org.openbp.common.classloader
Class XClassLoaderConfiguration

java.lang.Object
  extended by org.openbp.common.classloader.XClassLoaderConfiguration
All Implemented Interfaces:
java.lang.Cloneable

public class XClassLoaderConfiguration
extends java.lang.Object
implements java.lang.Cloneable

This class contains all information that is necessary to create a class loader. The information is concentrated here to allow a proper construction of the class loader. Without this class, it would be hard to design the class loader in a way, that is multi-threaded to use because it is hard to decide, whether the class loader is fully initialized (a call adding a directory to the class path would be possible at any time). To ensure, that a call changing the configuration of the class loader doesn't influence the class loader, the configuration is cloned when passed to a class loader, thus the configuration implements Cloneable

Author:
Falk Hartmann

Constructor Summary
XClassLoaderConfiguration()
          Default constrcutor.
 
Method Summary
 void addNonStandardPackage(java.lang.String packageName)
          Adds a package that should \bnot\b be loaded by the standard class loader.
 void addRepositories(java.lang.String repositoryList)
          This method adds a list of repository names, passed as string (each repository seperated by the standard File.pathSeparator from the others).
 void addRepository(java.lang.String repository)
          This method adds a single repository given by name to the list of repositories maintained by this configuration.
 void addStandardPackage(java.lang.String packageName)
          Adds a standard package that should be loaded by the standard class loader.
 java.lang.Object clone()
          Configuration's are cloneable, so clone is implemented as public method here.
 java.lang.String getName()
          This method returns the name to be used for the class loader.
 PackageList getNonStandardPackages()
          Returns the list of non-standard packages.
 java.lang.ClassLoader getParentClassLoader()
          This returns the parent class loader to be used.
 java.util.List getRepositories()
          This method returns the list of currently registered repositories.
 PackageList getStandardPackages()
          Returns the list of standard packages.
 boolean getTryStandardClassLoaderFirst()
          This method determines, whether the standard class loader should be tried before a lookup in the registered repositories.
 boolean isLoggingEnabled()
          Gets the flag if logging is to be done at all (calling loggers in class loaders may lead to stack overflows on log-related resource loading errors).
 void printDebug(XClassLoaderBase cl)
          Prints debug output to the given class loader's logger.
 void setLoggingEnabled(boolean loggingEnabled)
          Sets the flag if logging is to be done at all (calling loggers in class loaders may lead to stack overflows on log-related resource loading errors).
 void setName(java.lang.String name)
          This method sets the name for the class loader.
 void setParentClassLoader(java.lang.ClassLoader parentClassLoader)
          This method sets the parent class loader.
 void setTryStandardClassLoaderFirst(boolean tryStandardClassLoaderFirst)
          This method sets, whether the standard class loader should be tried before a lookup in the registered repositories.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XClassLoaderConfiguration

public XClassLoaderConfiguration()
Default constrcutor.

Method Detail

printDebug

public void printDebug(XClassLoaderBase cl)
Prints debug output to the given class loader's logger.

Parameters:
cl - Class loader

addStandardPackage

public void addStandardPackage(java.lang.String packageName)
Adds a standard package that should be loaded by the standard class loader.

Parameters:
packageName - Package name
If the package name ends with '*', it is treated as a wildcard and thus covers all sub packages of the package. Otherwise, the package name must match exactly.

addNonStandardPackage

public void addNonStandardPackage(java.lang.String packageName)
Adds a package that should \bnot\b be loaded by the standard class loader.

Parameters:
packageName - Package name
If the package name ends with '*', it is treated as a wildcard and thus covers all sub packages of the package. Otherwise, the package name must match exactly.

getStandardPackages

public PackageList getStandardPackages()
Returns the list of standard packages.

Returns:
The list of standard packages in this configuration

getNonStandardPackages

public PackageList getNonStandardPackages()
Returns the list of non-standard packages.

Returns:
The list of non-standard packages in this configuration

setTryStandardClassLoaderFirst

public void setTryStandardClassLoaderFirst(boolean tryStandardClassLoaderFirst)
This method sets, whether the standard class loader should be tried before a lookup in the registered repositories.

Parameters:
tryStandardClassLoaderFirst - If the standard loader should be tried first

getTryStandardClassLoaderFirst

public boolean getTryStandardClassLoaderFirst()
This method determines, whether the standard class loader should be tried before a lookup in the registered repositories.

Returns:
Whether the standard loader should be tried first

addRepositories

public void addRepositories(java.lang.String repositoryList)
This method adds a list of repository names, passed as string (each repository seperated by the standard File.pathSeparator from the others).

Parameters:
repositoryList - A list of repository names

addRepository

public void addRepository(java.lang.String repository)
This method adds a single repository given by name to the list of repositories maintained by this configuration.

Parameters:
repository - The repository to be added

getRepositories

public java.util.List getRepositories()
This method returns the list of currently registered repositories.

Returns:
The list of registered repositories

setName

public void setName(java.lang.String name)
This method sets the name for the class loader.

Parameters:
name - The name to be set

getName

public java.lang.String getName()
This method returns the name to be used for the class loader.

Returns:
The name to be used

setParentClassLoader

public void setParentClassLoader(java.lang.ClassLoader parentClassLoader)
This method sets the parent class loader.

Parameters:
parentClassLoader - The parent class loader to be set

getParentClassLoader

public java.lang.ClassLoader getParentClassLoader()
This returns the parent class loader to be used.

Returns:
The parent class loader to be used

isLoggingEnabled

public boolean isLoggingEnabled()
Gets the flag if logging is to be done at all (calling loggers in class loaders may lead to stack overflows on log-related resource loading errors).


setLoggingEnabled

public void setLoggingEnabled(boolean loggingEnabled)
Sets the flag if logging is to be done at all (calling loggers in class loaders may lead to stack overflows on log-related resource loading errors).


clone

public java.lang.Object clone()
Configuration's are cloneable, so clone is implemented as public method here.

Overrides:
clone in class java.lang.Object
Returns:
A clone of this configuration


Copyright © 2011. All Rights Reserved.