xmlBlaster 2.1.0 API

org.xmlBlaster.util.qos
Class ConnectQosSaxFactory

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

public final class ConnectQosSaxFactory
extends XmlQoSBase
implements I_ConnectQosFactory

This class encapsulates the qos of a login() or connect().

So you don't need to type the 'ugly' XML ASCII string by yourself. After construction access the ASCII-XML string with the toXml() method.
A typical connect QoS could look like this:

<qos>
   <securityService type="htpasswd" version="1.0">
     <![CDATA[
     <user>joe</user>
     <passwd>secret</passwd>
     ]]>
   </securityService>

   <session name='/node/heron/client/joe' timeout='3600000'
                 maxSessions='10' clearSessions='false'
                 reconnectSameClientOnly='false'/>

   <ptp>true</ptp>  

   <duplicateUpdates>true</duplicateUpdates>

   <!-- The client side queue (is ignored on server side): -->
   <queue relating='client' type='CACHE' version='1.0' maxEntries='1000' maxBytes='4000' onOverflow='exception'>
      <address type='IOR'>
         IOR:10000010033200000099000010....
      </address>
   <queue>

   <!-- Configures the server side callback queue: -->
   <queue relating='callback' type='CACHE' version='1.0' maxEntries='1000' maxBytes='4000' onOverflow='deadMessage'>
      <callback type='IOR' sessionId='4e56890ghdFzj0'>
         IOR:10000010033200000099000010....
         <burstMode collectTime='400' />
      </callback>
   </queue>
</qos>
 
NOTE: As a user of the Java client helper classes (client.I_XmlBlasterAccess) you don't need to create the
<callback>
element. This is generated automatically from I_XmlBlasterAccess when instantiating the callback driver.

A typical connect return QoS could look like this (this is the acknowledge returned by the server to the client on successful connect):

<qos>
   <securityService type="htpasswd" version="1.0">
     <![CDATA[
     <user>joe</user>
     <passwd>secret</passwd>
     ]]>
   </securityService>

   <session name='/node/heron/client/joe/-9' timeout='3600000' maxSessions='10' clearSessions='false'
               clearSessions='false' sessionId='sessionId:192.168.1.4-null-1042823803521-2074317763-3'/>

   <reconnected>false</reconnected>  <!-- Has the client reconnected to an existing session? -->

   <!-- The server side callback queue: -->
   <queue relating='callback' type='CACHE' version='1.0' maxEntries='1000' maxBytes='4000' onOverflow='deadMessage'>
      <callback type='XMLRPC' bootstrapHostname='192.168.1.4' sessionId='4e56890ghdFzj0'>
         http://192.168.1.4:8081/
         <burstMode collectTime='400' />
      </callback>
   <queue>
</qos>
 

See Also:
ConnectQosTest, connect interface

Field Summary
private  ConnectQosData connectQosData
           
private  Global glob
           
private  boolean inAddress
           
private  boolean inCallback
           
private  boolean inQueue
           
private  boolean inSecurityService
           
private static java.util.logging.Logger log
           
private  Address tmpAddr
           
private  CallbackAddress tmpCbAddr
           
private  CbQueueProperty tmpCbProp
           
private  ClientQueueProperty tmpProp
           
protected  java.lang.String tmpSecurityPluginType
           
protected  java.lang.String tmpSecurityPluginVersion
           
private  ServerRef tmpServerRef
          Helper for SAX parsing
 
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
ConnectQosSaxFactory(Global glob)
           
 
Method Summary
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String name)
          End element, event from SAX parser.
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String name, java.lang.StringBuffer character)
           
 ConnectQosData getConnectQosData()
          This is NOT thread safe so you need a new factory for each parse.
 java.lang.String getName()
          A human readable name of this factory
 ConnectQosData readObject(java.lang.String xmlQos)
          Parses the given xml Qos and returns a ConnectQosData holding the data.
 void setConnectQosData(ConnectQosData data)
          If a delegate call startElement() directly
 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.
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String name, java.lang.StringBuffer character, org.xml.sax.Attributes attrs)
          Start element from SAX parsing, call as delegate delivers the character
static java.lang.String toXml(java.lang.String rootTag, ConnectQosData data, java.lang.String extraOffset, java.util.Properties props)
           
 java.lang.String writeObject(ConnectQosData connectQosData, 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

connectQosData

private ConnectQosData connectQosData

inQueue

private boolean inQueue

inSecurityService

private boolean inSecurityService

inCallback

private boolean inCallback

inAddress

private boolean inAddress

tmpServerRef

private ServerRef tmpServerRef
Helper for SAX parsing


tmpCbProp

private CbQueueProperty tmpCbProp

tmpCbAddr

private CallbackAddress tmpCbAddr

tmpProp

private ClientQueueProperty tmpProp

tmpAddr

private Address tmpAddr

tmpSecurityPluginType

protected java.lang.String tmpSecurityPluginType

tmpSecurityPluginVersion

protected java.lang.String tmpSecurityPluginVersion
Constructor Detail

ConnectQosSaxFactory

public ConnectQosSaxFactory(Global glob)
Method Detail

readObject

public ConnectQosData readObject(java.lang.String xmlQos)
                          throws XmlBlasterException
Parses the given xml Qos and returns a ConnectQosData holding the data. Parsing of connect() and connect-return QoS is supported here. This call is thread safe if not intermixed with getConnectQosData() calls.

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

getConnectQosData

public ConnectQosData getConnectQosData()
This is NOT thread safe so you need a new factory for each parse. Use this variant if you have a bigger xml markup and want to delegate startElement(), endElement() calls to this. PRECONDITION: Call setConnectQosData() first!


setConnectQosData

public void setConnectQosData(ConnectQosData data)
If a delegate call startElement() directly


startElement

public 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

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String name,
                         java.lang.StringBuffer character,
                         org.xml.sax.Attributes attrs)
Start element from SAX parsing, call as delegate delivers the character


endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String name)
                throws org.xml.sax.SAXException
End element, event from SAX parser.

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

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String name,
                       java.lang.StringBuffer character)
                throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

writeObject

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

Specified by:
writeObject in interface I_ConnectQosFactory
Parameters:
extraOffset - indenting of tags for nice output
connectQosData - The data object to serialize
Returns:
internal state of the ConnectQos as a XML ASCII string

toXml

public static final java.lang.String toXml(java.lang.String rootTag,
                                           ConnectQosData data,
                                           java.lang.String extraOffset,
                                           java.util.Properties props)
Parameters:
flag - For example Constants.TOXML_FLAG_NOSECURITY

getName

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

Specified by:
getName in interface I_ConnectQosFactory
Returns:
"ConnectQosSaxFactory"

xmlBlaster 2.1.0 API

Copyright © 1999-2011 The xmlBlaster.org contributers.