FileDocCategorySizeDatePackage
POP3Server.javaAPI DocApache James 2.3.18692Fri Jan 12 12:56:24 GMT 2007org.apache.james.pop3server

POP3Server

public class POP3Server extends org.apache.james.core.AbstractJamesService implements POP3ServerMBean

Accepts POP3 connections on a server socket and dispatches them to POP3Handlers.

Also responsible for loading and parsing POP3 specific configuration.

version
1.0.0, 24/04/1999

Fields Summary
private org.apache.james.services.MailServer
mailServer
The internal mail server service
private org.apache.james.services.UsersRepository
users
The user repository for this server - used to authenticate users.
private int
lengthReset
The number of bytes to read before resetting the connection timeout timer. Defaults to 20 KB.
private org.apache.avalon.excalibur.pool.Pool
theHandlerPool
The pool used to provide POP3 Handler objects
private org.apache.avalon.excalibur.pool.ObjectFactory
theHandlerFactory
The factory used to provide POP3 Handler objects
private org.apache.james.util.watchdog.WatchdogFactory
theWatchdogFactory
The factory used to generate Watchdog objects
private POP3HandlerConfigurationData
theConfigData
The configuration data to be passed to the handler
Constructors Summary
Methods Summary
public voidconfigure(org.apache.avalon.framework.configuration.Configuration configuration)

see
org.apache.avalon.framework.configuration.Configurable#configure(Configuration)

        super.configure(configuration);
        if (isEnabled()) {
            Configuration handlerConfiguration = configuration.getChild("handler");
            lengthReset = handlerConfiguration.getChild("lengthReset").getValueAsInteger(lengthReset);
            if (getLogger().isInfoEnabled()) {
                getLogger().info("The idle timeout will be reset every " + lengthReset + " bytes.");
            }
        }
    
protected intgetDefaultPort()

see
org.apache.james.core.AbstractJamesService#getDefaultPort()

        return 110;
     
public java.lang.StringgetServiceType()

see
org.apache.james.core.AbstractJamesService#getServiceType()

        return "POP3 Service";
    
public voidinitialize()

see
org.apache.avalon.framework.activity.Initializable#initialize()

        super.initialize();
        if (!isEnabled()) {
            return;
        }

        if (connectionLimit != null) {
            theHandlerPool = new HardResourceLimitingPool(theHandlerFactory, 5, connectionLimit.intValue());
            getLogger().debug("Using a bounded pool for POP3 handlers with upper limit " + connectionLimit.intValue());
        } else {
            // NOTE: The maximum here is not a real maximum.  The handler pool will continue to
            //       provide handlers beyond this value.
            theHandlerPool = new DefaultPool(theHandlerFactory, null, 5, 30);
            getLogger().debug("Using an unbounded pool for POP3 handlers.");
        }
        if (theHandlerPool instanceof LogEnabled) {
            ((LogEnabled)theHandlerPool).enableLogging(getLogger());
        }
        if (theHandlerPool instanceof Initializable) {
            ((Initializable)theHandlerPool).initialize();
        }

        theWatchdogFactory = getWatchdogFactory();
    
protected org.apache.avalon.cornerstone.services.connection.ConnectionHandlernewHandler()

see
org.apache.avalon.cornerstone.services.connection.AbstractHandlerFactory#newHandler()

        POP3Handler theHandler = (POP3Handler)theHandlerPool.get();

        Watchdog theWatchdog = theWatchdogFactory.getWatchdog(theHandler.getWatchdogTarget());

        theHandler.setConfigurationData(theConfigData);

        theHandler.setWatchdog(theWatchdog);

        return theHandler;
    
public voidreleaseConnectionHandler(org.apache.avalon.cornerstone.services.connection.ConnectionHandler connectionHandler)

see
org.apache.avalon.cornerstone.services.connection.ConnectionHandlerFactory#releaseConnectionHandler(ConnectionHandler)

        if (!(connectionHandler instanceof POP3Handler)) {
            throw new IllegalArgumentException("Attempted to return non-POP3Handler to pool.");
        }
        theHandlerPool.put((Poolable)connectionHandler);
    
public voidservice(org.apache.avalon.framework.service.ServiceManager componentManager)

see
org.apache.avalon.framework.service.Serviceable#compose(ServiceManager)


           
          
          
        super.service(componentManager);
        mailServer = (MailServer)componentManager.lookup( MailServer.ROLE );
        users = (UsersRepository)componentManager.lookup( UsersRepository.ROLE );