org.apache.james.mailrepository
Class AvalonMailStore

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.james.mailrepository.AvalonMailStore
All Implemented Interfaces:
org.apache.avalon.cornerstone.services.store.Store, org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, org.apache.avalon.framework.service.ServiceSelector

public class AvalonMailStore
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements org.apache.avalon.framework.service.Serviceable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.activity.Initializable, org.apache.avalon.cornerstone.services.store.Store

Provides a registry of mail repositories. A mail repository is uniquely identified by its destinationURL, type and model.


Field Summary
protected  org.apache.avalon.framework.configuration.Configuration configuration
          The Avalon configuration used by the instance
protected  org.apache.avalon.framework.service.ServiceManager m_manager
          The Avalon component manager used by the instance
 
Fields inherited from interface org.apache.avalon.cornerstone.services.store.Store
ROLE
 
Constructor Summary
AvalonMailStore()
           
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
           
static java.lang.String getName()
          Returns a new name for a repository.
 void initialize()
           
 boolean isSelectable(java.lang.Object hint)
          Returns whether the mail store has a repository corresponding to the passed in hint.
 void registerRepository(org.apache.avalon.framework.configuration.Configuration repConf)
          Registers a new mail repository type in the mail store's registry based upon a passed in Configuration object.
 void release(java.lang.Object component)
          Return the Component when you are finished with it.
 java.lang.Object select(java.lang.Object hint)
          This method accept a Configuration object as hint and return the corresponding MailRepository.
 void service(org.apache.avalon.framework.service.ServiceManager manager)
           
 
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

configuration

protected org.apache.avalon.framework.configuration.Configuration configuration
The Avalon configuration used by the instance


m_manager

protected org.apache.avalon.framework.service.ServiceManager m_manager
The Avalon component manager used by the instance

Constructor Detail

AvalonMailStore

public AvalonMailStore()
Method Detail

service

public void service(org.apache.avalon.framework.service.ServiceManager manager)
             throws org.apache.avalon.framework.service.ServiceException
Specified by:
service in interface org.apache.avalon.framework.service.Serviceable
Throws:
org.apache.avalon.framework.service.ServiceException
See Also:
Serviceable.service(ServiceManager)

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Throws:
org.apache.avalon.framework.configuration.ConfigurationException
See Also:
Configurable.configure(Configuration)

initialize

public void initialize()
                throws java.lang.Exception
Specified by:
initialize in interface org.apache.avalon.framework.activity.Initializable
Throws:
java.lang.Exception
See Also:
Initializable.initialize()

registerRepository

public void registerRepository(org.apache.avalon.framework.configuration.Configuration repConf)
                        throws org.apache.avalon.framework.configuration.ConfigurationException

Registers a new mail repository type in the mail store's registry based upon a passed in Configuration object.

This is presumably synchronized to prevent corruption of the internal registry.

Parameters:
repConf - the Configuration object used to register the repository
Throws:
org.apache.avalon.framework.configuration.ConfigurationException - if an error occurs accessing the Configuration object

select

public java.lang.Object select(java.lang.Object hint)
                        throws org.apache.avalon.framework.service.ServiceException
This method accept a Configuration object as hint and return the corresponding MailRepository. The Configuration must be in the form of: [addition configuration]

Specified by:
select in interface org.apache.avalon.cornerstone.services.store.Store
Specified by:
select in interface org.apache.avalon.framework.service.ServiceSelector
Parameters:
hint - the Configuration object used to look up the repository
Returns:
the selected repository
Throws:
org.apache.avalon.framework.service.ServiceException - if any error occurs while parsing the Configuration or retrieving the MailRepository

getName

public static final java.lang.String getName()

Returns a new name for a repository.

Synchronized on the AvalonMailStore.class object to ensure against duplication of the repository name

Returns:
a new repository name

isSelectable

public boolean isSelectable(java.lang.Object hint)
Returns whether the mail store has a repository corresponding to the passed in hint.

Specified by:
isSelectable in interface org.apache.avalon.framework.service.ServiceSelector
Parameters:
hint - the Configuration object used to look up the repository
Returns:
whether the mail store has a repository corresponding to this hint

release

public void release(java.lang.Object component)
Return the Component when you are finished with it. In this implementation it does nothing

Specified by:
release in interface org.apache.avalon.framework.service.ServiceSelector
Parameters:
component - The Component we are releasing.


Copyright ? 2002-2009 The Apache Software Foundation. All Rights Reserved.