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

java.lang.Object
  extended byorg.apache.avalon.composition.model.impl.DefaultDeploymentModel
      extended byorg.apache.avalon.composition.model.impl.DefaultComponentModel
All Implemented Interfaces:
Commissionable, ComponentModel, DeploymentModel, Resolver

public class DefaultComponentModel
extends DefaultDeploymentModel
implements ComponentModel

Deployment model defintion.

Version:
$Revision: 1.17 $ $Date: 2004/03/17 10:39:10 $
Author:
Avalon Development Team

Field Summary
 
Fields inherited from interface org.apache.avalon.composition.model.DeploymentModel
DEPLOYMENT_TIMEOUT_KEY, SEPARATOR
 
Constructor Summary
DefaultComponentModel(ComponentContext context, SecurityModel security)
          Creation of a new deployment model.
 
Method Summary
 boolean getActivationPolicy()
          Return the activation policy for the model.
 int getCollectionPolicy()
          Return the collection policy for the model.
 Configuration getConfiguration()
          Return the configuration to be applied to the component.
 ContextModel getContextModel()
          Return the context model for this deployment model.
 boolean getDefaultActivationPolicy()
          Get the default activation policy for the model.
 DependencyModel getDependencyModel(DependencyDescriptor dependency)
          Return a dependency model matching the supplied descriptor.
 DependencyModel[] getDependencyModels()
          Return the dependency models for this component type.
 Class getDeploymentClass()
          Return the class for the deployable target.
 long getDeploymentTimeout()
          Return the deployment timeout value for the component.
 Class[] getInterfaces()
          Return the set of services produced by the model as a array of classes.
 Parameters getParameters()
          Return the parameters to be applied to the component.
 DeploymentModel[] getProviders()
          Return the set of models assigned as providers.
 ServiceDescriptor[] getServices()
          Return the set of services produced by the model.
 StageModel getStageModel(StageDescriptor stage)
          Return a stage model matching the supplied descriptor.
 StageModel[] getStageModels()
          Return the stage models for this component type.
 Type getType()
          Return the component type descriptor.
 boolean isaCandidate(DependencyDescriptor dependency)
          Return TRUE is this model is capable of supporting a supplied depedendency.
 boolean isaCandidate(ReferenceDescriptor reference)
          Return TRUE is this model is capable of supporting a supplied service.
 boolean isaCandidate(StageDescriptor stage)
          Return TRUE is this model is capable of supporting a supplied stage dependency.
 boolean isAssembled()
          Returns the assembled state of the model.
 boolean isConfigurable()
          Rest if the component type backing the model is configurable.
 boolean isParameterizable()
          Rest if the component type backing the model is parameterizable.
 void setActivationPolicy(boolean policy)
          Set the activation policy for the model.
 void setCollectionPolicy(int policy)
          Set the collection policy for the model.
 void setConfiguration(Configuration config)
          Set the configuration to the supplied value.
 void setConfiguration(Configuration config, boolean policy)
          Set the configuration to the supplied value.
 void setParameters(Parameters parameters)
          Set the parameters to the supplied value.
 void setParameters(Parameters parameters, boolean policy)
          Set the parameters to the supplied value.
 
Methods inherited from class org.apache.avalon.composition.model.impl.DefaultDeploymentModel
commission, decommission, equals, getAccessControlContext, getCategories, getConsumerGraph, getLogger, getMode, getName, getPath, getPermissions, getProviderGraph, getQualifiedName, release, resolve, resolve, setCategories, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.avalon.composition.model.DeploymentModel
getAccessControlContext, getCategories, getConsumerGraph, getLogger, getMode, getName, getPath, getProviderGraph, getQualifiedName, setCategories
 
Methods inherited from interface org.apache.avalon.composition.model.Commissionable
commission, decommission
 
Methods inherited from interface org.apache.avalon.composition.model.Resolver
release, resolve, resolve
 

Constructor Detail

DefaultComponentModel

public DefaultComponentModel(ComponentContext context,
                             SecurityModel security)
                      throws ModelException
Creation of a new deployment model.

Parameters:
context - the deployment context
Method Detail

getDefaultActivationPolicy

public boolean getDefaultActivationPolicy()
Get the default activation policy for the model.


isAssembled

public boolean isAssembled()
Returns the assembled state of the model.

Specified by:
isAssembled in interface DeploymentModel
Returns:
true if this model is assembled

getProviders

public DeploymentModel[] getProviders()
Return the set of models assigned as providers.

Specified by:
getProviders in interface DeploymentModel
Returns:
the providers consumed by the model
Throws:
IllegalStateException - if the model is not in an assembled state

getServices

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

Specified by:
getServices in interface DeploymentModel
Returns:
the service descriptors

isaCandidate

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

Specified by:
isaCandidate in interface DeploymentModel
Parameters:
dependency - the dependency descriptor
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.

Specified by:
isaCandidate in interface DeploymentModel
Parameters:
stage - the stage descriptor
Returns:
TRUE if this model can fulfill the stage dependency

isaCandidate

public boolean isaCandidate(ReferenceDescriptor reference)
Return TRUE is this model is capable of supporting a supplied service.

Specified by:
isaCandidate in interface DeploymentModel
Parameters:
reference - the service reference descriptor
Returns:
true if this model can fulfill the service

getCollectionPolicy

public int getCollectionPolicy()
Return the collection policy for the model. If a profile does not declare a collection policy, then the collection policy declared by the underlying component type will be used.

Specified by:
getCollectionPolicy in interface ComponentModel
Returns:
the collection policy
See Also:
InfoDescriptor.WEAK, InfoDescriptor.SOFT, InfoDescriptor.HARD, InfoDescriptor.UNDEFINED

setCollectionPolicy

public void setCollectionPolicy(int policy)
Set the collection policy for the model.

Specified by:
setCollectionPolicy in interface ComponentModel
Parameters:
policy - the collection policy
See Also:
InfoDescriptor.WEAK, InfoDescriptor.SOFT, InfoDescriptor.HARD

getActivationPolicy

public boolean getActivationPolicy()
Return the activation policy for the model.

Specified by:
getActivationPolicy in interface ComponentModel
Returns:
the activaltion policy

setActivationPolicy

public void setActivationPolicy(boolean policy)
Set the activation policy for the model.

Specified by:
setActivationPolicy in interface ComponentModel
Parameters:
policy - the activaltion policy

getType

public Type getType()
Return the component type descriptor.

Specified by:
getType in interface ComponentModel
Returns:
the type descriptor

getDeploymentClass

public Class getDeploymentClass()
Return the class for the deployable target.

Specified by:
getDeploymentClass in interface ComponentModel
Returns:
the class

isParameterizable

public boolean isParameterizable()
Rest if the component type backing the model is parameterizable.

Specified by:
isParameterizable in interface ComponentModel
Returns:
TRUE if the compoent type is parameterizable otherwise FALSE

setParameters

public void setParameters(Parameters parameters)
Set the parameters to the supplied value. The supplied parameters value will replace the existing parameters value.

Specified by:
setParameters in interface ComponentModel
Parameters:
parameters - the supplied parameters value
Throws:
IllegalStateException - if the component type backing the model does not implement the parameteriazable interface
NullPointerException - if the supplied parameters are null

setParameters

public void setParameters(Parameters parameters,
                          boolean policy)
                   throws IllegalStateException
Set the parameters to the supplied value. The supplied parameters value may suppliment or replace the existing parameters value.

Specified by:
setParameters in interface ComponentModel
Parameters:
parameters - the supplied parameters
policy - if TRUE the supplied parameters replaces the current parameters value otherwise the existing and supplied values are aggregrated
Throws:
IllegalStateException - if the component type backing the model does not implement the parameteriazable interface
NullPointerException - if the supplied parameters are null

getParameters

public Parameters getParameters()
Return the parameters to be applied to the component. If the the component type does not implementation the Parameterizable interface, the implementation returns null.

Specified by:
getParameters in interface ComponentModel
Returns:
the assigned parameters

isConfigurable

public boolean isConfigurable()
Rest if the component type backing the model is configurable.

Returns:
TRUE if the component type is configurable otherwise FALSE

setConfiguration

public void setConfiguration(Configuration config)
                      throws IllegalStateException,
                             NullPointerException
Set the configuration to the supplied value. The supplied configuration will replace the existing configuration.

Specified by:
setConfiguration in interface ComponentModel
Parameters:
config - the supplied configuration
Throws:
IllegalStateException - if the component type backing the model does not implement the configurable interface
NullPointerException - if the supplied configuration is null

setConfiguration

public void setConfiguration(Configuration config,
                             boolean policy)
                      throws IllegalStateException,
                             NullPointerException
Set the configuration to the supplied value. The supplied configuration may suppliment or replace the existing configuration.

Specified by:
setConfiguration in interface ComponentModel
Parameters:
config - the supplied configuration
policy - if TRUE the supplied configuration replaces the current configuration otherwise the resoved configuration shall be layed above the configuration supplied with the profile which in turn is layer above the type default configuration (if any)
Throws:
IllegalStateException - if the component type backing the model does not implement the configurable interface
NullPointerException - if the supplied configuration is null

getConfiguration

public Configuration getConfiguration()
Return the configuration to be applied to the component. The implementation returns the current configuration state. If the the component type does not implementation the Configurable interface, the implementation returns null.

Specified by:
getConfiguration in interface ComponentModel
Returns:
the qualified configuration

getContextModel

public ContextModel getContextModel()
Return the context model for this deployment model.

Specified by:
getContextModel in interface ComponentModel
Returns:
the context model if this model is context dependent, else the return value is null
See Also:
ContextModel.isEnabled()

getDependencyModels

public DependencyModel[] getDependencyModels()
Return the dependency models for this component type.

Specified by:
getDependencyModels in interface ComponentModel
Returns:
the dependency models

getDependencyModel

public DependencyModel getDependencyModel(DependencyDescriptor dependency)
Return a dependency model matching the supplied descriptor. If no model matches the supplied descriptor the implementation will return null.

Specified by:
getDependencyModel in interface ComponentModel
Parameters:
dependency - the dependency descriptor
Returns:
the matching stage model

getStageModels

public StageModel[] getStageModels()
Return the stage models for this component type.

Specified by:
getStageModels in interface ComponentModel
Returns:
the stage models

getStageModel

public StageModel getStageModel(StageDescriptor stage)
Return a stage model matching the supplied descriptor. If no stage model matches the supplied descriptor the implementation will return null.

Specified by:
getStageModel in interface ComponentModel
Parameters:
stage - the stage descriptor
Returns:
the matching stage model

getInterfaces

public Class[] getInterfaces()
Return the set of services produced by the model as a array of classes.

Specified by:
getInterfaces in interface ComponentModel
Returns:
the service classes

getDeploymentTimeout

public long getDeploymentTimeout()
Return the deployment timeout value for the component.

Specified by:
getDeploymentTimeout in interface DeploymentModel
Overrides:
getDeploymentTimeout in class DefaultDeploymentModel
Returns:
the default deployment timeout value


Copyright © The Apache Software Foundation. All Rights Reserved.