diff options
author | Ted Ross <tross@apache.org> | 2010-05-25 14:02:49 +0000 |
---|---|---|
committer | Ted Ross <tross@apache.org> | 2010-05-25 14:02:49 +0000 |
commit | 20def4fc6769f8ade4cf5b341c40249745ff95e2 (patch) | |
tree | 11fcc54c98ba911cd9d9dd933244cb9d9626b5d5 | |
parent | 708b53fae2a61e608d4f7329c4ae81a7a0556dc5 (diff) | |
download | qpid-python-20def4fc6769f8ade4cf5b341c40249745ff95e2.tar.gz |
Replaced the earlier-removed init function (in ManagementAgent.h) that uses
ConnectionSettings. Created a ConnectionSettings in the qpid::management name
space that mirrors that from the qpid::client namespace.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@948046 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | cpp/include/qpid/agent/ManagementAgent.h | 9 | ||||
-rw-r--r-- | cpp/include/qpid/management/ConnectionSettings.h | 118 | ||||
-rw-r--r-- | cpp/src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | cpp/src/Makefile.am | 2 | ||||
-rw-r--r-- | cpp/src/qpid/agent/ManagementAgentImpl.cpp | 25 | ||||
-rw-r--r-- | cpp/src/qpid/agent/ManagementAgentImpl.h | 2 | ||||
-rw-r--r-- | cpp/src/qpid/management/ConnectionSettings.cpp | 40 |
7 files changed, 192 insertions, 5 deletions
diff --git a/cpp/include/qpid/agent/ManagementAgent.h b/cpp/include/qpid/agent/ManagementAgent.h index 456b657dc2..d534416da2 100644 --- a/cpp/include/qpid/agent/ManagementAgent.h +++ b/cpp/include/qpid/agent/ManagementAgent.h @@ -24,6 +24,7 @@ #include "qpid/management/ManagementObject.h" #include "qpid/management/ManagementEvent.h" #include "qpid/management/Manageable.h" +#include "qpid/management/ConnectionSettings.h" namespace qpid { namespace management { @@ -103,6 +104,12 @@ class ManagementAgent const std::string& mech = "PLAIN", const std::string& proto = "tcp") = 0; + virtual void init(const management::ConnectionSettings& settings, + uint16_t intervalSeconds = 10, + bool useExternalThread = false, + const std::string& storeFile = "") = 0; + + // Register a schema with the management agent. This is normally called by the // package initializer generated by the management code generator. // @@ -117,7 +124,7 @@ class ManagementAgent const std::string& eventName, uint8_t* md5Sum, management::ManagementEvent::writeSchemaCall_t schemaCall) = 0; - + // Add a management object to the agent. Once added, this object shall be visible // in the greater management context. // diff --git a/cpp/include/qpid/management/ConnectionSettings.h b/cpp/include/qpid/management/ConnectionSettings.h new file mode 100644 index 0000000000..b631ffa658 --- /dev/null +++ b/cpp/include/qpid/management/ConnectionSettings.h @@ -0,0 +1,118 @@ +#ifndef _management_ConnectionSettings_h +#define _management_ConnectionSettings_h +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +#include "qpid/CommonImportExport.h" +#include "qpid/types/Variant.h" +#include <string> + +namespace qpid { +namespace management { + +/** + * Settings for a Connection. + */ +struct ConnectionSettings { + + QPID_COMMON_EXTERN ConnectionSettings(); + QPID_COMMON_EXTERN virtual ~ConnectionSettings(); + + /** + * The protocol used for the connection (defaults to 'tcp') + */ + std::string protocol; + + /** + * The host (or ip address) to connect to (defaults to 'localhost'). + */ + std::string host; + /** + * The port to connect to (defaults to 5672). + */ + uint16_t port; + /** + * Allows an AMQP 'virtual host' to be specified for the + * connection. + */ + std::string virtualhost; + + /** + * The username to use when authenticating the connection. If not + * specified the current users login is used if available. + */ + std::string username; + /** + * The password to use when authenticating the connection. + */ + std::string password; + /** + * The SASL mechanism to use when authenticating the connection; + * the options are currently PLAIN or ANONYMOUS. + */ + std::string mechanism; + /** + * Allows a locale to be specified for the connection. + */ + std::string locale; + /** + * Allows a heartbeat frequency to be specified + */ + uint16_t heartbeat; + /** + * The maximum number of channels that the client will request for + * use on this connection. + */ + uint16_t maxChannels; + /** + * The maximum frame size that the client will request for this + * connection. + */ + uint16_t maxFrameSize; + /** + * Limit the size of the connections send buffer . The buffer + * is limited to bounds * maxFrameSize. + */ + unsigned int bounds; + /** + * If true, TCP_NODELAY will be set for the connection. + */ + bool tcpNoDelay; + /** + * SASL service name + */ + std::string service; + /** + * Minimum acceptable strength of any SASL negotiated security + * layer. 0 means no security layer required. + */ + unsigned int minSsf; + /** + * Maximum acceptable strength of any SASL negotiated security + * layer. 0 means no security layer allowed. + */ + unsigned int maxSsf; +}; + +}} + +#endif + diff --git a/cpp/src/CMakeLists.txt b/cpp/src/CMakeLists.txt index aa40fd7a2e..70835746fb 100644 --- a/cpp/src/CMakeLists.txt +++ b/cpp/src/CMakeLists.txt @@ -616,6 +616,7 @@ set (qpidcommon_SOURCES qpid/log/Selector.cpp qpid/log/Statement.cpp qpid/management/Buffer.cpp + qpid/management/ConnectionSettings.cpp qpid/management/Mutex.cpp qpid/management/Manageable.cpp qpid/management/ManagementObject.cpp diff --git a/cpp/src/Makefile.am b/cpp/src/Makefile.am index 15a0eb448a..fbce21d579 100644 --- a/cpp/src/Makefile.am +++ b/cpp/src/Makefile.am @@ -422,6 +422,7 @@ libqpidcommon_la_SOURCES += \ qpid/log/Selector.cpp \ qpid/log/Statement.cpp \ qpid/management/Buffer.cpp \ + qpid/management/ConnectionSettings.cpp \ qpid/management/Manageable.cpp \ qpid/management/ManagementObject.cpp \ qpid/management/Mutex.cpp \ @@ -809,6 +810,7 @@ nobase_include_HEADERS += \ ../include/qpid/log/Statement.h \ ../include/qpid/management/Args.h \ ../include/qpid/management/Buffer.h \ + ../include/qpid/management/ConnectionSettings.h \ ../include/qpid/management/Manageable.h \ ../include/qpid/management/ManagementEvent.h \ ../include/qpid/management/ManagementObject.h \ diff --git a/cpp/src/qpid/agent/ManagementAgentImpl.cpp b/cpp/src/qpid/agent/ManagementAgentImpl.cpp index 5c2c6c54e6..6a07d8c0e7 100644 --- a/cpp/src/qpid/agent/ManagementAgentImpl.cpp +++ b/cpp/src/qpid/agent/ManagementAgentImpl.cpp @@ -148,7 +148,7 @@ void ManagementAgentImpl::init(const string& brokerHost, const string& mech, const string& proto) { - client::ConnectionSettings settings; + management::ConnectionSettings settings; settings.protocol = proto; settings.host = brokerHost; settings.port = brokerPort; @@ -158,7 +158,7 @@ void ManagementAgentImpl::init(const string& brokerHost, init(settings, intervalSeconds, useExternalThread, _storeFile); } -void ManagementAgentImpl::init(const qpid::client::ConnectionSettings& settings, +void ManagementAgentImpl::init(const qpid::management::ConnectionSettings& settings, uint16_t intervalSeconds, bool useExternalThread, const string& _storeFile) @@ -170,7 +170,26 @@ void ManagementAgentImpl::init(const qpid::client::ConnectionSettings& settings, QPID_LOG(info, "QMF Agent Initialized: broker=" << settings.host << ":" << settings.port << " interval=" << intervalSeconds << " storeFile=" << _storeFile); - connectionSettings = settings; + + // + // Convert from management::ConnectionSettings to client::ConnectionSettings + // + connectionSettings.protocol = settings.protocol; + connectionSettings.host = settings.host; + connectionSettings.port = settings.port; + connectionSettings.virtualhost = settings.virtualhost; + connectionSettings.username = settings.username; + connectionSettings.password = settings.password; + connectionSettings.mechanism = settings.mechanism; + connectionSettings.locale = settings.locale; + connectionSettings.heartbeat = settings.heartbeat; + connectionSettings.maxChannels = settings.maxChannels; + connectionSettings.maxFrameSize = settings.maxFrameSize; + connectionSettings.bounds = settings.bounds; + connectionSettings.tcpNoDelay = settings.tcpNoDelay; + connectionSettings.service = settings.service; + connectionSettings.minSsf = settings.minSsf; + connectionSettings.maxSsf = settings.maxSsf; retrieveData(); bootSequence++; diff --git a/cpp/src/qpid/agent/ManagementAgentImpl.h b/cpp/src/qpid/agent/ManagementAgentImpl.h index d1609341be..7d4531f1b8 100644 --- a/cpp/src/qpid/agent/ManagementAgentImpl.h +++ b/cpp/src/qpid/agent/ManagementAgentImpl.h @@ -63,7 +63,7 @@ class ManagementAgentImpl : public ManagementAgent, public client::MessageListen const std::string& pwd = "guest", const std::string& mech = "PLAIN", const std::string& proto = "tcp"); - void init(const client::ConnectionSettings& settings, + void init(const management::ConnectionSettings& settings, uint16_t intervalSeconds = 10, bool useExternalThread = false, const std::string& storeFile = ""); diff --git a/cpp/src/qpid/management/ConnectionSettings.cpp b/cpp/src/qpid/management/ConnectionSettings.cpp new file mode 100644 index 0000000000..1421a26867 --- /dev/null +++ b/cpp/src/qpid/management/ConnectionSettings.cpp @@ -0,0 +1,40 @@ +/* + * + * 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/management/ConnectionSettings.h" +#include "qpid/Version.h" + +qpid::management::ConnectionSettings::ConnectionSettings() : + protocol("tcp"), + host("localhost"), + port(5672), + locale("en_US"), + heartbeat(0), + maxChannels(32767), + maxFrameSize(65535), + bounds(2), + tcpNoDelay(false), + service(qpid::saslName), + minSsf(0), + maxSsf(256) +{} + +qpid::management::ConnectionSettings::~ConnectionSettings() {} + |