org.abstracthorizon.mercury.imap
Class IMAPConnectionHandler

java.lang.Object
  extended by org.abstracthorizon.mercury.imap.IMAPConnectionHandler
All Implemented Interfaces:
org.abstracthorizon.danube.connection.ConnectionHandler

public class IMAPConnectionHandler
extends Object
implements org.abstracthorizon.danube.connection.ConnectionHandler

A class for IMAP service

Author:
Daniel Sendula

Field Summary
protected  boolean allowInsecure
          Allow insecure connections
protected  IMAPCommandFactory factory
          Command factory
protected  org.slf4j.Logger logger
          Logger
protected  char[] passPhrase
          Keystore pass phrase
protected  javax.mail.Session session
          Session
protected  StorageManager storageManager
          Storage manager
protected  javax.mail.Store store
          Selected store
protected  Executor threadPool
          Thread pool
 
Constructor Summary
IMAPConnectionHandler()
          Constructor
 
Method Summary
 boolean commandAny(IMAPSession imapConnection)
          Processes any command
 boolean commandAuth(IMAPSession imapConnection)
          Processes authorised commands
 boolean commandNonAuth(IMAPSession imapConnection)
          Processes non-authorised comamnds
 boolean commandSelected(IMAPSession imapConnection)
          Processes select command
 IMAPCommandFactory getFactory()
          Returns command factory
 javax.mail.Session getJavaMailSession()
          Returns javamail session that is used
 InputStream getKeyStoreInputStream()
          Returns keystore as an input stream
 char[] getPassPhrase()
          Returns pass phrase of a keystore to be used for switching to TLS
 StorageManager getStorageManager()
          Returns storage manager
 Executor getThreadPool()
          Returns thread pool to be used for parallel tasks
 void handleConnection(org.abstracthorizon.danube.connection.Connection connection)
          Handles IMAP connection
 void invokeCommand(IMAPSession imapConnection, String name)
          Invokes command
 void invokeCommand(IMAPSession imapConnection, String name, boolean uid)
          Invokes command
 boolean isInsecureAllowed()
          Returns if insecure connections are allowed
 void processInput(IMAPSession imapConnection)
          Processes input
 void setInsecureAllowed(boolean allowInsecure)
          Sets if insecure connections are allowed
 void setJavaMailSession(javax.mail.Session session)
          Sets javamail session that to be used
 void setPassPhrase(char[] passPhrase)
          Sets pass phrase of a keystore to be used for switching to TLS
 void setStorageManager(StorageManager storageManager)
          Sets storage manager
 void setThreadPool(Executor executor)
          Sets thread pool to be used for parallel tasks
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.slf4j.Logger logger
Logger


storageManager

protected StorageManager storageManager
Storage manager


store

protected javax.mail.Store store
Selected store


factory

protected IMAPCommandFactory factory
Command factory


session

protected javax.mail.Session session
Session


threadPool

protected Executor threadPool
Thread pool


passPhrase

protected char[] passPhrase
Keystore pass phrase


allowInsecure

protected boolean allowInsecure
Allow insecure connections

Constructor Detail

IMAPConnectionHandler

public IMAPConnectionHandler()
Constructor

Method Detail

setStorageManager

public void setStorageManager(StorageManager storageManager)
Sets storage manager

Parameters:
storageManager - storage manager

getStorageManager

public StorageManager getStorageManager()
Returns storage manager

Returns:
storage manager

getFactory

public IMAPCommandFactory getFactory()
Returns command factory

Returns:
command factory

getJavaMailSession

public javax.mail.Session getJavaMailSession()
Returns javamail session that is used

Returns:
javamail session that is used

setJavaMailSession

public void setJavaMailSession(javax.mail.Session session)
Sets javamail session that to be used

Parameters:
session - javamail session that to be used

setThreadPool

public void setThreadPool(Executor executor)
Sets thread pool to be used for parallel tasks

Parameters:
executor - thread pool

getThreadPool

public Executor getThreadPool()
Returns thread pool to be used for parallel tasks

Returns:
thread pool to be used for parallel tasks

getKeyStoreInputStream

public InputStream getKeyStoreInputStream()
Returns keystore as an input stream

Returns:
keystore as an input stream

setPassPhrase

public void setPassPhrase(char[] passPhrase)
Sets pass phrase of a keystore to be used for switching to TLS

Parameters:
passPhrase - password of a keystore

getPassPhrase

public char[] getPassPhrase()
Returns pass phrase of a keystore to be used for switching to TLS

Returns:
pass phrase of a keystore to be used for switching to TLS

isInsecureAllowed

public boolean isInsecureAllowed()
Returns if insecure connections are allowed

Returns:
if insecure connections are allowed

setInsecureAllowed

public void setInsecureAllowed(boolean allowInsecure)
Sets if insecure connections are allowed

Parameters:
allowInsecure - is insecure connection allowed

handleConnection

public void handleConnection(org.abstracthorizon.danube.connection.Connection connection)
Handles IMAP connection

Specified by:
handleConnection in interface org.abstracthorizon.danube.connection.ConnectionHandler
Parameters:
connection - connection

processInput

public void processInput(IMAPSession imapConnection)
                  throws IOException
Processes input

Parameters:
imapConnection - imap connection
Throws:
IOException

invokeCommand

public void invokeCommand(IMAPSession imapConnection,
                          String name)
                   throws IOException
Invokes command

Parameters:
imapConnection - imap connection
name - comamnd name
Throws:
IOException

invokeCommand

public void invokeCommand(IMAPSession imapConnection,
                          String name,
                          boolean uid)
                   throws IOException
Invokes command

Parameters:
imapConnection - imap connection
name - command name
uid - is UID function
Throws:
IOException

commandAny

public boolean commandAny(IMAPSession imapConnection)
                   throws IOException
Processes any command

Parameters:
imapConnection - imap connection
Returns:
command is recognised and processes
Throws:
IOException

commandNonAuth

public boolean commandNonAuth(IMAPSession imapConnection)
                       throws IOException
Processes non-authorised comamnds

Parameters:
imapConnection - imap connection
Returns:
command is found and executed
Throws:
IOException

commandAuth

public boolean commandAuth(IMAPSession imapConnection)
                    throws IOException
Processes authorised commands

Parameters:
imapConnection - imap connection
Returns:
command is found and executed
Throws:
IOException

commandSelected

public boolean commandSelected(IMAPSession imapConnection)
                        throws IOException
Processes select command

Parameters:
imapConnection - imap connection
Returns:
command is found and processed
Throws:
IOException


Copyright © 2005-2009 Abstract Horizon. All Rights Reserved.