org.keel.core.container
Class KeelContainer
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.avalon.fortress.impl.AbstractContainer
org.apache.avalon.fortress.impl.DefaultContainer
org.keel.core.container.KeelContainer
- All Implemented Interfaces:
- Configurable, Container, Container, Contextualizable, Disposable, Initializable, LogEnabled, Serviceable
- public class KeelContainer
- extends DefaultContainer
- implements Container
This is the top-level container for Keel Framework services. This is instantiated by the KeelServer class.
- Version:
- $Revision: 1.1 $ $Date: 2003/12/30 01:29:31 $
- Author:
- Shash Chatterjee Created on Oct 17, 2002
| Fields inherited from class org.apache.avalon.fortress.impl.AbstractContainer |
DEFAULT_ENTRY, m_classLoader, m_commandSink, m_componentContext, m_components, m_context, m_extManager, m_instrumentManager, m_loggerManager, m_mapper, m_metaManager, m_poolManager, m_serviceManager, m_shutDownOrder, SELECTOR_ENTRY |
| Fields inherited from interface org.apache.avalon.fortress.Container |
ROLE |
| Methods inherited from class org.apache.avalon.fortress.impl.AbstractContainer |
addComponent, createHintMap, createObjectFactory, get, getProxyManager, getRoleKey, has, initialize, provideComponentContext, provideServiceManager, setProxyManager |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
m_configuration
private Configuration m_configuration
-
svcDelegate
private KeelServiceableDelegate svcDelegate
-
KeelContainer
public KeelContainer()
getService
public java.lang.Object getService(java.lang.String role,
java.lang.String hint,
Context ctx)
throws ServiceException
-
- Specified by:
getService in interface Container
-
- Throws:
ServiceException
getService
public java.lang.Object getService(java.lang.String role,
java.lang.String hint)
throws ServiceException
-
- Specified by:
getService in interface Container
-
- Throws:
ServiceException
getService
public java.lang.Object getService(java.lang.String role)
throws ServiceException
-
- Specified by:
getService in interface Container
-
- Throws:
ServiceException
getSysConfig
public Configuration getSysConfig()
-
-
release
public void release(java.lang.Object obj)
-
- Specified by:
release in interface Container
-
release
public void release(java.lang.String role,
java.lang.Object obj)
-
Deprecated. Use release(Object obj) instead
-
- Specified by:
release in interface Container
-
contextualize
public void contextualize(Context context)
throws ContextException
- Description copied from class:
AbstractContainer
-
Pull the manager items from the context so we can use them to set up the system.
-
- Specified by:
contextualize in interface Contextualizable
- Overrides:
contextualize in class AbstractContainer
-
- Parameters:
context - the impl context
- Throws:
ContextException - if a contexaulization error occurs
- See Also:
Contextualizable.contextualize(org.apache.avalon.framework.context.Context)
configure
public void configure(Configuration config)
throws ConfigurationException
- Description copied from class:
DefaultContainer
-
Process the configuration and set up the components and their mappings. At this point, all components are prepared and all mappings are made. However, nothing is initialized.
The configuration format follows a specific convention:
- root configuration element may have any name.
- child configuration elements are named after short names managed by the
Container's MetaInfoManager or RoleManager
- alternatively
<component> configuration elements may be used. These elements specify implementation class directly via the class attribute.
Please note: each configuration element must have a unique id. If a configuration element does not have a unique id, it will not be treated as a component. This id is used later as a hint when there is more than one implementation of a role.
The first component encourted which implements a specific role becomes the default implemenation of that role. This can be changed by the default attribute in this configuration.
<my-config>
<component id="default-connection"
class="org.apache.avalon.excalibur.datasource.JdbcDataSourceComponent">
<!-- Component specific configuration -->
</component>
<jdbc-data-source id="another-connection">
<!-- Component specific configuration -->
</jdbc-data-source>
</my-config>
-
- Specified by:
configure in interface Configurable
- Overrides:
configure in class DefaultContainer
-
- Parameters:
config - The configuration element to translate into the list of components this impl managers.
- Throws:
ConfigurationException - if the configuration is not valid
- See Also:
Configurable.configure(org.apache.avalon.framework.configuration.Configuration)
handleConditionalConfigs
private Configuration handleConditionalConfigs(Configuration orig)
throws ConfigurationException
-
This method "prunes" top-level configuration entries (e.g. entries immediately below the "keel" top element in the *-system.xconf file(s). It first reads all the children of an element called "modules". Then it examines each top-level element and looks for an attribute named "if" If this attribute exists, it's value must exist in the list of names in the module list, or that element is "pruned" from the tree.
-
-
- Throws:
ConfigurationException
service
public void service(ServiceManager parent)
throws ServiceException
-
Root ServiceManager. The Container may choose to have it's ServiceManager delegate to the root manager, or it may choose to be entirely self contained.
-
- Specified by:
service in interface Serviceable
- Overrides:
service in class AbstractContainer
-
- Parameters:
parent - the service manager to apply to the impl
- Throws:
ServiceException - is a servicing related error occurs
dispose
public void dispose()
- Description copied from class:
AbstractContainer
-
Disposes of all components and frees resources that they consume.
-
- Specified by:
dispose in interface Container
- Overrides:
dispose in class AbstractContainer
-
dumpConfigInfo
private void dumpConfigInfo(Configuration config)
throws ConfigurationException
-
-
- Throws:
ConfigurationException
metaFailed
private void metaFailed()
throws ConfigurationException
-
-
- Throws:
ConfigurationException
processServiceList
private void processServiceList(java.net.URL serviceList,
java.lang.ClassLoader loader)
throws java.lang.Exception
-
-
- Throws:
java.lang.Exception
processOneServiceEntry
private void processOneServiceEntry(java.lang.String oneEntry,
java.net.URL serviceList,
java.lang.ClassLoader loader)
throws java.lang.Exception
-
-
- Throws:
java.lang.Exception
processImplementationList
private void processImplementationList(java.net.URL theRightServiceEntry,
java.lang.String jarFile)
throws java.lang.Exception
-
-
- Throws:
java.lang.Exception
cleanUrlList
public java.util.Enumeration cleanUrlList(java.util.Enumeration originalURLs)
-
-
getSystemConfig
public Configuration getSystemConfig()
throws ConfigurationException
-
- Specified by:
getSystemConfig in interface Container
-
- Throws:
ConfigurationException
- See Also:
Container.getSystemConfig()
Please see keelframework.org for information about new Keel releases.