Author: cctrieloff
Date: Tue Sep 16 12:33:36 2008
New Revision: 696017

URL: http://svn.apache.org/viewvc?rev=696017&view=rev
Log:
- add mgnt schema for cluster
- add mgnt object and init
- create call-backs to stop a cluster node & the full cluster



Added:
    incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/management-schema.xml
Modified:
    incubator/qpid/trunk/qpid/cpp/src/Makefile.am
    incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.h

Modified: incubator/qpid/trunk/qpid/cpp/src/Makefile.am
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/Makefile.am?rev=696017&r1=696016&r2=696017&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/Makefile.am (original)
+++ incubator/qpid/trunk/qpid/cpp/src/Makefile.am Tue Sep 16 12:33:36 2008
@@ -30,7 +30,8 @@
 mgen_dir=$(top_srcdir)/managementgen
 mgen_cmd=$(mgen_dir)/qmf-gen -m $(srcdir)/managementgen.mk -o gen/qmf \
        $(top_srcdir)/../specs/management-schema.xml \
-       $(srcdir)/qpid/acl/management-schema.xml
+       $(srcdir)/qpid/acl/management-schema.xml \
+       $(srcdir)/qpid/cluster/management-schema.xml
 
 $(srcdir)/managementgen.mk $(mgen_broker_cpp) $(dist_qpid_management_HEADERS): 
mgen.timestamp
 mgen.timestamp: $(mgen_generator)

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp?rev=696017&r1=696016&r2=696017&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp Tue Sep 16 
12:33:36 2008
@@ -33,6 +33,7 @@
 #include "qpid/log/Statement.h"
 #include "qpid/memory.h"
 #include "qpid/shared_ptr.h"
+#include "qmf/org/apache/qpid/cluster/Package.h"
 
 #include <boost/bind.hpp>
 #include <boost/cast.hpp>
@@ -47,6 +48,12 @@
 using namespace qpid::framing;
 using namespace qpid::sys;
 using namespace std;
+using namespace qpid::cluster;
+using qpid::management::ManagementAgent;
+using qpid::management::ManagementObject;
+using qpid::management::Manageable;
+using qpid::management::Args;
+namespace _qmf = qmf::org::apache::qpid::cluster;
 
 struct ClusterOperations : public AMQP_AllOperations::ClusterHandler {
     Cluster& cluster;
@@ -74,6 +81,15 @@
     
connectionEventQueue(EventQueue::forEach(boost::bind(&Cluster::connectionEvent, 
this, _1))),
     state(START)
 {
+    ManagementAgent* agent = ManagementAgent::Singleton::getInstance();
+    if (agent != 0){
+        _qmf::Package  packageInit(agent);
+        mgmtObject = new _qmf::Cluster (agent, this, &broker,name.str());
+        agent->addObject (mgmtObject);
+               mgmtObject->set_status("JOINING");
+               
+               // if first cluster up set new UUID to set_clusterID() else set 
UUID of cluster being joined.
+    }
     QPID_LOG(notice, self << " joining cluster " << name.str());
     broker.addFinalizer(boost::bind(&Cluster::shutdown, this));
     cpgDispatchHandle.startWatch(poller);
@@ -344,5 +360,35 @@
     delete this;
 }
 
+ManagementObject* Cluster::GetManagementObject(void) const
+{
+   return (ManagementObject*) mgmtObject;
+}
+
+Manageable::status_t Cluster::ManagementMethod (uint32_t methodId, Args& 
/*args*/, string&)
+{
+  Manageable::status_t status = Manageable::STATUS_UNKNOWN_METHOD;
+  QPID_LOG (debug, "Queue::ManagementMethod [id=" << methodId << "]");
+
+  switch (methodId)
+  {
+  case _qmf::Cluster::METHOD_STOPCLUSTERNODE:
+      stopClusterNode();
+      break;
+  case _qmf::Cluster::METHOD_STOPFULLCLUSTER:
+      stopFullCluster();
+      break;
+  }
+
+  return status;
+}    
+
+void Cluster::stopClusterNode(void)
+{
+}
+
+void Cluster::stopFullCluster(void)
+{
+}
 
 }} // namespace qpid::cluster

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.h
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.h?rev=696017&r1=696016&r2=696017&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.h Tue Sep 16 
12:33:36 2008
@@ -29,6 +29,8 @@
 #include "qpid/sys/Monitor.h"
 #include "qpid/framing/AMQP_AllOperations.h"
 #include "qpid/Url.h"
+#include "qpid/management/Manageable.h"
+#include "qmf/org/apache/qpid/cluster/Cluster.h"
 
 #include <boost/intrusive_ptr.hpp>
 
@@ -43,7 +45,7 @@
  * Connection to the cluster.
  * Keeps cluster membership data.
  */
-class Cluster : private Cpg::Handler
+class Cluster : private Cpg::Handler, public management::Manageable
 {
   public:
 
@@ -129,6 +131,11 @@
 
     boost::intrusive_ptr<cluster::Connection> getConnection(const 
ConnectionId&);
 
+    virtual qpid::management::ManagementObject* GetManagementObject(void) 
const;
+    virtual management::Manageable::status_t ManagementMethod (uint32_t 
methodId, management::Args& args, std::string& text);
+    void stopClusterNode(void);
+    void stopFullCluster(void);
+
     mutable sys::Monitor lock;  // Protect access to members.
     broker::Broker& broker;
     boost::shared_ptr<sys::Poller> poller;
@@ -142,6 +149,7 @@
     sys::DispatchHandle cpgDispatchHandle;
     EventQueue connectionEventQueue;
     State state;
+    qmf::org::apache::qpid::cluster::Cluster* mgmtObject; // mgnt owns 
lifecycle
 };
 
 }} // namespace qpid::cluster

Added: incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/management-schema.xml
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/management-schema.xml?rev=696017&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/management-schema.xml (added)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/management-schema.xml Tue 
Sep 16 12:33:36 2008
@@ -0,0 +1,57 @@
+<schema package="org.apache.qpid.cluster">
+
+<!--
+  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.
+-->
+
+  <!-- Type information:
+
+       Numeric types with "_wm" suffix are watermarked numbers.  These are 
compound
+       values containing a current value, and a low and high water mark for 
the reporting
+       interval.  The low and high water marks are set to the current value at 
the
+       beginning of each interval and track the minimum and maximum values of 
the statistic
+       over the interval respectively.
+
+       Access rights for configuration elements:
+
+           RO => Read Only
+           RC => Read/Create, can be set at create time only, read-only 
thereafter
+           RW => Read/Write
+
+           If access rights are omitted for a property, they are assumed to be 
RO.
+
+  -->
+
+  <class name="cluster">
+    <property name="brokerRef"        type="objId"  references="Broker" 
access="RC" index="y" parentRef="y"/>
+    <property name="clusterName"      type="sstr"   access="RC" desc="Name of 
cluster this server is a member of"/>
+    <property name="clusterID"        type="sstr"   access="RO" desc="Globally 
uniquie ID (UUID) for this cluster instance"/>
+    <property name="publishedURL"     type="sstr"   access="RO" desc="URL this 
node advertizes itself as"/>
+    <property name="clusterSize"      type="uint16" access="RO" desc="Number 
of brokers currently in the cluster"/>
+    <property name="status"           type="sstr"   access="RO" desc="Cluster 
node status (STALLED,ACTIVE,JOINING)"/>
+       <property name="members"          type="map"    access="RO" desc="List 
of 'host:port' of member nodes in the cluster"/>
+       
+
+    <method name="stopClusterNode"/>
+    <method name="stopFullCluster"/>
+
+  </class>
+
+
+</schema>
+


Reply via email to