Interface ComponentManager
- All Known Implementing Classes:
DefaultComponentManager
,WrapperComponentManager
public interface ComponentManager
A
ComponentManager
selects Component
s based on a
role. The contract is that all the Component
s implement the
differing roles and there is one Component
per role. If you
need to select on of many Component
s that implement the same
role, then you need to use a ComponentSelector
. 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 ComponentManager
does not specify the methodology of
getting the Component
, merely the interface used to get it.
Therefore the ComponentManager
can be implemented with a
factory pattern, an object pool, or a simple Hashtable.
Deprecated:
Use ServiceManager
instead.
- Version:
- CVS $Revision: 1.21 $ $Date: 2004/02/11 14:34:24 $
- Author:
- Avalon Development Team
- See Also:
-
Method Summary
-
Method Details
-
lookup
Get theComponent
associated with the given key. For instance, If theComponentManager
had aLoggerComponent
stored 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 theComponent
to retrieve.- Returns:
- the desired component
- Throws:
ComponentException
- if an error occurs
-
hasComponent
Check to see if aComponent
exists for a key.- Parameters:
key
- a string identifying the key to check.- Returns:
- True if the component exists, False if it does not.
-
release
Return theComponent
when you are finished with it. This allows theComponentManager
to 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.
-