Package org.codehaus.plexus
Interface PlexusContainer
-
public interface PlexusContainer
The core component of Plexus. This is the entry-point for loading and accessing other components, as well as an element in a hierarchy of containers. A Plexus Container can also itself be a component, however, the hierarchy must be bootstrapped by a PlexusContainer implementation.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ROLE
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
addComponentDescriptor(ComponentDescriptor componentDescriptor)
Adds a component descriptor to this container.void
addContextValue(java.lang.Object key, java.lang.Object value)
Add a key/value pair to this container's Context.void
addJarRepository(java.io.File repository)
Adds a directory of jar resources.void
addJarResource(java.io.File resource)
Adds a jar to this container's ClassRealm - whose components are then discovered (via the various registered ComponentDiscoverer's).java.lang.Object
autowire(java.lang.Object component)
Assembles a component and returns it.java.lang.Object
createAndAutowire(java.lang.String clazz)
Creates a corrosponding component instance found in this container's classrealm, then autowires it.PlexusContainer
createChildContainer(java.lang.String name, java.util.Set urls)
PlexusContainer
createChildContainer(java.lang.String name, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
org.codehaus.plexus.classworlds.realm.ClassRealm
createComponentRealm(java.lang.String id, java.util.List jars)
Creates and returns a new class realm under this container's realm for the given list of jars.void
dispose()
Disposes of this container, which in turn disposes all of it's components.PlexusContainer
getChildContainer(java.lang.String name)
Returns a child container with the unique name.ComponentDescriptor
getComponentDescriptor(java.lang.String role)
Returns the ComponentDescriptor with the given component role and the default role hint.ComponentDescriptor
getComponentDescriptor(java.lang.String role, java.lang.String roleHint)
Returns the ComponentDescriptor with the given component role and hint.ComponentDescriptor
getComponentDescriptor(java.lang.String role, java.lang.String roleHint, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
Returns the ComponentDescriptor with the given component role and hint.ComponentDescriptor
getComponentDescriptor(java.lang.String role, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
Returns the ComponentDescriptor with the given component role and the default role hint.java.util.List
getComponentDescriptorList(java.lang.String role)
Returns a List of ComponentDescriptors with the given role.java.util.List
getComponentDescriptorList(java.lang.String role, org.codehaus.plexus.classworlds.realm.ClassRealm componentRealm)
Returns a List of ComponentDescriptors with the given role.java.util.Map
getComponentDescriptorMap(java.lang.String role)
Returns a Map of ComponentDescriptors with the given role, keyed by role-hint.java.util.Map
getComponentDescriptorMap(java.lang.String role, org.codehaus.plexus.classworlds.realm.ClassRealm componentRealm)
Returns a Map of ComponentDescriptors with the given role, keyed by role-hint.org.codehaus.plexus.classworlds.realm.ClassRealm
getComponentRealm(java.lang.String realmId)
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.java.util.Date
getCreationDate()
Returns the date this container was created.Logger
getLogger()
Deprecated.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 {@see MutablePlexusContainer#setLookupRealm(ClassRealm)}.org.codehaus.plexus.classworlds.realm.ClassRealm
getLookupRealm(java.lang.Object component)
XXX ideally i'd like to place this in a plexus container specific utility class.java.lang.String
getName()
Returns the unique name of this container in the container hierarchy.boolean
hasChildContainer(java.lang.String name)
Returns true if this container has a child with the given name.boolean
hasComponent(java.lang.String role)
Returns true if this container has the keyed component.boolean
hasComponent(java.lang.String role, java.lang.String roleHint)
Returns true if this container has a component with the given role/role-hint.boolean
isReloadingEnabled()
Returns true if a component's metadata may be reloaded, otherwise, it may be loaded only once.java.lang.Object
lookup(java.lang.Class componentClass)
Looks up and returns a component object with the given unique key or role.java.lang.Object
lookup(java.lang.Class role, java.lang.String roleHint)
Looks up and returns a component object with the given unique role/role-hint combination.java.lang.Object
lookup(java.lang.Class role, java.lang.String roleHint, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
Looks up and returns a component object with the given unique role/role-hint combination.java.lang.Object
lookup(java.lang.Class componentClass, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
Looks up and returns a component object with the given unique key or role.java.lang.Object
lookup(java.lang.String componentKey)
Looks up and returns a component object with the given unique key or role.java.lang.Object
lookup(java.lang.String role, java.lang.String roleHint)
Looks up and returns a component object with the given unique role/role-hint combination.java.lang.Object
lookup(java.lang.String role, java.lang.String roleHint, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
Looks up and returns a component object with the given unique role/role-hint combination.java.lang.Object
lookup(java.lang.String componentKey, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
Looks up and returns a component object with the given unique key or role.java.util.List
lookupList(java.lang.Class role)
Looks up and returns a List of component objects with the given role.java.util.List
lookupList(java.lang.Class role, java.util.List roles)
Looks up and returns a List of component objects with the given role.java.util.List
lookupList(java.lang.Class role, java.util.List roles, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
Looks up and returns a List of component objects with the given role.java.util.List
lookupList(java.lang.Class role, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
Looks up and returns a List of component objects with the given role.java.util.List
lookupList(java.lang.String role)
Looks up and returns a List of component objects with the given role.java.util.List
lookupList(java.lang.String role, java.util.List roles)
Looks up and returns a List of component objects with the given role.java.util.List
lookupList(java.lang.String role, java.util.List roles, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
Looks up and returns a List of component objects with the given role.java.util.List
lookupList(java.lang.String role, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
Looks up and returns a List of component objects with the given role.java.util.Map
lookupMap(java.lang.Class role)
Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.java.util.Map
lookupMap(java.lang.Class role, java.util.List roles)
Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.java.util.Map
lookupMap(java.lang.Class role, java.util.List roles, 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.java.util.Map
lookupMap(java.lang.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.java.util.Map
lookupMap(java.lang.String role)
Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.java.util.Map
lookupMap(java.lang.String role, java.util.List roles)
Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.java.util.Map
lookupMap(java.lang.String role, java.util.List roles, 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.java.util.Map
lookupMap(java.lang.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.void
registerComponentDiscoveryListener(ComponentDiscoveryListener listener)
Adds the listener to this container.void
release(java.lang.Object component)
Releases the component from the container.void
releaseAll(java.util.List components)
Releases all Listed components from the container.void
releaseAll(java.util.Map components)
Releases all Mapped component values from the container.void
removeChildContainer(java.lang.String name)
Removes the keyed child from this container.void
removeComponentDiscoveryListener(ComponentDiscoveryListener listener)
Removes the listener from this container.void
resume(java.lang.Object component)
Attempts to resume execution of the component.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(java.lang.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.void
suspend(java.lang.Object component)
Attempts to suspend execution of the component.
-
-
-
Method Detail
-
getName
java.lang.String getName()
Returns the unique name of this container in the container hierarchy.- Returns:
- the unique name of this container in the container hierarchy
-
getCreationDate
java.util.Date getCreationDate()
Returns the date this container was created.- Returns:
- the date this container was created
-
hasChildContainer
boolean hasChildContainer(java.lang.String name)
Returns true if this container has a child with the given name.- Parameters:
name
- a key unique amongst this container's children- Returns:
- true if this container has a child with the given name
-
removeChildContainer
void removeChildContainer(java.lang.String name)
Removes the keyed child from this container. Does not necessarily dispose the children.- Parameters:
name
- a key unique amongst this container's children
-
getChildContainer
PlexusContainer getChildContainer(java.lang.String name)
Returns a child container with the unique name.- Parameters:
name
- a key unique amongst this container's children- Returns:
- the keyed child container
-
lookup
java.lang.Object lookup(java.lang.String componentKey) throws ComponentLookupException
Looks up and returns a component object with the given unique key or role.- Parameters:
componentKey
- a unique key for the desired component- Returns:
- a Plexus component object
- Throws:
ComponentLookupException
-
lookup
java.lang.Object lookup(java.lang.String componentKey, org.codehaus.plexus.classworlds.realm.ClassRealm realm) throws ComponentLookupException
Looks up and returns a component object with the given unique key or role.- Parameters:
componentKey
- a unique key for the desired component- Returns:
- a Plexus component object
- Throws:
ComponentLookupException
-
lookup
java.lang.Object lookup(java.lang.String role, java.lang.String roleHint) throws ComponentLookupException
Looks up and returns a component object with the given unique role/role-hint combination.- Parameters:
role
- a non-unique key for the desired componentroleHint
- a hint for the desired component implementation- Returns:
- a Plexus component object
- Throws:
ComponentLookupException
-
lookup
java.lang.Object lookup(java.lang.String role, java.lang.String roleHint, org.codehaus.plexus.classworlds.realm.ClassRealm realm) throws ComponentLookupException
Looks up and returns a component object with the given unique role/role-hint combination.- Parameters:
role
- a non-unique key for the desired componentroleHint
- a hint for the desired component implementation- Returns:
- a Plexus component object
- Throws:
ComponentLookupException
-
lookup
java.lang.Object lookup(java.lang.Class componentClass) throws ComponentLookupException
Looks up and returns a component object with the given unique key or role.- Parameters:
componentClass
- a unique key for the desired component- Returns:
- a Plexus component object
- Throws:
ComponentLookupException
-
lookup
java.lang.Object lookup(java.lang.Class componentClass, org.codehaus.plexus.classworlds.realm.ClassRealm realm) throws ComponentLookupException
Looks up and returns a component object with the given unique key or role.- Parameters:
componentClass
- a unique key for the desired component- Returns:
- a Plexus component object
- Throws:
ComponentLookupException
-
lookup
java.lang.Object lookup(java.lang.Class role, java.lang.String roleHint) throws ComponentLookupException
Looks up and returns a component object with the given unique role/role-hint combination.- Parameters:
role
- a non-unique class key for the desired componentroleHint
- a hint for the desired component implementation- Returns:
- a Plexus component object
- Throws:
ComponentLookupException
-
lookup
java.lang.Object lookup(java.lang.Class role, java.lang.String roleHint, org.codehaus.plexus.classworlds.realm.ClassRealm realm) throws ComponentLookupException
Looks up and returns a component object with the given unique role/role-hint combination.- Parameters:
role
- a non-unique class key for the desired componentroleHint
- a hint for the desired component implementation- Returns:
- a Plexus component object
- Throws:
ComponentLookupException
-
lookupList
java.util.List lookupList(java.lang.String role) throws ComponentLookupException
Looks up and returns a List of component objects with the given role.- Parameters:
role
- a non-unique key for the desired components- Returns:
- a List of component objects
- Throws:
ComponentLookupException
-
lookupList
java.util.List lookupList(java.lang.String role, java.util.List roles) throws ComponentLookupException
Looks up and returns a List of component objects with the given role.- Parameters:
role
- a non-unique key for the desired components- Returns:
- a List of component objects
- Throws:
ComponentLookupException
-
lookupList
java.util.List lookupList(java.lang.String role, org.codehaus.plexus.classworlds.realm.ClassRealm realm) throws ComponentLookupException
Looks up and returns a List of component objects with the given role.- Parameters:
role
- a non-unique key for the desired components- Returns:
- a List of component objects
- Throws:
ComponentLookupException
-
lookupList
java.util.List lookupList(java.lang.String role, java.util.List roles, org.codehaus.plexus.classworlds.realm.ClassRealm realm) throws ComponentLookupException
Looks up and returns a List of component objects with the given role.- Parameters:
role
- a non-unique key for the desired components- Returns:
- a List of component objects
- Throws:
ComponentLookupException
-
lookupList
java.util.List lookupList(java.lang.Class role, java.util.List roles) throws ComponentLookupException
Looks up and returns a List of component objects with the given role.- Parameters:
role
- a non-unique class key for the desired components- Returns:
- a List of component objects
- Throws:
ComponentLookupException
-
lookupList
java.util.List lookupList(java.lang.Class role) throws ComponentLookupException
Looks up and returns a List of component objects with the given role.- Parameters:
role
- a non-unique class key for the desired components- Returns:
- a List of component objects
- Throws:
ComponentLookupException
-
lookupList
java.util.List lookupList(java.lang.Class role, java.util.List roles, org.codehaus.plexus.classworlds.realm.ClassRealm realm) throws ComponentLookupException
Looks up and returns a List of component objects with the given role.- Parameters:
role
- a non-unique class key for the desired components- Returns:
- a List of component objects
- Throws:
ComponentLookupException
-
lookupList
java.util.List lookupList(java.lang.Class role, org.codehaus.plexus.classworlds.realm.ClassRealm realm) throws ComponentLookupException
Looks up and returns a List of component objects with the given role.- Parameters:
role
- a non-unique class key for the desired components- Returns:
- a List of component objects
- Throws:
ComponentLookupException
-
lookupMap
java.util.Map lookupMap(java.lang.String role, java.util.List roles) throws ComponentLookupException
Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.- Parameters:
role
- a non-unique key for the desired components- Returns:
- a Map of component objects
- Throws:
ComponentLookupException
-
lookupMap
java.util.Map lookupMap(java.lang.String role) throws ComponentLookupException
Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.- Parameters:
role
- a non-unique key for the desired components- Returns:
- a Map of component objects
- Throws:
ComponentLookupException
-
lookupMap
java.util.Map lookupMap(java.lang.String role, java.util.List roles, org.codehaus.plexus.classworlds.realm.ClassRealm realm) throws ComponentLookupException
Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.- Parameters:
role
- a non-unique key for the desired components- Returns:
- a Map of component objects
- Throws:
ComponentLookupException
-
lookupMap
java.util.Map lookupMap(java.lang.String role, org.codehaus.plexus.classworlds.realm.ClassRealm realm) throws ComponentLookupException
Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.- Parameters:
role
- a non-unique key for the desired components- Returns:
- a Map of component objects
- Throws:
ComponentLookupException
-
lookupMap
java.util.Map lookupMap(java.lang.Class role, java.util.List roles) throws ComponentLookupException
Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.- Parameters:
role
- a non-unique class key for the desired components- Returns:
- a Map of component objects
- Throws:
ComponentLookupException
-
lookupMap
java.util.Map lookupMap(java.lang.Class role) throws ComponentLookupException
Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.- Parameters:
role
- a non-unique class key for the desired components- Returns:
- a Map of component objects
- Throws:
ComponentLookupException
-
lookupMap
java.util.Map lookupMap(java.lang.Class role, java.util.List roles, org.codehaus.plexus.classworlds.realm.ClassRealm realm) throws ComponentLookupException
Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.- Parameters:
role
- a non-unique class key for the desired components- Returns:
- a Map of component objects
- Throws:
ComponentLookupException
-
lookupMap
java.util.Map lookupMap(java.lang.Class role, org.codehaus.plexus.classworlds.realm.ClassRealm realm) throws ComponentLookupException
Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.- Parameters:
role
- a non-unique class key for the desired components- Returns:
- a Map of component objects
- Throws:
ComponentLookupException
-
getComponentDescriptor
ComponentDescriptor getComponentDescriptor(java.lang.String role)
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.- Parameters:
role
- a unique role for the desired component's descriptor- Returns:
- the ComponentDescriptor with the given component role
-
getComponentDescriptor
ComponentDescriptor getComponentDescriptor(java.lang.String role, java.lang.String roleHint)
Returns the ComponentDescriptor with the given component role and hint. Searches up the hierarchy until one is found, null if none is found.- Parameters:
role
- a unique role for the desired component's descriptorroleHint
- a hint showing which implementation should be used- Returns:
- the ComponentDescriptor with the given component role
-
getComponentDescriptor
ComponentDescriptor getComponentDescriptor(java.lang.String role, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
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.- Parameters:
role
- a unique role for the desired component's descriptorrealm
- The class realm to search- Returns:
- the ComponentDescriptor with the given component role
-
getComponentDescriptor
ComponentDescriptor getComponentDescriptor(java.lang.String role, java.lang.String roleHint, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
Returns the ComponentDescriptor with the given component role and hint. Searches up the hierarchy until one is found, null if none is found.- Parameters:
role
- a unique role for the desired component's descriptorroleHint
- a hint showing which implementation should be usedrealm
- The class realm to search- Returns:
- the ComponentDescriptor with the given component role
-
getComponentDescriptorMap
java.util.Map getComponentDescriptorMap(java.lang.String role)
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.- Parameters:
role
- a non-unique key for the desired components- Returns:
- a Map of component descriptors keyed by role-hint
-
getComponentDescriptorMap
java.util.Map getComponentDescriptorMap(java.lang.String role, org.codehaus.plexus.classworlds.realm.ClassRealm componentRealm)
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.- Parameters:
role
- a non-unique key for the desired components- Returns:
- a Map of component descriptors keyed by role-hint
-
getComponentDescriptorList
java.util.List getComponentDescriptorList(java.lang.String role)
Returns a List of ComponentDescriptors with the given role. Searches up the hierarchy until all are found, an empty List if none are found.- Parameters:
role
- a non-unique key for the desired components- Returns:
- a List of component descriptors
-
getComponentDescriptorList
java.util.List getComponentDescriptorList(java.lang.String role, org.codehaus.plexus.classworlds.realm.ClassRealm componentRealm)
Returns a List of ComponentDescriptors with the given role. Searches up the hierarchy until all are found, an empty List if none are found.- Parameters:
role
- a non-unique key for the desired components- Returns:
- a List of component descriptors
-
addComponentDescriptor
void addComponentDescriptor(ComponentDescriptor componentDescriptor) throws ComponentRepositoryException
Adds a component descriptor to this container. componentDescriptor should have realmId set.- Parameters:
componentDescriptor
-- Throws:
ComponentRepositoryException
-
release
void release(java.lang.Object component) throws ComponentLifecycleException
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).- Parameters:
component
- the plexus component object to release- Throws:
ComponentLifecycleException
-
releaseAll
void releaseAll(java.util.Map components) throws ComponentLifecycleException
Releases all Mapped component values from the container.- Parameters:
components
- Map of plexus component objects to release- Throws:
ComponentLifecycleException
- See Also:
release( Object component )
-
releaseAll
void releaseAll(java.util.List components) throws ComponentLifecycleException
Releases all Listed components from the container.- Parameters:
components
- List of plexus component objects to release- Throws:
ComponentLifecycleException
- See Also:
release( Object component )
-
hasComponent
boolean hasComponent(java.lang.String role)
Returns true if this container has the keyed component.- Parameters:
role
-- Returns:
- true if this container has the keyed component
-
hasComponent
boolean hasComponent(java.lang.String role, java.lang.String roleHint)
Returns true if this container has a component with the given role/role-hint.- Parameters:
role
-roleHint
-- Returns:
- true if this container has a component with the given role/role-hint
-
suspend
void suspend(java.lang.Object component) throws ComponentLifecycleException
Attempts to suspend execution of the component.- Parameters:
component
- a plexus component- Throws:
ComponentLifecycleException
-
resume
void resume(java.lang.Object component) throws ComponentLifecycleException
Attempts to resume execution of the component.- Parameters:
component
- a plexus component- Throws:
ComponentLifecycleException
-
dispose
void dispose()
Disposes of this container, which in turn disposes all of it's components. This container should also remove itself from the container hierarchy.
-
addContextValue
void addContextValue(java.lang.Object key, java.lang.Object value)
Add a key/value pair to this container's Context.- Parameters:
key
- any unique object valid to the Context's implementationvalue
- any object valid to the Context's implementation
-
getContext
Context getContext()
Returns this container's context. A Context is a simple data store used to hold values which may alter the execution of the Container.- Returns:
- this container's context.
-
getContainerRealm
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.- Returns:
- the ClassRealm of this Container
-
registerComponentDiscoveryListener
void registerComponentDiscoveryListener(ComponentDiscoveryListener listener)
Adds the listener to this container. ComponentDiscoveryListeners have the ability to respond to various ComponentDiscoverer events.- Parameters:
listener
- A listener which responds to differnet ComponentDiscoveryEvents
-
removeComponentDiscoveryListener
void removeComponentDiscoveryListener(ComponentDiscoveryListener listener)
Removes the listener from this container.- Parameters:
listener
- A listener to remove
-
addJarRepository
void addJarRepository(java.io.File repository)
Adds a directory of jar resources.- Parameters:
repository
- a directory containing JAR files- See Also:
addJarResource(File)
-
addJarResource
void addJarResource(java.io.File resource) throws PlexusContainerException
Adds a jar to this container's ClassRealm - whose components are then discovered (via the various registered ComponentDiscoverer's).- Parameters:
resource
- a JAR file- Throws:
PlexusContainerException
-
autowire
java.lang.Object autowire(java.lang.Object component) throws CompositionException
Assembles a component and returns it. May bypass the normal component assembly hooks (such as creation of a ComponentDescriptor).- Parameters:
component
- a valid Plexus component- Returns:
- a componsed (dependency-injected) component
- Throws:
CompositionException
-
createAndAutowire
java.lang.Object createAndAutowire(java.lang.String clazz) throws CompositionException, java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessException
Creates a corrosponding component instance found in this container's classrealm, then autowires it.- Parameters:
clazz
- A class available in this container's ClassRealm- Returns:
- A newly created and autowired component
- Throws:
CompositionException
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException
- See Also:
autowire(Object)
-
setReloadingEnabled
void setReloadingEnabled(boolean reloadingEnabled)
Sets the ability to reload a component's metadata multiple times.- Parameters:
reloadingEnabled
- true is a component may be reloaded
-
isReloadingEnabled
boolean isReloadingEnabled()
Returns true if a component's metadata may be reloaded, otherwise, it may be loaded only once.- Returns:
- true if a component's metadata may be reloaded
-
setLoggerManager
void setLoggerManager(LoggerManager loggerManager)
-
getLoggerManager
LoggerManager getLoggerManager()
-
getLogger
Logger getLogger()
Deprecated.
-
setName
void setName(java.lang.String name)
-
setParentPlexusContainer
void setParentPlexusContainer(PlexusContainer container)
Sets the parent of this container.- Parameters:
container
- the parent of this container, null if none
-
createChildContainer
PlexusContainer createChildContainer(java.lang.String name, java.util.Set urls) throws PlexusContainerException
- Throws:
PlexusContainerException
-
createChildContainer
PlexusContainer createChildContainer(java.lang.String name, org.codehaus.plexus.classworlds.realm.ClassRealm realm) throws PlexusContainerException
- Throws:
PlexusContainerException
-
createComponentRealm
org.codehaus.plexus.classworlds.realm.ClassRealm createComponentRealm(java.lang.String id, java.util.List jars) throws PlexusContainerException
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?- Parameters:
id
- unique key for the ClassRealmjars
- list of JARs to place in the realm.- Throws:
PlexusContainerException
- See Also:
addJarResource(File)
-
getComponentRealm
org.codehaus.plexus.classworlds.realm.ClassRealm getComponentRealm(java.lang.String realmId)
-
getLookupRealm
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 {@see MutablePlexusContainer#setLookupRealm(ClassRealm)}.
-
setLookupRealm
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.- 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
org.codehaus.plexus.classworlds.realm.ClassRealm getLookupRealm(java.lang.Object component)
XXX ideally i'd like to place this in a plexus container specific utility class. Utility method to retrieve the lookup realm for a component instance. If the component's classloader is a ClassRealm, that realm is returned, otherwise the result of getLookupRealm is returned.- Parameters:
component
-- Returns:
-
-