xmlBlaster 2.2.0 client API

org.xmlBlaster.util.key
Class KeyData

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

public abstract class KeyData
extends java.lang.Object
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:

     <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 to the setClientTags() method.
A well designed xml hierarchy of your problem domain is essential for a proper working xmlBlaster

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

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

See Also:
MsgKeySaxFactory, Serialized Form

Field Summary
static java.lang.String CONTENTMIME_DEFAULT
          The default content MIME type is "text/plain"
static java.lang.String CONTENTMIMEEXTENDED_DEFAULT
          The default content MIME extended type is null
static java.lang.String DEFAULT_DOMAIN
          is ""
protected  Global glob
           
protected  java.lang.String queryString
          The query string
protected  java.lang.String queryType
          The query type
static java.lang.String QUERYTYPE_DEFAULT
          The default queryType is "EXACT"
protected  java.lang.String serialData
           
 
Constructor Summary
KeyData(Global glob, java.lang.String serialData)
          Minimal constructor.
 
Method Summary
 java.lang.Object clone()
          Returns a shallow clone, you can change savely all basic or immutable types like boolean, String, int.
 boolean equals(KeyData other)
          Check if same query is used
 java.lang.String generateOid(java.lang.String uniquePrefix)
          Generates a unique key oid in scope of a cluster node (on server or on client side).
 java.lang.String getContentMime()
          Find out which mime type (syntax) the content of the message has.
 java.lang.String getContentMimeExtended()
          Some further specifying information of the content.
 java.lang.String getDomain()
          Access the domain setting
 Global getGlobal()
           
 java.lang.String getOid()
           
 java.lang.String getQueryString()
          Access the query string like "//key"
 java.lang.String getQueryType()
          Access the query type "XPATH" or "EXACT"
 java.lang.String getUrl()
          Access simplified URL like string.
 boolean hasOid()
           
 boolean isAdministrative()
          Messages starting with "__cmd:" are administrative messages
 boolean isDeadMessage()
          Test if oid is '__sys__deadMessage'.
 boolean isDefaultDomain()
           
 boolean isDomain()
           
 boolean isExact()
           
 boolean isInternal()
          Messages starting with "__" are reserved for internal usage
 boolean isPluginInternal()
          Messages starting with "_" are reserved for usage in plugins
 boolean isQuery()
           
 boolean isRemoteProperties()
          __sys__remoteProperties
 boolean isRunlevelManager()
          __sys__remoteProperties
 boolean isXPath()
           
 void setContentMime(java.lang.String contentMime)
          Set mime type (syntax) of the message content.
 void setContentMimeExtended(java.lang.String contentMimeExtended)
          Some further specifying information of the content.
 void setDomain(java.lang.String domain)
          Set the domain for this message, can be used for a simple grouping of messages to their master node with xmlBlaster clusters.
 void setGlobal(Global glob)
          Sets the global object (used when deserializing the object)
 void setOid(java.lang.String oid)
           
 void setQueryType(java.lang.String queryType)
           
 int size()
          The size in bytes of the data in XML form.
 java.lang.String toString()
          Converts the data in XML ASCII string.
abstract  java.lang.String toXml()
          Converts the data in XML ASCII string.
abstract  java.lang.String toXml(java.lang.String extraOffset)
          Dump state of this object into a XML ASCII string.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

glob

protected transient Global glob

serialData

protected final transient java.lang.String serialData

CONTENTMIME_DEFAULT

public static final transient java.lang.String CONTENTMIME_DEFAULT
The default content MIME type is "text/plain"

See Also:
Constant Field Values

CONTENTMIMEEXTENDED_DEFAULT

public static final transient java.lang.String CONTENTMIMEEXTENDED_DEFAULT
The default content MIME extended type is null


DEFAULT_DOMAIN

public static final transient java.lang.String DEFAULT_DOMAIN
is ""


QUERYTYPE_DEFAULT

public static final transient java.lang.String QUERYTYPE_DEFAULT
The default queryType is "EXACT"

See Also:
Constant Field Values

queryType

protected java.lang.String queryType
The query type


queryString

protected java.lang.String queryString
The query string

Constructor Detail

KeyData

public KeyData(Global glob,
               java.lang.String serialData)
Minimal constructor.

Method Detail

setGlobal

public void setGlobal(Global glob)
Sets the global object (used when deserializing the object)


setOid

public void setOid(java.lang.String oid)

getOid

public java.lang.String getOid()
Returns:
The key oid or null if not set (see MsgKeyData.getOid() which generates the oid if it was null).

hasOid

public boolean hasOid()

getUrl

public java.lang.String getUrl()
Access simplified URL like string.

Returns:
examples are "exact:hello", "xpath://key", "domain:sport"

isDeadMessage

public final boolean isDeadMessage()
Test if oid is '__sys__deadMessage'.

Dead letters are unrecoverable lost messages, usually an administrator should subscribe to those messages.

This is an internal message (isInternal() returns true)


isRemoteProperties

public final boolean isRemoteProperties()
__sys__remoteProperties

Returns:

isRunlevelManager

public final boolean isRunlevelManager()
__sys__remoteProperties

Returns:

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()
Messages starting with "__cmd:" are administrative messages


setContentMime

public void setContentMime(java.lang.String contentMime)
Set mime type (syntax) of the message content.

See Also:
RFC1521 - MIME (Multipurpose Internet Mail Extensions)

getContentMime

public java.lang.String getContentMime()
Find out which mime type (syntax) the content of the message has.

Returns:
The MIME type, for example "text/xml" in <key oid='' contentMime='text/xml'>
default is "text/plain" if not set
See Also:
RFC1521 - MIME (Multipurpose Internet Mail Extensions)

setContentMimeExtended

public void setContentMimeExtended(java.lang.String contentMimeExtended)
Some further specifying information of the content.

For example the application version number the document in the content.
You may use this attribute for you own purposes.

Parameters:
The - MIME-extended info, for example
"Version 1.1" in <key oid='' contentMime='text/xml' contentMimeExtended='Version 1.1'>
or "" (empty string) if not known

getContentMimeExtended

public java.lang.String getContentMimeExtended()
Some further specifying information of the content.

For example the application version number the document in the content.
You may use this attribute for you own purposes.

Returns:
The MIME-extended info, for example
"Version 1.1" in <key oid='' contentMime='text/xml' contentMimeExtended='Version 1.1'>
or "" (empty string) if not known

setDomain

public void setDomain(java.lang.String domain)
Set the domain for this message, can be used for a simple grouping of messages to their master node with xmlBlaster clusters.

Parameters:
The - domain, any chosen string in your problem domain, e.g. "RUGBY" or "RADAR_TRACK" defaults to "" where the local xmlBlaster instance is the master of the message.
See Also:
The cluster requirement

getDomain

public java.lang.String getDomain()
Access the domain setting

Returns:
A domain string or null

isDefaultDomain

public final boolean isDefaultDomain()
Returns:
true if no domain is given (null or empty string).

getQueryType

public java.lang.String getQueryType()
Access the query type "XPATH" or "EXACT"

Returns:
A queryType string or null

setQueryType

public void setQueryType(java.lang.String queryType)
                  throws XmlBlasterException
Throws:
XmlBlasterException

getQueryString

public java.lang.String getQueryString()
Access the query string like "//key"

Returns:
A query string or null

isExact

public boolean isExact()

isQuery

public boolean isQuery()

isXPath

public boolean isXPath()

isDomain

public boolean isDomain()

equals

public boolean equals(KeyData other)
Check if same query is used


size

public int size()
The size in bytes of the data in XML form.


toString

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

Overrides:
toString in class java.lang.Object
Returns:
An XML ASCII string

toXml

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

Returns:
An XML ASCII string

toXml

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

Parameters:
extraOffset - indenting of tags for nice output
Returns:
internal state of the query as a XML ASCII string

generateOid

public java.lang.String generateOid(java.lang.String uniquePrefix)
Generates a unique key oid in scope of a cluster node (on server or on client side).

Parameters:
glob.getStrippedId() - on server side

getGlobal

public final Global getGlobal()

clone

public java.lang.Object clone()
Returns a shallow clone, you can change savely all basic or immutable types like boolean, String, int. Currently RouteInfo is not cloned (so don't change it)

Overrides:
clone in class java.lang.Object

xmlBlaster 2.2.0 client API

Copyright © 1999-2014 The xmlBlaster.org contributers.