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/05/06 12:53:25 UTC

git commit: fix subscription subscribe issue

Repository: incubator-stratos
Updated Branches:
  refs/heads/master cbcb71c35 -> c6a4c3cc4


fix subscription subscribe issue

Signed-off-by: sajhak <sa...@gmail.com>


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

Branch: refs/heads/master
Commit: c6a4c3cc49fa4b538a5099487c743da24e6ffdd6
Parents: cbcb71c
Author: Akila Perera <ra...@gmail.com>
Authored: Tue May 6 11:32:32 2014 +0530
Committer: sajhak <sa...@gmail.com>
Committed: Tue May 6 16:13:41 2014 +0530

----------------------------------------------------------------------
 .../controllers/cartridgeSubscribeSubmit.jag    |   4 +-
 .../rest/endpoint/services/ServiceUtils.java    | 609 +++++++++----------
 2 files changed, 307 insertions(+), 306 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c6a4c3cc/components/org.apache.stratos.manager.console/console/controllers/cartridgeSubscribeSubmit.jag
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager.console/console/controllers/cartridgeSubscribeSubmit.jag b/components/org.apache.stratos.manager.console/console/controllers/cartridgeSubscribeSubmit.jag
index 1aed656..3e66a99 100644
--- a/components/org.apache.stratos.manager.console/console/controllers/cartridgeSubscribeSubmit.jag
+++ b/components/org.apache.stratos.manager.console/console/controllers/cartridgeSubscribeSubmit.jag
@@ -67,7 +67,9 @@
     }
     jsonRequest.autoscalePolicy = autoscalePolicy;
     jsonRequest.deploymentPolicy = deploymentPolicy;
-    jsonRequest.size = size;
+    if (size != null && size != ""){
+        jsonRequest.size = size;
+    }
     jsonRequest.persistanceRequired = persistencerequired;
     jsonRequest.commitsEnabled = commitsEnabled;
     jsonRequest.removeOnTermination = removeontermination;

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c6a4c3cc/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
index 217ea48..640a751 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
@@ -23,14 +23,14 @@ import org.apache.axis2.context.ConfigurationContext;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.autoscaler.deployment.policy.DeploymentPolicy;
-import org.apache.stratos.cloud.controller.stub.pojo.CartridgeConfig;
-import org.apache.stratos.cloud.controller.stub.pojo.CartridgeInfo;
-import org.apache.stratos.cloud.controller.stub.pojo.Property;
 import org.apache.stratos.autoscaler.stub.AutoScalerServiceInvalidPartitionExceptionException;
 import org.apache.stratos.autoscaler.stub.AutoScalerServiceInvalidPolicyExceptionException;
 import org.apache.stratos.cloud.controller.stub.CloudControllerServiceInvalidCartridgeDefinitionExceptionException;
 import org.apache.stratos.cloud.controller.stub.CloudControllerServiceInvalidCartridgeTypeExceptionException;
 import org.apache.stratos.cloud.controller.stub.CloudControllerServiceInvalidIaasProviderExceptionException;
+import org.apache.stratos.cloud.controller.stub.pojo.CartridgeConfig;
+import org.apache.stratos.cloud.controller.stub.pojo.CartridgeInfo;
+import org.apache.stratos.cloud.controller.stub.pojo.Property;
 import org.apache.stratos.manager.client.AutoscalerServiceClient;
 import org.apache.stratos.manager.client.CloudControllerServiceClient;
 import org.apache.stratos.manager.deploy.service.Service;
@@ -52,7 +52,8 @@ import org.apache.stratos.messaging.domain.topology.Member;
 import org.apache.stratos.messaging.domain.topology.MemberStatus;
 import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
 import org.apache.stratos.messaging.util.Constants;
-import org.apache.stratos.rest.endpoint.bean.*;
+import org.apache.stratos.rest.endpoint.bean.CartridgeInfoBean;
+import org.apache.stratos.rest.endpoint.bean.StratosAdminResponse;
 import org.apache.stratos.rest.endpoint.bean.autoscaler.partition.Partition;
 import org.apache.stratos.rest.endpoint.bean.autoscaler.partition.PartitionGroup;
 import org.apache.stratos.rest.endpoint.bean.autoscaler.policy.autoscale.AutoscalePolicy;
@@ -63,7 +64,6 @@ import org.apache.stratos.rest.endpoint.bean.util.converter.PojoConverter;
 import org.apache.stratos.rest.endpoint.exception.RestAPIException;
 
 import javax.ws.rs.core.Response;
-
 import java.rmi.RemoteException;
 import java.util.*;
 import java.util.regex.Pattern;
@@ -78,41 +78,41 @@ public class ServiceUtils {
     private static CartridgeSubscriptionManager cartridgeSubsciptionManager = new CartridgeSubscriptionManager();
     private static ServiceDeploymentManager serviceDeploymentManager = new ServiceDeploymentManager();
 
-    static StratosAdminResponse deployCartridge (CartridgeDefinitionBean cartridgeDefinitionBean, ConfigurationContext ctxt,
-        String userName, String tenantDomain) throws RestAPIException {
+    static StratosAdminResponse deployCartridge(CartridgeDefinitionBean cartridgeDefinitionBean, ConfigurationContext ctxt,
+                                                String userName, String tenantDomain) throws RestAPIException {
 
-        log.info("Starting to deploy a Cartridge [type] "+cartridgeDefinitionBean.type);
+        log.info("Starting to deploy a Cartridge [type] " + cartridgeDefinitionBean.type);
 
         CloudControllerServiceClient cloudControllerServiceClient = getCloudControllerServiceClient();
-        
+
         if (cloudControllerServiceClient != null) {
 
             CartridgeConfig cartridgeConfig = PojoConverter.populateCartridgeConfigPojo(cartridgeDefinitionBean);
 
-            if(cartridgeConfig == null) {
+            if (cartridgeConfig == null) {
                 throw new RestAPIException("Populated CartridgeConfig instance is null, cartridge deployment aborted");
             }
 
-                
-			// call CC
-			try {
-				cloudControllerServiceClient
-						.deployCartridgeDefinition(cartridgeConfig);
-			} catch (RemoteException e) {
-				log.error(e.getMessage(), e);
-				throw new RestAPIException(e.getMessage(), e);
-			} catch (CloudControllerServiceInvalidCartridgeDefinitionExceptionException e) {
-				String message = e.getFaultMessage().getInvalidCartridgeDefinitionException().getMessage();
-				log.error(message, e);
-				throw new RestAPIException(message, e);
-			} catch (CloudControllerServiceInvalidIaasProviderExceptionException e) {
-				String message = e.getFaultMessage().getInvalidIaasProviderException().getMessage();
-				log.error(message, e);
-				throw new RestAPIException(message, e);
-			}
-                
-            log.info("Successfully deployed Cartridge [type] "+cartridgeDefinitionBean.type);
-                
+
+            // call CC
+            try {
+                cloudControllerServiceClient
+                        .deployCartridgeDefinition(cartridgeConfig);
+            } catch (RemoteException e) {
+                log.error(e.getMessage(), e);
+                throw new RestAPIException(e.getMessage(), e);
+            } catch (CloudControllerServiceInvalidCartridgeDefinitionExceptionException e) {
+                String message = e.getFaultMessage().getInvalidCartridgeDefinitionException().getMessage();
+                log.error(message, e);
+                throw new RestAPIException(message, e);
+            } catch (CloudControllerServiceInvalidIaasProviderExceptionException e) {
+                String message = e.getFaultMessage().getInvalidIaasProviderException().getMessage();
+                log.error(message, e);
+                throw new RestAPIException(message, e);
+            }
+
+            log.info("Successfully deployed Cartridge [type] " + cartridgeDefinitionBean.type);
+
         }
 
         StratosAdminResponse stratosAdminResponse = new StratosAdminResponse();
@@ -122,38 +122,38 @@ public class ServiceUtils {
 
     @SuppressWarnings("unused")
     private static DeploymentPolicy[] intersection(
-        DeploymentPolicy[] cartridgeDepPolicies,
-        DeploymentPolicy[] lbCartridgeDepPolicies) {
-        
-        List<DeploymentPolicy> commonPolicies = 
+            DeploymentPolicy[] cartridgeDepPolicies,
+            DeploymentPolicy[] lbCartridgeDepPolicies) {
+
+        List<DeploymentPolicy> commonPolicies =
                 new ArrayList<DeploymentPolicy>();
-        for (DeploymentPolicy policy1 
+        for (DeploymentPolicy policy1
                 : cartridgeDepPolicies) {
-            for (DeploymentPolicy policy2 
+            for (DeploymentPolicy policy2
                     : lbCartridgeDepPolicies) {
-                if(policy1.equals(policy2)) {
+                if (policy1.equals(policy2)) {
                     commonPolicies.add(policy1);
                 }
             }
-            
+
         }
         return commonPolicies.toArray(new DeploymentPolicy[0]);
     }
-    
+
     static StratosAdminResponse undeployCartridge(String cartridgeType) throws RestAPIException {
 
         CloudControllerServiceClient cloudControllerServiceClient = getCloudControllerServiceClient();
         if (cloudControllerServiceClient != null) {
-                try {
-					cloudControllerServiceClient.unDeployCartridgeDefinition(cartridgeType);
-				} catch (RemoteException e) {
-					log.error(e.getMessage(), e);
-					throw new RestAPIException(e.getMessage(), e);
-				} catch (CloudControllerServiceInvalidCartridgeTypeExceptionException e) {
-					String msg = e.getFaultMessage().getInvalidCartridgeTypeException().getMessage();
-					log.error(msg, e);
-					throw new RestAPIException(msg, e);
-				}
+            try {
+                cloudControllerServiceClient.unDeployCartridgeDefinition(cartridgeType);
+            } catch (RemoteException e) {
+                log.error(e.getMessage(), e);
+                throw new RestAPIException(e.getMessage(), e);
+            } catch (CloudControllerServiceInvalidCartridgeTypeExceptionException e) {
+                String msg = e.getFaultMessage().getInvalidCartridgeTypeException().getMessage();
+                log.error(msg, e);
+                throw new RestAPIException(msg, e);
+            }
 
         }
 
@@ -173,16 +173,16 @@ public class ServiceUtils {
             org.apache.stratos.cloud.controller.stub.deployment.partition.Partition partition =
                     PojoConverter.convertToCCPartitionPojo(partitionBean);
 
-			try {
-				autoscalerServiceClient.deployPartition(partition);
-			} catch (RemoteException e) {
-				log.error(e.getMessage(), e);
-				throw new RestAPIException(e.getMessage(), e);
-			} catch (AutoScalerServiceInvalidPartitionExceptionException e) {
-				String message = e.getFaultMessage().getInvalidPartitionException().getMessage();
-				log.error(message, e);
-				throw new RestAPIException(message, e);
-			}
+            try {
+                autoscalerServiceClient.deployPartition(partition);
+            } catch (RemoteException e) {
+                log.error(e.getMessage(), e);
+                throw new RestAPIException(e.getMessage(), e);
+            } catch (AutoScalerServiceInvalidPartitionExceptionException e) {
+                String message = e.getFaultMessage().getInvalidPartitionException().getMessage();
+                log.error(message, e);
+                throw new RestAPIException(message, e);
+            }
 
         }
 
@@ -201,18 +201,18 @@ public class ServiceUtils {
             org.apache.stratos.autoscaler.policy.model.AutoscalePolicy autoscalePolicy = PojoConverter.
                     convertToCCAutoscalerPojo(autoscalePolicyBean);
 
-			try {
-				autoscalerServiceClient
-						.deployAutoscalingPolicy(autoscalePolicy);
-			} catch (RemoteException e) {
-				log.error(e.getMessage(), e);
-				throw new RestAPIException(e.getMessage(), e);
-			} catch (AutoScalerServiceInvalidPolicyExceptionException e) {
-				String message = e.getFaultMessage()
-						.getInvalidPolicyException().getMessage();
-				log.error(message, e);
-				throw new RestAPIException(message, e);
-			}
+            try {
+                autoscalerServiceClient
+                        .deployAutoscalingPolicy(autoscalePolicy);
+            } catch (RemoteException e) {
+                log.error(e.getMessage(), e);
+                throw new RestAPIException(e.getMessage(), e);
+            } catch (AutoScalerServiceInvalidPolicyExceptionException e) {
+                String message = e.getFaultMessage()
+                        .getInvalidPolicyException().getMessage();
+                log.error(message, e);
+                throw new RestAPIException(message, e);
+            }
 
         }
 
@@ -223,7 +223,7 @@ public class ServiceUtils {
 
     public static StratosAdminResponse deployDeploymentPolicy(
             org.apache.stratos.rest.endpoint.bean.autoscaler.policy.deployment.DeploymentPolicy deploymentPolicyBean)
-                throws RestAPIException {
+            throws RestAPIException {
 
         //log.info("***** " + cartridgeDefinitionBean.toString() + " *****");
 
@@ -233,17 +233,17 @@ public class ServiceUtils {
             org.apache.stratos.autoscaler.deployment.policy.DeploymentPolicy deploymentPolicy =
                     PojoConverter.convetToCCDeploymentPolicyPojo(deploymentPolicyBean);
 
-			try {
-				autoscalerServiceClient
-						.deployDeploymentPolicy(deploymentPolicy);
-			} catch (RemoteException e) {
-				log.error(e.getMessage(), e);
-				throw new RestAPIException(e.getMessage(), e);
-			} catch (AutoScalerServiceInvalidPolicyExceptionException e) {
-				String message = e.getFaultMessage().getInvalidPolicyException().getMessage();
-				log.error(message, e);
-				throw new RestAPIException(message, e);
-			}
+            try {
+                autoscalerServiceClient
+                        .deployDeploymentPolicy(deploymentPolicy);
+            } catch (RemoteException e) {
+                log.error(e.getMessage(), e);
+                throw new RestAPIException(e.getMessage(), e);
+            } catch (AutoScalerServiceInvalidPolicyExceptionException e) {
+                String message = e.getFaultMessage().getInvalidPolicyException().getMessage();
+                log.error(message, e);
+                throw new RestAPIException(message, e);
+            }
 
         }
 
@@ -252,20 +252,20 @@ public class ServiceUtils {
         return stratosAdminResponse;
     }
 
-    private static CloudControllerServiceClient getCloudControllerServiceClient () throws RestAPIException {
+    private static CloudControllerServiceClient getCloudControllerServiceClient() throws RestAPIException {
 
         try {
             return CloudControllerServiceClient.getServiceClient();
 
         } catch (AxisFault axisFault) {
             String errorMsg = "Error while getting CloudControllerServiceClient instance to connect to the "
-            		+ "Cloud Controller. Cause: "+axisFault.getMessage();
+                    + "Cloud Controller. Cause: " + axisFault.getMessage();
             log.error(errorMsg, axisFault);
             throw new RestAPIException(errorMsg, axisFault);
         }
     }
 
-    public static Partition[] getAvailablePartitions () throws RestAPIException {
+    public static Partition[] getAvailablePartitions() throws RestAPIException {
 
         org.apache.stratos.cloud.controller.stub.deployment.partition.Partition[] partitions = null;
         AutoscalerServiceClient autoscalerServiceClient = getAutoscalerServiceClient();
@@ -283,19 +283,19 @@ public class ServiceUtils {
         return PojoConverter.populatePartitionPojos(partitions);
     }
 
-    public static Partition[] getPartitionsOfDeploymentPolicy(String deploymentPolicyId) 
-                throws RestAPIException {
+    public static Partition[] getPartitionsOfDeploymentPolicy(String deploymentPolicyId)
+            throws RestAPIException {
 
         org.apache.stratos.cloud.controller.stub.deployment.partition.Partition[] partitions = null;
         AutoscalerServiceClient autoscalerServiceClient = getAutoscalerServiceClient();
         if (autoscalerServiceClient != null) {
             try {
                 partitions =
-                             autoscalerServiceClient.getPartitionsOfDeploymentPolicy(deploymentPolicyId);
+                        autoscalerServiceClient.getPartitionsOfDeploymentPolicy(deploymentPolicyId);
 
             } catch (RemoteException e) {
                 String errorMsg = "Error while getting available partitions for deployment policy id " +
-                		deploymentPolicyId+". Cause: "+e.getMessage();
+                        deploymentPolicyId + ". Cause: " + e.getMessage();
                 log.error(errorMsg, e);
                 throw new RestAPIException(errorMsg, e);
             }
@@ -303,20 +303,20 @@ public class ServiceUtils {
 
         return PojoConverter.populatePartitionPojos(partitions);
     }
-    
+
     public static Partition[]
-        getPartitionsOfGroup(String deploymentPolicyId, String groupId) throws RestAPIException {
+    getPartitionsOfGroup(String deploymentPolicyId, String groupId) throws RestAPIException {
 
         org.apache.stratos.cloud.controller.stub.deployment.partition.Partition[] partitions = null;
         AutoscalerServiceClient autoscalerServiceClient = getAutoscalerServiceClient();
         if (autoscalerServiceClient != null) {
             try {
                 partitions =
-                             autoscalerServiceClient.getPartitionsOfGroup(deploymentPolicyId, groupId);
+                        autoscalerServiceClient.getPartitionsOfGroup(deploymentPolicyId, groupId);
 
             } catch (RemoteException e) {
                 String errorMsg = "Error while getting available partitions for deployment policy id " + deploymentPolicyId +
-                        ", group id " + groupId+". Cause: "+e.getMessage();
+                        ", group id " + groupId + ". Cause: " + e.getMessage();
                 log.error(errorMsg, e);
                 throw new RestAPIException(errorMsg, e);
             }
@@ -325,7 +325,7 @@ public class ServiceUtils {
         return PojoConverter.populatePartitionPojos(partitions);
     }
 
-    public static Partition getPartition (String partitionId) throws RestAPIException {
+    public static Partition getPartition(String partitionId) throws RestAPIException {
 
         org.apache.stratos.cloud.controller.stub.deployment.partition.Partition partition = null;
         AutoscalerServiceClient autoscalerServiceClient = getAutoscalerServiceClient();
@@ -334,7 +334,7 @@ public class ServiceUtils {
                 partition = autoscalerServiceClient.getPartition(partitionId);
 
             } catch (RemoteException e) {
-                String errorMsg = "Error while getting partition for id " + partitionId+". Cause: "+e.getMessage();
+                String errorMsg = "Error while getting partition for id " + partitionId + ". Cause: " + e.getMessage();
                 log.error(errorMsg, e);
                 throw new RestAPIException(errorMsg, e);
             }
@@ -343,20 +343,20 @@ public class ServiceUtils {
         return PojoConverter.populatePartitionPojo(partition);
     }
 
-    private static AutoscalerServiceClient getAutoscalerServiceClient () throws RestAPIException {
+    private static AutoscalerServiceClient getAutoscalerServiceClient() throws RestAPIException {
 
         try {
             return AutoscalerServiceClient.getServiceClient();
 
         } catch (AxisFault axisFault) {
             String errorMsg = "Error while getting AutoscalerServiceClient instance to connect to the "
-            		+ "Autoscaler. Cause: "+axisFault.getMessage();
+                    + "Autoscaler. Cause: " + axisFault.getMessage();
             log.error(errorMsg, axisFault);
             throw new RestAPIException(errorMsg, axisFault);
         }
     }
 
-    public static AutoscalePolicy[] getAutoScalePolicies () throws RestAPIException {
+    public static AutoscalePolicy[] getAutoScalePolicies() throws RestAPIException {
 
         org.apache.stratos.autoscaler.policy.model.AutoscalePolicy[] autoscalePolicies = null;
         AutoscalerServiceClient autoscalerServiceClient = getAutoscalerServiceClient();
@@ -373,7 +373,7 @@ public class ServiceUtils {
         return PojoConverter.populateAutoscalePojos(autoscalePolicies);
     }
 
-    public static AutoscalePolicy getAutoScalePolicy (String autoscalePolicyId) throws RestAPIException {
+    public static AutoscalePolicy getAutoScalePolicy(String autoscalePolicyId) throws RestAPIException {
 
         org.apache.stratos.autoscaler.policy.model.AutoscalePolicy autoscalePolicy = null;
         AutoscalerServiceClient autoscalerServiceClient = getAutoscalerServiceClient();
@@ -382,8 +382,8 @@ public class ServiceUtils {
                 autoscalePolicy = autoscalerServiceClient.getAutoScalePolicy(autoscalePolicyId);
 
             } catch (RemoteException e) {
-                String errorMsg = "Error while getting information for autoscaling policy with id " + 
-                		autoscalePolicyId+".  Cause: "+e.getMessage();
+                String errorMsg = "Error while getting information for autoscaling policy with id " +
+                        autoscalePolicyId + ".  Cause: " + e.getMessage();
                 log.error(errorMsg, e);
                 throw new RestAPIException(errorMsg, e);
             }
@@ -392,10 +392,10 @@ public class ServiceUtils {
         return PojoConverter.populateAutoscalePojo(autoscalePolicy);
     }
 
-    public static org.apache.stratos.rest.endpoint.bean.autoscaler.policy.deployment.DeploymentPolicy[] 
-            getDeploymentPolicies () throws RestAPIException {
+    public static org.apache.stratos.rest.endpoint.bean.autoscaler.policy.deployment.DeploymentPolicy[]
+    getDeploymentPolicies() throws RestAPIException {
 
-        DeploymentPolicy [] deploymentPolicies = null;
+        DeploymentPolicy[] deploymentPolicies = null;
         AutoscalerServiceClient autoscalerServiceClient = getAutoscalerServiceClient();
         if (autoscalerServiceClient != null) {
             try {
@@ -406,16 +406,15 @@ public class ServiceUtils {
                 throw new RestAPIException(errorMsg, e);
             }
         }
-        
 
 
         return PojoConverter.populateDeploymentPolicyPojos(deploymentPolicies);
     }
 
-    public static org.apache.stratos.rest.endpoint.bean.autoscaler.policy.deployment.DeploymentPolicy[] 
-            getDeploymentPolicies (String cartridgeType) throws RestAPIException {
+    public static org.apache.stratos.rest.endpoint.bean.autoscaler.policy.deployment.DeploymentPolicy[]
+    getDeploymentPolicies(String cartridgeType) throws RestAPIException {
 
-        DeploymentPolicy [] deploymentPolicies = null;
+        DeploymentPolicy[] deploymentPolicies = null;
         AutoscalerServiceClient autoscalerServiceClient = getAutoscalerServiceClient();
         if (autoscalerServiceClient != null) {
             try {
@@ -423,14 +422,15 @@ public class ServiceUtils {
 
             } catch (RemoteException e) {
                 String errorMsg = "Error while getting available deployment policies for cartridge type " +
-                		cartridgeType+". Cause: "+e.getMessage();;
+                        cartridgeType + ". Cause: " + e.getMessage();
+                ;
                 log.error(errorMsg, e);
                 throw new RestAPIException(errorMsg, e);
             }
         }
-        
-        if(deploymentPolicies.length == 0) {
-        	String errorMsg = "Cannot find any matching deployment policy for Cartridge [type] "+cartridgeType;
+
+        if (deploymentPolicies.length == 0) {
+            String errorMsg = "Cannot find any matching deployment policy for Cartridge [type] " + cartridgeType;
             log.error(errorMsg);
             throw new RestAPIException(errorMsg);
         }
@@ -438,7 +438,7 @@ public class ServiceUtils {
         return PojoConverter.populateDeploymentPolicyPojos(deploymentPolicies);
     }
 
-    public static org.apache.stratos.rest.endpoint.bean.autoscaler.policy.deployment.DeploymentPolicy 
+    public static org.apache.stratos.rest.endpoint.bean.autoscaler.policy.deployment.DeploymentPolicy
     getDeploymentPolicy(String deploymentPolicyId) throws RestAPIException {
 
         DeploymentPolicy deploymentPolicy = null;
@@ -448,15 +448,15 @@ public class ServiceUtils {
                 deploymentPolicy = autoscalerServiceClient.getDeploymentPolicy(deploymentPolicyId);
 
             } catch (RemoteException e) {
-                String errorMsg = "Error while getting deployment policy with id " + 
-                		deploymentPolicyId+". Cause: "+e.getMessage();
+                String errorMsg = "Error while getting deployment policy with id " +
+                        deploymentPolicyId + ". Cause: " + e.getMessage();
                 log.error(errorMsg, e);
                 throw new RestAPIException(errorMsg, e);
             }
         }
-        
-        if(deploymentPolicy == null) {
-        	String errorMsg = "Cannot find a matching deployment policy for [id] "+deploymentPolicyId;
+
+        if (deploymentPolicy == null) {
+            String errorMsg = "Cannot find a matching deployment policy for [id] " + deploymentPolicyId;
             log.error(errorMsg);
             throw new RestAPIException(errorMsg);
         }
@@ -464,18 +464,18 @@ public class ServiceUtils {
         return PojoConverter.populateDeploymentPolicyPojo(deploymentPolicy);
     }
 
-    public static PartitionGroup[] getPartitionGroups (String deploymentPolicyId)
-            throws RestAPIException{
+    public static PartitionGroup[] getPartitionGroups(String deploymentPolicyId)
+            throws RestAPIException {
 
-        org.apache.stratos.autoscaler.partition.PartitionGroup [] partitionGroups = null;
+        org.apache.stratos.autoscaler.partition.PartitionGroup[] partitionGroups = null;
         AutoscalerServiceClient autoscalerServiceClient = getAutoscalerServiceClient();
         if (autoscalerServiceClient != null) {
             try {
                 partitionGroups = autoscalerServiceClient.getPartitionGroups(deploymentPolicyId);
 
             } catch (RemoteException e) {
-                String errorMsg = "Error getting available partition groups for deployment policy id " 
-                		+ deploymentPolicyId+". Cause: "+e.getMessage();
+                String errorMsg = "Error getting available partition groups for deployment policy id "
+                        + deploymentPolicyId + ". Cause: " + e.getMessage();
                 log.error(errorMsg, e);
                 throw new RestAPIException(errorMsg, e);
             }
@@ -486,34 +486,34 @@ public class ServiceUtils {
 
     static Cartridge getAvailableCartridgeInfo(String cartridgeType, Boolean multiTenant, ConfigurationContext configurationContext) throws RestAPIException {
         List<Cartridge> cartridges = getAvailableCartridges(null, multiTenant, configurationContext);
-        for(Cartridge cartridge : cartridges) {
-            if(cartridge.getCartridgeType().equals(cartridgeType)) {
+        for (Cartridge cartridge : cartridges) {
+            if (cartridge.getCartridgeType().equals(cartridgeType)) {
                 return cartridge;
             }
         }
         String msg = "Unavailable cartridge type: " + cartridgeType;
         log.error(msg);
-        throw new RestAPIException(msg) ;
+        throw new RestAPIException(msg);
     }
 
-	static List<Cartridge> getAvailableLbCartridges(Boolean multiTenant,
-			ConfigurationContext configurationContext) throws RestAPIException {
-		List<Cartridge> cartridges = getAvailableCartridges(null, multiTenant,
-				configurationContext);
-		List<Cartridge> lbCartridges = new ArrayList<Cartridge>();
-		for (Cartridge cartridge : cartridges) {
-			if (cartridge.isLoadBalancer()) {
-				lbCartridges.add(cartridge);
-			}
-		}
-		
+    static List<Cartridge> getAvailableLbCartridges(Boolean multiTenant,
+                                                    ConfigurationContext configurationContext) throws RestAPIException {
+        List<Cartridge> cartridges = getAvailableCartridges(null, multiTenant,
+                configurationContext);
+        List<Cartridge> lbCartridges = new ArrayList<Cartridge>();
+        for (Cartridge cartridge : cartridges) {
+            if (cartridge.isLoadBalancer()) {
+                lbCartridges.add(cartridge);
+            }
+        }
+
 		/*if(lbCartridges == null || lbCartridges.isEmpty()) {
 			String msg = "Load balancer Cartridges are not available.";
 	        log.error(msg);
 	        throw new RestAPIException(msg) ;
 		}*/
-		return lbCartridges;
-	}
+        return lbCartridges;
+    }
 
     static List<Cartridge> getAvailableCartridges(String cartridgeSearchString, Boolean multiTenant, ConfigurationContext configurationContext) throws RestAPIException {
         List<Cartridge> cartridges = new ArrayList<Cartridge>();
@@ -575,11 +575,11 @@ public class ServiceUtils {
                     cartridge.setCartridgeAlias("-");
                     cartridge.setPersistence(cartridgeInfo.getPersistence());
 
-                    if(cartridgeInfo.getLbConfig() != null && cartridgeInfo.getProperties() != null) {
-                        for(Property property: cartridgeInfo.getProperties()) {
-                        if(property.getName().equals("load.balancer")) {
-                            cartridge.setLoadBalancer(true);
-                        }
+                    if (cartridgeInfo.getProperties() != null) {
+                        for (Property property : cartridgeInfo.getProperties()) {
+                            if (property.getName().equals("load.balancer")) {
+                                cartridge.setLoadBalancer(true);
+                            }
                         }
                     }
                     //cartridge.setActiveInstances(0);
@@ -605,7 +605,7 @@ public class ServiceUtils {
                 }
             }
         } catch (Exception e) {
-            String msg = "Error while getting available cartridges. Cause: "+e.getMessage();
+            String msg = "Error while getting available cartridges. Cause: " + e.getMessage();
             log.error(msg, e);
             throw new RestAPIException(msg, e);
         }
@@ -620,17 +620,17 @@ public class ServiceUtils {
     }
 
     private static boolean isAlreadySubscribed(String cartridgeType,
-			int tenantId) {
-		
-    	Collection<CartridgeSubscription> subscriptionList = cartridgeSubsciptionManager.isCartridgeSubscribed(tenantId, cartridgeType);
-    	if(subscriptionList == null || subscriptionList.isEmpty()){
-    		return false;	
-    	}else {
-    		return true;
-    	}		
-	}
-
-    public static List<ServiceDefinitionBean> getdeployedServiceInformation () throws RestAPIException {
+                                               int tenantId) {
+
+        Collection<CartridgeSubscription> subscriptionList = cartridgeSubsciptionManager.isCartridgeSubscribed(tenantId, cartridgeType);
+        if (subscriptionList == null || subscriptionList.isEmpty()) {
+            return false;
+        } else {
+            return true;
+        }
+    }
+
+    public static List<ServiceDefinitionBean> getdeployedServiceInformation() throws RestAPIException {
 
         Collection<Service> services = null;
 
@@ -638,7 +638,7 @@ public class ServiceUtils {
             services = serviceDeploymentManager.getServices();
 
         } catch (ADCException e) {
-            String msg = "Unable to get deployed service information. Cause: "+e.getMessage();
+            String msg = "Unable to get deployed service information. Cause: " + e.getMessage();
             log.error(msg, e);
             throw new RestAPIException(msg, e);
         }
@@ -650,7 +650,7 @@ public class ServiceUtils {
         return null;
     }
 
-    public static ServiceDefinitionBean getDeployedServiceInformation (String type) throws RestAPIException {
+    public static ServiceDefinitionBean getDeployedServiceInformation(String type) throws RestAPIException {
 
         Service service = null;
 
@@ -658,7 +658,7 @@ public class ServiceUtils {
             service = serviceDeploymentManager.getService(type);
 
         } catch (ADCException e) {
-            String msg = "Unable to get deployed service information for [type]: " + type+". Cause: "+e.getMessage();
+            String msg = "Unable to get deployed service information for [type]: " + type + ". Cause: " + e.getMessage();
             log.error(msg, e);
             throw new RestAPIException(msg, e);
         }
@@ -670,7 +670,7 @@ public class ServiceUtils {
         return new ServiceDefinitionBean();
     }
 
-    public static List<Cartridge> getActiveDeployedServiceInformation (ConfigurationContext configurationContext) throws RestAPIException {
+    public static List<Cartridge> getActiveDeployedServiceInformation(ConfigurationContext configurationContext) throws RestAPIException {
 
         Collection<Service> services = null;
 
@@ -678,7 +678,7 @@ public class ServiceUtils {
             services = serviceDeploymentManager.getServices();
 
         } catch (ADCException e) {
-            String msg = "Unable to get deployed service information. Cause: "+e.getMessage();
+            String msg = "Unable to get deployed service information. Cause: " + e.getMessage();
             log.error(msg, e);
             throw new RestAPIException(msg, e);
         }
@@ -686,21 +686,21 @@ public class ServiceUtils {
         List<Cartridge> availableMultitenantCartridges = new ArrayList<Cartridge>();
         int tenantId = ApplicationManagementUtil.getTenantId(configurationContext);
         //getting the services for the tenantId
-        for(Service service : services) {
+        for (Service service : services) {
             String tenantRange = service.getTenantRange();
-            if(tenantRange.equals(Constants.TENANT_RANGE_ALL)) {
+            if (tenantRange.equals(Constants.TENANT_RANGE_ALL)) {
                 //check whether any active instances found for this service in the Topology
 
                 Cluster cluster = TopologyManager.getTopology().getService(service.getType()).
-                                        getCluster(service.getClusterId());
+                        getCluster(service.getClusterId());
                 boolean activeMemberFound = false;
-                for(Member member : cluster.getMembers()) {
-                    if(member.isActive()) {
+                for (Member member : cluster.getMembers()) {
+                    if (member.isActive()) {
                         activeMemberFound = true;
                         break;
                     }
                 }
-                if(activeMemberFound) {
+                if (activeMemberFound) {
                     availableMultitenantCartridges.add(getAvailableCartridgeInfo(null, true, configurationContext));
                 }
             } else {
@@ -717,7 +717,7 @@ public class ServiceUtils {
         return availableMultitenantCartridges;
     }
 
-	static List<Cartridge> getSubscriptions (String cartridgeSearchString, ConfigurationContext configurationContext) throws RestAPIException {
+    static List<Cartridge> getSubscriptions(String cartridgeSearchString, ConfigurationContext configurationContext) throws RestAPIException {
 
         List<Cartridge> cartridges = new ArrayList<Cartridge>();
 
@@ -734,32 +734,32 @@ public class ServiceUtils {
             if (subscriptions != null && !subscriptions.isEmpty()) {
 
                 for (CartridgeSubscription subscription : subscriptions) {
-                	
+
                     if (!cartridgeMatches(subscription.getCartridgeInfo(), subscription, searchPattern)) {
                         continue;
                     }
                     Cartridge cartridge = getCartridgeFromSubscription(subscription);
                     if (cartridge == null) {
-                		continue;
-                	}
+                        continue;
+                    }
                     Cluster cluster = TopologyClusterInformationModel.getInstance().getCluster(ApplicationManagementUtil.getTenantId(configurationContext)
-                            ,cartridge.getCartridgeType(), cartridge.getCartridgeAlias());
+                            , cartridge.getCartridgeType(), cartridge.getCartridgeAlias());
                     String cartridgeStatus = "Inactive";
                     int activeMemberCount = 0;
-					if (cluster != null) {
-						Collection<Member> members = cluster.getMembers();
-						for (Member member : members) {
-							if (member.isActive()) {
-								cartridgeStatus = "Active";
-								activeMemberCount++;
-							}
-						}
-					}
+                    if (cluster != null) {
+                        Collection<Member> members = cluster.getMembers();
+                        for (Member member : members) {
+                            if (member.isActive()) {
+                                cartridgeStatus = "Active";
+                                activeMemberCount++;
+                            }
+                        }
+                    }
                     cartridge.setActiveInstances(activeMemberCount);
-					cartridge.setStatus(cartridgeStatus);
+                    cartridge.setStatus(cartridgeStatus);
 
                     // Ignoring the LB cartridges since they are not shown to the user.
-                    if(cartridge.isLoadBalancer())
+                    if (cartridge.isLoadBalancer())
                         continue;
                     cartridges.add(cartridge);
                 }
@@ -769,7 +769,7 @@ public class ServiceUtils {
                 }
             }
         } catch (Exception e) {
-            String msg = "Error while getting subscribed cartridges. Cause: "+e.getMessage();
+            String msg = "Error while getting subscribed cartridges. Cause: " + e.getMessage();
             log.error(msg, e);
             throw new RestAPIException(msg, e);
         }
@@ -789,28 +789,28 @@ public class ServiceUtils {
         return cartridges;
     }
 
-    
+
     static Cartridge getSubscription(String cartridgeAlias, ConfigurationContext configurationContext) throws RestAPIException {
-    	
-    	Cartridge cartridge =  getCartridgeFromSubscription(cartridgeSubsciptionManager.getCartridgeSubscription(ApplicationManagementUtil.
-                    getTenantId(configurationContext), cartridgeAlias));
-    	
-    	if (cartridge == null) {
-    		String message = "Unregistered [alias]: "+cartridgeAlias+"! Please enter a valid alias.";
-    		log.error(message);
-			throw new RestAPIException(Response.Status.NOT_FOUND, message);
-    	}
+
+        Cartridge cartridge = getCartridgeFromSubscription(cartridgeSubsciptionManager.getCartridgeSubscription(ApplicationManagementUtil.
+                getTenantId(configurationContext), cartridgeAlias));
+
+        if (cartridge == null) {
+            String message = "Unregistered [alias]: " + cartridgeAlias + "! Please enter a valid alias.";
+            log.error(message);
+            throw new RestAPIException(Response.Status.NOT_FOUND, message);
+        }
         Cluster cluster = TopologyClusterInformationModel.getInstance().getCluster(ApplicationManagementUtil.getTenantId(configurationContext)
-                ,cartridge.getCartridgeType(), cartridge.getCartridgeAlias());
+                , cartridge.getCartridgeType(), cartridge.getCartridgeAlias());
         String cartridgeStatus = "Inactive";
         int activeMemberCount = 0;
 
         // cluster might not be created yet, so need to check
         if (cluster != null) {
             Collection<Member> members = cluster.getMembers();
-            if (members != null ) {
+            if (members != null) {
                 for (Member member : members) {
-                    if(member.isActive()) {
+                    if (member.isActive()) {
                         cartridgeStatus = "Active";
                         activeMemberCount++;
                     }
@@ -819,90 +819,90 @@ public class ServiceUtils {
         }
 
         cartridge.setActiveInstances(activeMemberCount);
-		cartridge.setStatus(cartridgeStatus);
-		return cartridge;
-    	
+        cartridge.setStatus(cartridgeStatus);
+        return cartridge;
+
     }
 
     static int getActiveInstances(String cartridgeType, String cartridgeAlias, ConfigurationContext configurationContext) throws RestAPIException {
-    	int noOfActiveInstances = 0;
+        int noOfActiveInstances = 0;
         Cluster cluster = TopologyClusterInformationModel.getInstance().getCluster(ApplicationManagementUtil.getTenantId(configurationContext)
-                ,cartridgeType , cartridgeAlias);
-        
-        if(cluster == null) {
-        	String message = "No Cluster found for cartridge [type] "+cartridgeType+", [alias] "+cartridgeAlias;
-			log.error(message);
-			throw new RestAPIException(message);
+                , cartridgeType, cartridgeAlias);
+
+        if (cluster == null) {
+            String message = "No Cluster found for cartridge [type] " + cartridgeType + ", [alias] " + cartridgeAlias;
+            log.error(message);
+            throw new RestAPIException(message);
         }
-        
-        for(Member member : cluster.getMembers()) {
-            if(member.getStatus().toString().equals(MemberStatus.Activated)) {
-                noOfActiveInstances ++;
+
+        for (Member member : cluster.getMembers()) {
+            if (member.getStatus().toString().equals(MemberStatus.Activated)) {
+                noOfActiveInstances++;
             }
         }
-		return noOfActiveInstances;
+        return noOfActiveInstances;
     }
-    
-	private static Cartridge getCartridgeFromSubscription(CartridgeSubscription subscription) throws RestAPIException {
-
-		if (subscription == null) {
-			return null;
-		}
-		try {
-			Cartridge cartridge = new Cartridge();
-			cartridge.setCartridgeType(subscription.getCartridgeInfo()
-					.getType());
-			cartridge.setMultiTenant(subscription.getCartridgeInfo()
-					.getMultiTenant());
-			cartridge
-					.setProvider(subscription.getCartridgeInfo().getProvider());
-			cartridge.setVersion(subscription.getCartridgeInfo().getVersion());
-			cartridge.setDescription(subscription.getCartridgeInfo()
-					.getDescription());
-			cartridge.setDisplayName(subscription.getCartridgeInfo()
-					.getDisplayName());
-			cartridge.setCartridgeAlias(subscription.getAlias());
-			cartridge.setHostName(subscription.getHostName());
-			cartridge.setMappedDomain(subscription.getMappedDomain());
-			if (subscription.getRepository() != null) {
-				cartridge.setRepoURL(subscription.getRepository().getUrl());
-			}
-
-			if (subscription instanceof DataCartridgeSubscription) {
-				DataCartridgeSubscription dataCartridgeSubscription = (DataCartridgeSubscription) subscription;
-				cartridge.setDbHost(dataCartridgeSubscription.getDBHost());
-				cartridge.setDbUserName(dataCartridgeSubscription
-						.getDBUsername());
-				cartridge
-						.setPassword(dataCartridgeSubscription.getDBPassword());
-			}
-
-			if (subscription.getLbClusterId() != null
-					&& !subscription.getLbClusterId().isEmpty()) {
-				cartridge.setLbClusterId(subscription.getLbClusterId());
-			}
-
-			cartridge.setStatus(subscription.getSubscriptionStatus());
-			cartridge.setPortMappings(subscription.getCartridgeInfo()
-					.getPortMappings());
-
-            if(subscription.getCartridgeInfo().getLbConfig() != null && subscription.getCartridgeInfo().getProperties() != null) {
-                for(Property property: subscription.getCartridgeInfo().getProperties()) {
-                    if(property.getName().equals("load.balancer")) {
+
+    private static Cartridge getCartridgeFromSubscription(CartridgeSubscription subscription) throws RestAPIException {
+
+        if (subscription == null) {
+            return null;
+        }
+        try {
+            Cartridge cartridge = new Cartridge();
+            cartridge.setCartridgeType(subscription.getCartridgeInfo()
+                    .getType());
+            cartridge.setMultiTenant(subscription.getCartridgeInfo()
+                    .getMultiTenant());
+            cartridge
+                    .setProvider(subscription.getCartridgeInfo().getProvider());
+            cartridge.setVersion(subscription.getCartridgeInfo().getVersion());
+            cartridge.setDescription(subscription.getCartridgeInfo()
+                    .getDescription());
+            cartridge.setDisplayName(subscription.getCartridgeInfo()
+                    .getDisplayName());
+            cartridge.setCartridgeAlias(subscription.getAlias());
+            cartridge.setHostName(subscription.getHostName());
+            cartridge.setMappedDomain(subscription.getMappedDomain());
+            if (subscription.getRepository() != null) {
+                cartridge.setRepoURL(subscription.getRepository().getUrl());
+            }
+
+            if (subscription instanceof DataCartridgeSubscription) {
+                DataCartridgeSubscription dataCartridgeSubscription = (DataCartridgeSubscription) subscription;
+                cartridge.setDbHost(dataCartridgeSubscription.getDBHost());
+                cartridge.setDbUserName(dataCartridgeSubscription
+                        .getDBUsername());
+                cartridge
+                        .setPassword(dataCartridgeSubscription.getDBPassword());
+            }
+
+            if (subscription.getLbClusterId() != null
+                    && !subscription.getLbClusterId().isEmpty()) {
+                cartridge.setLbClusterId(subscription.getLbClusterId());
+            }
+
+            cartridge.setStatus(subscription.getSubscriptionStatus());
+            cartridge.setPortMappings(subscription.getCartridgeInfo()
+                    .getPortMappings());
+
+            if (subscription.getCartridgeInfo().getProperties() != null) {
+                for (Property property : subscription.getCartridgeInfo().getProperties()) {
+                    if (property.getName().equals("load.balancer")) {
                         cartridge.setLoadBalancer(true);
                     }
                 }
             }
-			
-			return cartridge;
-			
-		} catch (Exception e) {
-			String msg = "Unable to extract the Cartridge from subscription. Cause: "+e.getMessage();
-			log.error(msg);
-			throw new RestAPIException(msg);
-		}
-		
-	}
+
+            return cartridge;
+
+        } catch (Exception e) {
+            String msg = "Unable to extract the Cartridge from subscription. Cause: " + e.getMessage();
+            log.error(msg);
+            throw new RestAPIException(msg);
+        }
+
+    }
 
     static Pattern getSearchStringPattern(String searchString) {
         if (log.isDebugEnabled()) {
@@ -955,13 +955,13 @@ public class ServiceUtils {
         }
         return true;
     }
-    
+
     public static CartridgeSubscription getCartridgeSubscription(String alias, ConfigurationContext configurationContext) {
-    	return cartridgeSubsciptionManager.getCartridgeSubscription(ApplicationManagementUtil.getTenantId(configurationContext), alias);
+        return cartridgeSubsciptionManager.getCartridgeSubscription(ApplicationManagementUtil.getTenantId(configurationContext), alias);
     }
 
-    static SubscriptionInfo subscribeToCartridge (CartridgeInfoBean cartridgeInfoBean, ConfigurationContext configurationContext, String tenantUsername,
-                                                  String tenantDomain) throws RestAPIException {
+    static SubscriptionInfo subscribeToCartridge(CartridgeInfoBean cartridgeInfoBean, ConfigurationContext configurationContext, String tenantUsername,
+                                                 String tenantDomain) throws RestAPIException {
 
         try {
             return subscribe(cartridgeInfoBean, configurationContext, tenantUsername, tenantDomain);
@@ -971,15 +971,15 @@ public class ServiceUtils {
         }
     }
 
-    private static SubscriptionInfo subscribe (CartridgeInfoBean cartridgeInfoBean, ConfigurationContext configurationContext, String tenantUsername, String tenantDomain)
-                                       throws ADCException, PolicyException, UnregisteredCartridgeException,
+    private static SubscriptionInfo subscribe(CartridgeInfoBean cartridgeInfoBean, ConfigurationContext configurationContext, String tenantUsername, String tenantDomain)
+            throws ADCException, PolicyException, UnregisteredCartridgeException,
             InvalidCartridgeAliasException, DuplicateCartridgeAliasException, RepositoryRequiredException,
             AlreadySubscribedException, RepositoryCredentialsRequiredException, InvalidRepositoryException,
             RepositoryTransportException, RestAPIException {
 
         SubscriptionData subscriptionData = new SubscriptionData();
         subscriptionData.setCartridgeType(cartridgeInfoBean.getCartridgeType());
-        subscriptionData.setCartridgeAlias(cartridgeInfoBean.getAlias().trim());        
+        subscriptionData.setCartridgeAlias(cartridgeInfoBean.getAlias().trim());
         subscriptionData.setAutoscalingPolicyName(cartridgeInfoBean.getAutoscalePolicy());
         subscriptionData.setDeploymentPolicyName(cartridgeInfoBean.getDeploymentPolicy());
         subscriptionData.setTenantDomain(tenantDomain);
@@ -991,7 +991,7 @@ public class ServiceUtils {
         subscriptionData.setRepositoryPassword(cartridgeInfoBean.getRepoPassword());
         subscriptionData.setCommitsEnabled(cartridgeInfoBean.isCommitsEnabled());
         subscriptionData.setServiceGroup(cartridgeInfoBean.getServiceGroup());
-        
+
         if (cartridgeInfoBean.isPersistanceRequired()) {
             // Add persistence related properties to PersistenceContext
             PersistenceContext persistenceContext = new PersistenceContext();
@@ -1006,24 +1006,24 @@ public class ServiceUtils {
 
     }
 
-    public static org.apache.stratos.rest.endpoint.bean.topology.Cluster getCluster (String cartridgeType, String subscriptionAlias, ConfigurationContext configurationContext) throws RestAPIException {
+    public static org.apache.stratos.rest.endpoint.bean.topology.Cluster getCluster(String cartridgeType, String subscriptionAlias, ConfigurationContext configurationContext) throws RestAPIException {
 
         Cluster cluster = TopologyClusterInformationModel.getInstance().getCluster(ApplicationManagementUtil.getTenantId(configurationContext)
-                ,cartridgeType , subscriptionAlias);
-        if(cluster == null) {
-            throw new RestAPIException("No matching cluster found for [cartridge type]: "+cartridgeType+ " [alias] "+subscriptionAlias);
-        } else{
+                , cartridgeType, subscriptionAlias);
+        if (cluster == null) {
+            throw new RestAPIException("No matching cluster found for [cartridge type]: " + cartridgeType + " [alias] " + subscriptionAlias);
+        } else {
             return PojoConverter.populateClusterPojos(cluster);
         }
     }
 
-    public static org.apache.stratos.rest.endpoint.bean.topology.Cluster[] getClustersForTenant (ConfigurationContext configurationContext) {
+    public static org.apache.stratos.rest.endpoint.bean.topology.Cluster[] getClustersForTenant(ConfigurationContext configurationContext) {
 
         Set<Cluster> clusterSet = TopologyClusterInformationModel.getInstance().getClusters(ApplicationManagementUtil.
                 getTenantId(configurationContext), null);
         ArrayList<org.apache.stratos.rest.endpoint.bean.topology.Cluster> clusters =
                 new ArrayList<org.apache.stratos.rest.endpoint.bean.topology.Cluster>();
-        for(Cluster cluster : clusterSet) {
+        for (Cluster cluster : clusterSet) {
             clusters.add(PojoConverter.populateClusterPojos(cluster));
         }
         org.apache.stratos.rest.endpoint.bean.topology.Cluster[] arrCluster =
@@ -1033,17 +1033,17 @@ public class ServiceUtils {
 
     }
 
-    public static org.apache.stratos.rest.endpoint.bean.topology.Cluster[] getClustersForTenantAndCartridgeType (ConfigurationContext configurationContext,
-                                                                  String cartridgeType) {
+    public static org.apache.stratos.rest.endpoint.bean.topology.Cluster[] getClustersForTenantAndCartridgeType(ConfigurationContext configurationContext,
+                                                                                                                String cartridgeType) {
 
         Set<Cluster> clusterSet = TopologyClusterInformationModel.getInstance().getClusters(ApplicationManagementUtil.
                 getTenantId(configurationContext), cartridgeType);
         List<org.apache.stratos.rest.endpoint.bean.topology.Cluster> clusters =
                 new ArrayList<org.apache.stratos.rest.endpoint.bean.topology.Cluster>();
-        for(Cluster cluster : clusterSet) {
+        for (Cluster cluster : clusterSet) {
             clusters.add(PojoConverter.populateClusterPojos(cluster));
         }
-         org.apache.stratos.rest.endpoint.bean.topology.Cluster[] arrCluster =
+        org.apache.stratos.rest.endpoint.bean.topology.Cluster[] arrCluster =
                 new org.apache.stratos.rest.endpoint.bean.topology.Cluster[clusters.size()];
         arrCluster = clusters.toArray(arrCluster);
         return arrCluster;
@@ -1102,8 +1102,8 @@ public class ServiceUtils {
             cartridgeSubsciptionManager.unsubscribeFromCartridge(tenantDomain, alias);
 
         } catch (ADCException e) {
-        	String msg = "Failed to unsubscribe from [alias] "+alias+". Cause: "+ e.getMessage();
-        	log.error(msg, e);
+            String msg = "Failed to unsubscribe from [alias] " + alias + ". Cause: " + e.getMessage();
+            log.error(msg, e);
             throw new RestAPIException(msg, e);
 
         } catch (NotSubscribedException e) {
@@ -1115,27 +1115,26 @@ public class ServiceUtils {
         stratosAdminResponse.setMessage("Successfully terminated the subscription with alias " + alias);
         return stratosAdminResponse;
     }
-    
+
     /**
-     * 
-     * Super tenant will deploy multitenant service. 
-     * 
+     * Super tenant will deploy multitenant service.
+     * <p/>
      * get domain , subdomain as well..
+     *
      * @param clusterDomain
      * @param clusterSubdomain
-     * 
      */
     static StratosAdminResponse deployService(String cartridgeType, String alias, String autoscalingPolicy, String deploymentPolicy,
                                               String tenantDomain, String tenantUsername, int tenantId, String clusterDomain, String clusterSubdomain, String tenantRange) throws RestAPIException {
-    	log.info("Deploying service..");
-    	try {
-    		serviceDeploymentManager.deployService(cartridgeType, autoscalingPolicy, deploymentPolicy, tenantId, tenantRange, tenantDomain, tenantUsername);
+        log.info("Deploying service..");
+        try {
+            serviceDeploymentManager.deployService(cartridgeType, autoscalingPolicy, deploymentPolicy, tenantId, tenantRange, tenantDomain, tenantUsername);
 
-		} catch (Exception e) {
+        } catch (Exception e) {
             String msg = String.format("Failed to deploy the Service [Cartridge type] %s [alias] %s . Cause: %s", cartridgeType, alias, e.getMessage());
             log.error(msg, e);
             throw new RestAPIException(msg, e);
-		}
+        }
 
         StratosAdminResponse stratosAdminResponse = new StratosAdminResponse();
         stratosAdminResponse.setMessage("Successfully deployed service cluster definition with type " + cartridgeType);
@@ -1148,7 +1147,7 @@ public class ServiceUtils {
             serviceDeploymentManager.undeployService(serviceType);
 
         } catch (Exception e) {
-            String msg = "Failed to undeploy service cluster definition of type " + serviceType+" Cause: "+e.getMessage();
+            String msg = "Failed to undeploy service cluster definition of type " + serviceType + " Cause: " + e.getMessage();
             log.error(msg, e);
             throw new RestAPIException(msg, e);
         }
@@ -1170,7 +1169,7 @@ public class ServiceUtils {
             throw new RestAPIException(msg, e);
         }
     }
-    
+
     static StratosAdminResponse synchronizeRepository(CartridgeSubscription cartridgeSubscription) throws RestAPIException {
         try {
             RepositoryNotification repoNotification = new RepositoryNotification();
@@ -1180,14 +1179,14 @@ public class ServiceUtils {
             log.error(msg, e);
             throw new RestAPIException(msg, e);
         }
-        
+
         StratosAdminResponse stratosAdminResponse = new StratosAdminResponse();
         stratosAdminResponse.setMessage("Successfully sent the repository synchronization request for " + cartridgeSubscription.getAlias());
         return stratosAdminResponse;
     }
 
     public static StratosAdminResponse addSubscriptionDomain(ConfigurationContext configurationContext, String cartridgeType,
-                                                              String subscriptionAlias, String domainName, String applicationAlias) throws RestAPIException {
+                                                             String subscriptionAlias, String domainName, String applicationAlias) throws RestAPIException {
         try {
             int tenantId = ApplicationManagementUtil.getTenantId(configurationContext);
             cartridgeSubsciptionManager.addSubscriptionDomain(tenantId, subscriptionAlias, domainName, applicationAlias);