You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by re...@apache.org on 2013/11/14 03:26:11 UTC

git commit: adding partition to the Topology

Updated Branches:
  refs/heads/master 43833f006 -> 237f366c4


adding partition 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/237f366c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/237f366c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/237f366c

Branch: refs/heads/master
Commit: 237f366c4f2f797a2b8be5c7044919be71b9a2d7
Parents: 43833f0
Author: rekathiru <rt...@gmail.com>
Authored: Wed Nov 13 19:25:40 2013 -0700
Committer: rekathiru <rt...@gmail.com>
Committed: Wed Nov 13 19:25:40 2013 -0700

----------------------------------------------------------------------
 .../cloud/controller/topology/TopologyBuilder.java       | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/237f366c/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java
index d03acbd..bf50c42 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java
@@ -22,7 +22,6 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.cloud.controller.runtime.FasterLookUpDataHolder;
 import org.apache.stratos.cloud.controller.util.Cartridge;
-import org.apache.stratos.cloud.controller.util.LocationScope;
 import org.apache.stratos.cloud.controller.util.PortMapping;
 import org.apache.stratos.cloud.controller.util.ServiceContext;
 import org.apache.stratos.messaging.domain.topology.*;
@@ -46,10 +45,20 @@ public class TopologyBuilder {
             throw new RuntimeException(String.format("Cartridge list is empty"));
         }
         try {
+
             TopologyManager.getInstance().acquireWriteLock();
             for (Cartridge cartridge : cartridgeList) {
                 if (!topology.serviceExists(cartridge.getType())) {
                     service = new Service(cartridge.getType());
+                     List<PortMapping> portMappings = cartridge.getPortMappings();
+                    Port port;
+                    //adding ports to the event
+                    for (PortMapping portMapping : portMappings) {
+                        port = new Port(portMapping.getProtocol(),
+                                Integer.parseInt(portMapping.getPort()),
+                                Integer.parseInt(portMapping.getProxyPort()));
+                        service.addPort(port);
+                    }
                     topology.addService(service);
                     TopologyManager.getInstance().updateTopology(topology);
                 }