|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.abstracthorizon.danube.connection.ConnectionWrapper
org.abstracthorizon.mercury.smtp.SMTPSession
public class SMTPSession
SMTP connection which represents SMTP session.
Field Summary | |
---|---|
protected long |
created
When session is created |
protected MailSessionData |
data
Session data |
protected SMTPCommandFactory |
factory
Cached reference to command factory |
protected InputStream |
inputStream
Cached input stream |
protected long |
lastAccessed
When session is accessed |
static org.slf4j.Logger |
logger
Logger |
protected TempStorage |
mail
Temporary storage for receiving mail |
protected SMTPConnectionHandler |
parent
Connection handler that created this connection |
protected SMTPScanner |
scanner
Scanner object to be used |
protected int |
state
State of the session. |
static int |
STATE_CONNECTED
Session is connected - no command is received yet |
static int |
STATE_MAIL
Receiving RCPT TO and DATA commands |
static int |
STATE_READY
EHLO is received - waiting for MAIL FROM |
static int |
STATE_UNKNOWN
State is not defined - UNKNOWN state |
static SimpleDateFormat |
USER_READABLE_FORMAT
Human readable format |
Fields inherited from class org.abstracthorizon.danube.connection.ConnectionWrapper |
---|
connection |
Constructor Summary | |
---|---|
SMTPSession(org.abstracthorizon.danube.connection.Connection connection,
SMTPConnectionHandler parent)
Constructor |
Method Summary | |
---|---|
void |
close()
Closes the session (connection) |
SMTPCommandFactory |
getCommandFactory()
Returns command factory that is used |
SMTPConnectionHandler |
getConnectionHandler()
Returns refernece to handler that created this session |
OutputStream |
getDebugStream()
Returns debug output stream or null |
InputStream |
getInputStream()
Returns cached input stream |
MailSessionData |
getMailSessionData()
Returns mail session data object |
SMTPScanner |
getScanner()
Returns scanner object |
long |
getSessionAccessed()
Returns time when the session is last accessed |
String |
getSessionAccessedString()
Returns time when the session is last accessed in the human readable format |
long |
getSessionCreated()
Returns time when the session is created |
String |
getSessionCreatedString()
Returns time when the session is created in human readable format |
int |
getState()
Returns session's state |
boolean |
isKeepLog()
Returns shell logs be kept after session is finished |
boolean |
isStreamDebug()
Returns if logging is enabled |
void |
resetLastAccessed()
Resets last accessed time |
void |
sendResponse(SMTPResponse response)
Sets SMTP response back |
void |
setCommandFactory(SMTPCommandFactory factory)
Sets command factory to be used |
void |
setKeepLog(boolean keepLog)
Should we keep log after the session is finished |
void |
setState(int state)
Sets session's state |
void |
setStreamDebug(boolean debug)
Sets debug stream's logging attribute ( LoggingConnection.setLogging(boolean) if any. |
void |
writeLogMessage(String msg)
Helper function to write messaage to the log stream |
Methods inherited from class org.abstracthorizon.danube.connection.ConnectionWrapper |
---|
adapt, isClosed |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final SimpleDateFormat USER_READABLE_FORMAT
public static org.slf4j.Logger logger
public static final int STATE_UNKNOWN
public static final int STATE_CONNECTED
public static final int STATE_READY
public static final int STATE_MAIL
protected TempStorage mail
protected SMTPScanner scanner
protected int state
STATE_UNKNOWN
protected MailSessionData data
protected SMTPConnectionHandler parent
protected InputStream inputStream
protected SMTPCommandFactory factory
protected long created
protected long lastAccessed
Constructor Detail |
---|
public SMTPSession(org.abstracthorizon.danube.connection.Connection connection, SMTPConnectionHandler parent) throws org.abstracthorizon.danube.connection.ConnectionException
connection
- underlay connectionparent
- handler that created this session
org.abstracthorizon.danube.connection.ConnectionException
Method Detail |
---|
public void setKeepLog(boolean keepLog)
keepLog
- keep logpublic boolean isKeepLog()
public void writeLogMessage(String msg)
msg
- message to be writen to log streampublic void setStreamDebug(boolean debug)
LoggingConnection.setLogging(boolean)
if any.
debug
- logging should start (true
) or stop (false
)public boolean isStreamDebug()
public OutputStream getDebugStream()
null
null
public InputStream getInputStream()
public void setState(int state)
state
- new session's statepublic int getState()
public SMTPScanner getScanner()
public MailSessionData getMailSessionData()
public SMTPConnectionHandler getConnectionHandler()
public void close()
close
in interface org.abstracthorizon.danube.connection.Connection
close
in class org.abstracthorizon.danube.connection.ConnectionWrapper
public void sendResponse(SMTPResponse response) throws IOException
response
- response
IOException
public void setCommandFactory(SMTPCommandFactory factory)
factory
- command factory to be usedpublic SMTPCommandFactory getCommandFactory()
public long getSessionCreated()
public String getSessionCreatedString()
public long getSessionAccessed()
public String getSessionAccessedString()
public void resetLastAccessed()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |