summaryrefslogtreecommitdiff
path: root/qpid/cpp/include/qmf
diff options
context:
space:
mode:
Diffstat (limited to 'qpid/cpp/include/qmf')
-rw-r--r--qpid/cpp/include/qmf/Agent.h133
-rw-r--r--qpid/cpp/include/qmf/AgentEvent.h74
-rw-r--r--qpid/cpp/include/qmf/AgentSession.h191
-rw-r--r--qpid/cpp/include/qmf/ConsoleEvent.h89
-rw-r--r--qpid/cpp/include/qmf/ConsoleSession.h127
-rw-r--r--qpid/cpp/include/qmf/Data.h71
-rw-r--r--qpid/cpp/include/qmf/DataAddr.h63
-rw-r--r--qpid/cpp/include/qmf/Handle.h70
-rw-r--r--qpid/cpp/include/qmf/ImportExport.h35
-rw-r--r--qpid/cpp/include/qmf/Query.h74
-rw-r--r--qpid/cpp/include/qmf/Schema.h76
-rw-r--r--qpid/cpp/include/qmf/SchemaId.h61
-rw-r--r--qpid/cpp/include/qmf/SchemaMethod.h65
-rw-r--r--qpid/cpp/include/qmf/SchemaProperty.h75
-rw-r--r--qpid/cpp/include/qmf/SchemaTypes.h56
-rw-r--r--qpid/cpp/include/qmf/Subscription.h82
-rw-r--r--qpid/cpp/include/qmf/engine/Agent.h209
-rw-r--r--qpid/cpp/include/qmf/engine/ConnectionSettings.h150
-rw-r--r--qpid/cpp/include/qmf/engine/Console.h239
-rw-r--r--qpid/cpp/include/qmf/engine/Event.h49
-rw-r--r--qpid/cpp/include/qmf/engine/Message.h41
-rw-r--r--qpid/cpp/include/qmf/engine/Object.h56
-rw-r--r--qpid/cpp/include/qmf/engine/ObjectId.h68
-rw-r--r--qpid/cpp/include/qmf/engine/QmfEngineImportExport.h42
-rw-r--r--qpid/cpp/include/qmf/engine/Query.h112
-rw-r--r--qpid/cpp/include/qmf/engine/ResilientConnection.h173
-rw-r--r--qpid/cpp/include/qmf/engine/Schema.h212
-rw-r--r--qpid/cpp/include/qmf/engine/Typecode.h53
-rw-r--r--qpid/cpp/include/qmf/engine/Value.h122
-rw-r--r--qpid/cpp/include/qmf/exceptions.h59
30 files changed, 2927 insertions, 0 deletions
diff --git a/qpid/cpp/include/qmf/Agent.h b/qpid/cpp/include/qmf/Agent.h
new file mode 100644
index 0000000000..94083be4f3
--- /dev/null
+++ b/qpid/cpp/include/qmf/Agent.h
@@ -0,0 +1,133 @@
+#ifndef QMF_AGENT_H
+#define QMF_AGENT_H
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include <qmf/ImportExport.h>
+#include "qmf/Handle.h"
+//#include "qmf/Subscription.h"
+#include "qmf/exceptions.h"
+#include "qpid/messaging/Duration.h"
+#include "qpid/types/Variant.h"
+#include <string>
+
+namespace qmf {
+
+#ifndef SWIG
+ template <class> class PrivateImplRef;
+#endif
+
+ class AgentImpl;
+ class ConsoleEvent;
+ class Query;
+ class DataAddr;
+ class SchemaId;
+ class Schema;
+
+ class QMF_CLASS_EXTERN Agent : public qmf::Handle<AgentImpl> {
+ public:
+ QMF_EXTERN Agent(AgentImpl* impl = 0);
+ QMF_EXTERN Agent(const Agent&);
+ QMF_EXTERN Agent& operator=(const Agent&);
+ QMF_EXTERN ~Agent();
+
+ QMF_EXTERN std::string getName() const;
+ QMF_EXTERN uint32_t getEpoch() const;
+ QMF_EXTERN std::string getVendor() const;
+ QMF_EXTERN std::string getProduct() const;
+ QMF_EXTERN std::string getInstance() const;
+ QMF_EXTERN const qpid::types::Variant& getAttribute(const std::string&) const;
+ QMF_EXTERN const qpid::types::Variant::Map& getAttributes() const;
+
+ QMF_EXTERN ConsoleEvent query(const Query&, qpid::messaging::Duration timeout=qpid::messaging::Duration::MINUTE);
+ QMF_EXTERN ConsoleEvent query(const std::string&, qpid::messaging::Duration timeout=qpid::messaging::Duration::MINUTE);
+ QMF_EXTERN uint32_t queryAsync(const Query&);
+ QMF_EXTERN uint32_t queryAsync(const std::string&);
+
+ /**
+ * Create a subscription to this agent
+ */
+ //QMF_EXTERN Subscription subscribe(const Query&, const std::string& options = "");
+ //QMF_EXTERN Subscription subscribe(const std::string&, const std::string& options = "");
+
+ QMF_EXTERN ConsoleEvent callMethod(const std::string&, const qpid::types::Variant::Map&, const DataAddr&,
+ 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);
+
+
+#ifndef SWIG
+ private:
+ friend class qmf::PrivateImplRef<Agent>;
+ friend struct AgentImplAccess;
+#endif
+ };
+
+}
+
+#endif
diff --git a/qpid/cpp/include/qmf/AgentEvent.h b/qpid/cpp/include/qmf/AgentEvent.h
new file mode 100644
index 0000000000..0f93a9bb0a
--- /dev/null
+++ b/qpid/cpp/include/qmf/AgentEvent.h
@@ -0,0 +1,74 @@
+#ifndef QMF_AGENT_EVENT_H
+#define QMF_AGENT_EVENT_H
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include <qmf/ImportExport.h>
+#include "qmf/Handle.h"
+#include "qpid/types/Variant.h"
+
+namespace qmf {
+
+#ifndef SWIG
+ template <class> class PrivateImplRef;
+#endif
+
+ class AgentEventImpl;
+ class Query;
+ class DataAddr;
+
+ enum AgentEventCode {
+ AGENT_AUTH_QUERY = 1,
+ AGENT_AUTH_SUBSCRIBE = 2,
+ AGENT_QUERY = 3,
+ AGENT_METHOD = 4,
+ AGENT_SUBSCRIBE_BEGIN = 5,
+ AGENT_SUBSCRIBE_TOUCH = 6,
+ AGENT_SUBSCRIBE_END = 7,
+ AGENT_THREAD_FAILED = 8
+ };
+
+ class QMF_CLASS_EXTERN AgentEvent : public qmf::Handle<AgentEventImpl> {
+ public:
+ QMF_EXTERN AgentEvent(AgentEventImpl* impl = 0);
+ QMF_EXTERN AgentEvent(const AgentEvent&);
+ QMF_EXTERN AgentEvent& operator=(const AgentEvent&);
+ QMF_EXTERN ~AgentEvent();
+
+ QMF_EXTERN AgentEventCode getType() const;
+ QMF_EXTERN const std::string& getUserId() const;
+ QMF_EXTERN Query getQuery() const;
+ QMF_EXTERN bool hasDataAddr() const;
+ QMF_EXTERN DataAddr getDataAddr() const;
+ QMF_EXTERN const std::string& getMethodName() const;
+ QMF_EXTERN qpid::types::Variant::Map& getArguments();
+ QMF_EXTERN qpid::types::Variant::Map& getArgumentSubtypes();
+ QMF_EXTERN void addReturnArgument(const std::string&, const qpid::types::Variant&, const std::string& st="");
+
+#ifndef SWIG
+ private:
+ friend class qmf::PrivateImplRef<AgentEvent>;
+ friend struct AgentEventImplAccess;
+#endif
+ };
+}
+
+#endif
diff --git a/qpid/cpp/include/qmf/AgentSession.h b/qpid/cpp/include/qmf/AgentSession.h
new file mode 100644
index 0000000000..1eeb252143
--- /dev/null
+++ b/qpid/cpp/include/qmf/AgentSession.h
@@ -0,0 +1,191 @@
+#ifndef QMF_AGENT_SESSION_H
+#define QMF_AGENT_SESSION_H
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include <qmf/ImportExport.h>
+#include "qmf/Handle.h"
+#include "qpid/messaging/Duration.h"
+#include "qpid/messaging/Connection.h"
+#include "qpid/types/Variant.h"
+#include <string>
+
+namespace qmf {
+
+#ifndef SWIG
+ template <class> class PrivateImplRef;
+#endif
+
+ class AgentSessionImpl;
+ class AgentEvent;
+ class Schema;
+ class Data;
+ class DataAddr;
+
+ class QMF_CLASS_EXTERN AgentSession : public qmf::Handle<AgentSessionImpl> {
+ public:
+ QMF_EXTERN AgentSession(AgentSessionImpl* impl = 0);
+ QMF_EXTERN AgentSession(const AgentSession&);
+ QMF_EXTERN AgentSession& operator=(const AgentSession&);
+ QMF_EXTERN ~AgentSession();
+
+ /**
+ * AgentSession
+ * A session that runs over an AMQP connection for QMF agent 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:
+ *
+ * interval:N - Heartbeat interval in seconds [default: 60]
+ * external:{True,False} - Use external data storage (queries and subscriptions are pass-through) [default: False]
+ * allow-queries:{True,False} - If True: automatically allow all queries [default]
+ * If False: generate an AUTH_QUERY event to allow per-query authorization
+ * allow-methods:{True,False} - If True: automatically allow all methods [default]
+ * If False: generate an AUTH_METHOD event to allow per-method authorization
+ * max-subscriptions:N - Maximum number of concurrent subscription queries permitted [default: 64]
+ * min-sub-interval:N - Minimum publish interval (in milliseconds) permitted for a subscription [default: 3000]
+ * sub-lifetime:N - Lifetime (in seconds with no keepalive) for a subscription [default: 300]
+ * public-events:{True,False} - If True: QMF events are sent to the topic exchange [default]
+ * If False: QMF events are only sent to authorized subscribers
+ * listen-on-direct:{True,False} - If True: Listen on legacy direct-exchange address for backward compatibility [default]
+ * If False: Listen only on the routable direct address
+ * strict-security:{True,False} - If True: Cooperate with the broker to enforce strict access control to the network
+ * - If False: Operate more flexibly with regard to use of messaging facilities [default]
+ */
+ QMF_EXTERN AgentSession(qpid::messaging::Connection& conn, const std::string& options="");
+
+ /**
+ * setDomain - Change the QMF domain that this agent will operate in. If this is not called,
+ * the domain will be "default". Agents in a domain can be seen only by consoles in the same domain.
+ * This must be called prior to opening the agent session.
+ */
+ QMF_EXTERN void setDomain(const std::string& domain);
+
+ /**
+ * Set identifying attributes of this agent.
+ * setVendor - Set the vendor string
+ * setProduct - Set the product name string
+ * setInstance - Set the unique instance name (if not set, a UUID will be assigned)
+ * These must be called prior to opening the agent session.
+ */
+ QMF_EXTERN void setVendor(const std::string& vendor);
+ QMF_EXTERN void setProduct(const std::string& product);
+ QMF_EXTERN void setInstance(const std::string& instance);
+
+ /**
+ * setAttribute - Set an arbitrary attribute for this agent. The attributes are not used
+ * to uniquely identify the agent but can be used as a search criteria when looking for agents.
+ * This must be called prior to opening the agent session.
+ */
+ QMF_EXTERN void setAttribute(const std::string& key, const qpid::types::Variant& value);
+
+ /**
+ * Get the identifying name of the agent.
+ */
+ QMF_EXTERN const std::string& getName() const;
+
+ /**
+ * Open the agent session. After opening the session, the domain, identifying strings, and attributes cannot
+ * be changed.
+ */
+ QMF_EXTERN void open();
+
+ /**
+ * Close the session. Once closed, the session no longer communicates on the messaging network.
+ */
+ QMF_EXTERN void close();
+
+ /**
+ * Get the next event from the agent session. Events represent actions that must be acted upon by the
+ * agent application. This method blocks for up to the timeout if there are no events to be handled.
+ * This method will typically be the focus of the agent application's main execution loop.
+ * If the timeout is set to Duration::IMMEDIATE, the call will not block.
+ */
+ QMF_EXTERN bool nextEvent(AgentEvent& outEvent, qpid::messaging::Duration timeout=qpid::messaging::Duration::FOREVER);
+
+ /**
+ * Return the number of events pending for nextEvent. This method will never block.
+ */
+ QMF_EXTERN int pendingEvents() const;
+
+ /**
+ * Register a schema to be exposed by this agent.
+ */
+ QMF_EXTERN void registerSchema(Schema& schema);
+
+ /**
+ * Add data to be managed internally by the agent. If the option external:True is selected, this call
+ * should not be used.
+ *
+ * @param data - The data object being managed by the agent.
+ * @param name - A name unique to this object to be used to address the object.
+ * If left default, a unique name will be assigned by the agent.
+ * @param persistent - Set this to true if the data object is to be considered persistent
+ * across different sessions. If persistent, it is the agent application's
+ * responsibility to ensure the name is the same each time it is added.
+ */
+ QMF_EXTERN DataAddr addData(Data& data, const std::string& name="", bool persistent=false);
+
+ /**
+ * Delete data from internal agent management.
+ */
+ QMF_EXTERN void delData(const DataAddr& dataAddr);
+
+ /**
+ * The following methods are used to respond to events received in nextEvent.
+ *
+ * authAccept - Accept an authorization request.
+ * authReject - Reject/forbid an authorization request.
+ * raiseException - indicate failure of an operation (i.e. query or method call).
+ * response - Provide data in response to a query (only for option: external:True)
+ * complete - Indicate that the response to a query is complete (external:True only)
+ * methodSuccess - Indicate the successful completion of a method call.
+ */
+ QMF_EXTERN void authAccept(AgentEvent& event);
+ QMF_EXTERN void authReject(AgentEvent& event, const std::string& diag="");
+ QMF_EXTERN void raiseException(AgentEvent& event, const std::string& errorText);
+ QMF_EXTERN void raiseException(AgentEvent& event, const Data& errorData);
+ QMF_EXTERN void response(AgentEvent& event, const Data& responseData);
+ QMF_EXTERN void complete(AgentEvent& event);
+ QMF_EXTERN void methodSuccess(AgentEvent& event);
+
+ /**
+ * Raise an event to be sent into the QMF network.
+ *
+ * @param data - A data object that contains the event contents.
+ * @param severity - Explicit severity (from qmf/SchemaTypes.h). If omitted, the severity is set to
+ * the default severity for the data's schema. If the data has no schema, the severity defaults
+ * to SEV_NOTICE.
+ */
+ QMF_EXTERN void raiseEvent(const Data& data);
+ QMF_EXTERN void raiseEvent(const Data& data, int severity);
+
+#ifndef SWIG
+ private:
+ friend class qmf::PrivateImplRef<AgentSession>;
+#endif
+ };
+
+}
+
+#endif
diff --git a/qpid/cpp/include/qmf/ConsoleEvent.h b/qpid/cpp/include/qmf/ConsoleEvent.h
new file mode 100644
index 0000000000..94600f9357
--- /dev/null
+++ b/qpid/cpp/include/qmf/ConsoleEvent.h
@@ -0,0 +1,89 @@
+#ifndef QMF_CONSOLE_EVENT_H
+#define QMF_CONSOLE_EVENT_H
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#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 {
+
+#ifndef SWIG
+ template <class> class PrivateImplRef;
+#endif
+
+ class ConsoleEventImpl;
+
+ enum ConsoleEventCode {
+ 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_ADD = 10,
+ CONSOLE_SUBSCRIBE_UPDATE = 11,
+ CONSOLE_SUBSCRIBE_DEL = 12,
+ CONSOLE_THREAD_FAILED = 13
+ };
+
+ enum AgentDelReason {
+ AGENT_DEL_AGED = 1,
+ AGENT_DEL_FILTER = 2
+ };
+
+ class QMF_CLASS_EXTERN ConsoleEvent : public qmf::Handle<ConsoleEventImpl> {
+ public:
+ QMF_EXTERN ConsoleEvent(ConsoleEventImpl* impl = 0);
+ QMF_EXTERN ConsoleEvent(const ConsoleEvent&);
+ QMF_EXTERN ConsoleEvent& operator=(const ConsoleEvent&);
+ QMF_EXTERN ~ConsoleEvent();
+
+ 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;
+ QMF_EXTERN const qpid::types::Variant::Map& getArguments() const;
+ QMF_EXTERN int getSeverity() const;
+ QMF_EXTERN uint64_t getTimestamp() const;
+
+#ifndef SWIG
+ private:
+ friend class qmf::PrivateImplRef<ConsoleEvent>;
+ friend struct ConsoleEventImplAccess;
+#endif
+ };
+
+}
+
+#endif
diff --git a/qpid/cpp/include/qmf/ConsoleSession.h b/qpid/cpp/include/qmf/ConsoleSession.h
new file mode 100644
index 0000000000..6008036eec
--- /dev/null
+++ b/qpid/cpp/include/qmf/ConsoleSession.h
@@ -0,0 +1,127 @@
+#ifndef QMF_CONSOLE_SESSION_H
+#define QMF_CONSOLE_SESSION_H
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include <qmf/ImportExport.h>
+#include "qmf/Handle.h"
+#include "qmf/Agent.h"
+#include "qmf/Subscription.h"
+#include "qpid/messaging/Duration.h"
+#include "qpid/messaging/Connection.h"
+#include <string>
+
+namespace qmf {
+
+#ifndef SWIG
+ template <class> class PrivateImplRef;
+#endif
+
+ class ConsoleSessionImpl;
+ class ConsoleEvent;
+
+ class QMF_CLASS_EXTERN ConsoleSession : public qmf::Handle<ConsoleSessionImpl> {
+ public:
+ QMF_EXTERN ConsoleSession(ConsoleSessionImpl* impl = 0);
+ QMF_EXTERN ConsoleSession(const ConsoleSession&);
+ 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]
+ * listen-on-direct:{True,False} - If True: Listen on legacy direct-exchange address for backward compatibility [default]
+ * If False: Listen only on the routable direct address
+ * strict-security:{True,False} - If True: Cooperate with the broker to enforce strict access control to the network
+ * - If False: Operate more flexibly with regard to use of messaging facilities [default]
+ */
+ QMF_EXTERN ConsoleSession(qpid::messaging::Connection& conn, const std::string& options="");
+
+ /**
+ * setDomain - Change the QMF domain that this console will operate in. If this is not called,
+ * the domain will be "default". Agents in a domain can be seen only by consoles in the same domain.
+ * This must be called prior to opening the console session.
+ */
+ QMF_EXTERN void setDomain(const std::string& domain);
+ QMF_EXTERN void setAgentFilter(const std::string& filter);
+
+ /**
+ * Open the console session. After opening the session, the domain cannot be changed.
+ */
+ QMF_EXTERN void open();
+
+ /**
+ * Close the session. Once closed, the session no longer communicates on the messaging network.
+ */
+ QMF_EXTERN void close();
+
+ /**
+ * Get the next event from the console session. Events represent actions that must be acted upon by the
+ * console application. This method blocks for up to the timeout if there are no events to be handled.
+ * This method will typically be the focus of the console application's main execution loop.
+ * If the timeout is set to Duration::IMMEDIATE, the call will not block.
+ */
+ QMF_EXTERN bool nextEvent(ConsoleEvent& outEvent, qpid::messaging::Duration timeout=qpid::messaging::Duration::FOREVER);
+
+ /**
+ * Return the number of events pending for nextEvent. This method will never block.
+ */
+ QMF_EXTERN int pendingEvents() const;
+
+ /**
+ * getAgentCount, getAgent - Retrieve the set of agents that match the console session's agent filter.
+ */
+ QMF_EXTERN uint32_t getAgentCount() const;
+ QMF_EXTERN Agent getAgent(uint32_t agentIndex) const;
+
+ /**
+ * Get the agent for the connected broker (i.e. the agent embedded in the broker to which we have a connection).
+ */
+ QMF_EXTERN Agent getConnectedBrokerAgent() const;
+
+ /**
+ * Create a subscription that involves a subset of the known agents. The set of known agents is defined by
+ * the session's agent-filter (see setAgentFilter). The agentFilter argument to the subscribe method is used
+ * to further refine the set of agents. If agentFilter is the empty string (i.e. match-all) the subscription
+ * will involve all known agents. If agentFilter is non-empty, it will be applied only to the set of known
+ * agents. A subscription cannot be created that involves an agent not known by the session.
+ */
+ QMF_EXTERN Subscription subscribe(const Query& query, const std::string& agentFilter = "", const std::string& options = "");
+ QMF_EXTERN Subscription subscribe(const std::string& query, const std::string& agentFilter = "", const std::string& options = "");
+
+#ifndef SWIG
+ private:
+ friend class qmf::PrivateImplRef<ConsoleSession>;
+#endif
+ };
+
+}
+
+#endif
diff --git a/qpid/cpp/include/qmf/Data.h b/qpid/cpp/include/qmf/Data.h
new file mode 100644
index 0000000000..487a02fe95
--- /dev/null
+++ b/qpid/cpp/include/qmf/Data.h
@@ -0,0 +1,71 @@
+#ifndef QMF_DATA_H
+#define QMF_DATA_H
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include <qmf/ImportExport.h>
+#include "qmf/Handle.h"
+#include "qmf/exceptions.h"
+#include "qpid/types/Variant.h"
+#include <string>
+
+namespace qmf {
+
+#ifndef SWIG
+ template <class> class PrivateImplRef;
+#endif
+
+ class DataImpl;
+ class Schema;
+ class SchemaId;
+ class DataAddr;
+ class Agent;
+
+ class QMF_CLASS_EXTERN Data : public qmf::Handle<DataImpl> {
+ public:
+ QMF_EXTERN Data(DataImpl* impl = 0);
+ QMF_EXTERN Data(const Data&);
+ QMF_EXTERN Data& operator=(const Data&);
+ QMF_EXTERN ~Data();
+
+ QMF_EXTERN Data(const Schema&);
+ QMF_EXTERN void setAddr(const DataAddr&);
+ QMF_EXTERN void setProperty(const std::string&, const qpid::types::Variant&);
+ QMF_EXTERN void overwriteProperties(const qpid::types::Variant::Map&);
+ QMF_EXTERN bool hasSchema() const;
+ QMF_EXTERN bool hasAddr() const;
+ QMF_EXTERN const SchemaId& getSchemaId() const;
+ QMF_EXTERN const DataAddr& getAddr() const;
+ QMF_EXTERN const qpid::types::Variant& getProperty(const std::string&) const;
+ QMF_EXTERN const qpid::types::Variant::Map& getProperties() const;
+ QMF_EXTERN bool hasAgent() const;
+ QMF_EXTERN const Agent& getAgent() const;
+
+#ifndef SWIG
+ private:
+ friend class qmf::PrivateImplRef<Data>;
+ friend struct DataImplAccess;
+#endif
+ };
+
+}
+
+#endif
diff --git a/qpid/cpp/include/qmf/DataAddr.h b/qpid/cpp/include/qmf/DataAddr.h
new file mode 100644
index 0000000000..63d309cc4b
--- /dev/null
+++ b/qpid/cpp/include/qmf/DataAddr.h
@@ -0,0 +1,63 @@
+#ifndef QMF_DATA_ADDR_H
+#define QMF_DATA_ADDR_H
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include <qmf/ImportExport.h>
+#include "qmf/Handle.h"
+#include "qpid/types/Variant.h"
+#include <string>
+
+namespace qmf {
+
+#ifndef SWIG
+ template <class> class PrivateImplRef;
+#endif
+
+ class DataAddrImpl;
+
+ class QMF_CLASS_EXTERN DataAddr : public qmf::Handle<DataAddrImpl> {
+ public:
+ QMF_EXTERN DataAddr(DataAddrImpl* impl = 0);
+ QMF_EXTERN DataAddr(const DataAddr&);
+ QMF_EXTERN DataAddr& operator=(const DataAddr&);
+ QMF_EXTERN ~DataAddr();
+
+ QMF_EXTERN bool operator==(const DataAddr&);
+ QMF_EXTERN bool operator<(const DataAddr&);
+
+ QMF_EXTERN DataAddr(const qpid::types::Variant::Map&);
+ QMF_EXTERN DataAddr(const std::string& name, const std::string& agentName, uint32_t agentEpoch=0);
+ QMF_EXTERN const std::string& getName() const;
+ QMF_EXTERN const std::string& getAgentName() const;
+ QMF_EXTERN uint32_t getAgentEpoch() const;
+ QMF_EXTERN qpid::types::Variant::Map asMap() const;
+
+#ifndef SWIG
+ private:
+ friend class qmf::PrivateImplRef<DataAddr>;
+ friend struct DataAddrImplAccess;
+#endif
+ };
+
+}
+
+#endif
diff --git a/qpid/cpp/include/qmf/Handle.h b/qpid/cpp/include/qmf/Handle.h
new file mode 100644
index 0000000000..50971ea626
--- /dev/null
+++ b/qpid/cpp/include/qmf/Handle.h
@@ -0,0 +1,70 @@
+#ifndef QMF_HANDLE_H
+#define QMF_HANDLE_H
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include "qmf/ImportExport.h"
+
+namespace qmf {
+
+template <class> class PrivateImplRef;
+
+/** \ingroup qmf
+ * A handle is like a pointer: refers to an underlying implementation object.
+ * Copying the handle does not copy the object.
+ *
+ * Handles can be null, like a 0 pointer. Use isValid(), isNull() or the
+ * conversion to bool to test for a null handle.
+ */
+template <class T> class Handle {
+ public:
+
+ /**@return true if handle is valid, i.e. not null. */
+ QMF_INLINE_EXTERN bool isValid() const { return impl; }
+
+ /**@return true if handle is null. It is an error to call any function on a null handle. */
+ QMF_INLINE_EXTERN bool isNull() const { return !impl; }
+
+ /** Conversion to bool supports idiom if (handle) { handle->... } */
+ QMF_INLINE_EXTERN operator bool() const { return impl; }
+
+ /** Operator ! supports idiom if (!handle) { do_if_handle_is_null(); } */
+ QMF_INLINE_EXTERN bool operator !() const { return !impl; }
+
+ void swap(Handle<T>& h) { T* t = h.impl; h.impl = impl; impl = t; }
+
+ protected:
+ typedef T Impl;
+ QMF_INLINE_EXTERN Handle() :impl() {}
+
+ // Not implemented,subclasses must implement.
+ QMF_EXTERN Handle(const Handle&);
+ QMF_EXTERN Handle& operator=(const Handle&);
+
+ Impl* impl;
+
+ friend class PrivateImplRef<T>;
+};
+
+} // namespace qmf
+
+#endif /*!QMF_HANDLE_H*/
diff --git a/qpid/cpp/include/qmf/ImportExport.h b/qpid/cpp/include/qmf/ImportExport.h
new file mode 100644
index 0000000000..7405c15259
--- /dev/null
+++ b/qpid/cpp/include/qmf/ImportExport.h
@@ -0,0 +1,35 @@
+#ifndef QMF_IMPORT_EXPORT_H
+#define QMF_IMPORT_EXPORT_H
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "qpid/ImportExport.h"
+
+#if defined(QMF_EXPORT) || defined (qmf2_EXPORTS)
+# define QMF_EXTERN QPID_EXPORT
+# define QMF_CLASS_EXTERN QPID_CLASS_EXPORT
+# define QMF_INLINE_EXTERN QPID_INLINE_EXPORT
+#else
+# define QMF_EXTERN QPID_IMPORT
+# define QMF_CLASS_EXTERN QPID_CLASS_IMPORT
+# define QMF_INLINE_EXTERN QPID_INLINE_IMPORT
+#endif
+
+#endif
diff --git a/qpid/cpp/include/qmf/Query.h b/qpid/cpp/include/qmf/Query.h
new file mode 100644
index 0000000000..c1264f8901
--- /dev/null
+++ b/qpid/cpp/include/qmf/Query.h
@@ -0,0 +1,74 @@
+#ifndef QMF_QUERY_H
+#define QMF_QUERY_H
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include <qmf/ImportExport.h>
+#include "qmf/Handle.h"
+#include "qpid/types/Variant.h"
+#include <string>
+
+namespace qmf {
+
+#ifndef SWIG
+ template <class> class PrivateImplRef;
+#endif
+
+ class QueryImpl;
+ class SchemaId;
+ class DataAddr;
+
+ enum QueryTarget {
+ QUERY_OBJECT = 1,
+ QUERY_OBJECT_ID = 2,
+ QUERY_SCHEMA = 3,
+ QUERY_SCHEMA_ID = 4
+ };
+
+ class QMF_CLASS_EXTERN Query : public qmf::Handle<QueryImpl> {
+ public:
+ QMF_EXTERN Query(QueryImpl* impl = 0);
+ QMF_EXTERN Query(const Query&);
+ QMF_EXTERN Query& operator=(const Query&);
+ QMF_EXTERN ~Query();
+
+ 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 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 struct QueryImplAccess;
+#endif
+ };
+
+}
+
+#endif
diff --git a/qpid/cpp/include/qmf/Schema.h b/qpid/cpp/include/qmf/Schema.h
new file mode 100644
index 0000000000..6cfd2e2a56
--- /dev/null
+++ b/qpid/cpp/include/qmf/Schema.h
@@ -0,0 +1,76 @@
+#ifndef QMF_SCHEMA_H
+#define QMF_SCHEMA_H
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include <qmf/ImportExport.h>
+#include "qpid/sys/IntegerTypes.h"
+#include "qmf/Handle.h"
+#include "qmf/SchemaTypes.h"
+#include <string>
+
+namespace qmf {
+
+#ifndef SWIG
+ template <class> class PrivateImplRef;
+#endif
+
+ class SchemaImpl;
+ class SchemaId;
+ class SchemaProperty;
+ class SchemaMethod;
+
+ class QMF_CLASS_EXTERN Schema : public qmf::Handle<SchemaImpl> {
+ public:
+ QMF_EXTERN Schema(SchemaImpl* impl = 0);
+ QMF_EXTERN Schema(const Schema&);
+ QMF_EXTERN Schema& operator=(const Schema&);
+ QMF_EXTERN ~Schema();
+
+ QMF_EXTERN Schema(int, const std::string&, const std::string&);
+ QMF_EXTERN const SchemaId& getSchemaId() const;
+
+ QMF_EXTERN void finalize();
+ QMF_EXTERN bool isFinalized() const;
+ QMF_EXTERN void addProperty(const SchemaProperty&);
+ QMF_EXTERN void addMethod(const SchemaMethod&);
+ QMF_EXTERN void setDesc(const std::string&);
+ QMF_EXTERN const std::string& getDesc() const;
+
+ QMF_EXTERN void setDefaultSeverity(int);
+ QMF_EXTERN int getDefaultSeverity() const;
+
+ QMF_EXTERN uint32_t getPropertyCount() const;
+ QMF_EXTERN SchemaProperty getProperty(uint32_t) const;
+
+ QMF_EXTERN uint32_t getMethodCount() const;
+ QMF_EXTERN SchemaMethod getMethod(uint32_t) const;
+
+#ifndef SWIG
+ private:
+ friend class qmf::PrivateImplRef<Schema>;
+ friend struct SchemaImplAccess;
+#endif
+ };
+
+}
+
+#endif
diff --git a/qpid/cpp/include/qmf/SchemaId.h b/qpid/cpp/include/qmf/SchemaId.h
new file mode 100644
index 0000000000..2dafc1c091
--- /dev/null
+++ b/qpid/cpp/include/qmf/SchemaId.h
@@ -0,0 +1,61 @@
+#ifndef QMF_SCHEMA_ID_H
+#define QMF_SCHEMA_ID_H
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include <qmf/ImportExport.h>
+#include "qmf/Handle.h"
+#include "qpid/types/Uuid.h"
+#include "qmf/SchemaTypes.h"
+#include <string>
+
+namespace qmf {
+
+#ifndef SWIG
+ template <class> class PrivateImplRef;
+#endif
+
+ class SchemaIdImpl;
+
+ class QMF_CLASS_EXTERN SchemaId : public qmf::Handle<SchemaIdImpl> {
+ public:
+ QMF_EXTERN SchemaId(SchemaIdImpl* impl = 0);
+ QMF_EXTERN SchemaId(const SchemaId&);
+ QMF_EXTERN SchemaId& operator=(const SchemaId&);
+ QMF_EXTERN ~SchemaId();
+
+ QMF_EXTERN SchemaId(int, const std::string&, const std::string&);
+ QMF_EXTERN void setHash(const qpid::types::Uuid&);
+ QMF_EXTERN int getType() const;
+ QMF_EXTERN const std::string& getPackageName() const;
+ QMF_EXTERN const std::string& getName() const;
+ QMF_EXTERN const qpid::types::Uuid& getHash() const;
+
+#ifndef SWIG
+ private:
+ friend class qmf::PrivateImplRef<SchemaId>;
+ friend struct SchemaIdImplAccess;
+#endif
+ };
+
+}
+
+#endif
diff --git a/qpid/cpp/include/qmf/SchemaMethod.h b/qpid/cpp/include/qmf/SchemaMethod.h
new file mode 100644
index 0000000000..b5944dc29e
--- /dev/null
+++ b/qpid/cpp/include/qmf/SchemaMethod.h
@@ -0,0 +1,65 @@
+#ifndef QMF_SCHEMA_METHOD_H
+#define QMF_SCHEMA_METHOD_H
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include "qmf/ImportExport.h"
+#include "qpid/sys/IntegerTypes.h"
+#include "qmf/Handle.h"
+#include "qmf/SchemaTypes.h"
+#include <string>
+
+namespace qmf {
+
+#ifndef SWIG
+ template <class> class PrivateImplRef;
+#endif
+
+ class SchemaMethodImpl;
+ class SchemaProperty;
+
+ class QMF_CLASS_EXTERN SchemaMethod : public qmf::Handle<SchemaMethodImpl> {
+ public:
+ QMF_EXTERN SchemaMethod(SchemaMethodImpl* impl = 0);
+ QMF_EXTERN SchemaMethod(const SchemaMethod&);
+ QMF_EXTERN SchemaMethod& operator=(const SchemaMethod&);
+ QMF_EXTERN ~SchemaMethod();
+
+ QMF_EXTERN SchemaMethod(const std::string&, const std::string& o="");
+
+ QMF_EXTERN void setDesc(const std::string&);
+ QMF_EXTERN void addArgument(const SchemaProperty&);
+
+ QMF_EXTERN const std::string& getName() const;
+ QMF_EXTERN const std::string& getDesc() const;
+ QMF_EXTERN uint32_t getArgumentCount() const;
+ QMF_EXTERN SchemaProperty getArgument(uint32_t) const;
+
+#ifndef SWIG
+ private:
+ friend class qmf::PrivateImplRef<SchemaMethod>;
+ friend struct SchemaMethodImplAccess;
+#endif
+ };
+
+}
+
+#endif
diff --git a/qpid/cpp/include/qmf/SchemaProperty.h b/qpid/cpp/include/qmf/SchemaProperty.h
new file mode 100644
index 0000000000..bbb603fa50
--- /dev/null
+++ b/qpid/cpp/include/qmf/SchemaProperty.h
@@ -0,0 +1,75 @@
+#ifndef QMF_SCHEMA_PROPERTY_H
+#define QMF_SCHEMA_PROPERTY_H
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include <qmf/ImportExport.h>
+#include "qmf/Handle.h"
+#include "qpid/types/Uuid.h"
+#include "qpid/types/Variant.h"
+#include "qmf/SchemaTypes.h"
+#include <string>
+
+namespace qmf {
+
+#ifndef SWIG
+ template <class> class PrivateImplRef;
+#endif
+
+ class SchemaPropertyImpl;
+
+ class QMF_CLASS_EXTERN SchemaProperty : public Handle<SchemaPropertyImpl> {
+ public:
+ QMF_EXTERN SchemaProperty(SchemaPropertyImpl* impl = 0);
+ QMF_EXTERN SchemaProperty(const SchemaProperty&);
+ QMF_EXTERN SchemaProperty& operator=(const SchemaProperty&);
+ QMF_EXTERN ~SchemaProperty();
+
+ QMF_EXTERN SchemaProperty(const std::string&, int, const std::string& o="");
+
+ QMF_EXTERN void setAccess(int);
+ QMF_EXTERN void setIndex(bool);
+ QMF_EXTERN void setOptional(bool);
+ QMF_EXTERN void setUnit(const std::string&);
+ QMF_EXTERN void setDesc(const std::string&);
+ QMF_EXTERN void setSubtype(const std::string&);
+ 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;
+ QMF_EXTERN const std::string& getUnit() const;
+ QMF_EXTERN const std::string& getDesc() const;
+ QMF_EXTERN const std::string& getSubtype() const;
+ QMF_EXTERN int getDirection() const;
+
+#ifndef SWIG
+ private:
+ friend class qmf::PrivateImplRef<SchemaProperty>;
+ friend struct SchemaPropertyImplAccess;
+#endif
+ };
+
+}
+
+#endif
diff --git a/qpid/cpp/include/qmf/SchemaTypes.h b/qpid/cpp/include/qmf/SchemaTypes.h
new file mode 100644
index 0000000000..af3da612e5
--- /dev/null
+++ b/qpid/cpp/include/qmf/SchemaTypes.h
@@ -0,0 +1,56 @@
+#ifndef QMF_SCHEMA_TYPES_H
+#define QMF_SCHEMA_TYPES_H
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+namespace qmf {
+
+ const int SCHEMA_TYPE_DATA = 1;
+ const int SCHEMA_TYPE_EVENT = 2;
+
+ const int SCHEMA_DATA_VOID = 1;
+ const int SCHEMA_DATA_BOOL = 2;
+ const int SCHEMA_DATA_INT = 3;
+ const int SCHEMA_DATA_FLOAT = 4;
+ const int SCHEMA_DATA_STRING = 5;
+ const int SCHEMA_DATA_MAP = 6;
+ const int SCHEMA_DATA_LIST = 7;
+ const int SCHEMA_DATA_UUID = 8;
+
+ const int ACCESS_READ_CREATE = 1;
+ const int ACCESS_READ_WRITE = 2;
+ const int ACCESS_READ_ONLY = 3;
+
+ const int DIR_IN = 1;
+ const int DIR_OUT = 2;
+ const int DIR_IN_OUT = 3;
+
+ const int SEV_EMERG = 0;
+ const int SEV_ALERT = 1;
+ const int SEV_CRIT = 2;
+ const int SEV_ERROR = 3;
+ const int SEV_WARN = 4;
+ const int SEV_NOTICE = 5;
+ const int SEV_INFORM = 6;
+ const int SEV_DEBUG = 7;
+}
+
+#endif
diff --git a/qpid/cpp/include/qmf/Subscription.h b/qpid/cpp/include/qmf/Subscription.h
new file mode 100644
index 0000000000..398a45b922
--- /dev/null
+++ b/qpid/cpp/include/qmf/Subscription.h
@@ -0,0 +1,82 @@
+#ifndef QMF_SUBSCRIPTION_H
+#define QMF_SUBSCRIPTION_H
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include <qmf/ImportExport.h>
+#include "qmf/Handle.h"
+#include "qpid/types/Variant.h"
+#include <string>
+
+namespace qmf {
+
+#ifndef SWIG
+ template <class> class PrivateImplRef;
+#endif
+
+ class SubscriptionImpl;
+ class Data;
+
+ class QMF_CLASS_EXTERN Subscription : public qmf::Handle<SubscriptionImpl> {
+ public:
+ QMF_EXTERN Subscription(SubscriptionImpl* impl = 0);
+ QMF_EXTERN Subscription(const Subscription&);
+ QMF_EXTERN Subscription& operator=(const Subscription&);
+ QMF_EXTERN ~Subscription();
+
+ /**
+ * Construction: A subscription is created by calling ConsoleSession::subscribe.
+ */
+
+ /**
+ * Cancel subscriptions to all subscribed agents. After this is called, the subscription
+ * shall be inactive.
+ */
+ QMF_EXTERN void cancel();
+
+ /**
+ * Check to see if this subscription is active. It is active if it has a live subscription
+ * on at least one agent. If it is not active, there is nothing that can be done to make it
+ * active, it can only be deleted.
+ */
+ QMF_EXTERN bool isActive() const;
+
+ /**
+ * lock and unlock should be used to bracket a traversal of the data set. After lock is called,
+ * the subscription will not change its set of available data objects. Between calls to getDataCount
+ * and getData, no data objects will be added or removed. After unlock is called, the set of data
+ * will catch up to any activity that occurred while the lock was in effect.
+ */
+ QMF_EXTERN void lock();
+ QMF_EXTERN void unlock();
+ QMF_EXTERN uint32_t getDataCount() const;
+ QMF_EXTERN Data getData(uint32_t) const;
+
+#ifndef SWIG
+ private:
+ friend class qmf::PrivateImplRef<Subscription>;
+ friend struct SubscriptionImplAccess;
+#endif
+ };
+
+}
+
+#endif
diff --git a/qpid/cpp/include/qmf/engine/Agent.h b/qpid/cpp/include/qmf/engine/Agent.h
new file mode 100644
index 0000000000..71abf82254
--- /dev/null
+++ b/qpid/cpp/include/qmf/engine/Agent.h
@@ -0,0 +1,209 @@
+#ifndef _QmfEngineAgent_
+#define _QmfEngineAgent_
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <qmf/engine/Schema.h>
+#include <qmf/engine/ObjectId.h>
+#include <qmf/engine/Object.h>
+#include <qmf/engine/Event.h>
+#include <qmf/engine/Query.h>
+#include <qmf/engine/Value.h>
+#include <qmf/engine/Message.h>
+
+namespace qmf {
+namespace engine {
+
+ /**
+ * AgentEvent
+ *
+ * This structure represents a QMF event coming from the agent to
+ * the application.
+ */
+ struct AgentEvent {
+ enum EventKind {
+ GET_QUERY = 1,
+ START_SYNC = 2,
+ END_SYNC = 3,
+ METHOD_CALL = 4,
+ DECLARE_QUEUE = 5,
+ DELETE_QUEUE = 6,
+ BIND = 7,
+ UNBIND = 8,
+ SETUP_COMPLETE = 9
+ };
+
+ EventKind kind;
+ uint32_t sequence; // Protocol sequence (for all kinds)
+ char* authUserId; // Authenticated user ID (for all kinds)
+ char* authToken; // Authentication token if issued (for all kinds)
+ char* name; // Name of the method/sync query
+ // (METHOD_CALL, START_SYNC, END_SYNC, DECLARE_QUEUE, BIND, UNBIND)
+ Object* object; // Object involved in method call (METHOD_CALL)
+ ObjectId* objectId; // ObjectId for method call (METHOD_CALL)
+ Query* query; // Query parameters (GET_QUERY, START_SYNC)
+ Value* arguments; // Method parameters (METHOD_CALL)
+ char* exchange; // Exchange for bind (BIND, UNBIND)
+ char* bindingKey; // Key for bind (BIND, UNBIND)
+ const SchemaObjectClass* objectClass; // (METHOD_CALL)
+ };
+
+ class AgentImpl;
+
+ /**
+ * Agent - Protocol engine for the QMF agent
+ */
+ class Agent {
+ public:
+ Agent(char* label, bool internalStore=true);
+ ~Agent();
+
+ /**
+ * Configure the directory path for storing persistent data.
+ *@param path Null-terminated string containing a directory path where files can be
+ * created, written, and read. If NULL, no persistent storage will be
+ * attempted.
+ */
+ void setStoreDir(const char* path);
+
+ /**
+ * Configure the directory path for files transferred over QMF.
+ *@param path Null-terminated string containing a directory path where files can be
+ * created, deleted, written, and read. If NULL, file transfers shall not
+ * be permitted.
+ */
+ void setTransferDir(const char* path);
+
+ /**
+ * Pass messages received from the AMQP session to the Agent engine.
+ *@param message AMQP messages received on the agent session.
+ */
+ void handleRcvMessage(Message& message);
+
+ /**
+ * Get the next message to be sent to the AMQP network.
+ *@param item The Message structure describing the message to be produced.
+ *@return true if the Message is valid, false if there are no messages to send.
+ */
+ bool getXmtMessage(Message& item) const;
+
+ /**
+ * Remove and discard one message from the head of the transmit queue.
+ */
+ void popXmt();
+
+ /**
+ * Get the next application event from the agent engine.
+ *@param event The event iff the return value is true
+ *@return true if event is valid, false if there are no events to process
+ */
+ bool getEvent(AgentEvent& event) const;
+
+ /**
+ * Remove and discard one event from the head of the event queue.
+ */
+ void popEvent();
+
+ /**
+ * A new AMQP session has been established for Agent communication.
+ */
+ void newSession();
+
+ /**
+ * Start the QMF Agent protocol. This should be invoked after a SETUP_COMPLETE event
+ * is received from the Agent engine.
+ */
+ void startProtocol();
+
+ /**
+ * This method is called periodically so the agent can supply a heartbeat.
+ */
+ void heartbeat();
+
+ /**
+ * Respond to a method request.
+ *@param sequence The sequence number from the method request event.
+ *@param status The method's completion status.
+ *@param text Status text ("OK" or an error message)
+ *@param arguments The list of output arguments from the method call.
+ */
+ void methodResponse(uint32_t sequence, uint32_t status, char* text, const Value& arguments);
+
+ /**
+ * Send a content indication to the QMF bus. This is only needed for objects that are
+ * managed by the application. This is *NOT* needed for objects managed by the Agent
+ * (inserted using addObject).
+ *@param sequence The sequence number of the GET request or the SYNC_START request.
+ *@param object The object (annotated with "changed" flags) for publication.
+ *@param prop If true, changed object properties are transmitted.
+ *@param stat If true, changed object statistics are transmitted.
+ */
+ void queryResponse(uint32_t sequence, Object& object, bool prop = true, bool stat = true);
+
+ /**
+ * Indicate the completion of a query. This is not used for SYNC_START requests.
+ *@param sequence The sequence number of the GET request.
+ */
+ void queryComplete(uint32_t sequence);
+
+ /**
+ * Register a schema class with the Agent.
+ *@param cls A SchemaObejctClass object that defines data managed by the agent.
+ */
+ void registerClass(SchemaObjectClass* cls);
+
+ /**
+ * Register a schema class with the Agent.
+ *@param cls A SchemaEventClass object that defines events sent by the agent.
+ */
+ void registerClass(SchemaEventClass* cls);
+
+ /**
+ * Give an object to the Agent for storage and management. Once added, the agent takes
+ * responsibility for the life cycle of the object.
+ *@param obj The object to be managed by the Agent.
+ *@param persistId A unique non-zero value if the object-id is to be persistent.
+ *@return The objectId of the managed object.
+ */
+ const ObjectId* addObject(Object& obj, uint64_t persistId);
+ // const ObjectId* addObject(Object& obj, uint32_t persistIdLo, uint32_t persistIdHi);
+
+ /**
+ * Allocate an object-id for an object that will be managed by the application.
+ *@param persistId A unique non-zero value if the object-id is to be persistent.
+ *@return The objectId structure for the allocated ID.
+ */
+ const ObjectId* allocObjectId(uint64_t persistId);
+ const ObjectId* allocObjectId(uint32_t persistIdLo, uint32_t persistIdHi);
+
+ /**
+ * Raise an event into the QMF network..
+ *@param event The event object for the event to be raised.
+ */
+ void raiseEvent(Event& event);
+
+ private:
+ AgentImpl* impl;
+ };
+}
+}
+
+#endif
+
diff --git a/qpid/cpp/include/qmf/engine/ConnectionSettings.h b/qpid/cpp/include/qmf/engine/ConnectionSettings.h
new file mode 100644
index 0000000000..36312400b1
--- /dev/null
+++ b/qpid/cpp/include/qmf/engine/ConnectionSettings.h
@@ -0,0 +1,150 @@
+#ifndef _QmfEngineConnectionSettings_
+#define _QmfEngineConnectionSettings_
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "qmf/engine/QmfEngineImportExport.h"
+#include "qpid/sys/IntegerTypes.h"
+
+namespace qmf {
+namespace engine {
+
+ class ConnectionSettingsImpl;
+ class Value;
+
+ /**
+ * Settings for AMQP connections to the broker.
+ *
+ * \ingroup qmfapi
+ */
+ class ConnectionSettings {
+ public:
+
+ /**
+ * Create a set of default connection settings.
+ *
+ * If no further attributes are set, the settings will cause a connection to be made to
+ * the default broker (on localhost or at a host/port supplied by service discovery) and
+ * authentication will be the best-available (GSSAPI/Kerberos, Anonymous, Plain with prompts
+ * for username and password).
+ */
+ QMFE_EXTERN ConnectionSettings();
+
+ /**
+ * Create a set of connection settings by URL.
+ *
+ * @param url Universal resource locator describing the broker address and additional attributes.
+ *
+ * The URL is of the form:
+ * amqp[s]://host[:port][?key=value[&key=value]*]
+ *
+ * For example:
+ * amqp://localhost
+ * amqp://broker?transport=rdma&authmech=GSSAPI&authservice=qpidd
+ * amqps://broker?authmech=PLAIN&authuser=guest&authpass=guest
+ */
+ QMFE_EXTERN ConnectionSettings(const char* url);
+
+ /**
+ * Copy Constructor.
+ */
+ ConnectionSettings(const ConnectionSettings& from);
+
+ /**
+ * Destroy the connection settings object.
+ */
+ QMFE_EXTERN ~ConnectionSettings();
+
+ /**
+ * Set an attribute to control connection setup.
+ *
+ * @param key A null-terminated string that is an attribute name.
+ *
+ * @param value Reference to a value to be stored as the attribute. The type of the value
+ * is specific to the key.
+ *
+ * @return True if success, False if invalid attribute
+ */
+ QMFE_EXTERN bool setAttr(const char* key, const Value& value);
+
+ /**
+ * Get the value of an attribute.
+ *
+ * @param key A null-terminated attribute name.
+ *
+ * @return The value associated with the attribute name.
+ */
+ QMFE_EXTERN Value getAttr(const char* key) const;
+
+ /**
+ * Get the attribute string (the portion of the URL following the '?') for the settings.
+ *
+ * @return A pointer to the attribute string. If the content of this string needs to be
+ * available beyond the scope of the calling function, it should be copied. The
+ * returned pointer may become invalid if the set of attributes is changed.
+ */
+ QMFE_EXTERN const char* getAttrString() const;
+
+ /**
+ * Shortcuts for setting the transport for the connection.
+ *
+ * @param port The port value for the connection address.
+ */
+ QMFE_EXTERN void transportTcp(uint16_t port = 5672);
+ QMFE_EXTERN void transportSsl(uint16_t port = 5671);
+ QMFE_EXTERN void transportRdma(uint16_t port = 5672);
+
+ /**
+ * Shortcuts for setting authentication mechanisms.
+ *
+ * @param username Null-terminated authentication user name.
+ *
+ * @param password Null-terminated authentication password.
+ *
+ * @param serviceName Null-terminated GSSAPI service name (Kerberos service principal)
+ *
+ * @param minSsf Minimum security factor for connections. 0 = encryption not required.
+ *
+ * @param maxSsf Maximum security factor for connections. 0 = encryption not permitted.
+ */
+ QMFE_EXTERN void authAnonymous(const char* username = 0);
+ QMFE_EXTERN void authPlain(const char* username = 0, const char* password = 0);
+ QMFE_EXTERN void authGssapi(const char* serviceName, uint32_t minSsf = 0, uint32_t maxSsf = 256);
+
+ /**
+ * Shortcut for setting connection retry attributes.
+ *
+ * @param delayMin Minimum delay (in seconds) between connection attempts.
+ *
+ * @param delaxMax Maximum delay (in seconds) between connection attempts.
+ *
+ * @param delayFactor Factor to multiply the delay by between failed connection attempts.
+ */
+ QMFE_EXTERN void setRetry(int delayMin = 1, int delayMax = 128, int delayFactor = 2);
+
+ private:
+ friend class ResilientConnectionImpl;
+ ConnectionSettingsImpl* impl;
+ };
+
+}
+}
+
+#endif
diff --git a/qpid/cpp/include/qmf/engine/Console.h b/qpid/cpp/include/qmf/engine/Console.h
new file mode 100644
index 0000000000..bd40c63c6c
--- /dev/null
+++ b/qpid/cpp/include/qmf/engine/Console.h
@@ -0,0 +1,239 @@
+#ifndef _QmfEngineConsole_
+#define _QmfEngineConsole_
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <qmf/engine/ResilientConnection.h>
+#include <qmf/engine/Schema.h>
+#include <qmf/engine/ObjectId.h>
+#include <qmf/engine/Object.h>
+#include <qmf/engine/Event.h>
+#include <qmf/engine/Query.h>
+#include <qmf/engine/Value.h>
+#include <qmf/engine/Message.h>
+
+namespace qmf {
+namespace engine {
+
+ class Console;
+ class ConsoleImpl;
+ class BrokerProxyImpl;
+ class AgentProxy;
+ struct AgentProxyImpl;
+ struct MethodResponseImpl;
+ struct QueryResponseImpl;
+ struct QueryContext;
+
+ /**
+ *
+ */
+ class MethodResponse {
+ public:
+ MethodResponse(const MethodResponse& from);
+ ~MethodResponse();
+ uint32_t getStatus() const;
+ const Value* getException() const;
+ const Value* getArgs() const;
+
+ private:
+ friend struct MethodResponseImpl;
+ friend class ConsoleImpl;
+ MethodResponse(MethodResponseImpl* impl);
+ MethodResponseImpl* impl;
+ };
+
+ /**
+ *
+ */
+ class QueryResponse {
+ public:
+ ~QueryResponse();
+ uint32_t getStatus() const;
+ const Value* getException() const;
+ uint32_t getObjectCount() const;
+ const Object* getObject(uint32_t idx) const;
+
+ private:
+ friend struct QueryResponseImpl;
+ friend struct QueryContext;
+ QueryResponse(QueryResponseImpl* impl);
+ QueryResponseImpl *impl;
+ };
+
+ /**
+ *
+ */
+ struct ConsoleEvent {
+ enum EventKind {
+ AGENT_ADDED = 1,
+ AGENT_DELETED = 2,
+ NEW_PACKAGE = 3,
+ NEW_CLASS = 4,
+ OBJECT_UPDATE = 5,
+ EVENT_RECEIVED = 7,
+ AGENT_HEARTBEAT = 8
+ };
+
+ EventKind kind;
+ AgentProxy* agent; // (AGENT_[ADDED|DELETED|HEARTBEAT])
+ char* name; // (NEW_PACKAGE)
+ const SchemaClassKey* classKey; // (NEW_CLASS)
+ Object* object; // (OBJECT_UPDATE)
+ void* context; // (OBJECT_UPDATE)
+ Event* event; // (EVENT_RECEIVED)
+ uint64_t timestamp; // (AGENT_HEARTBEAT)
+ QueryResponse* queryResponse; // (QUERY_COMPLETE)
+ bool hasProps;
+ bool hasStats;
+ };
+
+ /**
+ *
+ */
+ struct BrokerEvent {
+ enum EventKind {
+ BROKER_INFO = 10,
+ DECLARE_QUEUE = 11,
+ DELETE_QUEUE = 12,
+ BIND = 13,
+ UNBIND = 14,
+ SETUP_COMPLETE = 15,
+ STABLE = 16,
+ QUERY_COMPLETE = 17,
+ METHOD_RESPONSE = 18
+ };
+
+ EventKind kind;
+ char* name; // ([DECLARE|DELETE]_QUEUE, [UN]BIND)
+ char* exchange; // ([UN]BIND)
+ char* bindingKey; // ([UN]BIND)
+ void* context; // (QUERY_COMPLETE, METHOD_RESPONSE)
+ QueryResponse* queryResponse; // (QUERY_COMPLETE)
+ MethodResponse* methodResponse; // (METHOD_RESPONSE)
+ };
+
+ /**
+ *
+ */
+ class AgentProxy {
+ public:
+ AgentProxy(const AgentProxy& from);
+ ~AgentProxy();
+ const char* getLabel() const;
+ uint32_t getBrokerBank() const;
+ uint32_t getAgentBank() const;
+
+ private:
+ friend struct StaticContext;
+ friend struct QueryContext;
+ friend struct AgentProxyImpl;
+ friend class BrokerProxyImpl;
+ AgentProxy(AgentProxyImpl* impl);
+ AgentProxyImpl* impl;
+ };
+
+ /**
+ *
+ */
+ class BrokerProxy {
+ public:
+ BrokerProxy(Console& console);
+ ~BrokerProxy();
+
+ void sessionOpened(SessionHandle& sh);
+ void sessionClosed();
+ void startProtocol();
+
+ void handleRcvMessage(Message& message);
+ bool getXmtMessage(Message& item) const;
+ void popXmt();
+
+ bool getEvent(BrokerEvent& event) const;
+ void popEvent();
+
+ uint32_t agentCount() const;
+ const AgentProxy* getAgent(uint32_t idx) const;
+ void sendQuery(const Query& query, void* context, const AgentProxy* agent = 0);
+
+ private:
+ friend class ConsoleImpl;
+ friend struct StaticContext;
+ BrokerProxyImpl* impl;
+ };
+
+ // TODO - move this to a public header
+ struct ConsoleSettings {
+ bool rcvObjects;
+ bool rcvEvents;
+ bool rcvHeartbeats;
+ bool userBindings;
+
+ ConsoleSettings() :
+ rcvObjects(true),
+ rcvEvents(true),
+ rcvHeartbeats(true),
+ userBindings(false) {}
+ };
+
+ class Console {
+ public:
+ Console(const ConsoleSettings& settings = ConsoleSettings());
+ ~Console();
+
+ bool getEvent(ConsoleEvent& event) const;
+ void popEvent();
+
+ void addConnection(BrokerProxy& broker, void* context);
+ void delConnection(BrokerProxy& broker);
+
+ uint32_t packageCount() const;
+ const char* getPackageName(uint32_t idx) const;
+
+ uint32_t classCount(const char* packageName) const;
+ const SchemaClassKey* getClass(const char* packageName, uint32_t idx) const;
+
+ ClassKind getClassKind(const SchemaClassKey* key) const;
+ const SchemaObjectClass* getObjectClass(const SchemaClassKey* key) const;
+ const SchemaEventClass* getEventClass(const SchemaClassKey* key) const;
+
+ void bindPackage(const char* packageName);
+ void bindClass(const SchemaClassKey* key);
+ void bindClass(const char* packageName, const char* className);
+
+ void bindEvent(const SchemaClassKey *key);
+ void bindEvent(const char* packageName, const char* eventName);
+
+ /*
+ void startSync(const Query& query, void* context, SyncQuery& sync);
+ void touchSync(SyncQuery& sync);
+ void endSync(SyncQuery& sync);
+ */
+
+ private:
+ friend class BrokerProxyImpl;
+ friend struct AgentProxyImpl;
+ friend struct StaticContext;
+ ConsoleImpl* impl;
+ };
+}
+}
+
+#endif
+
diff --git a/qpid/cpp/include/qmf/engine/Event.h b/qpid/cpp/include/qmf/engine/Event.h
new file mode 100644
index 0000000000..647b88dbf8
--- /dev/null
+++ b/qpid/cpp/include/qmf/engine/Event.h
@@ -0,0 +1,49 @@
+#ifndef _QmfEngineEvent_
+#define _QmfEngineEvent_
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+namespace qmf {
+namespace engine {
+
+ class SchemaEventClass;
+ class Value;
+ struct EventImpl;
+
+ class Event {
+ public:
+ Event(const SchemaEventClass* type);
+ Event(const Event& from);
+ ~Event();
+
+ const SchemaEventClass* getClass() const;
+ Value* getValue(const char* key) const;
+
+ private:
+ friend struct EventImpl;
+ friend class AgentImpl;
+ Event(EventImpl* impl);
+ EventImpl* impl;
+ };
+}
+}
+
+#endif
+
diff --git a/qpid/cpp/include/qmf/engine/Message.h b/qpid/cpp/include/qmf/engine/Message.h
new file mode 100644
index 0000000000..1e95cc6afe
--- /dev/null
+++ b/qpid/cpp/include/qmf/engine/Message.h
@@ -0,0 +1,41 @@
+#ifndef _QmfEngineMessage_
+#define _QmfEngineMessage_
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "qpid/sys/IntegerTypes.h"
+
+namespace qmf {
+namespace engine {
+
+ struct Message {
+ char* body;
+ uint32_t length;
+ char* destination;
+ char* routingKey;
+ char* replyExchange;
+ char* replyKey;
+ char* userId;
+ };
+
+}
+}
+
+#endif
diff --git a/qpid/cpp/include/qmf/engine/Object.h b/qpid/cpp/include/qmf/engine/Object.h
new file mode 100644
index 0000000000..ad67cfdb95
--- /dev/null
+++ b/qpid/cpp/include/qmf/engine/Object.h
@@ -0,0 +1,56 @@
+#ifndef _QmfEngineObject_
+#define _QmfEngineObject_
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <qmf/engine/Schema.h>
+#include <qmf/engine/ObjectId.h>
+#include <qmf/engine/Value.h>
+
+namespace qmf {
+namespace engine {
+
+ struct ObjectImpl;
+ class Object {
+ public:
+ Object(const SchemaObjectClass* type);
+ Object(const Object& from);
+ virtual ~Object();
+
+ void destroy();
+ const ObjectId* getObjectId() const;
+ void setObjectId(ObjectId* oid);
+ const SchemaObjectClass* getClass() const;
+ Value* getValue(const char* key) const;
+ void invokeMethod(const char* methodName, const Value* inArgs, void* context) const;
+ bool isDeleted() const;
+ void merge(const Object& from);
+
+ private:
+ friend struct ObjectImpl;
+ friend class AgentImpl;
+ Object(ObjectImpl* impl);
+ ObjectImpl* impl;
+ };
+}
+}
+
+#endif
+
diff --git a/qpid/cpp/include/qmf/engine/ObjectId.h b/qpid/cpp/include/qmf/engine/ObjectId.h
new file mode 100644
index 0000000000..51eb2bc9e7
--- /dev/null
+++ b/qpid/cpp/include/qmf/engine/ObjectId.h
@@ -0,0 +1,68 @@
+#ifndef _QmfEngineObjectId_
+#define _QmfEngineObjectId_
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <qpid/sys/IntegerTypes.h>
+
+namespace qmf {
+namespace engine {
+
+ // TODO: Add to/from string and << operator
+
+ struct ObjectIdImpl;
+ class ObjectId {
+ public:
+ ObjectId();
+ ObjectId(const ObjectId& from);
+ ~ObjectId();
+
+ uint64_t getObjectNum() const;
+ uint32_t getObjectNumHi() const;
+ uint32_t getObjectNumLo() const;
+ bool isDurable() const;
+ const char* str() const;
+ uint8_t getFlags() const;
+ uint16_t getSequence() const;
+ uint32_t getBrokerBank() const;
+ uint32_t getAgentBank() const;
+
+ bool operator==(const ObjectId& other) const;
+ bool operator<(const ObjectId& other) const;
+ bool operator>(const ObjectId& other) const;
+ bool operator<=(const ObjectId& other) const;
+ bool operator>=(const ObjectId& other) const;
+ ObjectId& operator=(const ObjectId &other);
+
+ private:
+ friend struct ObjectIdImpl;
+ friend struct ObjectImpl;
+ friend class BrokerProxyImpl;
+ friend struct QueryImpl;
+ friend struct ValueImpl;
+ friend class AgentImpl;
+ ObjectId(ObjectIdImpl* impl);
+ ObjectIdImpl* impl;
+ };
+}
+}
+
+#endif
+
diff --git a/qpid/cpp/include/qmf/engine/QmfEngineImportExport.h b/qpid/cpp/include/qmf/engine/QmfEngineImportExport.h
new file mode 100644
index 0000000000..cf8fffdb17
--- /dev/null
+++ b/qpid/cpp/include/qmf/engine/QmfEngineImportExport.h
@@ -0,0 +1,42 @@
+#ifndef QMF_ENGINE_IMPORT_EXPORT_H
+#define QMF_ENGINE_IMPORT_EXPORT_H
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#if defined(WIN32) && !defined(QPID_DECLARE_STATIC)
+# if defined(QMF_EXPORT) || defined (qmfengine_EXPORTS)
+# define QMFE_EXTERN __declspec(dllexport)
+# else
+# define QMFE_EXTERN __declspec(dllimport)
+# endif
+# ifdef _MSC_VER
+# define QMFE_CLASS_EXTERN
+# define QMFE_INLINE_EXTERN QMFE_EXTERN
+# else
+# define QMFE_CLASS_EXTERN QMFE_EXTERN
+# define QMFE_INLINE_EXTERN
+# endif
+#else
+# define QMFE_EXTERN
+# define QMFE_CLASS_EXTERN
+# define QMFE_INLINE_EXTERN
+#endif
+
+#endif
diff --git a/qpid/cpp/include/qmf/engine/Query.h b/qpid/cpp/include/qmf/engine/Query.h
new file mode 100644
index 0000000000..3ed08c5d8e
--- /dev/null
+++ b/qpid/cpp/include/qmf/engine/Query.h
@@ -0,0 +1,112 @@
+#ifndef _QmfEngineQuery_
+#define _QmfEngineQuery_
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <qmf/engine/ObjectId.h>
+#include <qmf/engine/Value.h>
+
+namespace qmf {
+namespace engine {
+
+ class Object;
+ struct QueryElementImpl;
+ struct QueryImpl;
+ struct QueryExpressionImpl;
+ class SchemaClassKey;
+
+ enum ValueOper {
+ O_EQ = 1,
+ O_NE = 2,
+ O_LT = 3,
+ O_LE = 4,
+ O_GT = 5,
+ O_GE = 6,
+ O_RE_MATCH = 7,
+ O_RE_NOMATCH = 8,
+ O_PRESENT = 9,
+ O_NOT_PRESENT = 10
+ };
+
+ struct QueryOperand {
+ virtual ~QueryOperand() {}
+ virtual bool evaluate(const Object* object) const = 0;
+ };
+
+ struct QueryElement : public QueryOperand {
+ QueryElement(const char* attrName, const Value* value, ValueOper oper);
+ QueryElement(QueryElementImpl* impl);
+ virtual ~QueryElement();
+ bool evaluate(const Object* object) const;
+
+ QueryElementImpl* impl;
+ };
+
+ enum ExprOper {
+ E_NOT = 1,
+ E_AND = 2,
+ E_OR = 3,
+ E_XOR = 4
+ };
+
+ struct QueryExpression : public QueryOperand {
+ QueryExpression(ExprOper oper, const QueryOperand* operand1, const QueryOperand* operand2);
+ QueryExpression(QueryExpressionImpl* impl);
+ virtual ~QueryExpression();
+ bool evaluate(const Object* object) const;
+
+ QueryExpressionImpl* impl;
+ };
+
+ class Query {
+ public:
+ Query(const char* className, const char* packageName);
+ Query(const SchemaClassKey* key);
+ Query(const ObjectId* oid);
+ Query(const Query& from);
+ ~Query();
+
+ void setSelect(const QueryOperand* criterion);
+ void setLimit(uint32_t maxResults);
+ void setOrderBy(const char* attrName, bool decreasing);
+
+ const char* getPackage() const;
+ const char* getClass() const;
+ const ObjectId* getObjectId() const;
+
+ bool haveSelect() const;
+ bool haveLimit() const;
+ bool haveOrderBy() const;
+ const QueryOperand* getSelect() const;
+ uint32_t getLimit() const;
+ const char* getOrderBy() const;
+ bool getDecreasing() const;
+
+ private:
+ friend struct QueryImpl;
+ friend class BrokerProxyImpl;
+ Query(QueryImpl* impl);
+ QueryImpl* impl;
+ };
+}
+}
+
+#endif
+
diff --git a/qpid/cpp/include/qmf/engine/ResilientConnection.h b/qpid/cpp/include/qmf/engine/ResilientConnection.h
new file mode 100644
index 0000000000..c03d08cb96
--- /dev/null
+++ b/qpid/cpp/include/qmf/engine/ResilientConnection.h
@@ -0,0 +1,173 @@
+#ifndef _QmfEngineResilientConnection_
+#define _QmfEngineResilientConnection_
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <qmf/engine/Message.h>
+#include <qmf/engine/ConnectionSettings.h>
+#include <string>
+
+namespace qmf {
+namespace engine {
+
+ class ResilientConnectionImpl;
+
+ /**
+ * Represents events that occur, unsolicited, from ResilientConnection.
+ */
+ struct ResilientConnectionEvent {
+ enum EventKind {
+ CONNECTED = 1,
+ DISCONNECTED = 2,
+ SESSION_CLOSED = 3,
+ RECV = 4
+ };
+
+ EventKind kind;
+ void* sessionContext; // SESSION_CLOSED, RECV
+ char* errorText; // DISCONNECTED, SESSION_CLOSED
+ Message message; // RECV
+ };
+
+ class SessionHandle {
+ friend class ResilientConnectionImpl;
+ void* impl;
+ };
+
+ /**
+ * ResilientConnection represents a Qpid connection that is resilient.
+ *
+ * Upon creation, ResilientConnection attempts to establish a connection to the
+ * messaging broker. If it fails, it will continue to retry at an interval that
+ * increases over time (to a maximum interval). If an extablished connection is
+ * dropped, a reconnect will be attempted.
+ */
+ class ResilientConnection {
+ public:
+
+ /**
+ * Create a new resilient connection.
+ *@param settings Settings that define how the connection is to be made.
+ *@param delayMin Minimum delay (in seconds) between retries.
+ *@param delayMax Maximum delay (in seconds) between retries.
+ *@param delayFactor Factor to multiply retry delay by after each failure.
+ */
+ ResilientConnection(const ConnectionSettings& settings);
+ ~ResilientConnection();
+
+ /**
+ * Get the connected status of the resilient connection.
+ *@return true iff the connection is established.
+ */
+ bool isConnected() const;
+
+ /**
+ * Get the next event (if present) from the connection.
+ *@param event Returned event if one is available.
+ *@return true if event is valid, false if there are no more events to handle.
+ */
+ bool getEvent(ResilientConnectionEvent& event);
+
+ /**
+ * Discard the event on the front of the queue. This should be invoked after processing
+ * the event from getEvent.
+ */
+ void popEvent();
+
+ /**
+ * Create a new AMQP session.
+ *@param name Unique name for the session.
+ *@param sessionContext Optional user-context value that will be provided in events
+ * pertaining to this session.
+ *@param handle Output handle to be stored and used in subsequent calls pertaining to
+ * this session.
+ *@return true iff the session was successfully created.
+ */
+ bool createSession(const char* name, void* sessionContext, SessionHandle& handle);
+
+ /**
+ * Destroy a created session.
+ *@param handle SessionHandle returned by createSession.
+ */
+ void destroySession(SessionHandle handle);
+
+ /**
+ * Send a message into the AMQP broker via a session.
+ *@param handle The session handle of the session to transmit through.
+ *@param message The QMF message to transmit.
+ */
+ void sendMessage(SessionHandle handle, Message& message);
+
+ /**
+ * Declare an exclusive, auto-delete queue for a session.
+ *@param handle The session handle for the owner of the queue.
+ *@param queue The name of the queue.
+ */
+ void declareQueue(SessionHandle handle, char* queue);
+
+ /**
+ * Delete a queue.
+ *@param handle The session handle for the owner of the queue.
+ *@param queue The name of the queue.
+ */
+ void deleteQueue(SessionHandle handle, char* queue);
+
+ /**
+ * Bind a queue to an exchange.
+ *@param handle The session handle of the session to use for binding.
+ *@param exchange The name of the exchange for binding.
+ *@param queue The name of the queue for binding.
+ *@param key The binding key.
+ */
+ void bind(SessionHandle handle, char* exchange, char* queue, char* key);
+
+ /**
+ * Remove a binding.
+ *@param handle The session handle of the session to use for un-binding.
+ *@param exchange The name of the exchange.
+ *@param queue The name of the queue.
+ *@param key The binding key.
+ */
+ void unbind(SessionHandle handle, char* exchange, char* queue, char* key);
+
+ /**
+ * Establish a file descriptor for event notification.
+ *@param fd A file descriptor into which the connection shall write a character each
+ * time an event is enqueued. This fd may be in a pair, the other fd of which
+ * is used in a select loop to control execution.
+ */
+ void setNotifyFd(int fd);
+
+ /**
+ * Send a byte into the notify file descriptor.
+ *
+ * This can be used to wake up the event processing portion of the engine from either the
+ * wrapped implementation or the engine itself.
+ */
+ void notify();
+
+ private:
+ ResilientConnectionImpl* impl;
+ };
+}
+}
+
+#endif
+
diff --git a/qpid/cpp/include/qmf/engine/Schema.h b/qpid/cpp/include/qmf/engine/Schema.h
new file mode 100644
index 0000000000..f53e84324a
--- /dev/null
+++ b/qpid/cpp/include/qmf/engine/Schema.h
@@ -0,0 +1,212 @@
+#ifndef _QmfEngineSchema_
+#define _QmfEngineSchema_
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <qmf/engine/Typecode.h>
+#include <qpid/sys/IntegerTypes.h>
+
+namespace qmf {
+namespace engine {
+
+ enum Access { ACCESS_READ_CREATE = 1, ACCESS_READ_WRITE = 2, ACCESS_READ_ONLY = 3 };
+ enum Direction { DIR_IN = 1, DIR_OUT = 2, DIR_IN_OUT = 3 };
+ enum ClassKind { CLASS_OBJECT = 1, CLASS_EVENT = 2 };
+ enum Severity { SEV_EMERG = 0, SEV_ALERT = 1, SEV_CRIT = 2, SEV_ERROR = 3, SEV_WARN = 4, SEV_NOTICE = 5, SEV_INFORM = 6, SEV_DEBUG = 7 };
+
+ struct SchemaArgumentImpl;
+ struct SchemaMethodImpl;
+ struct SchemaPropertyImpl;
+ struct SchemaStatisticImpl;
+ struct SchemaObjectClassImpl;
+ struct SchemaEventClassImpl;
+ struct SchemaClassKeyImpl;
+
+ /**
+ */
+ class SchemaArgument {
+ public:
+ SchemaArgument(const char* name, Typecode typecode);
+ SchemaArgument(const SchemaArgument& from);
+ ~SchemaArgument();
+ void setDirection(Direction dir);
+ void setUnit(const char* val);
+ void setDesc(const char* desc);
+ const char* getName() const;
+ Typecode getType() const;
+ Direction getDirection() const;
+ const char* getUnit() const;
+ const char* getDesc() const;
+
+ private:
+ friend struct SchemaArgumentImpl;
+ friend struct SchemaMethodImpl;
+ friend struct SchemaEventClassImpl;
+ SchemaArgument(SchemaArgumentImpl* impl);
+ SchemaArgumentImpl* impl;
+ };
+
+ /**
+ */
+ class SchemaMethod {
+ public:
+ SchemaMethod(const char* name);
+ SchemaMethod(const SchemaMethod& from);
+ ~SchemaMethod();
+ void addArgument(const SchemaArgument* argument);
+ void setDesc(const char* desc);
+ const char* getName() const;
+ const char* getDesc() const;
+ int getArgumentCount() const;
+ const SchemaArgument* getArgument(int idx) const;
+
+ private:
+ friend struct SchemaMethodImpl;
+ friend struct SchemaObjectClassImpl;
+ friend class AgentImpl;
+ SchemaMethod(SchemaMethodImpl* impl);
+ SchemaMethodImpl* impl;
+ };
+
+ /**
+ */
+ class SchemaProperty {
+ public:
+ SchemaProperty(const char* name, Typecode typecode);
+ SchemaProperty(const SchemaProperty& from);
+ ~SchemaProperty();
+ void setAccess(Access access);
+ void setIndex(bool val);
+ void setOptional(bool val);
+ void setUnit(const char* val);
+ void setDesc(const char* desc);
+ const char* getName() const;
+ Typecode getType() const;
+ Access getAccess() const;
+ bool isIndex() const;
+ bool isOptional() const;
+ const char* getUnit() const;
+ const char* getDesc() const;
+
+ private:
+ friend struct SchemaPropertyImpl;
+ friend struct SchemaObjectClassImpl;
+ SchemaProperty(SchemaPropertyImpl* impl);
+ SchemaPropertyImpl* impl;
+ };
+
+ /**
+ */
+ class SchemaStatistic {
+ public:
+ SchemaStatistic(const char* name, Typecode typecode);
+ SchemaStatistic(const SchemaStatistic& from);
+ ~SchemaStatistic();
+ void setUnit(const char* val);
+ void setDesc(const char* desc);
+ const char* getName() const;
+ Typecode getType() const;
+ const char* getUnit() const;
+ const char* getDesc() const;
+
+ private:
+ friend struct SchemaStatisticImpl;
+ friend struct SchemaObjectClassImpl;
+ SchemaStatistic(SchemaStatisticImpl* impl);
+ SchemaStatisticImpl* impl;
+ };
+
+ /**
+ */
+ class SchemaClassKey {
+ public:
+ SchemaClassKey(const SchemaClassKey& from);
+ ~SchemaClassKey();
+
+ const char* getPackageName() const;
+ const char* getClassName() const;
+ const uint8_t* getHash() const;
+ const char* asString() const;
+
+ bool operator==(const SchemaClassKey& other) const;
+ bool operator<(const SchemaClassKey& other) const;
+
+ private:
+ friend struct SchemaClassKeyImpl;
+ friend class BrokerProxyImpl;
+ friend class ConsoleImpl;
+ SchemaClassKey(SchemaClassKeyImpl* impl);
+ SchemaClassKeyImpl* impl;
+ };
+
+ /**
+ */
+ class SchemaObjectClass {
+ public:
+ SchemaObjectClass(const char* package, const char* name);
+ SchemaObjectClass(const SchemaObjectClass& from);
+ ~SchemaObjectClass();
+ void addProperty(const SchemaProperty* property);
+ void addStatistic(const SchemaStatistic* statistic);
+ void addMethod(const SchemaMethod* method);
+
+ const SchemaClassKey* getClassKey() const;
+ int getPropertyCount() const;
+ int getStatisticCount() const;
+ int getMethodCount() const;
+ const SchemaProperty* getProperty(int idx) const;
+ const SchemaStatistic* getStatistic(int idx) const;
+ const SchemaMethod* getMethod(int idx) const;
+
+ private:
+ friend struct SchemaObjectClassImpl;
+ friend class BrokerProxyImpl;
+ friend class AgentImpl;
+ SchemaObjectClass(SchemaObjectClassImpl* impl);
+ SchemaObjectClassImpl* impl;
+ };
+
+ /**
+ */
+ class SchemaEventClass {
+ public:
+ SchemaEventClass(const char* package, const char* name, Severity severity);
+ SchemaEventClass(const SchemaEventClass& from);
+ ~SchemaEventClass();
+ void addArgument(const SchemaArgument* argument);
+ void setDesc(const char* desc);
+
+ const SchemaClassKey* getClassKey() const;
+ Severity getSeverity() const;
+ int getArgumentCount() const;
+ const SchemaArgument* getArgument(int idx) const;
+
+ private:
+ friend struct SchemaEventClassImpl;
+ friend class BrokerProxyImpl;
+ friend class AgentImpl;
+ SchemaEventClass(SchemaEventClassImpl* impl);
+ SchemaEventClassImpl* impl;
+ };
+}
+}
+
+#endif
+
diff --git a/qpid/cpp/include/qmf/engine/Typecode.h b/qpid/cpp/include/qmf/engine/Typecode.h
new file mode 100644
index 0000000000..613f96a483
--- /dev/null
+++ b/qpid/cpp/include/qmf/engine/Typecode.h
@@ -0,0 +1,53 @@
+#ifndef _QmfEngineTypecode_
+#define _QmfEngineTypecode_
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+namespace qmf {
+namespace engine {
+
+ enum Typecode {
+ TYPE_UINT8 = 1,
+ TYPE_UINT16 = 2,
+ TYPE_UINT32 = 3,
+ TYPE_UINT64 = 4,
+ TYPE_SSTR = 6,
+ TYPE_LSTR = 7,
+ TYPE_ABSTIME = 8,
+ TYPE_DELTATIME = 9,
+ TYPE_REF = 10,
+ TYPE_BOOL = 11,
+ TYPE_FLOAT = 12,
+ TYPE_DOUBLE = 13,
+ TYPE_UUID = 14,
+ TYPE_MAP = 15,
+ TYPE_INT8 = 16,
+ TYPE_INT16 = 17,
+ TYPE_INT32 = 18,
+ TYPE_INT64 = 19,
+ TYPE_OBJECT = 20,
+ TYPE_LIST = 21,
+ TYPE_ARRAY = 22
+ };
+}
+}
+
+#endif
+
diff --git a/qpid/cpp/include/qmf/engine/Value.h b/qpid/cpp/include/qmf/engine/Value.h
new file mode 100644
index 0000000000..5b45061b78
--- /dev/null
+++ b/qpid/cpp/include/qmf/engine/Value.h
@@ -0,0 +1,122 @@
+#ifndef _QmfEngineValue_
+#define _QmfEngineValue_
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <qmf/engine/ObjectId.h>
+#include <qmf/engine/Typecode.h>
+
+namespace qmf {
+namespace engine {
+
+ class Object;
+ struct ValueImpl;
+
+ class Value {
+ public:
+ // Value();
+ Value(const Value& from);
+ Value(Typecode t, Typecode arrayType = TYPE_UINT8);
+ ~Value();
+
+ Typecode getType() const;
+ bool isNull() const;
+ void setNull();
+
+ bool isObjectId() const;
+ const ObjectId& asObjectId() const;
+ void setObjectId(const ObjectId& oid);
+
+ bool isUint() const;
+ uint32_t asUint() const;
+ void setUint(uint32_t val);
+
+ bool isInt() const;
+ int32_t asInt() const;
+ void setInt(int32_t val);
+
+ bool isUint64() const;
+ uint64_t asUint64() const;
+ void setUint64(uint64_t val);
+
+ bool isInt64() const;
+ int64_t asInt64() const;
+ void setInt64(int64_t val);
+
+ bool isString() const;
+ const char* asString() const;
+ void setString(const char* val);
+
+ bool isBool() const;
+ bool asBool() const;
+ void setBool(bool val);
+
+ bool isFloat() const;
+ float asFloat() const;
+ void setFloat(float val);
+
+ bool isDouble() const;
+ double asDouble() const;
+ void setDouble(double val);
+
+ bool isUuid() const;
+ const uint8_t* asUuid() const;
+ void setUuid(const uint8_t* val);
+
+ bool isObject() const;
+ const Object* asObject() const;
+ void setObject(Object* val);
+
+ bool isMap() const;
+ bool keyInMap(const char* key) const;
+ Value* byKey(const char* key);
+ const Value* byKey(const char* key) const;
+ void deleteKey(const char* key);
+ void insert(const char* key, Value* val);
+ uint32_t keyCount() const;
+ const char* key(uint32_t idx) const;
+
+ bool isList() const;
+ uint32_t listItemCount() const;
+ Value* listItem(uint32_t idx);
+ void appendToList(Value* val);
+ void deleteListItem(uint32_t idx);
+
+ bool isArray() const;
+ Typecode arrayType() const;
+ uint32_t arrayItemCount() const;
+ Value* arrayItem(uint32_t idx);
+ void appendToArray(Value* val);
+ void deleteArrayItem(uint32_t idx);
+
+ private:
+ friend struct ValueImpl;
+ friend class BrokerProxyImpl;
+ friend struct ObjectImpl;
+ friend struct EventImpl;
+ friend class AgentImpl;
+ Value(ValueImpl* impl);
+ ValueImpl* impl;
+ };
+}
+}
+
+#endif
+
diff --git a/qpid/cpp/include/qmf/exceptions.h b/qpid/cpp/include/qmf/exceptions.h
new file mode 100644
index 0000000000..c7ffa68ce2
--- /dev/null
+++ b/qpid/cpp/include/qmf/exceptions.h
@@ -0,0 +1,59 @@
+#ifndef QMF_EXCEPTIONS_H
+#define QMF_EXCEPTIONS_H
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include "qmf/ImportExport.h"
+#include "qpid/types/Exception.h"
+#include "qpid/types/Variant.h"
+
+namespace qmf {
+
+/** \ingroup qmf
+ */
+
+ struct QMF_CLASS_EXTERN QmfException : public qpid::types::Exception {
+ QMF_EXTERN QmfException(const std::string& msg);
+ QMF_EXTERN virtual ~QmfException() throw();
+
+ qpid::types::Variant::Map detail;
+ };
+
+ struct QMF_CLASS_EXTERN KeyNotFound : public QmfException {
+ QMF_EXTERN KeyNotFound(const std::string& msg);
+ QMF_EXTERN virtual ~KeyNotFound() throw();
+ };
+
+ struct QMF_CLASS_EXTERN IndexOutOfRange : public QmfException {
+ QMF_EXTERN IndexOutOfRange();
+ QMF_EXTERN virtual ~IndexOutOfRange() throw();
+ };
+
+ struct QMF_CLASS_EXTERN OperationTimedOut : public QmfException {
+ QMF_EXTERN OperationTimedOut();
+ QMF_EXTERN virtual ~OperationTimedOut() throw();
+ };
+
+}
+
+#endif
+