org.apache.avalon.meta.info
Class ContextDescriptor

java.lang.Object
  extended byorg.apache.avalon.meta.info.Descriptor
      extended byorg.apache.avalon.meta.info.ContextDescriptor
All Implemented Interfaces:
Serializable

public class ContextDescriptor
extends Descriptor

A descriptor describing the Context that the Component is passed to describe information about Runtime environment of Component. It contains information such as;

Also associated with each Context is a set of arbitrary attributes that can be used to store extra information about Context requirements.

Version:
$Revision: 1.9 $ $Date: 2003/09/09 22:00:42 $
Author:
Avalon Development Team
See Also:
Serialized Form

Field Summary
static String AVALON_CONTEXT_CLASSNAME
          Context interface classname.
static String CLASSLOADER_KEY
          The context entry key for accessing a component classloader.
static String HOME_KEY
          The context entry key for accessing a component home directory.
static String NAME_KEY
          The context entry key for accessing a component name.
static String PARTITION_KEY
          The context entry key for accessing a component partition name.
static String STRATEGY_KEY
          Context attribute key used to declare a custom contextualization interface.
static String TEMP_KEY
          The context entry key for accessing a component temporary directory.
 
Constructor Summary
ContextDescriptor(EntryDescriptor[] entries)
          Create a standard descriptor without attributes.
ContextDescriptor(String classname, EntryDescriptor[] entries)
          Create a descriptor without attributes.
ContextDescriptor(String classname, EntryDescriptor[] entries, Properties attributes)
          Create a descriptor.
 
Method Summary
 boolean equals(Object other)
          Test is the supplied object is equal to this object.
 String getContextInterfaceClassname()
          Return the classname of the context object interface that the supplied context argument supports under a type-safe cast.
 EntryDescriptor[] getEntries()
          Return the local entries contained in the context.
 EntryDescriptor getEntry(String alias)
          Return the entry with specified alias.
 int hashCode()
          Return the hashcode for the object.
 EntryDescriptor[] merge(EntryDescriptor[] entries)
          Returns a set of entry descriptors resulting from a merge of the descriptors container in this descriptor with the supplied descriptors.
 
Methods inherited from class org.apache.avalon.meta.info.Descriptor
getAttribute, getAttribute, getAttributeNames, getProperties
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME_KEY

public static final String NAME_KEY
The context entry key for accessing a component name.

See Also:
Constant Field Values

PARTITION_KEY

public static final String PARTITION_KEY
The context entry key for accessing a component partition name.

See Also:
Constant Field Values

HOME_KEY

public static final String HOME_KEY
The context entry key for accessing a component home directory.

See Also:
Constant Field Values

TEMP_KEY

public static final String TEMP_KEY
The context entry key for accessing a component temporary directory.

See Also:
Constant Field Values

CLASSLOADER_KEY

public static final String CLASSLOADER_KEY
The context entry key for accessing a component classloader.

See Also:
Constant Field Values

STRATEGY_KEY

public static final String STRATEGY_KEY
Context attribute key used to declare a custom contextualization interface.

See Also:
Constant Field Values

AVALON_CONTEXT_CLASSNAME

public static final String AVALON_CONTEXT_CLASSNAME
Context interface classname.

See Also:
Constant Field Values
Constructor Detail

ContextDescriptor

public ContextDescriptor(EntryDescriptor[] entries)
Create a standard descriptor without attributes.

Parameters:
entries - the set of entries required within the context

ContextDescriptor

public ContextDescriptor(String classname,
                         EntryDescriptor[] entries)
Create a descriptor without attributes.

Parameters:
classname - the classname of a castable interface
entries - the set of entries required within the context

ContextDescriptor

public ContextDescriptor(String classname,
                         EntryDescriptor[] entries,
                         Properties attributes)
                  throws NullPointerException,
                         IllegalArgumentException
Create a descriptor.

Parameters:
classname - the classname of a castable interface
entries - the set of entries required within the context
attributes - supplimentary attributes associated with the context
Throws:
NullPointerException - if the entries argument is null
IllegalArgumentException
Method Detail

getContextInterfaceClassname

public String getContextInterfaceClassname()
Return the classname of the context object interface that the supplied context argument supports under a type-safe cast.

Returns:
the reference descriptor.

getEntries

public EntryDescriptor[] getEntries()
Return the local entries contained in the context.

Returns:
the entries contained in the context.

getEntry

public EntryDescriptor getEntry(String alias)
Return the entry with specified alias. If the entry does not declare an alias the method will return an entry with the matching key.

Parameters:
alias - the context entry key to lookup
Returns:
the entry with specified key.

merge

public EntryDescriptor[] merge(EntryDescriptor[] entries)
                        throws IllegalArgumentException
Returns a set of entry descriptors resulting from a merge of the descriptors container in this descriptor with the supplied descriptors.

Parameters:
entries - the entries to merge
Returns:
the mergerged set of entries
Throws:
IllegalArgumentException - if a entry conflict occurs

equals

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

Overrides:
equals in class Descriptor
Parameters:
other - the object to compare this object with
Returns:
true if the object are equivalent

hashCode

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

Overrides:
hashCode in class Descriptor
Returns:
the hashcode value


Copyright © Apache Software Foundation. All Rights Reserved.