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.20 $ $Date: 2004/05/09 23:51:08 $
Author:
Avalon Development Team

Constructor Summary
DefaultClassLoaderModel(ClassLoaderContext context)
          Creation of a new classloader model.
 
Method Summary
 ClassLoaderModel createClassLoaderModel(Logger logger, ContainmentProfile profile, URL[] implied)
          Creation of a classloader model using this model as the relative parent.
 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.
 CodeSource[] 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 ClassLoaderModel createClassLoaderModel(Logger logger,
                                               ContainmentProfile profile,
                                               URL[] implied)
                                        throws ModelException
Creation of a classloader model using this model as the relative parent.

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

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 CodeSource[] 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. WARNING: lots of updates needed to properly populate the returned code source with certificates used to verify repository content which means updating the extension utilities and the repository package. Currently the code sources returned contain an empty certificates array.

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,
                                      IllegalStateException
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
IllegalStateException


Copyright © The Apache Software Foundation. All Rights Reserved.