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/01/10 13:19:31 UTC

git commit: getting cluster id from deployed Service

Updated Branches:
  refs/heads/master 4506c5970 -> dd85cc287


getting cluster id from deployed Service


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

Branch: refs/heads/master
Commit: dd85cc287c91dd3bb46af7043aa3745c6f06ce2c
Parents: 4506c59
Author: Isuru <is...@wso2.com>
Authored: Fri Jan 10 17:49:17 2014 +0530
Committer: Isuru <is...@wso2.com>
Committed: Fri Jan 10 17:49:17 2014 +0530

----------------------------------------------------------------------
 .../SubscriptionMultiTenantBehaviour.java       | 29 +++++++++++++++++---
 1 file changed, 25 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/dd85cc28/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/subscription/tenancy/SubscriptionMultiTenantBehaviour.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/subscription/tenancy/SubscriptionMultiTenantBehaviour.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/subscription/tenancy/SubscriptionMultiTenantBehaviour.java
index b28ff36..1ad7992 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/subscription/tenancy/SubscriptionMultiTenantBehaviour.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/subscription/tenancy/SubscriptionMultiTenantBehaviour.java
@@ -22,10 +22,8 @@ package org.apache.stratos.manager.subscription.tenancy;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.cloud.controller.pojo.Properties;
-import org.apache.stratos.manager.exception.ADCException;
-import org.apache.stratos.manager.exception.AlreadySubscribedException;
-import org.apache.stratos.manager.exception.NotSubscribedException;
-import org.apache.stratos.manager.exception.UnregisteredCartridgeException;
+import org.apache.stratos.manager.deploy.service.Service;
+import org.apache.stratos.manager.exception.*;
 import org.apache.stratos.manager.publisher.InstanceNotificationPublisher;
 import org.apache.stratos.manager.retriever.DataInsertionAndRetrievalManager;
 import org.apache.stratos.manager.subscription.CartridgeSubscription;
@@ -69,6 +67,29 @@ public class SubscriptionMultiTenantBehaviour extends SubscriptionTenancyBehavio
             }
         }
 
+        // get the cluster domain and host name from deployed Service
+        DataInsertionAndRetrievalManager dataInsertionAndRetrievalManager = new DataInsertionAndRetrievalManager();
+
+        Service deployedService;
+        try {
+            deployedService = dataInsertionAndRetrievalManager.getService(cartridgeSubscription.getType());
+
+        } catch (PersistenceManagerException e) {
+            String errorMsg = "Error in checking if Service is available is PersistenceManager";
+            log.error(errorMsg, e);
+            throw new ADCException(errorMsg, e);
+        }
+
+        if (deployedService == null) {
+            String errorMsg = "There is no deployed Service for type " + cartridgeSubscription.getType();
+            log.error(errorMsg);
+            throw new ADCException(errorMsg);
+        }
+
+        //set the cluster and hostname
+        cartridgeSubscription.setClusterDomain(deployedService.getClusterId());
+        cartridgeSubscription.setHostName(deployedService.getHostName());
+
         if (cartridgeSubscription.getRepository() != null) {
 
             // publish the ArtifactUpdated event