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); } }
@Override public void populateRoots(Set<File> roots) throws IOException { if (fs instanceof DiskFileSystem) { roots.add(((DiskFileSystem)fs).getRoot()); } }
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) { URLFileSystem fs = new URLFileSystem(); fs.add(url); fs.copy(sourcePath, sourcePath.getPath(packageName));
sourcePathMap.put(context, sourcePath = new DiskFileSystem(dir)); log.info("Found cached source path " + sourcePath.getDescription() + " for package " + context.getPackageName());
assertEquals(null, error.getCode()); assertEquals(Collections.<String>emptyList(), error.getArguments()); assertEquals(fs.getPath("compiler", "annotationexception", "A.java"), error.getSourceFile()); assertTrue(error.getMessage().contains("the_message")); assertNotNull(error.getSourceFile());
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) { URLFileSystem fs = new URLFileSystem(); fs.add(url); fs.copy(sourcePath, sourcePath.getPath(packageName));
sourcePathMap.put(context, sourcePath = new DiskFileSystem(dir)); log.info("Found cached source path " + sourcePath.getDescription() + " for package " + context.getPackageName());
assertEquals(null, error.getCode()); assertEquals(Collections.<String>emptyList(), error.getArguments()); assertEquals(fs.getPath("compiler", "annotationexception", "A.java"), error.getSourceFile()); assertTrue(error.getMessage().contains("the_message")); assertNotNull(error.getSourceFile());
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); } }
@Override public void populateRoots(Set<File> roots) throws IOException { if (fs instanceof DiskFileSystem) { roots.add(((DiskFileSystem)fs).getRoot()); } }
public static DiskFileSystem diskFS(Name packageName) { File root = new File(System.getProperty("juzu.test.resources.path")); return new DiskFileSystem(root, packageName); }
@Override public void processAnnotationChange(ModuleMetaModel metaModel, AnnotationChange change) { ElementHandle<?> elt = change.getKey().getElement(); if (elt instanceof ElementHandle.Package) { ElementHandle.Package pkgElt = (ElementHandle.Package)elt; DiskFileSystem fs = metaModel.getProcessingContext().getSourcePath(pkgElt); if (fs != null) { metaModel.root = fs.getRoot(); } } super.processAnnotationChange(metaModel, change); }
public static DiskFileSystem diskFS(String packageName) { File root = new File(System.getProperty("juzu.test.resources.path")); return new DiskFileSystem(root, packageName); }
@Override public void processAnnotationChange(ModuleMetaModel metaModel, AnnotationChange change) { ElementHandle<?> elt = change.getKey().getElement(); if (elt instanceof ElementHandle.Package) { ElementHandle.Package pkgElt = (ElementHandle.Package)elt; DiskFileSystem fs = metaModel.getProcessingContext().getSourcePath(pkgElt); if (fs != null) { metaModel.root = fs.getRoot(); } } super.processAnnotationChange(metaModel, change); }
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 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);
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()); }