xmlBlaster 1.6.2 API

org.xmlBlaster.engine
Class RequestBroker

java.lang.Object
  extended byjavax.management.NotificationBroadcasterSupport
      extended byorg.xmlBlaster.engine.RequestBroker
All Implemented Interfaces:
java.util.EventListener, I_AdminNode, I_AdminUsage, I_ClientListener, I_LogListener, I_RunlevelListener, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, RequestBrokerMBean

public final class RequestBroker
extends javax.management.NotificationBroadcasterSupport
implements I_ClientListener, RequestBrokerMBean, I_RunlevelListener, I_LogListener

This is the central message broker, all requests are routed through this singleton.

The interface I_ClientListener informs about Client login/logout

Most events are fired from the RequestBroker

See xmlBlaster.idl, the CORBA access interface on how clients can access xmlBlaster.

Author:
Marcel Ruff

Nested Class Summary
 
Nested classes inherited from class javax.management.NotificationBroadcasterSupport
 
Field Summary
private  AccessPluginManager accessPluginManager
           
private static int ALIVE
           
private  Authenticate authenticate
          the authentication service
private  BigXmlKeyDOM bigXmlKeyDOM
          This is a handle on the big DOM tree with all XmlKey keys (all message meta data)
private  ClientSubscriptions clientSubscriptions
          Helper to handle the subscriptions
private  DispatchStatistic dispatchStatistic
          Contains total count of published messages and get() invocations.
private  ServerScope glob
           
static java.lang.String internalLoginNamePrefix
           
private  java.lang.String lastError
           
private  java.lang.String lastWarning
           
private static java.util.logging.Logger log
           
private  JmxMBeanHandle mbeanHandle
          My JMX registration
private  java.lang.String ME
           
private  SessionName myselfLoginName
           
private  boolean publishLoginEvent
          The messageUnit for a login event
private  boolean publishLogoutEvent
          Initialize a messageUnit for a logout event
private  PublishPluginManager publishPluginManager
           
private  PublishQos publishQosForEvents
           
private  PublishQosServer publishQosLoginEvent
           
private  PublishQosServer publishQosLogoutEvent
           
private  boolean publishUserList
          Initialize a messageUnit for a userList event
private  java.util.Set remotePropertiesListeners
           
private  long startupTime
          Incarnation time of this object instance in millis
private  int state
           
private  java.util.Map subscriptionListenerMap
          For listeners who want to be informed about subscribe/unsubscribe events.
private  I_Map topicStore
          Store configuration of all topics in xmlBlaster for recovery
private static int UNDEF
          State during construction
private  SessionInfo unsecureSessionInfo
          This client is only for internal use, it is un secure to pass it outside because there is no authentication.
The login name "__RequestBroker_internal__" is reserved!
TODO: security discussion
private  boolean useOldStylePersistence
          Flag for performance reasons only
private  MsgKeyData xmlKeyLoginEvent
           
private  MsgKeyData xmlKeyLogoutEvent
           
private  MsgKeyData xmlKeyUserListEvent
           
 
Fields inherited from class javax.management.NotificationBroadcasterSupport
 
Constructor Summary
RequestBroker(Authenticate authenticate)
          One instance of this represents one xmlBlaster server.
 
Method Summary
 int addPersistentTopicHandler(TopicEntry topicEntry)
          Make the topicHandler persistent for crash recovery and shutdown/startup cycle.
 boolean addRemotePropertiesListener(I_RemotePropertiesListener remotePropertiesListener)
          Add listener if new remote properties arrive.
 void addSubscriptionListener(I_SubscriptionListener l)
          Adds the specified subscription listener to receive subscribe/unSubscribe events.
 int changePersistentTopicHandler(TopicEntry topicEntry)
          Remove the persistent TopicHandler entry.
 java.lang.String checkCallbackEntriesConsistency(boolean fixIt, java.lang.String reportFileName)
          Loop through all database entries of relating='callback' and check if there are entries from not existing sessions with pubSessionId=<0
 java.lang.String checkConsistency(I_Map map, boolean fixIt, java.lang.String reportFileName)
           
 java.lang.String checkConsistency(java.lang.String fixIt, java.lang.String reportFileName)
          Do consistency check.
(package private)  void checkExistingSubscriptions(SessionInfo sessionInfo, TopicHandler topicHandler, PublishQosServer xmlQoS)
          This helper method checks for a published message which didn't exist before if there are any XPath subscriptions pending which match.
 void clearLastError()
          Clear the last exception text.
 void clearLastWarning()
          Clear the last warning text.
 java.lang.String[] deadMessage(MsgQueueEntry[] entries, I_Queue queue, java.lang.String reason)
          Publish dead letters, expired letters should be filtered away before.
 java.lang.String displayClassInfo(java.lang.String clazzName)
          Check if the given java class is known and wherefrom it was loaded.
 java.lang.String dump()
          Dump the complete internal state of xmlBlaster.
 java.lang.String dumpAllStacks()
           
 java.lang.String dumpAllStacksToFile(java.lang.String file)
           
(package private)  java.lang.String[] erase(SessionInfo sessionInfo, QueryKeyData xmlKey, EraseQosServer eraseQos)
          Client wants to erase a message.
private  java.lang.String[] erase(SessionInfo sessionInfo, QueryKeyData xmlKey, EraseQosServer eraseQos, boolean isClusterUpdate)
          Client wants to erase a message.
 void exit()
          Shutdown xmlBlaster, exit value is '0'
(package private)  void fireSubscribeEvent(SubscriptionInfo subscriptionInfo)
           
private  void fireSubscriptionEvent(SubscriptionInfo subscriptionInfo, boolean subscribe)
          Is fired on subscribe(), unSubscribe() and several times on erase().
(package private)  void fireUnSubscribeEvent(SubscriptionInfo subscriptionInfo)
           
 PublishReturnQos forwardPtpPublish(SessionInfo sessionInfo, MsgUnit msgUnit, boolean isClusterUpdate, Destination destination)
          Rorward a message to another cluster node.
 MsgUnit[] get(SessionInfo sessionInfo, QueryKeyData xmlKey, GetQosServer getQos)
          Invoked by a client, to access one/many MsgUnit.
 AccessPluginManager getAccessPluginManager()
           
 java.lang.String[] getAliveCallbackClients()
          Shows the clients which have a alive callback connection.
(package private)  Authenticate getAuthenticate()
           
 Authenticate getAuthenticate(java.lang.String secretSessionId)
          This method returns the unprotected Authenticate object.
(package private)  BigXmlKeyDOM getBigXmlKeyDOM()
           
 java.lang.String getBuildJavaVendor()
          The java vendor of the compiler.
 java.lang.String getBuildJavaVersion()
          The compiler java version.
 java.lang.String getBuildTimestamp()
          Returns the date when xmlBlaster was compiled.
 java.lang.String getClientList()
          These are the login names returned, every client may be logged in multiple times which you can't see here
 java.lang.String[] getClients()
          Get the client names.
 ClientSubscriptions getClientSubscriptions()
          Holds all subscriptions.
 long getFreeMem()
          Memory in bytes
 java.lang.String getFreeMemStr()
          Nicer to read for humans.
 java.lang.String getGc()
           
 java.lang.String getHostname()
          Access the bootstrap host name.
 java.lang.String getInstanceId()
          Unique id of the xmlBlaster server, changes on each restart.
(package private)  SessionInfo getInternalSessionInfo()
           
 java.lang.String getLastError()
          Access the last logged error
 java.lang.String getLastWarning()
          Access the last logged error
 int getMaxClients()
          Get the maximum allowed number of clients.
 long getMaxFreeMem()
          Free memory in bytes
 java.lang.String getMaxFreeMemStr()
          Nicer to read for humans.
 long getMaxMem()
          Returns the total amount of memory including what the Java virtual machine could additionally allocate.
 java.lang.String getMaxMemStr()
          Nicer to read for humans.
 java.lang.String getName()
          A human readable name of the listener for logging.
 java.lang.String getNodeId()
          Get my cluster node name.
 java.lang.String getNodeList()
          Get the names of all known xmlBlaster cluster nodes.
 java.lang.String[] getNodes()
          Get the names of all known xmlBlaster cluster nodes.
 javax.management.MBeanNotificationInfo[] getNotificationInfo()
          Declare available notification event types.
 int getNumClients()
          The number of different users, the sessions may be higher
 long getNumGet()
           
 int getNumNodes()
          Get the number of known cluster nodes.
 long getNumPublish()
           
 int getNumSubscriptions()
          Get the number of subscriptions.
 int getNumSysprop()
          Get the number of system properties.
 int getNumTopics()
          Get the number of topics.
 long getNumUpdate()
          The overall sent updates (callback to client)
 int getPort()
          The bootstrap bootstrap port
 PublishPluginManager getPublishPluginManager()
           
 I_RemotePropertiesListener[] getRemotePropertiesListenerArr()
          Access a current snapshot of all listeners.
 java.lang.String getRevisionNumber()
          Returns the xmlBlaster SVN version control revision number.
 java.lang.String getRunlevel()
          Access the current run level of xmlBlaster.
 ServerScope getServerScope()
          Access the ServerScope handle.
 java.lang.String getServerTimestamp()
          Access the current server time as a java.sql.Timestamp string.
 long getServerTimestampMillis()
          Returns the current server time in milliseconds.
 java.lang.String getStartupDate()
          Get date when xmlBlaster was started.
 java.lang.String getSubscriptionList()
          Get the subscriptions.
 I_SubscriptionListener getSubscriptionListener(java.lang.Integer prio)
          Returns the listener with the specified prio or null if none with that prio has been found.
 java.lang.String[] getSubscriptions()
          Get the subscriptions ids.
 java.lang.String getSyspropList()
          Get the system properties.
 java.lang.String getTopicList()
          Get the topics.
 java.lang.String[] getTopics()
          Get the topics.
(package private)  I_Map getTopicStore()
           
 long getTotalMem()
          Returns the current amount of memory in the Java virtual machine.
 java.lang.String getTotalMemStr()
          Nicer to read for humans.
 long getUptime()
          How long is the server running (in seconds)
 java.lang.String getUsageUrl()
          JMX
 long getUsedMem()
           
 java.lang.String getUsedMemStr()
          Nicer to read for humans.
 java.lang.String getVersion()
          Get the xmlBlaster version number.
private  void initHelperQos()
          Put this code in a generic internal message producer class (future release)
 boolean isAcceptWrongSenderAddress()
          Configure server with '-xmlBlaster/acceptWrongSenderAddress true' or "-xmlBlaster/acceptWrongSenderAddress/joe true".
 void log(java.util.logging.LogRecord record)
          Redirect logging, configure in xmlBlaster.properties.
 java.lang.String publish(SessionInfo sessionInfo, MsgUnit msgUnit)
          Internal publishing helper.
private  java.lang.String publish(SessionInfo sessionInfo, MsgUnit msgUnit, boolean isClusterUpdate)
           
private  java.lang.String publish(SessionInfo sessionInfo, MsgUnit msgUnit, PublishQosServer publishQos)
          Write-Access method to publish a new message from a data source.
private  KeyData[] queryMatchingKeys(SessionInfo sessionInfo, QueryKeyData queryKeyData, QueryQosData qos)
          This method does the query (queryType = "XPATH" | "EXACT").
private  java.lang.String[] queryMatchingTopics(SessionInfo sessionInfo, QueryKeyData queryKeyData, QueryQosData qos)
          This method does the query (queryType = "XPATH" | "EXACT").
 int removePersistentTopicHandler(TopicEntry topicEntry)
          Remove the persistent TopicHandler entry.
 boolean removeRemotePropertiesListener(I_RemotePropertiesListener remotePropertiesListener)
          Remove the given listener
 void removeSubscriptionListener(I_SubscriptionListener l)
          Removes the specified listener.
 java.lang.String reportMemoryOverview()
           
private  java.lang.String reportMemoryOverview(java.lang.String reportFileName)
           
 java.lang.String reportMemoryOverviewToFile(java.lang.String reportFileName)
           
 void runlevelChange(int from, int to, boolean force)
          Invoked on run level change, see RunlevelManager.RUNLEVEL_HALTED and RunlevelManager.RUNLEVEL_RUNNING

Enforced by I_RunlevelListener

 void sessionAdded(ClientEvent e)
          Event invoked on successful client login (interface I_ClientListener).
 void sessionPreRemoved(ClientEvent e)
          Invoked before a client does a logout
 void sessionRemoved(ClientEvent e)
          Event invoked when client does a logout (interface I_ClientListener).
 void sessionUpdated(ClientEvent e)
          Invoked on successful client re-login (interface I_ClientListener)
 void setAcceptWrongSenderAddress(boolean acceptWrongSenderAddress)
           
 void setDump(java.lang.String fn)
          Dump the internal xmlBlaster state to the given file.
 void setExit(java.lang.String exitValue)
           
 void setGc(java.lang.String dummy)
           
 void setRunlevel(java.lang.String levelStr)
          Change the run level of xmlBlaster.
 void setUsageUrl(java.lang.String url)
           
private  void startupTopicStore()
          This stores the topics configuration (the publish administrative message - the MsgUnit data struct)
 void subjectAdded(ClientEvent e)
          Event invoked on new created SubjectInfo.
 void subjectRemoved(ClientEvent e)
          Event invoked on deleted SubjectInfo.
 java.lang.String subscribe(SessionInfo sessionInfo, QueryKeyData xmlKey, SubscribeQosServer subscribeQos)
           
private  void subscribeToOid(SubscriptionInfo subs, boolean calleeIsXPathMatchCheck)
          Low level subscribe, is called when the to subscribe is exactly known.
 java.lang.String toXml()
          Dump state of this object into a XML ASCII string.
 java.lang.String toXml(java.lang.String extraOffset)
          Dump state of this object into a XML ASCII string.
 java.lang.String[] unSubscribe(SessionInfo sessionInfo, QueryKeyData xmlKey, UnSubscribeQosServer unSubscribeQos)
          Incoming unsubscribe request from a client.
 java.lang.String update(SessionInfo sessionInfo, UpdateKey updateKey, byte[] content, MsgQosData msgQosData)
          Used for cluster internal updates.
 void updateInternalUserList()
           
 java.lang.String usage()
          JMX
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ME

private java.lang.String ME

glob

private final ServerScope glob

log

private static java.util.logging.Logger log

dispatchStatistic

private DispatchStatistic dispatchStatistic
Contains total count of published messages and get() invocations.


lastWarning

private java.lang.String lastWarning

lastError

private java.lang.String lastError

authenticate

private Authenticate authenticate
the authentication service


remotePropertiesListeners

private final java.util.Set remotePropertiesListeners

topicStore

private I_Map topicStore
Store configuration of all topics in xmlBlaster for recovery


unsecureSessionInfo

private final SessionInfo unsecureSessionInfo
This client is only for internal use, it is un secure to pass it outside because there is no authentication.
The login name "__RequestBroker_internal__" is reserved!
TODO: security discussion


myselfLoginName

private final SessionName myselfLoginName

internalLoginNamePrefix

public static final java.lang.String internalLoginNamePrefix
See Also:
Constant Field Values

clientSubscriptions

private final ClientSubscriptions clientSubscriptions
Helper to handle the subscriptions


subscriptionListenerMap

private final java.util.Map subscriptionListenerMap
For listeners who want to be informed about subscribe/unsubscribe events. The key is an Integer number where the lowest is the first invoked on subscribe and the last invoked on unsubscribe.


bigXmlKeyDOM

private BigXmlKeyDOM bigXmlKeyDOM
This is a handle on the big DOM tree with all XmlKey keys (all message meta data)


useOldStylePersistence

private boolean useOldStylePersistence
Flag for performance reasons only


publishLoginEvent

private boolean publishLoginEvent
The messageUnit for a login event


xmlKeyLoginEvent

private MsgKeyData xmlKeyLoginEvent

publishQosForEvents

private PublishQos publishQosForEvents

publishQosLoginEvent

private PublishQosServer publishQosLoginEvent

publishUserList

private boolean publishUserList
Initialize a messageUnit for a userList event


xmlKeyUserListEvent

private MsgKeyData xmlKeyUserListEvent

publishLogoutEvent

private boolean publishLogoutEvent
Initialize a messageUnit for a logout event


xmlKeyLogoutEvent

private MsgKeyData xmlKeyLogoutEvent

publishQosLogoutEvent

private PublishQosServer publishQosLogoutEvent

accessPluginManager

private AccessPluginManager accessPluginManager

publishPluginManager

private PublishPluginManager publishPluginManager

startupTime

private long startupTime
Incarnation time of this object instance in millis


UNDEF

private static final int UNDEF
State during construction

See Also:
Constant Field Values

ALIVE

private static final int ALIVE
See Also:
Constant Field Values

state

private int state

mbeanHandle

private JmxMBeanHandle mbeanHandle
My JMX registration

Constructor Detail

RequestBroker

public RequestBroker(Authenticate authenticate)
              throws XmlBlasterException
One instance of this represents one xmlBlaster server.

Parameters:
authenticate - The authentication service
Method Detail

getAuthenticate

Authenticate getAuthenticate()

initHelperQos

private void initHelperQos()
                    throws XmlBlasterException
Put this code in a generic internal message producer class (future release)

Throws:
XmlBlasterException

getName

public java.lang.String getName()
A human readable name of the listener for logging.

Enforced by I_RunlevelListener

Specified by:
getName in interface I_RunlevelListener

getBigXmlKeyDOM

BigXmlKeyDOM getBigXmlKeyDOM()

getClientSubscriptions

public ClientSubscriptions getClientSubscriptions()
Holds all subscriptions.

Returns:
Is never null

runlevelChange

public void runlevelChange(int from,
                           int to,
                           boolean force)
                    throws XmlBlasterException
Invoked on run level change, see RunlevelManager.RUNLEVEL_HALTED and RunlevelManager.RUNLEVEL_RUNNING

Enforced by I_RunlevelListener

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
Throws:
XmlBlasterException

getServerScope

public final ServerScope getServerScope()
Access the ServerScope handle.

Returns:
The ServerScope instance of this xmlBlaster server

getTopicStore

I_Map getTopicStore()
Returns:
The handle on the persistence storage for all topics

startupTopicStore

private void startupTopicStore()
                        throws XmlBlasterException
This stores the topics configuration (the publish administrative message - the MsgUnit data struct)

Throws:
XmlBlasterException

getAccessPluginManager

public final AccessPluginManager getAccessPluginManager()

getPublishPluginManager

public final PublishPluginManager getPublishPluginManager()

getInternalSessionInfo

final SessionInfo getInternalSessionInfo()

deadMessage

public java.lang.String[] deadMessage(MsgQueueEntry[] entries,
                                      I_Queue queue,
                                      java.lang.String reason)
Publish dead letters, expired letters should be filtered away before.

The key contains an attribute with the oid of the lost message:

   <key oid='__sys__deadMessage'>
      <oid>aMessage</oid>
   <key>
 

The usual sources to send dead letters are:

  1. A publish of a message fails, the message is lost but you can handle it if you subscribe to dead messages
  2. A subscribe fails because a mime plugin throws an exception
  3. A callback fails

Parameters:
entries - The message to send as dead letters
queue - The belonging queue or null
reason - A human readable text describing the problem
Returns:
State information returned from the publish call (is never null)

subscribe

public java.lang.String subscribe(SessionInfo sessionInfo,
                                  QueryKeyData xmlKey,
                                  SubscribeQosServer subscribeQos)
                           throws XmlBlasterException
Throws:
XmlBlasterException

get

public MsgUnit[] get(SessionInfo sessionInfo,
                     QueryKeyData xmlKey,
                     GetQosServer getQos)
              throws XmlBlasterException
Invoked by a client, to access one/many MsgUnit.

Synchronous read-access method.

In the cluster environment all messages are accessed from the master cluster node, tuning with XmlBlasterAccess.synchronousCache is not yet implemented.

Parameters:
xmlKey - Key allowing XPath or exact selection
See XmlKey.dtd for a description
getQos - Quality of Service, flags to control subscription
See XmlQoS.dtd for a description, XmlQoS.xml for examples

Returns:
A sequence of 0 - n MsgUnit structs. 0 if no message matched. They are clones from the internal messageUnit, so native clients can manipulate them without danger
Throws:
XmlBlasterException - on internal errors
See Also:
GetQos, The interface.get requirement

updateInternalUserList

public void updateInternalUserList()
                            throws XmlBlasterException
Throws:
XmlBlasterException

queryMatchingKeys

private KeyData[] queryMatchingKeys(SessionInfo sessionInfo,
                                    QueryKeyData queryKeyData,
                                    QueryQosData qos)
                             throws XmlBlasterException
This method does the query (queryType = "XPATH" | "EXACT").

Returns:
Array of matching XmlKey objects (may contain null elements), the array is never null TODO: a query Handler, allowing drivers for REGEX, XPath, SQL, etc. queries
Throws:
XmlBlasterException

queryMatchingTopics

private java.lang.String[] queryMatchingTopics(SessionInfo sessionInfo,
                                               QueryKeyData queryKeyData,
                                               QueryQosData qos)
                                        throws XmlBlasterException
This method does the query (queryType = "XPATH" | "EXACT").

Returns:
Array of matching XmlKey objects (may contain null elements), the array is never null TODO: a query Handler, allowing drivers for REGEX, XPath, SQL, etc. queries
Throws:
XmlBlasterException

addPersistentTopicHandler

public final int addPersistentTopicHandler(TopicEntry topicEntry)
                                    throws XmlBlasterException
Make the topicHandler persistent for crash recovery and shutdown/startup cycle.

Returns:
Number of new entries added: 0 if entry existed, 1 if new entry added
Throws:
XmlBlasterException

removePersistentTopicHandler

public final int removePersistentTopicHandler(TopicEntry topicEntry)
                                       throws XmlBlasterException
Remove the persistent TopicHandler entry.

Returns:
the number of elements erased.
Throws:
XmlBlasterException

changePersistentTopicHandler

public final int changePersistentTopicHandler(TopicEntry topicEntry)
                                       throws XmlBlasterException
Remove the persistent TopicHandler entry.

Returns:
the number of elements erased.
Throws:
XmlBlasterException

subscribeToOid

private void subscribeToOid(SubscriptionInfo subs,
                            boolean calleeIsXPathMatchCheck)
                     throws XmlBlasterException
Low level subscribe, is called when the to subscribe is exactly known.

If the message is yet unknown, an empty is created to hold the subscription.

Parameters:
subs -
calleeIsXPathMatchCheck - true The calling thread is internally to check if a Query matches a new published topic false The callee is a subscribe() thread from a client
Throws:
XmlBlasterException

getAuthenticate

public Authenticate getAuthenticate(java.lang.String secretSessionId)
This method returns the unprotected Authenticate object.

Parameters:
secretSessionId - the secret Session Id of the invoker. TODO in future an authorization operation shall be performed here
Returns:

unSubscribe

public java.lang.String[] unSubscribe(SessionInfo sessionInfo,
                                      QueryKeyData xmlKey,
                                      UnSubscribeQosServer unSubscribeQos)
                               throws XmlBlasterException
Incoming unsubscribe request from a client.

If you have subscribed before, you can cancel your subscription with this method again

Parameters:
sessionInfo -
xmlKey - Key with the oid to unSubscribe
See XmlKey.dtd for a description
If you subscribed with XPath, you need to pass the id you got from your subscription
Returns:
An array of canceled subscriptions e.g.
   <qos>
      <subscribe id='__subId:2'/>
      <isUnSubscribe/>
   </qos>
 
Throws:
XmlBlasterException

update

public final java.lang.String update(SessionInfo sessionInfo,
                                     UpdateKey updateKey,
                                     byte[] content,
                                     MsgQosData msgQosData)
                              throws XmlBlasterException
Used for cluster internal updates.

Throws:
XmlBlasterException

publish

public final java.lang.String publish(SessionInfo sessionInfo,
                                      MsgUnit msgUnit)
                               throws XmlBlasterException
Internal publishing helper.

Throws:
XmlBlasterException

publish

private final java.lang.String publish(SessionInfo sessionInfo,
                                       MsgUnit msgUnit,
                                       boolean isClusterUpdate)
                                throws XmlBlasterException
Throws:
XmlBlasterException

publish

private final java.lang.String publish(SessionInfo sessionInfo,
                                       MsgUnit msgUnit,
                                       PublishQosServer publishQos)
                                throws XmlBlasterException
Write-Access method to publish a new message from a data source.

There are two MoM styles supported:

This triggers the method update() if observed by somebody

If the given key oid doesn't exist, it will be automatically added,
so this covers the SQL'ish INSERT and UPDATE.

If MsgUnit is created from subscribe or MsgUnit is new, the key meta data are added to the big DOM tree once (XmlKey takes care of that).

See xmlBlaster.idl, the CORBA access interface on how clients can access xmlBlaster.

TODO: Allow XML formatted returns which exactly match the update() return syntax (for clustering ClusterNode.java:update())

Parameters:
sessionInfo - The SessionInfo object, describing the publishing client
msgUnit - The MsgUnit struct
Returns:
String with the XML encoded key oid of the msgUnit
If you let the oid be generated, you need this information for further publishing to the same MsgUnit
Rejected Messages will contain a string with state id!=OK
Throws:
XmlBlasterException
See Also:
The interface.publish requirement

forwardPtpPublish

public PublishReturnQos forwardPtpPublish(SessionInfo sessionInfo,
                                          MsgUnit msgUnit,
                                          boolean isClusterUpdate,
                                          Destination destination)
                                   throws XmlBlasterException
Rorward a message to another cluster node. TODO: How to return multiple retVal from multiple destinations? !!!

Returns:
if not null the message was forwarded to another cluster
Throws:
XmlBlasterException

checkExistingSubscriptions

final void checkExistingSubscriptions(SessionInfo sessionInfo,
                                      TopicHandler topicHandler,
                                      PublishQosServer xmlQoS)
                               throws XmlBlasterException
This helper method checks for a published message which didn't exist before if there are any XPath subscriptions pending which match.

Throws:
XmlBlasterException

erase

java.lang.String[] erase(SessionInfo sessionInfo,
                         QueryKeyData xmlKey,
                         EraseQosServer eraseQos)
                   throws XmlBlasterException
Client wants to erase a message.

Parameters:
sessionInfo - The SessionInfo object, describing the invoking client
xmlKey - Key allowing XPath or exact selection
See XmlKey.dtd for a description
Returns:
String array with the xml encoded key oid's which are deleted
Throws:
XmlBlasterException
See Also:
The interface.publish requirement

erase

private java.lang.String[] erase(SessionInfo sessionInfo,
                                 QueryKeyData xmlKey,
                                 EraseQosServer eraseQos,
                                 boolean isClusterUpdate)
                          throws XmlBlasterException
Client wants to erase a message.

Parameters:
sessionInfo - The SessionInfo object, describing the invoking client
xmlKey - Key allowing XPath or exact selection
See XmlKey.dtd for a description
isClusterUpdate - true if it is a update() callback message from another cluster node
Returns:
String array with the xml encoded key oid's which are deleted
Throws:
XmlBlasterException
See Also:
The interface.publish requirement

sessionAdded

public void sessionAdded(ClientEvent e)
                  throws XmlBlasterException
Event invoked on successful client login (interface I_ClientListener).

Publishes a login event for this client with key oid="__sys_Login"

    <key oid='__sys__Login'>    <!-- Client name is delivered in the content -->
    </key>
 

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

sessionRemoved

public void sessionRemoved(ClientEvent e)
                    throws XmlBlasterException
Event invoked when client does a logout (interface I_ClientListener).

Publishes a logout event for this client with key oid="__sys_Logout"

    <key oid='__sys__Logout'>    <!-- Client name is delivered in the content -->
    </key>
 

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

subjectAdded

public void subjectAdded(ClientEvent e)
                  throws XmlBlasterException
Event invoked on new created SubjectInfo.

Specified by:
subjectAdded in interface I_ClientListener