org.codehaus.plexus

Class DefaultPlexusContainer

Implemented Interfaces:
LogEnabled, PlexusContainer

public class DefaultPlexusContainer
extends AbstractLogEnabled
implements PlexusContainer

Field Summary

static String
BOOTSTRAP_CONFIGURATION
protected PlexusConfiguration
configuration

Fields inherited from interface org.codehaus.plexus.PlexusContainer

ROLE

Constructor Summary

DefaultPlexusContainer()

Method Summary

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, getLogger, setupLogger, setupLogger, setupLogger

Field Details

BOOTSTRAP_CONFIGURATION

public static final String BOOTSTRAP_CONFIGURATION

configuration

protected PlexusConfiguration configuration

Constructor Details

DefaultPlexusContainer

public DefaultPlexusContainer()

Method Details

addComponentDescriptor

public void addComponentDescriptor(ComponentDescriptor componentDescriptor)
            throws ComponentRepositoryException
Specified by:
addComponentDescriptor in interface PlexusContainer

addContextValue

public void addContextValue(Object key,
                            Object value)
Specified by:
addContextValue in interface PlexusContainer

addJarRepository

public void addJarRepository(File repository)
Specified by:
addJarRepository in interface PlexusContainer

addJarResource

public void addJarResource(File jar)
            throws PlexusContainerException
Specified by:
addJarResource in interface PlexusContainer

composeComponent

public void composeComponent(Object component,
                             ComponentDescriptor componentDescriptor)
            throws CompositionException,
                   UndefinedComponentComposerException
Specified by:
composeComponent in interface PlexusContainer

createChildContainer

public PlexusContainer createChildContainer(String name,
                                            List classpathJars,
                                            Map context)
            throws PlexusContainerException
Specified by:
createChildContainer in interface PlexusContainer

createChildContainer

public PlexusContainer createChildContainer(String name,
                                            List classpathJars,
                                            Map context,
                                            List discoveryListeners)
            throws PlexusContainerException
Specified by:
createChildContainer in interface PlexusContainer

createComponentInstance

public Object createComponentInstance(ComponentDescriptor componentDescriptor)
            throws ComponentInstantiationException,
                   ComponentLifecycleException
Specified by:
createComponentInstance in interface PlexusContainer

discoverComponents

public List discoverComponents(ClassRealm classRealm)
            throws PlexusConfigurationException,
                   ComponentRepositoryException
TODO: Enhance the ComponentRepository so that it can take entire ComponentSetDescriptors instead of just ComponentDescriptors.

dispose

public void dispose()
Specified by:
dispose in interface PlexusContainer

disposeAllComponents

protected void disposeAllComponents()

getChildContainer

public PlexusContainer getChildContainer(String name)
Specified by:
getChildContainer in interface PlexusContainer

getClassWorld

public ClassWorld getClassWorld()

getComponentDescriptor

public ComponentDescriptor getComponentDescriptor(String componentKey)
Specified by:
getComponentDescriptor in interface PlexusContainer

getComponentDescriptorList

public List getComponentDescriptorList(String role)
Specified by:
getComponentDescriptorList in interface PlexusContainer

getComponentDescriptorMap

public Map getComponentDescriptorMap(String role)
Specified by:
getComponentDescriptorMap in interface PlexusContainer

getComponentRealm

public ClassRealm getComponentRealm(String id)

Deprecated. Use getContainerRealm() instead.

Specified by:
getComponentRealm in interface PlexusContainer

getContainerRealm

public ClassRealm getContainerRealm()
Specified by:
getContainerRealm in interface PlexusContainer

getContext

public Context getContext()
Specified by:
getContext in interface PlexusContainer

getCoreRealm

public ClassRealm getCoreRealm()

getCreationDate

public Date getCreationDate()
Specified by:
getCreationDate in interface PlexusContainer

getInterpolationConfigurationReader

protected Reader getInterpolationConfigurationReader(Reader reader)

getLogger

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

getLoggerManager

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

getName

public String getName()

hasChildContainer

public boolean hasChildContainer(String name)
Specified by:
hasChildContainer in interface PlexusContainer

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

initialize

public void initialize()
            throws PlexusContainerException
Specified by:
initialize in interface PlexusContainer

initializeConfiguration

protected void initializeConfiguration()
            throws ConfigurationProcessingException,
                   ConfigurationResourceNotFoundException,
                   PlexusConfigurationException

initializeName

protected void initializeName()
Create a name for our application if one doesn't exist.

initializeResources

public void initializeResources()
            throws PlexusConfigurationException

isInitialized

public boolean isInitialized()
Specified by:
isInitialized in interface PlexusContainer

isStarted

public boolean isStarted()
Specified by:
isStarted in interface PlexusContainer

loadComponentsOnStart

protected void loadComponentsOnStart()
            throws PlexusConfigurationException,
                   ComponentLookupException

lookup

public Object lookup(String componentKey)
            throws ComponentLookupException
Specified by:
lookup in interface PlexusContainer

lookup

public Object lookup(String role,
                     String roleHint)
            throws ComponentLookupException
Specified by:
lookup in interface PlexusContainer

lookupList

public List lookupList(String role)
            throws ComponentLookupException
Specified by:
lookupList in interface PlexusContainer

lookupMap

public Map lookupMap(String role)
            throws ComponentLookupException
Specified by:
lookupMap in interface PlexusContainer

registerComponentDiscoveryListener

public void registerComponentDiscoveryListener(ComponentDiscoveryListener listener)
Specified by:
registerComponentDiscoveryListener in interface PlexusContainer

registerComponentDiscoveryListeners

public void registerComponentDiscoveryListeners()
            throws ComponentLookupException

release

public void release(Object component)
            throws ComponentLifecycleException
Specified by:
release in interface PlexusContainer

releaseAll

public void releaseAll(List components)
            throws ComponentLifecycleException
Specified by:
releaseAll in interface PlexusContainer

releaseAll

public void releaseAll(Map components)
            throws ComponentLifecycleException
Specified by:
releaseAll in interface PlexusContainer

removeChildContainer

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

removeComponentDiscoveryListener

public void removeComponentDiscoveryListener(ComponentDiscoveryListener listener)
Specified by:
removeComponentDiscoveryListener in interface PlexusContainer

resume

public void resume(Object component)
            throws ComponentLifecycleException
Specified by:
resume in interface PlexusContainer

setClassWorld

public void setClassWorld(ClassWorld classWorld)

setConfigurationResource

public void setConfigurationResource(Reader configuration)
            throws PlexusConfigurationResourceException
Specified by:
setConfigurationResource in interface PlexusContainer

setCoreRealm

public void setCoreRealm(ClassRealm coreRealm)

setLoggerManager

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

setName

public void setName(String name)

setParentPlexusContainer

public void setParentPlexusContainer(PlexusContainer parentContainer)
Specified by:
setParentPlexusContainer in interface PlexusContainer

start

public void start()
            throws PlexusContainerException
Specified by:
start in interface PlexusContainer

suspend

public void suspend(Object component)
            throws ComponentLifecycleException
Specified by:
suspend in interface PlexusContainer