public static ReadFileSystem<?> create(URL url) throws IOException { String protocol = url.getProtocol(); if (protocol.equals("jar")) { String path = url.getPath(); int pos = path.lastIndexOf("!/"); URL nested = new URL(path.substring(0, pos)); if (nested.getProtocol().equals("file")) { return new JarFileSystem(url); } else { throw new IOException("Cannot handle nested jar URL " + url); } } else if (protocol.equals("file")) { File f; try { f = new File(url.toURI()); } catch (URISyntaxException e) { throw new IOException(e); } if (f.isDirectory()) { return new DiskFileSystem(f); } else { return new JarFileSystem(url); } } else { throw new IOException("Unsupported URL: " + url); } }
public static ReadFileSystem<?> create(URL url) throws IOException { String protocol = url.getProtocol(); if (protocol.equals("jar")) { String path = url.getPath(); int pos = path.lastIndexOf("!/"); URL nested = new URL(path.substring(0, pos)); if (nested.getProtocol().equals("file")) { return new JarFileSystem(url); } else { throw new IOException("Cannot handle nested jar URL " + url); } } else if (protocol.equals("file")) { File f; try { f = new File(url.toURI()); } catch (URISyntaxException e) { throw new IOException(e); } if (f.isDirectory()) { return new DiskFileSystem(f); } else { return new JarFileSystem(url); } } else { throw new IOException("Unsupported URL: " + url); } }
public static DiskFileSystem diskFS(Name packageName) { File root = new File(System.getProperty("juzu.test.resources.path")); return new DiskFileSystem(root, packageName); }
public static DiskFileSystem diskFS(Name packageName) { File root = new File(System.getProperty("juzu.test.resources.path")); return new DiskFileSystem(root, packageName); }
public static DiskFileSystem diskFS(String packageName) { File root = new File(System.getProperty("juzu.test.resources.path")); return new DiskFileSystem(root, packageName); }
public static DiskFileSystem diskFS(String packageName) { File root = new File(System.getProperty("juzu.test.resources.path")); return new DiskFileSystem(root, packageName); }
public final ReadFileSystem<?> getSourcePath() { if (sourcePath == null) { String sourcePathParam = getInitParameter(SOURCE_PATH); if (sourcePathParam != null) { sourcePath = new DiskFileSystem(new File(sourcePathParam)); } else { try { URL configURL = getClassLoader().getResource("juzu/config.json"); if (configURL != null) { String configValue = Tools.read(configURL); JSON config = (JSON)JSON.parse(configValue); String sourcePathValue = config.getString("sourcepath"); if (sourcePathValue != null) { File sourcePathRoot = new File(sourcePathValue); if (sourcePathRoot.isDirectory() && sourcePathRoot.exists()) { sourcePath = new DiskFileSystem(sourcePathRoot); } } } } catch (IOException e) { e.printStackTrace(); } } } return sourcePath; }
public final ReadFileSystem<?> getSourcePath() { if (sourcePath == null) { String sourcePathParam = getInitParameter(SOURCE_PATH); if (sourcePathParam != null) { sourcePath = new DiskFileSystem(new File(sourcePathParam)); } else { try { URL configURL = getClassLoader().getResource("juzu/config.json"); if (configURL != null) { String configValue = Tools.read(configURL); JSON config = (JSON)JSON.parse(configValue); String sourcePathValue = config.getString("sourcepath"); if (sourcePathValue != null) { File sourcePathRoot = new File(sourcePathValue); if (sourcePathRoot.isDirectory() && sourcePathRoot.exists()) { sourcePath = new DiskFileSystem(sourcePathRoot); } } } } catch (IOException e) { e.printStackTrace(); } } } return sourcePath; }
File root = new File(split.next()); if (root.isDirectory()) { sourcePath = new DiskFileSystem(root);
@Override protected ReadWriteFileSystem<File> create() throws IOException { File root = File.createTempFile("juzu", "test"); assertTrue(root.delete()); assertTrue(root.mkdir()); root.deleteOnExit(); return new DiskFileSystem(root); }
protected final void init(String pkg) throws Exception { File root = new File(AbstractInjectTestCase.class.getProtectionDomain().getCodeSource().getLocation().toURI()); assertTrue(root.exists()); assertTrue(root.isDirectory()); init(new DiskFileSystem(root, pkg), Thread.currentThread().getContextClassLoader()); }
@Override protected ReadWriteFileSystem<File> create() throws IOException { File root = File.createTempFile("juzu", "test"); assertTrue(root.delete()); assertTrue(root.mkdir()); root.deleteOnExit(); return new DiskFileSystem(root); }
protected final void init(String pkg) throws Exception { File root = new File(AbstractInjectTestCase.class.getProtectionDomain().getCodeSource().getLocation().toURI()); assertTrue(root.exists()); assertTrue(root.isDirectory()); init(new DiskFileSystem(root, pkg), Thread.currentThread().getContextClassLoader()); }
sourcePathMap.put(context, sourcePath = new DiskFileSystem(dir));
@Test public void testFoo() throws Exception { File root = new File(System.getProperty("juzu.test.resources.path")); assertNotNull(root); assertNotNull(root.isDirectory()); // doTest(new DiskFileSystem(root, "compiler.disk"), root); }
@Test public void testFoo() throws Exception { File root = new File(System.getProperty("juzu.test.resources.path")); assertNotNull(root); assertNotNull(root.isDirectory()); // doTest(new DiskFileSystem(root, "compiler.disk"), root); }
DiskFileSystem sourceOutput = new DiskFileSystem(sourceOutputDir); DiskFileSystem classOutput = new DiskFileSystem(classOutputDir); String relativePath = packageName.toString().replace('.', '/') + '/'; assertTrue(new File(sourcePathDir, relativePath).mkdirs()); DiskFileSystem sourcePath = new DiskFileSystem(sourcePathDir); URL url = Thread.currentThread().getContextClassLoader().getResource(relativePath); if (url == null) {
Assert.assertTrue(root.mkdirs()); root.deleteOnExit(); ReadWriteFileSystem classes = new DiskFileSystem(root); classOutput.copy(new Filter.Default<O>() { @Override
Assert.assertTrue(root.mkdirs()); root.deleteOnExit(); ReadWriteFileSystem classes = new DiskFileSystem(root); classOutput.copy(new Filter.Default<O>() { @Override
DiskFileSystem sourceOutput = new DiskFileSystem(sourceOutputDir); DiskFileSystem classOutput = new DiskFileSystem(classOutputDir); String relativePath = packageName.toString().replace('.', '/') + '/'; assertTrue(new File(sourcePathDir, relativePath).mkdirs()); DiskFileSystem sourcePath = new DiskFileSystem(sourcePathDir); URL url = Thread.currentThread().getContextClassLoader().getResource(relativePath); if (url == null) {