org.apache.avalon.excalibur.component
Class ExcaliburComponentSelector

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLoggable
        |
        +--org.apache.avalon.excalibur.component.ExcaliburComponentSelector
All Implemented Interfaces:
Component, ComponentSelector, Composable, Configurable, Contextualizable, Disposable, Initializable, Loggable, RoleManageable, ThreadSafe
Direct Known Subclasses:
DefaultComponentSelector

public class ExcaliburComponentSelector
extends AbstractLoggable
implements Contextualizable, ComponentSelector, Composable, Configurable, Initializable, ThreadSafe, Disposable, RoleManageable

Default component selector for Avalon's components.

Version:
CVS $Revision: 1.6 $ $Date: 2001/06/06 14:47:52 $
Author:
Berin Loritsch, Paul Russell

Field Summary
protected  Context m_context
          The application context for components
 
Constructor Summary
ExcaliburComponentSelector()
          Create the ComponentSelector
ExcaliburComponentSelector(java.lang.ClassLoader loader)
          Create the ComponentSelector with a Classloader
 
Method Summary
 void addComponent(java.lang.Object hint, java.lang.Class component, Configuration configuration)
          Add a new component to the manager.
 void addComponentInstance(java.lang.String hint, java.lang.Object instance)
          Add a static instance of a component to the manager.
 void compose(ComponentManager componentManager)
          Compose the ComponentSelector so that we know what the parent ComponentManager is.
 void configure(Configuration configuration)
          Default Configuration handler for ComponentSelector.
 void contextualize(Context context)
          Provide the application Context.
 void dispose()
          Properly dispose of all the ComponentHandlers.
 void initialize()
          Properly initialize of the Child handlers.
 void release(Component component)
          Release the Component to the propper ComponentHandler.
 Component select(java.lang.Object hint)
          Return an instance of a component based on a hint.
 void setRoleManager(RoleManager roles)
          Configure the RoleManager
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLoggable
getLogger, setLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_context

protected Context m_context
The application context for components
Constructor Detail

ExcaliburComponentSelector

public ExcaliburComponentSelector()
Create the ComponentSelector

ExcaliburComponentSelector

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

contextualize

public void contextualize(Context context)
Provide the application Context.
Specified by:
contextualize in interface Contextualizable
Following copied from interface: org.apache.avalon.framework.context.Contextualizable
Parameters:
context - the context
Throws:
ContextException - if context is invalid

compose

public void compose(ComponentManager componentManager)
             throws ComponentException
Compose the ComponentSelector so that we know what the parent ComponentManager is.
Specified by:
compose in interface Composable
Following copied from interface: org.apache.avalon.framework.component.Composable
Parameters:
manager - The ComponentManager which this Composable uses.

initialize

public void initialize()
Properly initialize of the Child handlers.
Specified by:
initialize in interface Initializable
Following copied from interface: org.apache.avalon.framework.activity.Initializable
Throws:
java.lang.Exception - if an error occurs

dispose

public void dispose()
Properly dispose of all the ComponentHandlers.
Specified by:
dispose in interface Disposable

select

public Component select(java.lang.Object hint)
                 throws ComponentException
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 ComponentSelector
Following copied from interface: org.apache.avalon.framework.component.ComponentSelector
Parameters:
name - A hint to retrieve the correct Component.
Throws:
ComponentNotFoundException - If the given role is not associated with a Component.
ComponentNotAccessibleException - If a Component instance cannot be created.

configure

public void configure(Configuration configuration)
               throws ConfigurationException
Default Configuration handler for ComponentSelector.
Specified by:
configure in interface Configurable
Following copied from interface: org.apache.avalon.framework.configuration.Configurable
Parameters:
configuration - the class configurations.

setRoleManager

public void setRoleManager(RoleManager roles)
Configure the RoleManager
Specified by:
setRoleManager in interface RoleManageable

release

public void release(Component component)
Release the Component to the propper ComponentHandler.
Specified by:
release in interface ComponentSelector
Following copied from interface: org.apache.avalon.framework.component.ComponentSelector
Parameters:
component - The Component we are releasing.

addComponent

public void addComponent(java.lang.Object hint,
                         java.lang.Class component,
                         Configuration configuration)
                  throws ComponentException
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.

addComponentInstance

public void addComponentInstance(java.lang.String hint,
                                 java.lang.Object instance)
Add a static instance of a component to the manager.
Parameters:
hint - the hint name for the component.
instance - the instance of the component.


Copyright © 2001 Apache Jakarta Project. All Rights Reserved.