net.dpml.metro.data
Class ComponentDirective

java.lang.Object
  extended by net.dpml.lang.AbstractDirective
      extended by net.dpml.metro.data.ComponentDirective
All Implemented Interfaces:
Serializable, Comparable, Directive

public class ComponentDirective
extends AbstractDirective
implements Comparable, Directive

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.avalon.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>

</component>

Version:
1.0.4
Author:
Digital Product Meta Library
See Also:
Serialized Form

Constructor Summary
ComponentDirective(String name, ActivationPolicy activation, CollectionPolicy collection, LifestylePolicy lifestyle, String classname, CategoriesDirective categories, ContextDirective context, PartReference[] parts, URI uri)
          Creation of a new deployment profile.
ComponentDirective(String name, String classname)
          Creation of a new profile.
 
Method Summary
 int compareTo(Object object)
          Compare this object with the supplied object.
 boolean equals(Object other)
          Test if the supplied object is equal to this object.
 ActivationPolicy getActivationPolicy()
          Get the activation policy for the profile.
 ComponentDirective getBaseDirective()
          Return the base directive.
 DefaultComposition getBasePart()
          Return the base part.
 URI getBaseURI()
          Return the base directive uri.
 CategoriesDirective getCategoriesDirective()
          Return the logging categories for the profile.
 String getClassname()
          Return the component type classname.
 CollectionPolicy getCollectionPolicy()
          Return the component collection policy.
 ContextDirective getContextDirective()
          Return the context directive for the profile.
 Directive getDirective(String key)
          Retrieve an identified directive.
 LifestylePolicy getLifestylePolicy()
          Return the component lifestyle policy.
 String getName()
          Return the profile name.
 PartReference[] getPartReferences()
          Returns the parts declared by this component type.
 int hashCode()
          Return the hashcode for the instance.
 String toString()
          Returns a string representation of the profile.
 
Methods inherited from class net.dpml.lang.AbstractDirective
equals, hashArray, hashValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ComponentDirective

public ComponentDirective(String name,
                          String classname)
                   throws IOException
Creation of a new profile.

Parameters:
name - the name to assign to the component deployment scenario
classname - the classname of the component type
Throws:
IOException - if an IO exception occurs

ComponentDirective

public ComponentDirective(String name,
                          ActivationPolicy activation,
                          CollectionPolicy collection,
                          LifestylePolicy lifestyle,
                          String classname,
                          CategoriesDirective categories,
                          ContextDirective context,
                          PartReference[] parts,
                          URI uri)
                   throws IOException
Creation of a new deployment profile.

Parameters:
name - the name to assign to the created profile
activation - the component activation policy
collection - the component garbage collection policy
lifestyle - the component lifestyle policy
classname - the component classname
categories - logging categories
context - context directive
parts - the component internal parts
uri - URI of the component super-definition
Throws:
IOException - if an IO exception occurs
Method Detail

getPartReferences

public PartReference[] getPartReferences()
Returns the parts declared by this component type.

Returns:
the part descriptors

getDirective

public Directive getDirective(String key)
Retrieve an identified directive.

Parameters:
key - the directive key
Returns:
the directive or null if the directive key is unknown

getName

public String getName()
Return the profile name.

Returns:
the name of the component.

getCategoriesDirective

public CategoriesDirective getCategoriesDirective()
Return the logging categories for the profile.

Returns:
the categories

getActivationPolicy

public ActivationPolicy getActivationPolicy()
Get the activation policy for the profile.

Returns:
the declared activation policy
See Also:
ActivationPolicy.SYSTEM, ActivationPolicy.STARTUP, ActivationPolicy.DEMAND

getClassname

public String getClassname()
Return the component type classname.

Returns:
classname of the component type

getLifestylePolicy

public LifestylePolicy getLifestylePolicy()
Return the component lifestyle policy.

Returns:
the lifestyle policy value

getCollectionPolicy

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

Returns:
a HARD, WEAK, SOFT or SYSTEM

getContextDirective

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

Returns:
the ContextDirective for the profile.

getBaseURI

public URI getBaseURI()
Return the base directive uri.

Returns:
the uri of the base directive

getBaseDirective

public ComponentDirective getBaseDirective()
Return the base directive.

Returns:
the base directive

getBasePart

public DefaultComposition getBasePart()
Return the base part.

Returns:
the base part

toString

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

Overrides:
toString in class Object
Returns:
a string representation

compareTo

public int compareTo(Object object)
Compare this object with the supplied object.

Specified by:
compareTo in interface Comparable
Parameters:
object - the object to compare with
Returns:
the result

equals

public boolean equals(Object other)
Test if the supplied object is equal to this object.

Overrides:
equals in class AbstractDirective
Parameters:
other - the object to compare with this instance
Returns:
TRUE if the supplied object is equal to this object

hashCode

public int hashCode()
Return the hashcode for the instance.

Overrides:
hashCode in class AbstractDirective
Returns:
the instance hashcode