org.apache.avalon.cornerstone.blocks.masterstore
Class RepositoryManager

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.avalon.cornerstone.blocks.masterstore.RepositoryManager
All Implemented Interfaces:
Configurable, Contextualizable, LogEnabled, Serviceable, ServiceSelector, Store

public class RepositoryManager
extends AbstractLogEnabled
implements Store, Contextualizable, Serviceable, Configurable

Author:
Federico Barbieri

Field Summary
protected  java.util.HashMap m_classes
           
protected  Context m_context
           
protected  java.util.HashMap m_models
           
protected  java.util.HashMap m_repositories
           
protected  ServiceManager m_serviceManager
           
 
Fields inherited from interface org.apache.avalon.cornerstone.services.store.Store
ROLE
 
Constructor Summary
RepositoryManager()
           
 
Method Summary
 void configure(Configuration configuration)
          Pass the Configuration to the Configurable class.
 void contextualize(Context context)
          Pass the Context to the component.
static java.lang.String getName()
           
 boolean isSelectable(java.lang.Object policy)
          Check to see if a Object exists relative to the supplied policy.
 void registerRepository(Configuration repConf)
           
 void release(java.lang.Object service)
          Return the Object when you are finished with it.
 java.lang.Object select(java.lang.Object policy)
          Selects a Repository configured for the given policy.
 void service(ServiceManager serviceManager)
          Pass the ServiceManager to the Serviceable.
 
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
 

Field Detail

m_repositories

protected java.util.HashMap m_repositories

m_models

protected java.util.HashMap m_models

m_classes

protected java.util.HashMap m_classes

m_serviceManager

protected ServiceManager m_serviceManager

m_context

protected Context m_context
Constructor Detail

RepositoryManager

public RepositoryManager()
Method Detail

contextualize

public void contextualize(Context context)
Description copied from interface: Contextualizable
Pass the Context to the component. This method is called after the LogEnabled.enableLogging( Logger ) (if present) method and before any other method.

Specified by:
contextualize in interface Contextualizable
Parameters:
context - the context. Must not be null.

service

public void service(ServiceManager serviceManager)
             throws ServiceException
Description copied from interface: Serviceable
Pass the ServiceManager to the Serviceable. The Serviceable implementation should use the specified ServiceManager to acquire the components it needs for execution.

Specified by:
service in interface Serviceable
Parameters:
serviceManager - The ServiceManager which this Serviceable uses. Must not be null.
Throws:
ServiceException - if an error occurs

configure

public void configure(Configuration configuration)
               throws ConfigurationException
Description copied from interface: Configurable
Pass the Configuration to the Configurable class.

Specified by:
configure in interface Configurable
Parameters:
configuration - the class configurations. Must not be null.
Throws:
ConfigurationException - if an error occurs

registerRepository

public void registerRepository(Configuration repConf)
                        throws ConfigurationException
Throws:
ConfigurationException

release

public void release(java.lang.Object service)
Description copied from interface: ServiceSelector
Return the Object when you are finished with it. This allows the ServiceSelector to handle the End-Of-Life Lifecycle events associated with the Object. Please note, that no Exception should be thrown at this point. This is to allow easy use of the ServiceSelector system without having to trap Exceptions on a release.

Specified by:
release in interface ServiceSelector
Parameters:
service - The Object we are releasing, may also be a null reference

isSelectable

public boolean isSelectable(java.lang.Object policy)
Description copied from interface: ServiceSelector
Check to see if a Object exists relative to the supplied policy.

Specified by:
isSelectable in interface ServiceSelector
Parameters:
policy - a Object containing the selection criteria
Returns:
True if the component is available, False if it not.

select

public java.lang.Object select(java.lang.Object policy)
                        throws ServiceException
Description copied from interface: Store
Selects a Repository configured for the given policy. The policy must be an instance of Configuration. The following attributes are used by the Store and thus are mandatory in the policy parameter:
 <repository destinationURL="[URL of this repository]"
             type="[repository type e.g. OBJECT, STREAM or MAIL]"
             model="[repository model e.g. PERSISTENT, CACHE]">
   [additional configuration]
 </repository>
 

The policy is used both to select the appropriate Repository and to configure it.

Specified by:
select in interface Store
Parameters:
policy - a Configuration object identifying the sought Repository
Returns:
requested Repository
Throws:
ServiceException - if no repository matches policy

getName

public static final java.lang.String getName()


Copyright © 1997-2005 The Apache Software Foundation. All Rights Reserved.