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

java.lang.Object
  extended byorg.apache.avalon.composition.model.impl.DefaultModel
      extended byorg.apache.avalon.composition.model.impl.DefaultContainmentModel
All Implemented Interfaces:
ContainmentModel, Model

public class DefaultContainmentModel
extends DefaultModel
implements ContainmentModel

Containment model implmentation within which composite models are aggregated as a part of a containment deployment model.

Version:
$Revision: 1.6 $ $Date: 2003/09/14 13:14:23 $
Author:
Avalon Development Team

Field Summary
 
Fields inherited from interface org.apache.avalon.composition.model.ContainmentModel
SEPERATOR
 
Constructor Summary
DefaultContainmentModel(ContainmentContext context)
          Creation of a new containment model.
 
Method Summary
 Model addModel(Profile profile)
          Addition of a new subsidiary model within the containment context using a supplied profile.
 Model addModel(URL url)
          Addition of a new subsidiary model within the containment context using a supplied profile url.
 CategoriesDirective getCategories()
          Return the logging categories.
 ClassLoaderModel getClassLoaderModel()
          Return the classloader model.
 ServiceDirective getExportDirective(Class clazz)
          Return the set of service export directives for a supplied class.
 ServiceDirective[] getExportDirectives()
          Return the set of service export mappings
 Model getModel(DependencyDescriptor dependency)
          Get a local model relative to a supplied service dependency.
 Model getModel(StageDescriptor stage)
          Return a model relative to a supplied stage descriptor.
 Model getModel(String path)
          Return a child model relative to a supplied name.
 Model[] getModels()
          Return the set of immediate child models nested within this model.
 String getPartition()
          Return the partition name established by this containment context.
 ServiceDescriptor[] getServices()
          Return the set of services produced by the model.
 boolean isaCandidate(DependencyDescriptor dependency)
          Return TRUE is this model is capable of supporting a supplied depedendency.
 boolean isaCandidate(StageDescriptor stage)
          Return TRUE is this model is capable of supporting a supplied stage dependency.
 void setCategories(CategoriesDirective categories)
          Set categories.
 String toString()
           
 
Methods inherited from class org.apache.avalon.composition.model.impl.DefaultModel
getLogger, getMode, getName, getPath, getQualifiedName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.avalon.composition.model.Model
getMode, getName, getPath, getQualifiedName
 

Constructor Detail

DefaultContainmentModel

public DefaultContainmentModel(ContainmentContext context)
                        throws ModelException
Creation of a new containment model.

Parameters:
context - the containment context that establishes the structural association of this containment model within a parent scope
Method Detail

getClassLoaderModel

public ClassLoaderModel getClassLoaderModel()
Return the classloader model.

Specified by:
getClassLoaderModel in interface ContainmentModel
Returns:
the classloader model

getServices

public ServiceDescriptor[] getServices()
Return the set of services produced by the model.

Specified by:
getServices in interface Model
Returns:
the services

isaCandidate

public boolean isaCandidate(DependencyDescriptor dependency)
Return TRUE is this model is capable of supporting a supplied depedendency.

Specified by:
isaCandidate in interface Model
Returns:
true if this model can fulfill the dependency

isaCandidate

public boolean isaCandidate(StageDescriptor stage)
Return TRUE is this model is capable of supporting a supplied stage dependency. The containment model implementation will allways return FALSE.

Specified by:
isaCandidate in interface Model
Returns:
FALSE containers don't export stage handling support

getCategories

public CategoriesDirective getCategories()
Return the logging categories.

Specified by:
getCategories in interface ContainmentModel
Returns:
the logging categories

setCategories

public void setCategories(CategoriesDirective categories)
Set categories.

Specified by:
setCategories in interface ContainmentModel
Parameters:
categories - the logging categories

addModel

public Model addModel(URL url)
               throws ModelException
Description copied from interface: ContainmentModel
Addition of a new subsidiary model within the containment context using a supplied profile url.

Specified by:
addModel in interface ContainmentModel
Parameters:
url - a containment profile url
Returns:
the model based on the derived profile
Throws:
ModelException - if an error occurs during model establishment

addModel

public Model addModel(Profile profile)
               throws ModelException
Description copied from interface: ContainmentModel
Addition of a new subsidiary model within the containment context using a supplied profile.

Specified by:
addModel in interface ContainmentModel
Parameters:
profile - a containment or deployment profile
Returns:
the model based on the supplied profile
Throws:
ModelException - if an error occurs during model establishment

getPartition

public String getPartition()
Return the partition name established by this containment context.

Specified by:
getPartition in interface ContainmentModel
Returns:
the partition name

getModels

public Model[] getModels()
Return the set of immediate child models nested within this model.

Specified by:
getModels in interface ContainmentModel
Returns:
the nested model

getModel

public Model getModel(String path)
Return a child model relative to a supplied name.

Specified by:
getModel in interface ContainmentModel
Parameters:
path - a relative or absolute path
Returns:
the named model or null if the name is unknown
Throws:
IllegalArgumentException - if the name if badly formed

getModel

public Model getModel(DependencyDescriptor dependency)
               throws ModelException
Get a local model relative to a supplied service dependency.

Specified by:
getModel in interface ContainmentModel
Parameters:
dependency - the service dependency descriptor
Returns:
a matching model or null if the dependency is unresolvable
Throws:
ModelException - if an error occurs during model creation

getModel

public Model getModel(StageDescriptor stage)
               throws ModelException
Return a model relative to a supplied stage descriptor.

Specified by:
getModel in interface ContainmentModel
Parameters:
stage - the stage descriptor
Returns:
model of a an stage handler or null if the stage is unresolvable
Throws:
ModelException - if an error occurs during model establishment

getExportDirectives

public ServiceDirective[] getExportDirectives()
Return the set of service export mappings

Specified by:
getExportDirectives in interface ContainmentModel
Returns:
the block implementation model

getExportDirective

public ServiceDirective getExportDirective(Class clazz)
Return the set of service export directives for a supplied class.

Specified by:
getExportDirective in interface ContainmentModel
Returns:
the export directives

toString

public String toString()
Overrides:
toString in class DefaultModel


Copyright © Apache Software Foundation. All Rights Reserved.