stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From isu...@apache.org
Subject git commit: exposing complete deployment policy with the CLI
Date Thu, 06 Feb 2014 16:23:12 GMT
Updated Branches:
  refs/heads/master c89680e32 -> 4e8c0cc23


exposing complete deployment policy with the CLI


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

Branch: refs/heads/master
Commit: 4e8c0cc23e5af043461319e1e0158f2cf5742020
Parents: c89680e
Author: Isuru <isuruh@wso2.com>
Authored: Thu Feb 6 21:52:52 2014 +0530
Committer: Isuru <isuruh@wso2.com>
Committed: Thu Feb 6 21:52:52 2014 +0530

----------------------------------------------------------------------
 .../stratos/cli/RestCommandLineService.java     | 28 ++++++++++----------
 .../bean/util/converter/PojoConverter.java      | 13 ++++++---
 2 files changed, 23 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4e8c0cc2/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 8456e71..b02ea69 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
@@ -29,10 +29,11 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.http.HttpResponse;
 import org.apache.http.client.ClientProtocolException;
 import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.stratos.cli.beans.*;
+import org.apache.stratos.cli.beans.SubscriptionInfo;
+import org.apache.stratos.cli.beans.TenantInfoBean;
 import org.apache.stratos.cli.beans.autoscaler.partition.Partition;
-import org.apache.stratos.cli.beans.autoscaler.policy.deployment.DeploymentPolicy;
 import org.apache.stratos.cli.beans.autoscaler.policy.autoscale.AutoscalePolicy;
+import org.apache.stratos.cli.beans.autoscaler.policy.deployment.DeploymentPolicy;
 import org.apache.stratos.cli.beans.cartridge.Cartridge;
 import org.apache.stratos.cli.beans.cartridge.CartridgeInfoBean;
 import org.apache.stratos.cli.beans.cartridge.PortMapping;
@@ -51,14 +52,7 @@ import java.io.IOException;
 import java.io.InputStreamReader;
 import java.net.ConnectException;
 import java.net.SocketException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import jline.internal.Log;
+import java.util.*;
 
 public class RestCommandLineService {
 
@@ -533,11 +527,17 @@ public class RestCommandLineService {
 
         	Member[] members = getMembers(cartridgeType, alias, httpClient);
 
+            if (members == null) {
+                 // these conditions are handled in the getMembers method
+                return;
+            }
+
             if (members.length == 0) {
                 if (logger.isDebugEnabled()) {
-                    logger.debug("No subscribed cartridges found");
+                    logger.debug("No Members found");
                 }
-                System.out.println("There are no subscribed cartridges");
+                System.out.println("No members found for the corresponding cluster for type
" + cartridgeType
+                        + ", alias " + alias);
                 return;
             }
 
@@ -591,7 +591,7 @@ public class RestCommandLineService {
 		Cluster cluster = getClusterObjectFromString(getHttpResponseString(response));
 		
 		 if (cluster == null) {
-             System.out.println("Subscribe cartridge list is null");
+             System.out.println("No existing subscriptions found for alias " + alias);
              return null;
          }
 
@@ -945,7 +945,7 @@ public class RestCommandLineService {
         try {
             HttpResponse response = restClientService.doPost(httpClient, restClientService.getUrl()
+ deploymentPolicyDeploymentEndPoint,
                     deploymentPolicy, restClientService.getUsername(), restClientService.getPassword());
-            System.out.println(deploymentPolicy);
+            //System.out.println(deploymentPolicy);
             String responseCode = "" + response.getStatusLine().getStatusCode();
             if (responseCode.equals("" + CliConstants.RESPONSE_AUTHORIZATION_FAIL)) {
                 System.out.println("Invalid operations. Authorization failed");

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4e8c0cc2/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 4927a57..3d3b814 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
@@ -29,6 +29,7 @@ import org.apache.stratos.rest.endpoint.bean.cartridge.definition.*;
 import org.apache.stratos.rest.endpoint.bean.topology.Member;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 public class PojoConverter {
@@ -516,10 +517,14 @@ public class PojoConverter {
         }
 
         deploymentPolicyBean.id = deploymentPolicy.getId();
-        //if(deploymentPolicy.getPartitionGroups() != null &&
-        //        deploymentPolicy.getPartitionGroups().length > 0) {
-        //    deploymentPolicy.partitionGroup = getPartitionGroups(deploymentPolicy.getPartitionGroups());
-        //}
+
+        if (deploymentPolicy.getPartitionGroups() != null &&  deploymentPolicy.getPartitionGroups().length
> 0) {
+            deploymentPolicyBean.partitionGroup = Arrays.asList(populatePartitionGroupPojos(deploymentPolicy.getPartitionGroups()));
+        }
+
+        /*if (deploymentPolicy.getAllPartitions() != null && deploymentPolicy.getAllPartitions().length
> 0) {
+            deploymentPolicyBean.partition = Arrays.asList(populatePartitionPojos(deploymentPolicy.getAllPartitions()));
+        }*/
 
         return deploymentPolicyBean;
     }


Mime
View raw message