org.apache.avalon.composition.model.impl
Class DefaultClassLoaderModel

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.avalon.composition.model.impl.DefaultClassLoaderModel
All Implemented Interfaces:
ClassLoaderModel, LogEnabled

public class DefaultClassLoaderModel
extends AbstractLogEnabled
implements ClassLoaderModel

Implementation of a classloader model within which a repository, a base directory and a classloader directive are associated together enabling the creation of a fully qualified classpath.

The classpath established by this model implementation applies the following logic:

Class dependecies include the Excalibur i18n, the assembly repository package, the avalon framework and meta packages, and the extensions package.

Version:
$Revision: 1.4 $ $Date: 2003/12/16 01:34:55 $
Author:
Avalon Development Team

Constructor Summary
DefaultClassLoaderModel(ClassLoaderContext context)
          Creation of a new classloader model.
 
Method Summary
 ClassLoaderContext createChildContext(Logger logger, ContainmentProfile profile, URL[] implied)
          Creation of a classloader context using this model as the relative parent.
static ClassLoaderModel createClassLoaderModel(ClassLoaderContext context)
           
 File[] expandFileSetDirectives(File base, FilesetDirective[] filesets)
          Return an array of files corresponding to the expansion of the filesets declared within the directive.
 ClassLoader getClassLoader()
          Return the classloader established by this classloader model.
 ExtensionManager getExtensionManager()
          Return the optional extensions manager.
 OptionalPackage[] getOptionalPackages()
          Return the set of local established optional packages.
 OptionalPackage[] getOptionalPackages(boolean policy)
          Return the set of optional packages already established including the optional packages established by any parent classloader model.
 URL[] getQualifiedClassPath()
          Return the fully qualified classpath including extension jar files resolved relative to the classpath directives in the meta-data and any parent classloader models.
 ServiceRepository getServiceRepository()
          Return the classloader model service repository.
 TypeRepository getTypeRepository()
          Return the type repository managed by this containment context.
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultClassLoaderModel

public DefaultClassLoaderModel(ClassLoaderContext context)
                        throws ModelException
Creation of a new classloader model. The model associated a repository, a base directory and a classloader directive enabling the creation of a fully populated classpath.

Parameters:
context - the classloader context
Method Detail

createClassLoaderModel

public static ClassLoaderModel createClassLoaderModel(ClassLoaderContext context)
                                               throws ModelException
Throws:
ModelException

createChildContext

public ClassLoaderContext createChildContext(Logger logger,
                                             ContainmentProfile profile,
                                             URL[] implied)
Creation of a classloader context using this model as the relative parent.

Specified by:
createChildContext in interface ClassLoaderModel
Parameters:
logger - the loggiong channel
profile - the profile directive
implied - a sequence of implied urls
Returns:
a new classloader context

getTypeRepository

public TypeRepository getTypeRepository()
Return the type repository managed by this containment context.

Specified by:
getTypeRepository in interface ClassLoaderModel
Returns:
the repository

getServiceRepository

public ServiceRepository getServiceRepository()
Return the classloader model service repository.

Specified by:
getServiceRepository in interface ClassLoaderModel
Returns:
the repository

getExtensionManager

public ExtensionManager getExtensionManager()
Return the optional extensions manager.

Specified by:
getExtensionManager in interface ClassLoaderModel
Returns:
the extension manager

getOptionalPackages

public OptionalPackage[] getOptionalPackages()
Return the set of local established optional packages.

Specified by:
getOptionalPackages in interface ClassLoaderModel
Returns:
the local set of optional packages

getOptionalPackages

public OptionalPackage[] getOptionalPackages(boolean policy)
Return the set of optional packages already established including the optional packages established by any parent classloader model.

Specified by:
getOptionalPackages in interface ClassLoaderModel
Parameters:
policy - if TRUE, return the local and all ancestor optional package - if FALSE only return the local packages
Returns:
the OptionalPackage instances

getQualifiedClassPath

public URL[] getQualifiedClassPath()
Return the fully qualified classpath including extension jar files resolved relative to the classpath directives in the meta-data and any parent classloader models.

Specified by:
getQualifiedClassPath in interface ClassLoaderModel
Returns:
an array of URL representing the complete classpath

getClassLoader

public ClassLoader getClassLoader()
Return the classloader established by this classloader model.

Specified by:
getClassLoader in interface ClassLoaderModel
Returns:
the classloader

expandFileSetDirectives

public File[] expandFileSetDirectives(File base,
                                      FilesetDirective[] filesets)
                               throws IOException
Return an array of files corresponding to the expansion of the filesets declared within the directive.

Parameters:
base - the base directory against which relative file references will be resolved
Returns:
the classpath
Throws:
IOException


Copyright © Apache Software Foundation. All Rights Reserved.