xmlBlaster 2.2.0 API

org.xmlBlaster.protocol.email
Class EmailDriver

java.lang.Object
  extended by org.xmlBlaster.util.protocol.RequestReplyExecutor
      extended by org.xmlBlaster.util.protocol.email.EmailExecutor
          extended by org.xmlBlaster.protocol.email.EmailDriver
All Implemented Interfaces:
java.util.EventListener, I_ClientListener, I_Driver, I_AdminPlugin, I_AdminUsage, I_ResponseListener, I_Plugin, EmailExecutorMBean, RequestReplyExecutorMBean

public class EmailDriver
extends EmailExecutor
implements I_Driver, I_ClientListener

Email driver class to invoke the xmlBlaster server over ordinary emails.

This "email:" driver needs to be registered in xmlBlasterPlugins.xml and will be started on xmlBlaster startup by the runlevel manager as configured.

The interface I_Driver is needed by xmlBlaster to instantiate and shutdown this driver implementation.

All adjustable parameters are explained in usage()

Author:
Marcel Ruff
See Also:
MsgInfo, The protocol.email requirement

Nested Class Summary
 
Nested classes/interfaces inherited from class org.xmlBlaster.util.protocol.email.EmailExecutor
EmailExecutor.LoopProtection
 
Field Summary
private  I_Authenticate authenticate
          The singleton handle for this authentication server
private  Global glob
           
private static java.util.logging.Logger log
           
private  java.lang.String ME
           
private  PluginInfo pluginInfo
           
private  boolean stripSecurityQosCDATA
          The address configuration
private  I_XmlBlaster xmlBlasterImpl
          The singleton handle for this xmlBlaster server
 
Fields inherited from class org.xmlBlaster.util.protocol.email.EmailExecutor
bcc, BOUNCE_MAILFROM_KEY, BOUNCE_MAILTO_KEY, BOUNCE_MESSAGEID_KEY, cc, fromAddress, messageIdFileName, msgInfoParserClassName, payloadFileNamePrefix, pop3Driver, senderLoopProtectionMap, smtpClient, SUBJECT_MESSAGEID_TOKEN, subjectTemplate, toAddress
 
Fields inherited from class org.xmlBlaster.util.protocol.RequestReplyExecutor
addressConfig, addressServer, cbClient, compressZlib, compressZlibStream, contextNode, mbeanHandle, minSizeForCompression, ONEWAY, pingResponseTimeout, prefix, progressListener, responseListenerMap, responseTimeout, updateResponseTimeout, useEmailExpiryTimestamp, WAIT_ON_RESPONSE
 
Constructor Summary
EmailDriver()
          Creates the driver.
 
Method Summary
 void activate()
          Activate xmlBlaster access through this protocol.
 void deActivate()
          Deactivate xmlBlaster access (standby), no clients can connect.
(package private)  I_Authenticate getAuthenticate()
          Access the handle to the xmlBlaster authenication core
 java.lang.String getEmailSessionId(MsgInfo msgInfo)
          Overwrites EmailExecutor as we are a singleton handling different clients.
 java.lang.String getEnvPrefix()
          The command line key prefix
 java.lang.String getName()
          Get a human readable name of this driver
 java.lang.String getProtocolId()
          Access the xmlBlaster internal name of the protocol driver.
 java.lang.String getRawAddress()
          Get the address how to access this driver.
 java.lang.String getType()
          Enforced by I_Plugin
 java.lang.String getVersion()
          Enforced by I_Plugin
(package private)  I_XmlBlaster getXmlBlaster()
          Access the handle to the xmlBlaster core
private  void init(Global glob, AddressServer addressServer, I_Authenticate authenticate, I_XmlBlaster xmlBlasterImpl)
          Start xmlBlaster EMAIL access.
 void init(Global glob, PluginInfo pluginInfo)
          This method is called by the PluginManager (enforced by I_Plugin).
 boolean receiveReply(MsgInfo receiver, boolean udp)
          Handle connect/disconnect
 void sessionAdded(ClientEvent e)
          Implements I_ClientListener
 void sessionPreRemoved(ClientEvent e)
          Invoked before a client does a logout
 void sessionRemoved(ClientEvent e)
          Invoked when client does a logout
 void sessionUpdated(ClientEvent e)
          Invoked on successful client login
 void shutdown()
          Close the listener port, the driver shuts down.
 void subjectAdded(ClientEvent e)
          Invoked on first successful client login, when SubjectInfo is created
 void subjectRemoved(ClientEvent e)
          Invoked when client does its last logout
 java.lang.String usage()
          Command line usage.
 
Methods inherited from class org.xmlBlaster.util.protocol.email.EmailExecutor
createMessageId, getBcc, getCc, getDefaultResponseTimeout, getDefaultUpdateResponseTimeout, getEmailSessionId, getFrom, getLoopProtectionList, getLoopProtections, getMsgInfoParserClassName, getPop3Driver, getSecretSessionId, getSmtpClient, getTo, getUsageUrl, incomingMessage, init, isAlive, isLoopingMail, isShutdown, ping, removeFromLoopProtection, sendEmail, sendEmail, sendEmail, sendEmail, sendMessage, sendUpdateOneway, setBcc, setCc, setEmailSessionId, setEmailSessionId, setFrom, setSecretSessionId, setTo, setUsageUrl
 
Methods inherited from class org.xmlBlaster.util.protocol.RequestReplyExecutor
addResponseListener, clearResponseListenerMap, executeException, executeResponse, freePendingThreads, getAddressServer, getCbClient, getDefaultPingResponseTimeout, getExpiryTimestamp, getMinSizeForCompression, getPendingRequestList, getPingResponseTimeout, getProgressListener, getResponseListener, getResponseTimeout, getResponseTimeout, getResponseTimeout, getResponseTimeoutPropertyName, getUpdateResponseTimeout, getXmlBlasterCore, hasConnection, initialize, initializeCb, interruptInvocation, isCompressZlib, isCompressZlibStream, isShutdownCompletly, isUseEmailExpiryTimestamp, registerProgressListener, removeResponseListener, requestAndBlockForReply, setCbClient, setCompressZlib, setCompressZlibStream, setLoginName, setMinSizeForCompression, setPingResponseTimeout, setResponseTimeout, setUpdateResponseTimeout, setUseEmailExpiryTimestamp, setXmlBlasterCore
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xmlBlaster.util.protocol.RequestReplyExecutorMBean
getMinSizeForCompression, getPingResponseTimeout, getResponseTimeout, getResponseTimeout, getUpdateResponseTimeout, interruptInvocation, isCompressZlib, isCompressZlibStream, isUseEmailExpiryTimestamp, setCompressZlib, setCompressZlibStream, setMinSizeForCompression, setPingResponseTimeout, setResponseTimeout, setUpdateResponseTimeout, setUseEmailExpiryTimestamp
 

Field Detail

log

private static java.util.logging.Logger log

ME

private java.lang.String ME

glob

private Global glob

authenticate

private I_Authenticate authenticate
The singleton handle for this authentication server


xmlBlasterImpl

private I_XmlBlaster xmlBlasterImpl
The singleton handle for this xmlBlaster server


stripSecurityQosCDATA

private boolean stripSecurityQosCDATA
The address configuration


pluginInfo

private PluginInfo pluginInfo
Constructor Detail

EmailDriver

public EmailDriver()
Creates the driver. Note: getName() is enforced by interface I_Driver, but is already defined in Thread class

Method Detail

getProtocolId

public java.lang.String getProtocolId()
Access the xmlBlaster internal name of the protocol driver.

Specified by:
getProtocolId in interface I_Driver
Returns:
The configured [type] in xmlBlaster.properties, defaults to "email"

getType

public java.lang.String getType()
Enforced by I_Plugin

Specified by:
getType in interface I_AdminPlugin
Specified by:
getType in interface I_Plugin
Specified by:
getType in class RequestReplyExecutor
Returns:
The configured type in xmlBlaster.properties, defaults to "email"

getEnvPrefix

public java.lang.String getEnvPrefix()
The command line key prefix

Returns:
The configured type in xmlBlasterPlugins.xml, defaults to "plugin/email"

getVersion

public java.lang.String getVersion()
Enforced by I_Plugin

Specified by:
getVersion in interface I_AdminPlugin
Specified by:
getVersion in interface I_Plugin
Returns:
For example "1.0"

init

public void init(Global glob,
                 PluginInfo pluginInfo)
          throws XmlBlasterException
This method is called by the PluginManager (enforced by I_Plugin).

Specified by:
init in interface I_Plugin
Throws:
XmlBlasterException
See Also:
I_Plugin.init(org.xmlBlaster.util.Global,org.xmlBlaster.util.plugin.PluginInfo)

getRawAddress

public java.lang.String getRawAddress()
Get the address how to access this driver.

Specified by:
getRawAddress in interface I_Driver
Returns:
"server.mars.univers:6701"

getAuthenticate

I_Authenticate getAuthenticate()
Access the handle to the xmlBlaster authenication core


getXmlBlaster

I_XmlBlaster getXmlBlaster()
Access the handle to the xmlBlaster core


init

private void init(Global glob,
                  AddressServer addressServer,
                  I_Authenticate authenticate,
                  I_XmlBlaster xmlBlasterImpl)
           throws XmlBlasterException
Start xmlBlaster EMAIL access.

Enforced by interface I_Driver.
This method returns as soon as the listener email is alive and ready or on error.

Parameters:
glob - Global handle to access logging, property and commandline args
authenticate - Handle to access authentication server
xmlBlasterImpl - Handle to access xmlBlaster core
Throws:
XmlBlasterException

activate

public void activate()
              throws XmlBlasterException
Activate xmlBlaster access through this protocol.

Specified by:
activate in interface I_Driver
Throws:
XmlBlasterException

getEmailSessionId

public java.lang.String getEmailSessionId(MsgInfo msgInfo)
Overwrites EmailExecutor as we are a singleton handling different clients.

Overrides:
getEmailSessionId in class EmailExecutor
Parameters:
msgInfo -
Returns:

receiveReply

public final boolean receiveReply(MsgInfo receiver,
                                  boolean udp)
                           throws XmlBlasterException,
                                  java.io.IOException
Handle connect/disconnect

Overrides:
receiveReply in class RequestReplyExecutor
Returns:
false: for connect() and disconnect() which must be handled by the base class
Throws:
XmlBlasterException
java.io.IOException

deActivate

public void deActivate()
                throws XmlBlasterException
Deactivate xmlBlaster access (standby), no clients can connect.

Specified by:
deActivate in interface I_Driver
Throws:
XmlBlasterException

shutdown

public void shutdown()
Close the listener port, the driver shuts down.

Specified by:
shutdown in interface I_AdminPlugin
Specified by:
shutdown in interface I_Plugin
Overrides:
shutdown in class EmailExecutor

usage

public java.lang.String usage()
Command line usage.

Enforced by interface I_Driver.

Specified by:
usage in interface I_Driver
Specified by:
usage in interface I_AdminUsage
Overrides:
usage in class EmailExecutor
Returns:
a human readable usage help string

getName

public java.lang.String getName()
Description copied from interface: I_Driver
Get a human readable name of this driver

Specified by:
getName in interface I_Driver

sessionAdded

public void sessionAdded(ClientEvent e)
Implements I_ClientListener

Specified by:
sessionAdded in interface I_ClientListener

sessionUpdated

public void sessionUpdated(ClientEvent e)
Description copied from interface: I_ClientListener
Invoked on successful client login

Specified by:
sessionUpdated in interface I_ClientListener

subjectAdded

public void subjectAdded(ClientEvent e)
Description copied from interface: I_ClientListener
Invoked on first successful client login, when SubjectInfo is created

Specified by:
subjectAdded in interface I_ClientListener

sessionPreRemoved

public void sessionPreRemoved(ClientEvent e)
Description copied from interface: I_ClientListener
Invoked before a client does a logout

Specified by:
sessionPreRemoved in interface I_ClientListener

sessionRemoved

public void sessionRemoved(ClientEvent e)
Description copied from interface: I_ClientListener
Invoked when client does a logout

Specified by:
sessionRemoved in interface I_ClientListener

subjectRemoved

public void subjectRemoved(ClientEvent e)
Description copied from interface: I_ClientListener
Invoked when client does its last logout

Specified by:
subjectRemoved in interface I_ClientListener

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.