From ea1194b80b45af210cdc79f9ceabeee31a83b4fd Mon Sep 17 00:00:00 2001 From: Kenneth Anthony Giusti Date: Mon, 21 Oct 2013 12:37:27 +0000 Subject: QPID-5244: remove stale QMFv1 agent example git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1534133 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/examples/README.txt | 5 - qpid/cpp/examples/examples.sln | 24 -- qpid/cpp/examples/qmf-agent/example.cpp | 242 --------------- qpid/cpp/examples/qmf-agent/example_gen.mak | 29 -- qpid/cpp/examples/qmf-agent/qmf_agent.vcproj | 443 --------------------------- qpid/cpp/examples/qmf-agent/schema.xml | 75 ----- 6 files changed, 818 deletions(-) delete mode 100644 qpid/cpp/examples/qmf-agent/example.cpp delete mode 100644 qpid/cpp/examples/qmf-agent/example_gen.mak delete mode 100644 qpid/cpp/examples/qmf-agent/qmf_agent.vcproj delete mode 100644 qpid/cpp/examples/qmf-agent/schema.xml (limited to 'qpid/cpp/examples') diff --git a/qpid/cpp/examples/README.txt b/qpid/cpp/examples/README.txt index 494dab7cd9..74de2788c3 100644 --- a/qpid/cpp/examples/README.txt +++ b/qpid/cpp/examples/README.txt @@ -221,9 +221,4 @@ On Windows: C:\Program Files\qpidc-0.7\examples\request-response> server C:\Program Files\qpidc-0.7\examples\request-response> client -== qmf-console == - -This directory contains examples which demonstrate integration with -the Qpid Management Framework (QMF). Refer to the README.txt file -within the directory for more information. diff --git a/qpid/cpp/examples/examples.sln b/qpid/cpp/examples/examples.sln index 6f96105d97..8511fe3cce 100644 --- a/qpid/cpp/examples/examples.sln +++ b/qpid/cpp/examples/examples.sln @@ -32,14 +32,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "messaging_drain", "messagin EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "messaging_spout", "messaging\messaging_spout.vcproj", "{D3115AC9-91C4-4D79-BCAC-DE837C70F1EA}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qmf_console_console", "qmf-console\qmf-console_console.vcproj", "{490473E1-FECA-1BAD-2E13-3FFA2B8669C3}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qmf_console_ping", "qmf-console\qmf-console_ping.vcproj", "{C1FFDE95-3442-49AE-9985-7EEE3D45B4A3}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qmf_console_printevents", "qmf-console\qmf-console_printevents.vcproj", "{72C74624-FECA-1BAD-2E13-3FFA2B8669C3}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qmf_console_queuestats", "qmf-console\qmf-console_queuestats.vcproj", "{B21825EA-FECA-1BAD-2E13-3FFA2B8669C3}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -96,22 +88,6 @@ Global {D3115AC9-91C4-4D79-BCAC-DE837C70F1EA}.Release|Win32.Build.0 = Release|Win32 {D3115AC9-91C4-4D79-BCAC-DE837C70F1EA}.Release|x64.ActiveCfg = Release|x64 {D3115AC9-91C4-4D79-BCAC-DE837C70F1EA}.Release|x64.Build.0 = Release|x64 - {490473E1-FECA-1BAD-2E13-3FFA2B8669C3}.Debug|Win32.ActiveCfg = Debug|Win32 - {490473E1-FECA-1BAD-2E13-3FFA2B8669C3}.Debug|Win32.Build.0 = Debug|Win32 - {490473E1-FECA-1BAD-2E13-3FFA2B8669C3}.Release|Win32.ActiveCfg = Release|Win32 - {490473E1-FECA-1BAD-2E13-3FFA2B8669C3}.Release|Win32.Build.0 = Release|Win32 - {C1FFDE95-3442-49AE-9985-7EEE3D45B4A3}.Debug|Win32.ActiveCfg = Debug|Win32 - {C1FFDE95-3442-49AE-9985-7EEE3D45B4A3}.Debug|Win32.Build.0 = Debug|Win32 - {C1FFDE95-3442-49AE-9985-7EEE3D45B4A3}.Release|Win32.ActiveCfg = Release|Win32 - {C1FFDE95-3442-49AE-9985-7EEE3D45B4A3}.Release|Win32.Build.0 = Release|Win32 - {72C74624-FECA-1BAD-2E13-3FFA2B8669C3}.Debug|Win32.ActiveCfg = Debug|Win32 - {72C74624-FECA-1BAD-2E13-3FFA2B8669C3}.Debug|Win32.Build.0 = Debug|Win32 - {72C74624-FECA-1BAD-2E13-3FFA2B8669C3}.Release|Win32.ActiveCfg = Release|Win32 - {72C74624-FECA-1BAD-2E13-3FFA2B8669C3}.Release|Win32.Build.0 = Release|Win32 - {B21825EA-FECA-1BAD-2E13-3FFA2B8669C3}.Debug|Win32.ActiveCfg = Debug|Win32 - {B21825EA-FECA-1BAD-2E13-3FFA2B8669C3}.Debug|Win32.Build.0 = Debug|Win32 - {B21825EA-FECA-1BAD-2E13-3FFA2B8669C3}.Release|Win32.ActiveCfg = Release|Win32 - {B21825EA-FECA-1BAD-2E13-3FFA2B8669C3}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/qpid/cpp/examples/qmf-agent/example.cpp b/qpid/cpp/examples/qmf-agent/example.cpp deleted file mode 100644 index f9be4f0164..0000000000 --- a/qpid/cpp/examples/qmf-agent/example.cpp +++ /dev/null @@ -1,242 +0,0 @@ -/* - * - * 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 -#include -#include -#include -#include -#include -#include "qpid/types/Variant.h" -#include "qmf/org/apache/qpid/agent/example/Parent.h" -#include "qmf/org/apache/qpid/agent/example/Child.h" -#include "qmf/org/apache/qpid/agent/example/ArgsParentCreate_child.h" -#include "qmf/org/apache/qpid/agent/example/ArgsParentTest_method.h" -#include "qmf/org/apache/qpid/agent/example/EventChildCreated.h" -#include "qmf/org/apache/qpid/agent/example/Package.h" - -#include -#include -#include - -#include - -static bool running = true; - -using namespace std; -using qpid::management::ManagementAgent; -using qpid::management::ManagementObject; -using qpid::management::Manageable; -using qpid::management::Args; -using qpid::sys::Mutex; -using qpid::types::Variant; -namespace _qmf = qmf::org::apache::qpid::agent::example; - -class ChildClass; - -//============================================================== -// CoreClass is the operational class that corresponds to the -// "Parent" class in the management schema. -//============================================================== -class CoreClass : public Manageable -{ - string name; - ManagementAgent* agent; - _qmf::Parent* mgmtObject; - std::vector children; - Mutex vectorLock; - -public: - - CoreClass(ManagementAgent* agent, string _name); - ~CoreClass() { mgmtObject->resourceDestroy(); } - - ManagementObject* GetManagementObject(void) const - { return mgmtObject; } - - void doLoop(); - bool AuthorizeMethod(uint32_t methodId, Args& args, const string& userId); - status_t ManagementMethod(uint32_t methodId, Args& args, string& text); -}; - -class ChildClass : public Manageable -{ - string name; - _qmf::Child* mgmtObject; - -public: - - ChildClass(ManagementAgent* agent, CoreClass* parent, string name); - ~ChildClass() { mgmtObject->resourceDestroy(); } - - ManagementObject* GetManagementObject(void) const - { return mgmtObject; } - - void doWork() - { - mgmtObject->inc_count(2); - } -}; - -CoreClass::CoreClass(ManagementAgent* _agent, string _name) : name(_name), agent(_agent) -{ - static uint64_t persistId = 0x111222333444555LL; - mgmtObject = new _qmf::Parent(agent, this, name); - - agent->addObject(mgmtObject); - mgmtObject->set_state("IDLE"); - - Variant::Map args; - Variant::Map subMap; - args["first"] = "String data"; - args["second"] = 34; - subMap["string-data"] = "Text"; - subMap["numeric-data"] = 10000; - args["map-data"] = subMap; - mgmtObject->set_args(args); - - Variant::List list; - list.push_back(20000); - list.push_back("string-item"); - mgmtObject->set_list(list); -} - -void CoreClass::doLoop() -{ - // Periodically bump a counter to provide a changing statistical value - while (running) { - qpid::sys::sleep(1); - mgmtObject->inc_count(); - mgmtObject->set_state("IN_LOOP"); - - { - Mutex::ScopedLock _lock(vectorLock); - - for (std::vector::iterator iter = children.begin(); - iter != children.end(); - iter++) { - (*iter)->doWork(); - } - } - } -} - - -bool CoreClass::AuthorizeMethod(uint32_t methodId, Args& args, const string& userId) -{ - QPID_LOG(trace, "AuthorizeMethod for methodId=" << methodId << " userId=" << userId); - return methodId != _qmf::Parent::METHOD_AUTH_FAIL; -} - - -Manageable::status_t CoreClass::ManagementMethod(uint32_t methodId, Args& args, string& /*text*/) -{ - Mutex::ScopedLock _lock(vectorLock); - - switch (methodId) { - case _qmf::Parent::METHOD_CREATE_CHILD: { - _qmf::ArgsParentCreate_child& ioArgs = (_qmf::ArgsParentCreate_child&) args; - - ChildClass *child = new ChildClass(agent, this, ioArgs.i_name); - ioArgs.o_childRef = child->GetManagementObject()->getObjectId(); - - children.push_back(child); - - agent->raiseEvent(_qmf::EventChildCreated(ioArgs.i_name)); - - return STATUS_OK; - } - - case _qmf::Parent::METHOD_TEST_METHOD: { - _qmf::ArgsParentTest_method& ioArgs = (_qmf::ArgsParentTest_method&) args; - - ioArgs.io_aMap["add"] = "me"; - ioArgs.io_aList.push_back(Variant("Stuff")); - // TBD - return STATUS_OK; - } - } - - return STATUS_NOT_IMPLEMENTED; -} - -ChildClass::ChildClass(ManagementAgent* agent, CoreClass* parent, string name) -{ - mgmtObject = new _qmf::Child(agent, this, parent, name); - - agent->addObject(mgmtObject); -} - - -//============================================================== -// Main program -//============================================================== - -ManagementAgent::Singleton* singleton; - -void shutdown(int) -{ - running = false; -} - -int main_int(int argc, char** argv) -{ - singleton = new ManagementAgent::Singleton(); - const char* host = argc>1 ? argv[1] : "127.0.0.1"; - int port = argc>2 ? atoi(argv[2]) : 5672; - - signal(SIGINT, shutdown); - - // Create the qmf management agent - ManagementAgent* agent = singleton->getInstance(); - - // Register the Qmf_example schema with the agent - _qmf::Package packageInit(agent); - - // Name the agent. - agent->setName("apache.org", "qmf-example"); - - // Start the agent. It will attempt to make a connection to the - // management broker - agent->init(host, port, 5, false, ".magentdata"); - - // Allocate some core objects - CoreClass core1(agent, "Example Core Object #1"); - CoreClass core2(agent, "Example Core Object #2"); - CoreClass core3(agent, "Example Core Object #3"); - - core1.doLoop(); - - // done, cleanup and exit - delete singleton; - - return 0; -} - -int main(int argc, char** argv) -{ - try { - return main_int(argc, argv); - } catch(std::exception& e) { - cout << "Top Level Exception: " << e.what() << endl; - } -} - diff --git a/qpid/cpp/examples/qmf-agent/example_gen.mak b/qpid/cpp/examples/qmf-agent/example_gen.mak deleted file mode 100644 index 1d71e77b63..0000000000 --- a/qpid/cpp/examples/qmf-agent/example_gen.mak +++ /dev/null @@ -1,29 +0,0 @@ -# -# 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. -# - -# This nmake file generates the C++ mapping from the example schema. -# -# The Visual Studio projects assume the existence of the generated files. -# These generated files must be created using this makefile for Windows -# developers working from the source repository. - -mgen_dir=..\..\..\cpp\managementgen - -all: - python $(mgen_dir)\qmf-gen -o .\gen\qmf .\schema.xml diff --git a/qpid/cpp/examples/qmf-agent/qmf_agent.vcproj b/qpid/cpp/examples/qmf-agent/qmf_agent.vcproj deleted file mode 100644 index 2a1c04b367..0000000000 --- a/qpid/cpp/examples/qmf-agent/qmf_agent.vcproj +++ /dev/null @@ -1,443 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/qpid/cpp/examples/qmf-agent/schema.xml b/qpid/cpp/examples/qmf-agent/schema.xml deleted file mode 100644 index 2a3bb461cc..0000000000 --- a/qpid/cpp/examples/qmf-agent/schema.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - This class represents a parent object - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit v1.2.1