Interface ComponentManager
-
public interface ComponentManagerAComponentManagerselectsComponents based on a role. The contract is that all theComponents implement the differing roles and there is oneComponentper role. If you need to select on of manyComponents that implement the same role, then you need to use aComponentSelector. Roles are usually the full interface name.A role is better understood by the analogy of a play. There are many different roles in a script. Any actor or actress can play any given part and you get the same results (phrases said, movements made, etc.). The exact nuances of the performance is different.
Below is a list of things that might be considered the different roles:
- InputAdapter and OutputAdapter
- Store and Spool
The
ComponentManagerdoes not specify the methodology of getting theComponent, merely the interface used to get it. Therefore theComponentManagercan be implemented with a factory pattern, an object pool, or a simple Hashtable.Deprecated: Use
ServiceManagerinstead.- Version:
- $Id: ComponentManager.java 30977 2004-07-30 03:57:54 -0500 (Fri, 30 Jul 2004) niclas $
- Author:
- Avalon Development Team
- See Also:
Component,Composable,ComponentSelector
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanhasComponent(java.lang.String key)Check to see if aComponentexists for a key.Componentlookup(java.lang.String key)Get theComponentassociated with the given key.voidrelease(Component component)Return theComponentwhen you are finished with it.
-
-
-
Method Detail
-
lookup
Component lookup(java.lang.String key) throws ComponentException
Get theComponentassociated with the given key. For instance, If theComponentManagerhad aLoggerComponentstored and referenced by key, I would use the following call:try { LoggerComponent log; myComponent = (LoggerComponent) m_manager.lookup(LoggerComponent.ROLE); } catch (...) { ... }- Parameters:
key- The key name of theComponentto retrieve.- Returns:
- the desired component
- Throws:
ComponentException- if an error occurs
-
hasComponent
boolean hasComponent(java.lang.String key)
Check to see if aComponentexists for a key.- Parameters:
key- a string identifying the key to check.- Returns:
- True if the component exists, False if it does not.
-
release
void release(Component component)
Return theComponentwhen you are finished with it. This allows theComponentManagerto handle the End-Of-Life Lifecycle events associated with the Component. Please note, that no Exceptions should be thrown at this point. This is to allow easy use of the ComponentManager system without having to trap Exceptions on a release.- Parameters:
component- The Component we are releasing.
-
-