Package org.oddjob.arooa.registry
Interface ComponentPool
- All Known Implementing Classes:
SimpleComponentPool
public interface ComponentPool
A ComponentPool provides access to the Components created by parsing
an
ArooaConfiguration.- Author:
- rob
-
Method Summary
Modifier and TypeMethodDescriptionProvide a way of iterating over all trinities.voidConfigure the component.contextFor(Object either) Get the componentsArooaContext.Provide the Id for either a component or it's proxy.registerComponent(ComponentTrinity trinity, String id) Register aComponentTrinity.booleanRemove a component.voidPossibly save the component to a persistent store, if everything is in place for this to happen.trinityFor(Object either) Get theComponentTrinityfor either the component or proxy.trinityForContext(ArooaContext context) Get theComponentTrinityfor the givenArooaContext.trinityForId(String id) Provide theComponentTrinityfor a given id, if possible.
-
Method Details
-
configure
Configure the component. The is a shortcut method equivalent tocontextFor(component).getRuntime().configure().- Parameters:
component- The component or it's proxy.- Throws:
ArooaConfigurationException
-
save
Possibly save the component to a persistent store, if everything is in place for this to happen.If a
ComponentPersisteris in operation and the component was registered with an id then the ComponentPersister is invoked with the component.- Parameters:
either- A component or it's proxy.- Throws:
ComponentPersistException
-
remove
Remove a component.- Parameters:
either- A component or it's proxy.- Returns:
- true if the component was removed.
- Throws:
ComponentPersistException
-
contextFor
Get the componentsArooaContext.- Parameters:
either- The component or the proxy.- Returns:
- The context or null if the component/proxy is not in this pool.
-
trinityForContext
Get theComponentTrinityfor the givenArooaContext.This is required for
ContextHierarchyServiceFinder.- Parameters:
context- A context;- Returns:
- The trinity or null.
- Since:
- 1.3
-
trinityFor
Get theComponentTrinityfor either the component or proxy.- Parameters:
either- Either the component or the proxy.- Returns:
- The component trinity or null if it can't be found.
- Since:
- 1.3
-
registerComponent
Register aComponentTrinity.- Parameters:
trinity- The trinity.id- The id. May be null.- Returns:
- The new id if one was assigned.
-
getIdFor
Provide the Id for either a component or it's proxy.- Parameters:
either- Either a component or it's proxy.- Returns:
- The id, or null if the component wasn't registered with an id, or the component doesn't exist in pool.
-
trinityForId
Provide theComponentTrinityfor a given id, if possible.- Parameters:
id- The id.- Returns:
- The trinity, or null if none exists for the given id.
-
allTrinities
Iterable<ComponentTrinity> allTrinities()Provide a way of iterating over all trinities.- Returns:
- An Iterable of trinities. Will never be null.
-