public class SimpleComponentPool extends Object implements ComponentPool
ComponentPool.
This class is thread safe for the addition an removal of components. It is not thread safe for configuration an saving. This is left to the calling code. Oddjob for instance achieves thread safety for for these operations by locking on State.
| Constructor and Description |
|---|
SimpleComponentPool() |
| Modifier and Type | Method and Description |
|---|---|
Iterable<ComponentTrinity> |
allTrinities()
Provide a way of iterating over all trinities.
|
void |
configure(Object component)
Configure the component.
|
ArooaContext |
contextFor(Object either)
Get the components
ArooaContext. |
String |
getIdFor(Object either)
Provide the Id for either a component or it's proxy.
|
String |
registerComponent(ComponentTrinity componentTrinity,
String id)
Register a
ComponentTrinity. |
boolean |
remove(Object either)
Remove a component.
|
void |
save(Object component)
Possibly save the component to a persistent store, if everything
is in place for this to happen.
|
ComponentTrinity |
trinityFor(Object either)
Get the
ComponentTrinity for either the component or
proxy. |
ComponentTrinity |
trinityForContext(ArooaContext context)
Get the
ComponentTrinity for the given ArooaContext. |
ComponentTrinity |
trinityForId(String id)
Provide the
ComponentTrinity for a given id, if possible. |
public void configure(Object component) throws ArooaConfigurationException
ComponentPoolcontextFor(component).getRuntime().configure().configure in interface ComponentPoolcomponent - The component or it's proxy.ArooaConfigurationExceptionpublic void save(Object component) throws ComponentPersistException
ComponentPool
If a ComponentPersister is in operation and the component
was registered with an id then the ComponentPersister is
invoked with the component.
save in interface ComponentPoolcomponent - A component or it's proxy.ComponentPersistExceptionpublic boolean remove(Object either) throws ComponentPersistException
ComponentPoolremove in interface ComponentPooleither - A component or it's proxy.ComponentPersistExceptionpublic ArooaContext contextFor(Object either)
ComponentPoolArooaContext.contextFor in interface ComponentPooleither - The component or the proxy.public ComponentTrinity trinityForContext(ArooaContext context)
ComponentPoolComponentTrinity for the given ArooaContext.
This is required for ContextHierarchyServiceFinder.
trinityForContext in interface ComponentPoolcontext - A context;public ComponentTrinity trinityFor(Object either)
ComponentPoolComponentTrinity for either the component or
proxy.
trinityFor in interface ComponentPooleither - Either the component or the proxy.public ComponentTrinity trinityForId(String id)
ComponentPoolComponentTrinity for a given id, if possible.trinityForId in interface ComponentPoolid - The id.public String getIdFor(Object either)
ComponentPoolgetIdFor in interface ComponentPooleither - Either a component or it's proxy.public Iterable<ComponentTrinity> allTrinities()
ComponentPoolallTrinities in interface ComponentPoolpublic String registerComponent(ComponentTrinity componentTrinity, String id)
ComponentPoolComponentTrinity.registerComponent in interface ComponentPoolcomponentTrinity - The trinity.id - The id. May be null.Copyright © 2023. All rights reserved.