xdoclet.util
Class ClasspathManager

java.lang.Object
  |
  +--xdoclet.util.ClasspathManager

public class ClasspathManager
extends Object

Finds directories and jars on the classpath.

Version:
$Revision: 1.13 $
Author:
Aslak Hellesøy

Nested Class Summary
static class ClasspathManager.DirFilter
           
static class ClasspathManager.FileFilterPredicate
          Adapter class that makes it possible to use a class as both a Commons Collections Predicate and FileFilter.
static class ClasspathManager.JarFilter
           
 
Field Summary
static ClasspathManager.DirFilter DIR_FILTER
           
static ClasspathManager.JarFilter JAR_FILTER
           
static String PATH_DELIM
           
 
Constructor Summary
ClasspathManager(String classpath)
          Constructs a new ClasspathManager.
 
Method Summary
 List findJavaBeans()
          Returns all Java Bean classes on the classpath.
static List findJavaBeans(ClassLoader beanClassLoader, File dirOrJar)
          Returns a collection of classes that are Java Beans.
 String getClasspath()
          Gets the classpath where plugins are looked for.
 Collection getDirectories()
          Returns the existing directories on the classpath.
 Collection getFiles()
          Gets all the files on the classpath that exist, both directories and files.
 Collection getJars()
          Returns the existing zip/jar files on the classpath.
static String getNiceClasspath(String classpath)
           
static String getPackage(Class clazz)
           
 URL getResource(String relativePath)
          Returns a resource from the classpath, taking the first it finds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JAR_FILTER

public static final ClasspathManager.JarFilter JAR_FILTER

DIR_FILTER

public static final ClasspathManager.DirFilter DIR_FILTER

PATH_DELIM

public static final String PATH_DELIM
Constructor Detail

ClasspathManager

public ClasspathManager(String classpath)
Constructs a new ClasspathManager.

Parameters:
classpath - where plugin jars and directories will be searched for
Method Detail

getNiceClasspath

public static String getNiceClasspath(String classpath)

getFiles

public Collection getFiles()
Gets all the files on the classpath that exist, both directories and files.

Returns:
Collection of File

getJars

public final Collection getJars()
Returns the existing zip/jar files on the classpath.

Returns:
a Collection of File

getDirectories

public final Collection getDirectories()
Returns the existing directories on the classpath.

Returns:
a Collection of File

getResource

public URL getResource(String relativePath)
Returns a resource from the classpath, taking the first it finds.

Parameters:
relativePath -
Returns:
an URL to the resource or null if not found.

getClasspath

public String getClasspath()
Gets the classpath where plugins are looked for.

Returns:
the classpath where plugins are looked for.

findJavaBeans

public List findJavaBeans()
Returns all Java Bean classes on the classpath.

Returns:
a List of Class.

findJavaBeans

public static List findJavaBeans(ClassLoader beanClassLoader,
                                 File dirOrJar)
Returns a collection of classes that are Java Beans. The Java Bean classes are found by looking at the MANIFEST.MF file.

Parameters:
beanClassLoader - the ClassLoader used to load the bean classes.
dirOrJar - the directory of jar file containing the classes.
Returns:
a Collection of Class.

getPackage

public static String getPackage(Class clazz)


Copyright © 2000-2003 XDoclet Team. All Rights Reserved.