Add describe-service-group command to CLI

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

Branch: refs/heads/master
Commit: d3747756b5ca27c6c92d0dd14686a075626a69fa
Parents: edb22c5
Author: Manula Thantriwatte <[email protected]>
Authored: Sat Nov 8 06:43:31 2014 +0000
Committer: Manula Thantriwatte <[email protected]>
Committed: Sat Nov 8 06:43:31 2014 +0000

----------------------------------------------------------------------
 .../stratos/cli/RestCommandLineService.java     |  9 ++--
 .../grouping/definitions/Dependencies.java      | 46 +++++++++++++++++
 .../definitions/DependencyDefinitions.java      | 50 -------------------
 .../definitions/ServiceGroupDefinition.java     | 48 +++++++++---------
 .../grouping/definitions/ServiceGroupList.java  | 52 +++++++++-----------
 .../definitions/StartupOrderDefinition.java     | 43 ----------------
 6 files changed, 99 insertions(+), 149 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/d3747756/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
 
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
index 3011a8c..a4cde9b 100644
--- 
a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
+++ 
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
@@ -1826,15 +1826,16 @@ public class RestCommandLineService {
 
     public void describeServiceGroup (String groupDefinitionName) {
         try {
-            ServiceGroupDefinition list = (ServiceGroupDefinition) 
restClient.listEntity(ENDPOINT_LIST_SERVICE_GROUP.replace("{groupDefinitionName}",
 groupDefinitionName),
-                    ServiceGroupDefinition.class, "serviceGroup");
+            ServiceGroupList list = (ServiceGroupList) 
restClient.listEntity(ENDPOINT_LIST_SERVICE_GROUP.replace("{groupDefinitionName}",
 groupDefinitionName),
+                    ServiceGroupList.class, "serviceGroup");
 
-            if ((list == null) || (list.getName() == null)) {
+            if ((list == null) || (list.getServiceGroupDefinition() == null)) {
                 System.out.println("Service group not found: " + 
groupDefinitionName);
                 return;
             }
 
-            System.out.println(getGson().toJson(list));
+            System.out.println("Service Group : " + groupDefinitionName);
+            
System.out.println(getGson().toJson(list.getServiceGroupDefinition()));
         } catch (Exception e) {
             String message = "Error in describing service group: " + 
groupDefinitionName;
             System.out.println(message);

http://git-wip-us.apache.org/repos/asf/stratos/blob/d3747756/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/grouping/definitions/Dependencies.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/grouping/definitions/Dependencies.java
 
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/grouping/definitions/Dependencies.java
new file mode 100644
index 0000000..f093a51
--- /dev/null
+++ 
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/grouping/definitions/Dependencies.java
@@ -0,0 +1,46 @@
+/*
+ * 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.cli.beans.grouping.definitions;
+
+public class Dependencies
+{
+    private String terminationBehaviour;
+
+    private String[] startupOrders;
+
+    public String getTerminationBehaviour ()
+    {
+        return terminationBehaviour;
+    }
+
+    public void setTerminationBehaviour (String terminationBehaviour)
+    {
+        this.terminationBehaviour = terminationBehaviour;
+    }
+
+    public String[] getStartupOrders ()
+    {
+        return startupOrders;
+    }
+
+    public void setStartupOrders (String[] startupOrders)
+    {
+        this.startupOrders = startupOrders;
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d3747756/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/grouping/definitions/DependencyDefinitions.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/grouping/definitions/DependencyDefinitions.java
 
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/grouping/definitions/DependencyDefinitions.java
deleted file mode 100644
index 4d74778..0000000
--- 
a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/grouping/definitions/DependencyDefinitions.java
+++ /dev/null
@@ -1,50 +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.
- */
-
-package org.apache.stratos.cli.beans.grouping.definitions;
-
-import java.util.List;
-
-public class DependencyDefinitions {
-
-    /**
-        * 
-        */
-       private static final long serialVersionUID = 1L;
-       
-       private List<String> startupOrders;
-
-    private String terminationBehaviour;
-
-    public String getTerminationBehaviour() {
-        return terminationBehaviour;
-    }
-
-    public void setTerminationBehaviour(String terminationBehaviour) {
-        this.terminationBehaviour = terminationBehaviour;
-    }
-
-       public List<String> getStartupOrders() {
-               return startupOrders;
-       }
-
-       public void setStartupOrders(List<String> startupOrders) {
-               this.startupOrders = startupOrders;
-       }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d3747756/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/grouping/definitions/ServiceGroupDefinition.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/grouping/definitions/ServiceGroupDefinition.java
 
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/grouping/definitions/ServiceGroupDefinition.java
index 18b3099..e27d728 100644
--- 
a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/grouping/definitions/ServiceGroupDefinition.java
+++ 
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/grouping/definitions/ServiceGroupDefinition.java
@@ -16,51 +16,55 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.stratos.cli.beans.grouping.definitions;
 
-import javax.xml.bind.annotation.XmlRootElement;
-import java.util.List;
-
-public class ServiceGroupDefinition {
+public class ServiceGroupDefinition
+{
+    private Dependencies dependencies;
 
     private String name;
 
-    private List<String> subGroups;
+    private String[] subGroups;
 
-    private List<String> cartridges;
+    private String[] cartridges;
 
-    private DependencyDefinitions dependencies;
+    public Dependencies getDependencies ()
+    {
+        return dependencies;
+    }
+
+    public void setDependencies (Dependencies dependencies)
+    {
+        this.dependencies = dependencies;
+    }
 
-    public String getName() {
+    public String getName ()
+    {
         return name;
     }
 
-    public void setName(String name) {
+    public void setName (String name)
+    {
         this.name = name;
     }
 
-    public List<String> getSubGroups() {
+    public String[] getSubGroups ()
+    {
         return subGroups;
     }
 
-    public void setSubGroups(List<String> subGroups) {
+    public void setSubGroups (String[] subGroups)
+    {
         this.subGroups = subGroups;
     }
 
-    public List<String> getCartridges() {
+    public String[] getCartridges ()
+    {
         return cartridges;
     }
 
-    public void setCartridges(List<String> cartridges) {
+    public void setCartridges (String[] cartridges)
+    {
         this.cartridges = cartridges;
     }
-
-    public DependencyDefinitions getDependencies() {
-        return dependencies;
-    }
-
-    public void setDependencies(DependencyDefinitions dependencies) {
-        this.dependencies = dependencies;
-    }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/d3747756/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/grouping/definitions/ServiceGroupList.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/grouping/definitions/ServiceGroupList.java
 
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/grouping/definitions/ServiceGroupList.java
index 25949c8..7a9fae6 100644
--- 
a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/grouping/definitions/ServiceGroupList.java
+++ 
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/grouping/definitions/ServiceGroupList.java
@@ -1,41 +1,33 @@
-/**
- *  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
-
+/*
+ * 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.
+ *
+ * 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.cli.beans.grouping.definitions;
 
-import java.util.ArrayList;
-
-/**
- * Service group list.
- */
 public class ServiceGroupList {
-    private ArrayList<ServiceGroupDefinition> serviceGroup;
+    private ServiceGroupDefinition serviceGroup;
 
-    public ArrayList<ServiceGroupDefinition> getServiceGroup() {
+    public ServiceGroupDefinition getServiceGroupDefinition ()
+    {
         return serviceGroup;
     }
 
-    public void setServiceGroup(ArrayList<ServiceGroupDefinition> 
serviceGroup) {
-        this.serviceGroup = serviceGroup;
-    }
-
-    ServiceGroupList () {
-        serviceGroup = new ArrayList<ServiceGroupDefinition>();
+    public void setServiceGroupDefinition (ServiceGroupDefinition 
serviceGroupDefinition)
+    {
+        this.serviceGroup = serviceGroupDefinition;
     }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/d3747756/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/grouping/definitions/StartupOrderDefinition.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/grouping/definitions/StartupOrderDefinition.java
 
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/grouping/definitions/StartupOrderDefinition.java
deleted file mode 100644
index 8e437e1..0000000
--- 
a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/grouping/definitions/StartupOrderDefinition.java
+++ /dev/null
@@ -1,43 +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.
- */
-
-package org.apache.stratos.cli.beans.grouping.definitions;
-
-public class StartupOrderDefinition {
-
-    private String start;
-
-    private String after;
-
-    public String getStart() {
-        return start;
-    }
-
-    public void setStart(String start) {
-        this.start = start;
-    }
-
-    public String getAfter() {
-        return after;
-    }
-
-    public void setAfter(String after) {
-        this.after = after;
-    }
-}

Reply via email to