org.codehaus.plexus
Class DefaultPlexusContainer

java.lang.Object
  extended by org.codehaus.plexus.logging.AbstractLogEnabled
      extended by org.codehaus.plexus.DefaultPlexusContainer
All Implemented Interfaces:
LogEnabled, MutablePlexusContainer, PlexusContainer

public class DefaultPlexusContainer
extends AbstractLogEnabled
implements MutablePlexusContainer

Author:
Jason van Zyl, Kenney Westerhof

Field Summary
protected  Map childContainers
          Map<String, PlexusContainer> where the key is the container name.
protected  org.codehaus.plexus.classworlds.ClassWorld classWorld
           
protected  ComponentComposerManager componentComposerManager
           
protected  ComponentDiscovererManager componentDiscovererManager
           
protected  ComponentFactoryManager componentFactoryManager
           
protected  ComponentLookupManager componentLookupManager
           
protected  ComponentManagerManager componentManagerManager
           
protected  ComponentRepository componentRepository
           
protected  PlexusConfiguration configuration
           
protected  Reader configurationReader
           
protected  ConfigurationSource configurationSource
           
protected  DefaultContext containerContext
           
protected  org.codehaus.plexus.classworlds.realm.ClassRealm containerRealm
           
protected  Date creationDate
           
protected static String DEFAULT_CONTAINER_NAME
           
protected static String DEFAULT_REALM_NAME
           
protected  List initializationPhases
           
protected  LifecycleHandlerManager lifecycleHandlerManager
           
protected  LoggerManager loggerManager
           
protected  String name
           
protected  PlexusContainer parentContainer
           
protected  boolean reloadingEnabled
           
 
Fields inherited from interface org.codehaus.plexus.PlexusContainer
ROLE
 
Constructor Summary
DefaultPlexusContainer()
           
DefaultPlexusContainer(ContainerConfiguration c)
           
 
Method Summary
 void addComponent(Object component, String role)
           
 void addComponentDescriptor(ComponentDescriptor componentDescriptor)
          Adds a component descriptor to this container.
 void addContextValue(Object key, Object value)
          Add a key/value pair to this container's Context.
 void addJarRepository(File repository)
          Adds a directory of jar resources.
 void addJarResource(File jar)
          Adds a jar to this container's ClassRealm - whose components are then discovered (via the various registered ComponentDiscoverer's).
 PlexusContainer createChildContainer(String name, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
           
 PlexusContainer createChildContainer(String name, Set urls)
           
 org.codehaus.plexus.classworlds.realm.ClassRealm createComponentRealm(String id, List jars)
          Creates and returns a new class realm under this container's realm for the given list of jars.
 List discoverComponents(org.codehaus.plexus.classworlds.realm.ClassRealm classRealm)
           
 List discoverComponents(org.codehaus.plexus.classworlds.realm.ClassRealm classRealm, boolean override)
          Discovers components in the given realm.
 void dispose()
          Disposes of this container, which in turn disposes all of it's components.
protected  void disposeAllComponents()
           
 PlexusContainer getChildContainer(String name)
          Returns a child container with the unique name.
 org.codehaus.plexus.classworlds.ClassWorld getClassWorld()
           
 ComponentComposerManager getComponentComposerManager()
           
 ComponentDescriptor getComponentDescriptor(String role)
          Returns the ComponentDescriptor with the given component role and the default role hint.
 ComponentDescriptor getComponentDescriptor(String role, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
          Returns the ComponentDescriptor with the given component role and the default role hint.
 ComponentDescriptor getComponentDescriptor(String role, String hint)
          Returns the ComponentDescriptor with the given component role and hint.
 ComponentDescriptor getComponentDescriptor(String role, String hint, org.codehaus.plexus.classworlds.realm.ClassRealm classRealm)
          Returns the ComponentDescriptor with the given component role and hint.
 List getComponentDescriptorList(String role)
          Returns a List of ComponentDescriptors with the given role.
 List getComponentDescriptorList(String role, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
          Returns a List of ComponentDescriptors with the given role.
 List getComponentDescriptorList(String role, List roleHints, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
          Returns a List of ComponentDescriptors with the given role in a requested order driven by roleHints list.
 Map getComponentDescriptorMap(String role)
          Returns a Map of ComponentDescriptors with the given role, keyed by role-hint.
 Map getComponentDescriptorMap(String role, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
          Returns a Map of ComponentDescriptors with the given role, keyed by role-hint.
 ComponentDiscovererManager getComponentDiscovererManager()
           
 ComponentFactoryManager getComponentFactoryManager()
           
 ComponentLookupManager getComponentLookupManager()
           
 ComponentManagerManager getComponentManagerManager()
           
 org.codehaus.plexus.classworlds.realm.ClassRealm getComponentRealm(String realmId)
           
 ComponentRepository getComponentRepository()
           
 PlexusConfiguration getConfiguration()
           
 ConfigurationSource getConfigurationSource()
           
 org.codehaus.plexus.classworlds.realm.ClassRealm getContainerRealm()
          Returns the Classworld's ClassRealm of this Container, which acts as the default parent for all contained components.
 Context getContext()
          Returns this container's context.
 Date getCreationDate()
          Returns the date this container was created.
protected  Reader getInterpolationConfigurationReader(Reader reader)
           
 LifecycleHandlerManager getLifecycleHandlerManager()
           
 Logger getLogger()
           
 LoggerManager getLoggerManager()
           
 org.codehaus.plexus.classworlds.realm.ClassRealm getLookupRealm()
          Returns the lookup realm for this container, which is either the container realm or the realm set by PlexusContainer.setLookupRealm(ClassRealm).
 org.codehaus.plexus.classworlds.realm.ClassRealm getLookupRealm(Object component)
          Utility method to get a default lookup realm for a component.
 String getName()
          Returns the unique name of this container in the container hierarchy.
 PlexusContainer getParentContainer()
           
 boolean hasChildContainer(String name)
          Returns true if this container has a child with the given name.
 boolean hasComponent(String componentKey)
          Returns true if this container has the keyed component.
 boolean hasComponent(String componentKey, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
           
 boolean hasComponent(String role, String roleHint)
          Returns true if this container has a component with the given role/role-hint.
 boolean hasComponent(String role, String roleHint, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
           
protected  void initialize(ContainerConfiguration containerConfiguration)
           
protected  void initializeConfiguration(ContainerConfiguration c)
           
protected  void initializePhases(ContainerConfiguration containerConfiguration)
           
 boolean isReloadingEnabled()
          Returns true if a component's metadata may be reloaded, otherwise, it may be loaded only once.
 Object lookup(Class componentClass)
          Looks up and returns a component object with the given unique key or role.
 Object lookup(Class componentClass, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
          Looks up and returns a component object with the given unique key or role.
 Object lookup(Class role, String roleHint)
          Looks up and returns a component object with the given unique role/role-hint combination.
 Object lookup(Class role, String roleHint, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
          Looks up and returns a component object with the given unique role/role-hint combination.
 Object lookup(String componentKey)
          Looks up and returns a component object with the given unique key or role.
 Object lookup(String componentKey, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
          Looks up and returns a component object with the given unique key or role.
 Object lookup(String role, String roleHint)
          Looks up and returns a component object with the given unique role/role-hint combination.
 Object lookup(String role, String roleHint, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
          Looks up and returns a component object with the given unique role/role-hint combination.
 List lookupList(Class role)
          Looks up and returns a List of component objects with the given role.
 List lookupList(Class role, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
          Looks up and returns a List of component objects with the given role.
 List lookupList(Class role, List hints)
          Looks up and returns a List of component objects with the given role.
 List lookupList(Class role, List hints, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
          Looks up and returns a List of component objects with the given role.
 List lookupList(String role)
          Looks up and returns a List of component objects with the given role.
 List lookupList(String role, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
          Looks up and returns a List of component objects with the given role.
 List lookupList(String role, List hints)
          Looks up and returns a List of component objects with the given role.
 List lookupList(String role, List hints, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
          Looks up and returns a List of component objects with the given role.
 Map lookupMap(Class role)
          Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.
 Map lookupMap(Class role, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
          Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.
 Map lookupMap(Class role, List hints)
          Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.
 Map lookupMap(Class role, List hints, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
          Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.
 Map lookupMap(String role)
          Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.
 Map lookupMap(String role, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
          Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.
 Map lookupMap(String role, List hints)
          Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.
 Map lookupMap(String role, List hints, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
          Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.
 void registerComponentDiscoveryListener(ComponentDiscoveryListener listener)
          Adds the listener to this container.
 void release(Object component)
          Releases the component from the container.
 void releaseAll(List components)
          Releases all Listed components from the container.
 void releaseAll(Map components)
          Releases all Mapped component values from the container.
 void removeChildContainer(String name)
          Removes the keyed child from this container.
 void removeComponentDiscoveryListener(ComponentDiscoveryListener listener)
          Removes the listener from this container.
 void removeComponentRealm(org.codehaus.plexus.classworlds.realm.ClassRealm realm)
          Dissociate the realm with the specified id from the container.
 void setClassWorld(org.codehaus.plexus.classworlds.ClassWorld classWorld)
           
 void setComponentComposerManager(ComponentComposerManager componentComposerManager)
           
 void setComponentDiscovererManager(ComponentDiscovererManager componentDiscovererManager)
           
 void setComponentFactoryManager(ComponentFactoryManager componentFactoryManager)
           
 void setComponentLookupManager(ComponentLookupManager componentLookupManager)
           
 void setComponentManagerManager(ComponentManagerManager componentManagerManager)
           
 void setComponentRepository(ComponentRepository componentRepository)
           
 void setConfiguration(PlexusConfiguration configuration)
           
 void setConfigurationSource(ConfigurationSource configurationSource)
           
 void setContainerRealm(org.codehaus.plexus.classworlds.realm.ClassRealm containerRealm)
           
 void setLifecycleHandlerManager(LifecycleHandlerManager lifecycleHandlerManager)
           
 void setLoggerManager(LoggerManager loggerManager)
           
 org.codehaus.plexus.classworlds.realm.ClassRealm setLookupRealm(org.codehaus.plexus.classworlds.realm.ClassRealm realm)
          Sets the lookup realm to use for lookup calls that don't have a ClassRealm parameter.
 void setName(String name)
           
 void setParentPlexusContainer(PlexusContainer container)
          Sets the parent of this container.
 void setReloadingEnabled(boolean reloadingEnabled)
          Sets the ability to reload a component's metadata multiple times.
protected  void start()
           
 
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CONTAINER_NAME

protected static final String DEFAULT_CONTAINER_NAME
See Also:
Constant Field Values

DEFAULT_REALM_NAME

protected static final String DEFAULT_REALM_NAME
See Also:
Constant Field Values

name

protected String name

parentContainer

protected PlexusContainer parentContainer

containerContext

protected DefaultContext containerContext

configuration

protected PlexusConfiguration configuration

configurationReader

protected Reader configurationReader

classWorld

protected org.codehaus.plexus.classworlds.ClassWorld classWorld

containerRealm

protected org.codehaus.plexus.classworlds.realm.ClassRealm containerRealm

initializationPhases

protected List initializationPhases

componentRepository

protected ComponentRepository componentRepository

componentManagerManager

protected ComponentManagerManager componentManagerManager

lifecycleHandlerManager

protected LifecycleHandlerManager lifecycleHandlerManager

componentDiscovererManager

protected ComponentDiscovererManager componentDiscovererManager

componentFactoryManager

protected ComponentFactoryManager componentFactoryManager

componentLookupManager

protected ComponentLookupManager componentLookupManager

componentComposerManager

protected ComponentComposerManager componentComposerManager

loggerManager

protected LoggerManager loggerManager

configurationSource

protected ConfigurationSource configurationSource

childContainers

protected Map childContainers
Map<String, PlexusContainer> where the key is the container name.


creationDate

protected Date creationDate

reloadingEnabled

protected boolean reloadingEnabled
Constructor Detail

DefaultPlexusContainer

public DefaultPlexusContainer()
                       throws PlexusContainerException
Throws:
PlexusContainerException

DefaultPlexusContainer

public DefaultPlexusContainer(ContainerConfiguration c)
                       throws PlexusContainerException
Throws:
PlexusContainerException
Method Detail

addComponent

public void addComponent(Object component,
                         String role)
                  throws ComponentRepositoryException
Specified by:
addComponent in interface PlexusContainer
Throws:
ComponentRepositoryException

setLookupRealm

public org.codehaus.plexus.classworlds.realm.ClassRealm setLookupRealm(org.codehaus.plexus.classworlds.realm.ClassRealm realm)
Description copied from interface: PlexusContainer
Sets the lookup realm to use for lookup calls that don't have a ClassRealm parameter.

Specified by:
setLookupRealm in interface PlexusContainer
Parameters:
realm - the new realm to use.
Returns:
The previous lookup realm. It is adviced to set it back once the old-style lookups have completed.

getLookupRealm

public org.codehaus.plexus.classworlds.realm.ClassRealm getLookupRealm()
Description copied from interface: PlexusContainer
Returns the lookup realm for this container, which is either the container realm or the realm set by PlexusContainer.setLookupRealm(ClassRealm).

Specified by:
getLookupRealm in interface PlexusContainer

createComponentRealm

public org.codehaus.plexus.classworlds.realm.ClassRealm createComponentRealm(String id,
                                                                             List jars)
                                                                      throws PlexusContainerException
Description copied from interface: PlexusContainer
Creates and returns a new class realm under this container's realm for the given list of jars. If the realm already exists, return the realm with the given ID?

Specified by:
createComponentRealm in interface PlexusContainer
Parameters:
id - unique key for the ClassRealm
jars - list of JARs to place in the realm.
Throws:
PlexusContainerException
See Also:
PlexusContainer.addJarResource(File)

createChildContainer

public PlexusContainer createChildContainer(String name,
                                            Set urls)
Specified by:
createChildContainer in interface PlexusContainer

createChildContainer

public PlexusContainer createChildContainer(String name,
                                            org.codehaus.plexus.classworlds.realm.ClassRealm realm)
                                     throws PlexusContainerException
Specified by:
createChildContainer in interface PlexusContainer
Throws:
PlexusContainerException

lookup

public Object lookup(String componentKey)
              throws ComponentLookupException
Description copied from interface: PlexusContainer
Looks up and returns a component object with the given unique key or role.

Specified by:
lookup in interface PlexusContainer
Parameters:
componentKey - a unique key for the desired component
Returns:
a Plexus component object
Throws:
ComponentLookupException

lookup

public Object lookup(String componentKey,
                     org.codehaus.plexus.classworlds.realm.ClassRealm realm)
              throws ComponentLookupException
Description copied from interface: PlexusContainer
Looks up and returns a component object with the given unique key or role.

Specified by:
lookup in interface MutablePlexusContainer
Specified by:
lookup in interface PlexusContainer
Parameters:
componentKey - a unique key for the desired component
Returns:
a Plexus component object
Throws:
ComponentLookupException

lookupMap

public Map lookupMap(String role)
              throws ComponentLookupException
Description copied from interface: PlexusContainer
Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.

Specified by:
lookupMap in interface PlexusContainer
Parameters:
role - a non-unique key for the desired components
Returns:
a Map of component objects
Throws:
ComponentLookupException

lookupMap

public Map lookupMap(String role,
                     org.codehaus.plexus.classworlds.realm.ClassRealm realm)
              throws ComponentLookupException
Description copied from interface: PlexusContainer
Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.

Specified by:
lookupMap in interface PlexusContainer
Parameters:
role - a non-unique key for the desired components
Returns:
a Map of component objects
Throws:
ComponentLookupException

lookupList

public List lookupList(String role)
                throws ComponentLookupException
Description copied from interface: PlexusContainer
Looks up and returns a List of component objects with the given role.

Specified by:
lookupList in interface PlexusContainer
Parameters:
role - a non-unique key for the desired components
Returns:
a List of component objects
Throws:
ComponentLookupException

lookupList

public List lookupList(String role,
                       org.codehaus.plexus.classworlds.realm.ClassRealm realm)
                throws ComponentLookupException
Description copied from interface: PlexusContainer
Looks up and returns a List of component objects with the given role.

Specified by:
lookupList in interface PlexusContainer
Parameters:
role - a non-unique key for the desired components
Returns:
a List of component objects
Throws:
ComponentLookupException

lookupMap

public Map lookupMap(String role,
                     List hints)
              throws ComponentLookupException
Description copied from interface: PlexusContainer
Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.

Specified by:
lookupMap in interface PlexusContainer
Parameters:
role - a non-unique key for the desired components
Returns:
a Map of component objects
Throws:
ComponentLookupException

lookupMap

public Map lookupMap(String role,
                     List hints,
                     org.codehaus.plexus.classworlds.realm.ClassRealm realm)
              throws ComponentLookupException
Description copied from interface: PlexusContainer
Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.

Specified by:
lookupMap in interface PlexusContainer
Parameters:
role - a non-unique key for the desired components
Returns:
a Map of component objects
Throws:
ComponentLookupException

lookupList

public List lookupList(String role,
                       List hints)
                throws ComponentLookupException
Description copied from interface: PlexusContainer
Looks up and returns a List of component objects with the given role.

Specified by:
lookupList in interface PlexusContainer
Parameters:
role - a non-unique key for the desired components
Returns:
a List of component objects
Throws:
ComponentLookupException

lookupList

public List lookupList(String role,
                       List hints,
                       org.codehaus.plexus.classworlds.realm.ClassRealm realm)
                throws ComponentLookupException
Description copied from interface: PlexusContainer
Looks up and returns a List of component objects with the given role.

Specified by:
lookupList in interface PlexusContainer
Parameters:
role - a non-unique key for the desired components
Returns:
a List of component objects
Throws:
ComponentLookupException

lookup

public Object lookup(String role,
                     String roleHint)
              throws ComponentLookupException
Description copied from interface: PlexusContainer
Looks up and returns a component object with the given unique role/role-hint combination.

Specified by:
lookup in interface PlexusContainer
Parameters:
role - a non-unique key for the desired component
roleHint - a hint for the desired component implementation
Returns:
a Plexus component object
Throws:
ComponentLookupException

lookup

public Object lookup(String role,
                     String roleHint,
                     org.codehaus.plexus.classworlds.realm.ClassRealm realm)
              throws ComponentLookupException
Description copied from interface: PlexusContainer
Looks up and returns a component object with the given unique role/role-hint combination.

Specified by:
lookup in interface MutablePlexusContainer
Specified by:
lookup in interface PlexusContainer
Parameters:
role - a non-unique key for the desired component
roleHint - a hint for the desired component implementation
Returns:
a Plexus component object
Throws:
ComponentLookupException

lookup

public Object lookup(Class componentClass)
              throws ComponentLookupException
Description copied from interface: PlexusContainer
Looks up and returns a component object with the given unique key or role.

Specified by:
lookup in interface PlexusContainer
Parameters:
componentClass - a unique key for the desired component
Returns:
a Plexus component object
Throws:
ComponentLookupException

lookup

public Object lookup(Class componentClass,
                     org.codehaus.plexus.classworlds.realm.ClassRealm realm)
              throws ComponentLookupException
Description copied from interface: PlexusContainer
Looks up and returns a component object with the given unique key or role.

Specified by:
lookup in interface PlexusContainer
Parameters:
componentClass - a unique key for the desired component
Returns:
a Plexus component object
Throws:
ComponentLookupException

lookupMap

public Map lookupMap(Class role)
              throws ComponentLookupException
Description copied from interface: PlexusContainer
Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.

Specified by:
lookupMap in interface PlexusContainer
Parameters:
role - a non-unique class key for the desired components
Returns:
a Map of component objects
Throws:
ComponentLookupException

lookupMap

public Map lookupMap(Class role,
                     org.codehaus.plexus.classworlds.realm.ClassRealm realm)
              throws ComponentLookupException
Description copied from interface: PlexusContainer
Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.

Specified by:
lookupMap in interface PlexusContainer
Parameters:
role - a non-unique class key for the desired components
Returns:
a Map of component objects
Throws:
ComponentLookupException

lookupList

public List lookupList(Class role)
                throws ComponentLookupException
Description copied from interface: PlexusContainer
Looks up and returns a List of component objects with the given role.

Specified by:
lookupList in interface PlexusContainer
Parameters:
role - a non-unique class key for the desired components
Returns:
a List of component objects
Throws:
ComponentLookupException

lookupList

public List lookupList(Class role,
                       org.codehaus.plexus.classworlds.realm.ClassRealm realm)
                throws ComponentLookupException
Description copied from interface: PlexusContainer
Looks up and returns a List of component objects with the given role.

Specified by:
lookupList in interface PlexusContainer
Parameters:
role - a non-unique class key for the desired components
Returns:
a List of component objects
Throws:
ComponentLookupException

lookup

public Object lookup(Class role,
                     String roleHint)
              throws ComponentLookupException
Description copied from interface: PlexusContainer
Looks up and returns a component object with the given unique role/role-hint combination.

Specified by:
lookup in interface PlexusContainer
Parameters:
role - a non-unique class key for the desired component
roleHint - a hint for the desired component implementation
Returns:
a Plexus component object
Throws:
ComponentLookupException

lookup

public Object lookup(Class role,
                     String roleHint,
                     org.codehaus.plexus.classworlds.realm.ClassRealm realm)
              throws ComponentLookupException
Description copied from interface: PlexusContainer
Looks up and returns a component object with the given unique role/role-hint combination.

Specified by:
lookup in interface PlexusContainer
Parameters:
role - a non-unique class key for the desired component
roleHint - a hint for the desired component implementation
Returns:
a Plexus component object
Throws:
ComponentLookupException

lookupMap

public Map lookupMap(Class role,
                     List hints)
              throws ComponentLookupException
Description copied from interface: PlexusContainer
Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.

Specified by:
lookupMap in interface PlexusContainer
Parameters:
role - a non-unique class key for the desired components
Returns:
a Map of component objects
Throws:
ComponentLookupException

lookupMap

public Map lookupMap(Class role,
                     List hints,
                     org.codehaus.plexus.classworlds.realm.ClassRealm realm)
              throws ComponentLookupException
Description copied from interface: PlexusContainer
Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.

Specified by:
lookupMap in interface PlexusContainer
Parameters:
role - a non-unique class key for the desired components
Returns:
a Map of component objects
Throws:
ComponentLookupException

lookupList

public List lookupList(Class role,
                       List hints)
                throws ComponentLookupException
Description copied from interface: PlexusContainer
Looks up and returns a List of component objects with the given role.

Specified by:
lookupList in interface PlexusContainer
Parameters:
role - a non-unique class key for the desired components
Returns:
a List of component objects
Throws:
ComponentLookupException

lookupList

public List lookupList(Class role,
                       List hints,
                       org.codehaus.plexus.classworlds.realm.ClassRealm realm)
                throws ComponentLookupException
Description copied from interface: PlexusContainer
Looks up and returns a List of component objects with the given role.

Specified by:
lookupList in interface PlexusContainer
Parameters:
role - a non-unique class key for the desired components
Returns:
a List of component objects
Throws:
ComponentLookupException

getCreationDate

public Date getCreationDate()
Description copied from interface: PlexusContainer
Returns the date this container was created.

Specified by:
getCreationDate in interface PlexusContainer
Returns:
the date this container was created

hasChildContainer

public boolean hasChildContainer(String name)
Description copied from interface: PlexusContainer
Returns true if this container has a child with the given name.

Specified by:
hasChildContainer in interface PlexusContainer
Parameters:
name - a key unique amongst this container's children
Returns:
true if this container has a child with the given name

removeChildContainer

public void removeChildContainer(String name)
Description copied from interface: PlexusContainer
Removes the keyed child from this container. Does not necessarily dispose the children.

Specified by:
removeChildContainer in interface PlexusContainer
Parameters:
name - a key unique amongst this container's children

getChildContainer

public PlexusContainer getChildContainer(String name)
Description copied from interface: PlexusContainer
Returns a child container with the unique name.

Specified by:
getChildContainer in interface PlexusContainer
Parameters:
name - a key unique amongst this container's children
Returns:
the keyed child container

setName

public void setName(String name)
Specified by:
setName in interface PlexusContainer

setParentPlexusContainer

public void setParentPlexusContainer(PlexusContainer container)
Description copied from interface: PlexusContainer
Sets the parent of this container.

Specified by:
setParentPlexusContainer in interface PlexusContainer
Parameters:
container - the parent of this container, null if none

getComponentDescriptor

public ComponentDescriptor getComponentDescriptor(String role)
Description copied from interface: PlexusContainer
Returns the ComponentDescriptor with the given component role and the default role hint. Searches up the hierarchy until one is found, null if none is found.

Specified by:
getComponentDescriptor in interface PlexusContainer
Parameters:
role - a unique role for the desired component's descriptor
Returns:
the ComponentDescriptor with the given component role

getComponentDescriptor

public ComponentDescriptor getComponentDescriptor(String role,
                                                  org.codehaus.plexus.classworlds.realm.ClassRealm realm)
Description copied from interface: PlexusContainer
Returns the ComponentDescriptor with the given component role and the default role hint. Searches up the hierarchy until one is found, null if none is found.

Specified by:
getComponentDescriptor in interface PlexusContainer
Parameters:
role - a unique role for the desired component's descriptor
realm - The class realm to search
Returns:
the ComponentDescriptor with the given component role

getComponentDescriptor

public ComponentDescriptor getComponentDescriptor(String role,
                                                  String hint)
Description copied from interface: PlexusContainer
Returns the ComponentDescriptor with the given component role and hint. Searches up the hierarchy until one is found, null if none is found.

Specified by:
getComponentDescriptor in interface PlexusContainer
Parameters:
role - a unique role for the desired component's descriptor
hint - a hint showing which implementation should be used
Returns:
the ComponentDescriptor with the given component role

getComponentDescriptor

public ComponentDescriptor getComponentDescriptor(String role,
                                                  String hint,
                                                  org.codehaus.plexus.classworlds.realm.ClassRealm classRealm)
Description copied from interface: PlexusContainer
Returns the ComponentDescriptor with the given component role and hint. Searches up the hierarchy until one is found, null if none is found.

Specified by:
getComponentDescriptor in interface PlexusContainer
Parameters:
role - a unique role for the desired component's descriptor
hint - a hint showing which implementation should be used
classRealm - The class realm to search
Returns:
the ComponentDescriptor with the given component role

getComponentDescriptorMap

public Map getComponentDescriptorMap(String role)
Description copied from interface: PlexusContainer
Returns a Map of ComponentDescriptors with the given role, keyed by role-hint. Searches up the hierarchy until all are found, an empty Map if none are found.

Specified by:
getComponentDescriptorMap in interface PlexusContainer
Parameters:
role - a non-unique key for the desired components
Returns:
a Map of component descriptors keyed by role-hint

getComponentDescriptorMap

public Map getComponentDescriptorMap(String role,
                                     org.codehaus.plexus.classworlds.realm.ClassRealm realm)
Description copied from interface: PlexusContainer
Returns a Map of ComponentDescriptors with the given role, keyed by role-hint. Searches up the hierarchy until all are found, an empty Map if none are found.

Specified by:
getComponentDescriptorMap in interface PlexusContainer
Parameters:
role - a non-unique key for the desired components
Returns:
a Map of component descriptors keyed by role-hint

getComponentDescriptorList

public List getComponentDescriptorList(String role)
Description copied from interface: PlexusContainer
Returns a List of ComponentDescriptors with the given role. Searches up the hierarchy until all are found, an empty List if none are found.

Specified by:
getComponentDescriptorList in interface PlexusContainer
Parameters:
role - a non-unique key for the desired components
Returns:
a List of component descriptors

getComponentDescriptorList

public List getComponentDescriptorList(String role,
                                       org.codehaus.plexus.classworlds.realm.ClassRealm realm)
Description copied from interface: PlexusContainer
Returns a List of ComponentDescriptors with the given role. Searches up the hierarchy until all are found, an empty List if none are found.

Specified by:
getComponentDescriptorList in interface PlexusContainer
Parameters:
role - a non-unique key for the desired components
Returns:
a List of component descriptors

getComponentDescriptorList

public List getComponentDescriptorList(String role,
                                       List roleHints,
                                       org.codehaus.plexus.classworlds.realm.ClassRealm realm)
Description copied from interface: PlexusContainer
Returns a List of ComponentDescriptors with the given role in a requested order driven by roleHints list. Searches up the hierarchy until all are found, an empty List if none are found.

Specified by:
getComponentDescriptorList in interface PlexusContainer
Parameters:
role - a non-unique key for the desired components
Returns:
a List of component descriptors

addComponentDescriptor

public void addComponentDescriptor(ComponentDescriptor componentDescriptor)
                            throws ComponentRepositoryException
Description copied from interface: PlexusContainer
Adds a component descriptor to this container. componentDescriptor should have realmId set.

Specified by:
addComponentDescriptor in interface PlexusContainer
Throws:
ComponentRepositoryException

release

public void release(Object component)
             throws ComponentLifecycleException
Description copied from interface: PlexusContainer
Releases the component from the container. This is dependant upon how the implementation manages the component, but usually enacts some standard lifecycle shutdown procedure on the component. In every case, the component is no longer accessible from the container (unless another is created).

Specified by:
release in interface PlexusContainer
Parameters:
component - the plexus component object to release
Throws:
ComponentLifecycleException

releaseAll

public void releaseAll(Map components)
                throws ComponentLifecycleException
Description copied from interface: PlexusContainer
Releases all Mapped component values from the container.

Specified by:
releaseAll in interface PlexusContainer
Parameters:
components - Map of plexus component objects to release
Throws:
ComponentLifecycleException
See Also:
PlexusContainer.release( Object component )

releaseAll

public void releaseAll(List components)
                throws ComponentLifecycleException
Description copied from interface: PlexusContainer
Releases all Listed components from the container.

Specified by:
releaseAll in interface PlexusContainer
Parameters:
components - List of plexus component objects to release
Throws:
ComponentLifecycleException
See Also:
PlexusContainer.release( Object component )

hasComponent

public boolean hasComponent(String componentKey)
Description copied from interface: PlexusContainer
Returns true if this container has the keyed component.

Specified by:
hasComponent in interface PlexusContainer
Returns:
true if this container has the keyed component

hasComponent

public boolean hasComponent(String componentKey,
                            org.codehaus.plexus.classworlds.realm.ClassRealm realm)

hasComponent

public boolean hasComponent(String role,
                            String roleHint)
Description copied from interface: PlexusContainer
Returns true if this container has a component with the given role/role-hint.

Specified by:
hasComponent in interface PlexusContainer
Returns:
true if this container has a component with the given role/role-hint

hasComponent

public boolean hasComponent(String role,
                            String roleHint,
                            org.codehaus.plexus.classworlds.realm.ClassRealm realm)

initialize

protected void initialize(ContainerConfiguration containerConfiguration)
                   throws PlexusContainerException
Throws:
PlexusContainerException

initializePhases

protected void initializePhases(ContainerConfiguration containerConfiguration)
                         throws PlexusContainerException
Throws:
PlexusContainerException

discoverComponents

public List discoverComponents(org.codehaus.plexus.classworlds.realm.ClassRealm classRealm)
                        throws PlexusConfigurationException,
                               ComponentRepositoryException
Throws:
PlexusConfigurationException
ComponentRepositoryException

discoverComponents

public List discoverComponents(org.codehaus.plexus.classworlds.realm.ClassRealm classRealm,
                               boolean override)
                        throws PlexusConfigurationException,
                               ComponentRepositoryException
Description copied from interface: MutablePlexusContainer
Discovers components in the given realm.

Specified by:
discoverComponents in interface MutablePlexusContainer
override - wheter to override/merge any conflicting components, where the new component takes precedence.
Returns:
Throws:
PlexusConfigurationException
ComponentRepositoryException
See Also:
MutablePlexusContainer.discoverComponents(org.codehaus.plexus.classworlds.realm.ClassRealm,boolean)

start

protected void start()
              throws PlexusContainerException
Throws:
PlexusContainerException

dispose

public void dispose()
Description copied from interface: PlexusContainer
Disposes of this container, which in turn disposes all of it's components. This container should also remove itself from the container hierarchy.

Specified by:
dispose in interface PlexusContainer

disposeAllComponents

protected void disposeAllComponents()

addContextValue

public void addContextValue(Object key,
                            Object value)
Description copied from interface: PlexusContainer
Add a key/value pair to this container's Context.

Specified by:
addContextValue in interface PlexusContainer
Parameters:
key - any unique object valid to the Context's implementation
value - any object valid to the Context's implementation

getName

public String getName()
Description copied from interface: PlexusContainer
Returns the unique name of this container in the container hierarchy.

Specified by:
getName in interface PlexusContainer
Returns:
the unique name of this container in the container hierarchy

getClassWorld

public org.codehaus.plexus.classworlds.ClassWorld getClassWorld()
Specified by:
getClassWorld in interface MutablePlexusContainer

setClassWorld

public void setClassWorld(org.codehaus.plexus.classworlds.ClassWorld classWorld)

getContainerRealm

public org.codehaus.plexus.classworlds.realm.ClassRealm getContainerRealm()
Description copied from interface: PlexusContainer
Returns the Classworld's ClassRealm of this Container, which acts as the default parent for all contained components.

Specified by:
getContainerRealm in interface PlexusContainer
Returns:
the ClassRealm of this Container

setContainerRealm

public void setContainerRealm(org.codehaus.plexus.classworlds.realm.ClassRealm containerRealm)

getContext

public Context getContext()
Description copied from interface: PlexusContainer
Returns this container's context. A Context is a simple data store used to hold values which may alter the execution of the Container.

Specified by:
getContext in interface PlexusContainer
Returns:
this container's context.

initializeConfiguration

protected void initializeConfiguration(ContainerConfiguration c)
                                throws PlexusConfigurationException,
                                       ContextException,
                                       IOException
Throws:
PlexusConfigurationException
ContextException
IOException

getInterpolationConfigurationReader

protected Reader getInterpolationConfigurationReader(Reader reader)

addJarResource

public void addJarResource(File jar)
                    throws PlexusContainerException
Description copied from interface: PlexusContainer
Adds a jar to this container's ClassRealm - whose components are then discovered (via the various registered ComponentDiscoverer's).

Specified by:
addJarResource in interface PlexusContainer
Parameters:
jar - a JAR file
Throws:
PlexusContainerException

addJarRepository

public void addJarRepository(File repository)
Description copied from interface: PlexusContainer
Adds a directory of jar resources.

Specified by:
addJarRepository in interface PlexusContainer
Parameters:
repository - a directory containing JAR files
See Also:
PlexusContainer.addJarResource(File)

getLogger

public Logger getLogger()
Specified by:
getLogger in interface MutablePlexusContainer
Specified by:
getLogger in interface PlexusContainer
Overrides:
getLogger in class AbstractLogEnabled

registerComponentDiscoveryListener

public void registerComponentDiscoveryListener(ComponentDiscoveryListener listener)
Description copied from interface: PlexusContainer
Adds the listener to this container. ComponentDiscoveryListeners have the ability to respond to various ComponentDiscoverer events.

Specified by:
registerComponentDiscoveryListener in interface PlexusContainer
Parameters:
listener - A listener which responds to differnet ComponentDiscoveryEvents

removeComponentDiscoveryListener

public void removeComponentDiscoveryListener(ComponentDiscoveryListener listener)
Description copied from interface: PlexusContainer
Removes the listener from this container.

Specified by:
removeComponentDiscoveryListener in interface PlexusContainer
Parameters:
listener - A listener to remove

setReloadingEnabled

public void setReloadingEnabled(boolean reloadingEnabled)
Description copied from interface: PlexusContainer
Sets the ability to reload a component's metadata multiple times.

Specified by:
setReloadingEnabled in interface PlexusContainer
Parameters:
reloadingEnabled - true is a component may be reloaded

isReloadingEnabled

public boolean isReloadingEnabled()
Description copied from interface: PlexusContainer
Returns true if a component's metadata may be reloaded, otherwise, it may be loaded only once.

Specified by:
isReloadingEnabled in interface PlexusContainer
Returns:
true if a component's metadata may be reloaded

getComponentRepository

public ComponentRepository getComponentRepository()
Specified by:
getComponentRepository in interface MutablePlexusContainer

setComponentRepository

public void setComponentRepository(ComponentRepository componentRepository)
Specified by:
setComponentRepository in interface MutablePlexusContainer

getComponentManagerManager

public ComponentManagerManager getComponentManagerManager()
Specified by:
getComponentManagerManager in interface MutablePlexusContainer

setComponentManagerManager

public void setComponentManagerManager(ComponentManagerManager componentManagerManager)
Specified by:
setComponentManagerManager in interface MutablePlexusContainer

getLifecycleHandlerManager

public LifecycleHandlerManager getLifecycleHandlerManager()
Specified by:
getLifecycleHandlerManager in interface MutablePlexusContainer

setLifecycleHandlerManager

public void setLifecycleHandlerManager(LifecycleHandlerManager lifecycleHandlerManager)
Specified by:
setLifecycleHandlerManager in interface MutablePlexusContainer

getComponentDiscovererManager

public ComponentDiscovererManager getComponentDiscovererManager()
Specified by:
getComponentDiscovererManager in interface MutablePlexusContainer

setComponentDiscovererManager

public void setComponentDiscovererManager(ComponentDiscovererManager componentDiscovererManager)
Specified by:
setComponentDiscovererManager in interface MutablePlexusContainer

getComponentFactoryManager

public ComponentFactoryManager getComponentFactoryManager()
Specified by:
getComponentFactoryManager in interface MutablePlexusContainer

setComponentFactoryManager

public void setComponentFactoryManager(ComponentFactoryManager componentFactoryManager)
Specified by:
setComponentFactoryManager in interface MutablePlexusContainer

getComponentLookupManager

public ComponentLookupManager getComponentLookupManager()
Specified by:
getComponentLookupManager in interface MutablePlexusContainer

setComponentLookupManager

public void setComponentLookupManager(ComponentLookupManager componentLookupManager)
Specified by:
setComponentLookupManager in interface MutablePlexusContainer

getComponentComposerManager

public ComponentComposerManager getComponentComposerManager()
Specified by:
getComponentComposerManager in interface MutablePlexusContainer

setComponentComposerManager

public void setComponentComposerManager(ComponentComposerManager componentComposerManager)
Specified by:
setComponentComposerManager in interface MutablePlexusContainer

getLoggerManager

public LoggerManager getLoggerManager()
Specified by:
getLoggerManager in interface MutablePlexusContainer
Specified by:
getLoggerManager in interface PlexusContainer

setLoggerManager

public void setLoggerManager(LoggerManager loggerManager)
Specified by:
setLoggerManager in interface MutablePlexusContainer
Specified by:
setLoggerManager in interface PlexusContainer

getConfiguration

public PlexusConfiguration getConfiguration()
Specified by:
getConfiguration in interface MutablePlexusContainer

setConfiguration

public void setConfiguration(PlexusConfiguration configuration)
Specified by:
setConfiguration in interface MutablePlexusContainer

getParentContainer

public PlexusContainer getParentContainer()
Specified by:
getParentContainer in interface MutablePlexusContainer

getComponentRealm

public org.codehaus.plexus.classworlds.realm.ClassRealm getComponentRealm(String realmId)
Specified by:
getComponentRealm in interface MutablePlexusContainer
Specified by:
getComponentRealm in interface PlexusContainer

removeComponentRealm

public void removeComponentRealm(org.codehaus.plexus.classworlds.realm.ClassRealm realm)
                          throws PlexusContainerException
Description copied from interface: PlexusContainer
Dissociate the realm with the specified id from the container. This will remove all components contained in the realm from the component repository.

Specified by:
removeComponentRealm in interface PlexusContainer
Parameters:
realm - Realm to remove from the container.
Throws:
PlexusContainerException

getLookupRealm

public org.codehaus.plexus.classworlds.realm.ClassRealm getLookupRealm(Object component)
Utility method to get a default lookup realm for a component.

Specified by:
getLookupRealm in interface PlexusContainer
Returns:

setConfigurationSource

public void setConfigurationSource(ConfigurationSource configurationSource)
Specified by:
setConfigurationSource in interface MutablePlexusContainer

getConfigurationSource

public ConfigurationSource getConfigurationSource()
Specified by:
getConfigurationSource in interface MutablePlexusContainer


Copyright © 2001-2008 Codehaus. All Rights Reserved.