diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/bindings/qmf/python/Makefile.am | 2 | ||||
-rw-r--r-- | cpp/bindings/qmf/python/qmf.py | 4 | ||||
-rw-r--r-- | cpp/bindings/qmf/qmfengine.i | 35 | ||||
-rw-r--r-- | cpp/bindings/qmf/ruby/Makefile.am | 7 | ||||
-rw-r--r-- | cpp/bindings/qmf/ruby/qmf.rb | 42 | ||||
-rwxr-xr-x | cpp/bindings/qmf/tests/ruby_console_test.rb | 35 | ||||
-rw-r--r-- | cpp/bindings/qmf/tests/test_base.rb | 5 | ||||
-rw-r--r-- | cpp/include/qmf/ConsoleObject.h | 94 | ||||
-rw-r--r-- | cpp/include/qmf/engine/Agent.h (renamed from cpp/src/qmf/AgentEngine.h) | 32 | ||||
-rw-r--r-- | cpp/include/qmf/engine/ConnectionSettings.h (renamed from cpp/include/qmf/ConnectionSettings.h) | 34 | ||||
-rw-r--r-- | cpp/include/qmf/engine/Console.h (renamed from cpp/src/qmf/ConsoleEngine.h) | 40 | ||||
-rw-r--r-- | cpp/include/qmf/engine/Event.h (renamed from cpp/src/qmf/Event.h) | 6 | ||||
-rw-r--r-- | cpp/include/qmf/engine/Message.h (renamed from cpp/src/qmf/Message.h) | 6 | ||||
-rw-r--r-- | cpp/include/qmf/engine/Object.h (renamed from cpp/src/qmf/Object.h) | 14 | ||||
-rw-r--r-- | cpp/include/qmf/engine/ObjectId.h (renamed from cpp/src/qmf/ObjectId.h) | 8 | ||||
-rw-r--r-- | cpp/include/qmf/engine/QmfEngineImportExport.h | 33 | ||||
-rw-r--r-- | cpp/include/qmf/engine/Query.h (renamed from cpp/src/qmf/Query.h) | 10 | ||||
-rw-r--r-- | cpp/include/qmf/engine/ResilientConnection.h (renamed from cpp/src/qmf/ResilientConnection.h) | 10 | ||||
-rw-r--r-- | cpp/include/qmf/engine/Schema.h (renamed from cpp/src/qmf/Schema.h) | 16 | ||||
-rw-r--r-- | cpp/include/qmf/engine/Typecode.h (renamed from cpp/src/qmf/Typecode.h) | 6 | ||||
-rw-r--r-- | cpp/include/qmf/engine/Value.h (renamed from cpp/src/qmf/Value.h) | 12 | ||||
-rw-r--r-- | cpp/src/qmf.mk | 122 | ||||
-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 |
47 files changed, 651 insertions, 408 deletions
diff --git a/cpp/bindings/qmf/python/Makefile.am b/cpp/bindings/qmf/python/Makefile.am index 55d9079fb7..53303c7be9 100644 --- a/cpp/bindings/qmf/python/Makefile.am +++ b/cpp/bindings/qmf/python/Makefile.am @@ -38,7 +38,7 @@ lib_LTLIBRARIES = _qmfengine.la #_qmfengine_la_LDFLAGS = -avoid-version -module -shrext "$(PYTHON_SO)" #_qmfengine_la_LDFLAGS = -avoid-version -module -shrext ".so" _qmfengine_la_LDFLAGS = -avoid-version -module -shared -_qmfengine_la_LIBADD = $(PYTHON_LIBS) -L$(top_builddir)/src/.libs -lqpidclient $(top_builddir)/src/libqmfagent.la +_qmfengine_la_LIBADD = $(PYTHON_LIBS) -L$(top_builddir)/src/.libs -lqpidclient $(top_builddir)/src/libqmf.la _qmfengine_la_CXXFLAGS = $(INCLUDES) -I$(srcdir)/qmf -I$(PYTHON_INC) nodist__qmfengine_la_SOURCES = qmfengine.cpp diff --git a/cpp/bindings/qmf/python/qmf.py b/cpp/bindings/qmf/python/qmf.py index 4800b327f1..383baad0e3 100644 --- a/cpp/bindings/qmf/python/qmf.py +++ b/cpp/bindings/qmf/python/qmf.py @@ -566,7 +566,7 @@ class Console: # attr_reader :impl def initialize(handler=None, kwargs={}): self._handler = handler - self.impl = qmfengine.ConsoleEngine() + self.impl = qmfengine.Console() self._event = qmfengine.ConsoleEvent() self._broker_list = [] @@ -741,7 +741,7 @@ class Agent(ConnectionHandler): self._agentLabel = label self._conn = None self._handler = handler - self.impl = qmfengine.AgentEngine(self._agentLabel) + self.impl = qmfengine.Agent(self._agentLabel) self._event = qmfengine.AgentEvent() self._xmtMessage = qmfengine.Message() diff --git a/cpp/bindings/qmf/qmfengine.i b/cpp/bindings/qmf/qmfengine.i index d3500c9b8f..3477215254 100644 --- a/cpp/bindings/qmf/qmfengine.i +++ b/cpp/bindings/qmf/qmfengine.i @@ -19,34 +19,35 @@ %{ -#include "qmf/AgentEngine.h" -#include "qmf/ConsoleEngine.h" -#include "qmf/ResilientConnection.h" +#include "qmf/engine/Agent.h" +#include "qmf/engine/Console.h" +#include "qmf/engine/ResilientConnection.h" %} -%include <qmf/QmfImportExport.h> -%include <qmf/Query.h> -%include <qmf/Message.h> -%include <qmf/AgentEngine.h> -%include <qmf/ConsoleEngine.h> -%include <qmf/ConnectionSettings.h> -%include <qmf/ResilientConnection.h> -%include <qmf/Typecode.h> -%include <qmf/Schema.h> -%include <qmf/Value.h> -%include <qmf/ObjectId.h> -%include <qmf/Object.h> +%include <qmf/engine/QmfEngineImportExport.h> +%include <qmf/engine/Query.h> +%include <qmf/engine/Message.h> +%include <qmf/engine/Agent.h> +%include <qmf/engine/Console.h> +%include <qmf/engine/ConnectionSettings.h> +%include <qmf/engine/ResilientConnection.h> +%include <qmf/engine/Typecode.h> +%include <qmf/engine/Schema.h> +%include <qmf/engine/Value.h> +%include <qmf/engine/ObjectId.h> +%include <qmf/engine/Object.h> %inline { using namespace std; -using namespace qmf; +using namespace qmf::engine; namespace qmf { +namespace engine { - +} } } diff --git a/cpp/bindings/qmf/ruby/Makefile.am b/cpp/bindings/qmf/ruby/Makefile.am index 0537dd1cd8..34096da9ee 100644 --- a/cpp/bindings/qmf/ruby/Makefile.am +++ b/cpp/bindings/qmf/ruby/Makefile.am @@ -23,23 +23,22 @@ INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_srcdir)/src EXTRA_DIST = ruby.i BUILT_SOURCES = qmfengine.cpp -generated_file_list = qmfengine.cpp rubylibdir = $(RUBY_LIB) dist_rubylib_DATA = qmf.rb -$(generated_file_list): $(srcdir)/ruby.i $(srcdir)/../qmfengine.i +qmfengine.cpp: $(srcdir)/ruby.i $(srcdir)/../qmfengine.i $(SWIG) -ruby -c++ -Wall -I/usr/include $(INCLUDES) $(QPID_CXXFLAGS) -o qmfengine.cpp $(srcdir)/ruby.i rubylibarchdir = $(RUBY_LIB_ARCH) rubylibarch_LTLIBRARIES = qmfengine.la qmfengine_la_LDFLAGS = -avoid-version -module -shrext ".$(RUBY_DLEXT)" -qmfengine_la_LIBADD = $(RUBY_LIBS) -L$(top_builddir)/src/.libs -lqpidclient $(top_builddir)/src/libqmfagent.la +qmfengine_la_LIBADD = $(RUBY_LIBS) -L$(top_builddir)/src/.libs -lqpidclient $(top_builddir)/src/libqmfengine.la qmfengine_la_CXXFLAGS = $(INCLUDES) -I$(RUBY_INC) -I$(RUBY_INC_ARCH) nodist_qmfengine_la_SOURCES = qmfengine.cpp -CLEANFILES = $(generated_file_list) +CLEANFILES = qmfengine.cpp endif # HAVE_RUBY_DEVEL diff --git a/cpp/bindings/qmf/ruby/qmf.rb b/cpp/bindings/qmf/ruby/qmf.rb index 265d2ce192..c469376ff4 100644 --- a/cpp/bindings/qmf/ruby/qmf.rb +++ b/cpp/bindings/qmf/ruby/qmf.rb @@ -570,6 +570,10 @@ module Qmf def args Arguments.new(@impl.getArgs) end + + def method_missing(name, *extra_args) + args.__send__(name, extra_args) + end end ##============================================================================== @@ -643,6 +647,10 @@ module Qmf def typecode @impl.getType end + + def to_s + name + end end class SchemaMethod @@ -669,6 +677,10 @@ module Qmf def name @impl.getName end + + def to_s + name + end end class SchemaProperty @@ -689,6 +701,10 @@ module Qmf def name @impl.getName end + + def to_s + name + end end class SchemaStatistic @@ -706,6 +722,10 @@ module Qmf def name @impl.getName end + + def to_s + name + end end class SchemaClassKey @@ -816,7 +836,7 @@ module Qmf def initialize(handler = nil, kwargs={}) super() @handler = handler - @impl = Qmfengine::ConsoleEngine.new + @impl = Qmfengine::Console.new @event = Qmfengine::ConsoleEvent.new @broker_list = [] @cv = new_cond @@ -902,9 +922,15 @@ module Qmf def objects(query, kwargs = {}) timeout = 30 + kwargs.merge!(query) if query.class == Hash + if kwargs.include?(:timeout) timeout = kwargs[:timeout] + kwargs.delete(:timeout) end + + query = Query.new(kwargs) if query.class == Hash + synchronize do @sync_count = 1 @sync_result = [] @@ -918,6 +944,18 @@ module Qmf end end + # Return one and only one object or nil. + def object(query, kwargs = {}) + objs = objects(query, kwargs) + return objs.length == 1 ? objs[0] : nil + end + + # Return the first of potentially many objects. + def first_object(query, kwargs = {}) + objs = objects(query, kwargs) + return objs.length > 0 ? objs[0] : nil + end + def _get_result(list, context) synchronize do list.each do |item| @@ -1120,7 +1158,7 @@ module Qmf end @conn = nil @handler = handler - @impl = Qmfengine::AgentEngine.new(@agentLabel) + @impl = Qmfengine::Agent.new(@agentLabel) @event = Qmfengine::AgentEvent.new @xmtMessage = Qmfengine::Message.new end diff --git a/cpp/bindings/qmf/tests/ruby_console_test.rb b/cpp/bindings/qmf/tests/ruby_console_test.rb index 29f7be9db0..9a33b5cdc6 100755 --- a/cpp/bindings/qmf/tests/ruby_console_test.rb +++ b/cpp/bindings/qmf/tests/ruby_console_test.rb @@ -38,9 +38,8 @@ class ConsoleTest < ConsoleTestBase end def test_B_basic_method_invocation - parents = @qmfc.objects(Qmf::Query.new(:class => "parent")) - assert_equal(parents.size, 1, "Number of 'parent' objects") - parent = parents[0] + parent = @qmfc.object(:class => "parent") + assert(parent, "Number of 'parent' objects") for seq in 0...10 result = parent.echo(seq) assert_equal(result.status, 0, "Method Response Status") @@ -54,9 +53,8 @@ class ConsoleTest < ConsoleTestBase end def test_C_basic_types_numeric_big - parents = @qmfc.objects(Qmf::Query.new(:class =>"parent")) - assert_equal(parents.size, 1, "Number of parent objects") - parent = parents[0] + parent = @qmfc.object(:class =>"parent") + assert(parent, "Number of parent objects") result = parent.set_numerics("big") assert_equal(result.status, 0, "Method Response Status") @@ -76,9 +74,8 @@ class ConsoleTest < ConsoleTestBase end def test_C_basic_types_numeric_small - parents = @qmfc.objects(Qmf::Query.new(:class =>"parent")) - assert_equal(parents.size, 1, "Number of parent objects") - parent = parents[0] + parent = @qmfc.object(:class =>"parent") + assert(parent, "Number of parent objects") result = parent.set_numerics("small") assert_equal(result.status, 0, "Method Response Status") @@ -98,9 +95,8 @@ class ConsoleTest < ConsoleTestBase end def test_C_basic_types_numeric_negative - parents = @qmfc.objects(Qmf::Query.new(:class =>"parent")) - assert_equal(parents.size, 1, "Number of parent objects") - parent = parents[0] + parent = @qmfc.object(:class =>"parent") + assert(parent, "Number of parent objects") result = parent.set_numerics("negative") assert_equal(result.status, 0, "Method Response Status") @@ -120,9 +116,8 @@ class ConsoleTest < ConsoleTestBase end def test_C_basic_types_string_short - parents = @qmfc.objects(Qmf::Query.new(:class =>"parent")) - assert_equal(parents.size, 1, "Number of parent objects") - parent = parents[0] + parent = @qmfc.object(:class =>"parent") + assert(parent, "Number of parent objects") strings = [] strings << "" @@ -148,9 +143,8 @@ class ConsoleTest < ConsoleTestBase end def test_C_basic_types_string_long - parents = @qmfc.objects(Qmf::Query.new(:class =>"parent")) - assert_equal(parents.size, 1, "Number of parent objects") - parent = parents[0] + parent = @qmfc.object(:class =>"parent") + assert(parent, "Number of parent objects") strings = [] strings << "" @@ -174,9 +168,8 @@ class ConsoleTest < ConsoleTestBase end def test_D_userid_for_method - parents = @qmfc.objects(Qmf::Query.new(:class => "parent")) - assert_equal(parents.size, 1, "Number of parent objects") - parent = parents[0] + parent = @qmfc.object(:class => "parent") + assert(parent, "Number of parent objects") result = parent.probe_userid assert_equal(result.status, 0, "Method Response Status") diff --git a/cpp/bindings/qmf/tests/test_base.rb b/cpp/bindings/qmf/tests/test_base.rb index 80cc43a12d..947753b02a 100644 --- a/cpp/bindings/qmf/tests/test_base.rb +++ b/cpp/bindings/qmf/tests/test_base.rb @@ -62,6 +62,11 @@ class ConsoleTestBase < Qmf::ConsoleHandler raise "Assertion failed: #{left} != #{right}#{text}" unless left == right end + def assert(condition, in_text=nil) + text = " (#{in_text})" if in_text + raise "Assertion failed: #{left} != #{right}#{text}" unless condition + end + def fail(text) raise text end diff --git a/cpp/include/qmf/ConsoleObject.h b/cpp/include/qmf/ConsoleObject.h new file mode 100644 index 0000000000..acbc285e05 --- /dev/null +++ b/cpp/include/qmf/ConsoleObject.h @@ -0,0 +1,94 @@ +#ifndef _QmfConsoleObject_ +#define _QmfConsoleObject_ + +/* + * 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/QmfImportExport.h" + +namespace qmf { + + class ConsoleObjectImpl; + class SchemaObjectClass; + class ObjectId; + class Value; + + /** + * ConsoleObject is an extension of Object with console-specific methods added. + * + * \ingroup qmfapi + */ + class ConsoleObject : public Object { + public: + /** + * Create a new Object of a specific type. + * + * @param type Pointer to the schema class to use as a type for this object. + */ + QMF_EXTERN ConsoleObject(const SchemaObjectClass* type); + + /** + * Destroy the object. + */ + QMF_EXTERN virtual ~ConsoleObject(); + + /** + * + */ + QMF_EXTERN const SchemaObjectClass* getSchema() const; + + /** + * + */ + QMF_EXTERN ObjectId* getObjectId() const; + + /** + * + */ + QMF_EXTERN uint64_t getCurrentTime() const; + QMF_EXTERN uint64_t getCreateTime() const; + QMF_EXTERN uint64_t getDeleteTime() const; + + /** + * + */ + QMF_EXTERN bool isDeleted() const; + + /** + * + */ + QMF_EXTERN void update(); + + /** + * + */ + QMF_EXTERN void invokeMethod(const char* name, const Value* arguments, MethodResult& result); + + /** + * + */ + QMF_EXTERN uint32_t invokeMethodAsync(const char* name, const Value* arguments = 0); + + private: + ConsoleObjectImpl* impl; + }; + +} + +#endif diff --git a/cpp/src/qmf/AgentEngine.h b/cpp/include/qmf/engine/Agent.h index bf91cbb4c8..71abf82254 100644 --- a/cpp/src/qmf/AgentEngine.h +++ b/cpp/include/qmf/engine/Agent.h @@ -1,5 +1,5 @@ -#ifndef _QmfAgentEngine_ -#define _QmfAgentEngine_ +#ifndef _QmfEngineAgent_ +#define _QmfEngineAgent_ /* * Licensed to the Apache Software Foundation (ASF) under one @@ -20,15 +20,16 @@ * 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> +#include <qmf/engine/Schema.h> +#include <qmf/engine/ObjectId.h> +#include <qmf/engine/Object.h> +#include <qmf/engine/Event.h> +#include <qmf/engine/Query.h> +#include <qmf/engine/Value.h> +#include <qmf/engine/Message.h> namespace qmf { +namespace engine { /** * AgentEvent @@ -64,15 +65,15 @@ namespace qmf { const SchemaObjectClass* objectClass; // (METHOD_CALL) }; - class AgentEngineImpl; + class AgentImpl; /** - * AgentEngine - Protocol engine for the QMF agent + * Agent - Protocol engine for the QMF agent */ - class AgentEngine { + class Agent { public: - AgentEngine(char* label, bool internalStore=true); - ~AgentEngine(); + Agent(char* label, bool internalStore=true); + ~Agent(); /** * Configure the directory path for storing persistent data. @@ -199,9 +200,10 @@ namespace qmf { void raiseEvent(Event& event); private: - AgentEngineImpl* impl; + AgentImpl* impl; }; } +} #endif diff --git a/cpp/include/qmf/ConnectionSettings.h b/cpp/include/qmf/engine/ConnectionSettings.h index 5ba49226fc..33f7c85a94 100644 --- a/cpp/include/qmf/ConnectionSettings.h +++ b/cpp/include/qmf/engine/ConnectionSettings.h @@ -1,5 +1,5 @@ -#ifndef _QmfConnectionSettings_ -#define _QmfConnectionSettings_ +#ifndef _QmfEngineConnectionSettings_ +#define _QmfEngineConnectionSettings_ /* * Licensed to the Apache Software Foundation (ASF) under one @@ -20,10 +20,11 @@ * under the License. */ -#include "qmf/QmfImportExport.h" +#include "qmf/engine/QmfEngineImportExport.h" #include "qpid/sys/IntegerTypes.h" namespace qmf { +namespace engine { class ConnectionSettingsImpl; class Value; @@ -44,7 +45,7 @@ namespace qmf { * authentication will be the best-available (GSSAPI/Kerberos, Anonymous, Plain with prompts * for username and password). */ - QMF_EXTERN ConnectionSettings(); + QMFE_EXTERN ConnectionSettings(); /** * Create a set of connection settings by URL. @@ -59,7 +60,7 @@ namespace qmf { * amqp://broker?transport=rdma&authmech=GSSAPI&authservice=qpidd * amqps://broker?authmech=PLAIN&authuser=guest&authpass=guest */ - QMF_EXTERN ConnectionSettings(const char* url); + QMFE_EXTERN ConnectionSettings(const char* url); /** * Copy Constructor. @@ -69,7 +70,7 @@ namespace qmf { /** * Destroy the connection settings object. */ - QMF_EXTERN ~ConnectionSettings(); + QMFE_EXTERN ~ConnectionSettings(); /** * Set an attribute to control connection setup. @@ -79,7 +80,7 @@ namespace qmf { * @param value Reference to a value to be stored as the attribute. The type of the value * is specific to the key. */ - QMF_EXTERN void setAttr(const char* key, const Value& value); + QMFE_EXTERN void setAttr(const char* key, const Value& value); /** * Get the value of an attribute. @@ -88,7 +89,7 @@ namespace qmf { * * @return The value associated with the attribute name. */ - QMF_EXTERN Value getAttr(const char* key) const; + QMFE_EXTERN Value getAttr(const char* key) const; /** * Get the attribute string (the portion of the URL following the '?') for the settings. @@ -97,16 +98,16 @@ namespace qmf { * available beyond the scope of the calling function, it should be copied. The * returned pointer may become invalid if the set of attributes is changed. */ - QMF_EXTERN const char* getAttrString() const; + QMFE_EXTERN const char* getAttrString() const; /** * Shortcuts for setting the transport for the connection. * * @param port The port value for the connection address. */ - QMF_EXTERN void transportTcp(uint16_t port = 5672); - QMF_EXTERN void transportSsl(uint16_t port = 5671); - QMF_EXTERN void transportRdma(uint16_t port = 5672); + QMFE_EXTERN void transportTcp(uint16_t port = 5672); + QMFE_EXTERN void transportSsl(uint16_t port = 5671); + QMFE_EXTERN void transportRdma(uint16_t port = 5672); /** * Shortcuts for setting authentication mechanisms. @@ -121,9 +122,9 @@ namespace qmf { * * @param maxSsf Maximum security factor for connections. 0 = encryption not permitted. */ - QMF_EXTERN void authAnonymous(const char* username = 0); - QMF_EXTERN void authPlain(const char* username = 0, const char* password = 0); - QMF_EXTERN void authGssapi(const char* serviceName, uint32_t minSsf = 0, uint32_t maxSsf = 256); + QMFE_EXTERN void authAnonymous(const char* username = 0); + QMFE_EXTERN void authPlain(const char* username = 0, const char* password = 0); + QMFE_EXTERN void authGssapi(const char* serviceName, uint32_t minSsf = 0, uint32_t maxSsf = 256); /** * Shortcut for setting connection retry attributes. @@ -134,7 +135,7 @@ namespace qmf { * * @param delayFactor Factor to multiply the delay by between failed connection attempts. */ - QMF_EXTERN void setRetry(int delayMin = 1, int delayMax = 128, int delayFactor = 2); + QMFE_EXTERN void setRetry(int delayMin = 1, int delayMax = 128, int delayFactor = 2); private: friend class ResilientConnectionImpl; @@ -142,5 +143,6 @@ namespace qmf { }; } +} #endif diff --git a/cpp/src/qmf/ConsoleEngine.h b/cpp/include/qmf/engine/Console.h index 455ec69901..49cf41f2bc 100644 --- a/cpp/src/qmf/ConsoleEngine.h +++ b/cpp/include/qmf/engine/Console.h @@ -1,5 +1,5 @@ -#ifndef _QmfConsoleEngine_ -#define _QmfConsoleEngine_ +#ifndef _QmfEngineConsole_ +#define _QmfEngineConsole_ /* * Licensed to the Apache Software Foundation (ASF) under one @@ -20,19 +20,20 @@ * 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> +#include <qmf/engine/ResilientConnection.h> +#include <qmf/engine/Schema.h> +#include <qmf/engine/ObjectId.h> +#include <qmf/engine/Object.h> +#include <qmf/engine/Event.h> +#include <qmf/engine/Query.h> +#include <qmf/engine/Value.h> +#include <qmf/engine/Message.h> namespace qmf { +namespace engine { - class ConsoleEngine; - struct ConsoleEngineImpl; + class Console; + struct ConsoleImpl; class BrokerProxyImpl; class AgentProxy; struct AgentProxyImpl; @@ -53,7 +54,7 @@ namespace qmf { private: friend struct MethodResponseImpl; - friend struct ConsoleEngineImpl; + friend struct ConsoleImpl; MethodResponse(MethodResponseImpl* impl); MethodResponseImpl* impl; }; @@ -146,7 +147,7 @@ namespace qmf { */ class BrokerProxy { public: - BrokerProxy(ConsoleEngine& console); + BrokerProxy(Console& console); ~BrokerProxy(); void sessionOpened(SessionHandle& sh); @@ -165,7 +166,7 @@ namespace qmf { void sendQuery(const Query& query, void* context, const AgentProxy* agent = 0); private: - friend struct ConsoleEngineImpl; + friend struct ConsoleImpl; friend struct StaticContext; BrokerProxyImpl* impl; }; @@ -184,10 +185,10 @@ namespace qmf { userBindings(false) {} }; - class ConsoleEngine { + class Console { public: - ConsoleEngine(const ConsoleSettings& settings = ConsoleSettings()); - ~ConsoleEngine(); + Console(const ConsoleSettings& settings = ConsoleSettings()); + ~Console(); bool getEvent(ConsoleEvent& event) const; void popEvent(); @@ -218,9 +219,10 @@ namespace qmf { private: friend class BrokerProxyImpl; friend struct AgentProxyImpl; - ConsoleEngineImpl* impl; + ConsoleImpl* impl; }; } +} #endif diff --git a/cpp/src/qmf/Event.h b/cpp/include/qmf/engine/Event.h index f20c6d2fb1..50ab5c1200 100644 --- a/cpp/src/qmf/Event.h +++ b/cpp/include/qmf/engine/Event.h @@ -1,5 +1,5 @@ -#ifndef _QmfEvent_ -#define _QmfEvent_ +#ifndef _QmfEngineEvent_ +#define _QmfEngineEvent_ /* * Licensed to the Apache Software Foundation (ASF) under one @@ -21,10 +21,12 @@ */ namespace qmf { +namespace engine { class Event { }; } +} #endif diff --git a/cpp/src/qmf/Message.h b/cpp/include/qmf/engine/Message.h index 52b8ba72d3..1e95cc6afe 100644 --- a/cpp/src/qmf/Message.h +++ b/cpp/include/qmf/engine/Message.h @@ -1,5 +1,5 @@ -#ifndef _QmfMessage_ -#define _QmfMessage_ +#ifndef _QmfEngineMessage_ +#define _QmfEngineMessage_ /* * Licensed to the Apache Software Foundation (ASF) under one @@ -23,6 +23,7 @@ #include "qpid/sys/IntegerTypes.h" namespace qmf { +namespace engine { struct Message { char* body; @@ -35,5 +36,6 @@ namespace qmf { }; } +} #endif diff --git a/cpp/src/qmf/Object.h b/cpp/include/qmf/engine/Object.h index f32095cba4..ad67cfdb95 100644 --- a/cpp/src/qmf/Object.h +++ b/cpp/include/qmf/engine/Object.h @@ -1,5 +1,5 @@ -#ifndef _QmfObject_ -#define _QmfObject_ +#ifndef _QmfEngineObject_ +#define _QmfEngineObject_ /* * Licensed to the Apache Software Foundation (ASF) under one @@ -20,11 +20,12 @@ * under the License. */ -#include <qmf/Schema.h> -#include <qmf/ObjectId.h> -#include <qmf/Value.h> +#include <qmf/engine/Schema.h> +#include <qmf/engine/ObjectId.h> +#include <qmf/engine/Value.h> namespace qmf { +namespace engine { struct ObjectImpl; class Object { @@ -44,11 +45,12 @@ namespace qmf { private: friend struct ObjectImpl; - friend class AgentEngineImpl; + friend class AgentImpl; Object(ObjectImpl* impl); ObjectImpl* impl; }; } +} #endif diff --git a/cpp/src/qmf/ObjectId.h b/cpp/include/qmf/engine/ObjectId.h index 9097230fd9..a4b868b578 100644 --- a/cpp/src/qmf/ObjectId.h +++ b/cpp/include/qmf/engine/ObjectId.h @@ -1,5 +1,5 @@ -#ifndef _QmfObjectId_ -#define _QmfObjectId_ +#ifndef _QmfEngineObjectId_ +#define _QmfEngineObjectId_ /* * Licensed to the Apache Software Foundation (ASF) under one @@ -23,6 +23,7 @@ #include <qpid/sys/IntegerTypes.h> namespace qmf { +namespace engine { // TODO: Add to/from string and << operator @@ -50,11 +51,12 @@ namespace qmf { friend class BrokerProxyImpl; friend struct QueryImpl; friend struct ValueImpl; - friend class AgentEngineImpl; + friend class AgentImpl; ObjectId(ObjectIdImpl* impl); ObjectIdImpl* impl; }; } +} #endif diff --git a/cpp/include/qmf/engine/QmfEngineImportExport.h b/cpp/include/qmf/engine/QmfEngineImportExport.h new file mode 100644 index 0000000000..70164c749f --- /dev/null +++ b/cpp/include/qmf/engine/QmfEngineImportExport.h @@ -0,0 +1,33 @@ +#ifndef QMF_ENGINE_IMPORT_EXPORT_H +#define QMF_ENGINE_IMPORT_EXPORT_H + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#if defined(WIN32) && !defined(QPID_DECLARE_STATIC) +# if defined(QMF_EXPORT) || defined (qmfcommon_EXPORTS) +# define QMFE_EXTERN __declspec(dllexport) +# else +# define QMFE_EXTERN __declspec(dllimport) +# endif +#else +# define QMFE_EXTERN +#endif + +#endif diff --git a/cpp/src/qmf/Query.h b/cpp/include/qmf/engine/Query.h index bd3ed6b862..1b11ea83f2 100644 --- a/cpp/src/qmf/Query.h +++ b/cpp/include/qmf/engine/Query.h @@ -1,5 +1,5 @@ -#ifndef _QmfQuery_ -#define _QmfQuery_ +#ifndef _QmfEngineQuery_ +#define _QmfEngineQuery_ /* * Licensed to the Apache Software Foundation (ASF) under one @@ -20,10 +20,11 @@ * under the License. */ -#include <qmf/ObjectId.h> -#include <qmf/Value.h> +#include <qmf/engine/ObjectId.h> +#include <qmf/engine/Value.h> namespace qmf { +namespace engine { class Object; struct QueryElementImpl; @@ -103,6 +104,7 @@ namespace qmf { QueryImpl* impl; }; } +} #endif diff --git a/cpp/src/qmf/ResilientConnection.h b/cpp/include/qmf/engine/ResilientConnection.h index 03f1b9c0d5..359c8ea6ff 100644 --- a/cpp/src/qmf/ResilientConnection.h +++ b/cpp/include/qmf/engine/ResilientConnection.h @@ -1,5 +1,5 @@ -#ifndef _QmfResilientConnection_ -#define _QmfResilientConnection_ +#ifndef _QmfEngineResilientConnection_ +#define _QmfEngineResilientConnection_ /* * Licensed to the Apache Software Foundation (ASF) under one @@ -20,11 +20,12 @@ * under the License. */ -#include <qmf/Message.h> -#include <qmf/ConnectionSettings.h> +#include <qmf/engine/Message.h> +#include <qmf/engine/ConnectionSettings.h> #include <string> namespace qmf { +namespace engine { class ResilientConnectionImpl; @@ -158,6 +159,7 @@ namespace qmf { ResilientConnectionImpl* impl; }; } +} #endif diff --git a/cpp/src/qmf/Schema.h b/cpp/include/qmf/engine/Schema.h index a7757756ea..fceb29990d 100644 --- a/cpp/src/qmf/Schema.h +++ b/cpp/include/qmf/engine/Schema.h @@ -1,5 +1,5 @@ -#ifndef _QmfSchema_ -#define _QmfSchema_ +#ifndef _QmfEngineSchema_ +#define _QmfEngineSchema_ /* * Licensed to the Apache Software Foundation (ASF) under one @@ -20,10 +20,11 @@ * under the License. */ -#include <qmf/Typecode.h> +#include <qmf/engine/Typecode.h> #include <qpid/sys/IntegerTypes.h> namespace qmf { +namespace engine { enum Access { ACCESS_READ_CREATE = 1, ACCESS_READ_WRITE = 2, ACCESS_READ_ONLY = 3 }; enum Direction { DIR_IN = 1, DIR_OUT = 2, DIR_IN_OUT = 3 }; @@ -78,7 +79,7 @@ namespace qmf { private: friend struct SchemaMethodImpl; friend struct SchemaObjectClassImpl; - friend class AgentEngineImpl; + friend class AgentImpl; SchemaMethod(SchemaMethodImpl* impl); SchemaMethodImpl* impl; }; @@ -148,7 +149,7 @@ namespace qmf { private: friend struct SchemaClassKeyImpl; friend class BrokerProxyImpl; - friend struct ConsoleEngineImpl; + friend struct ConsoleImpl; SchemaClassKey(SchemaClassKeyImpl* impl); SchemaClassKeyImpl* impl; }; @@ -175,7 +176,7 @@ namespace qmf { private: friend struct SchemaObjectClassImpl; friend class BrokerProxyImpl; - friend class AgentEngineImpl; + friend class AgentImpl; SchemaObjectClass(SchemaObjectClassImpl* impl); SchemaObjectClassImpl* impl; }; @@ -197,11 +198,12 @@ namespace qmf { private: friend struct SchemaEventClassImpl; friend class BrokerProxyImpl; - friend class AgentEngineImpl; + friend class AgentImpl; SchemaEventClass(SchemaEventClassImpl* impl); SchemaEventClassImpl* impl; }; } +} #endif diff --git a/cpp/src/qmf/Typecode.h b/cpp/include/qmf/engine/Typecode.h index 94614d2977..613f96a483 100644 --- a/cpp/src/qmf/Typecode.h +++ b/cpp/include/qmf/engine/Typecode.h @@ -1,5 +1,5 @@ -#ifndef _QmfTypecode_ -#define _QmfTypecode_ +#ifndef _QmfEngineTypecode_ +#define _QmfEngineTypecode_ /* * Licensed to the Apache Software Foundation (ASF) under one @@ -21,6 +21,7 @@ */ namespace qmf { +namespace engine { enum Typecode { TYPE_UINT8 = 1, @@ -46,6 +47,7 @@ namespace qmf { TYPE_ARRAY = 22 }; } +} #endif diff --git a/cpp/src/qmf/Value.h b/cpp/include/qmf/engine/Value.h index 81ff5a8783..8eae382caf 100644 --- a/cpp/src/qmf/Value.h +++ b/cpp/include/qmf/engine/Value.h @@ -1,5 +1,5 @@ -#ifndef _QmfValue_ -#define _QmfValue_ +#ifndef _QmfEngineValue_ +#define _QmfEngineValue_ /* * Licensed to the Apache Software Foundation (ASF) under one @@ -20,10 +20,11 @@ * under the License. */ -#include <qmf/ObjectId.h> -#include <qmf/Typecode.h> +#include <qmf/engine/ObjectId.h> +#include <qmf/engine/Typecode.h> namespace qmf { +namespace engine { class Object; struct ValueImpl; @@ -109,11 +110,12 @@ namespace qmf { friend struct ValueImpl; friend class BrokerProxyImpl; friend struct ObjectImpl; - friend class AgentEngineImpl; + friend class AgentImpl; Value(ValueImpl* impl); ValueImpl* impl; }; } +} #endif 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.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(); } |