Apache Qpid C++ API
Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET Apache Qpid Documentation

qmf::Agent Class Reference
[Qpid Management Framework C++ API]

The Agent class is the QMF Agent portal. More...

#include <qmf/Agent.h>

List of all members.

Public Member Functions

QMF_EXTERN Agent (char *label="qmfa", bool internalStore=true, AgentListener *listener=0)
 Create an instance of the Agent class.
QMF_EXTERN ~Agent ()
 Destroy an instance of the Agent class.
QMF_EXTERN void setStoreDir (const char *path)
 Set the persistent store file.
QMF_EXTERN void setConnection (Connection *conn)
 Provide a connection (to a Qpid broker) over which the agent can communicate.
QMF_EXTERN void registerClass (SchemaObjectClass *cls)
 Register a class schema (object or event) with the agent.
QMF_EXTERN void registerClass (SchemaEventClass *cls)
QMF_EXTERN const ObjectId * addObject (AgentObject &obj, bool persistent=false, uint64_t oid=0)
 Add an object to the agent (for internal storage mode only).
QMF_EXTERN const ObjectId * addObject (AgentObject &obj, bool persistent, uint32_t oidLo, uint32_t oidHi)
QMF_EXTERN const ObjectId * allocObjectId (bool persistent=false, uint64_t oid=0)
 Allocate an object ID for an object (for external storage mode only).
QMF_EXTERN const ObjectId * allocObjectId (bool persistent, uint32_t oidLo, uint32_t oidHi)
QMF_EXTERN void raiseEvent (Event &event)
 Raise a QMF event.
QMF_EXTERN void queryResponse (uint32_t context, AgentObject &object, bool prop=true, bool stat=true)
 Provide a response to a query (for external storage mode only).
QMF_EXTERN void queryComplete (uint32_t context)
 Indicate that a query (or the initial dump of a sync) is complete (for external storage mode only).
QMF_EXTERN void methodResponse (uint32_t context, const Value &args, uint32_t status=0, const Value *exception=0)
 Provide the response to a method call.

Detailed Description

The Agent class is the QMF Agent portal.

It should be instantiated once and associated with a Connection (setConnection) to connect an agent to the QMF infrastructure.

Definition at line 151 of file Agent.h.


Constructor & Destructor Documentation

QMF_EXTERN qmf::Agent::Agent ( char *  label = "qmfa",
bool  internalStore = true,
AgentListener listener = 0 
)

Create an instance of the Agent class.

Parameters:
label An optional string label that can be used to identify the agent.
internalStore If true, objects shall be tracked internally by the agent. If false, the user of the agent must track the objects. If the agent is tracking the objects, queries and syncs are handled by the agent. The only involvement the user has is to optionally authorize individual operations. If the user is tracking the objects, the user code must implement queries and syncs (standing queries).
listener A pointer to a class that implements the AgentListener interface. This must be supplied if any of the following conditions are true:

  • The agent model contains methods
  • The user wishes to individually authorize query and sync operations.
  • internalStore = false
QMF_EXTERN qmf::Agent::~Agent (  ) 

Destroy an instance of the Agent class.


Member Function Documentation

QMF_EXTERN const ObjectId* qmf::Agent::addObject ( AgentObject obj,
bool  persistent,
uint32_t  oidLo,
uint32_t  oidHi 
)
QMF_EXTERN const ObjectId* qmf::Agent::addObject ( AgentObject obj,
bool  persistent = false,
uint64_t  oid = 0 
)

Add an object to the agent (for internal storage mode only).

Parameters:
obj Reference to the object to be managed by the agent.
persistent Iff true, the object ID assigned to the object shall indicate persistence (i.e. the object ID shall be the same across restarts of the agent program).
oid 64-bit value for the oid (if zero, the agent will assign the value).
oidLo 32-bit value for the lower 32-bits of the oid.
oidHi 32-bit value for the upper 32-bits of the oid.
QMF_EXTERN const ObjectId* qmf::Agent::allocObjectId ( bool  persistent,
uint32_t  oidLo,
uint32_t  oidHi 
)
QMF_EXTERN const ObjectId* qmf::Agent::allocObjectId ( bool  persistent = false,
uint64_t  oid = 0 
)

Allocate an object ID for an object (for external storage mode only).

Parameters:
persistent Iff true, the object ID allocated shall indicate persistence (i.e. the object ID shall be the same across restarts of the agent program).
oid 64-bit value for the oid (if zero, the agent will assign the value).
oidLo 32-bit value for the lower 32-bits of the oid.
oidHi 32-bit value for the upper 32-bits of the oid.
QMF_EXTERN void qmf::Agent::methodResponse ( uint32_t  context,
const Value &  args,
uint32_t  status = 0,
const Value *  exception = 0 
)

Provide the response to a method call.

Parameters:
context The context value supplied in the method request (via the AgentListener interface).
args The argument list from the method call. Must include the output arguments (may include the input arguments).
status Numerical return status: zero indicates no error, non-zero indicates error.
exception Pointer to an exception value. If status is non-zero, the exception value is sent to the caller. It is optional (i.e. leave the pointer as 0), or may be set to any legal value. A string may be supplied, but an unmanaged object of any schema may also be passed.
QMF_EXTERN void qmf::Agent::queryComplete ( uint32_t  context  ) 

Indicate that a query (or the initial dump of a sync) is complete (for external storage mode only).

Parameters:
context The context value supplied in the query/sync (via the AgentListener interface).
QMF_EXTERN void qmf::Agent::queryResponse ( uint32_t  context,
AgentObject object,
bool  prop = true,
bool  stat = true 
)

Provide a response to a query (for external storage mode only).

Parameters:
context The context value supplied in the query (via the AgentListener interface).
object A reference to the agent that matched the query criteria.
prop If true, transmit the property attributes of this object.
stat If true, transmit the statistic attributes of this object.
QMF_EXTERN void qmf::Agent::raiseEvent ( Event &  event  ) 

Raise a QMF event.

Parameters:
event Reference to an event object to be raised to the QMF infrastructure.
QMF_EXTERN void qmf::Agent::registerClass ( SchemaEventClass *  cls  ) 
QMF_EXTERN void qmf::Agent::registerClass ( SchemaObjectClass *  cls  ) 

Register a class schema (object or event) with the agent.

The agent must have a registered schema for an object class or an event class before it can handle objects or events of that class.

Parameters:
cls Pointer to the schema structure describing the class.
QMF_EXTERN void qmf::Agent::setConnection ( Connection conn  ) 

Provide a connection (to a Qpid broker) over which the agent can communicate.

Parameters:
conn Pointer to a Connection object.
QMF_EXTERN void qmf::Agent::setStoreDir ( const char *  path  ) 

Set the persistent store file.

This file, if specified, is used to store state information about the Agent. For example, if object-ids must be persistent across restarts of the Agent program, this file path must be supplied.

Parameters:
path Full path to a file that is both writable and readable by the Agent program.

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

Qpid C++ API Reference
Generated on Mon Jun 7 17:49:08 2010 for Qpid C++ Client API by doxygen 1.6.2-20100208