xmlBlaster 2.2.0 client API

org.xmlBlaster.util.key
Class MsgKeyData

java.lang.Object
  extended by org.xmlBlaster.util.key.KeyData
      extended by org.xmlBlaster.util.key.MsgKeyData
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public final class MsgKeyData
extends KeyData
implements java.io.Serializable, java.lang.Cloneable

This class encapsulates the Message meta data and unique identifier (key) of a publish()/update() or get()-return message.

A typical key could look like this:

c* 

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

If you haven't specified a key oid, there will be generated one automatically.

NOTE: Message oid starting with "__" is reserved for internal usage.

NOTE: Message oid starting with "_" is reserved for xmlBlaster plugins.

NOTE: The application specific tags and their attributes (like AGENT or DRIVER in the above example) are received as a 'raw' XML ASCII string in the update() method of a client. If a client wants to look at it she needs to parse it herself, usually by using an XML parser (DOM or SAX). Some weird people even use regular expressions to do so.

See Also:
MsgKeySaxFactory, Serialized Form

Field Summary
 
Fields inherited from class org.xmlBlaster.util.key.KeyData
CONTENTMIME_DEFAULT, CONTENTMIMEEXTENDED_DEFAULT, DEFAULT_DOMAIN, glob, queryString, queryType, QUERYTYPE_DEFAULT, serialData
 
Constructor Summary
MsgKeyData(Global glob)
          Minimal constructor.
MsgKeyData(Global glob, I_MsgKeyFactory factory, java.lang.String serialData)
          Constructor to parse a message.
MsgKeyData(Global glob, java.lang.String serialData)
          Constructor to parse a message.
 
Method Summary
 java.lang.Object clone()
          Returns a shallow clone, you can change safely all basic or immutable types like boolean, String, int.
 java.lang.String getClientTags()
          The XML meta information of the topic.
 java.lang.String getOid()
           
static void main(java.lang.String[] args)
          java org.xmlBlaster.util.key.MsgKeyData
 void setClientTags(java.lang.String tags)
          Set client specific meta informations.
 java.util.Hashtable toJXPath()
          Dump the key to a flattened JXPath representation.
 java.lang.String toXml()
          Converts the data in XML ASCII string.
 java.lang.String toXml(java.lang.String extraOffset)
          Dump state of this object into a XML ASCII string.
 
Methods inherited from class org.xmlBlaster.util.key.KeyData
equals, generateOid, getContentMime, getContentMimeExtended, getDomain, getGlobal, getQueryString, getQueryType, getUrl, hasOid, isAdministrative, isDeadMessage, isDefaultDomain, isDomain, isExact, isInternal, isPluginInternal, isQuery, isRemoteProperties, isRunlevelManager, isXPath, setContentMime, setContentMimeExtended, setDomain, setGlobal, setOid, setQueryType, size, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MsgKeyData

public MsgKeyData(Global glob)
Minimal constructor.


MsgKeyData

public MsgKeyData(Global glob,
                  java.lang.String serialData)
Constructor to parse a message.

Parameters:
factory - If null, the default factory from Global is used.

MsgKeyData

public MsgKeyData(Global glob,
                  I_MsgKeyFactory factory,
                  java.lang.String serialData)
Constructor to parse a message.

Parameters:
factory - If null, the default factory from Global is used.
Method Detail

getOid

public java.lang.String getOid()
Overrides:
getOid in class KeyData
Returns:
never null, an oid is generated if it was null.

setClientTags

public void setClientTags(java.lang.String tags)
Set client specific meta informations.

May be used to integrate your application tags, for example:

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

Parameters:
str - Your tags in ASCII XML syntax

getClientTags

public java.lang.String getClientTags()
The XML meta information of the topic.

Returns:
Can be null

toXml

public java.lang.String toXml()
Converts the data in XML ASCII string.

Specified by:
toXml in class KeyData
Returns:
An XML ASCII string

toXml

public java.lang.String toXml(java.lang.String extraOffset)
Dump state of this object into a XML ASCII string.

Specified by:
toXml in class KeyData
Parameters:
extraOffset - indenting of tags for nice output
Returns:
internal state of the query as a XML ASCII string

clone

public java.lang.Object clone()
Returns a shallow clone, you can change safely all basic or immutable types like boolean, String, int.

Overrides:
clone in class KeyData

toJXPath

public java.util.Hashtable toJXPath()
Dump the key to a flattened JXPath representation.

This is experimental code for the simple Applet client

   /key/@oid                 -> Rugby
   /key/@contentMime         -> text/plain
   /key/@contentMimeExtended -> Version-1.0
   /key/child::node()        -> <myTeam>Munich<numPlayers>6</numPlayers></myTeam>
 

See Also:
Apache JXPath

main

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


xmlBlaster 2.2.0 client API

Copyright © 1999-2014 The xmlBlaster.org contributers.