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

[1/2] git commit: adding the LB type to payload in Subscription and Service Deployment for Load Balancer

Repository: incubator-stratos
Updated Branches:
  refs/heads/master 819701dc9 -> e89b1a6e3


adding the LB type to payload in Subscription and Service Deployment for Load Balancer


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

Branch: refs/heads/master
Commit: dbf8a270fd0d306408b0c36dd2633faba4d157d5
Parents: 3d7c868
Author: Isuru <is...@wso2.com>
Authored: Wed Apr 9 15:50:52 2014 +0530
Committer: Isuru <is...@wso2.com>
Committed: Wed Apr 9 15:50:52 2014 +0530

----------------------------------------------------------------------
 .../stratos/manager/deploy/service/Service.java | 27 +++++++++++++-------
 .../service/ServiceDeploymentManager.java       | 10 ++++++++
 .../service/multitenant/MultiTenantService.java | 16 ------------
 .../multitenant/lb/MultiTenantLBService.java    |  2 --
 .../lb/category/LoadBalancerCategory.java       |  1 -
 .../ServiceLevelLoadBalancerCategory.java       |  3 ++-
 .../manager/CartridgeSubscriptionManager.java   |  4 ++-
 .../manager/utils/CartridgeConstants.java       |  4 +++
 8 files changed, 37 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/dbf8a270/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/Service.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/Service.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/Service.java
index a706380..adfe60f 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/Service.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/Service.java
@@ -24,7 +24,6 @@ import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.cloud.controller.stub.pojo.CartridgeInfo;
 import org.apache.stratos.cloud.controller.stub.pojo.Properties;
 import org.apache.stratos.manager.behaviour.CartridgeMgtBehaviour;
-import org.apache.stratos.manager.client.CloudControllerServiceClient;
 import org.apache.stratos.manager.dao.Cluster;
 import org.apache.stratos.manager.exception.ADCException;
 import org.apache.stratos.manager.exception.NotSubscribedException;
@@ -59,15 +58,9 @@ public abstract class Service extends CartridgeMgtBehaviour {
         this.setCluster(new Cluster());
     }
 
-    public void deploy (Properties properties) throws ADCException, UnregisteredCartridgeException {
+    public void create () throws ADCException {
 
-        //generate the cluster ID (domain)for the service
-        String clusterId = type + "." + cartridgeInfo.getHostName() + ".domain";
-        // limit the cartridge alias to 30 characters in length
-        if (clusterId.length() > 30) {
-            clusterId = CartridgeSubscriptionUtils.limitLengthOfString(clusterId, 30);
-        }
-        setClusterId(clusterId);
+        setClusterId(generateClusterId(null, type));
         //host name is the hostname defined in cartridge definition
         setHostName(cartridgeInfo.getHostName());
 
@@ -75,6 +68,22 @@ public abstract class Service extends CartridgeMgtBehaviour {
         setPayloadData(createPayload(cartridgeInfo, subscriptionKey, null, cluster, null, null, null));
     }
 
+    protected String generateClusterId (String alias, String cartridgeType) {
+
+        String clusterId = cartridgeType + cartridgeInfo.getHostName() + ".domain";
+        // limit the cartridge alias to 30 characters in length
+        if (clusterId.length() > 30) {
+            clusterId = CartridgeSubscriptionUtils.limitLengthOfString(clusterId, 30);
+        }
+
+        return clusterId;
+    }
+
+    public void deploy (Properties properties) throws ADCException, UnregisteredCartridgeException {
+
+        register(getCartridgeInfo(), getCluster(), getPayloadData(), getAutoscalingPolicyName(), getDeploymentPolicyName(), properties);
+    }
+
     public void undeploy () throws ADCException, NotSubscribedException {
 
         remove(cluster.getClusterDomain(), null);

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/dbf8a270/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/ServiceDeploymentManager.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/ServiceDeploymentManager.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/ServiceDeploymentManager.java
index b4ab369..2c3045e 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/ServiceDeploymentManager.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/ServiceDeploymentManager.java
@@ -34,6 +34,7 @@ import org.apache.stratos.manager.lb.category.*;
 import org.apache.stratos.manager.retriever.DataInsertionAndRetrievalManager;
 import org.apache.stratos.manager.subscription.CartridgeSubscription;
 import org.apache.stratos.manager.subscription.utils.CartridgeSubscriptionUtils;
+import org.apache.stratos.manager.utils.CartridgeConstants;
 import org.apache.stratos.messaging.util.Constants;
 
 import java.util.Collection;
@@ -323,6 +324,9 @@ public class ServiceDeploymentManager {
             serviceClusterProperties.setProperties(lbDataCtxt.getLoadBalancedServiceProperties().toArray(new Property[0]));
         }
 
+        // create
+        service.create();
+
         //deploy the service
         service.deploy(serviceClusterProperties);
 
@@ -375,6 +379,12 @@ public class ServiceDeploymentManager {
             lbProperties.setProperties(lbDataCtxt.getLbProperperties().toArray(new Property[0]));
         }
 
+        // create service
+        lbService.create();
+
+        // add LB category to the payload
+        lbService.getPayloadData().add(CartridgeConstants.LB_CATEGORY, lbDataCtxt.getLbCategory());
+
         // delpoy
         lbService.deploy(lbProperties);
 

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/dbf8a270/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/multitenant/MultiTenantService.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/multitenant/MultiTenantService.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/multitenant/MultiTenantService.java
index 00581fc..fb77fe6 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/multitenant/MultiTenantService.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/multitenant/MultiTenantService.java
@@ -22,10 +22,7 @@ package org.apache.stratos.manager.deploy.service.multitenant;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.cloud.controller.stub.pojo.CartridgeInfo;
-import org.apache.stratos.cloud.controller.stub.pojo.Properties;
 import org.apache.stratos.manager.deploy.service.Service;
-import org.apache.stratos.manager.exception.ADCException;
-import org.apache.stratos.manager.exception.UnregisteredCartridgeException;
 
 public class MultiTenantService extends Service {
 
@@ -35,17 +32,4 @@ public class MultiTenantService extends Service {
     		String tenantRange) {
         super(type, autoscalingPolicyName, deploymentPolicyName, tenantId, cartridgeInfo, tenantRange);
     }
-
-    @Override
-    public void deploy(Properties properties) throws ADCException, UnregisteredCartridgeException {
-
-        super.deploy(properties);
-
-        //register the service
-        //ApplicationManagementUtil.registerService(getType(), getClusterId(), CartridgeConstants.DEFAULT_SUBDOMAIN,
-        //        getPayloadData().getCompletePayloadData(), getTenantRange(), getHostName(), getAutoscalingPolicyName(),
-        //        getDeploymentPolicyName(), properties);
-
-        register(getCartridgeInfo(), getCluster(), getPayloadData(), getAutoscalingPolicyName(), getDeploymentPolicyName(), properties);
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/dbf8a270/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/multitenant/lb/MultiTenantLBService.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/multitenant/lb/MultiTenantLBService.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/multitenant/lb/MultiTenantLBService.java
index 7cccb45..5a16fc5 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/multitenant/lb/MultiTenantLBService.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/multitenant/lb/MultiTenantLBService.java
@@ -44,8 +44,6 @@ public class MultiTenantLBService extends Service {
     @Override
     public void deploy(Properties properties) throws ADCException, UnregisteredCartridgeException {
 
-        super.deploy(properties);
-
         //register the service
         loadBalancerCategory.register(getCartridgeInfo(), getCluster(), getPayloadData(), getAutoscalingPolicyName(), getDeploymentPolicyName(),
                 properties);

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/dbf8a270/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lb/category/LoadBalancerCategory.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lb/category/LoadBalancerCategory.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lb/category/LoadBalancerCategory.java
index ef6be1f..3c60907 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lb/category/LoadBalancerCategory.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lb/category/LoadBalancerCategory.java
@@ -112,7 +112,6 @@ public abstract class LoadBalancerCategory extends CartridgeMgtBehaviour {
 		this.isLoadBalancedServiceMultiTenant = isLoadBalancedServiceMultiTenant;
 	}
 
-
     public String getDeploymentPolicyName() {
         return deploymentPolicyName;
     }

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/dbf8a270/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lb/category/ServiceLevelLoadBalancerCategory.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lb/category/ServiceLevelLoadBalancerCategory.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lb/category/ServiceLevelLoadBalancerCategory.java
index 7c4b2ae..e1f888d 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lb/category/ServiceLevelLoadBalancerCategory.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/lb/category/ServiceLevelLoadBalancerCategory.java
@@ -26,6 +26,7 @@ import org.apache.stratos.manager.exception.AlreadySubscribedException;
 import org.apache.stratos.manager.payload.PayloadData;
 import org.apache.stratos.manager.repository.Repository;
 import org.apache.stratos.manager.subscriber.Subscriber;
+import org.apache.stratos.manager.utils.CartridgeConstants;
 
 import java.util.Map;
 
@@ -38,7 +39,7 @@ public class ServiceLevelLoadBalancerCategory extends LoadBalancerCategory {
         // add payload entry for load balanced service type
         PayloadData serviceLevelLbPayloadData = super.create(alias, cluster, subscriber, repository, cartridgeInfo, subscriptionKey,
                 customPayloadEntries);
-        serviceLevelLbPayloadData.add("LOAD_BALANCED_SERVICE_TYPE", getLoadBalancedServiceType());
+        serviceLevelLbPayloadData.add(CartridgeConstants.LOAD_BALANCED_SERVICE_TYPE, getLoadBalancedServiceType());
         return serviceLevelLbPayloadData;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/dbf8a270/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/manager/CartridgeSubscriptionManager.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/manager/CartridgeSubscriptionManager.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/manager/CartridgeSubscriptionManager.java
index a4a8301..742d383 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/manager/CartridgeSubscriptionManager.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/manager/CartridgeSubscriptionManager.java
@@ -248,6 +248,8 @@ public class CartridgeSubscriptionManager {
         cartridgeSubscription.createSubscription(subscriber, lbAlias, lbDataContext.getAutoscalePolicy(),
                 lbDataContext.getDeploymentPolicy(), repository);
 
+        // add LB category to the payload
+        cartridgeSubscription.getPayloadData().add(CartridgeConstants.LB_CATEGORY, lbDataContext.getLbCategory());
 
                 // publishing to bam
              	CartridgeSubscriptionDataPublisher.publish(subscriptionData.getTenantId(),
@@ -312,7 +314,7 @@ public class CartridgeSubscriptionManager {
         //create subscription
         cartridgeSubscription.createSubscription(subscriber, subscriptionData.getCartridgeAlias(), subscriptionData.getAutoscalingPolicyName(),
                                                 subscriptionData.getDeploymentPolicyName(), repository);
-        
+
 		// publishing to bam
 		CartridgeSubscriptionDataPublisher.publish(
 				subscriptionData.getTenantId(),

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/dbf8a270/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/utils/CartridgeConstants.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/utils/CartridgeConstants.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/utils/CartridgeConstants.java
index 1ae3554..6ed5564 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/utils/CartridgeConstants.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/utils/CartridgeConstants.java
@@ -93,6 +93,10 @@ public class CartridgeConstants {
 	public static final String ACTION_COL = "action";
 	public static final String INTERNAL_REPO_BASED_CARTRIDGE_PROVIDER = "internal";
 
+    // payload data related information
+    public static final String LOAD_BALANCED_SERVICE_TYPE = "LOAD_BALANCED_SERVICE_TYPE";
+    public static final String LB_CATEGORY = "LB_CATEGORY";
+
     public static final class DomainMappingInfo {
 		public static final String ACTUAL_HOST = "actual.host";
 		public static final String HOSTINFO = "hostinfo/";


[2/2] git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos

Posted by is...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos


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

Branch: refs/heads/master
Commit: e89b1a6e32018b06a598aea8a15196c2bdf82cee
Parents: dbf8a27 819701d
Author: Isuru <is...@wso2.com>
Authored: Wed Apr 9 15:51:02 2014 +0530
Committer: Isuru <is...@wso2.com>
Committed: Wed Apr 9 15:51:02 2014 +0530

----------------------------------------------------------------------
 .../console/themes/theme1/pages/index.hbs       |   2 +-
 .../console/themes/theme1/pages/plain.hbs       |   2 +-
 .../themes/theme1/ui/js/tenant_management.js    |   5 +-
 products/stratos/conf/registry.xml              | 100 +++++++++++++++++++
 .../modules/distribution/src/assembly/bin.xml   |   3 +-
 5 files changed, 108 insertions(+), 4 deletions(-)
----------------------------------------------------------------------