|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object SK.gnome.dwarf.GenericService SK.gnome.dwarf.GenericServer SK.gnome.dwarf.thread.ThreadServer SK.gnome.dwarf.thread.MultiThreadServer SK.gnome.dwarf.tcpip.TCPIPServer SK.gnome.dwarf.mail.MailServer SK.gnome.dwarf.mail.smtp.SMTPServer
This is the main SMTP server object.
Field Summary |
Fields inherited from class SK.gnome.dwarf.mail.MailServer |
hosts |
Fields inherited from class SK.gnome.dwarf.tcpip.TCPIPServer |
sslContext |
Fields inherited from class SK.gnome.dwarf.thread.MultiThreadServer |
counter |
Fields inherited from class SK.gnome.dwarf.thread.ThreadServer |
daemon, thread |
Fields inherited from class SK.gnome.dwarf.GenericService |
initParameters, parent |
Fields inherited from interface SK.gnome.dwarf.Service |
INITIALIZED, LOG_DEBUG, LOG_ERROR, LOG_FATAL, LOG_INFO, LOG_TRACE, LOG_WARN, LOG_XFER, SHUTDOWN, STARTED, STOPPED |
Constructor Summary | |
SMTPServer(java.lang.String name)
Creates a new SMTPServer. |
Method Summary | |
void |
addService(SK.gnome.dwarf.Service service)
Adds the given service to the server. |
java.util.Collection |
expandAlias(SMTPMessage message,
Recipient recipient)
Expands the given alias recipient to collection of mail recipients. |
java.lang.String |
getHostName()
Returns the full hostname of the server. |
SMTPMessage |
getMessageInstance()
Creates a new SMTPMessage istance. |
void |
init(SK.gnome.dwarf.Server parent)
Initializes the service. |
boolean |
isLocalHost(java.lang.String hostname)
Finds out whether the given argument refers to a local mail host. |
boolean |
isLocalUser(java.lang.String user)
Finds out whether the given argument refers to a local mail user. |
void |
listMessages(boolean details,
java.io.PrintWriter pw)
Lists all messages in the queue. |
void |
runQueue(java.lang.String node,
boolean forceDelivery)
Process the given queue node. |
void |
sendMessage(MimeMessageBuilder message)
Sends the message. |
void |
sendMessage(SMTPMessage message,
java.util.Collection recipients)
Sends the message. |
void |
shutdown()
|
void |
start()
|
void |
storeMessage(java.lang.String user,
java.lang.String folder,
java.lang.String from,
java.io.InputStream in)
Stores the message to the given mail folder. |
Methods inherited from class SK.gnome.dwarf.mail.MailServer |
getACLStore, getMailHost, getMailHostByUser, getMailStore, getUserStore |
Methods inherited from class SK.gnome.dwarf.tcpip.TCPIPServer |
createSSLServerSocket, createSSLServerSocket, createSSLSocket, enqueue, finish, getRequestReadTimeout, getTCPRequest, isBlocking, isSSLConfigured, loop, report, setKeyPwd, setKeyStorePwd, setKeyStoreURL, setRegistrationQueueSize, setRequestClass, setSSLProtocol |
Methods inherited from class SK.gnome.dwarf.thread.MultiThreadServer |
dequeue, enableThread, getHandlerTimeout, setHandlerClass, setHandlerTimeout, setMaxHandlers, setMinHandlers, setQueueSize, setSingleRequest, wakeUpHandlers |
Methods inherited from class SK.gnome.dwarf.thread.ThreadServer |
finish, run, setDaemon, stop |
Methods inherited from class SK.gnome.dwarf.GenericServer |
addService, getAuthenticator, getLogger, getParameters, getService, getServices, getServices, removeService |
Methods inherited from class SK.gnome.dwarf.GenericService |
getAuthFacility, getFullName, getInitParameter, getInitParameterNames, getLogFacility, getName, getPrincipal, getShutdownTimeout, getState, log, log, login, logout, setAuthFacility, setInitParameters, setLogFacility, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface SK.gnome.dwarf.mail.smtp.proc.MailAgentContext |
getMailStore, getUserStore |
Methods inherited from interface SK.gnome.dwarf.Service |
getFullName, getName, getState, log, log, login, logout |
Constructor Detail |
public SMTPServer(java.lang.String name)
The setHandlerClass(SMTPHandler.class) is invoked to set the initial
handler class. That means the server will use SMTPHandler
objects for handling
the client connections by default.
Method Detail |
public void addService(SK.gnome.dwarf.Service service) throws SK.gnome.dwarf.ServiceException
addService
in interface SK.gnome.dwarf.Server
addService
in class MailServer
SK.gnome.dwarf.ServiceException
public void init(SK.gnome.dwarf.Server parent) throws SK.gnome.dwarf.ServiceException
init
in interface SK.gnome.dwarf.Service
init
in class MailServer
SK.gnome.dwarf.ServiceException
public void shutdown()
shutdown
in interface SK.gnome.dwarf.Service
public void start() throws SK.gnome.dwarf.ServiceException
start
in interface SK.gnome.dwarf.Service
SK.gnome.dwarf.ServiceException
public java.lang.String getHostName()
MailAgentContext
This is also the name of the default mail host contained by the server.
getHostName
in interface MailAgentContext
public boolean isLocalHost(java.lang.String hostname)
MailAgentContext
isLocalHost
in interface MailAgentContext
hostname
- the host name
public boolean isLocalUser(java.lang.String user) throws MailException
MailAgentContext
The user argument may contain a domain part after the '@' character if it represents a virtual domain user.
The local part of the user argument is case-sensitive.
isLocalUser
in interface MailAgentContext
user
- the user name or mail address, if it is virtual user
MailException
- if an error occuredpublic SMTPMessage getMessageInstance() throws MailException
MailAgentContext
The SMTPMessage
object may be used to create and send a new mail message.
It provides more precise control over the delivery process than the MimeMessageBuilder
class.
getMessageInstance
in interface MailAgentContext
MailException
public void sendMessage(MimeMessageBuilder message) throws java.io.IOException, MailException
MailAgentContext
The message is put to the mail queue directly, bypassing the network and SMTP protocol overhead.
sendMessage
in interface MailAgentContext
message
- the message to send
java.io.IOException
- if an I/O error occured
MailException
- if an error occuredpublic void sendMessage(SMTPMessage message, java.util.Collection recipients) throws java.io.IOException, MailException
MailAgentContext
The message is put to the mail queue directly, bypassing the network and SMTP protocol overhead.
The recipients collection must contain Recipient objects, representing the actual message recipients.
sendMessage
in interface MailAgentContext
message
- the message to sendrecipients
- the message recipients represented by the Recipient objects
MailException
- if an error occured
java.io.IOException
- if an I/O error occuredpublic void storeMessage(java.lang.String user, java.lang.String folder, java.lang.String from, java.io.InputStream in) throws java.io.IOException, MailException
MailAgentContext
The unparsed message content will be read from the given in stream and stored to the local user's folder. The user argument may contain a domain part after the '@' character if it represents a virtual domain user. The from parameter specifies the sender's address (without the display name and comments) and will be used in setting the "Return-Path" header of the stored message, if the message has not been received via the SMTP protocol. If the from argument is null, this header will not be written at all.
This is a direct way how to store a message to the mail store, completely bypassing the queue and agent processing.
storeMessage
in interface MailAgentContext
user
- the local user namefolder
- full name of the target mail folderfrom
- the From address or nullin
- the input stream containing the raw message data
java.io.IOException
- if an I/O error occured
MailException
- if an error occuredpublic java.util.Collection expandAlias(SMTPMessage message, Recipient recipient) throws MailException
This method checks whether the given recipient represents an alias name and
it will try to expand it to collection of other recipients. This mechanism offers a basic
mail forwarding as well as simple mail distribution lists. The aliases are obtained from
the particular SMTPHost
as well as UserStore
instance which the given
recipient belongs to.
Please note that expanded addresses are not subject of further expansion in the same method call, so the expansion process is cummulative rather than recursive.
message
- source SMTP messagerecipient
- recipient representing the alias name
MailException
- if an error occurspublic void listMessages(boolean details, java.io.PrintWriter pw) throws MailException
details
- true to print message details, false otherwisepw
- the output stream
MailException
- if an error occuredMailQueue.listMessages(boolean, PrintWriter)
public void runQueue(java.lang.String node, boolean forceDelivery)
node
- the node nameforceDelivery
- true to force the processing, false otherwiseQueueManager.runQueue(String, boolean)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |