org.apache.avalon.excalibur.component
Class ExcaliburComponentSelector

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.avalon.excalibur.component.AbstractDualLogEnabled
          extended by org.apache.avalon.excalibur.component.ExcaliburComponentSelector
All Implemented Interfaces:
RoleManageable, org.apache.avalon.excalibur.logger.LoggerManageable, org.apache.avalon.excalibur.logger.LogKitManageable, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.component.Component, org.apache.avalon.framework.component.ComponentSelector, org.apache.avalon.framework.component.Composable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.logger.Loggable, org.apache.avalon.framework.thread.ThreadSafe, org.apache.excalibur.instrument.Instrumentable, org.apache.excalibur.instrument.InstrumentManageable
Direct Known Subclasses:
DefaultComponentSelector

Deprecated. ECM is no longer supported

public class ExcaliburComponentSelector
extends AbstractDualLogEnabled
implements org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.component.ComponentSelector, org.apache.avalon.framework.component.Composable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.thread.ThreadSafe, org.apache.avalon.framework.activity.Disposable, RoleManageable, org.apache.avalon.excalibur.logger.LogKitManageable, org.apache.avalon.excalibur.logger.LoggerManageable, org.apache.excalibur.instrument.InstrumentManageable, org.apache.excalibur.instrument.Instrumentable

Default component selector for Avalon's components.

Since:
4.0
Version:
CVS $Revision: 1.6 $ $Date: 2004/02/28 11:47:14 $
Author:
Avalon Development Team

Field Summary
private static java.lang.String DEFAULT_NAME
          Deprecated. The ComponentSelector's name for logging purposes.
private  java.util.Map m_componentHandlers
          Deprecated. Static component handlers.
private  org.apache.avalon.framework.component.ComponentManager m_componentManager
          Deprecated. The application context for components
private  java.util.Map m_componentMapping
          Deprecated. Dynamic component handlers mapping.
private  org.apache.avalon.framework.configuration.Configuration m_configuration
          Deprecated. Static configuraiton object.
protected  org.apache.avalon.framework.context.Context m_context
          Deprecated. The application context for components
private  boolean m_disposed
          Deprecated. Flag for if this is disposed or not.
private  boolean m_initialized
          Deprecated. Flag for if this is initialized or not.
private  java.lang.String m_instrumentableName
          Deprecated. Instrumentable Name assigned to this Instrumentable
private  org.apache.excalibur.instrument.InstrumentManager m_instrumentManager
          Deprecated. Instrument Manager to register objects created by this selector with (May be null).
private  java.lang.ClassLoader m_loader
          Deprecated. The classloader used for this system.
private  LogkitLoggerManager m_logkit
          Deprecated. The RoleManager to get hint shortcuts
private  java.lang.String m_rolename
          Deprecated. The role name for this instance
private  RoleManager m_roles
          Deprecated. The RoleManager to get hint shortcuts
 
Fields inherited from interface org.apache.excalibur.instrument.Instrumentable
EMPTY_INSTRUMENT_ARRAY, EMPTY_INSTRUMENTABLE_ARRAY
 
Constructor Summary
ExcaliburComponentSelector()
          Deprecated. Create the ComponentSelector
ExcaliburComponentSelector(java.lang.ClassLoader loader)
          Deprecated. Create the ComponentSelector with a Classloader
 
Method Summary
 void addComponent(java.lang.Object hint, java.lang.Class component, org.apache.avalon.framework.configuration.Configuration configuration)
          Deprecated. Add a new component to the manager.
 void addComponentInstance(java.lang.Object hint, org.apache.avalon.framework.component.Component instance)
          Deprecated. Add a static instance of a component to the manager.
protected  boolean canRelease(org.apache.avalon.framework.component.Component component)
          Deprecated. Is this component looked up using this selector?
 void compose(org.apache.avalon.framework.component.ComponentManager componentManager)
          Deprecated. Compose the ComponentSelector so that we know what the parent ComponentLocator is.
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
          Deprecated. Default Configuration handler for ComponentSelector.
 void contextualize(org.apache.avalon.framework.context.Context context)
          Deprecated. Provide the application Context.
 void dispose()
          Deprecated. Properly dispose of all the ComponentHandlers.
 org.apache.excalibur.instrument.Instrumentable[] getChildInstrumentables()
          Deprecated. Any Object which implements Instrumentable can also make use of other Instrumentable child objects.
protected  ComponentHandler getComponentHandler(java.lang.String role, java.lang.Class componentClass, org.apache.avalon.framework.configuration.Configuration configuration, org.apache.avalon.framework.component.ComponentManager componentManager, org.apache.avalon.framework.context.Context context, RoleManager roleManager, LogkitLoggerManager logkitManager)
          Deprecated. Obtain a new ComponentHandler for the specified component.
protected  java.util.Map getComponentHandlers()
          Deprecated. Makes the ComponentHandlers available to subclasses.
 java.lang.String getInstrumentableName()
          Deprecated. Gets the name of the Instrumentable.
 org.apache.excalibur.instrument.Instrument[] getInstruments()
          Deprecated. Obtain a reference to all the Instruments that the Instrumentable object wishes to expose.
private  java.lang.String getName()
          Deprecated. Return this selector's configuration name or a default name if no such configuration was provided.
 boolean hasComponent(java.lang.Object hint)
          Deprecated. Tests for existence of a component.
 void initialize()
          Deprecated. Properly initialize of the Child handlers.
 void release(org.apache.avalon.framework.component.Component component)
          Deprecated. Release the Component to the propper ComponentHandler.
 org.apache.avalon.framework.component.Component select(java.lang.Object hint)
          Deprecated. Return an instance of a component based on a hint.
 void setInstrumentableName(java.lang.String name)
          Deprecated. Sets the name for the Instrumentable.
 void setInstrumentManager(org.apache.excalibur.instrument.InstrumentManager instrumentManager)
          Deprecated. Sets the InstrumentManager for child components.
 void setLoggerManager(org.apache.avalon.excalibur.logger.LoggerManager logkit)
          Deprecated. Configure the LoggerManager.
 void setLogKitManager(org.apache.avalon.excalibur.logger.LogKitManager logkit)
          Deprecated. Configure the LogKitManager
 void setRoleManager(RoleManager roles)
          Deprecated. Configure the RoleManager
 
Methods inherited from class org.apache.avalon.excalibur.component.AbstractDualLogEnabled
getLogkitLogger, setLogger
 
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
 

Field Detail

m_loader

private final java.lang.ClassLoader m_loader
Deprecated. 
The classloader used for this system.


DEFAULT_NAME

private static final java.lang.String DEFAULT_NAME
Deprecated. 
The ComponentSelector's name for logging purposes.

See Also:
Constant Field Values

m_rolename

private java.lang.String m_rolename
Deprecated. 
The role name for this instance


m_context

protected org.apache.avalon.framework.context.Context m_context
Deprecated. 
The application context for components


m_componentManager

private org.apache.avalon.framework.component.ComponentManager m_componentManager
Deprecated. 
The application context for components


m_configuration

private org.apache.avalon.framework.configuration.Configuration m_configuration
Deprecated. 
Static configuraiton object.


m_componentHandlers

private java.util.Map m_componentHandlers
Deprecated. 
Static component handlers.


m_componentMapping

private java.util.Map m_componentMapping
Deprecated. 
Dynamic component handlers mapping.


m_disposed

private boolean m_disposed
Deprecated. 
Flag for if this is disposed or not.


m_initialized

private boolean m_initialized
Deprecated. 
Flag for if this is initialized or not.


m_roles

private RoleManager m_roles
Deprecated. 
The RoleManager to get hint shortcuts


m_logkit

private LogkitLoggerManager m_logkit
Deprecated. 
The RoleManager to get hint shortcuts


m_instrumentManager

private org.apache.excalibur.instrument.InstrumentManager m_instrumentManager
Deprecated. 
Instrument Manager to register objects created by this selector with (May be null).


m_instrumentableName

private java.lang.String m_instrumentableName
Deprecated. 
Instrumentable Name assigned to this Instrumentable

Constructor Detail

ExcaliburComponentSelector

public ExcaliburComponentSelector()
Deprecated. 
Create the ComponentSelector


ExcaliburComponentSelector

public ExcaliburComponentSelector(java.lang.ClassLoader loader)
Deprecated. 
Create the ComponentSelector with a Classloader

Method Detail

contextualize

public void contextualize(org.apache.avalon.framework.context.Context context)
Deprecated. 
Provide the application Context.

Specified by:
contextualize in interface org.apache.avalon.framework.context.Contextualizable

select

public org.apache.avalon.framework.component.Component select(java.lang.Object hint)
                                                       throws org.apache.avalon.framework.component.ComponentException
Deprecated. 
Return an instance of a component based on a hint. The Composable has already selected the role, so the only part left it to make sure the Component is handled.

Specified by:
select in interface org.apache.avalon.framework.component.ComponentSelector
Throws:
org.apache.avalon.framework.component.ComponentException

hasComponent

public boolean hasComponent(java.lang.Object hint)
Deprecated. 
Tests for existence of a component.

Specified by:
hasComponent in interface org.apache.avalon.framework.component.ComponentSelector

release

public void release(org.apache.avalon.framework.component.Component component)
Deprecated. 
Release the Component to the propper ComponentHandler.

Specified by:
release in interface org.apache.avalon.framework.component.ComponentSelector

canRelease

protected boolean canRelease(org.apache.avalon.framework.component.Component component)
Deprecated. 
Is this component looked up using this selector?


compose

public void compose(org.apache.avalon.framework.component.ComponentManager componentManager)
             throws org.apache.avalon.framework.component.ComponentException
Deprecated. 
Compose the ComponentSelector so that we know what the parent ComponentLocator is.

Specified by:
compose in interface org.apache.avalon.framework.component.Composable
Throws:
org.apache.avalon.framework.component.ComponentException

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Deprecated. 
Default Configuration handler for ComponentSelector.

Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Throws:
org.apache.avalon.framework.configuration.ConfigurationException

initialize

public void initialize()
Deprecated. 
Properly initialize of the Child handlers.

Specified by:
initialize in interface org.apache.avalon.framework.activity.Initializable

dispose

public void dispose()
Deprecated. 
Properly dispose of all the ComponentHandlers.

Specified by:
dispose in interface org.apache.avalon.framework.activity.Disposable

setRoleManager

public void setRoleManager(RoleManager roles)
Deprecated. 
Configure the RoleManager

Specified by:
setRoleManager in interface RoleManageable

setLogKitManager

public void setLogKitManager(org.apache.avalon.excalibur.logger.LogKitManager logkit)
Deprecated. 
Configure the LogKitManager

Specified by:
setLogKitManager in interface org.apache.avalon.excalibur.logger.LogKitManageable

setInstrumentManager

public void setInstrumentManager(org.apache.excalibur.instrument.InstrumentManager instrumentManager)
Deprecated. 
Sets the InstrumentManager for child components. Can be for special purpose components, however it is used mostly internally.

Specified by:
setInstrumentManager in interface org.apache.excalibur.instrument.InstrumentManageable
Parameters:
instrumentManager - The InstrumentManager for the component to use.

setInstrumentableName

public void setInstrumentableName(java.lang.String name)
Deprecated. 
Sets the name for the Instrumentable. The Instrumentable Name is used to uniquely identify the Instrumentable during the configuration of the InstrumentManager and to gain access to an InstrumentableDescriptor through the InstrumentManager. The value should be a string which does not contain spaces or periods.

This value may be set by a parent Instrumentable, or by the InstrumentManager using the value of the 'instrumentable' attribute in the configuration of the component.

Specified by:
setInstrumentableName in interface org.apache.excalibur.instrument.Instrumentable
Parameters:
name - The name used to identify a Instrumentable.

getInstrumentableName

public java.lang.String getInstrumentableName()
Deprecated. 
Gets the name of the Instrumentable.

Specified by:
getInstrumentableName in interface org.apache.excalibur.instrument.Instrumentable
Returns:
The name used to identify a Instrumentable.

getInstruments

public org.apache.excalibur.instrument.Instrument[] getInstruments()
Deprecated. 
Obtain a reference to all the Instruments that the Instrumentable object wishes to expose. All sampling is done directly through the Instruments as opposed to the Instrumentable interface.

Specified by:
getInstruments in interface org.apache.excalibur.instrument.Instrumentable
Returns:
An array of the Instruments available for profiling. Should never be null. If there are no Instruments, then EMPTY_INSTRUMENT_ARRAY can be returned. This should never be the case though unless there are child Instrumentables with Instruments.

getChildInstrumentables

public org.apache.excalibur.instrument.Instrumentable[] getChildInstrumentables()
Deprecated. 
Any Object which implements Instrumentable can also make use of other Instrumentable child objects. This method is used to tell the InstrumentManager about them.

Specified by:
getChildInstrumentables in interface org.apache.excalibur.instrument.Instrumentable
Returns:
An array of child Instrumentables. This method should never return null. If there are no child Instrumentables, then EMPTY_INSTRUMENTABLE_ARRAY can be returned.

setLoggerManager

public void setLoggerManager(org.apache.avalon.excalibur.logger.LoggerManager logkit)
Deprecated. 
Configure the LoggerManager.

Specified by:
setLoggerManager in interface org.apache.avalon.excalibur.logger.LoggerManageable

getComponentHandler

protected ComponentHandler getComponentHandler(java.lang.String role,
                                               java.lang.Class componentClass,
                                               org.apache.avalon.framework.configuration.Configuration configuration,
                                               org.apache.avalon.framework.component.ComponentManager componentManager,
                                               org.apache.avalon.framework.context.Context context,
                                               RoleManager roleManager,
                                               LogkitLoggerManager logkitManager)
                                        throws java.lang.Exception
Deprecated. 
Obtain a new ComponentHandler for the specified component. This method allows classes which extend the ExcaliburComponentSelector to use their own ComponentHandlers.

Parameters:
componentClass - Class of the component for which the handle is being requested.
configuration - The configuration for this component.
componentManager - The ComponentLocator which will be managing the Component.
context - The current context object.
roleManager - The current RoleManager.
logkitManager - The current LogKitManager.
Throws:
java.lang.Exception - If there were any problems obtaining a ComponentHandler

getComponentHandlers

protected java.util.Map getComponentHandlers()
Deprecated. 
Makes the ComponentHandlers available to subclasses.

Returns:
A reference to the componentHandler Map.

addComponent

public void addComponent(java.lang.Object hint,
                         java.lang.Class component,
                         org.apache.avalon.framework.configuration.Configuration configuration)
                  throws org.apache.avalon.framework.component.ComponentException
Deprecated. 
Add a new component to the manager.

Parameters:
hint - the hint name for the new component.
component - the class of this component.
configuration - the configuration for this component.
Throws:
org.apache.avalon.framework.component.ComponentException

addComponentInstance

public void addComponentInstance(java.lang.Object hint,
                                 org.apache.avalon.framework.component.Component instance)
Deprecated. 
Add a static instance of a component to the manager.

Parameters:
hint - the hint for the component.
instance - the instance of the component.

getName

private java.lang.String getName()
Deprecated. 
Return this selector's configuration name or a default name if no such configuration was provided. This accounts for the case when a static component instance has been added through addComponentInstance with no associated configuration