stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From im...@apache.org
Subject stratos git commit: Resolving merge conflicts according to partition validator changes
Date Mon, 08 Dec 2014 07:41:17 GMT
Repository: stratos
Updated Branches:
  refs/heads/master 49eadd6ef -> 760fcf845


Resolving merge conflicts according to partition validator changes


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

Branch: refs/heads/master
Commit: 760fcf84521217079b6b7c0591dd01d477858981
Parents: 49eadd6
Author: Imesh Gunaratne <imesh@apache.org>
Authored: Mon Dec 8 13:11:07 2014 +0530
Committer: Imesh Gunaratne <imesh@apache.org>
Committed: Mon Dec 8 13:11:07 2014 +0530

----------------------------------------------------------------------
 .../monitor/cluster/VMClusterMonitor.java       |  1 -
 .../concurrent/PartitionValidatorCallable.java  |  6 ---
 .../cloud/controller/domain/IaasProvider.java   | 16 ++++---
 .../cloud/controller/iaases/JcloudsIaas.java    |  3 --
 .../controller/iaases/JcloudsIaasUtil.java      | 25 -----------
 .../cloud/controller/iaases/mock/MockIaas.java  | 44 +++++++++++---------
 .../controller/iaases/mock/MockMember.java      |  9 ++++
 .../iaases/mock/MockPartitionValidator.java     |  3 +-
 .../MockHealthStatisticsNotifier.java           |  2 +
 .../MockHealthStatisticsPublisher.java          |  4 +-
 .../validators/DockerPartitionValidator.java    |  5 +--
 .../impl/CloudControllerServiceUtil.java        | 29 ++++++-------
 .../controller/util/CloudControllerUtil.java    | 22 ++++++++++
 .../outputeventadaptors/JMSOutputAdaptor.xml    |  2 +-
 .../src/main/conf/drools/scaling.drl            |  3 +-
 15 files changed, 88 insertions(+), 86 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/760fcf84/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMClusterMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMClusterMonitor.java
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMClusterMonitor.java
index 745f104..03d8a38 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMClusterMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMClusterMonitor.java
@@ -252,7 +252,6 @@ public class VMClusterMonitor extends AbstractClusterMonitor {
 
                                 VMClusterContext vmClusterContext = (VMClusterContext) clusterContext;
 
-                                getScaleCheckKnowledgeSession().setGlobal("instance", instanceContext);
                                 getScaleCheckKnowledgeSession().setGlobal("clusterId", getClusterId());
                                 getScaleCheckKnowledgeSession().setGlobal("autoscalePolicy",
                                         vmClusterContext.getAutoscalePolicy());

http://git-wip-us.apache.org/repos/asf/stratos/blob/760fcf84/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/concurrent/PartitionValidatorCallable.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/concurrent/PartitionValidatorCallable.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/concurrent/PartitionValidatorCallable.java
index 625fbbd..cdb10cb 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/concurrent/PartitionValidatorCallable.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/concurrent/PartitionValidatorCallable.java
@@ -23,15 +23,9 @@ import java.util.concurrent.Callable;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.cloud.controller.domain.Partition;
-import org.apache.stratos.cloud.controller.exception.InvalidIaasProviderException;
-import org.apache.stratos.cloud.controller.exception.InvalidPartitionException;
 import org.apache.stratos.cloud.controller.domain.Cartridge;
 import org.apache.stratos.cloud.controller.domain.IaasProvider;
 import org.apache.stratos.cloud.controller.services.impl.CloudControllerServiceUtil;
-import org.apache.stratos.cloud.controller.util.CloudControllerUtil;
-import org.apache.stratos.cloud.controller.iaases.Iaas;
-import org.apache.stratos.cloud.controller.iaases.validators.IaasBasedPartitionValidator;
-import org.apache.stratos.cloud.controller.iaases.validators.PartitionValidator;
 
 public class PartitionValidatorCallable implements Callable<IaasProvider> {
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/760fcf84/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/IaasProvider.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/IaasProvider.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/IaasProvider.java
index 36380c8..159e2d4 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/IaasProvider.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/IaasProvider.java
@@ -22,7 +22,7 @@ import org.apache.commons.lang.builder.HashCodeBuilder;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.stratos.cloud.controller.exception.InvalidIaasProviderException;
 import org.apache.stratos.cloud.controller.iaases.Iaas;
-import org.apache.stratos.cloud.controller.iaases.JcloudsIaasUtil;
+import org.apache.stratos.cloud.controller.util.CloudControllerUtil;
 import org.jclouds.compute.ComputeService;
 import org.jclouds.compute.domain.Template;
 
@@ -216,11 +216,15 @@ public class IaasProvider implements Serializable {
 
     public Iaas getIaas() {
     	if (iaas == null) {
-    		try {
-				iaas = JcloudsIaasUtil.createIaasInstance(this);
-			} catch (InvalidIaasProviderException e) {
-				return null;
-			}
+            synchronized (IaasProvider.this) {
+                if(iaas == null) {
+                    try {
+                        iaas = CloudControllerUtil.createIaasInstance(this);
+                    } catch (InvalidIaasProviderException e) {
+                        throw new RuntimeException("Could not create IaaS instance", e);
+                    }
+                }
+            }
     	}
         return iaas;
     }

http://git-wip-us.apache.org/repos/asf/stratos/blob/760fcf84/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/JcloudsIaas.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/JcloudsIaas.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/JcloudsIaas.java
index 5d0e1ac..8a0656a 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/JcloudsIaas.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/JcloudsIaas.java
@@ -28,11 +28,8 @@ import org.apache.stratos.cloud.controller.exception.CloudControllerException;
 import org.apache.stratos.cloud.controller.exception.InvalidCartridgeTypeException;
 import org.apache.stratos.cloud.controller.exception.InvalidIaasProviderException;
 import org.apache.stratos.cloud.controller.exception.InvalidMemberException;
-import org.apache.stratos.cloud.controller.messaging.publisher.CartridgeInstanceDataPublisher;
-import org.apache.stratos.cloud.controller.messaging.topology.TopologyBuilder;
 import org.apache.stratos.cloud.controller.services.impl.CloudControllerServiceUtil;
 import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
-import org.apache.stratos.messaging.domain.topology.MemberStatus;
 import org.jclouds.compute.ComputeService;
 import org.jclouds.compute.domain.NodeMetadata;
 import org.jclouds.compute.domain.NodeMetadataBuilder;

http://git-wip-us.apache.org/repos/asf/stratos/blob/760fcf84/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/JcloudsIaasUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/JcloudsIaasUtil.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/JcloudsIaasUtil.java
index b361f5c..7d8e47c 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/JcloudsIaasUtil.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/JcloudsIaasUtil.java
@@ -26,8 +26,6 @@ import org.apache.stratos.cloud.controller.exception.InvalidIaasProviderExceptio
 import org.apache.stratos.cloud.controller.util.ComputeServiceBuilderUtil;
 import org.jclouds.compute.ComputeService;
 
-import java.lang.reflect.Constructor;
-
 /**
  * jclouds IaaS utility methods.
  */
@@ -64,27 +62,4 @@ public class JcloudsIaasUtil {
             throw new InvalidIaasProviderException(msg, e);
         }
     }
-
-    public static Iaas createIaasInstance(IaasProvider iaasProvider)
-            throws InvalidIaasProviderException {
-        try {
-
-            if(iaasProvider.getClassName() == null) {
-                String msg = "You have not specified a class which represents the iaas of
type: ["
-                        + iaasProvider.getType() + "].";
-                log.error(msg);
-                throw new InvalidIaasProviderException(msg);
-            }
-
-            Constructor<?> c = Class.forName(iaasProvider.getClassName()).getConstructor(IaasProvider.class);
-            Iaas iaas = (Iaas) c.newInstance(iaasProvider);
-            return iaas;
-        } catch (Exception e) {
-            String msg = "Class [" + iaasProvider.getClassName()
-                    + "] which represents the iaas of type: ["
-                    + iaasProvider.getType() + "] has failed to instantiate.";
-            log.error(msg, e);
-            throw new InvalidIaasProviderException(msg, e);
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/760fcf84/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/MockIaas.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/MockIaas.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/MockIaas.java
index 82d6c59..6e02640 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/MockIaas.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/MockIaas.java
@@ -72,22 +72,24 @@ public class MockIaas extends Iaas {
 
     @Override
     public NodeMetadata createInstance(ClusterContext clusterContext, MemberContext memberContext)
{
-        // Create mock member instance
-        MockMemberContext mockMemberContext = new MockMemberContext(clusterContext.getCartridgeType(),
-                clusterContext.getClusterId(), memberContext.getMemberId(), memberContext.getNetworkPartitionId(),
-                memberContext.getPartition().getId(), memberContext.getInstanceId());
-        MockMember mockMember = new MockMember(mockMemberContext);
-        membersMap.put(mockMember.getMockMemberContext().getMemberId(), mockMember);
-        executorService.submit(mockMember);
-
-        // Prepare node metadata
-        MockNodeMetadata nodeMetadata = new MockNodeMetadata();
-        nodeMetadata.setId(UUID.randomUUID().toString());
-
-        // Persist changes
-        persistInRegistry();
-
-        return nodeMetadata;
+        synchronized (MockIaas.class) {
+            // Create mock member instance
+            MockMemberContext mockMemberContext = new MockMemberContext(clusterContext.getCartridgeType(),
+                    clusterContext.getClusterId(), memberContext.getMemberId(), memberContext.getNetworkPartitionId(),
+                    memberContext.getPartition().getId(), memberContext.getInstanceId());
+            MockMember mockMember = new MockMember(mockMemberContext);
+            membersMap.put(mockMember.getMockMemberContext().getMemberId(), mockMember);
+            executorService.submit(mockMember);
+
+            // Prepare node metadata
+            MockNodeMetadata nodeMetadata = new MockNodeMetadata();
+            nodeMetadata.setId(UUID.randomUUID().toString());
+
+            // Persist changes
+            persistInRegistry();
+
+            return nodeMetadata;
+        }
     }
 
     private void persistInRegistry() {
@@ -167,10 +169,12 @@ public class MockIaas extends Iaas {
 
     @Override
     public void terminateInstance(MemberContext memberContext) throws InvalidCartridgeTypeException,
InvalidMemberException {
-        MockMember mockMember = membersMap.get(memberContext.getMemberId());
-        if(mockMember != null) {
-            mockMember.terminate();
-            membersMap.remove(memberContext.getMemberId());
+        synchronized (MockIaas.class) {
+            MockMember mockMember = membersMap.get(memberContext.getMemberId());
+            if (mockMember != null) {
+                mockMember.terminate();
+                membersMap.remove(memberContext.getMemberId());
+            }
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/760fcf84/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/MockMember.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/MockMember.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/MockMember.java
index 898de35..ddce529 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/MockMember.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/MockMember.java
@@ -46,6 +46,10 @@ public class MockMember implements Runnable, Serializable {
 
     @Override
     public void run() {
+        if(log.isInfoEnabled()) {
+            log.info(String.format("Mock member started: [member-id] %s", mockMemberContext.getMemberId()));
+        }
+
         MockMemberEventPublisher.publishInstanceStartedEvent(mockMemberContext);
         sleep(5000);
         MockMemberEventPublisher.publishInstanceActivatedEvent(mockMemberContext);
@@ -79,7 +83,12 @@ public class MockMember implements Runnable, Serializable {
     }
 
     public void terminate() {
+        String memberId = mockMemberContext.getMemberId();
         terminated = true;
         scheduler.shutdownNow();
+
+        if(log.isInfoEnabled()) {
+            log.info(String.format("Mock member terminated: [member-id] %s", memberId));
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/760fcf84/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/MockPartitionValidator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/MockPartitionValidator.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/MockPartitionValidator.java
index ef7ae94..e1055f0 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/MockPartitionValidator.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/MockPartitionValidator.java
@@ -21,6 +21,7 @@ package org.apache.stratos.cloud.controller.iaases.mock;
 
 import org.apache.stratos.cloud.controller.domain.IaasProvider;
 import org.apache.stratos.cloud.controller.exception.InvalidPartitionException;
+import org.apache.stratos.cloud.controller.iaases.validators.IaasBasedPartitionValidator;
 import org.apache.stratos.cloud.controller.iaases.validators.PartitionValidator;
 
 import java.util.Properties;
@@ -28,7 +29,7 @@ import java.util.Properties;
 /**
  * Mock partition validator.
  */
-public class MockPartitionValidator implements PartitionValidator {
+public class MockPartitionValidator extends IaasBasedPartitionValidator {
 
     private IaasProvider iaasProvider;
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/760fcf84/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/statistics/MockHealthStatisticsNotifier.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/statistics/MockHealthStatisticsNotifier.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/statistics/MockHealthStatisticsNotifier.java
index 882696d..c69f74f 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/statistics/MockHealthStatisticsNotifier.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/statistics/MockHealthStatisticsNotifier.java
@@ -52,6 +52,7 @@ public class MockHealthStatisticsNotifier implements Runnable {
                 }
                 statsPublisher.publish(
                         mockMemberContext.getClusterId(),
+                        mockMemberContext.getInstanceId(),
                         mockMemberContext.getNetworkPartitionId(),
                         mockMemberContext.getMemberId(),
                         mockMemberContext.getPartitionId(),
@@ -64,6 +65,7 @@ public class MockHealthStatisticsNotifier implements Runnable {
                 }
                 statsPublisher.publish(
                         mockMemberContext.getClusterId(),
+                        mockMemberContext.getInstanceId(),
                         mockMemberContext.getNetworkPartitionId(),
                         mockMemberContext.getMemberId(),
                         mockMemberContext.getPartitionId(),

http://git-wip-us.apache.org/repos/asf/stratos/blob/760fcf84/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/statistics/MockHealthStatisticsPublisher.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/statistics/MockHealthStatisticsPublisher.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/statistics/MockHealthStatisticsPublisher.java
index e4a525a..7305aa5 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/statistics/MockHealthStatisticsPublisher.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/statistics/MockHealthStatisticsPublisher.java
@@ -46,6 +46,7 @@ public class MockHealthStatisticsPublisher extends WSO2CEPStatisticsPublisher
{
             // Payload definition
             List<Attribute> payloadData = new ArrayList<Attribute>();
             payloadData.add(new Attribute("cluster_id", AttributeType.STRING));
+            payloadData.add(new Attribute("instance_id", AttributeType.STRING));
             payloadData.add(new Attribute("network_partition_id", AttributeType.STRING));
             payloadData.add(new Attribute("member_id", AttributeType.STRING));
             payloadData.add(new Attribute("partition_id", AttributeType.STRING));
@@ -71,7 +72,7 @@ public class MockHealthStatisticsPublisher extends WSO2CEPStatisticsPublisher
{
      * @param health
      * @param value
      */
-    public void publish(String clusterId, String networkPartitionId, String memberId, String
partitionId, String health, double value) {
+    public void publish(String clusterId, String instanceId, String networkPartitionId, String
memberId, String partitionId, String health, double value) {
         if(log.isDebugEnabled()) {
             log.debug(String.format("Publishing health statistics: [cluster] %s [network-partition]
%s [partition] %s [member] %s [health] %s [value] %f",
                     clusterId, networkPartitionId, partitionId, memberId, health, value));
@@ -79,6 +80,7 @@ public class MockHealthStatisticsPublisher extends WSO2CEPStatisticsPublisher
{
         List<Object> payload = new ArrayList<Object>();
         // Payload values
         payload.add(clusterId);
+        payload.add(instanceId);
         payload.add(networkPartitionId);
         payload.add(memberId);
         payload.add(partitionId);

http://git-wip-us.apache.org/repos/asf/stratos/blob/760fcf84/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/DockerPartitionValidator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/DockerPartitionValidator.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/DockerPartitionValidator.java
index 6fce78f..2a57b3e 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/DockerPartitionValidator.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/validators/DockerPartitionValidator.java
@@ -21,12 +21,11 @@ package org.apache.stratos.cloud.controller.iaases.validators;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.cloud.controller.domain.IaasProvider;
 import org.apache.stratos.cloud.controller.exception.InvalidIaasProviderException;
 import org.apache.stratos.cloud.controller.exception.InvalidPartitionException;
-import org.apache.stratos.cloud.controller.iaases.AWSEC2Iaas;
 import org.apache.stratos.cloud.controller.iaases.Iaas;
-import org.apache.stratos.cloud.controller.domain.IaasProvider;
-import org.apache.stratos.cloud.controller.util.CloudControllerUtil;
+import org.apache.stratos.cloud.controller.services.impl.CloudControllerServiceUtil;
 
 import java.util.Properties;
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/760fcf84/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java
index 4dafc2c..1b014ab 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java
@@ -42,13 +42,9 @@ import org.apache.stratos.cloud.controller.messaging.publisher.CartridgeInstance
 import org.apache.stratos.cloud.controller.messaging.topology.TopologyBuilder;
 import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
 import org.apache.stratos.cloud.controller.util.CloudControllerUtil;
-import org.apache.stratos.cloud.controller.util.ComputeServiceBuilderUtil;
 import org.apache.stratos.messaging.domain.topology.MemberStatus;
-import org.jclouds.compute.ComputeService;
 import org.jclouds.rest.ResourceNotFoundException;
 
-import java.lang.reflect.Constructor;
-
 /**
  * Cloud controller service utility methods.
  */
@@ -170,19 +166,18 @@ public class CloudControllerServiceUtil {
             // if this is a IaaS based partition
             Iaas iaas = iaasProvider.getIaas();
 
-            if (iaas == null) {
-
-                try {
-                    iaas = CloudControllerUtil.getIaas(iaasProvider);
-                } catch (InvalidIaasProviderException e) {
-                    String msg =
-                            "Invalid Partition - " + partition.toString()
-                                    + ". Cause: Unable to build Iaas of this IaasProvider
[Provider] : " + provider
-                                    + ". " + e.getMessage();
-                    log.error(msg, e);
-                    throw new InvalidPartitionException(msg, e);
-                }
-            }
+//            if (iaas == null) {
+//                try {
+//                    iaas = CloudControllerUtil.getIaas(iaasProvider);
+//                } catch (InvalidIaasProviderException e) {
+//                    String msg =
+//                            "Invalid Partition - " + partition.toString()
+//                                    + ". Cause: Unable to build Iaas of this IaasProvider
[Provider] : " + provider
+//                                    + ". " + e.getMessage();
+//                    log.error(msg, e);
+//                    throw new InvalidPartitionException(msg, e);
+//                }
+//            }
 
             IaasBasedPartitionValidator validator = (IaasBasedPartitionValidator) iaas.getPartitionValidator();
             validator.setIaasProvider(iaasProvider);

http://git-wip-us.apache.org/repos/asf/stratos/blob/760fcf84/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
index 07aa77d..7ceca72 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
@@ -55,6 +55,28 @@ import java.util.Properties;
 public class CloudControllerUtil {
 	private static final Log log = LogFactory.getLog(CloudControllerUtil.class);
 
+    public static Iaas createIaasInstance(IaasProvider iaasProvider)
+            throws InvalidIaasProviderException {
+        try {
+            if(iaasProvider.getClassName() == null) {
+                String msg = "You have not specified a class which represents the iaas of
type: ["
+                        + iaasProvider.getType() + "].";
+                log.error(msg);
+                throw new InvalidIaasProviderException(msg);
+            }
+
+            Constructor<?> c = Class.forName(iaasProvider.getClassName()).getConstructor(IaasProvider.class);
+            Iaas iaas = (Iaas) c.newInstance(iaasProvider);
+            return iaas;
+        } catch (Exception e) {
+            String msg = "Class [" + iaasProvider.getClassName()
+                    + "] which represents the iaas of type: ["
+                    + iaasProvider.getType() + "] has failed to instantiate.";
+            log.error(msg, e);
+            throw new InvalidIaasProviderException(msg, e);
+        }
+    }
+
     public static Cartridge toCartridge(CartridgeConfig config) {
         if (config == null) {
             return null;

http://git-wip-us.apache.org/repos/asf/stratos/blob/760fcf84/extensions/cep/artifacts/outputeventadaptors/JMSOutputAdaptor.xml
----------------------------------------------------------------------
diff --git a/extensions/cep/artifacts/outputeventadaptors/JMSOutputAdaptor.xml b/extensions/cep/artifacts/outputeventadaptors/JMSOutputAdaptor.xml
index a6a1161..59c3653 100644
--- a/extensions/cep/artifacts/outputeventadaptors/JMSOutputAdaptor.xml
+++ b/extensions/cep/artifacts/outputeventadaptors/JMSOutputAdaptor.xml
@@ -23,7 +23,7 @@
 <outputEventAdaptor name="JMSOutputAdaptor" statistics="disable"
   trace="enable" type="jms" xmlns="http://wso2.org/carbon/eventadaptormanager">
   <!--property name="java.naming.provider.url">CEP_HOME/repository/conf/jndi.properties</property-->
-  <property name="java.naming.provider.url">tcp://MB_HOSTNAME:MB_LISTEN_PORT</property>
+  <property name="java.naming.provider.url">tcp://localhost:61616</property>
   <property name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</property>
   <property name="transport.jms.ConnectionFactoryJNDIName">TopicConnectionFactory</property>
   <property name="transport.jms.DestinationType">topic</property>

http://git-wip-us.apache.org/repos/asf/stratos/blob/760fcf84/products/stratos/modules/distribution/src/main/conf/drools/scaling.drl
----------------------------------------------------------------------
diff --git a/products/stratos/modules/distribution/src/main/conf/drools/scaling.drl b/products/stratos/modules/distribution/src/main/conf/drools/scaling.drl
index 621cbe6..bfc7bbd 100644
--- a/products/stratos/modules/distribution/src/main/conf/drools/scaling.drl
+++ b/products/stratos/modules/distribution/src/main/conf/drools/scaling.drl
@@ -51,7 +51,6 @@ global org.apache.stratos.autoscaler.rule.RuleLog log;
 global org.apache.stratos.autoscaler.rule.RuleTasksDelegator delegator;
 global org.apache.stratos.autoscaler.pojo.policy.autoscale.AutoscalePolicy autoscalePolicy;
 global java.lang.String clusterId;
-global java.lang.String instanceId;
 global java.lang.Boolean rifReset;
 global java.lang.Boolean mcReset;
 global java.lang.Boolean laReset;
@@ -140,7 +139,7 @@ dialect "mvel"
             if(partitionContext != null){
                 log.info("[scale-up] Partition available, hence trying to spawn an instance
to scale up!" );
                 log.debug("[scale-up] " + " [partition] " + partitionContext.getPartitionId()
+ " [cluster] " + clusterId );
-                delegator.delegateSpawn(partitionContext, clusterId, instanceId, isPrimary);
+                delegator.delegateSpawn(partitionContext, clusterId, clusterInstanceContext.getId(),
isPrimary);
 				count++;
             }
           }    


Mime
View raw message