xmlBlaster 2.2.0 API

org.xmlBlaster.engine.xml2java
Class XmlKey

java.lang.Object
  extended by org.xmlBlaster.engine.xml2java.XmlKey

public final class XmlKey
extends java.lang.Object

This class encapsulates the Message meta data and unique identifier.

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

A typical subscribe key could look like this:

     <key oid='4711' queryType='EXACT'/>
 

In this example you would subscribe on message 4711.

A typical subscribe using XPath query syntax could look like this:

     <key oid='' queryType='XPATH'>
        //DRIVER[@id='FileProof']
     </key>
 

In this example you would subscribe on all DRIVERs which have the attribute 'FileProof'

A cluster query checking the domain attribute could look like this:

     <key oid='' queryType='DOMAIN' domain='RUGBY'/>
 

NOTE: The 'XPATH' query covers the 'DOMAIN' and 'EXACT' query, but is far slower. Therefore you should try to use EXACT or in a cluster environment DOMAIN queries first.
More examples you find in xmlBlaster/src/dtd/XmlKey.xml

Author:
xmlBlaster@marcelruff.info
See Also:
The W3C XPath specification

Field Summary
 int ASCII_TYPE
           
private  ServerScope glob
           
protected  KeyData keyData
           
private  int keyType
           
private static java.util.logging.Logger log
           
private  java.lang.String ME
           
 int XML_TYPE
           
private  org.w3c.dom.Document xmlKeyDoc
          A DOM tree containing exactly one (this) message to allow XPath subscriptions to check if this message matches
private  XmlToDom xmlToDom
           
 
Constructor Summary
XmlKey(ServerScope glob, KeyData keyData)
          Parses given xml string
XmlKey(ServerScope glob, java.lang.String xmlKey_literal)
          Parses given xml string
 
Method Summary
 void cleanupMatch()
          After the existing XPath subscriptions have queried this message we should release the DOM tree.
 java.lang.String getContentMime()
           
 java.lang.String getContentMimeExtended()
           
 java.lang.String getDomain()
           
 KeyData getKeyData()
           
 java.lang.String getKeyOid()
          Deprecated. use getOid()
 java.lang.String getOid()
          Accessing the unique oid of .
 org.w3c.dom.Node getRootNode()
          Fills the DOM tree, and assures that a valid is used.
 java.lang.String getUniqueKey()
          Deprecated. use getOid()
 boolean isAdministrative()
           
 boolean isDeadMessage()
           
 boolean isDefaultDomain()
           
 boolean isInternal()
          Messages starting with "__" are reserved for internal usage
 boolean isPluginInternal()
          Messages starting with "_" are reserved for usage in plugins
 java.lang.String literal()
          Access the literal XML-ASCII xmlKey.
private  void loadDomTree()
          Fills the DOM tree, and assures that a valid
 boolean match(QueryKeyData queryKey)
          Allows to check if this xmlKey matches the given query.
 boolean match(java.lang.String xpath)
          We need this to allow checking if an existing XPath subscription matches this new message type.
 void mergeRootNode(I_MergeDomNode merger)
          Should be called by publish() to merge the local XmlKey DOM into the big xmlBlaster DOM tree
 java.lang.String toString()
          Access the literal ASCII xmlKey.
 java.lang.String toXml()
          Access the literal ASCII xmlKey.
 
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 ServerScope glob

log

private static java.util.logging.Logger log

xmlToDom

private XmlToDom xmlToDom

XML_TYPE

public final int XML_TYPE
See Also:
Constant Field Values

ASCII_TYPE

public final int ASCII_TYPE
See Also:
Constant Field Values

keyType

private int keyType

keyData

protected KeyData keyData

xmlKeyDoc

private org.w3c.dom.Document xmlKeyDoc
A DOM tree containing exactly one (this) message to allow XPath subscriptions to check if this message matches
    <xmlBlaster>
       <key oid='xx'>
           ...
       </key>
    </xmlBlaster>
 

Constructor Detail

XmlKey

public XmlKey(ServerScope glob,
              KeyData keyData)
Parses given xml string

Parameters:
The - original key in XML syntax, for example:

XmlKey

public XmlKey(ServerScope glob,
              java.lang.String xmlKey_literal)
       throws XmlBlasterException
Parses given xml string

Parameters:
The - original key in XML syntax, for example:
Throws:
XmlBlasterException
Method Detail

getKeyData

public KeyData getKeyData()

isDeadMessage

public final boolean isDeadMessage()
                            throws XmlBlasterException
Throws:
XmlBlasterException
See Also:
KeyData.isDeadMessage()

toString

public final java.lang.String toString()
Access the literal ASCII xmlKey.

Overrides:
toString in class java.lang.Object
Returns:
the literal ASCII xmlKey
See Also:
literal()

toXml

public java.lang.String toXml()
Access the literal ASCII xmlKey.

Returns:
the literal ASCII xmlKey
See Also:
literal()

literal

public final java.lang.String literal()
Access the literal XML-ASCII xmlKey.

Note that this may vary from the original ASCII string:
When the key oid was generated locally, the literal string contains this new generated oid as well.

Returns:
the literal ASCII xmlKey

getUniqueKey

public final java.lang.String getUniqueKey()
Deprecated. use getOid()


getKeyOid

public final java.lang.String getKeyOid()
Deprecated. use getOid()


getOid

public final java.lang.String getOid()
Accessing the unique oid of .

Returns:
oid

getContentMime

public final java.lang.String getContentMime()

getContentMimeExtended

public final java.lang.String getContentMimeExtended()

getDomain

public final java.lang.String getDomain()

isDefaultDomain

public final boolean isDefaultDomain()

isPluginInternal

public final boolean isPluginInternal()
Messages starting with "_" are reserved for usage in plugins


isInternal

public final boolean isInternal()
Messages starting with "__" are reserved for internal usage


isAdministrative

public final boolean isAdministrative()

getRootNode

public org.w3c.dom.Node getRootNode()
                             throws XmlBlasterException
Fills the DOM tree, and assures that a valid is used.

Throws:
XmlBlasterException

loadDomTree

private void loadDomTree()
                  throws XmlBlasterException
Fills the DOM tree, and assures that a valid
<key oid="">
is used.

Throws:
XmlBlasterException

mergeRootNode

public final void mergeRootNode(I_MergeDomNode merger)
                         throws XmlBlasterException
Should be called by publish() to merge the local XmlKey DOM into the big xmlBlaster DOM tree

Throws:
XmlBlasterException

match

public final boolean match(QueryKeyData queryKey)
                    throws XmlBlasterException
Allows to check if this xmlKey matches the given query.

Parameters:
queryKey - An XmlKey object containing a query (XPATH, EXACT or DOMAIN)
Returns:
true if this message key matches the query
Throws:
XmlBlasterException

match

public final boolean match(java.lang.String xpath)
                    throws XmlBlasterException
We need this to allow checking if an existing XPath subscription matches this new message type.

Note that we manipulate the XML key and add a surrounding root node <xmlBlaster>

Parameters:
xpath - The XPath query, check if it matches to this xmlKey
Returns:
true if this message meta data matches the XPath query
Throws:
XmlBlasterException

cleanupMatch

public void cleanupMatch()
After the existing XPath subscriptions have queried this message we should release the DOM tree.


xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.