org.apache.james.core
Class AvalonMailStore

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLogEnabled
        |
        +--org.apache.james.core.AvalonMailStore
All Implemented Interfaces:
Component, ComponentSelector, Composable, Configurable, Contextualizable, Initializable, LogEnabled, MailStore, Store

public class AvalonMailStore
extends AbstractLogEnabled
implements Contextualizable, Composable, Configurable, Initializable, MailStore

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

Author:
Federico Barbieri, Darrell DeBoer

Field Summary
protected  ComponentManager componentManager
          The Avalon component manager used by the instance
protected  Configuration configuration
          The Avalon configuration used by the instance
protected  Context context
          The Avalon context used by the instance
 
Fields inherited from interface org.apache.james.services.MailStore
ROLE
 
Constructor Summary
AvalonMailStore()
           
 
Method Summary
 void compose(ComponentManager componentManager)
           
 void configure(Configuration configuration)
           
 void contextualize(Context context)
           
 SpoolRepository getInboundSpool()
          Returns the mail spool associated with this AvalonMailStore
static String getName()
          Returns a new name for a repository.
 boolean hasComponent(Object hint)
          Returns whether the mail store has a repository corresponding to the passed in hint.
 void initialize()
           
 void registerRepository(Configuration repConf)
          Registers a new mail repository type in the mail store's registry based upon a passed in Configuration object.
 void release(Component component)
          Return the Component when you are finished with it.
 Component select(Object hint)
          This method accept a Configuration object as hint and return the corresponding MailRepository.
 
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

context

protected Context context
The Avalon context used by the instance


configuration

protected Configuration configuration
The Avalon configuration used by the instance


componentManager

protected ComponentManager componentManager
The Avalon component manager used by the instance

Constructor Detail

AvalonMailStore

public AvalonMailStore()
Method Detail

contextualize

public void contextualize(Context context)
                   throws ContextException
Specified by:
contextualize in interface Contextualizable
ContextException
See Also:
Contextualizable.contextualize(Context)

compose

public void compose(ComponentManager componentManager)
             throws ComponentException
Specified by:
compose in interface Composable
ComponentException
See Also:
Composable.compose(ComponentManager)

configure

public void configure(Configuration configuration)
               throws ConfigurationException
Specified by:
configure in interface Configurable
ConfigurationException
See Also:
Configurable.configure(Configuration)

initialize

public void initialize()
                throws Exception
Specified by:
initialize in interface Initializable
Exception
See Also:
Initializable.initialize()

registerRepository

public void registerRepository(Configuration repConf)
                        throws 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:
ConfigurationException - if an error occurs accessing the Configuration object

select

public Component select(Object hint)
                 throws ComponentException
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 Store
Parameters:
hint - the Configuration object used to look up the repository
Returns:
the selected repository
Throws:
ComponentException - if any error occurs while parsing the Configuration or retrieving the MailRepository

getName

public static final 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

getInboundSpool

public SpoolRepository getInboundSpool()
Returns the mail spool associated with this AvalonMailStore

Specified by:
getInboundSpool in interface MailStore
Returns:
the mail spool
Throws:
IllegalStateException - if the inbound spool has not yet been set

hasComponent

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

Specified by:
hasComponent in interface ComponentSelector
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(Component component)
Return the Component when you are finished with it. In this implementation it does nothing

Specified by:
release in interface ComponentSelector
Parameters:
component - The Component we are releasing.


"Copyright © 1999-2002 Apache Jakarta Project. All Rights Reserved."