xmlBlaster 2.2.0 client API

org.xmlBlaster.util.key
Class MsgKeySaxFactory

java.lang.Object
  extended by org.xmlBlaster.util.SaxHandlerBase
      extended by org.xmlBlaster.util.key.MsgKeySaxFactory
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.ErrorHandler, org.xml.sax.ext.LexicalHandler, I_MsgKeyFactory

public final class MsgKeySaxFactory
extends SaxHandlerBase
implements I_MsgKeyFactory

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

All XmlKey's have the same XML minimal structure:

    <key oid="12345"/>
 
or
    <key oid="12345">
       <!-- application specific tags -->
    </key>
 
where oid is a unique key.

A typical publish key could look like this:

     <key oid='4711' contentMime='text/xml'>
        <AGENT id='192.168.124.20' subId='1' type='generic'>
           <DRIVER id='FileProof' pollingFreq='10'>
           </DRIVER>
        </AGENT>
     </key>
 

Note that the AGENT and DRIVER tags are application know how, which you have to supply.
A well designed xml hierarchy of your problem domain is essential for a proper working xmlBlaster

NOTE: <![CDATA[ ... ]]> sections in the key are not supported

NOTE: Using tags like '<' will be transformed to '<c></c>' on toXml()

Author:
xmlBlaster@marcelruff.info
See Also:
MsgKeyData, org.xmlBlaster.test.classtest.key.MsgKeyFactoryTest

Field Summary
 
Fields inherited from class org.xmlBlaster.util.SaxHandlerBase
character, locator, xmlLiteral, xmlSource
 
Constructor Summary
MsgKeySaxFactory(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)
          java org.xmlBlaster.util.key.MsgKeySaxFactory
 MsgKeyData readObject(java.lang.String xmlKey)
          Parses the given xml Key and returns a MsgKeyData holding the data.
 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(MsgKeyData msgKeyData, java.lang.String extraOffset)
          Dump state of this object into a XML ASCII string.
 
Methods inherited from class org.xmlBlaster.util.SaxHandlerBase
characters, comment, endCDATA, endDocument, endDTD, endEntity, endPrefixMapping, error, fatalError, getUseLexicalHandler, ignorableWhitespace, init, 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
 

Constructor Detail

MsgKeySaxFactory

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

Method Detail

readObject

public MsgKeyData readObject(java.lang.String xmlKey)
                      throws XmlBlasterException
Parses the given xml Key and returns a MsgKeyData holding the data. Parsing of update() and publish() key is supported here.

Specified by:
readObject in interface I_MsgKeyFactory
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 SaxHandlerBase
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 SaxHandlerBase
Parameters:
name - Tag name

writeObject

public final java.lang.String writeObject(MsgKeyData msgKeyData,
                                          java.lang.String extraOffset)
Dump state of this object into a XML ASCII string.

Specified by:
writeObject in interface I_MsgKeyFactory
Parameters:
extraOffset - indenting of tags for nice output
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_MsgKeyFactory
Returns:
"MsgKeySaxFactory"

main

public static void main(java.lang.String[] args)
java org.xmlBlaster.util.key.MsgKeySaxFactory


xmlBlaster 2.2.0 client API

Copyright © 1999-2014 The xmlBlaster.org contributers.