xmlBlaster 2.2.0 API

org.xmlBlaster.util.qos
Class MsgQosSaxFactory

java.lang.Object
  extended by org.xmlBlaster.util.SaxHandlerBase
      extended by org.xmlBlaster.util.XmlQoSBase
          extended by org.xmlBlaster.util.qos.MsgQosSaxFactory
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.ErrorHandler, org.xml.sax.ext.LexicalHandler, I_MsgQosFactory

public class MsgQosSaxFactory
extends XmlQoSBase
implements I_MsgQosFactory

Parsing xml QoS (quality of service) of publish() and update().

Example for Pub/Sub style:

  <qos> <
     <state id='OK' info='Keep on running"/> 
     <priority>5</priority>
     <administrative>false</administrative>
     <expiration lifeTime='129595811' forceDestroy='false'/> 
     <persistent/>
     <topic readonly='false' destroyDelay='60000' createDomEntry='true'>
        <persistence relating='msgUnitStore' type='CACHE' version='1.0' maxEntries='1000' maxBytes='4000000' onOverflow='deadMessage'/>
        <queue relating='history' type='CACHE' version='1.0' maxEntries='1000' maxBytes='4000000' onOverflow='exception'/>
     </topic>
  </qos>
 
Example for PtP addressing style:<p />
  <qos>
     <subscribable>false</subscribable>  <!-- false to make PtP message invisible for subscribes -->
     <destination queryType='EXACT' forceQueuing='true'>
        Tim
     </destination>
     <destination queryType='EXACT'>
        /node/heron/client/Ben/-2
     </destination>
     <destination queryType='XPATH'>   
        //[GROUP='Manager']
     </destination>
     <destination queryType='XPATH'>   
        //ROLE/[@id='Developer']
     </destination>
     <sender>
        Gesa
     </sender>
     <priority>7</priority>
     <route>
        <node id='bilbo' stratum='2' timestamp='34460239640' dirtyRead='true'/>
     </route>
  </qos>
 

Example for update() QoS:

  <qos> <
     <state id='OK' info='Keep on running"/> 
     <sender>Tim</sender>
     <priority>5</priority>
     <subscribe id='__subId:1'/> 
     <rcvTimestamp nanos='1007764305862000002'> <!-- UTC time when message was created in xmlBlaster server with a publish() call, in nanoseconds since 1970 -->
           2001-12-07 23:31:45.862000002   <!-- The nanos from above but human readable -->
     </rcvTimestamp>
     <expiration lifeTime='129595811' forceDestroy='false'/> 
     <queue index='0' of='1'/> <!-- If queued messages are flushed on login -->
     <persistent/>
     <redeliver>4</redeliver>             
     <route>
        <node id='heron'/>
     </route>
  </qos>
 

Note that receiveTimestamp is in nanoseconds, whereas all other time values are milliseconds

The receive timestamp can be delivered in human readable form as well by setting on server command line:
   -cb.receiveTimestampHumanReadable true

   <rcvTimestamp nanos='1015959656372000000'>
     2002-03-12 20:00:56.372
   </rcvTimestamp>
 

Author:
xmlBlaster@marcelruff.info
See Also:
MsgQosFactoryTest, The interface.publish requirement

Field Summary
private  Destination destination
           
private  Global glob
           
private  boolean inDestination
           
private  boolean inRoute
           
private  boolean inTopic
          helper flag for SAX parsing: parsing inside ?
private static java.util.logging.Logger log
           
private  MsgQosData msgQosData
           
private  RouteInfo routeInfo
           
private  boolean sendRemainingLife
           
 
Fields inherited from class org.xmlBlaster.util.XmlQoSBase
clientProperty, clientPropertyTagNames, cpCharacter, inQos
 
Fields inherited from class org.xmlBlaster.util.SaxHandlerBase
character, locator, xmlLiteral, xmlSource
 
Constructor Summary
MsgQosSaxFactory(Global glob)
          Can be used as singleton.
 
Method Summary
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String name)
          End element, event from SAX parser.
 java.lang.String getName()
          A human readable name of this factory
static void main(java.lang.String[] args)
           
 MsgQosData readObject(java.lang.String xmlQos)
          Parses the given xml Qos and returns a MsgQosData holding the data.
 boolean sendRemainingLife()
           
 void sendRemainingLife(boolean sendRemainingLife)
          Configure if remaingLife is sent in Qos (redesign approach to work with all QoS attributes
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String name, org.xml.sax.Attributes attrs)
          Start element, event from SAX parser.
 java.lang.String writeObject(MsgQosData msgQosData, java.lang.String extraOffset, java.util.Properties props)
          Dump state of this object into a XML ASCII string.
 
Methods inherited from class org.xmlBlaster.util.XmlQoSBase
addTagToString, characters, characters, endElementBase, init, isEmpty, startElementBase
 
Methods inherited from class org.xmlBlaster.util.SaxHandlerBase
comment, endCDATA, endDocument, endDTD, endEntity, endPrefixMapping, error, fatalError, getUseLexicalHandler, ignorableWhitespace, init, init, notationDecl, processingInstruction, setDocumentLocator, setUseLexicalHandler, skippedEntity, startCDATA, startDocument, startDTD, startEntity, startPrefixMapping, toString, toXml, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

glob

private final Global glob

log

private static java.util.logging.Logger log

msgQosData

private MsgQosData msgQosData

inTopic

private boolean inTopic
helper flag for SAX parsing: parsing inside ?


inDestination

private boolean inDestination

inRoute

private boolean inRoute

destination

private Destination destination

routeInfo

private RouteInfo routeInfo

sendRemainingLife

private boolean sendRemainingLife
Constructor Detail

MsgQosSaxFactory

public MsgQosSaxFactory(Global glob)
Can be used as singleton.

Method Detail

readObject

public MsgQosData readObject(java.lang.String xmlQos)
                      throws XmlBlasterException
Parses the given xml Qos and returns a MsgQosData holding the data. Parsing of update() and publish() QoS is supported here.

Specified by:
readObject in interface I_MsgQosFactory
Parameters:
the - XML based ASCII string
Throws:
XmlBlasterException

startElement

public final void startElement(java.lang.String uri,
                               java.lang.String localName,
                               java.lang.String name,
                               org.xml.sax.Attributes attrs)
Start element, event from SAX parser.

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class XmlQoSBase
Parameters:
name - Tag name
attrs - the attributes of the tag

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String name)
End element, event from SAX parser.

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class XmlQoSBase
Parameters:
name - Tag name

writeObject

public final java.lang.String writeObject(MsgQosData msgQosData,
                                          java.lang.String extraOffset,
                                          java.util.Properties props)
Dump state of this object into a XML ASCII string.

Specified by:
writeObject in interface I_MsgQosFactory
Parameters:
extraOffset - indenting of tags for nice output
forceReadable - If true, any base64 is decoded to be more human readable and timestamps are human readable
Returns:
internal state of the RequestBroker as a XML ASCII string

getName

public java.lang.String getName()
A human readable name of this factory

Specified by:
getName in interface I_MsgQosFactory
Returns:
"MsgQosSaxFactory"

sendRemainingLife

public void sendRemainingLife(boolean sendRemainingLife)
Configure if remaingLife is sent in Qos (redesign approach to work with all QoS attributes


sendRemainingLife

public boolean sendRemainingLife()

main

public static void main(java.lang.String[] args)

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.