com.caucho.loader
Class SimpleLoader

java.lang.Object
  extended by com.caucho.loader.Loader
      extended by com.caucho.loader.SimpleLoader

public class SimpleLoader
extends Loader

Class loader which checks for changes in class files and automatically picks up new jars.


Constructor Summary
SimpleLoader()
          Null constructor for the simple loader.
SimpleLoader(Path path)
          Creates the simple loader with the specified path.
SimpleLoader(Path path, java.lang.String prefix)
          Creates the simple loader with the specified path and prefix.
 
Method Summary
protected  void buildClassPath(java.util.ArrayList<java.lang.String> pathList)
          Adds the class of this resource.
static DynamicClassLoader create(java.lang.ClassLoader parent, Path path)
          Create a class loader based on the SimpleLoader
static DynamicClassLoader create(java.lang.ClassLoader parent, Path path, java.lang.String prefix)
          Create a class loader based on the SimpleLoader
static DynamicClassLoader create(Path path)
          Create a class loader based on the SimpleLoader
protected  java.security.CodeSource getCodeSource(Path path)
          Returns the code source for the directory.
 Path getPath()
          Gets the resource path.
 Path getPath(java.lang.String name)
          Given a class or resource name, returns a patch to that resource.
 java.lang.String getPrefix()
          Gets the resource prefix
 void init()
          Initializes the loader.
 void setLoader(DynamicClassLoader loader)
          Sets the owning class loader.
 void setPath(Path path)
          Sets the resource directory.
 void setPrefix(java.lang.String prefix)
          Sets the resource prefix
 java.lang.String toString()
          Returns a printable representation of the loader.
 
Methods inherited from class com.caucho.loader.Loader
buildClassPath, buildSourcePath, buildSourcePath, destroy, getClassEntry, getLoader, getResource, getResourceAsStream, getResources, loadClass, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleLoader

public SimpleLoader()
Null constructor for the simple loader.


SimpleLoader

public SimpleLoader(Path path)
Creates the simple loader with the specified path.

Parameters:
path - specifying the root of the resources

SimpleLoader

public SimpleLoader(Path path,
                    java.lang.String prefix)
Creates the simple loader with the specified path and prefix.

Parameters:
path - specifying the root of the resources
prefix - the prefix that the resources must match
Method Detail

create

public static DynamicClassLoader create(java.lang.ClassLoader parent,
                                        Path path,
                                        java.lang.String prefix)
Create a class loader based on the SimpleLoader

Parameters:
parent - parent class loader
path - traditional classpath
prefix - the class prefix restriction
Returns:
the new ClassLoader

create

public static DynamicClassLoader create(java.lang.ClassLoader parent,
                                        Path path)
Create a class loader based on the SimpleLoader

Parameters:
parent - parent class loader
path - traditional classpath
Returns:
the new ClassLoader

create

public static DynamicClassLoader create(Path path)
Create a class loader based on the SimpleLoader

Parameters:
path - traditional classpath
Returns:
the new ClassLoader

setPath

public void setPath(Path path)
Sets the resource directory.


getPath

public Path getPath()
Gets the resource path.


setPrefix

public void setPrefix(java.lang.String prefix)
Sets the resource prefix


getPrefix

public java.lang.String getPrefix()
Gets the resource prefix


setLoader

public void setLoader(DynamicClassLoader loader)
Sets the owning class loader.

Overrides:
setLoader in class Loader

init

public void init()
          throws ConfigException
Initializes the loader.

Throws:
ConfigException

getPath

public Path getPath(java.lang.String name)
Given a class or resource name, returns a patch to that resource.

Overrides:
getPath in class Loader
Parameters:
name - the class or resource name.
Returns:
the path representing the class or resource.

getCodeSource

protected java.security.CodeSource getCodeSource(Path path)
Returns the code source for the directory.

Overrides:
getCodeSource in class Loader

buildClassPath

protected void buildClassPath(java.util.ArrayList<java.lang.String> pathList)
Adds the class of this resource.

Overrides:
buildClassPath in class Loader

toString

public java.lang.String toString()
Returns a printable representation of the loader.

Overrides:
toString in class java.lang.Object