public class ConcurrentPicoContainer extends Object implements org.picocontainer.MutablePicoContainer, Serializable
DefaultPicoContainer based on
java.util.concurrent collections.
Created by The eXo Platform SAS
Author : Nicolas Filotto
nicolas.filotto@exoplatform.com
6 mai 2010| Modifier and Type | Class and Description |
|---|---|
protected static class |
ConcurrentPicoContainer.ContainerVisitor
Cans be used to indicate that we only want to visit Containers
|
| Modifier and Type | Field and Description |
|---|---|
protected org.picocontainer.defaults.ComponentAdapterFactory |
componentAdapterFactory |
| Constructor and Description |
|---|
ConcurrentPicoContainer()
Creates a new container with a (caching)
DefaultComponentAdapterFactory and no parent container. |
ConcurrentPicoContainer(org.picocontainer.defaults.ComponentAdapterFactory componentAdapterFactory)
Creates a new container with a custom ComponentAdapterFactory and no parent container.
|
ConcurrentPicoContainer(org.picocontainer.defaults.ComponentAdapterFactory componentAdapterFactory,
org.picocontainer.PicoContainer parent)
Creates a new container with a custom ComponentAdapterFactory and a parent container.
|
ConcurrentPicoContainer(org.picocontainer.PicoContainer parent)
Creates a new container with a (caching)
DefaultComponentAdapterFactory
and a parent container. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
accept(ConcurrentPicoContainer.ContainerVisitor visitor)
Accepts a visitor that should visit the child containers only.
|
void |
accept(org.picocontainer.PicoVisitor visitor) |
boolean |
addChildContainer(org.picocontainer.PicoContainer child) |
void |
addComponentToCtx(Object key,
Object component)
Add the component corresponding to the given key, to the dependency resolution
context
|
protected boolean |
canBeDisposed()
Indicates whether or not the container can be disposed
|
protected boolean |
canBeStarted()
Indicates whether or not the container can be started
|
protected boolean |
canBeStopped()
Indicates whether or not the container can be stopped
|
void |
dispose()
Dispose the components of this PicoContainer and all its logical child containers.
|
org.picocontainer.ComponentAdapter |
getComponentAdapter(Object componentKey) |
org.picocontainer.ComponentAdapter |
getComponentAdapterOfType(Class componentType) |
Collection |
getComponentAdapters() |
List |
getComponentAdaptersOfType(Class componentType) |
Object |
getComponentInstance(Object componentKey) |
Object |
getComponentInstanceOfType(Class componentType)
If no
ComponentAdapter can be found it returns null otherwise
it first try to get it from the dependency resolution context if it still cannot
be found we get the instance from the ComponentAdapter. |
List |
getComponentInstances() |
List |
getComponentInstancesOfType(Class componentType) |
org.picocontainer.PicoContainer |
getParent() |
org.picocontainer.MutablePicoContainer |
makeChildContainer() |
org.picocontainer.ComponentAdapter |
registerComponent(org.picocontainer.ComponentAdapter componentAdapter)
This method can be used to override the ComponentAdapter created by the
ComponentAdapterFactory
passed to the constructor of this container. |
org.picocontainer.ComponentAdapter |
registerComponentImplementation(Class componentImplementation)
The returned ComponentAdapter will be instantiated by the
ComponentAdapterFactory
passed to the container's constructor. |
org.picocontainer.ComponentAdapter |
registerComponentImplementation(Object componentKey,
Class componentImplementation)
The returned ComponentAdapter will be instantiated by the
ComponentAdapterFactory
passed to the container's constructor. |
org.picocontainer.ComponentAdapter |
registerComponentImplementation(Object componentKey,
Class componentImplementation,
List parameters)
Same as
registerComponentImplementation(java.lang.Object, java.lang.Class, org.picocontainer.Parameter[])
but with parameters as a List. |
org.picocontainer.ComponentAdapter |
registerComponentImplementation(Object componentKey,
Class componentImplementation,
org.picocontainer.Parameter[] parameters)
The returned ComponentAdapter will be instantiated by the
ComponentAdapterFactory
passed to the container's constructor. |
org.picocontainer.ComponentAdapter |
registerComponentInstance(Object component)
The returned ComponentAdapter will be an
InstanceComponentAdapter. |
org.picocontainer.ComponentAdapter |
registerComponentInstance(Object componentKey,
Object componentInstance)
The returned ComponentAdapter will be an
InstanceComponentAdapter. |
boolean |
removeChildContainer(org.picocontainer.PicoContainer child) |
void |
removeComponentFromCtx(Object key)
Remove the component corresponding to the given key, from the dependency resolution
context
|
void |
start()
Start the components of this PicoContainer and all its logical child containers.
|
void |
stop()
Stop the components of this PicoContainer and all its logical child containers.
|
org.picocontainer.ComponentAdapter |
unregisterComponent(Object componentKey) |
org.picocontainer.ComponentAdapter |
unregisterComponentByInstance(Object componentInstance) |
void |
verify()
Deprecated.
since 1.1 - Use new VerifyingVisitor().traverse(this)
|
protected final org.picocontainer.defaults.ComponentAdapterFactory componentAdapterFactory
public ConcurrentPicoContainer(org.picocontainer.defaults.ComponentAdapterFactory componentAdapterFactory,
org.picocontainer.PicoContainer parent)
CachingComponentAdapter instances, such as for example
CachingComponentAdapterFactory. CachingComponentAdapterFactory can delegate to
other ComponentAdapterFactories.
componentAdapterFactory - the factory to use for creation of ComponentAdapters.parent - the parent container (used for component dependency lookups).public ConcurrentPicoContainer(org.picocontainer.PicoContainer parent)
DefaultComponentAdapterFactory
and a parent container.public ConcurrentPicoContainer(org.picocontainer.defaults.ComponentAdapterFactory componentAdapterFactory)
componentAdapterFactory - the ComponentAdapterFactory to use.public ConcurrentPicoContainer()
DefaultComponentAdapterFactory and no parent container.public Collection getComponentAdapters()
getComponentAdapters in interface org.picocontainer.PicoContainerpublic final org.picocontainer.ComponentAdapter getComponentAdapter(Object componentKey) throws org.picocontainer.defaults.AmbiguousComponentResolutionException
getComponentAdapter in interface org.picocontainer.PicoContainerorg.picocontainer.defaults.AmbiguousComponentResolutionExceptionpublic org.picocontainer.ComponentAdapter getComponentAdapterOfType(Class componentType)
getComponentAdapterOfType in interface org.picocontainer.PicoContainerpublic List getComponentAdaptersOfType(Class componentType)
getComponentAdaptersOfType in interface org.picocontainer.PicoContainerpublic org.picocontainer.ComponentAdapter registerComponent(org.picocontainer.ComponentAdapter componentAdapter)
throws org.picocontainer.defaults.DuplicateComponentKeyRegistrationException
ComponentAdapterFactory
passed to the constructor of this container.registerComponent in interface org.picocontainer.MutablePicoContainerorg.picocontainer.defaults.DuplicateComponentKeyRegistrationExceptionpublic org.picocontainer.ComponentAdapter unregisterComponent(Object componentKey)
unregisterComponent in interface org.picocontainer.MutablePicoContainerpublic org.picocontainer.ComponentAdapter registerComponentInstance(Object component) throws org.picocontainer.PicoRegistrationException
InstanceComponentAdapter.registerComponentInstance in interface org.picocontainer.MutablePicoContainerorg.picocontainer.PicoRegistrationExceptionpublic org.picocontainer.ComponentAdapter registerComponentInstance(Object componentKey, Object componentInstance) throws org.picocontainer.PicoRegistrationException
InstanceComponentAdapter.registerComponentInstance in interface org.picocontainer.MutablePicoContainerorg.picocontainer.PicoRegistrationExceptionpublic org.picocontainer.ComponentAdapter registerComponentImplementation(Class componentImplementation) throws org.picocontainer.PicoRegistrationException
ComponentAdapterFactory
passed to the container's constructor.registerComponentImplementation in interface org.picocontainer.MutablePicoContainerorg.picocontainer.PicoRegistrationExceptionpublic org.picocontainer.ComponentAdapter registerComponentImplementation(Object componentKey, Class componentImplementation) throws org.picocontainer.PicoRegistrationException
ComponentAdapterFactory
passed to the container's constructor.registerComponentImplementation in interface org.picocontainer.MutablePicoContainerorg.picocontainer.PicoRegistrationExceptionpublic org.picocontainer.ComponentAdapter registerComponentImplementation(Object componentKey, Class componentImplementation, org.picocontainer.Parameter[] parameters) throws org.picocontainer.PicoRegistrationException
ComponentAdapterFactory
passed to the container's constructor.registerComponentImplementation in interface org.picocontainer.MutablePicoContainerorg.picocontainer.PicoRegistrationExceptionpublic org.picocontainer.ComponentAdapter registerComponentImplementation(Object componentKey, Class componentImplementation, List parameters) throws org.picocontainer.PicoRegistrationException
registerComponentImplementation(java.lang.Object, java.lang.Class, org.picocontainer.Parameter[])
but with parameters as a List. Makes it possible to use with Groovy arrays (which are actually Lists).org.picocontainer.PicoRegistrationExceptionpublic List getComponentInstances() throws org.picocontainer.PicoException
getComponentInstances in interface org.picocontainer.PicoContainerorg.picocontainer.PicoExceptionpublic List getComponentInstancesOfType(Class componentType) throws org.picocontainer.PicoException
getComponentInstancesOfType in interface org.picocontainer.PicoContainerorg.picocontainer.PicoExceptionpublic Object getComponentInstance(Object componentKey) throws org.picocontainer.PicoException
getComponentInstance in interface org.picocontainer.PicoContainerorg.picocontainer.PicoExceptionpublic Object getComponentInstanceOfType(Class componentType)
ComponentAdapter can be found it returns null otherwise
it first try to get it from the dependency resolution context if it still cannot
be found we get the instance from the ComponentAdapter.getComponentInstanceOfType in interface org.picocontainer.PicoContainerPicoContainer.getComponentInstanceOfType(java.lang.Class)public void addComponentToCtx(Object key, Object component)
key - The key of the component to add to the contextcomponent - The instance of the component to add to the contextpublic void removeComponentFromCtx(Object key)
key - The key of the component to remove from the contextpublic org.picocontainer.PicoContainer getParent()
getParent in interface org.picocontainer.PicoContainerpublic org.picocontainer.ComponentAdapter unregisterComponentByInstance(Object componentInstance)
unregisterComponentByInstance in interface org.picocontainer.MutablePicoContainerpublic void verify()
throws org.picocontainer.PicoVerificationException
verify in interface org.picocontainer.PicoContainerorg.picocontainer.PicoVerificationExceptionprotected boolean canBeStarted()
protected boolean canBeStopped()
protected boolean canBeDisposed()
public void start()
Startable will be started.start in interface org.picocontainer.StartablemakeChildContainer(),
addChildContainer(PicoContainer),
removeChildContainer(PicoContainer)public void stop()
Startable will be stopped.stop in interface org.picocontainer.StartablemakeChildContainer(),
addChildContainer(PicoContainer),
removeChildContainer(PicoContainer)public void dispose()
Disposable will be disposed.dispose in interface org.picocontainer.DisposablemakeChildContainer(),
addChildContainer(PicoContainer),
removeChildContainer(PicoContainer)public org.picocontainer.MutablePicoContainer makeChildContainer()
makeChildContainer in interface org.picocontainer.MutablePicoContainerpublic boolean addChildContainer(org.picocontainer.PicoContainer child)
addChildContainer in interface org.picocontainer.MutablePicoContainerpublic boolean removeChildContainer(org.picocontainer.PicoContainer child)
removeChildContainer in interface org.picocontainer.MutablePicoContainerpublic void accept(org.picocontainer.PicoVisitor visitor)
accept in interface org.picocontainer.PicoContainerprotected void accept(ConcurrentPicoContainer.ContainerVisitor visitor)
Copyright © 2014 eXo Platform SAS. All Rights Reserved.