org.codehaus.plexus

## Class DefaultPlexusContainer

- java.lang.Object
- - org.codehaus.plexus.logging.AbstractLogEnabled
  - - org.codehaus.plexus.DefaultPlexusContainer

All Implemented Interfaces:
  LogEnabled, PlexusContainer

    public class DefaultPlexusContainer
    extends AbstractLogEnabled
    implements PlexusContainer

### Field Summary

Fields
`static String` `BOOTSTRAP_CONFIGURATION`
`protected PlexusConfiguration` `configuration`

### Fields inherited from interface org.codehaus.plexus.PlexusContainer

`ROLE`

### Constructor Summary

Constructors
Constructor and Description
`DefaultPlexusContainer()`

### Method Summary

Methods
`void` `addComponentDescriptor(ComponentDescriptor componentDescriptor)`
`void` `addContextValue(Object key, Object value)`
`void` `addJarRepository(File repository)`
`void` `addJarResource(File jar)`
`void` `composeComponent(Object component, ComponentDescriptor componentDescriptor)`
`PlexusContainer` `createChildContainer(String name, List classpathJars, Map context)`
`PlexusContainer` `createChildContainer(String name, List classpathJars, Map context, List discoveryListeners)`
`Object` `createComponentInstance(ComponentDescriptor componentDescriptor)`
`List` `discoverComponents(ClassRealm classRealm)` TODO: Enhance the ComponentRepository so that it can take entire ComponentSetDescriptors instead of just ComponentDescriptors.
`void` `dispose()`
`protected void` `disposeAllComponents()`
`PlexusContainer` `getChildContainer(String name)`
`ClassWorld` `getClassWorld()`
`ComponentDescriptor` `getComponentDescriptor(String componentKey)`
`List` `getComponentDescriptorList(String role)`
`Map` `getComponentDescriptorMap(String role)`
`ClassRealm` `getComponentRealm(String id)` Deprecated. Use getContainerRealm() instead.
`ClassRealm` `getContainerRealm()`
`Context` `getContext()`
`ClassRealm` `getCoreRealm()`
`Date` `getCreationDate()`
`protected Reader` `getInterpolationConfigurationReader(Reader reader)`
`Logger` `getLogger()`
`LoggerManager` `getLoggerManager()`
`String` `getName()`
`boolean` `hasChildContainer(String name)`
`boolean` `hasComponent(String componentKey)`
`boolean` `hasComponent(String role, String roleHint)`
`void` `initialize()`
`protected void` `initializeConfiguration()`
`protected void` `initializeName()` Create a name for our application if one doesn't exist.
`void` `initializeResources()`
`boolean` `isInitialized()`
`boolean` `isStarted()`
`protected void` `loadComponentsOnStart()`
`Object` `lookup(String componentKey)`
`Object` `lookup(String role, String roleHint)`
`List` `lookupList(String role)`
`Map` `lookupMap(String role)`
`void` `registerComponentDiscoveryListener(ComponentDiscoveryListener listener)`
`void` `registerComponentDiscoveryListeners()`
`void` `release(Object component)`
`void` `releaseAll(List components)`
`void` `releaseAll(Map components)`
`void` `removeChildContainer(String name)`
`void` `removeComponentDiscoveryListener(ComponentDiscoveryListener listener)`
`void` `resume(Object component)`
`void` `setClassWorld(ClassWorld classWorld)`
`void` `setConfigurationResource(Reader configuration)`
`void` `setCoreRealm(ClassRealm coreRealm)`
`void` `setLoggerManager(LoggerManager loggerManager)`
`void` `setName(String name)`
`void` `setParentPlexusContainer(PlexusContainer parentContainer)`
`void` `start()`
`void` `suspend(Object component)`

### 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

#### configuration

    protected PlexusConfiguration configuration

#### BOOTSTRAP_CONFIGURATION

    public static final String BOOTSTRAP_CONFIGURATION

See Also:
  Constant Field Values

### Constructor Detail

#### DefaultPlexusContainer

    public DefaultPlexusContainer()

### Method Detail

#### getCreationDate

    public Date getCreationDate()

Specified by:
  `getCreationDate` in interface `PlexusContainer`

#### hasChildContainer

    public boolean hasChildContainer(String name)

Specified by:
  `hasChildContainer` in interface `PlexusContainer`

#### removeChildContainer

    public void removeChildContainer(String name)

Specified by:
  `removeChildContainer` in interface `PlexusContainer`

#### getChildContainer

    public PlexusContainer getChildContainer(String name)

Specified by:
  `getChildContainer` in interface `PlexusContainer`

#### createChildContainer

    public PlexusContainer createChildContainer(String name,
                                       List classpathJars,
                                       Map context)
                                         throws PlexusContainerException

Specified by:
  `createChildContainer` in interface `PlexusContainer`
Throws:
  `PlexusContainerException`

#### createChildContainer

    public PlexusContainer createChildContainer(String name,
                                       List classpathJars,
                                       Map context,
                                       List discoveryListeners)
                                         throws PlexusContainerException

Specified by:
  `createChildContainer` in interface `PlexusContainer`
Throws:
  `PlexusContainerException`

#### lookup

    public Object lookup(String componentKey)
                  throws ComponentLookupException

Specified by:
  `lookup` in interface `PlexusContainer`
Throws:
  `ComponentLookupException`

#### lookupMap

    public Map lookupMap(String role)
                  throws ComponentLookupException

Specified by:
  `lookupMap` in interface `PlexusContainer`
Throws:
  `ComponentLookupException`

#### lookupList

    public List lookupList(String role)
                    throws ComponentLookupException

Specified by:
  `lookupList` in interface `PlexusContainer`
Throws:
  `ComponentLookupException`

#### lookup

    public Object lookup(String role,
                String roleHint)
                  throws ComponentLookupException

Specified by:
  `lookup` in interface `PlexusContainer`
Throws:
  `ComponentLookupException`

#### getComponentDescriptor

    public ComponentDescriptor getComponentDescriptor(String componentKey)

Specified by:
  `getComponentDescriptor` in interface `PlexusContainer`

#### getComponentDescriptorMap

    public Map getComponentDescriptorMap(String role)

Specified by:
  `getComponentDescriptorMap` in interface `PlexusContainer`

#### getComponentDescriptorList

    public List getComponentDescriptorList(String role)

Specified by:
  `getComponentDescriptorList` in interface `PlexusContainer`

#### addComponentDescriptor

    public void addComponentDescriptor(ComponentDescriptor componentDescriptor)
                                throws ComponentRepositoryException

Specified by:
  `addComponentDescriptor` in interface `PlexusContainer`
Throws:
  `ComponentRepositoryException`

#### release

    public void release(Object component)
                 throws ComponentLifecycleException

Specified by:
  `release` in interface `PlexusContainer`
Throws:
  `ComponentLifecycleException`

#### releaseAll

    public void releaseAll(Map components)
                    throws ComponentLifecycleException

Specified by:
  `releaseAll` in interface `PlexusContainer`
Throws:
  `ComponentLifecycleException`

#### releaseAll

    public void releaseAll(List components)
                    throws ComponentLifecycleException

Specified by:
  `releaseAll` in interface `PlexusContainer`
Throws:
  `ComponentLifecycleException`

#### hasComponent

    public boolean hasComponent(String componentKey)

Specified by:
  `hasComponent` in interface `PlexusContainer`

#### hasComponent

    public boolean hasComponent(String role,
                       String roleHint)

Specified by:
  `hasComponent` in interface `PlexusContainer`

#### suspend

    public void suspend(Object component)
                 throws ComponentLifecycleException

Specified by:
  `suspend` in interface `PlexusContainer`
Throws:
  `ComponentLifecycleException`

#### resume

    public void resume(Object component)
                throws ComponentLifecycleException

Specified by:
  `resume` in interface `PlexusContainer`
Throws:
  `ComponentLifecycleException`

#### getComponentRealm

    public ClassRealm getComponentRealm(String id)

Deprecated. Use getContainerRealm() instead.

Specified by:
  `getComponentRealm` in interface `PlexusContainer`

#### isInitialized

    public boolean isInitialized()

Specified by:
  `isInitialized` in interface `PlexusContainer`

#### initialize

    public void initialize()
                    throws PlexusContainerException

Specified by:
  `initialize` in interface `PlexusContainer`
Throws:
  `PlexusContainerException`

#### registerComponentDiscoveryListeners

    public void registerComponentDiscoveryListeners()
                                             throws ComponentLookupException

Throws:
  `ComponentLookupException`

#### discoverComponents

    public List discoverComponents(ClassRealm classRealm)
                            throws PlexusConfigurationException,
                                   ComponentRepositoryException

TODO: Enhance the ComponentRepository so that it can take entire ComponentSetDescriptors instead of just ComponentDescriptors.

Throws:
  `PlexusConfigurationException`
  `ComponentRepositoryException`

#### isStarted

    public boolean isStarted()

Specified by:
  `isStarted` in interface `PlexusContainer`

#### start

    public void start()
               throws PlexusContainerException

Specified by:
  `start` in interface `PlexusContainer`
Throws:
  `PlexusContainerException`

#### dispose

    public void dispose()

Specified by:
  `dispose` in interface `PlexusContainer`

#### disposeAllComponents

    protected void disposeAllComponents()

#### setParentPlexusContainer

    public void setParentPlexusContainer(PlexusContainer parentContainer)

Specified by:
  `setParentPlexusContainer` in interface `PlexusContainer`

#### addContextValue

    public void addContextValue(Object key,
                       Object value)

Specified by:
  `addContextValue` in interface `PlexusContainer`

#### setConfigurationResource

    public void setConfigurationResource(Reader configuration)
                                  throws PlexusConfigurationResourceException

Specified by:
  `setConfigurationResource` in interface `PlexusContainer`
Throws:
  `PlexusConfigurationResourceException`
See Also:
  `PlexusContainer.setConfigurationResource(Reader)`

#### loadComponentsOnStart

    protected void loadComponentsOnStart()
                                  throws PlexusConfigurationException,
                                         ComponentLookupException

Throws:
  `PlexusConfigurationException`
  `ComponentLookupException`

#### getName

    public String getName()

#### setName

    public void setName(String name)

#### getClassWorld

    public ClassWorld getClassWorld()

#### setClassWorld

    public void setClassWorld(ClassWorld classWorld)

#### getCoreRealm

    public ClassRealm getCoreRealm()

#### setCoreRealm

    public void setCoreRealm(ClassRealm coreRealm)

#### getContainerRealm

    public ClassRealm getContainerRealm()

Specified by:
  `getContainerRealm` in interface `PlexusContainer`

#### initializeName

    protected void initializeName()

Create a name for our application if one doesn't exist.

#### getContext

    public Context getContext()

Specified by:
  `getContext` in interface `PlexusContainer`

#### initializeConfiguration

    protected void initializeConfiguration()
                                    throws ConfigurationProcessingException,
                                           ConfigurationResourceNotFoundException,
                                           PlexusConfigurationException

Throws:
  `ConfigurationProcessingException`
  `ConfigurationResourceNotFoundException`
  `PlexusConfigurationException`

#### getInterpolationConfigurationReader

    protected Reader getInterpolationConfigurationReader(Reader reader)

#### initializeResources

    public void initializeResources()
                             throws PlexusConfigurationException

Throws:
  `PlexusConfigurationException`

#### addJarResource

    public void addJarResource(File jar)
                        throws PlexusContainerException

Specified by:
  `addJarResource` in interface `PlexusContainer`
Throws:
  `PlexusContainerException`

#### addJarRepository

    public void addJarRepository(File repository)

Specified by:
  `addJarRepository` in interface `PlexusContainer`

#### getLogger

    public Logger getLogger()

Specified by:
  `getLogger` in interface `PlexusContainer`
Overrides:
  `getLogger` in class `AbstractLogEnabled`

#### createComponentInstance

    public Object createComponentInstance(ComponentDescriptor componentDescriptor)
                                   throws ComponentInstantiationException,
                                          ComponentLifecycleException

Specified by:
  `createComponentInstance` in interface `PlexusContainer`
Throws:
  `ComponentInstantiationException`
  `ComponentLifecycleException`

#### composeComponent

    public void composeComponent(Object component,
                        ComponentDescriptor componentDescriptor)
                          throws CompositionException,
                                 UndefinedComponentComposerException

Specified by:
  `composeComponent` in interface `PlexusContainer`
Throws:
  `CompositionException`
  `UndefinedComponentComposerException`

#### registerComponentDiscoveryListener

    public void registerComponentDiscoveryListener(ComponentDiscoveryListener listener)

Specified by:
  `registerComponentDiscoveryListener` in interface `PlexusContainer`

#### removeComponentDiscoveryListener

    public void removeComponentDiscoveryListener(ComponentDiscoveryListener listener)

Specified by:
  `removeComponentDiscoveryListener` in interface `PlexusContainer`

#### setLoggerManager

    public void setLoggerManager(LoggerManager loggerManager)

Specified by:
  `setLoggerManager` in interface `PlexusContainer`

#### getLoggerManager

    public LoggerManager getLoggerManager()

Specified by:
  `getLoggerManager` in interface `PlexusContainer`