001package org.nuxeo.webengine.gwt.codeserver; 002 003import java.io.File; 004import java.net.MalformedURLException; 005import java.net.URL; 006import java.util.ArrayList; 007import java.util.List; 008 009import org.nuxeo.common.xmap.annotation.XNode; 010import org.nuxeo.common.xmap.annotation.XObject; 011import org.nuxeo.ecm.core.api.NuxeoException; 012 013@XObject("classpath") 014public class CodeServerClasspath { 015 016 protected URL[] entries = new URL[0]; 017 018 @XNode 019 public void setLibdir(File dir) { 020 List<URL> entries = new ArrayList<URL>(); 021 for (File entry : dir.listFiles()) { 022 try { 023 entries.add(entry.toURI().toURL()); 024 } catch (MalformedURLException e) { 025 throw new NuxeoException("Cannot find location of " + entry); 026 } 027 } 028 this.entries = entries.toArray(new URL[entries.size()]); 029 } 030}