SK.gnome.dwarf.mail.smtp
Class QueueManager

java.lang.Object
  extended bySK.gnome.dwarf.GenericService
      extended bySK.gnome.dwarf.GenericServer
          extended bySK.gnome.dwarf.thread.ThreadServer
              extended bySK.gnome.dwarf.thread.MultiThreadServer
                  extended bySK.gnome.dwarf.mail.smtp.QueueManager
All Implemented Interfaces:
SK.gnome.dwarf.Reportable, java.lang.Runnable, SK.gnome.dwarf.Server, SK.gnome.dwarf.Service

public class QueueManager
extends SK.gnome.dwarf.thread.MultiThreadServer

Provides mail queue management.

This service must be added to SMTPServer to provide mail queue handling.

If the server should provide remote deliveries, a SK.gnome.dwarf.utils.dns.DNSService must be added to this service.

A SK.gnome.dwarf.utils.cache.Cache implementation may be added to this service to provide an effective caching of client SMTP connections when performing remote deliveries.


Field Summary
static java.lang.String NODE_ALL
          Short name for all nodes.
static java.lang.String NODE_LOCAL
          Short name for local domain nodes.
static java.lang.String NODE_PROCESS
          Name for the special processing node.
static java.lang.String NODE_REMOTE
          Short name for remote domain nodes.
 
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
QueueManager(java.lang.String name)
          Creates a new QueueManager.
 
Method Summary
 void addService(SK.gnome.dwarf.Service service)
           
protected  void finish()
           
 void init(SK.gnome.dwarf.Server parent)
           
 boolean isLocalHost(java.lang.String domain)
          Whether the given domain is served by this server.
 void printMessage(SMTPMessage message, boolean details, java.io.PrintWriter out)
          Prints out the information about the given message.
 void runQueue(java.lang.String node, boolean forceDelivery)
          Process the given node.
 void setDateFormat(java.lang.String format)
          Sets the date/time format used to print out the mail queue information.
 void setInterval(int interval)
          Sets the queue processing interval.
 void start()
           
 
Methods inherited from class SK.gnome.dwarf.thread.MultiThreadServer
dequeue, enableThread, enqueue, finish, getHandlerTimeout, loop, report, setHandlerClass, setHandlerTimeout, setMaxHandlers, setMinHandlers, setQueueSize, setSingleRequest, wakeUpHandlers
 
Methods inherited from class SK.gnome.dwarf.thread.ThreadServer
run, setDaemon, shutdown, 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.Service
getFullName, getName, getState, log, log, login, logout
 

Field Detail

NODE_ALL

public static final java.lang.String NODE_ALL
Short name for all nodes.

Value: "#all"

See Also:
Constant Field Values

NODE_LOCAL

public static final java.lang.String NODE_LOCAL
Short name for local domain nodes.

Value: "#local"

See Also:
Constant Field Values

NODE_REMOTE

public static final java.lang.String NODE_REMOTE
Short name for remote domain nodes.

Value: "#remote"

See Also:
Constant Field Values

NODE_PROCESS

public static final java.lang.String NODE_PROCESS
Name for the special processing node.

Value: "#process"

See Also:
Constant Field Values
Constructor Detail

QueueManager

public QueueManager(java.lang.String name)
Creates a new QueueManager.

Parameters:
name - the service name
Method Detail

setInterval

public void setInterval(int interval)
Sets the queue processing interval.

Parameters:
interval - the interval in minutes

setDateFormat

public void setDateFormat(java.lang.String format)
Sets the date/time format used to print out the mail queue information.

Parameters:
format - the date format

addService

public void addService(SK.gnome.dwarf.Service service)
                throws SK.gnome.dwarf.ServiceException
Throws:
SK.gnome.dwarf.ServiceException

init

public void init(SK.gnome.dwarf.Server parent)
          throws SK.gnome.dwarf.ServiceException
Throws:
SK.gnome.dwarf.ServiceException

start

public void start()
           throws SK.gnome.dwarf.ServiceException
Throws:
SK.gnome.dwarf.ServiceException

printMessage

public void printMessage(SMTPMessage message,
                         boolean details,
                         java.io.PrintWriter out)
                  throws MailException
Prints out the information about the given message.

Parameters:
message - the message
details - true to print details, false otherwise
out - the output stream
Throws:
MailException - if an error occured

runQueue

public void runQueue(java.lang.String node,
                     boolean forceDelivery)
Process the given node.

The given node will be processed. If the forceDelivery parameter is true, the messages will be dequeued regardless of the time they were enqueued for. If the node parameter starts with the "@" character, it will force to process all nodes whose names end with this string without the "@" character. Furthermore, one of the NODE_ALL, NODE_LOCAL or NODE_REMOTE short names may be used as the node parameter, too.

Parameters:
node - the node name
forceDelivery - true to force the processing, false otherwise

isLocalHost

public boolean isLocalHost(java.lang.String domain)
Whether the given domain is served by this server.

Parameters:
domain - the domain name
Returns:
true if the domain is local, false otherwise

finish

protected void finish()


Copyright (c) 2004-2005, Gnome Ltd. All rights reserved.