xmlBlaster 2.2.0 API

org.xmlBlaster.protocol.email
Class CallbackEmailDriver

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

public class CallbackEmailDriver
extends EmailExecutor
implements I_CallbackDriver

Sends a MsgUnitRaw back to a client using Email.

Activate the email callback driver in xmlBlaster.properies first, for example:

CbProtocolPlugin[email][1.0]=\
   org.xmlBlaster.protocol.email.CallbackEmailDriver,\
   mail.smtp.bcc=sniffer@localhost,\
   inlineExtension=*,\
   compress/minSize=200,\
   compress/type=zlib,\
   mail.subject=XmlBlaster generated mail,\
   parserClass=org.xmlBlaster.util.xbformat.XmlScriptParser
 
The parserClass is optional, the default message serialization is XbfParser.

Author:
xmlBlaster@marcelruff.info

Nested Class Summary
 
Nested classes/interfaces inherited from class org.xmlBlaster.util.protocol.email.EmailExecutor
EmailExecutor.LoopProtection
 
Field Summary
private  CallbackAddress callbackAddress
           
private static java.util.logging.Logger log
           
private  java.lang.String ME
           
private  PluginInfo pluginInfo
           
 
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, glob, mbeanHandle, minSizeForCompression, ONEWAY, pingResponseTimeout, prefix, progressListener, responseListenerMap, responseTimeout, updateResponseTimeout, useEmailExpiryTimestamp, WAIT_ON_RESPONSE
 
Constructor Summary
CallbackEmailDriver()
           
 
Method Summary
 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
 void init(Global glob, CallbackAddress callbackAddress)
          This init() is called after the init(Global, PluginInfo)
 void init(Global glob, PluginInfo pluginInfo)
          This method is called by the PluginManager (enforced by I_Plugin).
 boolean isAlive()
           
 java.lang.String ping(java.lang.String qos)
          Ping to check if callback server is alive.
 java.lang.String[] sendUpdate(MsgUnitRaw[] msgArr)
          This sends the update to the client.
 void sendUpdateOneway(MsgUnitRaw[] msgArr)
          The oneway variant, without return value.
 void shutdown()
          This method shuts down the driver.
 
Methods inherited from class org.xmlBlaster.util.protocol.email.EmailExecutor
createMessageId, getBcc, getCc, getDefaultResponseTimeout, getDefaultUpdateResponseTimeout, getEmailSessionId, getEmailSessionId, getFrom, getLoopProtectionList, getLoopProtections, getMsgInfoParserClassName, getPop3Driver, getSecretSessionId, getSmtpClient, getTo, getUsageUrl, incomingMessage, init, isLoopingMail, isShutdown, removeFromLoopProtection, sendEmail, sendEmail, sendEmail, sendEmail, sendMessage, setBcc, setCc, setEmailSessionId, setEmailSessionId, setFrom, setSecretSessionId, setTo, setUsageUrl, usage
 
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, receiveReply, 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.protocol.I_CallbackDriver
registerProgressListener
 
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

ME

private java.lang.String ME

log

private static java.util.logging.Logger log

callbackAddress

private CallbackAddress callbackAddress

pluginInfo

private PluginInfo pluginInfo
Constructor Detail

CallbackEmailDriver

public CallbackEmailDriver()
Method Detail

getName

public java.lang.String getName()
Get a human readable name of this driver

Specified by:
getName in interface I_CallbackDriver

getProtocolId

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

Specified by:
getProtocolId in interface I_CallbackDriver
Returns:
"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:
"SOCKET" or "EMAIL", never null

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"

getEnvPrefix

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

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

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_CallbackDriver
Returns:
null

init

public void init(Global glob,
                 CallbackAddress callbackAddress)
          throws XmlBlasterException
This init() is called after the init(Global, PluginInfo)

Specified by:
init in interface I_CallbackDriver
Parameters:
callbackAddress - Contains the email TO: address
Throws:
XmlBlasterException

sendUpdate

public java.lang.String[] sendUpdate(MsgUnitRaw[] msgArr)
                              throws XmlBlasterException
This sends the update to the client.

Specified by:
sendUpdate in interface I_CallbackDriver
Parameters:
msgArr - Array of all messages to send, is guaranteed to never be null
Returns:
Clients should return a qos as follows. An empty qos string "" is valid as well and interpreted as OK
  <qos>
     <state id='OK'/>  <!-- Client processing state OK | ERROR ... see Constants.java -->
  </qos>
 
Throws:
XmlBlasterException

sendUpdateOneway

public void sendUpdateOneway(MsgUnitRaw[] msgArr)
                      throws XmlBlasterException
The oneway variant, without return value.

Specified by:
sendUpdateOneway in interface I_CallbackDriver
Overrides:
sendUpdateOneway in class EmailExecutor
Parameters:
msgArr - Array of all messages to send, is guaranteed to never be null
Throws:
XmlBlasterException - Is never from the client (oneway).

ping

public java.lang.String ping(java.lang.String qos)
                      throws XmlBlasterException
Ping to check if callback server is alive. This ping checks the availability on the application level.

Specified by:
ping in interface I_CallbackDriver
Overrides:
ping in class EmailExecutor
Parameters:
qos -
Returns:
Constants.RET_OK or the remote ping return
Throws:
XmlBlasterException - If client not reachable
See Also:
org.xmlBlaster.protocol.I_XmlBlaster#ping(String)

shutdown

public void shutdown()
This method shuts down the driver.

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

isAlive

public boolean isAlive()
Specified by:
isAlive in interface I_CallbackDriver
Overrides:
isAlive in class EmailExecutor
Returns:
true if the plugin is still alive, false otherwise

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.