Repository: stratos
Updated Branches:
  refs/heads/tenant-isolation fbfd68750 -> ee12ac759


Adding service UUID


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

Branch: refs/heads/tenant-isolation
Commit: ee12ac759a965ee4bd20eec8b97f51402cf8d7d6
Parents: fbfd687
Author: Dinithi <[email protected]>
Authored: Thu Jul 9 22:55:17 2015 +0530
Committer: Dinithi <[email protected]>
Committed: Thu Jul 9 22:55:17 2015 +0530

----------------------------------------------------------------------
 .../parser/DefaultApplicationParser.java             |  4 ++--
 .../applications/topic/ApplicationBuilder.java       |  2 +-
 .../messaging/publisher/TopologyEventPublisher.java  |  2 +-
 .../messaging/topology/TopologyBuilder.java          |  2 +-
 .../domain/application/ClusterDataHolder.java        | 15 ++++++++++++++-
 .../stratos/messaging/domain/topology/Service.java   | 12 +++++++++++-
 .../stratos/messaging/domain/topology/Topology.java  |  6 +++---
 .../event/topology/ServiceCreatedEvent.java          |  8 +++++++-
 .../topology/ServiceCreatedMessageProcessor.java     |  2 +-
 9 files changed, 41 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/ee12ac75/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/parser/DefaultApplicationParser.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/parser/DefaultApplicationParser.java
 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/parser/DefaultApplicationParser.java
index 8a5ca17..5a974ea 100644
--- 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/parser/DefaultApplicationParser.java
+++ 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/parser/DefaultApplicationParser.java
@@ -516,12 +516,12 @@ public class DefaultApplicationParser implements 
ApplicationParser {
 
             String clusterId = clusterInfo.getClusterId(applicationId, 
subscriptionAlias, cartridgeType);
             // add relevant information to the map
-            ClusterDataHolder clusterDataHolderPerType = new 
ClusterDataHolder(cartridgeType, clusterId);
+            ClusterDataHolder clusterDataHolderPerType = new 
ClusterDataHolder(cartridgeType, clusterId, cartridge.getUuid());
             
clusterDataHolderPerType.setMinInstances(cartridgeContext.getCartridgeMin());
             
clusterDataHolderPerType.setMaxInstances(cartridgeContext.getCartridgeMax());
             clusterDataMapByType.put(cartridgeType, clusterDataHolderPerType);
             // add relevant information to the map
-            ClusterDataHolder clusterDataHolder = new 
ClusterDataHolder(cartridgeType, clusterId);
+            ClusterDataHolder clusterDataHolder = new 
ClusterDataHolder(cartridgeType, clusterId, cartridge.getUuid());
             
clusterDataHolder.setMinInstances(cartridgeContext.getCartridgeMin());
             
clusterDataHolder.setMaxInstances(cartridgeContext.getCartridgeMax());
             clusterDataMap.put(subscriptionAlias, clusterDataHolder);

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee12ac75/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/topic/ApplicationBuilder.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/topic/ApplicationBuilder.java
 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/topic/ApplicationBuilder.java
index 1aafd00..5fd58bd 100644
--- 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/topic/ApplicationBuilder.java
+++ 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/topic/ApplicationBuilder.java
@@ -241,7 +241,7 @@ public class ApplicationBuilder {
             Set<ClusterDataHolder> appClusterData = 
application.getClusterDataRecursively();
             for (ClusterDataHolder currClusterData : appClusterData) {
                 ClusterDataHolder newClusterData = new 
ClusterDataHolder(currClusterData.getServiceType(),
-                        currClusterData.getClusterId());
+                        currClusterData.getClusterId(), 
currClusterData.getServiceUuid());
                 appClusterDataToSend.add(newClusterData);
             }
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee12ac75/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/publisher/TopologyEventPublisher.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/publisher/TopologyEventPublisher.java
 
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/publisher/TopologyEventPublisher.java
index 7225a61..3f7b0d7 100644
--- 
a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/publisher/TopologyEventPublisher.java
+++ 
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/publisher/TopologyEventPublisher.java
@@ -54,7 +54,7 @@ public class TopologyEventPublisher {
         for (Cartridge cartridge : cartridgeList) {
             serviceCreatedEvent = new ServiceCreatedEvent(cartridge.getType(),
                     (cartridge.isMultiTenant() ? ServiceType.MultiTenant
-                            : ServiceType.SingleTenant));
+                            : ServiceType.SingleTenant), cartridge.getUuid());
 
             // Add ports to the event
             if (cartridge.getPortMappings() != null) {

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee12ac75/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
 
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
index 6b27009..e74342c 100644
--- 
a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
+++ 
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
@@ -68,7 +68,7 @@ public class TopologyBuilder {
             for (Cartridge cartridge : cartridgeList) {
                 if (!topology.serviceExists(cartridge.getType())) {
                     ServiceType serviceType = cartridge.isMultiTenant() ? 
ServiceType.MultiTenant : ServiceType.SingleTenant;
-                    service = new Service(cartridge.getType(), serviceType);
+                    service = new Service(cartridge.getType(), serviceType, 
cartridge.getUuid());
                     Properties properties = new Properties();
 
                     try {

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee12ac75/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/application/ClusterDataHolder.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/application/ClusterDataHolder.java
 
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/application/ClusterDataHolder.java
index 3deeb6c..1b2ef5a 100644
--- 
a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/application/ClusterDataHolder.java
+++ 
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/application/ClusterDataHolder.java
@@ -30,22 +30,35 @@ public class ClusterDataHolder implements Serializable {
 
     // Service/Cartridge type
     private String serviceType;
+
+    // Service uuid
+    private String serviceUuid;
+
     // Cluster id
     private String clusterId;
 
     private int minInstances;
     private int maxInstances;
 
-    public ClusterDataHolder(String serviceType, String clusterId) {
+    public ClusterDataHolder(String serviceType, String clusterId, String 
serviceUuid) {
 
         this.serviceType = serviceType;
         this.clusterId = clusterId;
+        this.serviceUuid = serviceUuid;
     }
 
     public String getServiceType() {
         return serviceType;
     }
 
+    public String getServiceUuid() {
+        return serviceUuid;
+    }
+
+    public void setServiceUuid(String serviceUuid) {
+        this.serviceUuid = serviceUuid;
+    }
+
     public String getClusterId() {
         return clusterId;
     }

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee12ac75/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Service.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Service.java
 
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Service.java
index ee0b89d..2194c05 100644
--- 
a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Service.java
+++ 
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Service.java
@@ -34,15 +34,17 @@ public class Service implements Serializable {
 
     private final String serviceName;
     private final ServiceType serviceType;
+    private String serviceUuid;
     // Key: Cluster.clusterId
     private Map<String, Cluster> clusterIdClusterMap;
     // Key: Port.proxy
     private Map<Integer, Port> portMap;
     private Properties properties;
 
-    public Service(String serviceName, ServiceType serviceType) {
+    public Service(String serviceName, ServiceType serviceType, String 
serviceUuid) {
         this.serviceName = serviceName;
         this.serviceType = serviceType;
+        this.serviceUuid = serviceUuid;
         this.clusterIdClusterMap = new HashMap<String, Cluster>();
         this.portMap = new HashMap<Integer, Port>();
     }
@@ -55,6 +57,14 @@ public class Service implements Serializable {
         return serviceType;
     }
 
+    public String getServiceUuid() {
+        return serviceUuid;
+    }
+
+    public void setServiceUuid(String serviceUuid) {
+        this.serviceUuid = serviceUuid;
+    }
+
     public Collection<Cluster> getClusters() {
         return clusterIdClusterMap.values();
     }

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee12ac75/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Topology.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Topology.java
 
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Topology.java
index 2f929bf..533336f 100644
--- 
a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Topology.java
+++ 
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Topology.java
@@ -50,7 +50,7 @@ public class Topology implements Serializable {
     }
 
     public void addService(Service service) {
-        this.serviceMap.put(service.getServiceName(), service);
+        this.serviceMap.put(service.getServiceUuid(), service);
     }
 
     public synchronized void addServices(Collection<Service> services) {
@@ -69,8 +69,8 @@ public class Topology implements Serializable {
         
TopologyLockHierarchy.getInstance().removeTopologyLockForService(serviceName);
     }
 
-    public Service getService(String serviceName) {
-        return this.serviceMap.get(serviceName);
+    public Service getService(String serviceUuid) {
+        return this.serviceMap.get(serviceUuid);
     }
 
     public boolean serviceExists(String serviceName) {

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee12ac75/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ServiceCreatedEvent.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ServiceCreatedEvent.java
 
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ServiceCreatedEvent.java
index 6e21518..c3599e9 100644
--- 
a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ServiceCreatedEvent.java
+++ 
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ServiceCreatedEvent.java
@@ -34,13 +34,15 @@ public class ServiceCreatedEvent extends TopologyEvent 
implements Serializable {
 
     private final String serviceName;
     private final ServiceType serviceType;
+    private final String serviceUuid;
     // Key: Port.proxy
     private final Map<Integer, Port> portMap;
     private Properties properties;
 
-    public ServiceCreatedEvent(String serviceName, ServiceType serviceType) {
+    public ServiceCreatedEvent(String serviceName, ServiceType serviceType, 
String serviceUuid) {
         this.serviceName = serviceName;
         this.serviceType = serviceType;
+        this.serviceUuid = serviceUuid;
         this.portMap = new HashMap<Integer, Port>();
     }
 
@@ -52,6 +54,10 @@ public class ServiceCreatedEvent extends TopologyEvent 
implements Serializable {
         return serviceType;
     }
 
+    public String getServiceUuid() {
+        return serviceUuid;
+    }
+
     public Collection<Port> getPorts() {
         return Collections.unmodifiableCollection(portMap.values());
     }

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee12ac75/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ServiceCreatedMessageProcessor.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ServiceCreatedMessageProcessor.java
 
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ServiceCreatedMessageProcessor.java
index 9460ea6..dc9d040 100644
--- 
a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ServiceCreatedMessageProcessor.java
+++ 
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ServiceCreatedMessageProcessor.java
@@ -86,7 +86,7 @@ public class ServiceCreatedMessageProcessor extends 
MessageProcessor {
         } else {
 
             // Apply changes to the topology
-            Service service = new Service(event.getServiceName(), 
event.getServiceType());
+            Service service = new Service(event.getServiceName(), 
event.getServiceType(), event.getServiceUuid());
             service.addPorts(event.getPorts());
             topology.addService(service);
 

Reply via email to