public interface PlexusContainer
Modifier and Type | Method and Description |
---|---|
void |
addComponent(Object component,
String role) |
<T> void |
addComponent(T component,
Class<?> role,
String roleHint)
Adds live component instance to this container.
|
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.
|
org.codehaus.plexus.classworlds.realm.ClassRealm |
createChildRealm(String id) |
List<ComponentDescriptor<?>> |
discoverComponents(org.codehaus.plexus.classworlds.realm.ClassRealm childRealm)
Discovers components in the given realm.
|
List<ComponentDescriptor<?>> |
discoverComponents(org.codehaus.plexus.classworlds.realm.ClassRealm realm,
Object data)
Discovers components in the given realm.
|
void |
dispose()
Disposes of this container, which in turn disposes all of it's components.
|
<T> ComponentDescriptor<T> |
getComponentDescriptor(Class<T> type,
String role,
String roleHint)
Returns the ComponentDescriptor with the given component role and hint.
|
ComponentDescriptor<?> |
getComponentDescriptor(String role)
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.
|
<T> List<ComponentDescriptor<T>> |
getComponentDescriptorList(Class<T> type,
String role)
Returns a List of ComponentDescriptors with the given role.
|
List<ComponentDescriptor<?>> |
getComponentDescriptorList(String role)
Returns a List of ComponentDescriptors with the given role.
|
<T> Map<String,ComponentDescriptor<T>> |
getComponentDescriptorMap(Class<T> type,
String role)
Returns a Map of ComponentDescriptors with the given role, keyed by role-hint.
|
Map<String,ComponentDescriptor<?>> |
getComponentDescriptorMap(String role)
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.
|
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
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.
|
boolean |
hasComponent(Class<?> type)
Returns true if this container has a component with the given role/role-hint.
|
boolean |
hasComponent(Class<?> type,
String roleHint)
Returns true if this container has a component with the given role/role-hint.
|
boolean |
hasComponent(Class<?> type,
String role,
String roleHint)
Returns true if this container has a component with the given role/role-hint.
|
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.
|
<T> T |
lookup(Class<T> type)
Looks up and returns a component object with the given unique key or role.
|
<T> T |
lookup(Class<T> type,
String roleHint)
Looks up and returns a component object with the given unique role/role-hint combination.
|
<T> T |
lookup(Class<T> type,
String role,
String roleHint)
Looks up and returns a component object with the given unique role/role-hint combination.
|
<T> T |
lookup(ComponentDescriptor<T> componentDescriptor)
Looks up and returns a component object matching the given component descriptor.
|
Object |
lookup(String role)
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.
|
<T> List<T> |
lookupList(Class<T> type)
Looks up and returns a List of component objects with the given role.
|
<T> List<T> |
lookupList(Class<T> type,
List<String> roleHints)
Looks up and returns a List of component objects with the given role.
|
List<Object> |
lookupList(String role)
Looks up and returns a List of component objects with the given role.
|
List<Object> |
lookupList(String role,
List<String> roleHints)
Looks up and returns a List of component objects with the given role.
|
<T> Map<String,T> |
lookupMap(Class<T> type)
Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.
|
<T> Map<String,T> |
lookupMap(Class<T> type,
List<String> roleHints)
Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.
|
Map<String,Object> |
lookupMap(String role)
Looks up and returns a Map of component objects with the given role, keyed by all available role-hints.
|
Map<String,Object> |
lookupMap(String role,
List<String> roleHints)
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<String,?> components)
Releases all Mapped component values from the container.
|
void |
removeComponentDiscoveryListener(ComponentDiscoveryListener listener)
Removes the listener from this container.
|
void |
removeComponentRealm(org.codehaus.plexus.classworlds.realm.ClassRealm componentRealm)
Dissociate the realm with the specified id from the container.
|
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.
|
static final String ROLE
Object lookup(String role) throws ComponentLookupException
role
- a unique key for the desired componentComponentLookupException
- in case of lookup error.Object lookup(String role, String roleHint) throws ComponentLookupException
role
- a non-unique key for the desired componentroleHint
- a hint for the desired component implementationComponentLookupException
- in case of lookup error.<T> T lookup(Class<T> type) throws ComponentLookupException
T
- The type.type
- the unique type of the component within the containerComponentLookupException
- in case of lookup error.<T> T lookup(Class<T> type, String roleHint) throws ComponentLookupException
T
- The type.type
- the non-unique type of the componentroleHint
- a hint for the desired component implementationComponentLookupException
- in case of lookup error.<T> T lookup(Class<T> type, String role, String roleHint) throws ComponentLookupException
T
- The type.type
- the non-unique type of the componentrole
- a non-unique key for the desired componentroleHint
- a hint for the desired component implementationComponentLookupException
- in case of lookup error.<T> T lookup(ComponentDescriptor<T> componentDescriptor) throws ComponentLookupException
T
- The type.componentDescriptor
- the descriptor of the componentComponentLookupException
- in case of lookup error.List<Object> lookupList(String role) throws ComponentLookupException
role
- a non-unique key for the desired componentsComponentLookupException
- in case of lookup error.List<Object> lookupList(String role, List<String> roleHints) throws ComponentLookupException
role
- a non-unique key for the desired componentsroleHints
- the list of hints.ComponentLookupException
- in case of lookup error.<T> List<T> lookupList(Class<T> type) throws ComponentLookupException
T
- The type.type
- the non-unique type of the componentsComponentLookupException
- in case of lookup error.<T> List<T> lookupList(Class<T> type, List<String> roleHints) throws ComponentLookupException
T
- The type.type
- the non-unique type of the componentsroleHints
- the list of hints.ComponentLookupException
- in case of lookup error.Map<String,Object> lookupMap(String role) throws ComponentLookupException
role
- a non-unique key for the desired componentsComponentLookupException
- in case of lookup error.Map<String,Object> lookupMap(String role, List<String> roleHints) throws ComponentLookupException
role
- a non-unique key for the desired componentsroleHints
- the list of hints.ComponentLookupException
- in case of lookup error.<T> Map<String,T> lookupMap(Class<T> type) throws ComponentLookupException
T
- The type.type
- the non-unique type of the componentsComponentLookupException
- in case of lookup error.<T> Map<String,T> lookupMap(Class<T> type, List<String> roleHints) throws ComponentLookupException
T
- The type.type
- the non-unique type of the componentsroleHints
- the list of hints.ComponentLookupException
- in case of lookup error.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 used<T> ComponentDescriptor<T> getComponentDescriptor(Class<T> type, String role, String roleHint)
T
- The type.type
- the Java type of the desired componentrole
- a unique role for the desired component's descriptorroleHint
- a hint showing which implementation should be usedMap<String,ComponentDescriptor<?>> getComponentDescriptorMap(String role)
role
- a non-unique key for the desired components<T> Map<String,ComponentDescriptor<T>> getComponentDescriptorMap(Class<T> type, String role)
T
- The type.type
- the Java type of the desired componentsrole
- a non-unique key for the desired componentsList<ComponentDescriptor<?>> getComponentDescriptorList(String role)
role
- a non-unique key for the desired components<T> List<ComponentDescriptor<T>> getComponentDescriptorList(Class<T> type, String role)
T
- The type.type
- the Java type of the desired componentsrole
- a non-unique key for the desired componentsvoid addComponentDescriptor(ComponentDescriptor<?> componentDescriptor) throws CycleDetectedInComponentGraphException
componentDescriptor
- ComponentDescriptor
CycleDetectedInComponentGraphException
- In case of an error.void release(Object component) throws ComponentLifecycleException
component
- the plexus component object to releaseComponentLifecycleException
- in case of an error.void releaseAll(Map<String,?> components) throws ComponentLifecycleException
components
- Map of plexus component objects to releaseComponentLifecycleException
- in case of an error.release( Object component )
void releaseAll(List<?> components) throws ComponentLifecycleException
components
- List of plexus component objects to releaseComponentLifecycleException
- in case of an error.release( Object component )
boolean hasComponent(String role)
role
- a non-unique key for the desired componentboolean hasComponent(String role, String roleHint)
role
- a non-unique key for the desired componentroleHint
- a hint for the desired component implementationboolean hasComponent(Class<?> type)
type
- the non-unique type of the componentboolean hasComponent(Class<?> type, String roleHint)
type
- the non-unique type of the componentroleHint
- a hint for the desired component implementationboolean hasComponent(Class<?> type, String role, String roleHint)
type
- the non-unique type of the componentrole
- a non-unique key for the desired componentroleHint
- a hint for the desired component implementationvoid 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 different ComponentDiscoveryEventsvoid removeComponentDiscoveryListener(ComponentDiscoveryListener listener)
listener
- A listener to removeList<ComponentDescriptor<?>> discoverComponents(org.codehaus.plexus.classworlds.realm.ClassRealm childRealm) throws PlexusConfigurationException, CycleDetectedInComponentGraphException
childRealm
- ClassRealm
ComponentDescriptor
PlexusConfigurationException
- in case of an error.CycleDetectedInComponentGraphException
- in case of an error.List<ComponentDescriptor<?>> discoverComponents(org.codehaus.plexus.classworlds.realm.ClassRealm realm, Object data) throws PlexusConfigurationException, CycleDetectedInComponentGraphException
realm
- the ClassRealm
.data
- The data.ComponentDescriptor
PlexusConfigurationException
- in case of an error.CycleDetectedInComponentGraphException
- in case of an error.org.codehaus.plexus.classworlds.realm.ClassRealm createChildRealm(String id)
org.codehaus.plexus.classworlds.realm.ClassRealm getComponentRealm(String realmId)
void removeComponentRealm(org.codehaus.plexus.classworlds.realm.ClassRealm componentRealm) throws PlexusContainerException
componentRealm
- Realm to remove from the container.PlexusContainerException
- PlexusContainerException
.org.codehaus.plexus.classworlds.realm.ClassRealm getLookupRealm()
setLookupRealm(ClassRealm)
.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
- The component.ClassRealm
void addComponent(Object component, String role) throws CycleDetectedInComponentGraphException
<T> void addComponent(T component, Class<?> role, String roleHint)
T
- The type.component
- The component.role
- The role.roleHint
- The hint.Copyright © 2001–2019 Codehaus Plexus. All rights reserved.