xmlBlaster 2.1.0 API

org.xmlBlaster.util.dispatch.plugins.prio
Class ConfigurationParser

java.lang.Object
  extended by org.xmlBlaster.util.SaxHandlerBase
      extended by org.xmlBlaster.util.dispatch.plugins.prio.ConfigurationParser
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.ErrorHandler, org.xml.sax.ext.LexicalHandler

public class ConfigurationParser
extends SaxHandlerBase

Parsing the configuration parameter of the priority based message selection plugin.

Example:

 <msgDispatch type='Priority' version='1.0' defaultStatus='64k' defaultAction='send'>
   <onStatus oid='_bandwidth.status' content='64k' defaultAction='destroy'>
     <action do='send'  ifPriority='7-9'/>
     <action do='queue'  ifPriority='2-6'/>
   </onStatus>
   <onStatus oid='_bandwidth.status' content='2M'>
     <action do='send'  ifPriority='0-9'/>
   </onStatus>
   <onStatus oid='_bandwidth.status' content='down' connectionState='polling'>
     <action do='send'  ifPriority='0-9'/>
   </onStatus>
 </msgDispatch>

 
 
 
 

Author:
xmlBlaster@marcelruff.info
See Also:
ConfigurationParserTest

Field Summary
private  java.util.Map configurationContentMap
          key='status message content', value='StatusConfiguration instances'
private  DispatchAction defaultAction
           
private  java.lang.String defaultStatus
           
private  Global glob
           
private  boolean inAction
           
private  boolean inMsgDispatch
           
private  boolean inOnStatus
           
private static java.util.logging.Logger log
           
private  java.lang.String ME
           
private  java.lang.String pluginType
           
private  java.lang.String pluginVersion
           
private  StatusConfiguration statusConfiguration
           
 
Fields inherited from class org.xmlBlaster.util.SaxHandlerBase
character, locator, xmlLiteral, xmlSource
 
Constructor Summary
ConfigurationParser(Global glob, java.lang.String xmlLiteral)
           
 
Method Summary
(package private)  void addStatusConfiguration(StatusConfiguration conf)
          Invoked from parser if new configuration is available.
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String name)
          End element, event from SAX parser.
 DispatchAction getDefaultDispatchAction()
          Default action is "send"
 java.lang.String getDefaultStatus()
          Is null if not set with xml configuration
 StatusConfiguration getStatusConfiguration(ConnectionStateEnum currConnectionState)
          Access the configuration for the given state of the dispatcher connection
 StatusConfiguration getStatusConfiguration(java.lang.String currStatus)
          Access the configuration for the given status
 java.util.Map getStatusConfigurationMap()
          Access the internal map holding all status configurations.
private  void parseIt(java.lang.String xmlLiteral)
           
 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.
 
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
 

Field Detail

ME

private java.lang.String ME

glob

private final Global glob

log

private static java.util.logging.Logger log

inMsgDispatch

private boolean inMsgDispatch

inAction

private boolean inAction

inOnStatus

private boolean inOnStatus

defaultAction

private DispatchAction defaultAction

defaultStatus

private java.lang.String defaultStatus

statusConfiguration

private StatusConfiguration statusConfiguration

configurationContentMap

private final java.util.Map configurationContentMap
key='status message content', value='StatusConfiguration instances'


pluginType

private java.lang.String pluginType

pluginVersion

private java.lang.String pluginVersion
Constructor Detail

ConfigurationParser

public ConfigurationParser(Global glob,
                           java.lang.String xmlLiteral)
                    throws XmlBlasterException
Parameters:
the - XML based ASCII string
Throws:
XmlBlasterException
Method Detail

parseIt

private final void parseIt(java.lang.String xmlLiteral)
                    throws XmlBlasterException
Throws:
XmlBlasterException

getDefaultDispatchAction

public final DispatchAction getDefaultDispatchAction()
Default action is "send"


getDefaultStatus

public final java.lang.String getDefaultStatus()
Is null if not set with xml configuration


addStatusConfiguration

void addStatusConfiguration(StatusConfiguration conf)
Invoked from parser if new configuration is available.


getStatusConfiguration

public final StatusConfiguration getStatusConfiguration(java.lang.String currStatus)
Access the configuration for the given status

Returns:
never null

getStatusConfiguration

public final StatusConfiguration getStatusConfiguration(ConnectionStateEnum currConnectionState)
Access the configuration for the given state of the dispatcher connection

Returns:
null if no configuration is found
See Also:
DispatchConnectionsHandler

getStatusConfigurationMap

public final java.util.Map getStatusConfigurationMap()
Access the internal map holding all status configurations.

You need to synchronize on it on usage.

Returns:
map with key='status message content', value='StatusConfiguration instances'

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

xmlBlaster 2.1.0 API

Copyright © 1999-2011 The xmlBlaster.org contributers.