You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by sa...@apache.org on 2014/12/09 12:30:30 UTC

[2/2] stratos git commit: Removing status from Cluster and adding to ClusterInstance

Removing status from Cluster and adding to ClusterInstance


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/31b8ab71
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/31b8ab71
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/31b8ab71

Branch: refs/heads/4.1.0-test
Commit: 31b8ab7127d5591b8c68ee3047ef926fafc898c0
Parents: 05e1a83
Author: sajhak <sa...@gmail.com>
Authored: Tue Dec 9 15:44:02 2014 +0530
Committer: sajhak <sa...@gmail.com>
Committed: Tue Dec 9 16:53:03 2014 +0530

----------------------------------------------------------------------
 .../rest/endpoint/bean/topology/Cluster.java    |  2 +-
 .../endpoint/bean/topology/ClusterInstance.java | 29 ++++++++++++++++++++
 .../bean/util/converter/PojoConverter.java      | 12 +++++++-
 3 files changed, 41 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/31b8ab71/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/topology/Cluster.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/topology/Cluster.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/topology/Cluster.java
index 5635cc0..bc6ce52 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/topology/Cluster.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/topology/Cluster.java
@@ -40,7 +40,7 @@ public class Cluster {
 
     public boolean isLbCluster;
 
-    public String status;
+    public List<ClusterInstance> clusterInstance;
     
     public List<PropertyBean> property;
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/31b8ab71/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/topology/ClusterInstance.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/topology/ClusterInstance.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/topology/ClusterInstance.java
new file mode 100644
index 0000000..388d673
--- /dev/null
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/topology/ClusterInstance.java
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+package org.apache.stratos.rest.endpoint.bean.topology;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class ClusterInstance {
+
+	public String status;
+	
+	public String instanceId;
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/31b8ab71/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/util/converter/PojoConverter.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/util/converter/PojoConverter.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/util/converter/PojoConverter.java
index 128a33e..6ec5e52 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/util/converter/PojoConverter.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/util/converter/PojoConverter.java
@@ -42,6 +42,7 @@ import org.apache.stratos.manager.grouping.definitions.ServiceGroupDefinition;
 import org.apache.stratos.manager.subscription.SubscriptionDomain;
 import org.apache.stratos.messaging.domain.applications.Application;
 import org.apache.stratos.messaging.domain.applications.Group;
+import org.apache.stratos.messaging.domain.instance.ClusterInstance;
 import org.apache.stratos.messaging.domain.topology.Cluster;
 import org.apache.stratos.rest.endpoint.bean.ApplicationBean;
 import org.apache.stratos.rest.endpoint.bean.GroupBean;
@@ -484,7 +485,16 @@ public class PojoConverter {
         cluster1.property = getPropertyBeans(cluster.getProperties());
         cluster1.member = new ArrayList<Member>();
         cluster1.hostNames = new ArrayList<String>();
-        cluster1.status = cluster.getStatus(null).toString(); //TODO why null is passed?
+        Collection<ClusterInstance> clusterInstances = cluster.getClusterInstances();
+		if (clusterInstances != null) {
+			for (ClusterInstance clusterInstance : clusterInstances) {
+				org.apache.stratos.rest.endpoint.bean.topology.ClusterInstance instance = 
+						new org.apache.stratos.rest.endpoint.bean.topology.ClusterInstance();
+				instance.instanceId = clusterInstance.getInstanceId();
+				instance.status = clusterInstance.getStatus().toString();
+				cluster1.clusterInstance.add(instance);
+			}
+		}
 
         for (org.apache.stratos.messaging.domain.topology.Member tmp : cluster.getMembers()) {
             Member member = new Member();