diff options
author | Ted Ross <tross@apache.org> | 2009-09-25 20:24:22 +0000 |
---|---|---|
committer | Ted Ross <tross@apache.org> | 2009-09-25 20:24:22 +0000 |
commit | 97abe1cb80434eec7308a2f611cc884dd3a10d1f (patch) | |
tree | b49a46247e68f00c12c797f5fbc41f024f784a3f /cpp/src | |
parent | 6214f62e118a83b4cc593298ceb0658e28662845 (diff) | |
download | qpid-python-97abe1cb80434eec7308a2f611cc884dd3a10d1f.tar.gz |
QMF updates:
- Refactored into two namespaces:
1) 'qmf' for the public QMF api (c++)
2) 'qmf::engine' for the public engine API (used for language bindings)
- Added object and first_object calls to Console (in Ruby)
- Made objects call compatible with the kwarg arguments used in the older API
- Added to_s functions to classes that needed them
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@818994 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/qmf.mk | 122 | ||||
-rw-r--r-- | cpp/src/qmf/AgentEngine.h | 207 | ||||
-rw-r--r-- | cpp/src/qmf/ConsoleEngine.h | 226 | ||||
-rw-r--r-- | cpp/src/qmf/Event.h | 30 | ||||
-rw-r--r-- | cpp/src/qmf/Message.h | 39 | ||||
-rw-r--r-- | cpp/src/qmf/Object.h | 54 | ||||
-rw-r--r-- | cpp/src/qmf/ObjectId.h | 60 | ||||
-rw-r--r-- | cpp/src/qmf/Query.h | 108 | ||||
-rw-r--r-- | cpp/src/qmf/ResilientConnection.h | 163 | ||||
-rw-r--r-- | cpp/src/qmf/Schema.h | 207 | ||||
-rw-r--r-- | cpp/src/qmf/Typecode.h | 51 | ||||
-rw-r--r-- | cpp/src/qmf/Value.h | 119 | ||||
-rw-r--r-- | cpp/src/qmf/engine/Agent.cpp (renamed from cpp/src/qmf/AgentEngine.cpp) | 154 | ||||
-rw-r--r-- | cpp/src/qmf/engine/BrokerProxyImpl.cpp (renamed from cpp/src/qmf/BrokerProxyImpl.cpp) | 12 | ||||
-rw-r--r-- | cpp/src/qmf/engine/BrokerProxyImpl.h (renamed from cpp/src/qmf/BrokerProxyImpl.h) | 32 | ||||
-rw-r--r-- | cpp/src/qmf/engine/ConnectionSettingsImpl.cpp (renamed from cpp/src/qmf/ConnectionSettingsImpl.cpp) | 6 | ||||
-rw-r--r-- | cpp/src/qmf/engine/ConnectionSettingsImpl.h (renamed from cpp/src/qmf/ConnectionSettingsImpl.h) | 10 | ||||
-rw-r--r-- | cpp/src/qmf/engine/ConsoleImpl.cpp (renamed from cpp/src/qmf/ConsoleEngineImpl.cpp) | 110 | ||||
-rw-r--r-- | cpp/src/qmf/engine/ConsoleImpl.h (renamed from cpp/src/qmf/ConsoleEngineImpl.h) | 34 | ||||
-rw-r--r-- | cpp/src/qmf/engine/MessageImpl.cpp (renamed from cpp/src/qmf/MessageImpl.cpp) | 4 | ||||
-rw-r--r-- | cpp/src/qmf/engine/MessageImpl.h (renamed from cpp/src/qmf/MessageImpl.h) | 8 | ||||
-rw-r--r-- | cpp/src/qmf/engine/ObjectIdImpl.cpp (renamed from cpp/src/qmf/ObjectIdImpl.cpp) | 4 | ||||
-rw-r--r-- | cpp/src/qmf/engine/ObjectIdImpl.h (renamed from cpp/src/qmf/ObjectIdImpl.h) | 8 | ||||
-rw-r--r-- | cpp/src/qmf/engine/ObjectImpl.cpp (renamed from cpp/src/qmf/ObjectImpl.cpp) | 8 | ||||
-rw-r--r-- | cpp/src/qmf/engine/ObjectImpl.h (renamed from cpp/src/qmf/ObjectImpl.h) | 10 | ||||
-rw-r--r-- | cpp/src/qmf/engine/Protocol.cpp (renamed from cpp/src/qmf/Protocol.cpp) | 4 | ||||
-rw-r--r-- | cpp/src/qmf/engine/Protocol.h (renamed from cpp/src/qmf/Protocol.h) | 6 | ||||
-rw-r--r-- | cpp/src/qmf/engine/QueryImpl.cpp (renamed from cpp/src/qmf/QueryImpl.cpp) | 6 | ||||
-rw-r--r-- | cpp/src/qmf/engine/QueryImpl.h (renamed from cpp/src/qmf/QueryImpl.h) | 10 | ||||
-rw-r--r-- | cpp/src/qmf/engine/ResilientConnection.cpp (renamed from cpp/src/qmf/ResilientConnection.cpp) | 20 | ||||
-rw-r--r-- | cpp/src/qmf/engine/SchemaImpl.cpp (renamed from cpp/src/qmf/SchemaImpl.cpp) | 4 | ||||
-rw-r--r-- | cpp/src/qmf/engine/SchemaImpl.h (renamed from cpp/src/qmf/SchemaImpl.h) | 8 | ||||
-rw-r--r-- | cpp/src/qmf/engine/SequenceManager.cpp (renamed from cpp/src/qmf/SequenceManager.cpp) | 4 | ||||
-rw-r--r-- | cpp/src/qmf/engine/SequenceManager.h (renamed from cpp/src/qmf/SequenceManager.h) | 6 | ||||
-rw-r--r-- | cpp/src/qmf/engine/ValueImpl.cpp (renamed from cpp/src/qmf/ValueImpl.cpp) | 4 | ||||
-rw-r--r-- | cpp/src/qmf/engine/ValueImpl.h (renamed from cpp/src/qmf/ValueImpl.h) | 12 | ||||
-rw-r--r-- | cpp/src/qpid/broker/SemanticState.cpp | 2 |
37 files changed, 332 insertions, 1540 deletions
diff --git a/cpp/src/qmf.mk b/cpp/src/qmf.mk index 65caaedd5c..7b392ca1f1 100644 --- a/cpp/src/qmf.mk +++ b/cpp/src/qmf.mk @@ -20,12 +20,14 @@ # # qmf library makefile fragment, to be included in Makefile.am # -lib_LTLIBRARIES += \ - libqmfcommon.la \ - libqmfagent.la +lib_LTLIBRARIES += \ + libqmf.la \ + libqmfengine.la -# Public header files -nobase_include_HEADERS += \ +# +# Public headers for the QMF API +# +QMF_API = \ ../include/qpid/agent/ManagementAgent.h \ ../include/qpid/agent/QmfAgentImportExport.h \ ../include/qmf/Agent.h \ @@ -34,45 +36,75 @@ nobase_include_HEADERS += \ ../include/qmf/ConnectionSettings.h \ ../include/qmf/AgentObject.h -libqmfcommon_la_SOURCES = \ - qmf/BrokerProxyImpl.cpp \ - qmf/BrokerProxyImpl.h \ - qmf/ConnectionSettingsImpl.cpp \ - qmf/ConnectionSettingsImpl.h \ - qmf/ConsoleEngineImpl.cpp \ - qmf/ConsoleEngineImpl.h \ - qmf/ConsoleEngine.h \ - qmf/Event.h \ - qmf/Message.h \ - qmf/MessageImpl.cpp \ - qmf/MessageImpl.h \ - qmf/Object.h \ - qmf/ObjectId.h \ - qmf/ObjectIdImpl.cpp \ - qmf/ObjectIdImpl.h \ - qmf/ObjectImpl.cpp \ - qmf/ObjectImpl.h \ - qmf/Protocol.cpp \ - qmf/Protocol.h \ - qmf/Query.h \ - qmf/QueryImpl.cpp \ - qmf/QueryImpl.h \ - qmf/ResilientConnection.cpp \ - qmf/ResilientConnection.h \ - qmf/SequenceManager.cpp \ - qmf/SequenceManager.h \ - qmf/Schema.h \ - qmf/SchemaImpl.cpp \ - qmf/SchemaImpl.h \ - qmf/Typecode.h \ - qmf/Value.h \ - qmf/ValueImpl.cpp \ - qmf/ValueImpl.h +# +# Public headers for the QMF Engine API +# +QMF_ENGINE_API = \ + ../include/qmf/engine/Agent.h \ + ../include/qmf/engine/Console.h \ + ../include/qmf/engine/Event.h \ + ../include/qmf/engine/Message.h \ + ../include/qmf/engine/Object.h \ + ../include/qmf/engine/ObjectId.h \ + ../include/qmf/engine/Query.h \ + ../include/qmf/engine/ResilientConnection.h \ + ../include/qmf/engine/Schema.h \ + ../include/qmf/engine/Typecode.h \ + ../include/qmf/engine/Value.h + +# Public header files +nobase_include_HEADERS += \ + $(QMF_API) \ + $(QMF_ENGINE_API) + +libqmf_la_SOURCES = \ + $(QMF_API) \ + qpid/agent/ManagementAgentImpl.cpp + +libqmfengine_la_SOURCES = \ + $(QMF_ENGINE_API) \ + qmf/engine/Agent.cpp \ + qmf/engine/BrokerProxyImpl.cpp \ + qmf/engine/BrokerProxyImpl.h \ + qmf/engine/ConnectionSettingsImpl.cpp \ + qmf/engine/ConnectionSettingsImpl.h \ + qmf/engine/ConsoleImpl.cpp \ + qmf/engine/ConsoleImpl.h \ + qmf/engine/MessageImpl.cpp \ + qmf/engine/MessageImpl.h \ + qmf/engine/ObjectIdImpl.cpp \ + qmf/engine/ObjectIdImpl.h \ + qmf/engine/ObjectImpl.cpp \ + qmf/engine/ObjectImpl.h \ + qmf/engine/Protocol.cpp \ + qmf/engine/Protocol.h \ + qmf/engine/QueryImpl.cpp \ + qmf/engine/QueryImpl.h \ + qmf/engine/ResilientConnection.cpp \ + qmf/engine/SequenceManager.cpp \ + qmf/engine/SequenceManager.h \ + qmf/engine/SchemaImpl.cpp \ + qmf/engine/SchemaImpl.h \ + qmf/engine/ValueImpl.cpp \ + qmf/engine/ValueImpl.h + +libqmf_la_LIBADD = libqmfengine.la +libqmfengine_la_LIBADD = libqpidclient.la + +# Library Version Information: +# +# CURRENT => API/ABI version. Bump this if the interface changes +# REVISION => Version of underlying implementation. +# Bump if implementation changes but API/ABI doesn't +# AGE => Number of API/ABI versions this is backward compatible with +# +QMF_CURRENT = 1 +QMF_REVISION = 0 +QMF_AGE = 0 -libqmfagent_la_SOURCES = \ - qmf/AgentEngine.cpp \ - qmf/AgentEngine.h \ - qpid/agent/ManagementAgentImpl.cpp \ - qpid/agent/ManagementAgentImpl.h +QMF_ENGINE_CURRENT = 1 +QMF_ENGINE_REVISION = 0 +QMF_ENGINE_AGE = 0 -libqmfagent_la_LIBADD = libqpidclient.la libqmfcommon.la +libqmf_la_LDFLAGS = -version-info $(QMF_CURRENT):$(QMF_REVISION):$(QMF_AGE) +libqmfengine_la_LDFLAGS = -version-info $(QMF_ENGINE_CURRENT):$(QMF_ENGINE_REVISION):$(QMF_ENGINE_AGE) diff --git a/cpp/src/qmf/AgentEngine.h b/cpp/src/qmf/AgentEngine.h deleted file mode 100644 index bf91cbb4c8..0000000000 --- a/cpp/src/qmf/AgentEngine.h +++ /dev/null @@ -1,207 +0,0 @@ -#ifndef _QmfAgentEngine_ -#define _QmfAgentEngine_ - -/* - * 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/Schema.h> -#include <qmf/ObjectId.h> -#include <qmf/Object.h> -#include <qmf/Event.h> -#include <qmf/Query.h> -#include <qmf/Value.h> -#include <qmf/Message.h> - -namespace qmf { - - /** - * 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 AgentEngineImpl; - - /** - * AgentEngine - Protocol engine for the QMF agent - */ - class AgentEngine { - public: - AgentEngine(char* label, bool internalStore=true); - ~AgentEngine(); - - /** - * 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: - AgentEngineImpl* impl; - }; -} - -#endif - diff --git a/cpp/src/qmf/ConsoleEngine.h b/cpp/src/qmf/ConsoleEngine.h deleted file mode 100644 index 455ec69901..0000000000 --- a/cpp/src/qmf/ConsoleEngine.h +++ /dev/null @@ -1,226 +0,0 @@ -#ifndef _QmfConsoleEngine_ -#define _QmfConsoleEngine_ - -/* - * 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/ResilientConnection.h> -#include <qmf/Schema.h> -#include <qmf/ObjectId.h> -#include <qmf/Object.h> -#include <qmf/Event.h> -#include <qmf/Query.h> -#include <qmf/Value.h> -#include <qmf/Message.h> - -namespace qmf { - - class ConsoleEngine; - struct ConsoleEngineImpl; - 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 struct ConsoleEngineImpl; - 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) - 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) - }; - - /** - * - */ - 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 char* getLabel() const; - - private: - friend struct AgentProxyImpl; - friend class BrokerProxyImpl; - AgentProxy(AgentProxyImpl* impl); - AgentProxyImpl* impl; - }; - - /** - * - */ - class BrokerProxy { - public: - BrokerProxy(ConsoleEngine& 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 struct ConsoleEngineImpl; - 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 ConsoleEngine { - public: - ConsoleEngine(const ConsoleSettings& settings = ConsoleSettings()); - ~ConsoleEngine(); - - 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 startSync(const Query& query, void* context, SyncQuery& sync); - void touchSync(SyncQuery& sync); - void endSync(SyncQuery& sync); - */ - - private: - friend class BrokerProxyImpl; - friend struct AgentProxyImpl; - ConsoleEngineImpl* impl; - }; -} - -#endif - diff --git a/cpp/src/qmf/Event.h b/cpp/src/qmf/Event.h deleted file mode 100644 index f20c6d2fb1..0000000000 --- a/cpp/src/qmf/Event.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef _QmfEvent_ -#define _QmfEvent_ - -/* - * 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 { - - class Event { - }; -} - -#endif - diff --git a/cpp/src/qmf/Message.h b/cpp/src/qmf/Message.h deleted file mode 100644 index 52b8ba72d3..0000000000 --- a/cpp/src/qmf/Message.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef _QmfMessage_ -#define _QmfMessage_ - -/* - * 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 { - - struct Message { - char* body; - uint32_t length; - char* destination; - char* routingKey; - char* replyExchange; - char* replyKey; - char* userId; - }; - -} - -#endif diff --git a/cpp/src/qmf/Object.h b/cpp/src/qmf/Object.h deleted file mode 100644 index f32095cba4..0000000000 --- a/cpp/src/qmf/Object.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef _QmfObject_ -#define _QmfObject_ - -/* - * 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/Schema.h> -#include <qmf/ObjectId.h> -#include <qmf/Value.h> - -namespace qmf { - - 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 AgentEngineImpl; - Object(ObjectImpl* impl); - ObjectImpl* impl; - }; -} - -#endif - diff --git a/cpp/src/qmf/ObjectId.h b/cpp/src/qmf/ObjectId.h deleted file mode 100644 index 9097230fd9..0000000000 --- a/cpp/src/qmf/ObjectId.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef _QmfObjectId_ -#define _QmfObjectId_ - -/* - * 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 { - - // 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; - - 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; - - private: - friend struct ObjectIdImpl; - friend struct ObjectImpl; - friend class BrokerProxyImpl; - friend struct QueryImpl; - friend struct ValueImpl; - friend class AgentEngineImpl; - ObjectId(ObjectIdImpl* impl); - ObjectIdImpl* impl; - }; -} - -#endif - diff --git a/cpp/src/qmf/Query.h b/cpp/src/qmf/Query.h deleted file mode 100644 index bd3ed6b862..0000000000 --- a/cpp/src/qmf/Query.h +++ /dev/null @@ -1,108 +0,0 @@ -#ifndef _QmfQuery_ -#define _QmfQuery_ - -/* - * 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/ObjectId.h> -#include <qmf/Value.h> - -namespace qmf { - - 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 - }; - - 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/cpp/src/qmf/ResilientConnection.h b/cpp/src/qmf/ResilientConnection.h deleted file mode 100644 index 03f1b9c0d5..0000000000 --- a/cpp/src/qmf/ResilientConnection.h +++ /dev/null @@ -1,163 +0,0 @@ -#ifndef _QmfResilientConnection_ -#define _QmfResilientConnection_ - -/* - * 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/Message.h> -#include <qmf/ConnectionSettings.h> -#include <string> - -namespace qmf { - - 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); - - private: - ResilientConnectionImpl* impl; - }; -} - -#endif - diff --git a/cpp/src/qmf/Schema.h b/cpp/src/qmf/Schema.h deleted file mode 100644 index a7757756ea..0000000000 --- a/cpp/src/qmf/Schema.h +++ /dev/null @@ -1,207 +0,0 @@ -#ifndef _QmfSchema_ -#define _QmfSchema_ - -/* - * 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/Typecode.h> -#include <qpid/sys/IntegerTypes.h> - -namespace qmf { - - 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 }; - - 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 AgentEngineImpl; - 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; - - bool operator==(const SchemaClassKey& other) const; - bool operator<(const SchemaClassKey& other) const; - - private: - friend struct SchemaClassKeyImpl; - friend class BrokerProxyImpl; - friend struct ConsoleEngineImpl; - 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 AgentEngineImpl; - SchemaObjectClass(SchemaObjectClassImpl* impl); - SchemaObjectClassImpl* impl; - }; - - /** - */ - class SchemaEventClass { - public: - SchemaEventClass(const char* package, const char* name); - SchemaEventClass(const SchemaEventClass& from); - ~SchemaEventClass(); - void addArgument(const SchemaArgument* argument); - void setDesc(const char* desc); - - const SchemaClassKey* getClassKey() const; - int getArgumentCount() const; - const SchemaArgument* getArgument(int idx) const; - - private: - friend struct SchemaEventClassImpl; - friend class BrokerProxyImpl; - friend class AgentEngineImpl; - SchemaEventClass(SchemaEventClassImpl* impl); - SchemaEventClassImpl* impl; - }; -} - -#endif - diff --git a/cpp/src/qmf/Typecode.h b/cpp/src/qmf/Typecode.h deleted file mode 100644 index 94614d2977..0000000000 --- a/cpp/src/qmf/Typecode.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef _QmfTypecode_ -#define _QmfTypecode_ - -/* - * 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 { - - 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/cpp/src/qmf/Value.h b/cpp/src/qmf/Value.h deleted file mode 100644 index 81ff5a8783..0000000000 --- a/cpp/src/qmf/Value.h +++ /dev/null @@ -1,119 +0,0 @@ -#ifndef _QmfValue_ -#define _QmfValue_ - -/* - * 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/ObjectId.h> -#include <qmf/Typecode.h> - -namespace qmf { - - 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 class AgentEngineImpl; - Value(ValueImpl* impl); - ValueImpl* impl; - }; -} - -#endif - diff --git a/cpp/src/qmf/AgentEngine.cpp b/cpp/src/qmf/engine/Agent.cpp index 23d7eff84b..c5d1bff2e0 100644 --- a/cpp/src/qmf/AgentEngine.cpp +++ b/cpp/src/qmf/engine/Agent.cpp @@ -17,15 +17,15 @@ * under the License. */ -#include "qmf/AgentEngine.h" -#include "qmf/MessageImpl.h" -#include "qmf/SchemaImpl.h" -#include "qmf/Typecode.h" -#include "qmf/ObjectImpl.h" -#include "qmf/ObjectIdImpl.h" -#include "qmf/QueryImpl.h" -#include "qmf/ValueImpl.h" -#include "qmf/Protocol.h" +#include "qmf/engine/Agent.h" +#include "qmf/engine/MessageImpl.h" +#include "qmf/engine/SchemaImpl.h" +#include "qmf/engine/Typecode.h" +#include "qmf/engine/ObjectImpl.h" +#include "qmf/engine/ObjectIdImpl.h" +#include "qmf/engine/QueryImpl.h" +#include "qmf/engine/ValueImpl.h" +#include "qmf/engine/Protocol.h" #include <qpid/framing/Buffer.h> #include <qpid/framing/Uuid.h> #include <qpid/framing/FieldTable.h> @@ -43,11 +43,12 @@ #include <boost/noncopyable.hpp> using namespace std; -using namespace qmf; +using namespace qmf::engine; using namespace qpid::framing; using namespace qpid::sys; namespace qmf { +namespace engine { struct AgentEventImpl { typedef boost::shared_ptr<AgentEventImpl> Ptr; @@ -79,10 +80,10 @@ namespace qmf { AgentQueryContext() : schemaMethod(0) {} }; - class AgentEngineImpl : public boost::noncopyable { + class AgentImpl : public boost::noncopyable { public: - AgentEngineImpl(char* label, bool internalStore); - ~AgentEngineImpl(); + AgentImpl(char* label, bool internalStore); + ~AgentImpl(); void setStoreDir(const char* path); void setTransferDir(const char* path); @@ -199,10 +200,11 @@ namespace qmf { void handleConsoleAddedIndication(); }; } +} -const char* AgentEngineImpl::QMF_EXCHANGE = "qpid.management"; -const char* AgentEngineImpl::DIR_EXCHANGE = "amq.direct"; -const char* AgentEngineImpl::BROKER_KEY = "broker"; +const char* AgentImpl::QMF_EXCHANGE = "qpid.management"; +const char* AgentImpl::DIR_EXCHANGE = "amq.direct"; +const char* AgentImpl::BROKER_KEY = "broker"; #define STRING_REF(s) {if (!s.empty()) item.s = const_cast<char*>(s.c_str());} @@ -228,7 +230,7 @@ AgentEvent AgentEventImpl::copy() return item; } -AgentEngineImpl::AgentEngineImpl(char* _label, bool i) : +AgentImpl::AgentImpl(char* _label, bool i) : label(_label), queueName("qmfa-"), internalStore(i), nextTransientId(1), requestedBrokerBank(0), requestedAgentBank(0), assignedBrokerBank(0), assignedAgentBank(0), @@ -237,11 +239,11 @@ AgentEngineImpl::AgentEngineImpl(char* _label, bool i) : queueName += label; } -AgentEngineImpl::~AgentEngineImpl() +AgentImpl::~AgentImpl() { } -void AgentEngineImpl::setStoreDir(const char* path) +void AgentImpl::setStoreDir(const char* path) { Mutex::ScopedLock _lock(lock); if (path) @@ -250,7 +252,7 @@ void AgentEngineImpl::setStoreDir(const char* path) storeDir.clear(); } -void AgentEngineImpl::setTransferDir(const char* path) +void AgentImpl::setTransferDir(const char* path) { Mutex::ScopedLock _lock(lock); if (path) @@ -259,7 +261,7 @@ void AgentEngineImpl::setTransferDir(const char* path) transferDir.clear(); } -void AgentEngineImpl::handleRcvMessage(Message& message) +void AgentImpl::handleRcvMessage(Message& message) { Buffer inBuffer(message.body, message.length); uint8_t opcode; @@ -275,13 +277,13 @@ void AgentEngineImpl::handleRcvMessage(Message& message) else if (opcode == Protocol::OP_GET_QUERY) handleGetQuery(inBuffer, sequence, replyToKey, userId); else if (opcode == Protocol::OP_METHOD_REQUEST) handleMethodRequest(inBuffer, sequence, replyToKey, userId); else { - QPID_LOG(error, "AgentEngineImpl::handleRcvMessage invalid opcode=" << opcode); + QPID_LOG(error, "AgentImpl::handleRcvMessage invalid opcode=" << opcode); break; } } } -bool AgentEngineImpl::getXmtMessage(Message& item) const +bool AgentImpl::getXmtMessage(Message& item) const { Mutex::ScopedLock _lock(lock); if (xmtQueue.empty()) @@ -290,14 +292,14 @@ bool AgentEngineImpl::getXmtMessage(Message& item) const return true; } -void AgentEngineImpl::popXmt() +void AgentImpl::popXmt() { Mutex::ScopedLock _lock(lock); if (!xmtQueue.empty()) xmtQueue.pop_front(); } -bool AgentEngineImpl::getEvent(AgentEvent& event) const +bool AgentImpl::getEvent(AgentEvent& event) const { Mutex::ScopedLock _lock(lock); if (eventQueue.empty()) @@ -306,14 +308,14 @@ bool AgentEngineImpl::getEvent(AgentEvent& event) const return true; } -void AgentEngineImpl::popEvent() +void AgentImpl::popEvent() { Mutex::ScopedLock _lock(lock); if (!eventQueue.empty()) eventQueue.pop_front(); } -void AgentEngineImpl::newSession() +void AgentImpl::newSession() { Mutex::ScopedLock _lock(lock); eventQueue.clear(); @@ -323,7 +325,7 @@ void AgentEngineImpl::newSession() eventQueue.push_back(eventSetupComplete()); } -void AgentEngineImpl::startProtocol() +void AgentImpl::startProtocol() { Mutex::ScopedLock _lock(lock); char rawbuffer[512]; @@ -339,7 +341,7 @@ void AgentEngineImpl::startProtocol() " reqAgent=" << requestedAgentBank); } -void AgentEngineImpl::heartbeat() +void AgentImpl::heartbeat() { Mutex::ScopedLock _lock(lock); Buffer buffer(outputBuffer, MA_BUFFER_SIZE); @@ -352,7 +354,7 @@ void AgentEngineImpl::heartbeat() QPID_LOG(trace, "SENT HeartbeatIndication"); } -void AgentEngineImpl::methodResponse(uint32_t sequence, uint32_t status, char* text, +void AgentImpl::methodResponse(uint32_t sequence, uint32_t status, char* text, const Value& argMap) { Mutex::ScopedLock _lock(lock); @@ -385,7 +387,7 @@ void AgentEngineImpl::methodResponse(uint32_t sequence, uint32_t status, char* t QPID_LOG(trace, "SENT MethodResponse seq=" << context->sequence << " status=" << status << " text=" << text); } -void AgentEngineImpl::queryResponse(uint32_t sequence, Object& object, bool prop, bool stat) +void AgentImpl::queryResponse(uint32_t sequence, Object& object, bool prop, bool stat) { Mutex::ScopedLock _lock(lock); map<uint32_t, AgentQueryContext::Ptr>::iterator iter = contextMap.find(sequence); @@ -407,7 +409,7 @@ void AgentEngineImpl::queryResponse(uint32_t sequence, Object& object, bool prop QPID_LOG(trace, "SENT ContentIndication seq=" << context->sequence); } -void AgentEngineImpl::queryComplete(uint32_t sequence) +void AgentImpl::queryComplete(uint32_t sequence) { Mutex::ScopedLock _lock(lock); map<uint32_t, AgentQueryContext::Ptr>::iterator iter = contextMap.find(sequence); @@ -419,7 +421,7 @@ void AgentEngineImpl::queryComplete(uint32_t sequence) sendCommandCompleteLH(context->exchange, context->key, context->sequence, 0, "OK"); } -void AgentEngineImpl::registerClass(SchemaObjectClass* cls) +void AgentImpl::registerClass(SchemaObjectClass* cls) { Mutex::ScopedLock _lock(lock); @@ -436,7 +438,7 @@ void AgentEngineImpl::registerClass(SchemaObjectClass* cls) // TODO: Indicate this schema if connected. } -void AgentEngineImpl::registerClass(SchemaEventClass* cls) +void AgentImpl::registerClass(SchemaEventClass* cls) { Mutex::ScopedLock _lock(lock); @@ -453,13 +455,13 @@ void AgentEngineImpl::registerClass(SchemaEventClass* cls) // TODO: Indicate this schema if connected. } -const ObjectId* AgentEngineImpl::addObject(Object&, uint64_t) +const ObjectId* AgentImpl::addObject(Object&, uint64_t) { Mutex::ScopedLock _lock(lock); return 0; } -const ObjectId* AgentEngineImpl::allocObjectId(uint64_t persistId) +const ObjectId* AgentImpl::allocObjectId(uint64_t persistId) { Mutex::ScopedLock _lock(lock); uint16_t sequence = persistId ? 0 : bootSequence; @@ -469,17 +471,17 @@ const ObjectId* AgentEngineImpl::allocObjectId(uint64_t persistId) return oid; } -const ObjectId* AgentEngineImpl::allocObjectId(uint32_t persistIdLo, uint32_t persistIdHi) +const ObjectId* AgentImpl::allocObjectId(uint32_t persistIdLo, uint32_t persistIdHi) { return allocObjectId(((uint64_t) persistIdHi) << 32 | (uint64_t) persistIdLo); } -void AgentEngineImpl::raiseEvent(Event&) +void AgentImpl::raiseEvent(Event&) { Mutex::ScopedLock _lock(lock); } -AgentEventImpl::Ptr AgentEngineImpl::eventDeclareQueue(const string& name) +AgentEventImpl::Ptr AgentImpl::eventDeclareQueue(const string& name) { AgentEventImpl::Ptr event(new AgentEventImpl(AgentEvent::DECLARE_QUEUE)); event->name = name; @@ -487,7 +489,7 @@ AgentEventImpl::Ptr AgentEngineImpl::eventDeclareQueue(const string& name) return event; } -AgentEventImpl::Ptr AgentEngineImpl::eventBind(const string& exchange, const string& queue, +AgentEventImpl::Ptr AgentImpl::eventBind(const string& exchange, const string& queue, const string& key) { AgentEventImpl::Ptr event(new AgentEventImpl(AgentEvent::BIND)); @@ -498,13 +500,13 @@ AgentEventImpl::Ptr AgentEngineImpl::eventBind(const string& exchange, const str return event; } -AgentEventImpl::Ptr AgentEngineImpl::eventSetupComplete() +AgentEventImpl::Ptr AgentImpl::eventSetupComplete() { AgentEventImpl::Ptr event(new AgentEventImpl(AgentEvent::SETUP_COMPLETE)); return event; } -AgentEventImpl::Ptr AgentEngineImpl::eventQuery(uint32_t num, const string& userId, const string& package, +AgentEventImpl::Ptr AgentImpl::eventQuery(uint32_t num, const string& userId, const string& package, const string& cls, boost::shared_ptr<ObjectId> oid) { AgentEventImpl::Ptr event(new AgentEventImpl(AgentEvent::GET_QUERY)); @@ -517,7 +519,7 @@ AgentEventImpl::Ptr AgentEngineImpl::eventQuery(uint32_t num, const string& user return event; } -AgentEventImpl::Ptr AgentEngineImpl::eventMethod(uint32_t num, const string& userId, const string& method, +AgentEventImpl::Ptr AgentImpl::eventMethod(uint32_t num, const string& userId, const string& method, boost::shared_ptr<ObjectId> oid, boost::shared_ptr<Value> argMap, const SchemaObjectClass* objectClass) { @@ -531,7 +533,7 @@ AgentEventImpl::Ptr AgentEngineImpl::eventMethod(uint32_t num, const string& use return event; } -void AgentEngineImpl::sendBufferLH(Buffer& buf, const string& destination, const string& routingKey) +void AgentImpl::sendBufferLH(Buffer& buf, const string& destination, const string& routingKey) { uint32_t length = buf.getPosition(); MessageImpl::Ptr message(new MessageImpl); @@ -546,7 +548,7 @@ void AgentEngineImpl::sendBufferLH(Buffer& buf, const string& destination, const xmtQueue.push_back(message); } -void AgentEngineImpl::sendPackageIndicationLH(const string& packageName) +void AgentImpl::sendPackageIndicationLH(const string& packageName) { Buffer buffer(outputBuffer, MA_BUFFER_SIZE); Protocol::encodeHeader(buffer, Protocol::OP_PACKAGE_INDICATION); @@ -555,7 +557,7 @@ void AgentEngineImpl::sendPackageIndicationLH(const string& packageName) QPID_LOG(trace, "SENT PackageIndication: package_name=" << packageName); } -void AgentEngineImpl::sendClassIndicationLH(ClassKind kind, const string& packageName, const AgentClassKey& key) +void AgentImpl::sendClassIndicationLH(ClassKind kind, const string& packageName, const AgentClassKey& key) { Buffer buffer(outputBuffer, MA_BUFFER_SIZE); Protocol::encodeHeader(buffer, Protocol::OP_CLASS_INDICATION); @@ -567,7 +569,7 @@ void AgentEngineImpl::sendClassIndicationLH(ClassKind kind, const string& packag QPID_LOG(trace, "SENT ClassIndication: package_name=" << packageName << " class_name=" << key.name); } -void AgentEngineImpl::sendCommandCompleteLH(const string& exchange, const string& replyToKey, +void AgentImpl::sendCommandCompleteLH(const string& exchange, const string& replyToKey, uint32_t sequence, uint32_t code, const string& text) { Buffer buffer(outputBuffer, MA_BUFFER_SIZE); @@ -578,7 +580,7 @@ void AgentEngineImpl::sendCommandCompleteLH(const string& exchange, const string QPID_LOG(trace, "SENT CommandComplete: seq=" << sequence << " code=" << code << " text=" << text); } -void AgentEngineImpl::sendMethodErrorLH(uint32_t sequence, const string& key, uint32_t code, const string& text) +void AgentImpl::sendMethodErrorLH(uint32_t sequence, const string& key, uint32_t code, const string& text) { Buffer buffer(outputBuffer, MA_BUFFER_SIZE); Protocol::encodeHeader(buffer, Protocol::OP_METHOD_RESPONSE, sequence); @@ -604,7 +606,7 @@ void AgentEngineImpl::sendMethodErrorLH(uint32_t sequence, const string& key, ui QPID_LOG(trace, "SENT MethodResponse: errorCode=" << code << " text=" << fulltext); } -void AgentEngineImpl::handleAttachResponse(Buffer& inBuffer) +void AgentImpl::handleAttachResponse(Buffer& inBuffer) { Mutex::ScopedLock _lock(lock); @@ -651,17 +653,17 @@ void AgentEngineImpl::handleAttachResponse(Buffer& inBuffer) } } -void AgentEngineImpl::handlePackageRequest(Buffer&) +void AgentImpl::handlePackageRequest(Buffer&) { Mutex::ScopedLock _lock(lock); } -void AgentEngineImpl::handleClassQuery(Buffer&) +void AgentImpl::handleClassQuery(Buffer&) { Mutex::ScopedLock _lock(lock); } -void AgentEngineImpl::handleSchemaRequest(Buffer& inBuffer, uint32_t sequence, +void AgentImpl::handleSchemaRequest(Buffer& inBuffer, uint32_t sequence, const string& replyExchange, const string& replyKey) { Mutex::ScopedLock _lock(lock); @@ -710,7 +712,7 @@ void AgentEngineImpl::handleSchemaRequest(Buffer& inBuffer, uint32_t sequence, sendCommandCompleteLH(rExchange, rKey, sequence, 1, "class not found"); } -void AgentEngineImpl::handleGetQuery(Buffer& inBuffer, uint32_t sequence, const string& replyTo, const string& userId) +void AgentImpl::handleGetQuery(Buffer& inBuffer, uint32_t sequence, const string& replyTo, const string& userId) { Mutex::ScopedLock _lock(lock); FieldTable ft; @@ -762,7 +764,7 @@ void AgentEngineImpl::handleGetQuery(Buffer& inBuffer, uint32_t sequence, const eventQueue.push_back(eventQuery(contextNum, userId, pname, cname, oid)); } -void AgentEngineImpl::handleMethodRequest(Buffer& buffer, uint32_t sequence, const string& replyTo, const string& userId) +void AgentImpl::handleMethodRequest(Buffer& buffer, uint32_t sequence, const string& replyTo, const string& userId) { Mutex::ScopedLock _lock(lock); string pname; @@ -822,7 +824,7 @@ void AgentEngineImpl::handleMethodRequest(Buffer& buffer, uint32_t sequence, con eventQueue.push_back(eventMethod(contextNum, userId, method, oid, argMap, schema)); } -void AgentEngineImpl::handleConsoleAddedIndication() +void AgentImpl::handleConsoleAddedIndication() { Mutex::ScopedLock _lock(lock); } @@ -831,25 +833,25 @@ void AgentEngineImpl::handleConsoleAddedIndication() // Wrappers //================================================================== -AgentEngine::AgentEngine(char* label, bool internalStore) { impl = new AgentEngineImpl(label, internalStore); } -AgentEngine::~AgentEngine() { delete impl; } -void AgentEngine::setStoreDir(const char* path) { impl->setStoreDir(path); } -void AgentEngine::setTransferDir(const char* path) { impl->setTransferDir(path); } -void AgentEngine::handleRcvMessage(Message& message) { impl->handleRcvMessage(message); } -bool AgentEngine::getXmtMessage(Message& item) const { return impl->getXmtMessage(item); } -void AgentEngine::popXmt() { impl->popXmt(); } -bool AgentEngine::getEvent(AgentEvent& event) const { return impl->getEvent(event); } -void AgentEngine::popEvent() { impl->popEvent(); } -void AgentEngine::newSession() { impl->newSession(); } -void AgentEngine::startProtocol() { impl->startProtocol(); } -void AgentEngine::heartbeat() { impl->heartbeat(); } -void AgentEngine::methodResponse(uint32_t sequence, uint32_t status, char* text, const Value& arguments) { impl->methodResponse(sequence, status, text, arguments); } -void AgentEngine::queryResponse(uint32_t sequence, Object& object, bool prop, bool stat) { impl->queryResponse(sequence, object, prop, stat); } -void AgentEngine::queryComplete(uint32_t sequence) { impl->queryComplete(sequence); } -void AgentEngine::registerClass(SchemaObjectClass* cls) { impl->registerClass(cls); } -void AgentEngine::registerClass(SchemaEventClass* cls) { impl->registerClass(cls); } -const ObjectId* AgentEngine::addObject(Object& obj, uint64_t persistId) { return impl->addObject(obj, persistId); } -const ObjectId* AgentEngine::allocObjectId(uint64_t persistId) { return impl->allocObjectId(persistId); } -const ObjectId* AgentEngine::allocObjectId(uint32_t persistIdLo, uint32_t persistIdHi) { return impl->allocObjectId(persistIdLo, persistIdHi); } -void AgentEngine::raiseEvent(Event& event) { impl->raiseEvent(event); } +Agent::Agent(char* label, bool internalStore) { impl = new AgentImpl(label, internalStore); } +Agent::~Agent() { delete impl; } +void Agent::setStoreDir(const char* path) { impl->setStoreDir(path); } +void Agent::setTransferDir(const char* path) { impl->setTransferDir(path); } +void Agent::handleRcvMessage(Message& message) { impl->handleRcvMessage(message); } +bool Agent::getXmtMessage(Message& item) const { return impl->getXmtMessage(item); } +void Agent::popXmt() { impl->popXmt(); } +bool Agent::getEvent(AgentEvent& event) const { return impl->getEvent(event); } +void Agent::popEvent() { impl->popEvent(); } +void Agent::newSession() { impl->newSession(); } +void Agent::startProtocol() { impl->startProtocol(); } +void Agent::heartbeat() { impl->heartbeat(); } +void Agent::methodResponse(uint32_t sequence, uint32_t status, char* text, const Value& arguments) { impl->methodResponse(sequence, status, text, arguments); } +void Agent::queryResponse(uint32_t sequence, Object& object, bool prop, bool stat) { impl->queryResponse(sequence, object, prop, stat); } +void Agent::queryComplete(uint32_t sequence) { impl->queryComplete(sequence); } +void Agent::registerClass(SchemaObjectClass* cls) { impl->registerClass(cls); } +void Agent::registerClass(SchemaEventClass* cls) { impl->registerClass(cls); } +const ObjectId* Agent::addObject(Object& obj, uint64_t persistId) { return impl->addObject(obj, persistId); } +const ObjectId* Agent::allocObjectId(uint64_t persistId) { return impl->allocObjectId(persistId); } +const ObjectId* Agent::allocObjectId(uint32_t persistIdLo, uint32_t persistIdHi) { return impl->allocObjectId(persistIdLo, persistIdHi); } +void Agent::raiseEvent(Event& event) { impl->raiseEvent(event); } diff --git a/cpp/src/qmf/BrokerProxyImpl.cpp b/cpp/src/qmf/engine/BrokerProxyImpl.cpp index a66fa24834..36d3ffe361 100644 --- a/cpp/src/qmf/BrokerProxyImpl.cpp +++ b/cpp/src/qmf/engine/BrokerProxyImpl.cpp @@ -17,9 +17,9 @@ * under the License. */ -#include "qmf/BrokerProxyImpl.h" -#include "qmf/ConsoleEngineImpl.h" -#include "qmf/Protocol.h" +#include "qmf/engine/BrokerProxyImpl.h" +#include "qmf/engine/ConsoleImpl.h" +#include "qmf/engine/Protocol.h" #include "qpid/Address.h" #include "qpid/sys/SystemInfo.h" #include <qpid/log/Statement.h> @@ -28,7 +28,7 @@ #include <fstream> using namespace std; -using namespace qmf; +using namespace qmf::engine; using namespace qpid::framing; using namespace qpid::sys; @@ -74,7 +74,7 @@ BrokerEvent BrokerEventImpl::copy() return item; } -BrokerProxyImpl::BrokerProxyImpl(BrokerProxy& pub, ConsoleEngine& _console) : publicObject(pub), console(_console) +BrokerProxyImpl::BrokerProxyImpl(BrokerProxy& pub, Console& _console) : publicObject(pub), console(_console) { stringstream qn; qpid::TcpAddress addr; @@ -674,7 +674,7 @@ AgentProxy::AgentProxy(AgentProxyImpl* i) : impl(i) {} AgentProxy::~AgentProxy() { delete impl; } const char* AgentProxy::getLabel() const { return impl->getLabel().c_str(); } -BrokerProxy::BrokerProxy(ConsoleEngine& console) : impl(new BrokerProxyImpl(*this, console)) {} +BrokerProxy::BrokerProxy(Console& console) : impl(new BrokerProxyImpl(*this, console)) {} BrokerProxy::~BrokerProxy() { delete impl; } void BrokerProxy::sessionOpened(SessionHandle& sh) { impl->sessionOpened(sh); } void BrokerProxy::sessionClosed() { impl->sessionClosed(); } diff --git a/cpp/src/qmf/BrokerProxyImpl.h b/cpp/src/qmf/engine/BrokerProxyImpl.h index 5b0b22e038..660cb86c61 100644 --- a/cpp/src/qmf/BrokerProxyImpl.h +++ b/cpp/src/qmf/engine/BrokerProxyImpl.h @@ -1,5 +1,5 @@ -#ifndef _QmfBrokerProxyImpl_ -#define _QmfBrokerProxyImpl_ +#ifndef _QmfEngineBrokerProxyImpl_ +#define _QmfEngineBrokerProxyImpl_ /* * Licensed to the Apache Software Foundation (ASF) under one @@ -20,13 +20,13 @@ * under the License. */ -#include "qmf/ConsoleEngine.h" -#include "qmf/ObjectImpl.h" -#include "qmf/SchemaImpl.h" -#include "qmf/ValueImpl.h" -#include "qmf/QueryImpl.h" -#include "qmf/SequenceManager.h" -#include "qmf/MessageImpl.h" +#include "qmf/engine/Console.h" +#include "qmf/engine/ObjectImpl.h" +#include "qmf/engine/SchemaImpl.h" +#include "qmf/engine/ValueImpl.h" +#include "qmf/engine/QueryImpl.h" +#include "qmf/engine/SequenceManager.h" +#include "qmf/engine/MessageImpl.h" #include "qpid/framing/Buffer.h" #include "qpid/framing/Uuid.h" #include "qpid/sys/Mutex.h" @@ -39,6 +39,7 @@ #include <vector> namespace qmf { +namespace engine { typedef boost::shared_ptr<MethodResponse> MethodResponsePtr; struct MethodResponseImpl { @@ -93,13 +94,13 @@ namespace qmf { typedef boost::shared_ptr<AgentProxy> AgentProxyPtr; struct AgentProxyImpl { - ConsoleEngine& console; + Console& console; BrokerProxy& broker; uint32_t agentBank; std::string label; - AgentProxyImpl(ConsoleEngine& c, BrokerProxy& b, uint32_t ab, const std::string& l) : console(c), broker(b), agentBank(ab), label(l) {} - static AgentProxy* factory(ConsoleEngine& c, BrokerProxy& b, uint32_t ab, const std::string& l) { + AgentProxyImpl(Console& c, BrokerProxy& b, uint32_t ab, const std::string& l) : console(c), broker(b), agentBank(ab), label(l) {} + static AgentProxy* factory(Console& c, BrokerProxy& b, uint32_t ab, const std::string& l) { AgentProxyImpl* impl(new AgentProxyImpl(c, b, ab, l)); return new AgentProxy(impl); } @@ -109,7 +110,7 @@ namespace qmf { class BrokerProxyImpl : public boost::noncopyable { public: - BrokerProxyImpl(BrokerProxy& pub, ConsoleEngine& _console); + BrokerProxyImpl(BrokerProxy& pub, Console& _console); ~BrokerProxyImpl() {} void sessionOpened(SessionHandle& sh); @@ -140,7 +141,7 @@ namespace qmf { friend struct MethodContext; BrokerProxy& publicObject; mutable qpid::sys::Mutex lock; - ConsoleEngine& console; + Console& console; std::string queueName; qpid::framing::Uuid brokerId; SequenceManager seqMgr; @@ -220,8 +221,7 @@ namespace qmf { MethodResponsePtr methodResponse; }; - - +} } #endif diff --git a/cpp/src/qmf/ConnectionSettingsImpl.cpp b/cpp/src/qmf/engine/ConnectionSettingsImpl.cpp index 63ce53b751..8c918eec20 100644 --- a/cpp/src/qmf/ConnectionSettingsImpl.cpp +++ b/cpp/src/qmf/engine/ConnectionSettingsImpl.cpp @@ -17,11 +17,11 @@ * under the License. */ -#include "qmf/ConnectionSettingsImpl.h" -#include "qmf/Typecode.h" +#include "qmf/engine/ConnectionSettingsImpl.h" +#include "qmf/engine/Typecode.h" using namespace std; -using namespace qmf; +using namespace qmf::engine; using namespace qpid; const string attrProtocol("protocol"); diff --git a/cpp/src/qmf/ConnectionSettingsImpl.h b/cpp/src/qmf/engine/ConnectionSettingsImpl.h index e73715460a..c47c8bee2e 100644 --- a/cpp/src/qmf/ConnectionSettingsImpl.h +++ b/cpp/src/qmf/engine/ConnectionSettingsImpl.h @@ -1,5 +1,5 @@ -#ifndef _QmfConnectionSettingsImpl_ -#define _QmfConnectionSettingsImpl_ +#ifndef _QmfEngineConnectionSettingsImpl_ +#define _QmfEngineConnectionSettingsImpl_ /* * Licensed to the Apache Software Foundation (ASF) under one @@ -20,13 +20,14 @@ * under the License. */ -#include "qmf/ConnectionSettings.h" -#include "qmf/Value.h" +#include "qmf/engine/ConnectionSettings.h" +#include "qmf/engine/Value.h" #include "qpid/client/ConnectionSettings.h" #include <string> #include <map> namespace qmf { +namespace engine { class ConnectionSettingsImpl { qpid::client::ConnectionSettings clientSettings; @@ -57,5 +58,6 @@ namespace qmf { }; } +} #endif diff --git a/cpp/src/qmf/ConsoleEngineImpl.cpp b/cpp/src/qmf/engine/ConsoleImpl.cpp index 7c34af48c6..c856f04c51 100644 --- a/cpp/src/qmf/ConsoleEngineImpl.cpp +++ b/cpp/src/qmf/engine/ConsoleImpl.cpp @@ -17,17 +17,17 @@ * under the License. */ -#include "qmf/ConsoleEngineImpl.h" -#include "qmf/MessageImpl.h" -#include "qmf/SchemaImpl.h" -#include "qmf/Typecode.h" -#include "qmf/ObjectImpl.h" -#include "qmf/ObjectIdImpl.h" -#include "qmf/QueryImpl.h" -#include "qmf/ValueImpl.h" -#include "qmf/Protocol.h" -#include "qmf/SequenceManager.h" -#include "qmf/BrokerProxyImpl.h" +#include "qmf/engine/ConsoleImpl.h" +#include "qmf/engine/MessageImpl.h" +#include "qmf/engine/SchemaImpl.h" +#include "qmf/engine/Typecode.h" +#include "qmf/engine/ObjectImpl.h" +#include "qmf/engine/ObjectIdImpl.h" +#include "qmf/engine/QueryImpl.h" +#include "qmf/engine/ValueImpl.h" +#include "qmf/engine/Protocol.h" +#include "qmf/engine/SequenceManager.h" +#include "qmf/engine/BrokerProxyImpl.h" #include <qpid/framing/Buffer.h> #include <qpid/framing/Uuid.h> #include <qpid/framing/FieldTable.h> @@ -40,7 +40,7 @@ #include <fstream> using namespace std; -using namespace qmf; +using namespace qmf::engine; using namespace qpid::framing; using namespace qpid::sys; @@ -68,7 +68,7 @@ ConsoleEvent ConsoleEventImpl::copy() return item; } -ConsoleEngineImpl::ConsoleEngineImpl(const ConsoleSettings& s) : settings(s) +ConsoleImpl::ConsoleImpl(const ConsoleSettings& s) : settings(s) { bindingList.push_back(pair<string, string>(string(), "schema.#")); if (settings.rcvObjects && settings.rcvEvents && settings.rcvHeartbeats && !settings.userBindings) { @@ -85,12 +85,12 @@ ConsoleEngineImpl::ConsoleEngineImpl(const ConsoleSettings& s) : settings(s) } } -ConsoleEngineImpl::~ConsoleEngineImpl() +ConsoleImpl::~ConsoleImpl() { // This function intentionally left blank. } -bool ConsoleEngineImpl::getEvent(ConsoleEvent& event) const +bool ConsoleImpl::getEvent(ConsoleEvent& event) const { Mutex::ScopedLock _lock(lock); if (eventQueue.empty()) @@ -99,20 +99,20 @@ bool ConsoleEngineImpl::getEvent(ConsoleEvent& event) const return true; } -void ConsoleEngineImpl::popEvent() +void ConsoleImpl::popEvent() { Mutex::ScopedLock _lock(lock); if (!eventQueue.empty()) eventQueue.pop_front(); } -void ConsoleEngineImpl::addConnection(BrokerProxy& broker, void* /*context*/) +void ConsoleImpl::addConnection(BrokerProxy& broker, void* /*context*/) { Mutex::ScopedLock _lock(lock); brokerList.push_back(broker.impl); } -void ConsoleEngineImpl::delConnection(BrokerProxy& broker) +void ConsoleImpl::delConnection(BrokerProxy& broker) { Mutex::ScopedLock _lock(lock); for (vector<BrokerProxyImpl*>::iterator iter = brokerList.begin(); @@ -123,13 +123,13 @@ void ConsoleEngineImpl::delConnection(BrokerProxy& broker) } } -uint32_t ConsoleEngineImpl::packageCount() const +uint32_t ConsoleImpl::packageCount() const { Mutex::ScopedLock _lock(lock); return packages.size(); } -const string& ConsoleEngineImpl::getPackageName(uint32_t idx) const +const string& ConsoleImpl::getPackageName(uint32_t idx) const { const static string empty; @@ -142,7 +142,7 @@ const string& ConsoleEngineImpl::getPackageName(uint32_t idx) const return iter->first; } -uint32_t ConsoleEngineImpl::classCount(const char* packageName) const +uint32_t ConsoleImpl::classCount(const char* packageName) const { Mutex::ScopedLock _lock(lock); PackageList::const_iterator pIter = packages.find(packageName); @@ -155,7 +155,7 @@ uint32_t ConsoleEngineImpl::classCount(const char* packageName) const return oList.size() + eList.size(); } -const SchemaClassKey* ConsoleEngineImpl::getClass(const char* packageName, uint32_t idx) const +const SchemaClassKey* ConsoleImpl::getClass(const char* packageName, uint32_t idx) const { Mutex::ScopedLock _lock(lock); PackageList::const_iterator pIter = packages.find(packageName); @@ -183,7 +183,7 @@ const SchemaClassKey* ConsoleEngineImpl::getClass(const char* packageName, uint3 return 0; } -ClassKind ConsoleEngineImpl::getClassKind(const SchemaClassKey* key) const +ClassKind ConsoleImpl::getClassKind(const SchemaClassKey* key) const { Mutex::ScopedLock _lock(lock); PackageList::const_iterator pIter = packages.find(key->getPackageName()); @@ -196,7 +196,7 @@ ClassKind ConsoleEngineImpl::getClassKind(const SchemaClassKey* key) const return CLASS_OBJECT; } -const SchemaObjectClass* ConsoleEngineImpl::getObjectClass(const SchemaClassKey* key) const +const SchemaObjectClass* ConsoleImpl::getObjectClass(const SchemaClassKey* key) const { Mutex::ScopedLock _lock(lock); PackageList::const_iterator pIter = packages.find(key->getPackageName()); @@ -210,7 +210,7 @@ const SchemaObjectClass* ConsoleEngineImpl::getObjectClass(const SchemaClassKey* return iter->second; } -const SchemaEventClass* ConsoleEngineImpl::getEventClass(const SchemaClassKey* key) const +const SchemaEventClass* ConsoleImpl::getEventClass(const SchemaClassKey* key) const { Mutex::ScopedLock _lock(lock); PackageList::const_iterator pIter = packages.find(key->getPackageName()); @@ -224,7 +224,7 @@ const SchemaEventClass* ConsoleEngineImpl::getEventClass(const SchemaClassKey* k return iter->second; } -void ConsoleEngineImpl::bindPackage(const char* packageName) +void ConsoleImpl::bindPackage(const char* packageName) { stringstream key; key << "console.obj.*.*." << packageName << ".#"; @@ -235,7 +235,7 @@ void ConsoleEngineImpl::bindPackage(const char* packageName) (*iter)->addBinding(QMF_EXCHANGE, key.str()); } -void ConsoleEngineImpl::bindClass(const SchemaClassKey* classKey) +void ConsoleImpl::bindClass(const SchemaClassKey* classKey) { stringstream key; key << "console.obj.*.*." << classKey->getPackageName() << "." << classKey->getClassName() << ".#"; @@ -246,7 +246,7 @@ void ConsoleEngineImpl::bindClass(const SchemaClassKey* classKey) (*iter)->addBinding(QMF_EXCHANGE, key.str()); } -void ConsoleEngineImpl::bindClass(const char* packageName, const char* className) +void ConsoleImpl::bindClass(const char* packageName, const char* className) { stringstream key; key << "console.obj.*.*." << packageName << "." << className << ".#"; @@ -258,20 +258,20 @@ void ConsoleEngineImpl::bindClass(const char* packageName, const char* className } /* -void ConsoleEngineImpl::startSync(const Query& query, void* context, SyncQuery& sync) +void ConsoleImpl::startSync(const Query& query, void* context, SyncQuery& sync) { } -void ConsoleEngineImpl::touchSync(SyncQuery& sync) +void ConsoleImpl::touchSync(SyncQuery& sync) { } -void ConsoleEngineImpl::endSync(SyncQuery& sync) +void ConsoleImpl::endSync(SyncQuery& sync) { } */ -void ConsoleEngineImpl::learnPackage(const string& packageName) +void ConsoleImpl::learnPackage(const string& packageName) { Mutex::ScopedLock _lock(lock); if (packages.find(packageName) == packages.end()) @@ -279,7 +279,7 @@ void ConsoleEngineImpl::learnPackage(const string& packageName) (packageName, pair<ObjectClassList, EventClassList>(ObjectClassList(), EventClassList()))); } -void ConsoleEngineImpl::learnClass(SchemaObjectClass* cls) +void ConsoleImpl::learnClass(SchemaObjectClass* cls) { Mutex::ScopedLock _lock(lock); const SchemaClassKey* key = cls->getClassKey(); @@ -292,7 +292,7 @@ void ConsoleEngineImpl::learnClass(SchemaObjectClass* cls) list[key] = cls; } -void ConsoleEngineImpl::learnClass(SchemaEventClass* cls) +void ConsoleImpl::learnClass(SchemaEventClass* cls) { Mutex::ScopedLock _lock(lock); const SchemaClassKey* key = cls->getClassKey(); @@ -305,7 +305,7 @@ void ConsoleEngineImpl::learnClass(SchemaEventClass* cls) list[key] = cls; } -bool ConsoleEngineImpl::haveClass(const SchemaClassKey* key) const +bool ConsoleImpl::haveClass(const SchemaClassKey* key) const { Mutex::ScopedLock _lock(lock); PackageList::const_iterator pIter = packages.find(key->getPackageName()); @@ -318,7 +318,7 @@ bool ConsoleEngineImpl::haveClass(const SchemaClassKey* key) const return oList.find(key) != oList.end() || eList.find(key) != eList.end(); } -SchemaObjectClass* ConsoleEngineImpl::getSchema(const SchemaClassKey* key) const +SchemaObjectClass* ConsoleImpl::getSchema(const SchemaClassKey* key) const { Mutex::ScopedLock _lock(lock); PackageList::const_iterator pIter = packages.find(key->getPackageName()); @@ -337,24 +337,24 @@ SchemaObjectClass* ConsoleEngineImpl::getSchema(const SchemaClassKey* key) const // Wrappers //================================================================== -ConsoleEngine::ConsoleEngine(const ConsoleSettings& settings) : impl(new ConsoleEngineImpl(settings)) {} -ConsoleEngine::~ConsoleEngine() { delete impl; } -bool ConsoleEngine::getEvent(ConsoleEvent& event) const { return impl->getEvent(event); } -void ConsoleEngine::popEvent() { impl->popEvent(); } -void ConsoleEngine::addConnection(BrokerProxy& broker, void* context) { impl->addConnection(broker, context); } -void ConsoleEngine::delConnection(BrokerProxy& broker) { impl->delConnection(broker); } -uint32_t ConsoleEngine::packageCount() const { return impl->packageCount(); } -const char* ConsoleEngine::getPackageName(uint32_t idx) const { return impl->getPackageName(idx).c_str(); } -uint32_t ConsoleEngine::classCount(const char* packageName) const { return impl->classCount(packageName); } -const SchemaClassKey* ConsoleEngine::getClass(const char* packageName, uint32_t idx) const { return impl->getClass(packageName, idx); } -ClassKind ConsoleEngine::getClassKind(const SchemaClassKey* key) const { return impl->getClassKind(key); } -const SchemaObjectClass* ConsoleEngine::getObjectClass(const SchemaClassKey* key) const { return impl->getObjectClass(key); } -const SchemaEventClass* ConsoleEngine::getEventClass(const SchemaClassKey* key) const { return impl->getEventClass(key); } -void ConsoleEngine::bindPackage(const char* packageName) { impl->bindPackage(packageName); } -void ConsoleEngine::bindClass(const SchemaClassKey* key) { impl->bindClass(key); } -void ConsoleEngine::bindClass(const char* packageName, const char* className) { impl->bindClass(packageName, className); } -//void ConsoleEngine::startSync(const Query& query, void* context, SyncQuery& sync) { impl->startSync(query, context, sync); } -//void ConsoleEngine::touchSync(SyncQuery& sync) { impl->touchSync(sync); } -//void ConsoleEngine::endSync(SyncQuery& sync) { impl->endSync(sync); } +Console::Console(const ConsoleSettings& settings) : impl(new ConsoleImpl(settings)) {} +Console::~Console() { delete impl; } +bool Console::getEvent(ConsoleEvent& event) const { return impl->getEvent(event); } +void Console::popEvent() { impl->popEvent(); } +void Console::addConnection(BrokerProxy& broker, void* context) { impl->addConnection(broker, context); } +void Console::delConnection(BrokerProxy& broker) { impl->delConnection(broker); } +uint32_t Console::packageCount() const { return impl->packageCount(); } +const char* Console::getPackageName(uint32_t idx) const { return impl->getPackageName(idx).c_str(); } +uint32_t Console::classCount(const char* packageName) const { return impl->classCount(packageName); } +const SchemaClassKey* Console::getClass(const char* packageName, uint32_t idx) const { return impl->getClass(packageName, idx); } +ClassKind Console::getClassKind(const SchemaClassKey* key) const { return impl->getClassKind(key); } +const SchemaObjectClass* Console::getObjectClass(const SchemaClassKey* key) const { return impl->getObjectClass(key); } +const SchemaEventClass* Console::getEventClass(const SchemaClassKey* key) const { return impl->getEventClass(key); } +void Console::bindPackage(const char* packageName) { impl->bindPackage(packageName); } +void Console::bindClass(const SchemaClassKey* key) { impl->bindClass(key); } +void Console::bindClass(const char* packageName, const char* className) { impl->bindClass(packageName, className); } +//void Console::startSync(const Query& query, void* context, SyncQuery& sync) { impl->startSync(query, context, sync); } +//void Console::touchSync(SyncQuery& sync) { impl->touchSync(sync); } +//void Console::endSync(SyncQuery& sync) { impl->endSync(sync); } diff --git a/cpp/src/qmf/ConsoleEngineImpl.h b/cpp/src/qmf/engine/ConsoleImpl.h index a78e8409b9..2c4ee48a02 100644 --- a/cpp/src/qmf/ConsoleEngineImpl.h +++ b/cpp/src/qmf/engine/ConsoleImpl.h @@ -1,5 +1,5 @@ -#ifndef _QmfConsoleEngineImpl_ -#define _QmfConsoleEngineImpl_ +#ifndef _QmfEngineConsoleEngineImpl_ +#define _QmfEngineConsoleEngineImpl_ /* * Licensed to the Apache Software Foundation (ASF) under one @@ -20,17 +20,17 @@ * under the License. */ -#include "qmf/ConsoleEngine.h" -#include "qmf/MessageImpl.h" -#include "qmf/SchemaImpl.h" -#include "qmf/Typecode.h" -#include "qmf/ObjectImpl.h" -#include "qmf/ObjectIdImpl.h" -#include "qmf/QueryImpl.h" -#include "qmf/ValueImpl.h" -#include "qmf/Protocol.h" -#include "qmf/SequenceManager.h" -#include "qmf/BrokerProxyImpl.h" +#include "qmf/engine/Console.h" +#include "qmf/engine/MessageImpl.h" +#include "qmf/engine/SchemaImpl.h" +#include "qmf/engine/Typecode.h" +#include "qmf/engine/ObjectImpl.h" +#include "qmf/engine/ObjectIdImpl.h" +#include "qmf/engine/QueryImpl.h" +#include "qmf/engine/ValueImpl.h" +#include "qmf/engine/Protocol.h" +#include "qmf/engine/SequenceManager.h" +#include "qmf/engine/BrokerProxyImpl.h" #include <qpid/framing/Buffer.h> #include <qpid/framing/Uuid.h> #include <qpid/framing/FieldTable.h> @@ -49,6 +49,7 @@ #include <boost/noncopyable.hpp> namespace qmf { +namespace engine { struct ConsoleEventImpl { typedef boost::shared_ptr<ConsoleEventImpl> Ptr; @@ -67,10 +68,10 @@ namespace qmf { ConsoleEvent copy(); }; - class ConsoleEngineImpl : public boost::noncopyable { + class ConsoleImpl : public boost::noncopyable { public: - ConsoleEngineImpl(const ConsoleSettings& settings = ConsoleSettings()); - ~ConsoleEngineImpl(); + ConsoleImpl(const ConsoleSettings& settings = ConsoleSettings()); + ~ConsoleImpl(); bool getEvent(ConsoleEvent& event) const; void popEvent(); @@ -128,6 +129,7 @@ namespace qmf { SchemaObjectClass* getSchema(const SchemaClassKey* key) const; }; } +} #endif diff --git a/cpp/src/qmf/MessageImpl.cpp b/cpp/src/qmf/engine/MessageImpl.cpp index f2625c7202..0047d3eb9d 100644 --- a/cpp/src/qmf/MessageImpl.cpp +++ b/cpp/src/qmf/engine/MessageImpl.cpp @@ -17,11 +17,11 @@ * under the License. */ -#include "qmf/MessageImpl.h" +#include "qmf/engine/MessageImpl.h" #include <string.h> using namespace std; -using namespace qmf; +using namespace qmf::engine; #define STRING_REF(s) {if (!s.empty()) item.s = const_cast<char*>(s.c_str());} diff --git a/cpp/src/qmf/MessageImpl.h b/cpp/src/qmf/engine/MessageImpl.h index 137f435699..b91291d2e4 100644 --- a/cpp/src/qmf/MessageImpl.h +++ b/cpp/src/qmf/engine/MessageImpl.h @@ -1,5 +1,5 @@ -#ifndef _QmfMessageImpl_ -#define _QmfMessageImpl_ +#ifndef _QmfEngineMessageImpl_ +#define _QmfEngineMessageImpl_ /* * Licensed to the Apache Software Foundation (ASF) under one @@ -20,11 +20,12 @@ * under the License. */ -#include "qmf/Message.h" +#include "qmf/engine/Message.h" #include <string> #include <boost/shared_ptr.hpp> namespace qmf { +namespace engine { struct MessageImpl { typedef boost::shared_ptr<MessageImpl> Ptr; @@ -38,5 +39,6 @@ namespace qmf { Message copy(); }; } +} #endif diff --git a/cpp/src/qmf/ObjectIdImpl.cpp b/cpp/src/qmf/engine/ObjectIdImpl.cpp index 90daf204c8..032bc557c0 100644 --- a/cpp/src/qmf/ObjectIdImpl.cpp +++ b/cpp/src/qmf/engine/ObjectIdImpl.cpp @@ -17,11 +17,11 @@ * under the License. */ -#include "qmf/ObjectIdImpl.h" +#include "qmf/engine/ObjectIdImpl.h" #include <stdlib.h> using namespace std; -using namespace qmf; +using namespace qmf::engine; using qpid::framing::Buffer; diff --git a/cpp/src/qmf/ObjectIdImpl.h b/cpp/src/qmf/engine/ObjectIdImpl.h index 7a0950cd9d..44fa8adffc 100644 --- a/cpp/src/qmf/ObjectIdImpl.h +++ b/cpp/src/qmf/engine/ObjectIdImpl.h @@ -1,5 +1,5 @@ -#ifndef _QmfObjectIdImpl_ -#define _QmfObjectIdImpl_ +#ifndef _QmfEngineObjectIdImpl_ +#define _QmfEngineObjectIdImpl_ /* * Licensed to the Apache Software Foundation (ASF) under one @@ -20,10 +20,11 @@ * under the License. */ -#include <qmf/ObjectId.h> +#include <qmf/engine/ObjectId.h> #include <qpid/framing/Buffer.h> namespace qmf { +namespace engine { struct AgentAttachment { uint64_t first; @@ -64,6 +65,7 @@ namespace qmf { bool operator>(const ObjectIdImpl& other) const; }; } +} #endif diff --git a/cpp/src/qmf/ObjectImpl.cpp b/cpp/src/qmf/engine/ObjectImpl.cpp index 99d1fb4354..cae0e0da68 100644 --- a/cpp/src/qmf/ObjectImpl.cpp +++ b/cpp/src/qmf/engine/ObjectImpl.cpp @@ -17,13 +17,13 @@ * under the License. */ -#include "qmf/ObjectImpl.h" -#include "qmf/ValueImpl.h" -#include "qmf/BrokerProxyImpl.h" +#include "qmf/engine/ObjectImpl.h" +#include "qmf/engine/ValueImpl.h" +#include "qmf/engine/BrokerProxyImpl.h" #include <qpid/sys/Time.h> using namespace std; -using namespace qmf; +using namespace qmf::engine; using namespace qpid::sys; using qpid::framing::Buffer; diff --git a/cpp/src/qmf/ObjectImpl.h b/cpp/src/qmf/engine/ObjectImpl.h index 0776aab8fa..ddd20bfea2 100644 --- a/cpp/src/qmf/ObjectImpl.h +++ b/cpp/src/qmf/engine/ObjectImpl.h @@ -1,5 +1,5 @@ -#ifndef _QmfObjectImpl_ -#define _QmfObjectImpl_ +#ifndef _QmfEngineObjectImpl_ +#define _QmfEngineObjectImpl_ /* * Licensed to the Apache Software Foundation (ASF) under one @@ -20,8 +20,8 @@ * under the License. */ -#include <qmf/Object.h> -#include <qmf/ObjectIdImpl.h> +#include <qmf/engine/Object.h> +#include <qmf/engine/ObjectIdImpl.h> #include <map> #include <set> #include <string> @@ -30,6 +30,7 @@ #include <qpid/sys/Mutex.h> namespace qmf { +namespace engine { class BrokerProxyImpl; @@ -69,6 +70,7 @@ namespace qmf { void encodeStatistics(qpid::framing::Buffer& buffer) const; }; } +} #endif diff --git a/cpp/src/qmf/Protocol.cpp b/cpp/src/qmf/engine/Protocol.cpp index 0a3beeb276..6061b70a8d 100644 --- a/cpp/src/qmf/Protocol.cpp +++ b/cpp/src/qmf/engine/Protocol.cpp @@ -17,11 +17,11 @@ * under the License. */ -#include "qmf/Protocol.h" +#include "qmf/engine/Protocol.h" #include "qpid/framing/Buffer.h" using namespace std; -using namespace qmf; +using namespace qmf::engine; using namespace qpid::framing; diff --git a/cpp/src/qmf/Protocol.h b/cpp/src/qmf/engine/Protocol.h index d5da08c1db..1cdfa60c84 100644 --- a/cpp/src/qmf/Protocol.h +++ b/cpp/src/qmf/engine/Protocol.h @@ -1,5 +1,5 @@ -#ifndef _QmfProtocol_ -#define _QmfProtocol_ +#ifndef _QmfEngineProtocol_ +#define _QmfEngineProtocol_ /* * Licensed to the Apache Software Foundation (ASF) under one @@ -29,6 +29,7 @@ namespace qpid { } namespace qmf { +namespace engine { class Protocol { public: @@ -62,6 +63,7 @@ namespace qmf { }; } +} #endif diff --git a/cpp/src/qmf/QueryImpl.cpp b/cpp/src/qmf/engine/QueryImpl.cpp index c10bfb7018..6f2beeee87 100644 --- a/cpp/src/qmf/QueryImpl.cpp +++ b/cpp/src/qmf/engine/QueryImpl.cpp @@ -17,13 +17,13 @@ * under the License. */ -#include "qmf/QueryImpl.h" -#include "qmf/ObjectIdImpl.h" +#include "qmf/engine/QueryImpl.h" +#include "qmf/engine/ObjectIdImpl.h" #include "qpid/framing/Buffer.h" #include "qpid/framing/FieldTable.h" using namespace std; -using namespace qmf; +using namespace qmf::engine; using namespace qpid::framing; bool QueryElementImpl::evaluate(const Object* /*object*/) const diff --git a/cpp/src/qmf/QueryImpl.h b/cpp/src/qmf/engine/QueryImpl.h index afc2c754e6..2c64c6739c 100644 --- a/cpp/src/qmf/QueryImpl.h +++ b/cpp/src/qmf/engine/QueryImpl.h @@ -1,5 +1,5 @@ -#ifndef _QmfQueryImpl_ -#define _QmfQueryImpl_ +#ifndef _QmfEngineQueryImpl_ +#define _QmfEngineQueryImpl_ /* * Licensed to the Apache Software Foundation (ASF) under one @@ -20,8 +20,8 @@ * under the License. */ -#include "qmf/Query.h" -#include "qmf/Schema.h" +#include "qmf/engine/Query.h" +#include "qmf/engine/Schema.h" #include <string> #include <boost/shared_ptr.hpp> @@ -32,6 +32,7 @@ namespace qpid { } namespace qmf { +namespace engine { struct QueryElementImpl { QueryElementImpl(const std::string& a, const Value* v, ValueOper o) : attrName(a), value(v), oper(o) {} @@ -94,5 +95,6 @@ namespace qmf { bool orderDecreasing; }; } +} #endif diff --git a/cpp/src/qmf/ResilientConnection.cpp b/cpp/src/qmf/engine/ResilientConnection.cpp index b3735657af..709cfd1236 100644 --- a/cpp/src/qmf/ResilientConnection.cpp +++ b/cpp/src/qmf/engine/ResilientConnection.cpp @@ -17,9 +17,9 @@ * under the License. */ -#include "qmf/ResilientConnection.h" -#include "qmf/MessageImpl.h" -#include "qmf/ConnectionSettingsImpl.h" +#include "qmf/engine/ResilientConnection.h" +#include "qmf/engine/MessageImpl.h" +#include "qmf/engine/ConnectionSettingsImpl.h" #include <qpid/client/Connection.h> #include <qpid/client/Session.h> #include <qpid/client/MessageListener.h> @@ -41,11 +41,12 @@ #include <boost/noncopyable.hpp> using namespace std; -using namespace qmf; +using namespace qmf::engine; using namespace qpid; using qpid::sys::Mutex; namespace qmf { +namespace engine { struct ResilientConnectionEventImpl { ResilientConnectionEvent::EventKind kind; void* sessionContext; @@ -87,7 +88,7 @@ namespace qmf { void popEvent(); bool createSession(const char* name, void* sessionContext, SessionHandle& handle); void destroySession(SessionHandle handle); - void sendMessage(SessionHandle handle, qmf::Message& message); + void sendMessage(SessionHandle handle, qmf::engine::Message& message); void declareQueue(SessionHandle handle, char* queue); void deleteQueue(SessionHandle handle, char* queue); void bind(SessionHandle handle, char* exchange, char* queue, char* key); @@ -120,6 +121,7 @@ namespace qmf { set<RCSession::Ptr> sessions; }; } +} ResilientConnectionEvent ResilientConnectionEventImpl::copy() { @@ -166,7 +168,7 @@ void RCSession::stop() void RCSession::received(client::Message& msg) { - qmf::MessageImpl qmsg; + MessageImpl qmsg; qmsg.body = msg.getData(); qpid::framing::MessageProperties p = msg.getMessageProperties(); @@ -252,7 +254,7 @@ void ResilientConnectionImpl::destroySession(SessionHandle handle) } } -void ResilientConnectionImpl::sendMessage(SessionHandle handle, qmf::Message& message) +void ResilientConnectionImpl::sendMessage(SessionHandle handle, qmf::engine::Message& message) { Mutex::ScopedLock _lock(lock); RCSession::Ptr sess = RCSession::Ptr((RCSession*) handle.impl); @@ -393,7 +395,7 @@ void ResilientConnectionImpl::sessionClosed(RCSession*) void ResilientConnectionImpl::EnqueueEvent(ResilientConnectionEvent::EventKind kind, void* sessionContext, - const qmf::MessageImpl& message, + const MessageImpl& message, const string& errorText) { Mutex::ScopedLock _lock(lock); @@ -450,7 +452,7 @@ void ResilientConnection::destroySession(SessionHandle handle) impl->destroySession(handle); } -void ResilientConnection::sendMessage(SessionHandle handle, qmf::Message& message) +void ResilientConnection::sendMessage(SessionHandle handle, qmf::engine::Message& message) { impl->sendMessage(handle, message); } diff --git a/cpp/src/qmf/SchemaImpl.cpp b/cpp/src/qmf/engine/SchemaImpl.cpp index 1028281445..fb09980680 100644 --- a/cpp/src/qmf/SchemaImpl.cpp +++ b/cpp/src/qmf/engine/SchemaImpl.cpp @@ -17,7 +17,7 @@ * under the License. */ -#include "qmf/SchemaImpl.h" +#include "qmf/engine/SchemaImpl.h" #include <qpid/framing/Buffer.h> #include <qpid/framing/FieldTable.h> #include <qpid/framing/Uuid.h> @@ -26,7 +26,7 @@ #include <vector> using namespace std; -using namespace qmf; +using namespace qmf::engine; using qpid::framing::Buffer; using qpid::framing::FieldTable; using qpid::framing::Uuid; diff --git a/cpp/src/qmf/SchemaImpl.h b/cpp/src/qmf/engine/SchemaImpl.h index 190a0c7f26..865556f076 100644 --- a/cpp/src/qmf/SchemaImpl.h +++ b/cpp/src/qmf/engine/SchemaImpl.h @@ -1,5 +1,5 @@ -#ifndef _QmfSchemaImpl_ -#define _QmfSchemaImpl_ +#ifndef _QmfEngineSchemaImpl_ +#define _QmfEngineSchemaImpl_ /* * Licensed to the Apache Software Foundation (ASF) under one @@ -20,12 +20,13 @@ * under the License. */ -#include "qmf/Schema.h" +#include "qmf/engine/Schema.h" #include <string> #include <vector> #include <qpid/framing/Buffer.h> namespace qmf { +namespace engine { // TODO: Destructors for schema classes // TODO: Add "frozen" attribute for schema classes so they can't be modified after @@ -215,6 +216,7 @@ namespace qmf { const SchemaArgument* getArgument(int idx) const; }; } +} #endif diff --git a/cpp/src/qmf/SequenceManager.cpp b/cpp/src/qmf/engine/SequenceManager.cpp index 3171e66fac..3708105b46 100644 --- a/cpp/src/qmf/SequenceManager.cpp +++ b/cpp/src/qmf/engine/SequenceManager.cpp @@ -17,10 +17,10 @@ * under the License. */ -#include "qmf/SequenceManager.h" +#include "qmf/engine/SequenceManager.h" using namespace std; -using namespace qmf; +using namespace qmf::engine; using namespace qpid::sys; SequenceManager::SequenceManager() : nextSequence(1) {} diff --git a/cpp/src/qmf/SequenceManager.h b/cpp/src/qmf/engine/SequenceManager.h index bbfd0728a7..5f7db8bdb3 100644 --- a/cpp/src/qmf/SequenceManager.h +++ b/cpp/src/qmf/engine/SequenceManager.h @@ -1,5 +1,5 @@ -#ifndef _QmfSequenceManager_ -#define _QmfSequenceManager_ +#ifndef _QmfEngineSequenceManager_ +#define _QmfEngineSequenceManager_ /* * Licensed to the Apache Software Foundation (ASF) under one @@ -31,6 +31,7 @@ namespace qpid { } namespace qmf { +namespace engine { class SequenceContext { public: @@ -61,6 +62,7 @@ namespace qmf { }; } +} #endif diff --git a/cpp/src/qmf/ValueImpl.cpp b/cpp/src/qmf/engine/ValueImpl.cpp index f13e1a231e..f80bdab866 100644 --- a/cpp/src/qmf/ValueImpl.cpp +++ b/cpp/src/qmf/engine/ValueImpl.cpp @@ -17,11 +17,11 @@ * under the License. */ -#include "qmf/ValueImpl.h" +#include "qmf/engine/ValueImpl.h" #include <qpid/framing/FieldTable.h> using namespace std; -using namespace qmf; +using namespace qmf::engine; using qpid::framing::Buffer; ValueImpl::ValueImpl(Typecode t, Buffer& buf) : typecode(t) diff --git a/cpp/src/qmf/ValueImpl.h b/cpp/src/qmf/engine/ValueImpl.h index 03692a7fad..b6adae5d93 100644 --- a/cpp/src/qmf/ValueImpl.h +++ b/cpp/src/qmf/engine/ValueImpl.h @@ -1,5 +1,5 @@ -#ifndef _QmfValueImpl_ -#define _QmfValueImpl_ +#ifndef _QmfEngineValueImpl_ +#define _QmfEngineValueImpl_ /* * Licensed to the Apache Software Foundation (ASF) under one @@ -20,9 +20,9 @@ * under the License. */ -#include <qmf/Value.h> -#include <qmf/ObjectIdImpl.h> -#include <qmf/Object.h> +#include <qmf/engine/Value.h> +#include <qmf/engine/ObjectIdImpl.h> +#include <qmf/engine/Object.h> #include <qpid/framing/Buffer.h> #include <string> #include <string.h> @@ -31,6 +31,7 @@ #include <boost/shared_ptr.hpp> namespace qmf { +namespace engine { // TODO: set valid flag on all value settors // TODO: add a modified flag and accessors @@ -143,6 +144,7 @@ namespace qmf { void deleteArrayItem(uint32_t idx); }; } +} #endif diff --git a/cpp/src/qpid/broker/SemanticState.cpp b/cpp/src/qpid/broker/SemanticState.cpp index a59d29c3cc..ed9b6653c3 100644 --- a/cpp/src/qpid/broker/SemanticState.cpp +++ b/cpp/src/qpid/broker/SemanticState.cpp @@ -65,7 +65,7 @@ SemanticState::SemanticState(DeliveryAdapter& da, SessionContext& ss) tagGenerator("sgen"), dtxSelected(false), authMsg(getSession().getBroker().getOptions().auth && !getSession().getConnection().isFederationLink()), - userID(getSession().getConnection().getUserId().substr(0,getSession().getConnection().getUserId().find('@'))) + userID(getSession().getConnection().getUserId()) { acl = getSession().getBroker().getAcl(); } |