diff options
| author | Ted Ross <tross@apache.org> | 2010-09-21 21:48:41 +0000 |
|---|---|---|
| committer | Ted Ross <tross@apache.org> | 2010-09-21 21:48:41 +0000 |
| commit | 3cfbdf0e60c94733c0a79e94bdf8627afc6bb2a4 (patch) | |
| tree | e33d57bca9a2c2275e76f882484ac3ea913e83fd /cpp/include | |
| parent | 449ab0f1062c0eac0234f84556de60436ba2ee9d (diff) | |
| download | qpid-python-3cfbdf0e60c94733c0a79e94bdf8627afc6bb2a4.tar.gz | |
QMFv2 Additions:
- QMFv2 schema encoding completed
- Schema queries handled by the agent and initiated by the console by user request
- Full query support with predicates evaluated on the agent (regex not yet implemented)
- Agent filtering in the console
- Agent aging in the console
- Unit tests
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@999662 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/include')
| -rw-r--r-- | cpp/include/qmf/Agent.h | 42 | ||||
| -rw-r--r-- | cpp/include/qmf/ConsoleEvent.h | 32 | ||||
| -rw-r--r-- | cpp/include/qmf/ConsoleSession.h | 13 | ||||
| -rw-r--r-- | cpp/include/qmf/Query.h | 21 | ||||
| -rw-r--r-- | cpp/include/qmf/SchemaProperty.h | 1 |
5 files changed, 93 insertions, 16 deletions
diff --git a/cpp/include/qmf/Agent.h b/cpp/include/qmf/Agent.h index 8ddea0fae9..8d427ab2fb 100644 --- a/cpp/include/qmf/Agent.h +++ b/cpp/include/qmf/Agent.h @@ -65,10 +65,52 @@ namespace qmf { qpid::messaging::Duration timeout=qpid::messaging::Duration::MINUTE); QMF_EXTERN uint32_t callMethodAsync(const std::string&, const qpid::types::Variant::Map&, const DataAddr&); + /** + * Query the agent for a list of schema classes that it exposes. This operation comes in both + * synchronous (blocking) and asynchronous flavors. + * + * This method will typically be used after receiving an AGENT_SCHEMA_UPDATE event from the console session. + * It may also be used on a newly discovered agent to learn what schemata are exposed. + * + * querySchema returns a ConsoleEvent that contains a list of SchemaId objects exposed by the agent. + * This list is cached locally and can be locally queried using getPackage[Count] and getSchemaId[Count]. + */ + QMF_EXTERN ConsoleEvent querySchema(qpid::messaging::Duration timeout=qpid::messaging::Duration::MINUTE); + QMF_EXTERN uint32_t querySchemaAsync(); + + /** + * Get the list of schema packages exposed by the agent. + * + * getPackageCount returns the number of packages exposed. + * getPackage returns the name of the package by index (0..package-count) + * + * Note that both of these calls are synchronous and non-blocking. They only return locally cached data + * and will not send any messages to the remote agent. Use querySchema[Async] to get the latest schema + * information from the remote agent. + */ QMF_EXTERN uint32_t getPackageCount() const; QMF_EXTERN const std::string& getPackage(uint32_t) const; + + /** + * Get the list of schema identifiers for a particular package. + * + * getSchemaIdCount returns the number of IDs in the indicates package. + * getSchemaId returns the SchemaId by index (0..schema-id-count) + * + * Note that both of these calls are synchronous and non-blocking. They only return locally cached data + * and will not send any messages to the remote agent. Use querySchema[Async] to get the latest schema + * information from the remote agent. + */ QMF_EXTERN uint32_t getSchemaIdCount(const std::string&) const; QMF_EXTERN SchemaId getSchemaId(const std::string&, uint32_t) const; + + /** + * Get detailed schema information for a specified schema ID. + * + * This call will return cached information if it is available. If not, it will send a query message to the + * remote agent and block waiting for a response. The timeout argument specifies the maximum time to wait + * for a response from the agent. + */ QMF_EXTERN Schema getSchema(const SchemaId&, qpid::messaging::Duration timeout=qpid::messaging::Duration::MINUTE); diff --git a/cpp/include/qmf/ConsoleEvent.h b/cpp/include/qmf/ConsoleEvent.h index 61f625b137..3e75631a61 100644 --- a/cpp/include/qmf/ConsoleEvent.h +++ b/cpp/include/qmf/ConsoleEvent.h @@ -23,6 +23,9 @@ #include <qmf/ImportExport.h> #include "qmf/Handle.h" +#include "qmf/Agent.h" +#include "qmf/Data.h" +#include "qmf/SchemaId.h" #include "qpid/types/Variant.h" namespace qmf { @@ -32,18 +35,24 @@ namespace qmf { #endif class ConsoleEventImpl; - class Agent; - class Data; enum ConsoleEventCode { - CONSOLE_AGENT_ADD = 1, - CONSOLE_AGENT_AGE = 2, - CONSOLE_EVENT = 3, - CONSOLE_QUERY_RESPONSE = 4, - CONSOLE_METHOD_RESPONSE = 5, - CONSOLE_EXCEPTION = 6, - CONSOLE_SUBSCRIBE_UPDATE = 7, - CONSOLE_THREAD_FAILED = 8 + CONSOLE_AGENT_ADD = 1, + CONSOLE_AGENT_DEL = 2, + CONSOLE_AGENT_RESTART = 3, + CONSOLE_AGENT_SCHEMA_UPDATE = 4, + CONSOLE_AGENT_SCHEMA_RESPONSE = 5, + CONSOLE_EVENT = 6, + CONSOLE_QUERY_RESPONSE = 7, + CONSOLE_METHOD_RESPONSE = 8, + CONSOLE_EXCEPTION = 9, + CONSOLE_SUBSCRIBE_UPDATE = 10, + CONSOLE_THREAD_FAILED = 11 + }; + + enum AgentDelReason { + AGENT_DEL_AGED = 1, + AGENT_DEL_FILTER = 2 }; class ConsoleEvent : public qmf::Handle<ConsoleEventImpl> { @@ -56,6 +65,9 @@ namespace qmf { QMF_EXTERN ConsoleEventCode getType() const; QMF_EXTERN uint32_t getCorrelator() const; QMF_EXTERN Agent getAgent() const; + QMF_EXTERN AgentDelReason getAgentDelReason() const; + QMF_EXTERN uint32_t getSchemaIdCount() const; + QMF_EXTERN SchemaId getSchemaId(uint32_t) const; QMF_EXTERN uint32_t getDataCount() const; QMF_EXTERN Data getData(uint32_t) const; QMF_EXTERN bool isFinal() const; diff --git a/cpp/include/qmf/ConsoleSession.h b/cpp/include/qmf/ConsoleSession.h index 0e58a647d6..c17f4510f1 100644 --- a/cpp/include/qmf/ConsoleSession.h +++ b/cpp/include/qmf/ConsoleSession.h @@ -44,6 +44,19 @@ namespace qmf { QMF_EXTERN ConsoleSession& operator=(const ConsoleSession&); QMF_EXTERN ~ConsoleSession(); + /** + * ConsoleSession + * A session that runs over an AMQP connection for QMF console operation. + * + * @param connection - An opened qpid::messaging::Connection + * @param options - An optional string containing options + * + * The options string is of the form "{key:value,key:value}". The following keys are supported: + * + * domain:NAME - QMF Domain to join [default: "default"] + * max-agent-age:N - Maximum time, in minutes, that we will tolerate not hearing from + * an agent before deleting it [default: 5] + */ QMF_EXTERN ConsoleSession(qpid::messaging::Connection&, const std::string& options=""); QMF_EXTERN void setDomain(const std::string&); QMF_EXTERN void setAgentFilter(const std::string&); diff --git a/cpp/include/qmf/Query.h b/cpp/include/qmf/Query.h index 71ef31b104..fec4660bd7 100644 --- a/cpp/include/qmf/Query.h +++ b/cpp/include/qmf/Query.h @@ -36,6 +36,13 @@ namespace qmf { class SchemaId; class DataAddr; + enum QueryTarget { + QUERY_OBJECT = 1, + QUERY_OBJECT_ID = 2, + QUERY_SCHEMA = 3, + QUERY_SCHEMA_ID = 4 + }; + class Query : public qmf::Handle<QueryImpl> { public: QMF_EXTERN Query(QueryImpl* impl = 0); @@ -43,20 +50,22 @@ namespace qmf { QMF_EXTERN Query& operator=(const Query&); QMF_EXTERN ~Query(); - QMF_EXTERN Query(const std::string& className, const std::string& package="", const std::string& predicate=""); - QMF_EXTERN Query(const SchemaId&); + QMF_EXTERN Query(QueryTarget, const std::string& predicate=""); + QMF_EXTERN Query(QueryTarget, const std::string& className, const std::string& package, const std::string& predicate=""); + QMF_EXTERN Query(QueryTarget, const SchemaId&, const std::string& predicate=""); QMF_EXTERN Query(const DataAddr&); + QMF_EXTERN QueryTarget getTarget() const; QMF_EXTERN const DataAddr& getDataAddr() const; QMF_EXTERN const SchemaId& getSchemaId() const; - QMF_EXTERN const std::string& getClassName() const; - QMF_EXTERN const std::string& getPackageName() const; - QMF_EXTERN void addPredicate(const std::string&, const qpid::types::Variant&); - QMF_EXTERN const qpid::types::Variant::Map& getPredicate() const; + QMF_EXTERN void setPredicate(const qpid::types::Variant::List&); + QMF_EXTERN const qpid::types::Variant::List& getPredicate() const; + QMF_EXTERN bool matchesPredicate(const qpid::types::Variant::Map& map) const; #ifndef SWIG private: friend class qmf::PrivateImplRef<Query>; + friend class QueryImplAccess; #endif }; diff --git a/cpp/include/qmf/SchemaProperty.h b/cpp/include/qmf/SchemaProperty.h index 2e770c2ef1..a3a328b60b 100644 --- a/cpp/include/qmf/SchemaProperty.h +++ b/cpp/include/qmf/SchemaProperty.h @@ -54,6 +54,7 @@ namespace qmf { QMF_EXTERN void setDirection(int); QMF_EXTERN const std::string& getName() const; + QMF_EXTERN int getType() const; QMF_EXTERN int getAccess() const; QMF_EXTERN bool isIndex() const; QMF_EXTERN bool isOptional() const; |
