org.apache.avalon.composition.data
Class ComponentProfile

java.lang.Object
  extended byorg.apache.avalon.composition.data.DeploymentProfile
      extended byorg.apache.avalon.composition.data.ComponentProfile
All Implemented Interfaces:
Serializable

public class ComponentProfile
extends DeploymentProfile

Definition of the criteria for an explicit component profile. A profile, when included within the scope of a container declaration will be instantiated in the model as an EXPLICIT component profile resulting in the initiation of dependency resolution relative to the component as the target deployment objective. Multiple supplementary profiles may be packaged in a .xprofiles resources and will be assigned to the container automatically. In the absence of explicit or packaged profile directives, an implicit profile will be created for any component types declared under a jar manifest.

XML

A component element declares the profile to be applied during the instantiation of a component type. It includes a name and class declaration, logging directives (resolved relative to the component's container), context creation criteria, together with configuration or parameters information.

 <!--
 Declaration of the services hosted by this container.  Service container here
 will be managed relative to other provider components at the same level and
 may be serviced by components declared in parent container.
 -->

<component name="complex" class="org.apache.excalibur.playground.ComplexComponent" activation="startup">

  <!--
  Priority and target assignments for component specific logging categrories.
  -->

  <categories priority="DEBUG">
    <category name="init" priority="DEBUG" />
  </categories>

  <!--
  Context entry directives are normally only required in the case where the component
  type declares a required context type and entry values. Generally speaking, a component
  will normally qualify it's instantiation criteria through a configuration declaration.
  Any context values defined at this level will override context values supplied by the
  container.  The following two context directives for "location" and "home" demonstrate
  programatics creation of context values.  The first entry declares that the context
  value to be assigned to the key "location" shall be the String value "Paris".  The second
  context enty assignes the container's context value for "urn:avalon:home" to the component's
  context key of "home".
  -->

  <context>
    <entry key="location">Paris</entry>
    <include name="urn:avalon:home" key="home"/>
  </context>

  <!--
  Apply the following configuration when instantiating the component.  This configuration
  will be applied as the primary configuration in a cascading configuration chain.  A
  type may declare a default configuration under a "classname".xconfig file that will be
  used to dereference any configuration requests not resolvable by the configuration
  supplied here.
  -->

  <configuration>
    <message value="Hello"/>
  </configuration>

  <!--
  The parameterization criteria from this instance of the component type.
  -->

  <parameters/>

</component>

Version:
$Revision: 1.6 $ $Date: 2004/03/17 10:30:08 $
Author:
Avalon Development Team
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.avalon.composition.data.DeploymentProfile
DEFAULT, DISABLED, ENABLED
 
Constructor Summary
ComponentProfile(String name, ComponentProfile template)
          Creation of a new deployment profile using a supplied template profile.
ComponentProfile(String name, int activation, int collection, String classname, CategoriesDirective categories, ContextDirective context, DependencyDirective[] dependencies, StageDirective[] stages, Parameters parameters, Configuration config, Mode mode)
           
ComponentProfile(String name, String classname)
          Creation of a new profile using IMPLICT mode and LIBERAL collection policies.
 
Method Summary
 String getClassname()
          Return the component type classname.
 int getCollectionPolicy()
          Return the component collection policy.
 Configuration getConfiguration()
          Return the base Configuration for the profile.
 ContextDirective getContext()
          Return the context directive for the profile.
 DependencyDirective getDependencyDirective(String key)
          Return the dependency directive for a supplied key.
 DependencyDirective[] getDependencyDirectives()
          Return the dependency directives.
 Parameters getParameters()
          Return the Parameters for the profile.
 StageDirective getStageDirective(String key)
          Return the dependency directive for a supplied key.
 StageDirective[] getStageDirectives()
          Return the stage directives.
 String toString()
          Returns a string representation of the profile.
 
Methods inherited from class org.apache.avalon.composition.data.DeploymentProfile
getActivationDirective, getCategories, getMode, getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ComponentProfile

public ComponentProfile(String name,
                        String classname)
Creation of a new profile using IMPLICT mode and LIBERAL collection policies.

Parameters:
name - the name to assign to the component deployment scenario
classname - the classname of the component type

ComponentProfile

public ComponentProfile(String name,
                        ComponentProfile template)
Creation of a new deployment profile using a supplied template profile.

Parameters:
name - the name to assign to the created profile
template - the template deployment profile

ComponentProfile

public ComponentProfile(String name,
                        int activation,
                        int collection,
                        String classname,
                        CategoriesDirective categories,
                        ContextDirective context,
                        DependencyDirective[] dependencies,
                        StageDirective[] stages,
                        Parameters parameters,
                        Configuration config,
                        Mode mode)
Method Detail

getClassname

public String getClassname()
Return the component type classname.

Returns:
classname of the component type

getCollectionPolicy

public int getCollectionPolicy()
Return the component collection policy. If null, the component type collection policy will apply.

Returns:
a HARD, WEAK, SOFT or UNDEFINED

getContext

public ContextDirective getContext()
Return the context directive for the profile.

Returns:
the ContextDirective for the profile.

getDependencyDirectives

public DependencyDirective[] getDependencyDirectives()
Return the dependency directives.

Returns:
the set of DependencyDirective statements for the profile.

getDependencyDirective

public DependencyDirective getDependencyDirective(String key)
Return the dependency directive for a supplied key.

Returns:
the matching DependencyDirective (possibly null if no directive is declared for the given key)

getStageDirectives

public StageDirective[] getStageDirectives()
Return the stage directives.

Returns:
the set of StageDirective statements for the profile.

getStageDirective

public StageDirective getStageDirective(String key)
Return the dependency directive for a supplied key.

Returns:
the matching DependencyDirective (possibly null if no directive is declared for the given key)

getParameters

public Parameters getParameters()
Return the Parameters for the profile.

Returns:
the Parameters for Component (if any).

getConfiguration

public Configuration getConfiguration()
Return the base Configuration for the profile. The implementation garantees that the supplied configuration is not null.

Returns:
the base Configuration for profile.

toString

public String toString()
Returns a string representation of the profile.

Overrides:
toString in class DeploymentProfile
Returns:
a string representation


Copyright © The Apache Software Foundation. All Rights Reserved.