Updated Branches:
  refs/heads/master 1d04ee7d3 -> ef8cd5d9a

adding partitions event to the topology


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

Branch: refs/heads/master
Commit: ef8cd5d9a1a4ca513ee994f4b1fdef48931446d9
Parents: 1d04ee7
Author: rekathiru <[email protected]>
Authored: Fri Nov 8 14:17:14 2013 +0530
Committer: rekathiru <[email protected]>
Committed: Fri Nov 8 14:17:14 2013 +0530

----------------------------------------------------------------------
 .../messaging/domain/topology/Partition.java    | 18 ++++++++++
 .../messaging/domain/topology/Topology.java     | 37 ++++++++++++++++++--
 2 files changed, 53 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ef8cd5d9/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Partition.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Partition.java
 
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Partition.java
index fb5527e..ecbd14b 100644
--- 
a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Partition.java
+++ 
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Partition.java
@@ -46,4 +46,22 @@ public class Partition {
     public void setScope(String scope) {
         this.scope = scope;
     }
+
+    public Map<String, String> getProperties() {
+        return properties;
+    }
+
+    public void setProperties(Map<String, String> properties) {
+        this.properties = properties;
+    }
+
+    public void setProperty(String key, String value) {
+        if (key != null && value != null) {
+            getProperties().put(key, value);
+        }
+    }
+
+    public String getProperty(String key) {
+        return getProperties().get(key);
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ef8cd5d9/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 992c004..450df23 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
@@ -20,7 +20,9 @@
 package org.apache.stratos.messaging.domain.topology;
 
 import java.io.Serializable;
-import java.util.*;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * Defines a topology of serviceMap in Stratos.
@@ -28,6 +30,7 @@ import java.util.*;
 public class Topology implements Serializable {
     // Key: Service.serviceName
     private Map<String, Service> serviceMap;
+    private Map<String, Partition> partitionMap;
 
     public Topology() {
         this.serviceMap = new HashMap<String, Service>();
@@ -37,12 +40,16 @@ public class Topology implements Serializable {
         return serviceMap.values();
     }
 
+    public Collection<Partition> getPartitions() {
+        return partitionMap.values();
+    }
+
     public void addService(Service service) {
         this.serviceMap.put(service.getServiceName(), service);
     }
 
     public void addServices(Collection<Service> services) {
-        for(Service service: services) {
+        for (Service service : services) {
             addService(service);
         }
     }
@@ -62,4 +69,30 @@ public class Topology implements Serializable {
     public boolean serviceExists(String serviceName) {
         return this.serviceMap.containsKey(serviceName);
     }
+
+    public Map<String, Partition> getPartitionMap() {
+        return partitionMap;
+    }
+
+    public void setPartitionMap(Map<String, Partition> partitionMap) {
+        this.partitionMap = partitionMap;
+    }
+
+    public void addPartition(Partition partition) {
+        this.partitionMap.put(partition.getId(), partition);
+    }
+
+    public void addPartitions(Collection<Partition> partitions) {
+        for (Partition partition : partitions) {
+            addPartition(partition);
+        }
+    }
+
+    public void removePartition(Partition partition) {
+        this.partitionMap.remove(partition.getId());
+    }
+
+    public void removePartition(String partitionId) {
+        this.partitionMap.remove(partitionId);
+    }
 }

Reply via email to