1 19 20 package org.netbeans.modules.websvc.core.testutils; 21 22 import java.io.File ; 23 import java.net.URL ; 24 import java.util.ArrayList ; 25 import java.util.List ; 26 import org.openide.filesystems.FileSystem; 27 import org.openide.filesystems.LocalFileSystem; 28 import org.openide.filesystems.MultiFileSystem; 29 import org.openide.filesystems.Repository; 30 import org.openide.filesystems.XMLFileSystem; 31 import org.xml.sax.SAXException ; 32 33 37 public class RepositoryImpl extends Repository { 38 39 40 public RepositoryImpl() throws Exception { 41 super(mksystem()); 42 } 43 44 private static FileSystem mksystem() throws Exception { 45 LocalFileSystem lfs = new LocalFileSystem(); 46 File systemDir = new File (System.getProperty("websvc.core.test.repo.root")); 47 systemDir.mkdirs(); 48 lfs.setRootDirectory(systemDir); 49 lfs.setReadOnly(false); 50 List <FileSystem> layers = new ArrayList <FileSystem>(); 51 layers.add(lfs); 52 addLayer(layers, "org/netbeans/modules/java/j2seproject/ui/resources/layer.xml"); 58 addLayer(layers, "org/netbeans/modules/websvc/core/resources/mf-layer.xml"); 61 MultiFileSystem mfs = new MultiFileSystem((FileSystem[]) layers.toArray(new FileSystem[layers.size()])); 64 return mfs; 65 } 66 67 private static void addLayer(List <FileSystem> layers, String layerRes) throws SAXException { 68 URL layerFile = RepositoryImpl.class.getClassLoader().getResource(layerRes); 69 assert layerFile != null; 70 layers.add(new XMLFileSystem(layerFile)); 71 } 72 73 } 74 | Popular Tags |