Keel 2.1RC2

org.apache.avalon.fortress.impl
Class DefaultContainer

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.avalon.fortress.impl.AbstractContainer
          extended byorg.apache.avalon.fortress.impl.DefaultContainer
All Implemented Interfaces:
Configurable, Container, Contextualizable, Disposable, Initializable, LogEnabled, Serviceable
Direct Known Subclasses:
KeelContainer

public class DefaultContainer
extends AbstractContainer
implements Configurable

This is the default implementation of Container, adding configuration markup semantics to the AbstractContainer.

Version:
CVS $Revision: 1.17 $ $Date: 2004/02/28 15:16:24 $
Author:

Field Summary
 
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 class org.apache.avalon.framework.logger.AbstractLogEnabled
 
Fields inherited from interface org.apache.avalon.fortress.Container
ROLE
 
Constructor Summary
DefaultContainer()
           
 
Method Summary
 void configure(Configuration config)
          Process the configuration and set up the components and their mappings.
private  int getActivation(Configuration component)
          Helper method to determine the activation policy for a given component handler configuration.
private  java.lang.String getClassname(Configuration config)
          Retrieve the classname for component configuration.
 ServiceManager getServiceManager()
          Return the ServiceManager that exposes all the services in impl.
protected  void interpretProxy(java.lang.String proxyType)
          Interpret the ProxyManager type from the configuration element.
 
Methods inherited from class org.apache.avalon.fortress.impl.AbstractContainer
addComponent, contextualize, createHintMap, createObjectFactory, dispose, get, getProxyManager, getRoleKey, has, initialize, provideComponentContext, provideServiceManager, service, setProxyManager
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultContainer

public DefaultContainer()
Method Detail

configure

public void configure(Configuration config)
               throws ConfigurationException

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:

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
Parameters:
config - The configuration element to translate into the list of components this impl managers.
Throws:
ConfigurationException - if the configuration is not valid

interpretProxy

protected void interpretProxy(java.lang.String proxyType)
                       throws ConfigurationException
Interpret the ProxyManager type from the configuration element.

Parameters:
proxyType -
Throws:
ConfigurationException

getClassname

private java.lang.String getClassname(Configuration config)
                               throws ConfigurationException
Retrieve the classname for component configuration.

Parameters:
config - the component configuration
Returns:
the class name
Throws:
ConfigurationException

getActivation

private int getActivation(Configuration component)
                   throws ConfigurationException
Helper method to determine the activation policy for a given component handler configuration. Supported values for the "activation" attribute of the component are "background", "inline", or "lazy". The default activation is "background". For compatibility, "startup" is an alias for "background" and "request" is an alias for "lazy".

Parameters:
component - Configuration
Returns:
the activation policy, one of ComponentHandlerMetaData.ACTIVATION_BACKGROUND, ComponentHandlerMetaData.ACTIVATION_INLINE, ComponentHandlerMetaData.ACTIVATION_LAZY.
Throws:
ConfigurationException - if the handler specifies an unknown activation policy

getServiceManager

public ServiceManager getServiceManager()
Return the ServiceManager that exposes all the services in impl.

Overrides:
getServiceManager in class AbstractContainer
Returns:
the ServiceManager that exposes all the services in impl.

Keel 2.1RC2

Please see keelframework.org for information about new Keel releases.