|
jSyncManager Simple Java Server | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread org.jSyncManager.SJS.API.AbstractAdapter org.jSyncManager.SJS.API.AbstractRequestResponseAdapter org.jSyncManager.SJS.Adapters.SMTPServer.AbstractSMTPServer
public abstract class AbstractSMTPServer
This is an abstract adapter to be used for handling smtp requests. This class will take case of parsing received command and ensuring that any state requirements for the entered commands are met before forwarding the command for action to the subclass implementation.
Nested Class Summary | |
---|---|
class |
AbstractSMTPServer.CommandData
Handles the DATA command |
class |
AbstractSMTPServer.CommandEhlo
Handles the EHLO command |
class |
AbstractSMTPServer.CommandExpn
Handles the EXPN command |
class |
AbstractSMTPServer.CommandHelo
Handles the HELO command |
class |
AbstractSMTPServer.CommandHelp
Handles the HELP command |
class |
AbstractSMTPServer.CommandMail
Handles the MAIL command |
class |
AbstractSMTPServer.CommandNoop
Handles the NOOP command |
class |
AbstractSMTPServer.CommandQuit
Handles the QUIT command |
class |
AbstractSMTPServer.CommandRcpt
Handles the RCPT command |
class |
AbstractSMTPServer.CommandRset
Handles the RSET command |
class |
AbstractSMTPServer.CommandVrfy
Handles the VRFY command |
class |
AbstractSMTPServer.SmtpCommand
Handles the response of the system to a single command |
static class |
AbstractSMTPServer.State
Stores a mutable long for the masks which represent the state information |
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
protected static java.lang.String |
atDomainRegex
A string to provide the basic regex for a valid domain name preceeded by an '@'. |
protected java.util.HashMap<java.lang.String,AbstractSMTPServer.SmtpCommand> |
commands
stores all the command strings mapped to the handlers for those string |
protected long |
currentMask
bit used in construction of SmtpCommands, currently supports maximum 64 commands |
protected static java.lang.String |
domainRegex
A string to provide the basic regex for a valid domain name. |
protected static java.lang.String |
INVALID_ADDR_SYNTAX
String returned for invalid e-mail address syntax |
protected static java.lang.String |
INVALID_SEQUENCE
String returned for a command run out of sequence |
protected static java.lang.String |
INVALID_SYNTAX
String returned for invalid syntax |
protected static java.util.regex.Pattern |
mailAddrExpr
A pattern object for easily matching data within MAIL FROM: statements. |
protected static java.lang.String |
PARAM_NOT_IMPLEMENTED
String returned when a parameter is not implemented |
protected static java.util.regex.Pattern |
rcptAddrExpr
A pattern object for easily matching data within RCPT TO: statements. |
protected static java.util.regex.Pattern |
relayPattern
A pattern object for easily matching relays. |
protected AbstractSMTPServer.State |
state
A bit mask field to store the current state of the connection being handled by this instance |
protected static java.lang.String |
validEmailChars
A string to provide a regex denoting the basic valid e-mail characters. |
Fields inherited from class org.jSyncManager.SJS.API.AbstractAdapter |
---|
props |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
AbstractSMTPServer()
AbstractSMTPServer constructor, initializes the commands |
Method Summary | |
---|---|
java.util.HashMap<java.lang.String,AbstractSMTPServer.SmtpCommand> |
getCommands()
|
protected java.lang.String |
getConnectionHeaderString()
General summary |
long |
getCurrentMask()
|
static java.util.regex.Pattern |
getMailAddrExpr()
|
static java.util.regex.Pattern |
getRcptAddrExpr()
|
long |
getStateLong()
|
protected void |
initCommands()
Registers all of the available commands into the given map. |
protected abstract java.lang.String |
processData()
Processes a syntactically correct DATA command |
protected abstract java.lang.String |
processEhlo(java.lang.String args)
Processes a syntactically correct EHLO command |
protected abstract java.lang.String |
processExpn(java.lang.String args)
Processes a syntactically correct EXPN command |
protected abstract java.lang.String |
processHelo(java.lang.String args)
Processes a syntactically correct HELO command |
protected abstract java.lang.String |
processHelp(java.lang.String args)
Processes a syntactically correct HELP command |
protected abstract java.lang.String |
processMail(java.lang.String args)
Processes a syntactically correct MAIL command |
protected abstract java.lang.String |
processMessageFinished()
run at the end of a message, after "." appears on a line by itself |
protected abstract void |
processMessagePart(java.lang.String args)
Processes a string received while in the DATA state |
protected abstract java.lang.String |
processNoop()
Processes NOOP command |
protected abstract java.lang.String |
processQuit()
Processes a syntactically correct QUIT command |
protected abstract java.lang.String |
processRcpt(java.util.List<java.lang.String> relays,
java.lang.String addr)
Processes a syntactically correct RCPT command. |
protected java.lang.String |
processRequest(java.lang.String request)
Implementation of the processRequest method from AbstractResponseAdapter. |
protected abstract java.lang.String |
processRset()
Processes a syntactically correct RSET command |
protected abstract java.lang.String |
processVrfy(java.lang.String args)
Processes a syntactically correct VRFY command |
Methods inherited from class org.jSyncManager.SJS.API.AbstractRequestResponseAdapter |
---|
disconnect, getTimeoutMessage, processConnection |
Methods inherited from class org.jSyncManager.SJS.API.AbstractAdapter |
---|
connectionPermitted, getConnectionManagerInterface, getInetAddress, getLogManager, getProperty, processConnection, run, setLogManager, setThreadGroup |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String INVALID_SYNTAX
protected static final java.lang.String INVALID_ADDR_SYNTAX
protected static final java.lang.String INVALID_SEQUENCE
protected static final java.lang.String PARAM_NOT_IMPLEMENTED
protected static final java.lang.String validEmailChars
protected static final java.lang.String domainRegex
protected static final java.lang.String atDomainRegex
protected static final java.util.regex.Pattern rcptAddrExpr
protected static final java.util.regex.Pattern mailAddrExpr
protected static final java.util.regex.Pattern relayPattern
protected java.util.HashMap<java.lang.String,AbstractSMTPServer.SmtpCommand> commands
protected AbstractSMTPServer.State state
protected long currentMask
Constructor Detail |
---|
public AbstractSMTPServer()
Method Detail |
---|
protected void initCommands()
protected java.lang.String processRequest(java.lang.String request) throws java.lang.Exception
processRequest
in class AbstractRequestResponseAdapter
request
- parameter value
java.lang.Exception
- exceptionprotected abstract java.lang.String processHelo(java.lang.String args) throws java.lang.Exception
args
- parameter value
java.lang.Exception
- exceptionprotected abstract java.lang.String processEhlo(java.lang.String args) throws java.lang.Exception
args
- parameter value
java.lang.Exception
- exceptionprotected abstract java.lang.String processMail(java.lang.String args)
args
- The parameters passed to this command
protected abstract java.lang.String processRcpt(java.util.List<java.lang.String> relays, java.lang.String addr)
relays
- a list of relays.addr
- The parameters passed to this command.
protected abstract java.lang.String processData()
protected abstract void processMessagePart(java.lang.String args)
args
- The current part of the e-mail messageprotected abstract java.lang.String processMessageFinished()
protected abstract java.lang.String processRset()
protected abstract java.lang.String processVrfy(java.lang.String args)
args
- The parameters passed to this command
protected abstract java.lang.String processExpn(java.lang.String args)
args
- The parameters passed to this command
protected abstract java.lang.String processHelp(java.lang.String args)
args
- The parameters passed to this command
protected abstract java.lang.String processQuit() throws java.lang.Exception
java.lang.Exception
- exceptionprotected abstract java.lang.String processNoop()
protected java.lang.String getConnectionHeaderString()
getConnectionHeaderString
in class AbstractRequestResponseAdapter
public static java.util.regex.Pattern getRcptAddrExpr()
public static java.util.regex.Pattern getMailAddrExpr()
public java.util.HashMap<java.lang.String,AbstractSMTPServer.SmtpCommand> getCommands()
public long getStateLong()
public long getCurrentMask()
|
jSyncManager Simple Java Server | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |