org.keel.core.container
Class ServiceConfig
java.lang.Object
org.keel.core.container.ServiceConfig
- public class ServiceConfig
- extends java.lang.Object
A helper class to provide uniform way of allowing Keel components to acquire collaborator components. When looking up services/components from the container, a "hint" is needed. When "default" or a particular service hint is hardcoded for acquiring the service, it prevents the use of configuration to specify which implementation to use for a particular service. Instead this class allows a standard way of acquiring the hint from configuration, before looking up a service, thereby allowing a particular installation to change which component is used. To use, a class variable is first declared:
ServiceConfig svcConfig = null;
and initialized somewhere before use:
svcConfig = new ServiceConfig(configuration);
where "configuration" is standard Avalon XML config for a component. This class looks for configuration of the form:
Finally, when looking up a service, the hint is provided as:
svcCOnfig.getHint(someRole);
If no configuration is provided at all (i.e. current config files), then getHint simply returns "default".
- Version:
- $Revision: 1.3 $ $Date: 2004/03/10 03:36:15 $
- Author:
- Shash Chatterjee
| Method Summary |
java.lang.String |
getHint(java.lang.String name)
Get hint associated with a role |
void |
setHint(java.lang.String name, java.lang.String hint)
Allow setting of role/hint programatically |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
serviceHints
protected java.util.Map serviceHints
-
ServiceConfig
private ServiceConfig()
ServiceConfig
public ServiceConfig(Configuration configuration)
throws ConfigurationException
-
Cretae the configuration helper and configure role/hint pairs
- Parameters:
configuration - Avalon/Fortress XML configuration for a component
- Throws:
ConfigurationException - If there is error processing the XML configuration
getHint
public java.lang.String getHint(java.lang.String name)
-
Get hint associated with a role
-
- Parameters:
name - The role whose hint is required
- Returns:
- The configured hint or "*"
setHint
public void setHint(java.lang.String name,
java.lang.String hint)
-
Allow setting of role/hint programatically
-
- Parameters:
name - The role whose hint to set
hint - The hint to set
Please see keelframework.org for information about new Keel releases.