xmlBlaster 2.2.0 API

org.xmlBlaster.engine
Class EventPlugin

java.lang.Object
  extended by javax.management.NotificationBroadcasterSupport
      extended by org.xmlBlaster.engine.EventPlugin
All Implemented Interfaces:
java.lang.Comparable<java.lang.Object>, java.util.EventListener, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, I_ClientListener, I_ConnectionStateListener, EventPluginMBean, I_RemotePropertiesListener, I_SubscriptionListener, I_TopicListener, I_RunlevelListener, I_AdminPlugin, I_AdminService, I_AdminUsage, I_ConnectionStatusListener, I_EventDispatcher, I_LogListener, I_Plugin

public class EventPlugin
extends javax.management.NotificationBroadcasterSupport
implements I_Plugin, EventPluginMBean, I_ClientListener, I_RunlevelListener, I_LogListener, I_SubscriptionListener, I_TopicListener, I_ConnectionStatusListener, I_RemotePropertiesListener, I_EventDispatcher, I_ConnectionStateListener, java.lang.Comparable<java.lang.Object>

Registers for events from the xmlBlaster core and forwards them as configured.

This is useful for clients or administrators to be notified on certain core events.

This EventPlugin plugin is started with the run level manager as configured in xmlBlasterPlugins.xml, for example:

 lt;plugin id='EventPlugin' className='org.xmlBlaster.engine.EventPlugin'>
   <action do='LOAD' onStartupRunlevel='7' sequence='11'
                        onFail='resource.configuration.pluginFailed'/>
   <action do='STOP' onShutdownRunlevel='6' sequence='11'/>
   <attribute id='eventTypes'>
      logging/severe/*,
      logging/warning/*,
      service/RunlevelManager/event/startupRunlevel8,
      client/joe/session/1/event/connect
   </attribute>
   <attribute id='destination.smtp'>
      mail.smtp.from=xmlBlaster@localhost,
      mail.smtp.to=demo@localhost,
      mail.collectMillis=10000
   </attribute>
   <attribute id='destination.jmx'/>
 lt;/plugin>
 

In the above example an email is send if any logging/severe/* (==log/error) or logging/warning/* occurs. Further an event is emitted on xmlBlaster startup in run level 8 and if a new client logs in. Those events are send as JMX notifications as well. Adding <attribute id='destination.publish'/> would send the event as a xmlBlaster message as well, but take care to not send logging events as such messages will most certainly loop (if they log something they will trigger another message and so forth)!

List of supported event sources, note that this plugin must be active on a runlevel early enough depending on the event you want to capture:

logging/severe/* Captures all errors logged
logging/warning/* Captures all warnings logged
service/RunlevelManager/event/startupRunlevel9 Captures event when startup run level reaches 9 (RUNNING), any other runlevel is possible as well (note that this plugin must be active beforehand)
service/RunlevelManager/event/shutdownRunlevel8 Captures event when shutdown runlevel reaches 8 (RUNNING_RPE), any other run level is possible as well (note that this plugin must be active beforehand)
client/* /session/* /event/connect Captures event on client login (all clients)
client/[subjectId]/session/[publicSessionId]/event/connect Captures event on given client login, e.g. "client/joe/session/1/event/connect"
client/* /session/* /event/disconnect Captures event on client logout (all clients)
client/[subjectId]/session/[publicSessionId]/event/disconnect Captures event on given client logout, e.g. "client/joe/session/1/event/disconnect"
topic/* /event/subscribe Captures if subscribe() is invoked (on all topics)
topic/[topicId]/event/subscribe Captures if subscribe() on the specified topic is invoked
client/[subjectId]/session/[publicSessionId]/event/subscribe Captures if the given client has invoked subscribe(), e.g. "client/joe/session/1/event/subscribe". The publicSessionId can be a wildcard "*".
topic/* /event/unSubscribe Captures if unSubscribe() is invoked (on all topics)
topic/[topicId]/event/unSubscribe Captures if unSubscribe() on the specified topic is invoked
client/[subjectId]/session/[publicSessionId]/event/unSubscribe Captures if the given client has invoked unSubscribe(), e.g. "client/joe/session/1/event/unSubscribe". The publicSessionId can be a wildcard "*".
topic/* /event/alive Captures if a topic is created (on all topics)
topic/hello/event/alive Captures event if the topic 'hello' is created
topic/* /event/dead Captures if a topic is destroyed (on all topics)
topic/hello/event/dead Captures event if the topic 'hello' is destroyed
client/[subjectId]/session/[publicSessionId]/event/connectionState Captures event if the cluster client connection chages between ALIVE | POLLING | DEAD. Wildcards are supported.
client/[subjectId]/session/[publicSessionId]/event/callbackState Captures event if the client callback server goes to ALIVE or POLLING. Note that the status change to DEAD is currently not implemented (it is reported as POLLING). Wildcards are not supported.
heartbeat.360000 Sends a heartbeat notification every given milli seconds. Setting heartbeat defaults to one notification per day (86400000 millis).

List of supported event sinks:

destination.smtp Sends an email about the occurred event. Collects multiple events to one mail depending on configuration. You need to configure at least the email address parameters mail.stmp.from and mail.smtp.to and activate the SmtpClient plugin in xmlBlasterPlugins.xml. If you have a reasonable email provider you can configure it to forward the mail as an SMS (mine offers this feature).
destination.publish Publishes an xmlBlaster message which contains the occurred event, currently all messages are published into a topic named '__sys__Event'
destination.jmx Emits an JMX notification for the occurred event. Open 'jconsole' and 'MBeans->org.xmlBlaster->node->xxx->service->EventPlugin[yyy]' there choose the 'Notifications[0]' tabulator and click the 'Subscribe' button. Now you receive the configured events.

We access the xmlBlaster core directly to register the supported internal events, hence this plugin works only if it is in the same virtual machine (JVM) as the xmlBlaster server.

All events don't throw any exceptions as this plugin should have no influence on the regular work-flow of xmlBlaster.

Author:
Marcel Ruff
See Also:
The admin.events requirement

Field Summary
private  java.lang.String[] addClientProperties
           
protected  java.util.Set<java.lang.String> callbackSessionStateSet
           
protected  java.util.Set<java.lang.String> clientSet
           
private  ContextNode contextNode
           
protected  EmailData currentEmailData
           
protected  ServerScope engineGlob
           
protected  java.lang.String eventTypes
           
protected  ExecHelper execHelper
           
protected  Global glob
           
protected  long heartbeatInterval
           
protected  Timeout heartbeatTimeout
           
protected  Timestamp heartbeatTimeoutHandle
           
protected  int instanceCounter
           
protected  boolean isActive
           
protected  boolean isShutdown
           
protected  java.lang.String jmxDestinationConfiguration
           
protected  JmxDestinationHelper jmxDestinationHelper
           
private  long lastMillisLog_LoopProtection
           
private static java.util.logging.Logger log
           
protected  java.util.Set<java.lang.String> loggingSet
           
protected  long logInfinitLoopSuppressDelayMillis
           
private  java.lang.Object mbeanHandle
          My JMX registration
private static java.lang.String ME
           
protected  java.util.Set<java.lang.String> pendingCallbackSessionInfoSet
           
protected  I_PluginConfig pluginConfig
           
protected  java.lang.String publishDestinationConfiguration
           
protected  PublishDestinationHelper publishDestinationHelper
           
protected  RequestBroker requestBroker
           
protected  java.util.Set<java.lang.String> runlevelSet
           
protected  SessionInfo sessionInfo
           
protected  SmtpClient smtpClient
           
protected  java.lang.String smtpDestinationConfiguration
           
protected  SmtpDestinationHelper smtpDestinationHelper
           
protected  java.lang.Object smtpDestinationMonitor
           
protected  Timeout smtpTimeout
           
protected  Timestamp smtpTimeoutHandle
           
protected static int staticInstanceCounter
           
protected  java.util.Set<java.lang.String> topicSet
           
private  java.lang.String uniqueInstanceName
           
 
Fields inherited from interface org.xmlBlaster.engine.I_SubscriptionListener
PRIO_01, PRIO_05, PRIO_10
 
Constructor Summary
EventPlugin()
           
 
Method Summary
 void activate()
          Activate this service
protected  void callbackStateChange(I_DispatchManager dispatchManager, ConnectionStateEnum oldState, ConnectionStateEnum newState)
           
 void changed(TopicEvent topicEvent)
          Invoked on topic lifecycle change.
 int clearPendingEmails()
          JMX
 int compareTo(java.lang.Object obj)
           
protected  void connectionStateChange(I_XmlBlasterAccess connection, ConnectionStateEnum oldState, ConnectionStateEnum newState)
           
static java.lang.String createStatusDump(ServerScope g, java.lang.String summary, java.lang.String description, java.lang.String eventType, java.lang.String errorCode)
          Create an XML xmlBlaster dump which contains the most important status informations.
 void deActivate()
          Deactivate the service to standby.
 void dispatchEvent(java.lang.String summary, java.lang.String description, java.lang.String eventType)
          Enforced by I_EventDispatcher, notifies about I_Storage changes.
protected  void doExec(java.lang.String summary, java.lang.String description, java.lang.String eventType, java.lang.String errorCode, SessionName sessionName)
           
 java.lang.String dumpPendingEmails()
          JMX
 boolean equals(java.lang.Object obj)
           
 java.lang.String getEventTypes()
          The comma separated list of active events.
 java.lang.String getExecConfiguration()
          JMX
 int getInstanceCounter()
           
 java.lang.String getJmxDestinationConfiguration()
          JMX
 long getMailCollectMillis()
          How long to collect outgoing emails?
 java.lang.String getName()
          A human readable name of the listener for logging.
 int getNumOfPendingEmails()
          JMX
 I_PluginConfig getPluginConfig()
           
 java.lang.Integer getPriority()
          The priority by which it will be invoked.
 java.lang.String getPublishDestinationConfiguration()
          JMX
 ServerScope getServerScope()
           
 SmtpClient getSmtpClient()
          TODO: Put into engine.Global and util.Global (see EmailExecutor.java)
 java.lang.String getSmtpDestinationConfiguration()
          Configuration properties of the email sink.
 java.lang.String getType()
          The unique name of the plugin (together with the version).
 java.lang.String getUniqueInstanceName()
           
 java.lang.String getUsageUrl()
           
 java.lang.String getVersion()
          The version of the plugin
 void init(Global utilGlob, PluginInfo pluginInfo)
          Initializes the plugin
 boolean isActive()
          Access the current state
static boolean isCallbackStateEvent(java.lang.String txt)
           
static boolean isConnectionQueueEvent(java.lang.String txt)
           
static boolean isConnectionStateEvent(java.lang.String txt)
          Cluster client side (ClusterNode.java)
static boolean isPersistenceEvent(java.lang.String txt)
           
static boolean isQueueEvent(java.lang.String txt)
           
 boolean isShutdown()
          Check status
 boolean isWildcard(java.lang.String pattern)
           
 void log(java.util.logging.LogRecord record)
          Redirect logging.
private static boolean matchesRegex(java.lang.String pattern, java.lang.String txt)
           
protected  void newHeartbeatNotification(java.lang.String eventType)
          Send a heartbeat message/notification.
 void reachedAlive(ConnectionStateEnum oldState, I_XmlBlasterAccess connection)
          This is the callback method invoked from I_XmlBlasterAccess for cluster client connections "client/heron/session/1/event/connectionState"

This method is enforced through interface I_ConnectionStateListener

 void reachedAliveSync(ConnectionStateEnum oldState, I_XmlBlasterAccess connection)
          Invoked when the dispatcher goes to synch again after having delivered entries which where in the queue when the state changed to ALIVE.
 void reachedDead(ConnectionStateEnum oldState, I_XmlBlasterAccess connection)
          This is the callback method invoked from I_XmlBlasterAccess informing the client in an asynchronous mode if the connection was lost.
 void reachedPolling(ConnectionStateEnum oldState, I_XmlBlasterAccess connection)
          This is the callback method invoked from I_XmlBlasterAccess informing the client in an asynchronous mode if the connection was lost.
private  void registerEventTypes(java.lang.String eventTypes)
          Find out which events to listen.
 java.lang.String replaceTokens(java.lang.String str, java.lang.String summary, java.lang.String description, java.lang.String eventType, java.lang.String errorCode, SessionName sessionName)
          Replace some $_{} tokens.
private  java.lang.String replaceVariable(ClientPropertiesInfo clientPropertiesInfo, java.lang.String value)
           
 void runlevelChange(int from, int to, boolean force)
          Invoked on run level change, see for example RunlevelManager.RUNLEVEL_HALTED and RunlevelManager.RUNLEVEL_RUNNING
protected  void sendEmail(java.lang.String summary, java.lang.String description, java.lang.String eventType, java.lang.String errorCode, SessionName sessionName, boolean forceSending, ClientPropertiesInfo clientPropertiesInfo)
          Sending email as configured with destination.smtp.
protected  void sendJmxNotification(java.lang.String summary, java.lang.String description, java.lang.String eventType, java.lang.String errorCode, boolean forceSending)
          The xmlBlaster-JMX notification data sink.
protected  void sendMessage(java.lang.String summary, java.lang.String description, java.lang.String eventType, java.lang.String errorCode, SessionName sessionName, ClientProperty[] clientProperties)
          The xmlBlaster-message data sink.
 java.lang.String sendPendingEmails()
          JMX
 java.lang.String sendTestEmail()
          JMX
 void sessionAdded(ClientEvent clientEvent)
          Invoked on successful client login
 void sessionPreRemoved(ClientEvent clientEvent)
          Invoked before a client does a logout
 void sessionRemoved(ClientEvent clientEvent)
          Invoked when client does a logout
 void sessionUpdated(ClientEvent e)
          Invoked on successful client re-login (interface I_ClientListener)
 void setEventTypes(java.lang.String eventTypes)
          A comma separated list of active events.
 void setJmxDestinationConfiguration(java.lang.String jmxDestinationConfiguration)
           
 void setMailCollectMillis(long mailCollectMillis)
           
 void setPublishDestinationConfiguration(java.lang.String publishDestinationConfiguration)
           
 void setSmtpDestinationConfiguration(java.lang.String smtpDestinationConfiguration)
          Configuration properties of the email sink.
 void setupSmtpSink(java.lang.String destination)
          Initialize email sending.
 void setUsageUrl(java.lang.String url)
           
 void shutdown()
          Shutdown the plugin
 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
 void subscriptionAdd(SubscriptionEvent subscriptionEvent)
          Invoked on successful subscription login
 void subscriptionRemove(SubscriptionEvent subscriptionEvent)
          Invoked when subscription does a logout
 void toAlive(I_DispatchManager dispatchManager, ConnectionStateEnum oldState)
           
 void toAliveSync(I_DispatchManager dispatchManager, ConnectionStateEnum oldState)
           
 void toDead(I_DispatchManager dispatchManager, ConnectionStateEnum oldState, XmlBlasterException xmlBlasterException)
           
 void toPolling(I_DispatchManager dispatchManager, ConnectionStateEnum oldState)
           
 java.lang.String triggerHeartbeatNotification()
          Manually trigger a heart beat message.
 java.lang.String triggerTestLogSevere()
          Triggers a log.severe to test the configuration.
 java.lang.String triggerTestLogWarning()
          Triggers a log.warning to test the configuration.
 void update(SessionInfo sessionInfo, java.util.Map remoteProperties)
          Called when a client sends his remote properties, for example client side errors.
 java.lang.String usage()
           
 void verifyInternetAddress(java.lang.String address)
          Check string addresses if they have valid email syntax.
 boolean wildcardMatch(long pattern, long pubSessionId)
          SessionName.java parsed "client/joe/session/*" to pubSessionId=Long.MIN_VALUE
 boolean wildcardMatch(java.lang.String pattern, java.lang.String name)
           
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ME

private static final java.lang.String ME

log

private static java.util.logging.Logger log

mbeanHandle

private java.lang.Object mbeanHandle
My JMX registration


contextNode

private ContextNode contextNode

glob

protected Global glob

pluginConfig

protected I_PluginConfig pluginConfig

engineGlob

protected ServerScope engineGlob

requestBroker

protected RequestBroker requestBroker

sessionInfo

protected SessionInfo sessionInfo

isActive

protected boolean isActive

isShutdown

protected boolean isShutdown

eventTypes

protected java.lang.String eventTypes

loggingSet

protected java.util.Set<java.lang.String> loggingSet

runlevelSet

protected java.util.Set<java.lang.String> runlevelSet

clientSet

protected java.util.Set<java.lang.String> clientSet

topicSet

protected java.util.Set<java.lang.String> topicSet

pendingCallbackSessionInfoSet

protected java.util.Set<java.lang.String> pendingCallbackSessionInfoSet

callbackSessionStateSet

protected java.util.Set<java.lang.String> callbackSessionStateSet

staticInstanceCounter

protected static int staticInstanceCounter

instanceCounter

protected int instanceCounter

uniqueInstanceName

private java.lang.String uniqueInstanceName

addClientProperties

private java.lang.String[] addClientProperties

smtpClient

protected SmtpClient smtpClient

smtpDestinationMonitor

protected final java.lang.Object smtpDestinationMonitor

smtpDestinationHelper

protected SmtpDestinationHelper smtpDestinationHelper

smtpDestinationConfiguration

protected java.lang.String smtpDestinationConfiguration

smtpTimeout

protected Timeout smtpTimeout

smtpTimeoutHandle

protected Timestamp smtpTimeoutHandle

currentEmailData

protected EmailData currentEmailData

heartbeatInterval

protected long heartbeatInterval

heartbeatTimeout

protected Timeout heartbeatTimeout

heartbeatTimeoutHandle

protected Timestamp heartbeatTimeoutHandle

publishDestinationHelper

protected PublishDestinationHelper publishDestinationHelper

publishDestinationConfiguration

protected java.lang.String publishDestinationConfiguration

jmxDestinationHelper

protected JmxDestinationHelper jmxDestinationHelper

jmxDestinationConfiguration

protected java.lang.String jmxDestinationConfiguration

execHelper

protected ExecHelper execHelper

logInfinitLoopSuppressDelayMillis

protected long logInfinitLoopSuppressDelayMillis

lastMillisLog_LoopProtection

private long lastMillisLog_LoopProtection
Constructor Detail

EventPlugin

public EventPlugin()
Method Detail

getServerScope

public ServerScope getServerScope()

init

public void init(Global utilGlob,
                 PluginInfo pluginInfo)
          throws XmlBlasterException
Initializes the plugin

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

registerEventTypes

private void registerEventTypes(java.lang.String eventTypes)
                         throws XmlBlasterException
Find out which events to listen.

Parameters:
eventTypes - A commas seperated list of supported events, e.g. logging/severe/*,logging/warning/*
Throws:
XmlBlasterException

isQueueEvent

public static boolean isQueueEvent(java.lang.String txt)

isConnectionQueueEvent

public static boolean isConnectionQueueEvent(java.lang.String txt)

isPersistenceEvent

public static boolean isPersistenceEvent(java.lang.String txt)

isCallbackStateEvent

public static boolean isCallbackStateEvent(java.lang.String txt)

isConnectionStateEvent

public static boolean isConnectionStateEvent(java.lang.String txt)
Cluster client side (ClusterNode.java)


isWildcard

public final boolean isWildcard(java.lang.String pattern)

wildcardMatch

public final boolean wildcardMatch(java.lang.String pattern,
                                   java.lang.String name)

wildcardMatch

public final boolean wildcardMatch(long pattern,
                                   long pubSessionId)
SessionName.java parsed "client/joe/session/*" to pubSessionId=Long.MIN_VALUE


matchesRegex

private static boolean matchesRegex(java.lang.String pattern,
                                    java.lang.String txt)

update

public void update(SessionInfo sessionInfo,
                   java.util.Map remoteProperties)
Called when a client sends his remote properties, for example client side errors. eventType == client/* /session/* /event/remoteProperties Enforced by I_RemotePropertiesListener

Specified by:
update in interface I_RemotePropertiesListener
Parameters:
sessionInfo - The client sending the properties, the remoteProperties are added to this sessionInfo already
remoteProperties - Key is a string, value is of type ClientProperties

newHeartbeatNotification

protected void newHeartbeatNotification(java.lang.String eventType)
Send a heartbeat message/notification. Called by timeout or by manual trigger (e.g. over jconsole)

Parameters:
eventType -

triggerHeartbeatNotification

public java.lang.String triggerHeartbeatNotification()
Description copied from interface: EventPluginMBean
Manually trigger a heart beat message.

Specified by:
triggerHeartbeatNotification in interface EventPluginMBean
Returns:
Success text

createStatusDump

public static java.lang.String createStatusDump(ServerScope g,
                                                java.lang.String summary,
                                                java.lang.String description,
                                                java.lang.String eventType,
                                                java.lang.String errorCode)
Create an XML xmlBlaster dump which contains the most important status informations. Follows the admin.commands markup (without the root tag <xmlBlaster>

Parameters:
g - The global of the running server instance
Returns:
The XML dump
See Also:
The admin.commands requirement

setupSmtpSink

public void setupSmtpSink(java.lang.String destination)
                   throws XmlBlasterException
Initialize email sending.

Parameters:
destination - The configuration string, a comma separated list of key/value properties, e.g. mail.smtp.from=xmlBlaster@localhost,mail.smtp.to=demo@localhost,mail.collectMillis=10000
Throws:
XmlBlasterException

replaceTokens

public java.lang.String replaceTokens(java.lang.String str,
                                      java.lang.String summary,
                                      java.lang.String description,
                                      java.lang.String eventType,
                                      java.lang.String errorCode,
                                      SessionName sessionName)
Replace some $_{} tokens.

Parameters:
str - The string to check and replace
summary - The value for a $_{summary}, can be null
description - The value for a $_{description}, can be null
eventType - The value for a $_{eventType}, can be null
errorCode - The value for a $_{errorCode}, can be null
sessionName - TODO
Returns:
Resolved string

getType

public java.lang.String getType()
Description copied from interface: I_AdminPlugin
The unique name of the plugin (together with the version).

Specified by:
getType in interface I_AdminPlugin
Specified by:
getType in interface I_Plugin
Returns:
the plugin type, defaults to "EventPlugin"
See Also:
I_Plugin.getType()

getVersion

public java.lang.String getVersion()
Description copied from interface: I_AdminPlugin
The version of the plugin

Specified by:
getVersion in interface I_AdminPlugin
Specified by:
getVersion in interface I_Plugin
Returns:
the plugin version, defaults to "1.0"
See Also:
I_Plugin.getVersion()

shutdown

public void shutdown()
              throws XmlBlasterException
Shutdown the plugin

Specified by:
shutdown in interface I_AdminPlugin
Specified by:
shutdown in interface I_Plugin
Throws:
XmlBlasterException - if an exception occurs. The exception is handled by the RunLevelManager depending on how the plugin has been configured with the action:

<action do='STOP' onShutdownRunlevel='2' sequence='5' onFail='resource.configuration.pluginFailed'> If onFail is defined to something, the RunLevelManager will stop.

See Also:
I_Plugin.shutdown()

getSmtpClient

public SmtpClient getSmtpClient()
                         throws XmlBlasterException
TODO: Put into engine.Global and util.Global (see EmailExecutor.java)

Returns:
Throws:
XmlBlasterException

log

public void log(java.util.logging.LogRecord record)
Redirect logging.

Specified by:
log in interface I_LogListener
See Also:
I_LogListener.log(LogRecord)

sendJmxNotification

protected void sendJmxNotification(java.lang.String summary,
                                   java.lang.String description,
                                   java.lang.String eventType,
                                   java.lang.String errorCode,
                                   boolean forceSending)
The xmlBlaster-JMX notification data sink. Sends a JMX notification with the current event occurred.

Open jconsole and from the menue 'MBeans->org.xmlBlaster->node->xxx->service->EventPlugin[yyy]', there choose the 'Notifications[0]' tabulator and click the 'Subscribe' button. Now you receive the configured events.

See Also:
{

sendMessage

protected void sendMessage(java.lang.String summary,
                           java.lang.String description,
                           java.lang.String eventType,
                           java.lang.String errorCode,
                           SessionName sessionName,
                           ClientProperty[] clientProperties)
The xmlBlaster-message data sink. Publishes a message with the current event occurred.

Parameters:
clientProperties - Can be null
useEventTypeAsContent -
See Also:
{

doExec

protected void doExec(java.lang.String summary,
                      java.lang.String description,
                      java.lang.String eventType,
                      java.lang.String errorCode,
                      SessionName sessionName)

replaceVariable

private java.lang.String replaceVariable(ClientPropertiesInfo clientPropertiesInfo,
                                         java.lang.String value)

sendEmail

protected void sendEmail(java.lang.String summary,
                         java.lang.String description,
                         java.lang.String eventType,
                         java.lang.String errorCode,
                         SessionName sessionName,
                         boolean forceSending,
                         ClientPropertiesInfo clientPropertiesInfo)
Sending email as configured with destination.smtp.

Parameters:
summary - The email summary line to use, it is injected to the template as $_{summary}
description - The event description to send, it is injected as $_{description}
eventType - For example "logging/severe/*"
sessionName - TODO
forceSending - If true send directly and ignore the timeout
clientPropertiesInfo - TODO
See Also:
http://www.faqs.org/rfcs/rfc2822.html

getName

public java.lang.String getName()
Description copied from interface: I_RunlevelListener
A human readable name of the listener for logging.

Specified by:
getName in interface I_RunlevelListener

runlevelChange

public void runlevelChange(int from,
                           int to,
                           boolean force)
Description copied from interface: I_RunlevelListener
Invoked on run level change, see for example RunlevelManager.RUNLEVEL_HALTED and RunlevelManager.RUNLEVEL_RUNNING

Specified by:
runlevelChange in interface I_RunlevelListener
Parameters:
from - The current runlevel
to - The runlevel we want to switch to
force - If true force the change even if messages are lost

dispatchEvent

public void dispatchEvent(java.lang.String summary,
                          java.lang.String description,
                          java.lang.String eventType)
Enforced by I_EventDispatcher, notifies about I_Storage changes.

Specified by:
dispatchEvent in interface I_EventDispatcher
Parameters:
summary -
description -
eventType -

sessionAdded

public void sessionAdded(ClientEvent clientEvent)
                  throws XmlBlasterException
Description copied from interface: I_ClientListener
Invoked on successful client login

Specified by:
sessionAdded in interface I_ClientListener
Throws:
XmlBlasterException

sessionUpdated

public void sessionUpdated(ClientEvent e)
                    throws XmlBlasterException
Invoked on successful client re-login (interface I_ClientListener)

Specified by:
sessionUpdated in interface I_ClientListener
Throws:
XmlBlasterException

sessionPreRemoved

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

Specified by:
sessionPreRemoved in interface I_ClientListener
Throws:
XmlBlasterException

sessionRemoved

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

Specified by:
sessionRemoved in interface I_ClientListener
Throws:
XmlBlasterException

subjectAdded

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

Specified by:
subjectAdded in interface I_ClientListener
Throws:
XmlBlasterException

subjectRemoved

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

Specified by:
subjectRemoved in interface I_ClientListener
Throws:
XmlBlasterException

verifyInternetAddress

public void verifyInternetAddress(java.lang.String address)
                           throws XmlBlasterException
Check string addresses if they have valid email syntax.

Parameters:
address - Can be a comma separated list of email addresses
Throws:
XmlBlasterException - If one of the addresses has invalid syntax

sendTestEmail

public java.lang.String sendTestEmail()
JMX

Specified by:
sendTestEmail in interface EventPluginMBean
Returns:
A comment about the send mail

dumpPendingEmails

public java.lang.String dumpPendingEmails()
JMX

Specified by:
dumpPendingEmails in interface EventPluginMBean
Returns:
The XML dump of the pending emails.

clearPendingEmails

public int clearPendingEmails()
JMX

Specified by:
clearPendingEmails in interface EventPluginMBean
Returns:
Number of removed emails, usually 1 as all events are collected to one mail

getNumOfPendingEmails

public int getNumOfPendingEmails()
JMX

Specified by:
getNumOfPendingEmails in interface EventPluginMBean

sendPendingEmails

public java.lang.String sendPendingEmails()
JMX

Specified by:
sendPendingEmails in interface EventPluginMBean
Returns:
Comment about send emails, usually all events are collected to one mail

activate

public void activate()
              throws java.lang.Exception
Description copied from interface: I_AdminService
Activate this service

Specified by:
activate in interface I_AdminService
Throws:
java.lang.Exception

deActivate

public void deActivate()
Description copied from interface: I_AdminService
Deactivate the service to standby. A call to activate() fires the service up again

Specified by:
deActivate in interface I_AdminService

isActive

public boolean isActive()
Description copied from interface: I_AdminService
Access the current state

Specified by:
isActive in interface I_AdminService
Returns:
true if active

isShutdown

public boolean isShutdown()
Description copied from interface: I_AdminPlugin
Check status

Specified by:
isShutdown in interface I_AdminPlugin
Returns:
true if down

usage

public java.lang.String usage()
Specified by:
usage in interface I_AdminUsage
Returns:
a human readable usage help string

getUsageUrl

public java.lang.String getUsageUrl()
Specified by:
getUsageUrl in interface I_AdminUsage
Returns:
A link on javadoc for JMX usage

setUsageUrl

public void setUsageUrl(java.lang.String url)
Specified by:
setUsageUrl in interface I_AdminUsage

getMailCollectMillis

public long getMailCollectMillis()
How long to collect outgoing emails?

Specified by:
getMailCollectMillis in interface EventPluginMBean
Returns:
Returns the mailCollectMillis or -1 if no email sink is configured

setMailCollectMillis

public void setMailCollectMillis(long mailCollectMillis)
Specified by:
setMailCollectMillis in interface EventPluginMBean
Parameters:
mailCollectMillis - The mailCollectMillis to set.

getEventTypes

public java.lang.String getEventTypes()
Description copied from interface: EventPluginMBean
The comma separated list of active events.

Specified by:
getEventTypes in interface EventPluginMBean
Returns:
Returns the eventTypes.

setEventTypes

public void setEventTypes(java.lang.String eventTypes)
Description copied from interface: EventPluginMBean
A comma separated list of active events.

Specified by:
setEventTypes in interface EventPluginMBean
Parameters:
eventTypes - The eventTypes to set.

getSmtpDestinationConfiguration

public java.lang.String getSmtpDestinationConfiguration()
Description copied from interface: EventPluginMBean
Configuration properties of the email sink.

Specified by:
getSmtpDestinationConfiguration in interface EventPluginMBean
Returns:
Returns the smtpDestinationConfiguration.

setSmtpDestinationConfiguration

public void setSmtpDestinationConfiguration(java.lang.String smtpDestinationConfiguration)
Description copied from interface: EventPluginMBean
Configuration properties of the email sink.

Specified by:
setSmtpDestinationConfiguration in interface EventPluginMBean
Parameters:
smtpDestinationConfiguration - The smtpDestinationConfiguration to set.

getPriority

public java.lang.Integer getPriority()
Description copied from interface: I_SubscriptionListener
The priority by which it will be invoked. Lower numbers are invoked first on subscribe and last on unsubscribe.

Specified by:
getPriority in interface I_SubscriptionListener
Returns:

subscriptionAdd

public void subscriptionAdd(SubscriptionEvent subscriptionEvent)
                     throws XmlBlasterException
Description copied from interface: I_SubscriptionListener
Invoked on successful subscription login

Specified by:
subscriptionAdd in interface I_SubscriptionListener
Throws:
XmlBlasterException

subscriptionRemove

public void subscriptionRemove(SubscriptionEvent subscriptionEvent)
                        throws XmlBlasterException
Description copied from interface: I_SubscriptionListener
Invoked when subscription does a logout

Specified by:
subscriptionRemove in interface I_SubscriptionListener
Throws:
XmlBlasterException

triggerTestLogSevere

public java.lang.String triggerTestLogSevere()
Description copied from interface: EventPluginMBean
Triggers a log.severe to test the configuration.

Specified by:
triggerTestLogSevere in interface EventPluginMBean
Returns:
A comment about the test

triggerTestLogWarning

public java.lang.String triggerTestLogWarning()
Description copied from interface: EventPluginMBean
Triggers a log.warning to test the configuration.

Specified by:
triggerTestLogWarning in interface EventPluginMBean
Returns:
A comment about the test

changed

public void changed(TopicEvent topicEvent)
             throws XmlBlasterException
Description copied from interface: I_TopicListener
Invoked on topic lifecycle change.

Specified by:
changed in interface I_TopicListener
Throws:
XmlBlasterException

compareTo

public int compareTo(java.lang.Object obj)
Specified by:
compareTo in interface java.lang.Comparable<java.lang.Object>

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getInstanceCounter

public int getInstanceCounter()
Returns:
Returns the instanceCounter.

callbackStateChange

protected void callbackStateChange(I_DispatchManager dispatchManager,
                                   ConnectionStateEnum oldState,
                                   ConnectionStateEnum newState)

connectionStateChange

protected void connectionStateChange(I_XmlBlasterAccess connection,
                                     ConnectionStateEnum oldState,
                                     ConnectionStateEnum newState)

toAlive

public void toAlive(I_DispatchManager dispatchManager,
                    ConnectionStateEnum oldState)
Specified by:
toAlive in interface I_ConnectionStatusListener

toAliveSync

public void toAliveSync(I_DispatchManager dispatchManager,
                        ConnectionStateEnum oldState)
Specified by:
toAliveSync in interface I_ConnectionStatusListener

toPolling

public void toPolling(I_DispatchManager dispatchManager,
                      ConnectionStateEnum oldState)
Specified by:
toPolling in interface I_ConnectionStatusListener

toDead

public void toDead(I_DispatchManager dispatchManager,
                   ConnectionStateEnum oldState,
                   XmlBlasterException xmlBlasterException)
Specified by:
toDead in interface I_ConnectionStatusListener
xmlBlasterException - Can be null

getJmxDestinationConfiguration

public java.lang.String getJmxDestinationConfiguration()
JMX

Specified by:
getJmxDestinationConfiguration in interface EventPluginMBean
Returns:
Returns the jmxDestinationConfiguration.

getPublishDestinationConfiguration

public java.lang.String getPublishDestinationConfiguration()
JMX

Specified by:
getPublishDestinationConfiguration in interface EventPluginMBean
Returns:
Returns the publishDestinationConfiguration.

getExecConfiguration

public java.lang.String getExecConfiguration()
JMX

Returns:
Returns the destination.exec configuration.

setJmxDestinationConfiguration

public void setJmxDestinationConfiguration(java.lang.String jmxDestinationConfiguration)
Parameters:
jmxDestinationConfiguration - The jmxDestinationConfiguration to set.

setPublishDestinationConfiguration

public void setPublishDestinationConfiguration(java.lang.String publishDestinationConfiguration)
Parameters:
publishDestinationConfiguration - The publishDestinationConfiguration to set.

reachedAlive

public void reachedAlive(ConnectionStateEnum oldState,
                         I_XmlBlasterAccess connection)
This is the callback method invoked from I_XmlBlasterAccess for cluster client connections "client/heron/session/1/event/connectionState"

This method is enforced through interface I_ConnectionStateListener

Specified by:
reachedAlive in interface I_ConnectionStateListener
Parameters:
oldState - The previous state of the connection.

reachedAliveSync

public void reachedAliveSync(ConnectionStateEnum oldState,
                             I_XmlBlasterAccess connection)
Description copied from interface: I_ConnectionStateListener
Invoked when the dispatcher goes to synch again after having delivered entries which where in the queue when the state changed to ALIVE. Note that this could take some time or in the worst case it could never been invoked if the queue is never completely processed.

Specified by:
reachedAliveSync in interface I_ConnectionStateListener
Parameters:
oldState - is always ALIVE.

reachedPolling

public void reachedPolling(ConnectionStateEnum oldState,
                           I_XmlBlasterAccess connection)
This is the callback method invoked from I_XmlBlasterAccess informing the client in an asynchronous mode if the connection was lost. For cluster client connections

This method is enforced through interface I_ConnectionStateListener

Specified by:
reachedPolling in interface I_ConnectionStateListener
Parameters:
oldState - The previous state of the connection.

reachedDead

public void reachedDead(ConnectionStateEnum oldState,
                        I_XmlBlasterAccess connection)
This is the callback method invoked from I_XmlBlasterAccess informing the client in an asynchronous mode if the connection was lost. For cluster client connections

This method is enforced through interface I_ConnectionStateListener

Specified by:
reachedDead in interface I_ConnectionStateListener
Parameters:
oldState - The previous state of the connection.

getUniqueInstanceName

public java.lang.String getUniqueInstanceName()

getPluginConfig

public I_PluginConfig getPluginConfig()

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.