org.apache.james.imapserver
Class ImapServer

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.avalon.cornerstone.services.connection.AbstractHandlerFactory
          extended by org.apache.james.socket.AbstractJamesService
              extended by org.apache.james.imapserver.ImapServer
All Implemented Interfaces:
org.apache.avalon.cornerstone.services.connection.ConnectionHandlerFactory, org.apache.avalon.excalibur.pool.ObjectFactory, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, org.apache.james.imap.api.ImapConstants, org.apache.jsieve.mailet.Poster

public class ImapServer
extends AbstractJamesService
implements org.apache.james.imap.api.ImapConstants, org.apache.jsieve.mailet.Poster

TODO: this is a quick cut-and-paste hack from POP3Server. Should probably be rewritten from scratch, together with ImapHandler.

Accepts IMAP connections on a server socket and dispatches them to IMAPHandlers.

Also responsible for loading and parsing IMAP specific configuration.


Field Summary
 
Fields inherited from class org.apache.james.socket.AbstractJamesService
backlog, BACKLOG_NAME, bindTo, connectionLimit, connectionName, DEFAULT_BACKLOG, DEFAULT_TIMEOUT, HELLO_NAME, helloName, port, serverSocket, serverSocketType, theHandlerPool, theWatchdogFactory, threadGroup, threadPool, timeout, TIMEOUT_NAME
 
Fields inherited from interface org.apache.james.imap.api.ImapConstants
APPEND_COMMAND_NAME, AUTHENTICATE_COMMAND_NAME, BACK_SLASH, BAD, BYE, BYTE_BACK_SLASH, BYTE_CLOSE_BRACE, BYTE_CLOSE_SQUARE_BRACKET, BYTE_CLOSING_PARENTHESIS, BYTE_DQUOTE, BYTE_OPEN_BRACE, BYTE_OPEN_SQUARE_BRACKET, BYTE_OPENING_PARENTHESIS, BYTE_QUESTION, BYTE_SP, BYTES_CLOSE_BRACE, BYTES_CLOSE_SQUARE_BRACKET, BYTES_CLOSING_PARENTHESIS, BYTES_DQUOTE, BYTES_LINE_END, BYTES_OPEN_BRACE, BYTES_OPEN_SQUARE_BRACKET, BYTES_OPENING_PARENTHESIS, BYTES_SPACE, CAPABILITY_COMMAND_NAME, CHECK_COMMAND_NAME, CLOSE_COMMAND_NAME, CLOSING_PARENTHESIS, CLOSING_SQUARE_BRACKET, COPY_COMMAND_NAME, CREATE_COMMAND_NAME, DELETE_COMMAND_NAME, DQUOTE, EMPTY_STRING_ARRAY, EXAMINE_COMMAND_NAME, EXPUNGE_COMMAND_NAME, FETCH_BODY, FETCH_BODY_STRUCTURE, FETCH_COMMAND_NAME, FETCH_RFC822, FETCH_RFC822_HEADER, FETCH_RFC822_TEXT, HIERARCHY_DELIMITER, HIERARCHY_DELIMITER_CHAR, INBOX_NAME, LIST_COMMAND_NAME, LIST_RESPONSE_NAME, LOGIN_COMMAND_NAME, LOGOUT_COMMAND_NAME, LSUB_COMMAND_NAME, LSUB_RESPONSE_NAME, MIME_HEADER_CONTENT_LANGUAGE, MIME_HEADER_CONTENT_LOCATION, MIME_HEADER_CONTENT_MD5, MIME_SUBTYPE_PLAIN, MIME_SUBTYPE_RFC822, MIME_TYPE_MESSAGE, MIME_TYPE_MULTIPART, MIME_TYPE_TEXT, NAME_ATTRIBUTE_HAS_CHILDREN, NAME_ATTRIBUTE_HAS_NO_CHILDREN, NAME_ATTRIBUTE_MARKED, NAME_ATTRIBUTE_NOINFERIORS, NAME_ATTRIBUTE_NOSELECT, NAME_ATTRIBUTE_UNMARKED, NAMESPACE_COMMAND_NAME, NAMESPACE_PREFIX, NAMESPACE_PREFIX_CHAR, NIL, NO, NOOP_COMMAND_NAME, OK, OPENING_PARENTHESIS, OPENING_SQUARE_BRACKET, PS_HEADER, PS_MIME, PS_TEXT, RENAME_COMMAND_NAME, RFC822_BCC, RFC822_CC, RFC822_DATE, RFC822_FROM, RFC822_IN_REPLY_TO, RFC822_MESSAGE_ID, RFC822_REPLY_TO, RFC822_SENDER, RFC822_SUBJECT, RFC822_TO, SEARCH_COMMAND_NAME, SEARCH_RESPONSE_NAME, SELECT_COMMAND_NAME, SP, SP_CHAR, STATUS_COMMAND_NAME, STATUS_MESSAGES, STATUS_RECENT, STATUS_UIDNEXT, STATUS_UIDVALIDITY, STATUS_UNSEEN, STORE_COMMAND_NAME, SUBSCRIBE_COMMAND_NAME, SUPPORTS_LITERAL_PLUS, SUPPORTS_NAMESPACES, SUPPORTS_RFC3348, UID, UID_COMMAND_NAME, UNSUBSCRIBE_COMMAND_NAME, UNTAGGED, USER_NAMESPACE, VERSION
 
Constructor Summary
ImapServer()
           
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
           
 void dispose()
           
protected  java.lang.Object getConfigurationData()
           
protected  int getDefaultPort()
          Get the default port for this server type.
 java.lang.String getServiceType()
          This method returns the type of service provided by this server.
 void initialize()
           
 ProtocolHandler newProtocolHandlerInstance()
          Producing handlers.
 void post(java.lang.String url, javax.mail.internet.MimeMessage mail)
           
 void postToMailbox(java.lang.String username, javax.mail.internet.MimeMessage mail, java.lang.String destination, org.apache.james.imap.mailbox.MailboxSession session, org.apache.james.imap.mailbox.MailboxManager mailboxManager)
           
 void service(org.apache.avalon.framework.service.ServiceManager comp)
           
 
Methods inherited from class org.apache.james.socket.AbstractJamesService
createConnectionHandler, decommission, getCreatedClass, getLocalHostName, getNetworkInterface, getPort, getSocketType, getWatchdogFactory, isDefaultTLSEnabled, isEnabled, newHandler, newInstance, releaseConnectionHandler, setConnectionManager, setStreamDumpDir
 
Methods inherited from class org.apache.avalon.cornerstone.services.connection.AbstractHandlerFactory
contextualize
 
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

ImapServer

public ImapServer()
Method Detail

service

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

dispose

public void dispose()
Specified by:
dispose in interface org.apache.avalon.framework.activity.Disposable
Overrides:
dispose in class AbstractJamesService
See Also:
Disposable.dispose()

initialize

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

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
Overrides:
configure in class AbstractJamesService
Throws:
org.apache.avalon.framework.configuration.ConfigurationException
See Also:
Configurable.configure(Configuration)

getDefaultPort

protected int getDefaultPort()
Description copied from class: AbstractJamesService
Get the default port for this server type. It is strongly recommended that subclasses of this class override this method to specify the default port for their specific server type.

Overrides:
getDefaultPort in class AbstractJamesService
Returns:
the default port
See Also:
AbstractJamesService.getDefaultPort()

getServiceType

public java.lang.String getServiceType()
Description copied from class: AbstractJamesService
This method returns the type of service provided by this server. This should be invariant over the life of the class. Subclasses may override this implementation. This implementation parses the complete class name and returns the undecorated class name.

Overrides:
getServiceType in class AbstractJamesService
Returns:
description of this server
See Also:
AbstractJamesService.getServiceType()

newProtocolHandlerInstance

public ProtocolHandler newProtocolHandlerInstance()
Producing handlers.

Specified by:
newProtocolHandlerInstance in class AbstractJamesService
See Also:
ObjectFactory.newInstance()

getConfigurationData

protected java.lang.Object getConfigurationData()
Specified by:
getConfigurationData in class AbstractJamesService

post

public void post(java.lang.String url,
                 javax.mail.internet.MimeMessage mail)
          throws javax.mail.MessagingException
Specified by:
post in interface org.apache.jsieve.mailet.Poster
Throws:
javax.mail.MessagingException

postToMailbox

public void postToMailbox(java.lang.String username,
                          javax.mail.internet.MimeMessage mail,
                          java.lang.String destination,
                          org.apache.james.imap.mailbox.MailboxSession session,
                          org.apache.james.imap.mailbox.MailboxManager mailboxManager)
                   throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException


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