org.mailster.pop3
Class Pop3ProtocolHandler

java.lang.Object
  extended by org.apache.mina.core.service.IoHandlerAdapter
      extended by org.mailster.pop3.Pop3ProtocolHandler
All Implemented Interfaces:
org.apache.mina.core.service.IoHandler, AbstractPop3Handler

public class Pop3ProtocolHandler
extends org.apache.mina.core.service.IoHandlerAdapter
implements AbstractPop3Handler

---
Mailster (C) 2007-2009 De Oliveira Edouard

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

See  Mailster Web Site
---

Pop3ProtocolHandler.java - Handles POP3 protocol communications.

Version:
$Revision: 1.7 $, $Date: 2009/01/30 01:32:31 $
Author:
Edouard De Oliveira

Field Summary
protected static java.lang.String CONNECTION
           
static int DEFAULT_TIMEOUT_SECONDS
           
private static java.lang.String LAST_INCOMPLETE_COMMAND
           
private static org.slf4j.Logger log
           
private static java.lang.String PEER_IS_CLOSING_SESSION
           
private  boolean secureAuthRequired
           
private static java.lang.String SECURED_AUTH_REQUIRED
           
private static int timeout
           
private  UserManager userManager
           
private static java.lang.String USING_APOP_AUTH
           
private  boolean usingAPOPAuthMethod
           
 
Constructor Summary
Pop3ProtocolHandler(UserManager userManager)
           
 
Method Summary
 void exceptionCaught(org.apache.mina.core.session.IoSession session, java.lang.Throwable cause)
           
static int getTimeout()
          Get the reader timeout in seconds.
 boolean isSecureAuthRequired(AbstractPop3Connection conn)
           
 boolean isUsingAPOPAuthMethod(AbstractPop3Connection conn)
           
 void messageReceived(org.apache.mina.core.session.IoSession session, java.lang.Object message)
           
 void quit(AbstractPop3Connection conn)
           
private  void sendGreetings(MinaPop3Connection conn)
           
 void sessionClosed(org.apache.mina.core.session.IoSession session)
           
 void sessionCreated(org.apache.mina.core.session.IoSession session)
           
 void sessionIdle(org.apache.mina.core.session.IoSession session, org.apache.mina.core.session.IdleStatus status)
           
 void setSecureAuthRequired(boolean secureAuthRequired)
           
static void setTimeout(int timeout)
          Set the reader timeout for the new sessions.
 void setUsingAPOPAuthMethod(boolean usingAPOPAuthMethod)
           
 
Methods inherited from class org.apache.mina.core.service.IoHandlerAdapter
messageSent, sessionOpened
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONNECTION

protected static final java.lang.String CONNECTION

PEER_IS_CLOSING_SESSION

private static final java.lang.String PEER_IS_CLOSING_SESSION

USING_APOP_AUTH

private static final java.lang.String USING_APOP_AUTH

SECURED_AUTH_REQUIRED

private static final java.lang.String SECURED_AUTH_REQUIRED

LAST_INCOMPLETE_COMMAND

private static final java.lang.String LAST_INCOMPLETE_COMMAND

DEFAULT_TIMEOUT_SECONDS

public static final int DEFAULT_TIMEOUT_SECONDS
See Also:
Constant Field Values

timeout

private static int timeout

log

private static final org.slf4j.Logger log

userManager

private UserManager userManager

usingAPOPAuthMethod

private boolean usingAPOPAuthMethod

secureAuthRequired

private boolean secureAuthRequired
Constructor Detail

Pop3ProtocolHandler

public Pop3ProtocolHandler(UserManager userManager)
Method Detail

sessionCreated

public void sessionCreated(org.apache.mina.core.session.IoSession session)
Specified by:
sessionCreated in interface org.apache.mina.core.service.IoHandler
Overrides:
sessionCreated in class org.apache.mina.core.service.IoHandlerAdapter

sessionClosed

public void sessionClosed(org.apache.mina.core.session.IoSession session)
                   throws java.lang.Exception
Specified by:
sessionClosed in interface org.apache.mina.core.service.IoHandler
Overrides:
sessionClosed in class org.apache.mina.core.service.IoHandlerAdapter
Throws:
java.lang.Exception

sendGreetings

private void sendGreetings(MinaPop3Connection conn)

sessionIdle

public void sessionIdle(org.apache.mina.core.session.IoSession session,
                        org.apache.mina.core.session.IdleStatus status)
Specified by:
sessionIdle in interface org.apache.mina.core.service.IoHandler
Overrides:
sessionIdle in class org.apache.mina.core.service.IoHandlerAdapter

exceptionCaught

public void exceptionCaught(org.apache.mina.core.session.IoSession session,
                            java.lang.Throwable cause)
Specified by:
exceptionCaught in interface org.apache.mina.core.service.IoHandler
Overrides:
exceptionCaught in class org.apache.mina.core.service.IoHandlerAdapter

messageReceived

public void messageReceived(org.apache.mina.core.session.IoSession session,
                            java.lang.Object message)
                     throws java.lang.Exception
Specified by:
messageReceived in interface org.apache.mina.core.service.IoHandler
Overrides:
messageReceived in class org.apache.mina.core.service.IoHandlerAdapter
Throws:
java.lang.Exception

isUsingAPOPAuthMethod

public boolean isUsingAPOPAuthMethod(AbstractPop3Connection conn)
Specified by:
isUsingAPOPAuthMethod in interface AbstractPop3Handler

isSecureAuthRequired

public boolean isSecureAuthRequired(AbstractPop3Connection conn)
Specified by:
isSecureAuthRequired in interface AbstractPop3Handler

setUsingAPOPAuthMethod

public void setUsingAPOPAuthMethod(boolean usingAPOPAuthMethod)

setSecureAuthRequired

public void setSecureAuthRequired(boolean secureAuthRequired)

quit

public void quit(AbstractPop3Connection conn)
Specified by:
quit in interface AbstractPop3Handler

getTimeout

public static int getTimeout()
Get the reader timeout in seconds.

Returns:
the timeout value

setTimeout

public static void setTimeout(int timeout)
Set the reader timeout for the new sessions.

Parameters:
timeout - timeout in seconds