xmlBlaster 2.2.0 API

org.xmlBlaster.engine
Class SessionPersistencePlugin

java.lang.Object
  extended by org.xmlBlaster.engine.SessionPersistencePlugin
All Implemented Interfaces:
java.util.EventListener, I_ClientListener, I_SessionPersistencePlugin, I_SubscriptionListener, I_Plugin

public class SessionPersistencePlugin
extends java.lang.Object
implements I_SessionPersistencePlugin

SessionPersistencePlugin provides the persistent storage for both sessions and subscriptions.

Author:
Michele Laghi

Field Summary
private  AddressServer addressServer
           
private  int duplicateCounter
           
private  int errorCounter
           
private  ServerScope global
           
private  PluginInfo info
           
private  boolean isOK
          flag indicating the status: true means initialized and not yet shut down)
private static java.util.logging.Logger log
           
private static java.lang.String ME
           
private static java.lang.String ORIGINAL_INITIAL_UPDATES
          when recovering all subscriptions must be 'noInitialUpdate' because otherwise we would get messages which we already got in the past
private  StorageId sessionStorageId
           
private  I_Map sessionStore
           
private  StorageId subscribeStorageId
           
private  I_Map subscribeStore
           
private  java.lang.Object sync
           
 
Fields inherited from interface org.xmlBlaster.engine.I_SessionPersistencePlugin
ID
 
Fields inherited from interface org.xmlBlaster.engine.I_SubscriptionListener
PRIO_01, PRIO_05, PRIO_10
 
Constructor Summary
SessionPersistencePlugin()
           
 
Method Summary
private  void addOrUpdateSession(SessionInfo sessionInfo)
          A new session is added, checks if it shall be persisted.
 java.lang.Integer getPriority()
          The priority by which it will be invoked.
 java.lang.String getType()
          returns the plugin type
 java.lang.String getVersion()
          returns the plugin version
 void init(Global glob, PluginInfo pluginInfo)
          Initializes the plugin
private  java.util.HashMap recoverSessions()
           
private  void recoverSubscriptions(java.util.HashMap sessionIds)
          When recovering due to a run level change (without shutting down the application) this will not work.
private  void removeAssociatedSubscriptions(SessionInfo sessionInfo)
           
 boolean removeSession(long uniqueId, ConnectQosData connectQosData)
           
 void sessionAdded(ClientEvent e)
          Invoked on successful client login
 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 re-login (interface I_ClientListener)
 void shutdown()
          Shutsdown the plugin
 void subjectAdded(ClientEvent e)
          does nothing
 void subjectRemoved(ClientEvent e)
          does nothing
 void subscriptionAdd(SubscriptionEvent e)
          This event is invoked even by child subscriptions.
 void subscriptionRemove(SubscriptionEvent e)
          Invoked when subscription does a logout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ME

private static final java.lang.String ME
See Also:
Constant Field Values

ORIGINAL_INITIAL_UPDATES

private static final java.lang.String ORIGINAL_INITIAL_UPDATES
when recovering all subscriptions must be 'noInitialUpdate' because otherwise we would get messages which we already got in the past

See Also:
Constant Field Values

info

private PluginInfo info

global

private ServerScope global

log

private static java.util.logging.Logger log

isOK

private boolean isOK
flag indicating the status: true means initialized and not yet shut down)


sessionStore

private I_Map sessionStore

subscribeStore

private I_Map subscribeStore

sessionStorageId

private StorageId sessionStorageId

subscribeStorageId

private StorageId subscribeStorageId

addressServer

private AddressServer addressServer

sync

private java.lang.Object sync

duplicateCounter

private int duplicateCounter

errorCounter

private int errorCounter
Constructor Detail

SessionPersistencePlugin

public SessionPersistencePlugin()
Method Detail

recoverSessions

private java.util.HashMap recoverSessions()
                                   throws XmlBlasterException
Returns:
hash map containing the secret sessionId of the entries recovered as values and as keys the corresponding absolute name for the session (String)
Throws:
XmlBlasterException

recoverSubscriptions

private void recoverSubscriptions(java.util.HashMap sessionIds)
                           throws XmlBlasterException
When recovering due to a run level change (without shutting down the application) this will not work.

Throws:
XmlBlasterException

removeAssociatedSubscriptions

private void removeAssociatedSubscriptions(SessionInfo sessionInfo)
                                    throws XmlBlasterException
Throws:
XmlBlasterException

init

public void init(Global glob,
                 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)

getType

public java.lang.String getType()
returns the plugin type

Specified by:
getType in interface I_Plugin
See Also:
I_Plugin.getType()

getVersion

public java.lang.String getVersion()
returns the plugin version

Specified by:
getVersion in interface I_Plugin
See Also:
I_Plugin.getVersion()

shutdown

public void shutdown()
              throws XmlBlasterException
Shutsdown the plugin

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()

addOrUpdateSession

private void addOrUpdateSession(SessionInfo sessionInfo)
                         throws XmlBlasterException
A new session is added, checks if it shall be persisted.

Throws:
XmlBlasterException

sessionAdded

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

Specified by:
sessionAdded in interface I_ClientListener
Throws:
XmlBlasterException
See Also:
I_ClientListener.sessionAdded(org.xmlBlaster.authentication.ClientEvent)

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

sessionRemoved

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

Specified by:
sessionRemoved in interface I_ClientListener
Throws:
XmlBlasterException

sessionPreRemoved

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

Specified by:
sessionPreRemoved in interface I_ClientListener
Throws:
XmlBlasterException
See Also:
I_ClientListener.sessionRemoved(org.xmlBlaster.authentication.ClientEvent)

removeSession

public boolean removeSession(long uniqueId,
                             ConnectQosData connectQosData)

subscriptionAdd

public void subscriptionAdd(SubscriptionEvent e)
                     throws XmlBlasterException
This event is invoked even by child subscriptions. However only parent subscriptions should be stored, so all child subscriptions are ignored.

Specified by:
subscriptionAdd in interface I_SubscriptionListener
Throws:
XmlBlasterException
See Also:
I_SubscriptionListener.subscriptionAdd(org.xmlBlaster.engine.SubscriptionEvent)

subscriptionRemove

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

Specified by:
subscriptionRemove in interface I_SubscriptionListener
Throws:
XmlBlasterException
See Also:
I_SubscriptionListener.subscriptionRemove(org.xmlBlaster.engine.SubscriptionEvent)

subjectAdded

public void subjectAdded(ClientEvent e)
                  throws XmlBlasterException
does nothing

Specified by:
subjectAdded in interface I_ClientListener
Throws:
XmlBlasterException

subjectRemoved

public void subjectRemoved(ClientEvent e)
                    throws XmlBlasterException
does nothing

Specified by:
subjectRemoved in interface I_ClientListener
Throws:
XmlBlasterException

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:
See Also:
I_SubscriptionListener.getPriority()

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.