org::xmlBlaster::util::key::KeyData Class Reference

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

Inheritance diagram for org::xmlBlaster::util::key::KeyData:

Inheritance graph
[legend]
Collaboration diagram for org::xmlBlaster::util::key::KeyData:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 KeyData (org::xmlBlaster::util::Global &global)
 Minimal constructor.
 KeyData (const KeyData &key)
 Copy constructor.
KeyDataoperator= (const KeyData &key)
 Assignement constructor.
virtual ~KeyData ()
void setOid (const std::string &oid)
std::string getOid () const
 
Returns:
The key oid or null if not set (see org::xmlBlaster::util::key::MsgKeyData.getOid() which generates the oid if it was null).

bool isDeadMessage () const
 Test if oid is '__sys__deadMessage'.
bool isPluginInternal () const
 Messages starting with "_" are reserved for usage in plugins.
bool isInternal () const
 Messages starting with "__" are reserved for internal usage.
bool isAdministrative () const
 Messages starting with "__cmd:" are administrative messages.
void setContentMime (const std::string &contentMime)
 Set mime type (syntax) of the message content.
std::string getContentMime () const
 Find out which mime type (syntax) the content of the message has.
void setContentMimeExtended (const std::string &contentMimeExtended)
 Some further specifying information of the content.
std::string getContentMimeExtended () const
 Some further specifying information of the content.
void setDomain (const std::string &domain)
 Set the domain for this message, can be used for a simple grouping of messages to their master node with xmlBlaster clusters.
std::string getDomain () const
 Access the domain setting.
bool isDefaultDomain () const
 
Returns:
true if no domain is given (null or empty std::string).

std::string getQueryType () const
 Access the query type "XPATH" or "EXACT".
bool isExact () const
bool isQuery () const
bool isXPath () const
bool isDomain () const
int size () const
 The size in bytes of the data in XML form.
virtual std::string toXml (const std::string &extraOffset) const
 Dump state of this object into a XML ASCII std::string.
virtual std::string toXml () const
virtual KeyDatagetClone () const
 Allocate a clone, the derived classes need to implement this method.
std::string generateOid (const std::string &uniquePrefix) const
 Generates a unique key oid in scope of a cluster node (on server or on client side).
bool isGeneratedOid () const
 
Returns:
true if the key oid is generated by xmlBlaster


Protected Member Functions

void init ()
void copy (const KeyData &key)

Protected Attributes

std::string ME
org::xmlBlaster::util::Globalglobal_
org::xmlBlaster::util::I_Loglog_
std::string oid_
 value from attribute <key oid="...">
std::string contentMime_
 value from attribute <key oid="" contentmime="...">
std::string contentMimeExtended_
 value from attribute <key oid="" contentmimeextended="...">
std::string domain_
 value from attribute <key oid="" domain="...">
bool isGeneratedOid_
 Is the key oid generated?
std::string queryType_
 The query type.
std::string queryString_
 The query std::string.

Detailed Description

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.

Definition at line 50 of file KeyData.h.


Constructor & Destructor Documentation

org::xmlBlaster::util::key::KeyData::KeyData ( org::xmlBlaster::util::Global global  ) 

Minimal constructor.

Definition at line 46 of file KeyData.cpp.

org::xmlBlaster::util::key::KeyData::KeyData ( const KeyData key  ) 

Copy constructor.

org::xmlBlaster::util::key::KeyData::~KeyData (  )  [virtual]

Definition at line 64 of file KeyData.cpp.


Member Function Documentation

void org::xmlBlaster::util::key::KeyData::init (  )  [protected]

Definition at line 24 of file KeyData.cpp.

References contentMime_, contentMimeExtended_, org::xmlBlaster::util::key::DEFAULT_DOMAIN, domain_, isGeneratedOid_, oid_, queryString_, queryType_, and org::xmlBlaster::util::key::QUERYTYPE_DEFAULT.

void org::xmlBlaster::util::key::KeyData::copy ( const KeyData key  )  [protected]

KeyData& org::xmlBlaster::util::key::KeyData::operator= ( const KeyData key  ) 

Assignement constructor.

void org::xmlBlaster::util::key::KeyData::setOid ( const std::string &  oid  ) 

Reimplemented in org::xmlBlaster::util::key::QueryKeyData.

std::string org::xmlBlaster::util::key::KeyData::getOid (  )  const

Returns:
The key oid or null if not set (see org::xmlBlaster::util::key::MsgKeyData.getOid() which generates the oid if it was null).

Reimplemented in org::xmlBlaster::util::key::MsgKeyData.

Referenced by org::xmlBlaster::util::dispatch::ConnectionsHandler::publish(), and org::xmlBlaster::util::dispatch::ConnectionsHandler::queuePublish().

bool org::xmlBlaster::util::key::KeyData::isDeadMessage (  )  const

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)

bool org::xmlBlaster::util::key::KeyData::isPluginInternal (  )  const

Messages starting with "_" are reserved for usage in plugins.

bool org::xmlBlaster::util::key::KeyData::isInternal (  )  const

Messages starting with "__" are reserved for internal usage.

bool org::xmlBlaster::util::key::KeyData::isAdministrative (  )  const

Messages starting with "__cmd:" are administrative messages.

void org::xmlBlaster::util::key::KeyData::setContentMime ( const std::string &  contentMime  ) 

Set mime type (syntax) of the message content.

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)

std::string org::xmlBlaster::util::key::KeyData::getContentMime (  )  const

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)

Referenced by org::xmlBlaster::test::TestKeys::testPublishKey().

void org::xmlBlaster::util::key::KeyData::setContentMimeExtended ( const std::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 std::string) if not known

std::string org::xmlBlaster::util::key::KeyData::getContentMimeExtended (  )  const

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 std::string) if not known

Referenced by org::xmlBlaster::test::TestKeys::testPublishKey().

void org::xmlBlaster::util::key::KeyData::setDomain ( const std::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 std::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

std::string org::xmlBlaster::util::key::KeyData::getDomain (  )  const

Access the domain setting.

Returns:
A domain std::string or null

bool org::xmlBlaster::util::key::KeyData::isDefaultDomain (  )  const

Returns:
true if no domain is given (null or empty std::string).

std::string org::xmlBlaster::util::key::KeyData::getQueryType (  )  const

Access the query type "XPATH" or "EXACT".

Returns:
A queryType std::string or null

bool org::xmlBlaster::util::key::KeyData::isExact (  )  const

bool org::xmlBlaster::util::key::KeyData::isQuery (  )  const

bool org::xmlBlaster::util::key::KeyData::isXPath (  )  const

bool org::xmlBlaster::util::key::KeyData::isDomain (  )  const

int org::xmlBlaster::util::key::KeyData::size (  )  const

The size in bytes of the data in XML form.

virtual std::string org::xmlBlaster::util::key::KeyData::toXml ( const std::string &  extraOffset  )  const [virtual]

Dump state of this object into a XML ASCII std::string.


Needs to be implemented by derived classes.

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

Reimplemented in org::xmlBlaster::util::key::MsgKeyData, and org::xmlBlaster::util::key::QueryKeyData.

Referenced by org::xmlBlaster::client::protocol::corba::CorbaConnection::copyToCorba(), org::xmlBlaster::util::queue::MsgQueueEntry::getEmbeddedObject(), and org::xmlBlaster::client::protocol::socket::SocketDriver::publish().

virtual std::string org::xmlBlaster::util::key::KeyData::toXml (  )  const [virtual]

Reimplemented in org::xmlBlaster::util::key::MsgKeyData, and org::xmlBlaster::util::key::QueryKeyData.

virtual KeyData* org::xmlBlaster::util::key::KeyData::getClone (  )  const [virtual]

Allocate a clone, the derived classes need to implement this method.

Returns:
The caller needs to free it with 'delete'.

Reimplemented in org::xmlBlaster::util::key::MsgKeyData, and org::xmlBlaster::util::key::QueryKeyData.

std::string org::xmlBlaster::util::key::KeyData::generateOid ( const std::string &  uniquePrefix  )  const

Generates a unique key oid in scope of a cluster node (on server or on client side).

Parameters:
glob.getStrippedId() on server side

bool org::xmlBlaster::util::key::KeyData::isGeneratedOid (  )  const

Returns:
true if the key oid is generated by xmlBlaster


Member Data Documentation

std::string org::xmlBlaster::util::key::KeyData::ME [protected]

Definition at line 53 of file KeyData.h.

org::xmlBlaster::util::Global& org::xmlBlaster::util::key::KeyData::global_ [protected]

Definition at line 54 of file KeyData.h.

org::xmlBlaster::util::I_Log& org::xmlBlaster::util::key::KeyData::log_ [protected]

Definition at line 55 of file KeyData.h.

std::string org::xmlBlaster::util::key::KeyData::oid_ [mutable, protected]

value from attribute <key oid="...">

Definition at line 58 of file KeyData.h.

Referenced by init().

std::string org::xmlBlaster::util::key::KeyData::contentMime_ [protected]

value from attribute <key oid="" contentmime="...">

Definition at line 61 of file KeyData.h.

Referenced by init().

std::string org::xmlBlaster::util::key::KeyData::contentMimeExtended_ [protected]

value from attribute <key oid="" contentmimeextended="...">

Definition at line 64 of file KeyData.h.

Referenced by init().

std::string org::xmlBlaster::util::key::KeyData::domain_ [protected]

value from attribute <key oid="" domain="...">

Definition at line 67 of file KeyData.h.

Referenced by init().

bool org::xmlBlaster::util::key::KeyData::isGeneratedOid_ [mutable, protected]

Is the key oid generated?

Definition at line 70 of file KeyData.h.

Referenced by init().

std::string org::xmlBlaster::util::key::KeyData::queryType_ [protected]

The query type.

Definition at line 73 of file KeyData.h.

Referenced by init().

std::string org::xmlBlaster::util::key::KeyData::queryString_ [protected]

The query std::string.

Definition at line 76 of file KeyData.h.

Referenced by init().


The documentation for this class was generated from the following files: