public interface PlexusContainer
Modifier and Type | Method and Description |
---|---|
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 resource)
Adds a jar to this container's ClassRealm - whose components are then discovered (via the various registered
ComponentDiscoverer's).
|
Object |
autowire(Object component)
Assembles a component and returns it.
|
Object |
createAndAutowire(String clazz)
Creates a corrosponding component instance found in this container's classrealm, then autowires it.
|
PlexusContainer |
createChildContainer(String name,
List classpathJars,
Map context) |
PlexusContainer |
createChildContainer(String name,
List classpathJars,
Map context,
List discoveryListeners) |
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.
|
void |
dispose()
Disposes of this container, which in turn disposes all of it's components.
|
PlexusContainer |
getChildContainer(String name)
Returns a child container with the unique name.
|
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 roleHint)
Returns the ComponentDescriptor with the given component role and hint.
|
ComponentDescriptor |
getComponentDescriptor(String role,
String roleHint,
org.codehaus.plexus.classworlds.realm.ClassRealm realm)
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 componentRealm)
Returns a List of ComponentDescriptors with the given role.
|
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 componentRealm)
Returns a Map of ComponentDescriptors with the given role, keyed by role-hint.
|
org.codehaus.plexus.classworlds.realm.ClassRealm |
getComponentRealm(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.
|
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
MutablePlexusContainer#setLookupRealm(ClassRealm) . |
org.codehaus.plexus.classworlds.realm.ClassRealm |
getLookupRealm(Object component)
XXX ideally i'd like to place this in a plexus container specific utility class.
|
String |
getName()
Returns the unique name of this container in the container hierarchy.
|
boolean |
hasChildContainer(String name)
Returns true if this container has a child with the given name.
|
boolean |
hasComponent(String role)
Returns true if this container has the keyed component.
|
boolean |
hasComponent(String role,
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.
|
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(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.
|
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(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.
|
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 |
resume(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(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(Object component)
Attempts to suspend execution of the component.
|
static final String ROLE
String getName()
Date getCreationDate()
boolean hasChildContainer(String name)
name
- a key unique amongst this container's childrenvoid removeChildContainer(String name)
name
- a key unique amongst this container's childrenPlexusContainer getChildContainer(String name)
name
- a key unique amongst this container's childrenObject lookup(String componentKey) throws ComponentLookupException
componentKey
- a unique key for the desired componentComponentLookupException
Object lookup(String componentKey, org.codehaus.plexus.classworlds.realm.ClassRealm realm) throws ComponentLookupException
componentKey
- a unique key for the desired componentComponentLookupException
Object lookup(String role, String roleHint) throws ComponentLookupException
role
- a non-unique key for the desired componentroleHint
- a hint for the desired component implementationComponentLookupException
Object lookup(String role, String roleHint, org.codehaus.plexus.classworlds.realm.ClassRealm realm) throws ComponentLookupException
role
- a non-unique key for the desired componentroleHint
- a hint for the desired component implementationComponentLookupException
Object lookup(Class componentClass) throws ComponentLookupException
componentClass
- a unique key for the desired componentComponentLookupException
Object lookup(Class componentClass, org.codehaus.plexus.classworlds.realm.ClassRealm realm) throws ComponentLookupException
componentClass
- a unique key for the desired componentComponentLookupException
Object lookup(Class role, String roleHint) throws ComponentLookupException
role
- a non-unique class key for the desired componentroleHint
- a hint for the desired component implementationComponentLookupException
Object lookup(Class role, String roleHint, org.codehaus.plexus.classworlds.realm.ClassRealm realm) throws ComponentLookupException
role
- a non-unique class key for the desired componentroleHint
- a hint for the desired component implementationComponentLookupException
List lookupList(String role) throws ComponentLookupException
role
- a non-unique key for the desired componentsComponentLookupException
List lookupList(String role, org.codehaus.plexus.classworlds.realm.ClassRealm realm) throws ComponentLookupException
role
- a non-unique key for the desired componentsComponentLookupException
List lookupList(Class role) throws ComponentLookupException
role
- a non-unique class key for the desired componentsComponentLookupException
List lookupList(Class role, org.codehaus.plexus.classworlds.realm.ClassRealm realm) throws ComponentLookupException
role
- a non-unique class key for the desired componentsComponentLookupException
Map lookupMap(String role) throws ComponentLookupException
role
- a non-unique key for the desired componentsComponentLookupException
Map lookupMap(String role, org.codehaus.plexus.classworlds.realm.ClassRealm realm) throws ComponentLookupException
role
- a non-unique key for the desired componentsComponentLookupException
Map lookupMap(Class role) throws ComponentLookupException
role
- a non-unique class key for the desired componentsComponentLookupException
Map lookupMap(Class role, org.codehaus.plexus.classworlds.realm.ClassRealm realm) throws ComponentLookupException
role
- a non-unique class key for the desired componentsComponentLookupException
ComponentDescriptor getComponentDescriptor(String role)
role
- a unique role for the desired component's descriptorComponentDescriptor getComponentDescriptor(String role, String roleHint)
role
- a unique role for the desired component's descriptorroleHint
- a hint showing which implementation should be usedComponentDescriptor getComponentDescriptor(String role, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
role
- a unique role for the desired component's descriptorrealm
- The class realm to searchComponentDescriptor getComponentDescriptor(String role, String roleHint, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
role
- a unique role for the desired component's descriptorroleHint
- a hint showing which implementation should be usedrealm
- The class realm to searchMap getComponentDescriptorMap(String role)
role
- a non-unique key for the desired componentsMap getComponentDescriptorMap(String role, org.codehaus.plexus.classworlds.realm.ClassRealm componentRealm)
role
- a non-unique key for the desired componentsList getComponentDescriptorList(String role)
role
- a non-unique key for the desired componentsList getComponentDescriptorList(String role, org.codehaus.plexus.classworlds.realm.ClassRealm componentRealm)
role
- a non-unique key for the desired componentsvoid addComponentDescriptor(ComponentDescriptor componentDescriptor) throws ComponentRepositoryException
componentDescriptor
- ComponentRepositoryException
void release(Object component) throws ComponentLifecycleException
component
- the plexus component object to releaseComponentLifecycleException
void releaseAll(Map components) throws ComponentLifecycleException
components
- Map of plexus component objects to releaseComponentLifecycleException
release( Object component )
void releaseAll(List components) throws ComponentLifecycleException
components
- List of plexus component objects to releaseComponentLifecycleException
release( Object component )
boolean hasComponent(String role)
role
- boolean hasComponent(String role, String roleHint)
role
- roleHint
- void suspend(Object component) throws ComponentLifecycleException
component
- a plexus componentComponentLifecycleException
void resume(Object component) throws ComponentLifecycleException
component
- a plexus componentComponentLifecycleException
void dispose()
void addContextValue(Object key, Object value)
key
- any unique object valid to the Context's implementationvalue
- any object valid to the Context's implementationContext getContext()
org.codehaus.plexus.classworlds.realm.ClassRealm getContainerRealm()
void registerComponentDiscoveryListener(ComponentDiscoveryListener listener)
listener
- A listener which responds to differnet ComponentDiscoveryEventsvoid removeComponentDiscoveryListener(ComponentDiscoveryListener listener)
listener
- A listener to removevoid addJarRepository(File repository)
repository
- a directory containing JAR filesaddJarResource(File)
void addJarResource(File resource) throws PlexusContainerException
resource
- a JAR filePlexusContainerException
Object autowire(Object component) throws CompositionException
component
- a valid Plexus componentCompositionException
Object createAndAutowire(String clazz) throws CompositionException, ClassNotFoundException, InstantiationException, IllegalAccessException
clazz
- A class available in this container's ClassRealmCompositionException
ClassNotFoundException
InstantiationException
IllegalAccessException
autowire(Object)
void setReloadingEnabled(boolean reloadingEnabled)
reloadingEnabled
- true is a component may be reloadedboolean isReloadingEnabled()
void setLoggerManager(LoggerManager loggerManager)
LoggerManager getLoggerManager()
Logger getLogger()
void setName(String name)
void setParentPlexusContainer(PlexusContainer container)
container
- the parent of this container, null if nonePlexusContainer createChildContainer(String name, List classpathJars, Map context) throws PlexusContainerException
PlexusContainerException
PlexusContainer createChildContainer(String name, List classpathJars, Map context, List discoveryListeners) throws PlexusContainerException
PlexusContainerException
org.codehaus.plexus.classworlds.realm.ClassRealm createComponentRealm(String id, List jars) throws PlexusContainerException
id
- unique key for the ClassRealmjars
- list of JARs to place in the realm.PlexusContainerException
addJarResource(File)
org.codehaus.plexus.classworlds.realm.ClassRealm getComponentRealm(String realmId)
org.codehaus.plexus.classworlds.realm.ClassRealm getLookupRealm()
MutablePlexusContainer#setLookupRealm(ClassRealm)
.org.codehaus.plexus.classworlds.realm.ClassRealm setLookupRealm(org.codehaus.plexus.classworlds.realm.ClassRealm realm)
realm
- the new realm to use.org.codehaus.plexus.classworlds.realm.ClassRealm getLookupRealm(Object component)
component
- Copyright © 2019. All rights reserved.