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

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.avalon.composition.model.impl.DefaultDependent
          extended byorg.apache.avalon.composition.model.impl.DefaultContextModel
All Implemented Interfaces:
ContextModel, Dependent, LogEnabled

public class DefaultContextModel
extends DefaultDependent
implements ContextModel

Specification of a context model from which a a fully qualifed context can be established.

Version:
$Revision: 1.17 $ $Date: 2004/04/19 10:50:05 $
Author:
Avalon Development Team

Field Summary
static Class DEFAULT_CONTEXT_CLASS
          The default context implementation class to be used if no context class is defined.
 
Fields inherited from interface org.apache.avalon.composition.model.ContextModel
DEFAULT_STRATEGY_CLASSNAME
 
Constructor Summary
DefaultContextModel(Logger logger, ContextDescriptor descriptor, ContextDirective directive, ComponentContext context)
          Default implementation of the context model.
 
Method Summary
 Class getCastingClass()
          Return the class that the context is castable to.
 Object getContext()
          Return the context object established for the component.
 DeliveryDescriptor getDeliveryDescriptor()
          Return the delivery descriptor.
 EntryModel getEntryModel(String key)
          Return an entry model matching the supplied key.
 EntryModel[] getEntryModels()
          Return the set of entry models associated with this context model.
 Class getStrategyClass()
          Return the class representing the contextualization stage interface.
static boolean isaStandardKey(String key)
           
 boolean isEnabled()
          Return the enabled state of the context model.
 void setEntry(String key, Object value)
          Set the entry to a suplied value.
 void setEntryModel(String key, EntryModel model)
          Set the entry model relative to a supplied key.
 
Methods inherited from class org.apache.avalon.composition.model.impl.DefaultDependent
clearProvider, getProvider, setProvider
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.avalon.composition.model.Dependent
clearProvider, getProvider, setProvider
 

Field Detail

DEFAULT_CONTEXT_CLASS

public static final Class DEFAULT_CONTEXT_CLASS
The default context implementation class to be used if no context class is defined.

Constructor Detail

DefaultContextModel

public DefaultContextModel(Logger logger,
                           ContextDescriptor descriptor,
                           ContextDirective directive,
                           ComponentContext context)
                    throws ModelException

Default implementation of the context model. The implementation takes an inital system context as the base for context value establishment and uses this to set standard context entries.

Parameters:
logger - the logging channel
descriptor - the contextualization stage descriptor that describes the set of context entries that the component type is requesting
directive - the contextualization directive that describes a set of context entry creation strategies
context - the component model context argument
Method Detail

isaStandardKey

public static boolean isaStandardKey(String key)

isEnabled

public boolean isEnabled()
Description copied from interface: ContextModel
Return the enabled state of the context model.

Specified by:
isEnabled in interface ContextModel
Returns:
TRUE if enabled else FALSE

getDeliveryDescriptor

public DeliveryDescriptor getDeliveryDescriptor()
Return the delivery descriptor.

Specified by:
getDeliveryDescriptor in interface ContextModel
Returns:
the descriptor

getEntryModels

public EntryModel[] getEntryModels()
Return the set of entry models associated with this context model.

Specified by:
getEntryModels in interface ContextModel
Returns:
the entry models

getEntryModel

public EntryModel getEntryModel(String key)
Return an entry model matching the supplied key.

Specified by:
getEntryModel in interface ContextModel
Returns:
the entry model or null if tyhe key is unknown

setEntryModel

public void setEntryModel(String key,
                          EntryModel model)
Set the entry model relative to a supplied key.

Specified by:
setEntryModel in interface ContextModel
Parameters:
key - the entry key
model - the entry model

setEntry

public void setEntry(String key,
                     Object value)
Set the entry to a suplied value.

Specified by:
setEntry in interface ContextModel
Parameters:
key - the entry key
value - the entry value

getStrategyClass

public Class getStrategyClass()
Return the class representing the contextualization stage interface.

Specified by:
getStrategyClass in interface ContextModel
Returns:
the class representing the contextualization interface

getCastingClass

public Class getCastingClass()
Return the class that the context is castable to.

Specified by:
getCastingClass in interface ContextModel
Returns:
the base context casting class

getContext

public Object getContext()
Return the context object established for the component.

Specified by:
getContext in interface ContextModel
Returns:
the context object


Copyright © The Apache Software Foundation. All Rights Reserved.