@Override protected Enumeration findResources( String name ) throws IOException { Enumeration enu = super.findResources( name ); return enu; }
/** * Gets the {@link VirtualFile} representation of this {@link FilePath} * * @since 1.532 */ public VirtualFile toVirtualFile() { return VirtualFile.forFilePath(this); }
private static void collectFiles(VirtualFile d, Collection<String> names, String prefix) throws IOException { for (VirtualFile child : d.list()) { if (child.isFile()) { names.add(prefix + child.getName()); } else if (child.isDirectory()) { collectFiles(child, names, prefix + child.getName() + "/"); } } } }
/** * May be overridden to provide an alternate executor service. * @return by default, {@link Timer#get} */ protected ExecutorService executorService() { return Timer.get(); }
public static BuildListener wrap(TaskListener l) { if (l instanceof BuildListener) { return (BuildListener) l; } else { return new BuildListenerAdapter(l); } } }
@Override public Collection<String> list(String includes, String excludes, boolean useDefaultExcludes) throws IOException { if (isIllegalSymlink()) { return Collections.emptySet(); } return new Scanner(includes, excludes, useDefaultExcludes).invoke(f, null); } @Override public VirtualFile child(String name) {
@Override public boolean isFile() throws IOException { // TODO should probably introduce a method for this purpose return exists() && !isDirectory(); } @Override public boolean exists() throws IOException {
/** * Returns a <code>String</code> representing this loader. * @return the path that this classloader has. */ public String toString() { return "AntClassLoader[" + getClasspath() + "]"; }
/** * Creates a virtual file wrapper for a local file. * @param f a disk file (need not exist) * @return a wrapper */ public static VirtualFile forFile(final File f) { return new FileVF(f, f); } private static final class FileVF extends VirtualFile {
@Override public InputStream getResourceAsStream( String name ) { InputStream is = super.getResourceAsStream( name ); return is; } }
/** * Create an Ant Class Loader */ public AntClassLoader() { setParent(null); }
/** * Returns an enumeration of URLs representing all the resources with the * given name by searching the class loader's classpath. * * @param name The resource name to search for. * Must not be <code>null</code>. * @return an enumeration of URLs for the resources * @exception IOException if I/O errors occurs (can't happen) */ protected Enumeration/*<URL>*/ findResources(String name) throws IOException { return findResources(name, true); }
/** * Creates a virtual file wrapper for a remotable file. * @param f a local or remote file (need not exist) * @return a wrapper */ public static VirtualFile forFilePath(final FilePath f) { return new FilePathVF(f, f); } private static final class FilePathVF extends VirtualFile {
/** * Cleans up any resources held by this classloader at the end * of a build. * * @param event the buildFinished event */ public void buildFinished(BuildEvent event) { cleanup(); }
/** * Interns a string. */ public TreeString intern(final String s) { if (s==null) return null; return root.intern(s).node; }
@Override public URL getResource( String arg0 ) { URL url = super.getResource( arg0 ); return url; }
/** * Constructs a new enumeration of resources of the given name found * within this class loader's classpath. * * @param name the name of the resource to search for. */ ResourceEnumeration(String name) { this.resourceName = name; this.pathElementsIndex = 0; findNextResource(); }
public void addPathFiles(Collection<File> paths) throws IOException { for (File f : paths) addPathFile(f); }
@Override protected Enumeration findResources( String arg0, boolean arg1 ) throws IOException { Enumeration enu = super.findResources( arg0, arg1 ); return enu; }