xmlBlaster 2.2.0 client API

org.xmlBlaster.util
Class XmlQoSBase

java.lang.Object
  extended by org.xmlBlaster.util.SaxHandlerBase
      extended by org.xmlBlaster.util.XmlQoSBase
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.ErrorHandler, org.xml.sax.ext.LexicalHandler
Direct Known Subclasses:
ConnectQosSaxFactory, DisconnectQosSaxFactory, MsgQosSaxFactory, QueryQosSaxFactory, StatusQosSaxFactory

public class XmlQoSBase
extends SaxHandlerBase

In good old C days this would have been named a 'flag' (with bit wise setting)
But this allows to specify QoS (quality of service) in XML syntax.

With XML there are no problems to extend the services of the xmlBlaster in unlimited ways.
The xml string is parsed with a SAX parser, since no persistent DOM tree is needed and SAX is much faster.

You may use this as a base class for your specialized QoS.
The <qos> tag is parsed here, and you provide the parsing of the inner tags.


Field Summary
protected  ClientProperty clientProperty
           
protected  java.util.Set clientPropertyTagNames
           
protected  java.lang.StringBuffer cpCharacter
           
protected  boolean inQos
           
 
Fields inherited from class org.xmlBlaster.util.SaxHandlerBase
character, glob, locator, xmlLiteral, xmlSource
 
Constructor Summary
XmlQoSBase()
          Constructs an un initialized QoS (quality of service) object.
XmlQoSBase(Global glob)
           
 
Method Summary
protected static void addTagToString(java.lang.StringBuffer buf, java.lang.String tagName, org.xml.sax.Attributes attrs)
           
 void characters(char[] ch, int start, int length)
          Characters standard SAX.
 void characters(char[] ch, int start, int length, java.lang.StringBuffer delegateCharacters)
          Characters, when called from other sax parsing code The text between two tags, in the following example 'Hello': Hello
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String name)
          End element.
protected  boolean endElementBase(java.lang.String uri, java.lang.String localName, java.lang.String name)
          End element callback, does handling of tag <qos>.
protected  void init(java.lang.String xmlLiteral)
           
protected  boolean isEmpty(java.lang.String qos)
          To avoid SAX parsing (which costs many CPU cycles) check the QoS string here if it contains anything useful.
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String name, org.xml.sax.Attributes attrs)
          Start element.
protected  boolean startElementBase(java.lang.String uri, java.lang.String localName, java.lang.String name, org.xml.sax.Attributes attrs)
          Start element callback, does handling of tag <qos>.
 
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

inQos

protected boolean inQos

clientProperty

protected ClientProperty clientProperty

clientPropertyTagNames

protected final java.util.Set clientPropertyTagNames

cpCharacter

protected java.lang.StringBuffer cpCharacter
Constructor Detail

XmlQoSBase

public XmlQoSBase()
Constructs an un initialized QoS (quality of service) object. You need to call the init() method to parse the XML string.


XmlQoSBase

public XmlQoSBase(Global glob)
Method Detail

init

protected void init(java.lang.String xmlLiteral)
             throws XmlBlasterException
Overrides:
init in class SaxHandlerBase
Throws:
XmlBlasterException

isEmpty

protected boolean isEmpty(java.lang.String qos)
To avoid SAX parsing (which costs many CPU cycles) check the QoS string here if it contains anything useful.

Parameters:
qos - The literal ASCII xml string

startElementBase

protected final boolean startElementBase(java.lang.String uri,
                                         java.lang.String localName,
                                         java.lang.String name,
                                         org.xml.sax.Attributes attrs)
Start element callback, does handling of tag <qos>.

You may include this into your derived startElement() method like this:

  if (super.startElementBase(name, attrs) == true)
     return;
 

Returns:
true if the tag is parsed here, the derived class doesn't need to look at this tag anymore false this tag is not handled by this Base class

addTagToString

protected static void addTagToString(java.lang.StringBuffer buf,
                                     java.lang.String tagName,
                                     org.xml.sax.Attributes attrs)

characters

public void characters(char[] ch,
                       int start,
                       int length)
Characters standard SAX. The text between two tags, in the following example 'Hello': Hello

Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class SaxHandlerBase

characters

public void characters(char[] ch,
                       int start,
                       int length,
                       java.lang.StringBuffer delegateCharacters)
Characters, when called from other sax parsing code The text between two tags, in the following example 'Hello': Hello


startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String name,
                         org.xml.sax.Attributes attrs)
                  throws org.xml.sax.SAXException
Start element.

Default implementation, knows how to parse <qos> but knows nothing about the tags inside of qos

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class SaxHandlerBase
Throws:
org.xml.sax.SAXException

endElementBase

protected final boolean endElementBase(java.lang.String uri,
                                       java.lang.String localName,
                                       java.lang.String name)
End element callback, does handling of tag <qos>.

You may include this into your derived endElement() method like this:

  if (super.endElementBase(name) == true)
     return;
 

Returns:
true if the tag is parsed here, the derived class doesn't need to look at this tag anymore false this tag is not handled by this Base class

endElement

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

Default implementation, knows how to parse <qos> but knows nothing about the tags inside of qos

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class SaxHandlerBase
Throws:
org.xml.sax.SAXException

xmlBlaster 2.2.0 client API

Copyright © 1999-2014 The xmlBlaster.org contributers.