You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stratos.apache.org by Thanu <gi...@git.apache.org> on 2015/07/22 14:31:15 UTC

[GitHub] stratos pull request: Data publisher integration

GitHub user Thanu opened a pull request:

    https://github.com/apache/stratos/pull/403

    Data publisher integration

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/Thanu/stratos data-publisher-integration

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/stratos/pull/403.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #403
    
----
commit 2fd289b8c6b7f20d56f45e574f77940b3749cb4b
Author: Thanuja <th...@wso2.com>
Date:   2015-07-22T09:01:13Z

    Metering Service Implementation

commit 76c7724b6f248e48b14ba2ea69e6e919291b4194
Author: Thanuja <th...@wso2.com>
Date:   2015-07-22T10:58:56Z

    Publishing events for Metering Service Implementation

commit 07e861937818e3dfae5ee40ce5b5cb7b31668a4b
Author: Thanuja <th...@wso2.com>
Date:   2015-07-22T12:25:51Z

    Publishing events for Metering Service Implementation

commit 632a3a4319ea55bd7bef7c95442e5fe9878b0898
Author: Thanuja <th...@wso2.com>
Date:   2015-07-22T12:29:57Z

    Publishing events for Metering Service Implementation

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] stratos pull request: Data publisher integration

Posted by Thanu <gi...@git.apache.org>.
Github user Thanu commented on a diff in the pull request:

    https://github.com/apache/stratos/pull/403#discussion_r35297226
  
    --- Diff: components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java ---
    @@ -44,347 +43,350 @@
      */
     public class RuleTasksDelegator {
     
    -    private static boolean arspiIsSet = false;
    -
    -    private static final Log log = LogFactory.getLog(RuleTasksDelegator.class);
    -
    -    public double getPredictedValueForNextMinute(float average, float gradient, float secondDerivative, int timeInterval) {
    -        double predictedValue;
    -//        s = u * t + 0.5 * a * t * t
    -        if (log.isDebugEnabled()) {
    -            log.debug(String.format("Predicting the value, [average]: %s , [gradient]: %s , [second derivative] " +
    -                    ": %s , [time intervals]: %s ", average, gradient, secondDerivative, timeInterval));
    -        }
    -        predictedValue = average + gradient * timeInterval + 0.5 * secondDerivative * timeInterval * timeInterval;
    -
    -        return predictedValue;
    -    }
    -
    -
    -    public int getNumberOfInstancesRequiredBasedOnRif(float rifPredictedValue, float rifThreshold) {
    -
    -        if (rifThreshold != 0) {
    -
    -            float requiredNumberOfInstances = rifPredictedValue / rifThreshold;
    -            return (int) Math.ceil(requiredNumberOfInstances);
    -        } else {
    -            log.error("Request in flight threshold is Zero");
    -            return 0;
    -        }
    -
    -    }
    -
    -    public int getNumberOfInstancesRequiredBasedOnMemoryConsumption(float threshold, double predictedValue,
    -                                                                    int min, int max) {
    -        double numberOfAdditionalInstancesRequired = 0;
    -        if (predictedValue != threshold) {
    -
    -            float scalingRange = 100 - threshold;
    -            int instanceRange = max - min;
    -
    -            if (instanceRange != 0) {
    -
    -                float gradient = scalingRange / instanceRange;
    -                numberOfAdditionalInstancesRequired = (predictedValue - threshold) / gradient;
    -            }
    -
    -            if (predictedValue < threshold) {
    -                //Since predicted-value is less, it can be scale-down
    -                return min - 1;
    -            }
    -        }
    -
    -        return (int) Math.ceil(min + numberOfAdditionalInstancesRequired);
    -    }
    -
    -    public int getNumberOfInstancesRequiredBasedOnLoadAverage(float threshold, double predictedValue,
    -                                                              int min) {
    -
    -        double numberOfInstances;
    -        if (threshold != 0) {
    -
    -            numberOfInstances = (min * predictedValue) / threshold;
    -            return (int) Math.ceil(numberOfInstances);
    -        }
    -
    -        return min;
    -    }
    -
    -    public int getMaxNumberOfInstancesRequired(int numberOfInstancesRequiredBasedOnRif,
    -                                               int numberOfInstancesRequiredBasedOnMemoryConsumption,
    -                                               boolean mcReset, int numberOfInstancesReuquiredBasedOnLoadAverage,
    -                                               boolean laReset) {
    -        int numberOfInstances = 0;
    -
    -        int rifBasedRequiredInstances = 0;
    -        int mcBasedRequiredInstances = 0;
    -        int laBasedRequiredInstances = 0;
    -        if (arspiIsSet) {
    -            rifBasedRequiredInstances = numberOfInstancesRequiredBasedOnRif;
    -        }
    -        if (mcReset) {
    -            mcBasedRequiredInstances = numberOfInstancesRequiredBasedOnMemoryConsumption;
    -        }
    -        if (laReset) {
    -            laBasedRequiredInstances = numberOfInstancesReuquiredBasedOnLoadAverage;
    -        }
    -        numberOfInstances = Math.max(Math.max(numberOfInstancesRequiredBasedOnMemoryConsumption,
    -                numberOfInstancesReuquiredBasedOnLoadAverage), numberOfInstancesRequiredBasedOnRif);
    -        return numberOfInstances;
    -    }
    -
    -    public PartitionAlgorithm getPartitionAlgorithm(String partitionAlgorithm) {
    -
    -        PartitionAlgorithm autoscaleAlgorithm = null;
    -        //FIXME to not parse for algo when partition is chosen by the parent
    -
    -        if (partitionAlgorithm == null) {
    -            //Send one after another as default
    -            partitionAlgorithm = StratosConstants.PARTITION_ONE_AFTER_ANOTHER_ALGORITHM_ID;
    -        }
    -        if (log.isDebugEnabled()) {
    -            log.debug(String.format("Retrieving partition algorithm [Partition algorithm]: %s", partitionAlgorithm));
    -        }
    -        if (StratosConstants.PARTITION_ROUND_ROBIN_ALGORITHM_ID.equals(partitionAlgorithm)) {
    -            autoscaleAlgorithm = new RoundRobin();
    -        } else if (StratosConstants.PARTITION_ONE_AFTER_ANOTHER_ALGORITHM_ID.equals(partitionAlgorithm)) {
    -            autoscaleAlgorithm = new OneAfterAnother();
    -        } else {
    -            if (log.isErrorEnabled()) {
    -                log.error(String.format("Partition algorithm %s could not be identified !", partitionAlgorithm));
    -            }
    -        }
    -        return autoscaleAlgorithm;
    -    }
    -
    -    public void delegateInstanceCleanup(String memberId) {
    -        try {
    -            // send the instance notification event.
    -            InstanceNotificationPublisher.getInstance().sendInstanceCleanupEventForMember(memberId);
    -            log.info("Instance clean up event sent for [member] " + memberId);
    -
    -        } catch (Exception e) {
    -            log.error("Cannot terminate instance", e);
    -        }
    -    }
    -
    -    /**
    -     * Invoked from drools to start an instance.
    -     *
    -     * @param clusterMonitorPartitionContext Cluster monitor partition context
    -     * @param clusterId                      Cluster id
    -     * @param clusterInstanceId              Instance id
    -     * @param isPrimary                      Is a primary member
    -     */
    -    public void delegateSpawn(ClusterLevelPartitionContext clusterMonitorPartitionContext, String clusterId,
    -                              String clusterInstanceId, boolean isPrimary) {
    -
    -        try {
    -            String nwPartitionId = clusterMonitorPartitionContext.getNetworkPartitionId();
    -
    -            // Calculate accumulation of minimum counts of all the partition of current network partition
    -            int minimumCountOfNetworkPartition;
    -            ClusterMonitor clusterMonitor = AutoscalerContext.getInstance().getClusterMonitor(clusterId);
    -            ClusterContext clusterContext = clusterMonitor.getClusterContext();
    -            ClusterLevelNetworkPartitionContext clusterLevelNetworkPartitionContext =
    -                    clusterContext.getNetworkPartitionCtxt(nwPartitionId);
    -            ClusterInstanceContext clusterInstanceContext =
    -                    (ClusterInstanceContext) clusterLevelNetworkPartitionContext.
    -                            getInstanceContext(clusterInstanceId);
    -            minimumCountOfNetworkPartition = clusterInstanceContext.getMinInstanceCount();
    -
    -            MemberContext memberContext =
    -                    AutoscalerCloudControllerClient.getInstance()
    -                            .startInstance(clusterMonitorPartitionContext.getPartition(),
    -                                    clusterId,
    -                                    clusterInstanceId, clusterMonitorPartitionContext.getNetworkPartitionId(),
    -                                    isPrimary,
    -                                    minimumCountOfNetworkPartition);
    -            if (memberContext != null) {
    -                ClusterLevelPartitionContext partitionContext = clusterInstanceContext.
    -                        getPartitionCtxt(clusterMonitorPartitionContext.getPartitionId());
    -                partitionContext.addPendingMember(memberContext);
    -                partitionContext.addMemberStatsContext(new MemberStatsContext(memberContext.getMemberId()));
    -                if (log.isDebugEnabled()) {
    -                    log.debug(String.format("Pending member added, [member] %s [partition] %s", memberContext.getMemberId(),
    -                            memberContext.getPartition().getId()));
    -                }
    -
    -            } else {
    -                if (log.isErrorEnabled()) {
    -                    log.error("Member context returned from cloud controller is null");
    -                }
    -            }
    -        } catch (Exception e) {
    -            String message = String.format("Could not start instance: [cluster-id] %s [instance-id] %s",
    -                    clusterId, clusterInstanceId);
    -            log.error(message, e);
    -            throw new RuntimeException(message, e);
    -        }
    -    }
    -
    -    public void delegateScalingDependencyNotification(String clusterId, String networkPartitionId, String instanceId,
    -                                                      int requiredInstanceCount, int minimumInstanceCount) {
    -
    -        if (log.isDebugEnabled()) {
    -            log.debug("Scaling dependent notification is going to the [parentInstance] " + instanceId);
    -        }
    -        //Notify parent for checking scaling dependencies
    -        ClusterMonitor clusterMonitor = AutoscalerContext.getInstance().getClusterMonitor(clusterId);
    -        float fMinimumInstanceCount = minimumInstanceCount;
    -        float factor = requiredInstanceCount / fMinimumInstanceCount;
    -        clusterMonitor.sendClusterScalingEvent(networkPartitionId, instanceId, factor);
    -    }
    -
    -    public void delegateScalingOverMaxNotification(String clusterId, String networkPartitionId, String instanceId) {
    -        if (log.isDebugEnabled()) {
    -            log.debug("Scaling max out notification is going to the [parentInstance] " + instanceId);
    -        }
    -        //Notify parent for checking scaling dependencies
    -        ClusterMonitor clusterMonitor = AutoscalerContext.getInstance().getClusterMonitor(clusterId);
    -        clusterMonitor.sendScalingOverMaxEvent(networkPartitionId, instanceId);
    -    }
    -
    -    public void delegateScalingDownBeyondMinNotification(String clusterId, String networkPartitionId, String instanceId) {
    -        if (log.isDebugEnabled()) {
    -            log.debug("Scaling down lower min notification is going to the [parentInstance] " + instanceId);
    -        }
    -        //Notify parent for checking scaling dependencies
    -        ClusterMonitor clusterMonitor = AutoscalerContext.getInstance().getClusterMonitor(clusterId);
    -        clusterMonitor.sendScalingDownBeyondMinEvent(networkPartitionId, instanceId);
    -    }
    -
    -    public void delegateTerminate(ClusterLevelPartitionContext clusterMonitorPartitionContext, String memberId) {
    -
    -        try {
    -            //Moving member to pending termination list
    -            if (clusterMonitorPartitionContext.activeMemberAvailable(memberId)) {
    -
    -                log.info(String.format("[scale-down] Moving active member to termination pending list [member id] %s " +
    -                                "[partition] %s [network partition] %s", memberId,
    -                        clusterMonitorPartitionContext.getPartitionId(),
    -                        clusterMonitorPartitionContext.getNetworkPartitionId()));
    -                clusterMonitorPartitionContext.moveActiveMemberToTerminationPendingMembers(memberId);
    -                clusterMonitorPartitionContext.removeMemberStatsContext(memberId);
    -            } else if (clusterMonitorPartitionContext.pendingMemberAvailable(memberId)) {
    -
    -                log.info(String.format("[scale-down] Moving pending member to termination pending list [member id] %s " +
    -                                "[partition] %s [network partition] %s", memberId,
    -                        clusterMonitorPartitionContext.getPartitionId(),
    -                        clusterMonitorPartitionContext.getNetworkPartitionId()));
    -                clusterMonitorPartitionContext.movePendingMemberToObsoleteMembers(memberId);
    -                clusterMonitorPartitionContext.removeMemberStatsContext(memberId);
    -            }
    -        } catch (Exception e) {
    -            log.error("[scale-down] Cannot move member to termination pending list ", e);
    -        }
    -    }
    -
    -    public void delegateTerminateDependency(ClusterLevelPartitionContext clusterMonitorPartitionContext, String memberId) {
    -        try {
    -            //calling SM to send the instance notification event.
    -            if (log.isDebugEnabled()) {
    -                log.debug("delegateTerminateDependency:memberId:" + memberId);
    -            }
    -            //InstanceNotificationClient.getInstance().sendMemberCleanupEvent(memberId);
    -            //partitionContext.moveActiveMemberToTerminationPendingMembers(memberId);
    -            //CloudControllerClient.getInstance().terminate(memberId);
    -        } catch (Exception e) {
    -            log.error("Cannot terminate instance", e);
    -        }
    -    }
    -
    -    public void terminateObsoleteInstance(String memberId) {
    -        try {
    -            AutoscalerCloudControllerClient.getInstance().terminateInstance(memberId);
    -        } catch (Exception e) {
    -            log.error("Cannot terminate instance", e);
    -        }
    -    }
    -
    -    //Grouping
    -    public void delegateTerminateAll(String clusterId) {
    -        try {
    -            if (log.isDebugEnabled()) {
    -                log.debug("delegateTerminateAll - begin");
    -            }
    -            AutoscalerCloudControllerClient.getInstance().terminateAllInstances(clusterId);
    -            if (log.isDebugEnabled()) {
    -                log.debug("delegateTerminateAll - done");
    -            }
    -        } catch (Exception e) {
    -            log.error("Cannot terminate instance", e);
    -        }
    -    }
    -
    -    public int getPredictedReplicasForStat(int minReplicas, float statUpperLimit, float statPredictedValue) {
    -        if (statUpperLimit == 0) {
    -            return 0;
    -        }
    -        float predictedValue = ((minReplicas / statUpperLimit) * statPredictedValue);
    -        return (int) Math.ceil(predictedValue);
    -    }
    -
    -    public double getLoadAveragePredictedValue(ClusterInstanceContext clusterInstanceContext) {
    -        double loadAveragePredicted = 0.0d;
    -        int totalMemberCount = 0;
    -        for (ClusterLevelPartitionContext partitionContext : clusterInstanceContext.getPartitionCtxts()) {
    -            for (MemberStatsContext memberStatsContext : partitionContext.getMemberStatsContexts().values()) {
    -
    -                float memberAverageLoadAverage = memberStatsContext.getLoadAverage().getAverage();
    -                float memberGredientLoadAverage = memberStatsContext.getLoadAverage().getGradient();
    -                float memberSecondDerivativeLoadAverage = memberStatsContext.getLoadAverage().getSecondDerivative();
    -
    -                double memberPredictedLoadAverage = getPredictedValueForNextMinute(memberAverageLoadAverage,
    -                        memberGredientLoadAverage, memberSecondDerivativeLoadAverage, 1);
    -
    -                if (log.isDebugEnabled()) {
    -                    log.debug(String.format("[cluster-instance-id] %s [member-id] %s " +
    -                            "[predicted load average] %s "
    -                            , clusterInstanceContext.getId(), memberStatsContext.getMemberId()
    -                            , memberPredictedLoadAverage));
    -                }
    -                loadAveragePredicted += memberPredictedLoadAverage;
    -                ++totalMemberCount;
    -            }
    -        }
    -
    -        if (totalMemberCount > 0) {
    -            log.debug("Predicted load average : " + loadAveragePredicted / totalMemberCount);
    -            return loadAveragePredicted / totalMemberCount;
    -        } else {
    -            return 0;
    -        }
    -    }
    -
    -    public double getMemoryConsumptionPredictedValue(ClusterInstanceContext clusterInstanceContext) {
    -        double memoryConsumptionPredicted = 0.0d;
    -        int totalMemberCount = 0;
    -        for (ClusterLevelPartitionContext partitionContext : clusterInstanceContext.getPartitionCtxts()) {
    -            for (MemberStatsContext memberStatsContext : partitionContext.getMemberStatsContexts().values()) {
    -
    -                float memberMemoryConsumptionAverage = memberStatsContext.getMemoryConsumption().getAverage();
    -                float memberMemoryConsumptionGredient = memberStatsContext.getMemoryConsumption().getGradient();
    -                float memberMemoryConsumptionSecondDerivative = memberStatsContext.getMemoryConsumption().getSecondDerivative();
    -
    -                double memberPredictedMemoryConsumption = getPredictedValueForNextMinute(memberMemoryConsumptionAverage,
    -                        memberMemoryConsumptionGredient, memberMemoryConsumptionSecondDerivative, 1);
    -
    -                if (log.isDebugEnabled()) {
    -                    log.debug(String.format("[member-id] %s [predicted memory consumption] %s ",
    -                            memberStatsContext.getMemberId()
    -                            , memberPredictedMemoryConsumption));
    -                }
    -                memoryConsumptionPredicted += memberPredictedMemoryConsumption;
    -                ++totalMemberCount;
    -            }
    -        }
    -
    -        if (totalMemberCount > 0) {
    -            log.debug("Predicted memory consumption : " + memoryConsumptionPredicted / totalMemberCount);
    -            return memoryConsumptionPredicted / totalMemberCount;
    -        } else {
    -            return 0;
    -        }
    -    }
    +	private static boolean arspiIsSet = false;
    +
    +	private static final Log log = LogFactory.getLog(RuleTasksDelegator.class);
    +
    +	public double getPredictedValueForNextMinute(float average, float gradient, float secondDerivative,
    +	                                             int timeInterval) {
    +		double predictedValue;
    +		//        s = u * t + 0.5 * a * t * t
    +		if (log.isDebugEnabled()) {
    +			log.debug(String.format("Predicting the value, [average]: %s , [gradient]: %s , [second derivative] " +
    +			                        ": %s , [time intervals]: %s ", average, gradient, secondDerivative, timeInterval));
    +		}
    +		predictedValue = average + gradient * timeInterval + 0.5 * secondDerivative * timeInterval * timeInterval;
    +
    +		return predictedValue;
    +	}
    +
    +	public int getNumberOfInstancesRequiredBasedOnRif(float rifPredictedValue, float rifThreshold) {
    +
    +		if (rifThreshold != 0) {
    +
    +			float requiredNumberOfInstances = rifPredictedValue / rifThreshold;
    +			return (int) Math.ceil(requiredNumberOfInstances);
    +		} else {
    +			log.error("Request in flight threshold is Zero");
    +			return 0;
    +		}
    +
    +	}
    +
    +	public int getNumberOfInstancesRequiredBasedOnMemoryConsumption(float threshold, double predictedValue, int min,
    +	                                                                int max) {
    +		double numberOfAdditionalInstancesRequired = 0;
    +		if (predictedValue != threshold) {
    +
    +			float scalingRange = 100 - threshold;
    +			int instanceRange = max - min;
    +
    +			if (instanceRange != 0) {
    +
    +				float gradient = scalingRange / instanceRange;
    +				numberOfAdditionalInstancesRequired = (predictedValue - threshold) / gradient;
    +			}
    +
    +			if (predictedValue < threshold) {
    +				//Since predicted-value is less, it can be scale-down
    +				return min - 1;
    +			}
    +		}
    +
    +		return (int) Math.ceil(min + numberOfAdditionalInstancesRequired);
    +	}
    +
    +	public int getNumberOfInstancesRequiredBasedOnLoadAverage(float threshold, double predictedValue, int min) {
    +
    +		double numberOfInstances;
    +		if (threshold != 0) {
    +
    +			numberOfInstances = (min * predictedValue) / threshold;
    +			return (int) Math.ceil(numberOfInstances);
    +		}
    +
    +		return min;
    +	}
    +
    +	public int getMaxNumberOfInstancesRequired(int numberOfInstancesRequiredBasedOnRif,
    +	                                           int numberOfInstancesRequiredBasedOnMemoryConsumption, boolean mcReset,
    +	                                           int numberOfInstancesReuquiredBasedOnLoadAverage, boolean laReset) {
    +		int numberOfInstances = 0;
    +
    +		int rifBasedRequiredInstances = 0;
    +		int mcBasedRequiredInstances = 0;
    +		int laBasedRequiredInstances = 0;
    +		if (arspiIsSet) {
    +			rifBasedRequiredInstances = numberOfInstancesRequiredBasedOnRif;
    +		}
    +		if (mcReset) {
    +			mcBasedRequiredInstances = numberOfInstancesRequiredBasedOnMemoryConsumption;
    +		}
    +		if (laReset) {
    +			laBasedRequiredInstances = numberOfInstancesReuquiredBasedOnLoadAverage;
    +		}
    +		numberOfInstances = Math.max(Math.max(numberOfInstancesRequiredBasedOnMemoryConsumption,
    +		                                      numberOfInstancesReuquiredBasedOnLoadAverage),
    +		                             numberOfInstancesRequiredBasedOnRif);
    +		return numberOfInstances;
    +	}
    +
    +	public PartitionAlgorithm getPartitionAlgorithm(String partitionAlgorithm) {
    +
    +		PartitionAlgorithm autoscaleAlgorithm = null;
    +		//FIXME to not parse for algo when partition is chosen by the parent
    +
    +		if (partitionAlgorithm == null) {
    +			//Send one after another as default
    +			partitionAlgorithm = StratosConstants.PARTITION_ONE_AFTER_ANOTHER_ALGORITHM_ID;
    +		}
    +		if (log.isDebugEnabled()) {
    +			log.debug(String.format("Retrieving partition algorithm [Partition algorithm]: %s", partitionAlgorithm));
    +		}
    +		if (StratosConstants.PARTITION_ROUND_ROBIN_ALGORITHM_ID.equals(partitionAlgorithm)) {
    +			autoscaleAlgorithm = new RoundRobin();
    +		} else if (StratosConstants.PARTITION_ONE_AFTER_ANOTHER_ALGORITHM_ID.equals(partitionAlgorithm)) {
    +			autoscaleAlgorithm = new OneAfterAnother();
    +		} else {
    +			if (log.isErrorEnabled()) {
    +				log.error(String.format("Partition algorithm %s could not be identified !", partitionAlgorithm));
    +			}
    +		}
    +		return autoscaleAlgorithm;
    +	}
    +
    +	public void delegateInstanceCleanup(String memberId) {
    +		try {
    +			// send the instance notification event.
    +			InstanceNotificationPublisher.getInstance().sendInstanceCleanupEventForMember(memberId);
    +			log.info("Instance clean up event sent for [member] " + memberId);
    +
    +		} catch (Exception e) {
    +			log.error("Cannot terminate instance", e);
    +		}
    +	}
    +
    +	/**
    +	 * Invoked from drools to start an instance.
    +	 *
    +	 * @param clusterMonitorPartitionContext Cluster monitor partition context
    +	 * @param clusterId                      Cluster id
    +	 * @param clusterInstanceId              Instance id
    +	 * @param isPrimary                      Is a primary member
    +	 */
    +	public void delegateSpawn(ClusterLevelPartitionContext clusterMonitorPartitionContext, String clusterId,
    +	                          String clusterInstanceId, boolean isPrimary, String autoscalingReason, long scalingTime) {
    +
    +		try {
    +			String nwPartitionId = clusterMonitorPartitionContext.getNetworkPartitionId();
    +
    +			// Calculate accumulation of minimum counts of all the partition of current network partition
    +			int minimumCountOfNetworkPartition;
    +			ClusterMonitor clusterMonitor = AutoscalerContext.getInstance().getClusterMonitor(clusterId);
    +			ClusterContext clusterContext = clusterMonitor.getClusterContext();
    +			ClusterLevelNetworkPartitionContext clusterLevelNetworkPartitionContext =
    +					clusterContext.getNetworkPartitionCtxt(nwPartitionId);
    +			ClusterInstanceContext clusterInstanceContext =
    +					(ClusterInstanceContext) clusterLevelNetworkPartitionContext.
    +							                                                            getInstanceContext(
    +									                                                            clusterInstanceId);
    +			minimumCountOfNetworkPartition = clusterInstanceContext.getMinInstanceCount();
    +
    +			MemberContext memberContext = AutoscalerCloudControllerClient.getInstance().startInstance(
    +					clusterMonitorPartitionContext.getPartition(), clusterId, clusterInstanceId,
    +					clusterMonitorPartitionContext.getNetworkPartitionId(), isPrimary, minimumCountOfNetworkPartition,
    +					autoscalingReason, scalingTime);
    +			if (memberContext != null) {
    +				ClusterLevelPartitionContext partitionContext = clusterInstanceContext.
    +						                                                                      getPartitionCtxt(
    +								                                                                      clusterMonitorPartitionContext
    +										                                                                      .getPartitionId());
    +				partitionContext.addPendingMember(memberContext);
    +				partitionContext.addMemberStatsContext(new MemberStatsContext(memberContext.getMemberId()));
    +				if (log.isDebugEnabled()) {
    +					log.debug(String.format("Pending member added, [member] %s [partition] %s",
    +					                        memberContext.getMemberId(), memberContext.getPartition().getId()));
    +				}
    +
    +			} else {
    +				if (log.isErrorEnabled()) {
    +					log.error("Member context returned from cloud controller is null");
    +				}
    +			}
    +		} catch (Exception e) {
    +			String message = String.format("Could not start instance: [cluster-id] %s [instance-id] %s", clusterId,
    +			                               clusterInstanceId);
    +			log.error(message, e);
    +			throw new RuntimeException(message, e);
    +		}
    +	}
    +
    +	public void delegateScalingDependencyNotification(String clusterId, String networkPartitionId, String instanceId,
    +	                                                  int requiredInstanceCount, int minimumInstanceCount) {
    +
    +		if (log.isDebugEnabled()) {
    +			log.debug("Scaling dependent notification is going to the [parentInstance] " + instanceId);
    +		}
    +		//Notify parent for checking scaling dependencies
    +		ClusterMonitor clusterMonitor = AutoscalerContext.getInstance().getClusterMonitor(clusterId);
    +		float fMinimumInstanceCount = minimumInstanceCount;
    +		float factor = requiredInstanceCount / fMinimumInstanceCount;
    +		clusterMonitor.sendClusterScalingEvent(networkPartitionId, instanceId, factor);
    +	}
    +
    +	public void delegateScalingOverMaxNotification(String clusterId, String networkPartitionId, String instanceId) {
    +		if (log.isDebugEnabled()) {
    +			log.debug("Scaling max out notification is going to the [parentInstance] " + instanceId);
    +		}
    +		//Notify parent for checking scaling dependencies
    +		ClusterMonitor clusterMonitor = AutoscalerContext.getInstance().getClusterMonitor(clusterId);
    +		clusterMonitor.sendScalingOverMaxEvent(networkPartitionId, instanceId);
    +	}
    +
    +	public void delegateScalingDownBeyondMinNotification(String clusterId, String networkPartitionId,
    +	                                                     String instanceId) {
    +		if (log.isDebugEnabled()) {
    +			log.debug("Scaling down lower min notification is going to the [parentInstance] " + instanceId);
    +		}
    +		//Notify parent for checking scaling dependencies
    +		ClusterMonitor clusterMonitor = AutoscalerContext.getInstance().getClusterMonitor(clusterId);
    +		clusterMonitor.sendScalingDownBeyondMinEvent(networkPartitionId, instanceId);
    +	}
    +
    +	public void delegateTerminate(ClusterLevelPartitionContext clusterMonitorPartitionContext, String memberId) {
    +
    +		try {
    +			//Moving member to pending termination list
    +			if (clusterMonitorPartitionContext.activeMemberAvailable(memberId)) {
    +
    +				log.info(String.format("[scale-down] Moving active member to termination pending list [member id] %s " +
    +				                       "[partition] %s [network partition] %s", memberId,
    +				                       clusterMonitorPartitionContext.getPartitionId(),
    +				                       clusterMonitorPartitionContext.getNetworkPartitionId()));
    +				clusterMonitorPartitionContext.moveActiveMemberToTerminationPendingMembers(memberId);
    +				clusterMonitorPartitionContext.removeMemberStatsContext(memberId);
    +			} else if (clusterMonitorPartitionContext.pendingMemberAvailable(memberId)) {
    +
    +				log.info(String.format(
    +						"[scale-down] Moving pending member to termination pending list [member id] %s " +
    +						"[partition] %s [network partition] %s", memberId,
    +						clusterMonitorPartitionContext.getPartitionId(),
    +						clusterMonitorPartitionContext.getNetworkPartitionId()));
    +				clusterMonitorPartitionContext.movePendingMemberToObsoleteMembers(memberId);
    +				clusterMonitorPartitionContext.removeMemberStatsContext(memberId);
    +			}
    +		} catch (Exception e) {
    +			log.error("[scale-down] Cannot move member to termination pending list ", e);
    +		}
    +	}
    +
    +	public void delegateTerminateDependency(ClusterLevelPartitionContext clusterMonitorPartitionContext,
    +	                                        String memberId) {
    +		try {
    +			//calling SM to send the instance notification event.
    +			if (log.isDebugEnabled()) {
    +				log.debug("delegateTerminateDependency:memberId:" + memberId);
    +			}
    +			//InstanceNotificationClient.getInstance().sendMemberCleanupEvent(memberId);
    +			//partitionContext.moveActiveMemberToTerminationPendingMembers(memberId);
    --- End diff --
    
    It was already there that's why I didn't remove it. Now I've removed it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] stratos pull request: Data publisher integration

Posted by R-Rajkumar <gi...@git.apache.org>.
Github user R-Rajkumar commented on a diff in the pull request:

    https://github.com/apache/stratos/pull/403#discussion_r35234450
  
    --- Diff: components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/AutoscalerCloudControllerClient.java ---
    @@ -48,194 +48,205 @@
      */
     public class AutoscalerCloudControllerClient {
     
    -    private static final Log log = LogFactory.getLog(AutoscalerCloudControllerClient.class);
    -
    -    private static CloudControllerServiceStub stub;
    -
    -    /* An instance of a CloudControllerClient is created when the class is loaded. 
    -     * Since the class is loaded only once, it is guaranteed that an object of 
    -     * CloudControllerClient is created only once. Hence it is singleton.
    -     */
    -    private static class InstanceHolder {
    -        private static final AutoscalerCloudControllerClient INSTANCE = new AutoscalerCloudControllerClient();
    -    }
    -
    -    public static AutoscalerCloudControllerClient getInstance() {
    -        return InstanceHolder.INSTANCE;
    -    }
    -
    -    private AutoscalerCloudControllerClient() {
    -        try {
    -            XMLConfiguration conf = ConfUtil.getInstance(null).getConfiguration();
    -            int port = conf.getInt("autoscaler.cloudController.port", AutoscalerConstants.CLOUD_CONTROLLER_DEFAULT_PORT);
    -            String hostname = conf.getString("autoscaler.cloudController.hostname", "localhost");
    -            String epr = "https://" + hostname + ":" + port + "/" + AutoscalerConstants.CLOUD_CONTROLLER_SERVICE_SFX;
    -            int cloudControllerClientTimeout = conf.getInt("autoscaler.cloudController.clientTimeout", 180000);
    -
    -            stub = new CloudControllerServiceStub(epr);
    -            stub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT, cloudControllerClientTimeout);
    -            stub._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT,
    -                    cloudControllerClientTimeout);
    -        } catch (Exception e) {
    -            log.error("Could not initialize cloud controller client", e);
    -        }
    -    }
    -
    -    public synchronized MemberContext startInstance(PartitionRef partition,
    -                                                    String clusterId, String clusterInstanceId,
    -                                                    String networkPartitionId, boolean isPrimary,
    -                                                    int minMemberCount) throws SpawningException {
    -        try {
    -            if (log.isInfoEnabled()) {
    -                log.info(String.format("Trying to spawn an instance via cloud controller: " +
    -                                "[cluster] %s [partition] %s [network-partition-id] %s",
    -                        clusterId, partition.getId(), networkPartitionId));
    -            }
    -
    -            XMLConfiguration conf = ConfUtil.getInstance(null).getConfiguration();
    -            long expiryTime = conf.getLong(StratosConstants.OBSOLETED_MEMBER_EXPIRY_TIMEOUT, 86400000);
    -            if (log.isDebugEnabled()) {
    -                log.debug("Member obsolete expiry time is set to: " + expiryTime);
    -            }
    -
    -            InstanceContext instanceContext = new InstanceContext();
    -            instanceContext.setClusterId(clusterId);
    -            instanceContext.setClusterInstanceId(clusterInstanceId);
    -            instanceContext.setPartition(AutoscalerObjectConverter.convertPartitionToCCPartition(partition));
    -            instanceContext.setInitTime(System.currentTimeMillis());
    -            instanceContext.setObsoleteExpiryTime(expiryTime);
    -            instanceContext.setNetworkPartitionId(networkPartitionId);
    -
    -            Properties memberContextProps = new Properties();
    -            Property isPrimaryProp = new Property();
    -            isPrimaryProp.setName("PRIMARY");
    -            isPrimaryProp.setValue(String.valueOf(isPrimary));
    -
    -            Property minCountProp = new Property();
    -            minCountProp.setName(StratosConstants.MIN_COUNT);
    -            minCountProp.setValue(String.valueOf(minMemberCount));
    -
    -            memberContextProps.addProperty(isPrimaryProp);
    -            memberContextProps.addProperty(minCountProp);
    -            instanceContext.setProperties(AutoscalerUtil.toStubProperties(memberContextProps));
    -
    -            long startTime = System.currentTimeMillis();
    -            MemberContext memberContext = stub.startInstance(instanceContext);
    -
    -            if (log.isDebugEnabled()) {
    -                long endTime = System.currentTimeMillis();
    -                log.debug(String.format("Service call startInstance() returned in %dms", (endTime - startTime)));
    -            }
    -            return memberContext;
    -        } catch (CloudControllerServiceCartridgeNotFoundExceptionException e) {
    -            String message = e.getFaultMessage().getCartridgeNotFoundException().getMessage();
    -            log.error(message, e);
    -            throw new SpawningException(message, e);
    -        } catch (RemoteException e) {
    -            log.error(e.getMessage(), e);
    -            throw new SpawningException(e.getMessage(), e);
    -        } catch (CloudControllerServiceInvalidIaasProviderExceptionException e) {
    -            String message = e.getFaultMessage().getInvalidIaasProviderException().getMessage();
    -            log.error(message, e);
    -            throw new SpawningException(message, e);
    -        } catch (CloudControllerServiceCloudControllerExceptionException e) {
    -            String message = e.getMessage();
    -            log.error(message, e);
    -            throw new SpawningException(message, e);
    -        }
    -    }
    -
    -    public synchronized void createApplicationClusters(String appId,
    -                                                       ApplicationClusterContext[] applicationClusterContexts) {
    -        List<org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext> contextDTOs =
    -                new ArrayList<org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext>();
    -        if (applicationClusterContexts != null) {
    -            for (ApplicationClusterContext applicationClusterContext : applicationClusterContexts) {
    -                if (applicationClusterContext != null) {
    -                    org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext dto =
    -                            new org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext();
    -                    dto.setClusterId(applicationClusterContext.getClusterId());
    -                    dto.setAutoscalePolicyName(applicationClusterContext.getAutoscalePolicyName());
    -                    dto.setDeploymentPolicyName(applicationClusterContext.getDeploymentPolicyName());
    -                    dto.setCartridgeType(applicationClusterContext.getCartridgeType());
    -                    dto.setHostName(applicationClusterContext.getHostName());
    -                    dto.setTenantRange(applicationClusterContext.getTenantRange());
    -                    dto.setTextPayload(applicationClusterContext.getTextPayload());
    -                    dto.setProperties(AutoscalerUtil.toStubProperties(applicationClusterContext.getProperties()));
    -                    dto.setDependencyClusterIds(applicationClusterContext.getDependencyClusterIds());
    -                    if (applicationClusterContext.getPersistenceContext() != null) {
    -                        dto.setVolumeRequired(true);
    -                        dto.setVolumes(convertVolumesToStubVolumes(
    -                                applicationClusterContext.getPersistenceContext().getVolumes()));
    -                    }
    -                    contextDTOs.add(dto);
    -                }
    -            }
    -        }
    -
    -        org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext[] applicationClusterContextDTOs =
    -                new org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext[contextDTOs.size()];
    -        contextDTOs.toArray(applicationClusterContextDTOs);
    -        try {
    -            stub.createApplicationClusters(appId, applicationClusterContextDTOs);
    -        } catch (RemoteException e) {
    -            String msg = e.getMessage();
    -            log.error(msg, e);
    -        } catch (CloudControllerServiceApplicationClusterRegistrationExceptionException e) {
    -            String msg = e.getMessage();
    -            log.error(msg, e);
    -        }
    -    }
    -
    -
    -    private Volume[] convertVolumesToStubVolumes(VolumeContext[] volumeContexts) {
    -
    -        ArrayList<Volume> volumes = new ArrayList<Volume>();
    -        for (VolumeContext volumeContext : volumeContexts) {
    -            Volume volume = new Volume();
    -            volume.setRemoveOntermination(volumeContext.isRemoveOntermination());
    -            volume.setMappingPath(volumeContext.getMappingPath());
    -            volume.setId(volumeContext.getId());
    -            volume.setDevice(volumeContext.getDevice());
    -            volume.setIaasType(volumeContext.getIaasType());
    -            volume.setSnapshotId(volumeContext.getSnapshotId());
    -            volume.setVolumeId(volumeContext.getVolumeId());
    -            volume.setSize(volumeContext.getSize());
    -            volumes.add(volume);
    -        }
    -        return volumes.toArray(new Volume[volumes.size()]);
    -    }
    -
    -    public void terminateInstance(String memberId) throws Exception {
    -        if (log.isInfoEnabled()) {
    -            log.info(String.format("Terminating instance via cloud controller: [member] %s", memberId));
    -        }
    -        long startTime = System.currentTimeMillis();
    -        stub.terminateInstance(memberId);
    -        if (log.isDebugEnabled()) {
    -            long endTime = System.currentTimeMillis();
    -            log.debug(String.format("Service call terminateInstance() returned in %dms", (endTime - startTime)));
    -        }
    -    }
    -
    -    public void terminateInstanceForcefully(String memberId) throws Exception {
    -        if (log.isDebugEnabled()) {
    -            log.debug(String.format("Terminating instance forcefully via cloud controller: [member] %s", memberId));
    -        }
    -        stub.terminateInstanceForcefully(memberId);
    -    }
    -
    -    public void terminateAllInstances(String clusterId) throws RemoteException,
    -            CloudControllerServiceInvalidClusterExceptionException {
    -        if (log.isInfoEnabled()) {
    -            log.info(String.format("Terminating all instances of cluster via cloud controller: [cluster] %s", clusterId));
    -        }
    -        long startTime = System.currentTimeMillis();
    -        stub.terminateInstances(clusterId);
    -
    -        if (log.isDebugEnabled()) {
    -            long endTime = System.currentTimeMillis();
    -            log.debug(String.format("Service call terminateInstances() returned in %dms", (endTime - startTime)));
    -        }
    -    }
    +	private static final Log log = LogFactory.getLog(AutoscalerCloudControllerClient.class);
    +
    +	private static CloudControllerServiceStub stub;
    +
    +	/* An instance of a CloudControllerClient is created when the class is loaded.
    +	 * Since the class is loaded only once, it is guaranteed that an object of
    +	 * CloudControllerClient is created only once. Hence it is singleton.
    +	 */
    +	private static class InstanceHolder {
    +		private static final AutoscalerCloudControllerClient INSTANCE = new AutoscalerCloudControllerClient();
    +	}
    --- End diff --
    
    I know this code is there from the beginning. But why do we need this inner class? IMO, we don't need an inner class to make a parent class a singleton.  


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] stratos pull request: Data publisher integration

Posted by R-Rajkumar <gi...@git.apache.org>.
Github user R-Rajkumar commented on a diff in the pull request:

    https://github.com/apache/stratos/pull/403#discussion_r35233816
  
    --- Diff: DAS-Artifacts/CCEventReceiver.xml ---
    @@ -0,0 +1,9 @@
    +<?xml version="1.0" encoding="UTF-8"?>
    --- End diff --
    
    don't we need to add the licence header here?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] stratos pull request: Data publisher integration

Posted by R-Rajkumar <gi...@git.apache.org>.
Github user R-Rajkumar commented on a diff in the pull request:

    https://github.com/apache/stratos/pull/403#discussion_r35235134
  
    --- Diff: components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/AutoscalerCloudControllerClient.java ---
    @@ -48,194 +48,205 @@
      */
     public class AutoscalerCloudControllerClient {
     
    -    private static final Log log = LogFactory.getLog(AutoscalerCloudControllerClient.class);
    -
    -    private static CloudControllerServiceStub stub;
    -
    -    /* An instance of a CloudControllerClient is created when the class is loaded. 
    -     * Since the class is loaded only once, it is guaranteed that an object of 
    -     * CloudControllerClient is created only once. Hence it is singleton.
    -     */
    -    private static class InstanceHolder {
    -        private static final AutoscalerCloudControllerClient INSTANCE = new AutoscalerCloudControllerClient();
    -    }
    -
    -    public static AutoscalerCloudControllerClient getInstance() {
    -        return InstanceHolder.INSTANCE;
    -    }
    -
    -    private AutoscalerCloudControllerClient() {
    -        try {
    -            XMLConfiguration conf = ConfUtil.getInstance(null).getConfiguration();
    -            int port = conf.getInt("autoscaler.cloudController.port", AutoscalerConstants.CLOUD_CONTROLLER_DEFAULT_PORT);
    -            String hostname = conf.getString("autoscaler.cloudController.hostname", "localhost");
    -            String epr = "https://" + hostname + ":" + port + "/" + AutoscalerConstants.CLOUD_CONTROLLER_SERVICE_SFX;
    -            int cloudControllerClientTimeout = conf.getInt("autoscaler.cloudController.clientTimeout", 180000);
    -
    -            stub = new CloudControllerServiceStub(epr);
    -            stub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT, cloudControllerClientTimeout);
    -            stub._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT,
    -                    cloudControllerClientTimeout);
    -        } catch (Exception e) {
    -            log.error("Could not initialize cloud controller client", e);
    -        }
    -    }
    -
    -    public synchronized MemberContext startInstance(PartitionRef partition,
    -                                                    String clusterId, String clusterInstanceId,
    -                                                    String networkPartitionId, boolean isPrimary,
    -                                                    int minMemberCount) throws SpawningException {
    -        try {
    -            if (log.isInfoEnabled()) {
    -                log.info(String.format("Trying to spawn an instance via cloud controller: " +
    -                                "[cluster] %s [partition] %s [network-partition-id] %s",
    -                        clusterId, partition.getId(), networkPartitionId));
    -            }
    -
    -            XMLConfiguration conf = ConfUtil.getInstance(null).getConfiguration();
    -            long expiryTime = conf.getLong(StratosConstants.OBSOLETED_MEMBER_EXPIRY_TIMEOUT, 86400000);
    -            if (log.isDebugEnabled()) {
    -                log.debug("Member obsolete expiry time is set to: " + expiryTime);
    -            }
    -
    -            InstanceContext instanceContext = new InstanceContext();
    -            instanceContext.setClusterId(clusterId);
    -            instanceContext.setClusterInstanceId(clusterInstanceId);
    -            instanceContext.setPartition(AutoscalerObjectConverter.convertPartitionToCCPartition(partition));
    -            instanceContext.setInitTime(System.currentTimeMillis());
    -            instanceContext.setObsoleteExpiryTime(expiryTime);
    -            instanceContext.setNetworkPartitionId(networkPartitionId);
    -
    -            Properties memberContextProps = new Properties();
    -            Property isPrimaryProp = new Property();
    -            isPrimaryProp.setName("PRIMARY");
    -            isPrimaryProp.setValue(String.valueOf(isPrimary));
    -
    -            Property minCountProp = new Property();
    -            minCountProp.setName(StratosConstants.MIN_COUNT);
    -            minCountProp.setValue(String.valueOf(minMemberCount));
    -
    -            memberContextProps.addProperty(isPrimaryProp);
    -            memberContextProps.addProperty(minCountProp);
    -            instanceContext.setProperties(AutoscalerUtil.toStubProperties(memberContextProps));
    -
    -            long startTime = System.currentTimeMillis();
    -            MemberContext memberContext = stub.startInstance(instanceContext);
    -
    -            if (log.isDebugEnabled()) {
    -                long endTime = System.currentTimeMillis();
    -                log.debug(String.format("Service call startInstance() returned in %dms", (endTime - startTime)));
    -            }
    -            return memberContext;
    -        } catch (CloudControllerServiceCartridgeNotFoundExceptionException e) {
    -            String message = e.getFaultMessage().getCartridgeNotFoundException().getMessage();
    -            log.error(message, e);
    -            throw new SpawningException(message, e);
    -        } catch (RemoteException e) {
    -            log.error(e.getMessage(), e);
    -            throw new SpawningException(e.getMessage(), e);
    -        } catch (CloudControllerServiceInvalidIaasProviderExceptionException e) {
    -            String message = e.getFaultMessage().getInvalidIaasProviderException().getMessage();
    -            log.error(message, e);
    -            throw new SpawningException(message, e);
    -        } catch (CloudControllerServiceCloudControllerExceptionException e) {
    -            String message = e.getMessage();
    -            log.error(message, e);
    -            throw new SpawningException(message, e);
    -        }
    -    }
    -
    -    public synchronized void createApplicationClusters(String appId,
    -                                                       ApplicationClusterContext[] applicationClusterContexts) {
    -        List<org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext> contextDTOs =
    -                new ArrayList<org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext>();
    -        if (applicationClusterContexts != null) {
    -            for (ApplicationClusterContext applicationClusterContext : applicationClusterContexts) {
    -                if (applicationClusterContext != null) {
    -                    org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext dto =
    -                            new org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext();
    -                    dto.setClusterId(applicationClusterContext.getClusterId());
    -                    dto.setAutoscalePolicyName(applicationClusterContext.getAutoscalePolicyName());
    -                    dto.setDeploymentPolicyName(applicationClusterContext.getDeploymentPolicyName());
    -                    dto.setCartridgeType(applicationClusterContext.getCartridgeType());
    -                    dto.setHostName(applicationClusterContext.getHostName());
    -                    dto.setTenantRange(applicationClusterContext.getTenantRange());
    -                    dto.setTextPayload(applicationClusterContext.getTextPayload());
    -                    dto.setProperties(AutoscalerUtil.toStubProperties(applicationClusterContext.getProperties()));
    -                    dto.setDependencyClusterIds(applicationClusterContext.getDependencyClusterIds());
    -                    if (applicationClusterContext.getPersistenceContext() != null) {
    -                        dto.setVolumeRequired(true);
    -                        dto.setVolumes(convertVolumesToStubVolumes(
    -                                applicationClusterContext.getPersistenceContext().getVolumes()));
    -                    }
    -                    contextDTOs.add(dto);
    -                }
    -            }
    -        }
    -
    -        org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext[] applicationClusterContextDTOs =
    -                new org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext[contextDTOs.size()];
    -        contextDTOs.toArray(applicationClusterContextDTOs);
    -        try {
    -            stub.createApplicationClusters(appId, applicationClusterContextDTOs);
    -        } catch (RemoteException e) {
    -            String msg = e.getMessage();
    -            log.error(msg, e);
    -        } catch (CloudControllerServiceApplicationClusterRegistrationExceptionException e) {
    -            String msg = e.getMessage();
    -            log.error(msg, e);
    -        }
    -    }
    -
    -
    -    private Volume[] convertVolumesToStubVolumes(VolumeContext[] volumeContexts) {
    -
    -        ArrayList<Volume> volumes = new ArrayList<Volume>();
    -        for (VolumeContext volumeContext : volumeContexts) {
    -            Volume volume = new Volume();
    -            volume.setRemoveOntermination(volumeContext.isRemoveOntermination());
    -            volume.setMappingPath(volumeContext.getMappingPath());
    -            volume.setId(volumeContext.getId());
    -            volume.setDevice(volumeContext.getDevice());
    -            volume.setIaasType(volumeContext.getIaasType());
    -            volume.setSnapshotId(volumeContext.getSnapshotId());
    -            volume.setVolumeId(volumeContext.getVolumeId());
    -            volume.setSize(volumeContext.getSize());
    -            volumes.add(volume);
    -        }
    -        return volumes.toArray(new Volume[volumes.size()]);
    -    }
    -
    -    public void terminateInstance(String memberId) throws Exception {
    -        if (log.isInfoEnabled()) {
    -            log.info(String.format("Terminating instance via cloud controller: [member] %s", memberId));
    -        }
    -        long startTime = System.currentTimeMillis();
    -        stub.terminateInstance(memberId);
    -        if (log.isDebugEnabled()) {
    -            long endTime = System.currentTimeMillis();
    -            log.debug(String.format("Service call terminateInstance() returned in %dms", (endTime - startTime)));
    -        }
    -    }
    -
    -    public void terminateInstanceForcefully(String memberId) throws Exception {
    -        if (log.isDebugEnabled()) {
    -            log.debug(String.format("Terminating instance forcefully via cloud controller: [member] %s", memberId));
    -        }
    -        stub.terminateInstanceForcefully(memberId);
    -    }
    -
    -    public void terminateAllInstances(String clusterId) throws RemoteException,
    -            CloudControllerServiceInvalidClusterExceptionException {
    -        if (log.isInfoEnabled()) {
    -            log.info(String.format("Terminating all instances of cluster via cloud controller: [cluster] %s", clusterId));
    -        }
    -        long startTime = System.currentTimeMillis();
    -        stub.terminateInstances(clusterId);
    -
    -        if (log.isDebugEnabled()) {
    -            long endTime = System.currentTimeMillis();
    -            log.debug(String.format("Service call terminateInstances() returned in %dms", (endTime - startTime)));
    -        }
    -    }
    +	private static final Log log = LogFactory.getLog(AutoscalerCloudControllerClient.class);
    +
    +	private static CloudControllerServiceStub stub;
    +
    +	/* An instance of a CloudControllerClient is created when the class is loaded.
    +	 * Since the class is loaded only once, it is guaranteed that an object of
    +	 * CloudControllerClient is created only once. Hence it is singleton.
    +	 */
    +	private static class InstanceHolder {
    +		private static final AutoscalerCloudControllerClient INSTANCE = new AutoscalerCloudControllerClient();
    +	}
    +
    +	public static AutoscalerCloudControllerClient getInstance() {
    +		return InstanceHolder.INSTANCE;
    +	}
    +
    +	private AutoscalerCloudControllerClient() {
    +		try {
    +			XMLConfiguration conf = ConfUtil.getInstance(null).getConfiguration();
    +			int port =
    +					conf.getInt("autoscaler.cloudController.port", AutoscalerConstants.CLOUD_CONTROLLER_DEFAULT_PORT);
    +			String hostname = conf.getString("autoscaler.cloudController.hostname", "localhost");
    +			String epr = "https://" + hostname + ":" + port + "/" + AutoscalerConstants.CLOUD_CONTROLLER_SERVICE_SFX;
    +			int cloudControllerClientTimeout = conf.getInt("autoscaler.cloudController.clientTimeout", 180000);
    +
    +			stub = new CloudControllerServiceStub(epr);
    +			stub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT, cloudControllerClientTimeout);
    +			stub._getServiceClient().getOptions()
    +			    .setProperty(HTTPConstants.CONNECTION_TIMEOUT, cloudControllerClientTimeout);
    +		} catch (Exception e) {
    +			log.error("Could not initialize cloud controller client", e);
    +		}
    +	}
    +
    +	public synchronized MemberContext startInstance(PartitionRef partition, String clusterId, String clusterInstanceId,
    +	                                                String networkPartitionId, boolean isPrimary, int minMemberCount,
    +	                                                String autoscalingReason, long scalingTime)
    +			throws SpawningException {
    +		try {
    +			if (log.isInfoEnabled()) {
    +				log.info(String.format("Trying to spawn an instance via cloud controller: " +
    +				                       "[cluster] %s [partition] %s [network-partition-id] %s", clusterId,
    +				                       partition.getId(), networkPartitionId));
    +			}
    +
    +			XMLConfiguration conf = ConfUtil.getInstance(null).getConfiguration();
    +			long expiryTime = conf.getLong(StratosConstants.OBSOLETED_MEMBER_EXPIRY_TIMEOUT, 86400000);
    +			if (log.isDebugEnabled()) {
    +				log.debug("Member obsolete expiry time is set to: " + expiryTime);
    +			}
    +
    +			InstanceContext instanceContext = new InstanceContext();
    +			instanceContext.setClusterId(clusterId);
    +			instanceContext.setClusterInstanceId(clusterInstanceId);
    +			instanceContext.setPartition(AutoscalerObjectConverter.convertPartitionToCCPartition(partition));
    +			instanceContext.setInitTime(System.currentTimeMillis());
    +			instanceContext.setObsoleteExpiryTime(expiryTime);
    +			instanceContext.setNetworkPartitionId(networkPartitionId);
    +
    +			Properties memberContextProps = new Properties();
    +			Property isPrimaryProp = new Property();
    +			isPrimaryProp.setName("PRIMARY");
    +			isPrimaryProp.setValue(String.valueOf(isPrimary));
    --- End diff --
    
    what is this PRIMARY property? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] stratos pull request: Data publisher integration

Posted by Thanu <gi...@git.apache.org>.
Github user Thanu commented on a diff in the pull request:

    https://github.com/apache/stratos/pull/403#discussion_r35297343
  
    --- Diff: components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/AutoscalerCloudControllerClient.java ---
    @@ -48,194 +48,205 @@
      */
     public class AutoscalerCloudControllerClient {
     
    -    private static final Log log = LogFactory.getLog(AutoscalerCloudControllerClient.class);
    -
    -    private static CloudControllerServiceStub stub;
    -
    -    /* An instance of a CloudControllerClient is created when the class is loaded. 
    -     * Since the class is loaded only once, it is guaranteed that an object of 
    -     * CloudControllerClient is created only once. Hence it is singleton.
    -     */
    -    private static class InstanceHolder {
    -        private static final AutoscalerCloudControllerClient INSTANCE = new AutoscalerCloudControllerClient();
    -    }
    -
    -    public static AutoscalerCloudControllerClient getInstance() {
    -        return InstanceHolder.INSTANCE;
    -    }
    -
    -    private AutoscalerCloudControllerClient() {
    -        try {
    -            XMLConfiguration conf = ConfUtil.getInstance(null).getConfiguration();
    -            int port = conf.getInt("autoscaler.cloudController.port", AutoscalerConstants.CLOUD_CONTROLLER_DEFAULT_PORT);
    -            String hostname = conf.getString("autoscaler.cloudController.hostname", "localhost");
    -            String epr = "https://" + hostname + ":" + port + "/" + AutoscalerConstants.CLOUD_CONTROLLER_SERVICE_SFX;
    -            int cloudControllerClientTimeout = conf.getInt("autoscaler.cloudController.clientTimeout", 180000);
    -
    -            stub = new CloudControllerServiceStub(epr);
    -            stub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT, cloudControllerClientTimeout);
    -            stub._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT,
    -                    cloudControllerClientTimeout);
    -        } catch (Exception e) {
    -            log.error("Could not initialize cloud controller client", e);
    -        }
    -    }
    -
    -    public synchronized MemberContext startInstance(PartitionRef partition,
    -                                                    String clusterId, String clusterInstanceId,
    -                                                    String networkPartitionId, boolean isPrimary,
    -                                                    int minMemberCount) throws SpawningException {
    -        try {
    -            if (log.isInfoEnabled()) {
    -                log.info(String.format("Trying to spawn an instance via cloud controller: " +
    -                                "[cluster] %s [partition] %s [network-partition-id] %s",
    -                        clusterId, partition.getId(), networkPartitionId));
    -            }
    -
    -            XMLConfiguration conf = ConfUtil.getInstance(null).getConfiguration();
    -            long expiryTime = conf.getLong(StratosConstants.OBSOLETED_MEMBER_EXPIRY_TIMEOUT, 86400000);
    -            if (log.isDebugEnabled()) {
    -                log.debug("Member obsolete expiry time is set to: " + expiryTime);
    -            }
    -
    -            InstanceContext instanceContext = new InstanceContext();
    -            instanceContext.setClusterId(clusterId);
    -            instanceContext.setClusterInstanceId(clusterInstanceId);
    -            instanceContext.setPartition(AutoscalerObjectConverter.convertPartitionToCCPartition(partition));
    -            instanceContext.setInitTime(System.currentTimeMillis());
    -            instanceContext.setObsoleteExpiryTime(expiryTime);
    -            instanceContext.setNetworkPartitionId(networkPartitionId);
    -
    -            Properties memberContextProps = new Properties();
    -            Property isPrimaryProp = new Property();
    -            isPrimaryProp.setName("PRIMARY");
    -            isPrimaryProp.setValue(String.valueOf(isPrimary));
    -
    -            Property minCountProp = new Property();
    -            minCountProp.setName(StratosConstants.MIN_COUNT);
    -            minCountProp.setValue(String.valueOf(minMemberCount));
    -
    -            memberContextProps.addProperty(isPrimaryProp);
    -            memberContextProps.addProperty(minCountProp);
    -            instanceContext.setProperties(AutoscalerUtil.toStubProperties(memberContextProps));
    -
    -            long startTime = System.currentTimeMillis();
    -            MemberContext memberContext = stub.startInstance(instanceContext);
    -
    -            if (log.isDebugEnabled()) {
    -                long endTime = System.currentTimeMillis();
    -                log.debug(String.format("Service call startInstance() returned in %dms", (endTime - startTime)));
    -            }
    -            return memberContext;
    -        } catch (CloudControllerServiceCartridgeNotFoundExceptionException e) {
    -            String message = e.getFaultMessage().getCartridgeNotFoundException().getMessage();
    -            log.error(message, e);
    -            throw new SpawningException(message, e);
    -        } catch (RemoteException e) {
    -            log.error(e.getMessage(), e);
    -            throw new SpawningException(e.getMessage(), e);
    -        } catch (CloudControllerServiceInvalidIaasProviderExceptionException e) {
    -            String message = e.getFaultMessage().getInvalidIaasProviderException().getMessage();
    -            log.error(message, e);
    -            throw new SpawningException(message, e);
    -        } catch (CloudControllerServiceCloudControllerExceptionException e) {
    -            String message = e.getMessage();
    -            log.error(message, e);
    -            throw new SpawningException(message, e);
    -        }
    -    }
    -
    -    public synchronized void createApplicationClusters(String appId,
    -                                                       ApplicationClusterContext[] applicationClusterContexts) {
    -        List<org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext> contextDTOs =
    -                new ArrayList<org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext>();
    -        if (applicationClusterContexts != null) {
    -            for (ApplicationClusterContext applicationClusterContext : applicationClusterContexts) {
    -                if (applicationClusterContext != null) {
    -                    org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext dto =
    -                            new org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext();
    -                    dto.setClusterId(applicationClusterContext.getClusterId());
    -                    dto.setAutoscalePolicyName(applicationClusterContext.getAutoscalePolicyName());
    -                    dto.setDeploymentPolicyName(applicationClusterContext.getDeploymentPolicyName());
    -                    dto.setCartridgeType(applicationClusterContext.getCartridgeType());
    -                    dto.setHostName(applicationClusterContext.getHostName());
    -                    dto.setTenantRange(applicationClusterContext.getTenantRange());
    -                    dto.setTextPayload(applicationClusterContext.getTextPayload());
    -                    dto.setProperties(AutoscalerUtil.toStubProperties(applicationClusterContext.getProperties()));
    -                    dto.setDependencyClusterIds(applicationClusterContext.getDependencyClusterIds());
    -                    if (applicationClusterContext.getPersistenceContext() != null) {
    -                        dto.setVolumeRequired(true);
    -                        dto.setVolumes(convertVolumesToStubVolumes(
    -                                applicationClusterContext.getPersistenceContext().getVolumes()));
    -                    }
    -                    contextDTOs.add(dto);
    -                }
    -            }
    -        }
    -
    -        org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext[] applicationClusterContextDTOs =
    -                new org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext[contextDTOs.size()];
    -        contextDTOs.toArray(applicationClusterContextDTOs);
    -        try {
    -            stub.createApplicationClusters(appId, applicationClusterContextDTOs);
    -        } catch (RemoteException e) {
    -            String msg = e.getMessage();
    -            log.error(msg, e);
    -        } catch (CloudControllerServiceApplicationClusterRegistrationExceptionException e) {
    -            String msg = e.getMessage();
    -            log.error(msg, e);
    -        }
    -    }
    -
    -
    -    private Volume[] convertVolumesToStubVolumes(VolumeContext[] volumeContexts) {
    -
    -        ArrayList<Volume> volumes = new ArrayList<Volume>();
    -        for (VolumeContext volumeContext : volumeContexts) {
    -            Volume volume = new Volume();
    -            volume.setRemoveOntermination(volumeContext.isRemoveOntermination());
    -            volume.setMappingPath(volumeContext.getMappingPath());
    -            volume.setId(volumeContext.getId());
    -            volume.setDevice(volumeContext.getDevice());
    -            volume.setIaasType(volumeContext.getIaasType());
    -            volume.setSnapshotId(volumeContext.getSnapshotId());
    -            volume.setVolumeId(volumeContext.getVolumeId());
    -            volume.setSize(volumeContext.getSize());
    -            volumes.add(volume);
    -        }
    -        return volumes.toArray(new Volume[volumes.size()]);
    -    }
    -
    -    public void terminateInstance(String memberId) throws Exception {
    -        if (log.isInfoEnabled()) {
    -            log.info(String.format("Terminating instance via cloud controller: [member] %s", memberId));
    -        }
    -        long startTime = System.currentTimeMillis();
    -        stub.terminateInstance(memberId);
    -        if (log.isDebugEnabled()) {
    -            long endTime = System.currentTimeMillis();
    -            log.debug(String.format("Service call terminateInstance() returned in %dms", (endTime - startTime)));
    -        }
    -    }
    -
    -    public void terminateInstanceForcefully(String memberId) throws Exception {
    -        if (log.isDebugEnabled()) {
    -            log.debug(String.format("Terminating instance forcefully via cloud controller: [member] %s", memberId));
    -        }
    -        stub.terminateInstanceForcefully(memberId);
    -    }
    -
    -    public void terminateAllInstances(String clusterId) throws RemoteException,
    -            CloudControllerServiceInvalidClusterExceptionException {
    -        if (log.isInfoEnabled()) {
    -            log.info(String.format("Terminating all instances of cluster via cloud controller: [cluster] %s", clusterId));
    -        }
    -        long startTime = System.currentTimeMillis();
    -        stub.terminateInstances(clusterId);
    -
    -        if (log.isDebugEnabled()) {
    -            long endTime = System.currentTimeMillis();
    -            log.debug(String.format("Service call terminateInstances() returned in %dms", (endTime - startTime)));
    -        }
    -    }
    +	private static final Log log = LogFactory.getLog(AutoscalerCloudControllerClient.class);
    +
    +	private static CloudControllerServiceStub stub;
    +
    +	/* An instance of a CloudControllerClient is created when the class is loaded.
    +	 * Since the class is loaded only once, it is guaranteed that an object of
    +	 * CloudControllerClient is created only once. Hence it is singleton.
    +	 */
    +	private static class InstanceHolder {
    +		private static final AutoscalerCloudControllerClient INSTANCE = new AutoscalerCloudControllerClient();
    +	}
    +
    +	public static AutoscalerCloudControllerClient getInstance() {
    +		return InstanceHolder.INSTANCE;
    +	}
    +
    +	private AutoscalerCloudControllerClient() {
    +		try {
    +			XMLConfiguration conf = ConfUtil.getInstance(null).getConfiguration();
    +			int port =
    +					conf.getInt("autoscaler.cloudController.port", AutoscalerConstants.CLOUD_CONTROLLER_DEFAULT_PORT);
    +			String hostname = conf.getString("autoscaler.cloudController.hostname", "localhost");
    +			String epr = "https://" + hostname + ":" + port + "/" + AutoscalerConstants.CLOUD_CONTROLLER_SERVICE_SFX;
    +			int cloudControllerClientTimeout = conf.getInt("autoscaler.cloudController.clientTimeout", 180000);
    +
    +			stub = new CloudControllerServiceStub(epr);
    +			stub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT, cloudControllerClientTimeout);
    +			stub._getServiceClient().getOptions()
    +			    .setProperty(HTTPConstants.CONNECTION_TIMEOUT, cloudControllerClientTimeout);
    +		} catch (Exception e) {
    +			log.error("Could not initialize cloud controller client", e);
    +		}
    +	}
    +
    +	public synchronized MemberContext startInstance(PartitionRef partition, String clusterId, String clusterInstanceId,
    +	                                                String networkPartitionId, boolean isPrimary, int minMemberCount,
    +	                                                String autoscalingReason, long scalingTime)
    +			throws SpawningException {
    +		try {
    +			if (log.isInfoEnabled()) {
    +				log.info(String.format("Trying to spawn an instance via cloud controller: " +
    +				                       "[cluster] %s [partition] %s [network-partition-id] %s", clusterId,
    +				                       partition.getId(), networkPartitionId));
    +			}
    +
    +			XMLConfiguration conf = ConfUtil.getInstance(null).getConfiguration();
    +			long expiryTime = conf.getLong(StratosConstants.OBSOLETED_MEMBER_EXPIRY_TIMEOUT, 86400000);
    +			if (log.isDebugEnabled()) {
    +				log.debug("Member obsolete expiry time is set to: " + expiryTime);
    +			}
    +
    +			InstanceContext instanceContext = new InstanceContext();
    +			instanceContext.setClusterId(clusterId);
    +			instanceContext.setClusterInstanceId(clusterInstanceId);
    +			instanceContext.setPartition(AutoscalerObjectConverter.convertPartitionToCCPartition(partition));
    +			instanceContext.setInitTime(System.currentTimeMillis());
    +			instanceContext.setObsoleteExpiryTime(expiryTime);
    +			instanceContext.setNetworkPartitionId(networkPartitionId);
    +
    +			Properties memberContextProps = new Properties();
    +			Property isPrimaryProp = new Property();
    +			isPrimaryProp.setName("PRIMARY");
    +			isPrimaryProp.setValue(String.valueOf(isPrimary));
    --- End diff --
    
    It was already there but it is not used. I'll remove it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] stratos pull request: Data publisher integration

Posted by R-Rajkumar <gi...@git.apache.org>.
Github user R-Rajkumar commented on a diff in the pull request:

    https://github.com/apache/stratos/pull/403#discussion_r35233874
  
    --- Diff: DAS-Artifacts/CCEventReceiver.xml ---
    @@ -0,0 +1,9 @@
    +<?xml version="1.0" encoding="UTF-8"?>
    +<eventReceiver name="CCEventReceiver" statistics="disable"
    +    trace="enable" xmlns="http://wso2.org/carbon/eventreceiver">
    +    <from eventAdapterType="wso2event">
    +        <property name="events.duplicated.in.cluster">false</property>
    +    </from>
    +    <mapping customMapping="disable" type="wso2event"/>
    +    <to streamName="org.apache.stratos.cloud.controller" version="1.0.0"/>
    +</eventReceiver>
    --- End diff --
    
    don't we need to add a licence header to this file?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] stratos pull request: Data publisher integration

Posted by Thanu <gi...@git.apache.org>.
Github user Thanu closed the pull request at:

    https://github.com/apache/stratos/pull/403


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] stratos pull request: Data publisher integration

Posted by imesh <gi...@git.apache.org>.
Github user imesh commented on the pull request:

    https://github.com/apache/stratos/pull/403#issuecomment-124285589
  
    Thanuja: Please provide a description for your pull request explaining features that you have implemented. As I can see there is a problem in your commits, it cannot be merged:



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] stratos pull request: Data publisher integration

Posted by lahirus <gi...@git.apache.org>.
Github user lahirus commented on the pull request:

    https://github.com/apache/stratos/pull/403#issuecomment-123775024
  
    Is it possible to avoid jar file?( DAS-Artifacts/sparkudf-1.0-SNAPSHOT.jar)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] stratos pull request: Data publisher integration

Posted by Thanu <gi...@git.apache.org>.
Github user Thanu commented on a diff in the pull request:

    https://github.com/apache/stratos/pull/403#discussion_r35297243
  
    --- Diff: components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerConstants.java ---
    @@ -24,281 +24,267 @@
     
     public final class CloudControllerConstants {
     
    -    /**
    -     * cloud-controller XML file's elements
    -     */
    -    public static final String CLOUD_CONTROLLER_ELEMENT = "cloudController";
    -    public static final String SERIALIZATION_DIR_ELEMENT = "serializationDir";
    -    public static final String IAAS_PROVIDERS_ELEMENT = "iaasProviders";
    -    public static final String IAAS_PROVIDER_ELEMENT = "iaasProvider";
    -    public static final String PARTITION_ELEMENT = "partition";
    -    public static final String PARTITIONS_ELEMENT = "partitions";
    -    public static final String REGION_ELEMENT = "region";
    -    public static final String ZONE_ELEMENT = "zone";
    -    public static final String DEPLOYMENT_ELEMENT = "deployment";
    -    public static final String PORT_MAPPING_ELEMENT = "portMapping";
    -    public static final String APP_TYPES_ELEMENT = "appTypes";
    -    public static final String TYPE_ATTR = "type";
    -    public static final String HOST_ATTR = "host";
    -    public static final String BASE_DIR_ATTR = "baseDir";
    -    public static final String PROVIDER_ATTR = "provider";
    -    public static final String VERSION_ATTR = "version";
    -    public static final String MULTI_TENANT_ATTR = "multiTenant";
    -    public static final String PORT_ATTR = "port";
    -    public static final String PROXY_PORT_ATTR = "proxyPort";
    -    public static final String NAME_ATTR = "name";
    -    public static final String APP_SPECIFIC_MAPPING_ATTR = "appSpecificMapping";
    +	/**
    +	 * cloud-controller XML file's elements
    +	 */
    +	public static final String CLOUD_CONTROLLER_ELEMENT = "cloudController";
    +	public static final String SERIALIZATION_DIR_ELEMENT = "serializationDir";
    +	public static final String IAAS_PROVIDERS_ELEMENT = "iaasProviders";
    +	public static final String IAAS_PROVIDER_ELEMENT = "iaasProvider";
    +	public static final String PARTITION_ELEMENT = "partition";
    +	public static final String PARTITIONS_ELEMENT = "partitions";
    +	public static final String REGION_ELEMENT = "region";
    +	public static final String ZONE_ELEMENT = "zone";
    +	public static final String DEPLOYMENT_ELEMENT = "deployment";
    +	public static final String PORT_MAPPING_ELEMENT = "portMapping";
    +	public static final String APP_TYPES_ELEMENT = "appTypes";
    +	public static final String TYPE_ATTR = "type";
    +	public static final String HOST_ATTR = "host";
    +	public static final String BASE_DIR_ATTR = "baseDir";
    +	public static final String PROVIDER_ATTR = "provider";
    +	public static final String VERSION_ATTR = "version";
    +	public static final String MULTI_TENANT_ATTR = "multiTenant";
    +	public static final String PORT_ATTR = "port";
    +	public static final String PROXY_PORT_ATTR = "proxyPort";
    +	public static final String NAME_ATTR = "name";
    +	public static final String APP_SPECIFIC_MAPPING_ATTR = "appSpecificMapping";
     
    -    public static final String CARTRIDGES_ELEMENT = "cartridges";
    -    public static final String CARTRIDGE_ELEMENT = "cartridge";
    +	public static final String CARTRIDGES_ELEMENT = "cartridges";
    +	public static final String CARTRIDGE_ELEMENT = "cartridge";
     
    -    public static final String DISPLAY_NAME_ELEMENT = "displayName";
    -    public static final String DESCRIPTION_ELEMENT = "description";
    -    public static final String PROPERTY_ELEMENT = "property";
    -    public static final String PROPERTY_NAME_ATTR = "name";
    -    public static final String PROPERTY_VALUE_ATTR = "value";
    -    public static final String IMAGE_ID_ELEMENT = "imageId";
    -    public static final String SCALE_DOWN_ORDER_ELEMENT = "scaleDownOrder";
    -    public static final String SCALE_UP_ORDER_ELEMENT = "scaleUpOrder";
    -    public static final String CLASS_NAME_ELEMENT = "className";
    -    public static final String PROVIDER_ELEMENT = "provider";
    -    public static final String IDENTITY_ELEMENT = "identity";
    -    public static final String TYPE_ELEMENT = "type";
    -    public static final String SCOPE_ELEMENT = "scope";
    -    public static final String ID_ELEMENT = "id";
    -    public static final String CREDENTIAL_ELEMENT = "credential";
    -    public static final String DEFAULT_SERVICE_ELEMENT = "default";
    -    public static final String SERVICE_ELEMENT = "service";
    -    public static final String SERVICES_ELEMENT = "services";
    -    public static final String DIRECTORY_ELEMENT = "dir";
    -    public static final String HTTP_ELEMENT = "http";
    -    public static final String HTTPS_ELEMENT = "https";
    -    public static final String APP_TYPE_ELEMENT = "appType";
    -    public static final String SERVICE_DOMAIN_ATTR = "domain";
    -    public static final String SERVICE_SUB_DOMAIN_ATTR = "subDomain";
    -    public static final String SERVICE_TENANT_RANGE_ATTR = "tenantRange";
    -    public static final String POLICY_NAME = "policyName";
    -    public static final String PAYLOAD_ELEMENT = "payload";
    -    public static final String DATA_PUBLISHER_ELEMENT = "dataPublisher";
    -    public static final String TOPOLOGY_SYNC_ELEMENT = "topologySync";
    -    public static final String ENABLE_ATTR = "enable";
    -    public static final String BAM_SERVER_ELEMENT = "bamServer";
    -    public static final String CRON_ELEMENT = "cron";
    -    public static final String BAM_SERVER_ADMIN_USERNAME_ELEMENT = "adminUserName";
    -    public static final String BAM_SERVER_ADMIN_PASSWORD_ELEMENT = "adminPassword";
    -    public static final String CASSANDRA_INFO_ELEMENT = "cassandraInfo";
    -    public static final String HOST_ELEMENT = "host";
    -    public static final String CONNECTION_URL_ELEMENT = "connectionUrl";
    -    public static final String HOST_PORT_ELEMENT = "port";
    -    public static final String USER_NAME_ELEMENT = "userName";
    -    public static final String PASSWORD_ELEMENT = "password";
    -    public static final String CLOUD_CONTROLLER_EVENT_STREAM = "org.apache.stratos.cloud.controller";
    -    public static final String CLOUD_CONTROLLER_COL_FAMILY = CLOUD_CONTROLLER_EVENT_STREAM
    -            .replaceAll("[/.]", "_");
    +	public static final String DISPLAY_NAME_ELEMENT = "displayName";
    +	public static final String DESCRIPTION_ELEMENT = "description";
    +	public static final String PROPERTY_ELEMENT = "property";
    +	public static final String PROPERTY_NAME_ATTR = "name";
    +	public static final String PROPERTY_VALUE_ATTR = "value";
    +	public static final String IMAGE_ID_ELEMENT = "imageId";
    +	public static final String SCALE_DOWN_ORDER_ELEMENT = "scaleDownOrder";
    +	public static final String SCALE_UP_ORDER_ELEMENT = "scaleUpOrder";
    +	public static final String CLASS_NAME_ELEMENT = "className";
    +	public static final String PROVIDER_ELEMENT = "provider";
    +	public static final String IDENTITY_ELEMENT = "identity";
    +	public static final String TYPE_ELEMENT = "type";
    +	public static final String SCOPE_ELEMENT = "scope";
    +	public static final String ID_ELEMENT = "id";
    +	public static final String CREDENTIAL_ELEMENT = "credential";
    +	public static final String DEFAULT_SERVICE_ELEMENT = "default";
    +	public static final String SERVICE_ELEMENT = "service";
    +	public static final String SERVICES_ELEMENT = "services";
    +	public static final String DIRECTORY_ELEMENT = "dir";
    +	public static final String HTTP_ELEMENT = "http";
    +	public static final String HTTPS_ELEMENT = "https";
    +	public static final String APP_TYPE_ELEMENT = "appType";
    +	public static final String SERVICE_DOMAIN_ATTR = "domain";
    +	public static final String SERVICE_SUB_DOMAIN_ATTR = "subDomain";
    +	public static final String SERVICE_TENANT_RANGE_ATTR = "tenantRange";
    +	public static final String POLICY_NAME = "policyName";
    +	public static final String PAYLOAD_ELEMENT = "payload";
    +	public static final String DATA_PUBLISHER_ELEMENT = "dataPublisher";
    +	public static final String TOPOLOGY_SYNC_ELEMENT = "topologySync";
    +	public static final String ENABLE_ATTR = "enable";
    +	public static final String BAM_SERVER_ELEMENT = "bamServer";
    +	public static final String CRON_ELEMENT = "cron";
    +	public static final String BAM_SERVER_ADMIN_USERNAME_ELEMENT = "adminUserName";
    +	public static final String BAM_SERVER_ADMIN_PASSWORD_ELEMENT = "adminPassword";
    +	public static final String CASSANDRA_INFO_ELEMENT = "cassandraInfo";
    +	public static final String HOST_ELEMENT = "host";
    +	public static final String CONNECTION_URL_ELEMENT = "connectionUrl";
    +	public static final String HOST_PORT_ELEMENT = "port";
    +	public static final String USER_NAME_ELEMENT = "userName";
    +	public static final String PASSWORD_ELEMENT = "password";
    +	public static final String CLOUD_CONTROLLER_EVENT_STREAM = "org.apache.stratos.cloud.controller";
    +	public static final String CLOUD_CONTROLLER_COL_FAMILY = CLOUD_CONTROLLER_EVENT_STREAM.replaceAll("[/.]", "_");
     
    -    /**
    -     * column names
    -     */
    -    public static final String PAYLOAD_PREFIX = "payload_";
    -    public static final String MEMBER_ID_COL = "memberId";
    -    public static final String CARTRIDGE_TYPE_COL = "cartridgeType";
    -    public static final String CLUSTER_ID_COL = "clusterId";
    -    public static final String PARTITION_ID_COL = "partitionId";
    -    public static final String NETWORK_ID_COL = "networkId";
    -    public static final String ALIAS_COL = "alias";
    -    public static final String TENANT_RANGE_COL = "tenantRange";
    -    public static final String IS_MULTI_TENANT_COL = "isMultiTenant";
    -    public static final String IAAS_COL = "iaas";
    -    public static final String STATUS_COL = "status";
    -    public static final String HOST_NAME_COL = "hostName";
    -    public static final String HYPERVISOR_COL = "hypervisor";
    -    public static final String RAM_COL = "ram";
    -    public static final String IMAGE_ID_COL = "imageId";
    -    public static final String LOGIN_PORT_COL = "loginPort";
    -    public static final String OS_NAME_COL = "osName";
    -    public static final String OS_VERSION_COL = "osVersion";
    -    public static final String OS_ARCH_COL = "osArch";
    -    public static final String OS_BIT_COL = "is64bitOS";
    -    public static final String PRIV_IP_COL = "privateIPAddresses";
    -    public static final String PUB_IP_COL = "publicIPAddresses";
    -    public static final String ALLOCATE_IP_COL = "allocateIPAddresses";
    +	/**
    +	 * column names
    +	 */
    +	public static final String PAYLOAD_PREFIX = "payload_";
    +	public static final String MEMBER_ID_COL = "memberId";
    +	public static final String CARTRIDGE_TYPE_COL = "cartridgeType";
    +	public static final String CLUSTER_ID_COL = "clusterId";
    +	public static final String CLUSTER_INSTANCE_ID_COL = "clusterInstanceId";
    +	public static final String PARTITION_ID_COL = "partitionId";
    +	public static final String NETWORK_ID_COL = "networkId";
    +	public static final String ALIAS_COL = "alias";
    +	public static final String TENANT_RANGE_COL = "tenantRange";
    +	public static final String IS_MULTI_TENANT_COL = "isMultiTenant";
    +	public static final String IAAS_COL = "iaas";
    +	public static final String STATUS_COL = "status";
    +	public static final String HOST_NAME_COL = "hostName";
    +	public static final String HYPERVISOR_COL = "hypervisor";
    +	public static final String RAM_COL = "ram";
    +	public static final String IMAGE_ID_COL = "imageId";
    +	public static final String LOGIN_PORT_COL = "loginPort";
    +	public static final String OS_NAME_COL = "osName";
    +	public static final String OS_VERSION_COL = "osVersion";
    +	public static final String OS_ARCH_COL = "osArch";
    +	public static final String OS_BIT_COL = "is64bitOS";
    +	public static final String PRIV_IP_COL = "privateIPAddresses";
    +	public static final String PUB_IP_COL = "publicIPAddresses";
    +	public static final String ALLOCATE_IP_COL = "allocateIPAddresses";
    +	public static final String TIME_STAMP = "timeStamp";
    +	public static final String SCALING_REASON = "scalingReason";
    +	public static final String SCALING_TIME = "scalingTime";
     
    -    /**
    -     * Properties
    -     */
    -    public static final String REGION_PROPERTY = "region";
    -    public static final String TOPICS_PROPERTY = "topics";
    -    public static final String PUBLIC_IP_PROPERTY = "public_ip";
    -    public static final String TENANT_ID_PROPERTY = "tenant_id";
    -    public static final String ALIAS_PROPERTY = "alias";
    -    public static final String AUTO_ASSIGN_IP_PROPERTY = "autoAssignIp";
    -    public static final String JCLOUDS_ENDPOINT = "jclouds.endpoint";
    -    public static final String CRON_PROPERTY = "cron";
    -    public static final String AMQP_CONNECTION_URL_PROPERTY = "amqpConnectionUrl";
    -    public static final String AMQP_INITIAL_CONTEXT_FACTORY_PROPERTY = "amqpInitialContextFactory";
    -    public static final String AMQP_TOPIC_CONNECTION_FACTORY_PROPERTY = "amqpTopicConnectionFactory";
    -    public static final String INSTANCE_TOPIC = "instance/*";
    -    // pre define a floating ip
    -    public static final String FLOATING_IP_PROPERTY = "floatingIp";
    -    public static final String DEFAULT_FLOATING_IP_POOL = "defaultFloatingIpPool";
    -    public static final String OPENSTACK_NETWORKING_PROVIDER = "openstack.networking.provider";
    -    public static final String OPENSTACK_NEUTRON_NETWORKING = "neutron";
    +	/**
    +	 * Properties
    +	 */
    +	public static final String REGION_PROPERTY = "region";
    +	public static final String TOPICS_PROPERTY = "topics";
    +	public static final String PUBLIC_IP_PROPERTY = "public_ip";
    +	public static final String TENANT_ID_PROPERTY = "tenant_id";
    +	public static final String ALIAS_PROPERTY = "alias";
    +	public static final String AUTO_ASSIGN_IP_PROPERTY = "autoAssignIp";
    +	public static final String JCLOUDS_ENDPOINT = "jclouds.endpoint";
    +	public static final String CRON_PROPERTY = "cron";
    +	public static final String AMQP_CONNECTION_URL_PROPERTY = "amqpConnectionUrl";
    +	public static final String AMQP_INITIAL_CONTEXT_FACTORY_PROPERTY = "amqpInitialContextFactory";
    +	public static final String AMQP_TOPIC_CONNECTION_FACTORY_PROPERTY = "amqpTopicConnectionFactory";
    +	public static final String INSTANCE_TOPIC = "instance/*";
    +	// pre define a floating ip
    +	public static final String FLOATING_IP_PROPERTY = "floatingIp";
    +	public static final String DEFAULT_FLOATING_IP_POOL = "defaultFloatingIpPool";
    +	public static final String OPENSTACK_NETWORKING_PROVIDER = "openstack.networking.provider";
    +	public static final String OPENSTACK_NEUTRON_NETWORKING = "neutron";
     
    -    /**
    -     * XPath expressions
    -     */
    -    public static final String IAAS_PROVIDER_XPATH = "/"
    -            + CLOUD_CONTROLLER_ELEMENT + "/" + IAAS_PROVIDERS_ELEMENT + "/"
    -            + IAAS_PROVIDER_ELEMENT;
    -    public static final String PARTITION_XPATH = "/" + CLOUD_CONTROLLER_ELEMENT
    -            + "/" + PARTITIONS_ELEMENT + "/" + PARTITION_ELEMENT;
    -    public static final String REGION_XPATH = "/" + CLOUD_CONTROLLER_ELEMENT
    -            + "/" + IAAS_PROVIDERS_ELEMENT + "/" + IAAS_PROVIDER_ELEMENT + "/"
    -            + REGION_ELEMENT;
    -    public static final String ZONE_XPATH = "/" + CLOUD_CONTROLLER_ELEMENT
    -            + "/" + IAAS_PROVIDERS_ELEMENT + "/" + IAAS_PROVIDER_ELEMENT + "/"
    -            + REGION_ELEMENT + "/" + ZONE_ELEMENT;
    -    public static final String HOST_XPATH = "/" + CLOUD_CONTROLLER_ELEMENT
    -            + "/" + IAAS_PROVIDERS_ELEMENT + "/" + IAAS_PROVIDER_ELEMENT + "/"
    -            + REGION_ELEMENT + "/" + ZONE_ELEMENT + "/" + HOST_ELEMENT;
    -    public static final String PROPERTY_ELEMENT_XPATH = "/" + PROPERTY_ELEMENT;
    -    public static final String IMAGE_ID_ELEMENT_XPATH = "/" + IMAGE_ID_ELEMENT;
    -    public static final String SCALE_UP_ORDER_ELEMENT_XPATH = "/"
    -            + SCALE_UP_ORDER_ELEMENT;
    -    public static final String SCALE_DOWN_ORDER_ELEMENT_XPATH = "/"
    -            + SCALE_DOWN_ORDER_ELEMENT;
    -    public static final String PROVIDER_ELEMENT_XPATH = "/" + PROPERTY_ELEMENT;
    -    public static final String IDENTITY_ELEMENT_XPATH = "/" + IDENTITY_ELEMENT;
    -    public static final String CREDENTIAL_ELEMENT_XPATH = "/"
    -            + CREDENTIAL_ELEMENT;
    -    public static final String SERVICES_ELEMENT_XPATH = "/" + SERVICES_ELEMENT
    -            + "/" + SERVICE_ELEMENT;
    -    public static final String SERVICE_ELEMENT_XPATH = "/" + SERVICE_ELEMENT;
    -    public static final String CARTRIDGE_ELEMENT_XPATH = "/"
    -            + CARTRIDGE_ELEMENT;
    -    public static final String PAYLOAD_ELEMENT_XPATH = "/" + PAYLOAD_ELEMENT;
    -    public static final String HOST_ELEMENT_XPATH = "/" + HOST_ELEMENT;
    -    public static final String CARTRIDGES_ELEMENT_XPATH = "/"
    -            + CARTRIDGES_ELEMENT + "/" + CARTRIDGE_ELEMENT;
    -    public static final String IAAS_PROVIDER_ELEMENT_XPATH = "/"
    -            + IAAS_PROVIDER_ELEMENT;
    -    public static final String DEPLOYMENT_ELEMENT_XPATH = "/"
    -            + DEPLOYMENT_ELEMENT;
    -    public static final String PORT_MAPPING_ELEMENT_XPATH = "/"
    -            + PORT_MAPPING_ELEMENT;
    -    public static final String APP_TYPES_ELEMENT_XPATH = "/"
    -            + APP_TYPES_ELEMENT;
    +	/**
    +	 * XPath expressions
    +	 */
    +	public static final String IAAS_PROVIDER_XPATH =
    +			"/" + CLOUD_CONTROLLER_ELEMENT + "/" + IAAS_PROVIDERS_ELEMENT + "/" + IAAS_PROVIDER_ELEMENT;
    +	public static final String PARTITION_XPATH =
    +			"/" + CLOUD_CONTROLLER_ELEMENT + "/" + PARTITIONS_ELEMENT + "/" + PARTITION_ELEMENT;
    +	public static final String REGION_XPATH =
    +			"/" + CLOUD_CONTROLLER_ELEMENT + "/" + IAAS_PROVIDERS_ELEMENT + "/" + IAAS_PROVIDER_ELEMENT + "/" +
    +			REGION_ELEMENT;
    +	public static final String ZONE_XPATH =
    +			"/" + CLOUD_CONTROLLER_ELEMENT + "/" + IAAS_PROVIDERS_ELEMENT + "/" + IAAS_PROVIDER_ELEMENT + "/" +
    +			REGION_ELEMENT + "/" + ZONE_ELEMENT;
    +	public static final String HOST_XPATH =
    +			"/" + CLOUD_CONTROLLER_ELEMENT + "/" + IAAS_PROVIDERS_ELEMENT + "/" + IAAS_PROVIDER_ELEMENT + "/" +
    +			REGION_ELEMENT + "/" + ZONE_ELEMENT + "/" + HOST_ELEMENT;
    +	public static final String PROPERTY_ELEMENT_XPATH = "/" + PROPERTY_ELEMENT;
    +	public static final String IMAGE_ID_ELEMENT_XPATH = "/" + IMAGE_ID_ELEMENT;
    +	public static final String SCALE_UP_ORDER_ELEMENT_XPATH = "/" + SCALE_UP_ORDER_ELEMENT;
    +	public static final String SCALE_DOWN_ORDER_ELEMENT_XPATH = "/" + SCALE_DOWN_ORDER_ELEMENT;
    +	public static final String PROVIDER_ELEMENT_XPATH = "/" + PROPERTY_ELEMENT;
    +	public static final String IDENTITY_ELEMENT_XPATH = "/" + IDENTITY_ELEMENT;
    +	public static final String CREDENTIAL_ELEMENT_XPATH = "/" + CREDENTIAL_ELEMENT;
    +	public static final String SERVICES_ELEMENT_XPATH = "/" + SERVICES_ELEMENT + "/" + SERVICE_ELEMENT;
    +	public static final String SERVICE_ELEMENT_XPATH = "/" + SERVICE_ELEMENT;
    +	public static final String CARTRIDGE_ELEMENT_XPATH = "/" + CARTRIDGE_ELEMENT;
    +	public static final String PAYLOAD_ELEMENT_XPATH = "/" + PAYLOAD_ELEMENT;
    +	public static final String HOST_ELEMENT_XPATH = "/" + HOST_ELEMENT;
    +	public static final String CARTRIDGES_ELEMENT_XPATH = "/" + CARTRIDGES_ELEMENT + "/" + CARTRIDGE_ELEMENT;
    +	public static final String IAAS_PROVIDER_ELEMENT_XPATH = "/" + IAAS_PROVIDER_ELEMENT;
    +	public static final String DEPLOYMENT_ELEMENT_XPATH = "/" + DEPLOYMENT_ELEMENT;
    +	public static final String PORT_MAPPING_ELEMENT_XPATH = "/" + PORT_MAPPING_ELEMENT;
    +	public static final String APP_TYPES_ELEMENT_XPATH = "/" + APP_TYPES_ELEMENT;
     
    -    public static final String DATA_PUBLISHER_XPATH = "/"
    -            + CLOUD_CONTROLLER_ELEMENT + "/" + DATA_PUBLISHER_ELEMENT;
    -    public static final String TOPOLOGY_SYNC_XPATH = "/"
    -            + CLOUD_CONTROLLER_ELEMENT + "/" + TOPOLOGY_SYNC_ELEMENT;
    -    public static final String DATA_PUBLISHER_CRON_XPATH = "/"
    -            + CLOUD_CONTROLLER_ELEMENT + "/" + CRON_ELEMENT;
    -    public static final String BAM_SERVER_ADMIN_USERNAME_XPATH = "/"
    -            + CLOUD_CONTROLLER_ELEMENT + "/"
    -            + BAM_SERVER_ADMIN_USERNAME_ELEMENT;
    -    public static final String BAM_SERVER_ADMIN_PASSWORD_XPATH = "/"
    -            + CLOUD_CONTROLLER_ELEMENT + "/"
    -            + BAM_SERVER_ADMIN_PASSWORD_ELEMENT;
    -    // public static final String CASSANDRA_HOST_ADDRESS_XPATH =
    -    // "/"+CLOUD_CONTROLLER_ELEMENT+
    -    // "/"+CASSANDRA_HOST_ADDRESS;
    -    // public static final String CASSANDRA_HOST_PORT_XPATH =
    -    // "/"+CLOUD_CONTROLLER_ELEMENT+
    -    // "/"+CASSANDRA_HOST_PORT;
    +	public static final String DATA_PUBLISHER_XPATH = "/" + CLOUD_CONTROLLER_ELEMENT + "/" + DATA_PUBLISHER_ELEMENT;
    +	public static final String TOPOLOGY_SYNC_XPATH = "/" + CLOUD_CONTROLLER_ELEMENT + "/" + TOPOLOGY_SYNC_ELEMENT;
    +	public static final String DATA_PUBLISHER_CRON_XPATH = "/" + CLOUD_CONTROLLER_ELEMENT + "/" + CRON_ELEMENT;
    +	public static final String BAM_SERVER_ADMIN_USERNAME_XPATH =
    +			"/" + CLOUD_CONTROLLER_ELEMENT + "/" + BAM_SERVER_ADMIN_USERNAME_ELEMENT;
    +	public static final String BAM_SERVER_ADMIN_PASSWORD_XPATH =
    +			"/" + CLOUD_CONTROLLER_ELEMENT + "/" + BAM_SERVER_ADMIN_PASSWORD_ELEMENT;
    +	// public static final String CASSANDRA_HOST_ADDRESS_XPATH =
    --- End diff --
    
    It was already there that's why I didn't remove it. Now I've removed it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] stratos pull request: Data publisher integration

Posted by lahirus <gi...@git.apache.org>.
Github user lahirus commented on a diff in the pull request:

    https://github.com/apache/stratos/pull/403#discussion_r35230789
  
    --- Diff: components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerConstants.java ---
    @@ -24,281 +24,267 @@
     
     public final class CloudControllerConstants {
     
    -    /**
    -     * cloud-controller XML file's elements
    -     */
    -    public static final String CLOUD_CONTROLLER_ELEMENT = "cloudController";
    -    public static final String SERIALIZATION_DIR_ELEMENT = "serializationDir";
    -    public static final String IAAS_PROVIDERS_ELEMENT = "iaasProviders";
    -    public static final String IAAS_PROVIDER_ELEMENT = "iaasProvider";
    -    public static final String PARTITION_ELEMENT = "partition";
    -    public static final String PARTITIONS_ELEMENT = "partitions";
    -    public static final String REGION_ELEMENT = "region";
    -    public static final String ZONE_ELEMENT = "zone";
    -    public static final String DEPLOYMENT_ELEMENT = "deployment";
    -    public static final String PORT_MAPPING_ELEMENT = "portMapping";
    -    public static final String APP_TYPES_ELEMENT = "appTypes";
    -    public static final String TYPE_ATTR = "type";
    -    public static final String HOST_ATTR = "host";
    -    public static final String BASE_DIR_ATTR = "baseDir";
    -    public static final String PROVIDER_ATTR = "provider";
    -    public static final String VERSION_ATTR = "version";
    -    public static final String MULTI_TENANT_ATTR = "multiTenant";
    -    public static final String PORT_ATTR = "port";
    -    public static final String PROXY_PORT_ATTR = "proxyPort";
    -    public static final String NAME_ATTR = "name";
    -    public static final String APP_SPECIFIC_MAPPING_ATTR = "appSpecificMapping";
    +	/**
    +	 * cloud-controller XML file's elements
    +	 */
    +	public static final String CLOUD_CONTROLLER_ELEMENT = "cloudController";
    +	public static final String SERIALIZATION_DIR_ELEMENT = "serializationDir";
    +	public static final String IAAS_PROVIDERS_ELEMENT = "iaasProviders";
    +	public static final String IAAS_PROVIDER_ELEMENT = "iaasProvider";
    +	public static final String PARTITION_ELEMENT = "partition";
    +	public static final String PARTITIONS_ELEMENT = "partitions";
    +	public static final String REGION_ELEMENT = "region";
    +	public static final String ZONE_ELEMENT = "zone";
    +	public static final String DEPLOYMENT_ELEMENT = "deployment";
    +	public static final String PORT_MAPPING_ELEMENT = "portMapping";
    +	public static final String APP_TYPES_ELEMENT = "appTypes";
    +	public static final String TYPE_ATTR = "type";
    +	public static final String HOST_ATTR = "host";
    +	public static final String BASE_DIR_ATTR = "baseDir";
    +	public static final String PROVIDER_ATTR = "provider";
    +	public static final String VERSION_ATTR = "version";
    +	public static final String MULTI_TENANT_ATTR = "multiTenant";
    +	public static final String PORT_ATTR = "port";
    +	public static final String PROXY_PORT_ATTR = "proxyPort";
    +	public static final String NAME_ATTR = "name";
    +	public static final String APP_SPECIFIC_MAPPING_ATTR = "appSpecificMapping";
     
    -    public static final String CARTRIDGES_ELEMENT = "cartridges";
    -    public static final String CARTRIDGE_ELEMENT = "cartridge";
    +	public static final String CARTRIDGES_ELEMENT = "cartridges";
    +	public static final String CARTRIDGE_ELEMENT = "cartridge";
     
    -    public static final String DISPLAY_NAME_ELEMENT = "displayName";
    -    public static final String DESCRIPTION_ELEMENT = "description";
    -    public static final String PROPERTY_ELEMENT = "property";
    -    public static final String PROPERTY_NAME_ATTR = "name";
    -    public static final String PROPERTY_VALUE_ATTR = "value";
    -    public static final String IMAGE_ID_ELEMENT = "imageId";
    -    public static final String SCALE_DOWN_ORDER_ELEMENT = "scaleDownOrder";
    -    public static final String SCALE_UP_ORDER_ELEMENT = "scaleUpOrder";
    -    public static final String CLASS_NAME_ELEMENT = "className";
    -    public static final String PROVIDER_ELEMENT = "provider";
    -    public static final String IDENTITY_ELEMENT = "identity";
    -    public static final String TYPE_ELEMENT = "type";
    -    public static final String SCOPE_ELEMENT = "scope";
    -    public static final String ID_ELEMENT = "id";
    -    public static final String CREDENTIAL_ELEMENT = "credential";
    -    public static final String DEFAULT_SERVICE_ELEMENT = "default";
    -    public static final String SERVICE_ELEMENT = "service";
    -    public static final String SERVICES_ELEMENT = "services";
    -    public static final String DIRECTORY_ELEMENT = "dir";
    -    public static final String HTTP_ELEMENT = "http";
    -    public static final String HTTPS_ELEMENT = "https";
    -    public static final String APP_TYPE_ELEMENT = "appType";
    -    public static final String SERVICE_DOMAIN_ATTR = "domain";
    -    public static final String SERVICE_SUB_DOMAIN_ATTR = "subDomain";
    -    public static final String SERVICE_TENANT_RANGE_ATTR = "tenantRange";
    -    public static final String POLICY_NAME = "policyName";
    -    public static final String PAYLOAD_ELEMENT = "payload";
    -    public static final String DATA_PUBLISHER_ELEMENT = "dataPublisher";
    -    public static final String TOPOLOGY_SYNC_ELEMENT = "topologySync";
    -    public static final String ENABLE_ATTR = "enable";
    -    public static final String BAM_SERVER_ELEMENT = "bamServer";
    -    public static final String CRON_ELEMENT = "cron";
    -    public static final String BAM_SERVER_ADMIN_USERNAME_ELEMENT = "adminUserName";
    -    public static final String BAM_SERVER_ADMIN_PASSWORD_ELEMENT = "adminPassword";
    -    public static final String CASSANDRA_INFO_ELEMENT = "cassandraInfo";
    -    public static final String HOST_ELEMENT = "host";
    -    public static final String CONNECTION_URL_ELEMENT = "connectionUrl";
    -    public static final String HOST_PORT_ELEMENT = "port";
    -    public static final String USER_NAME_ELEMENT = "userName";
    -    public static final String PASSWORD_ELEMENT = "password";
    -    public static final String CLOUD_CONTROLLER_EVENT_STREAM = "org.apache.stratos.cloud.controller";
    -    public static final String CLOUD_CONTROLLER_COL_FAMILY = CLOUD_CONTROLLER_EVENT_STREAM
    -            .replaceAll("[/.]", "_");
    +	public static final String DISPLAY_NAME_ELEMENT = "displayName";
    +	public static final String DESCRIPTION_ELEMENT = "description";
    +	public static final String PROPERTY_ELEMENT = "property";
    +	public static final String PROPERTY_NAME_ATTR = "name";
    +	public static final String PROPERTY_VALUE_ATTR = "value";
    +	public static final String IMAGE_ID_ELEMENT = "imageId";
    +	public static final String SCALE_DOWN_ORDER_ELEMENT = "scaleDownOrder";
    +	public static final String SCALE_UP_ORDER_ELEMENT = "scaleUpOrder";
    +	public static final String CLASS_NAME_ELEMENT = "className";
    +	public static final String PROVIDER_ELEMENT = "provider";
    +	public static final String IDENTITY_ELEMENT = "identity";
    +	public static final String TYPE_ELEMENT = "type";
    +	public static final String SCOPE_ELEMENT = "scope";
    +	public static final String ID_ELEMENT = "id";
    +	public static final String CREDENTIAL_ELEMENT = "credential";
    +	public static final String DEFAULT_SERVICE_ELEMENT = "default";
    +	public static final String SERVICE_ELEMENT = "service";
    +	public static final String SERVICES_ELEMENT = "services";
    +	public static final String DIRECTORY_ELEMENT = "dir";
    +	public static final String HTTP_ELEMENT = "http";
    +	public static final String HTTPS_ELEMENT = "https";
    +	public static final String APP_TYPE_ELEMENT = "appType";
    +	public static final String SERVICE_DOMAIN_ATTR = "domain";
    +	public static final String SERVICE_SUB_DOMAIN_ATTR = "subDomain";
    +	public static final String SERVICE_TENANT_RANGE_ATTR = "tenantRange";
    +	public static final String POLICY_NAME = "policyName";
    +	public static final String PAYLOAD_ELEMENT = "payload";
    +	public static final String DATA_PUBLISHER_ELEMENT = "dataPublisher";
    +	public static final String TOPOLOGY_SYNC_ELEMENT = "topologySync";
    +	public static final String ENABLE_ATTR = "enable";
    +	public static final String BAM_SERVER_ELEMENT = "bamServer";
    +	public static final String CRON_ELEMENT = "cron";
    +	public static final String BAM_SERVER_ADMIN_USERNAME_ELEMENT = "adminUserName";
    +	public static final String BAM_SERVER_ADMIN_PASSWORD_ELEMENT = "adminPassword";
    +	public static final String CASSANDRA_INFO_ELEMENT = "cassandraInfo";
    +	public static final String HOST_ELEMENT = "host";
    +	public static final String CONNECTION_URL_ELEMENT = "connectionUrl";
    +	public static final String HOST_PORT_ELEMENT = "port";
    +	public static final String USER_NAME_ELEMENT = "userName";
    +	public static final String PASSWORD_ELEMENT = "password";
    +	public static final String CLOUD_CONTROLLER_EVENT_STREAM = "org.apache.stratos.cloud.controller";
    +	public static final String CLOUD_CONTROLLER_COL_FAMILY = CLOUD_CONTROLLER_EVENT_STREAM.replaceAll("[/.]", "_");
     
    -    /**
    -     * column names
    -     */
    -    public static final String PAYLOAD_PREFIX = "payload_";
    -    public static final String MEMBER_ID_COL = "memberId";
    -    public static final String CARTRIDGE_TYPE_COL = "cartridgeType";
    -    public static final String CLUSTER_ID_COL = "clusterId";
    -    public static final String PARTITION_ID_COL = "partitionId";
    -    public static final String NETWORK_ID_COL = "networkId";
    -    public static final String ALIAS_COL = "alias";
    -    public static final String TENANT_RANGE_COL = "tenantRange";
    -    public static final String IS_MULTI_TENANT_COL = "isMultiTenant";
    -    public static final String IAAS_COL = "iaas";
    -    public static final String STATUS_COL = "status";
    -    public static final String HOST_NAME_COL = "hostName";
    -    public static final String HYPERVISOR_COL = "hypervisor";
    -    public static final String RAM_COL = "ram";
    -    public static final String IMAGE_ID_COL = "imageId";
    -    public static final String LOGIN_PORT_COL = "loginPort";
    -    public static final String OS_NAME_COL = "osName";
    -    public static final String OS_VERSION_COL = "osVersion";
    -    public static final String OS_ARCH_COL = "osArch";
    -    public static final String OS_BIT_COL = "is64bitOS";
    -    public static final String PRIV_IP_COL = "privateIPAddresses";
    -    public static final String PUB_IP_COL = "publicIPAddresses";
    -    public static final String ALLOCATE_IP_COL = "allocateIPAddresses";
    +	/**
    +	 * column names
    +	 */
    +	public static final String PAYLOAD_PREFIX = "payload_";
    +	public static final String MEMBER_ID_COL = "memberId";
    +	public static final String CARTRIDGE_TYPE_COL = "cartridgeType";
    +	public static final String CLUSTER_ID_COL = "clusterId";
    +	public static final String CLUSTER_INSTANCE_ID_COL = "clusterInstanceId";
    +	public static final String PARTITION_ID_COL = "partitionId";
    +	public static final String NETWORK_ID_COL = "networkId";
    +	public static final String ALIAS_COL = "alias";
    +	public static final String TENANT_RANGE_COL = "tenantRange";
    +	public static final String IS_MULTI_TENANT_COL = "isMultiTenant";
    +	public static final String IAAS_COL = "iaas";
    +	public static final String STATUS_COL = "status";
    +	public static final String HOST_NAME_COL = "hostName";
    +	public static final String HYPERVISOR_COL = "hypervisor";
    +	public static final String RAM_COL = "ram";
    +	public static final String IMAGE_ID_COL = "imageId";
    +	public static final String LOGIN_PORT_COL = "loginPort";
    +	public static final String OS_NAME_COL = "osName";
    +	public static final String OS_VERSION_COL = "osVersion";
    +	public static final String OS_ARCH_COL = "osArch";
    +	public static final String OS_BIT_COL = "is64bitOS";
    +	public static final String PRIV_IP_COL = "privateIPAddresses";
    +	public static final String PUB_IP_COL = "publicIPAddresses";
    +	public static final String ALLOCATE_IP_COL = "allocateIPAddresses";
    +	public static final String TIME_STAMP = "timeStamp";
    +	public static final String SCALING_REASON = "scalingReason";
    +	public static final String SCALING_TIME = "scalingTime";
     
    -    /**
    -     * Properties
    -     */
    -    public static final String REGION_PROPERTY = "region";
    -    public static final String TOPICS_PROPERTY = "topics";
    -    public static final String PUBLIC_IP_PROPERTY = "public_ip";
    -    public static final String TENANT_ID_PROPERTY = "tenant_id";
    -    public static final String ALIAS_PROPERTY = "alias";
    -    public static final String AUTO_ASSIGN_IP_PROPERTY = "autoAssignIp";
    -    public static final String JCLOUDS_ENDPOINT = "jclouds.endpoint";
    -    public static final String CRON_PROPERTY = "cron";
    -    public static final String AMQP_CONNECTION_URL_PROPERTY = "amqpConnectionUrl";
    -    public static final String AMQP_INITIAL_CONTEXT_FACTORY_PROPERTY = "amqpInitialContextFactory";
    -    public static final String AMQP_TOPIC_CONNECTION_FACTORY_PROPERTY = "amqpTopicConnectionFactory";
    -    public static final String INSTANCE_TOPIC = "instance/*";
    -    // pre define a floating ip
    -    public static final String FLOATING_IP_PROPERTY = "floatingIp";
    -    public static final String DEFAULT_FLOATING_IP_POOL = "defaultFloatingIpPool";
    -    public static final String OPENSTACK_NETWORKING_PROVIDER = "openstack.networking.provider";
    -    public static final String OPENSTACK_NEUTRON_NETWORKING = "neutron";
    +	/**
    +	 * Properties
    +	 */
    +	public static final String REGION_PROPERTY = "region";
    +	public static final String TOPICS_PROPERTY = "topics";
    +	public static final String PUBLIC_IP_PROPERTY = "public_ip";
    +	public static final String TENANT_ID_PROPERTY = "tenant_id";
    +	public static final String ALIAS_PROPERTY = "alias";
    +	public static final String AUTO_ASSIGN_IP_PROPERTY = "autoAssignIp";
    +	public static final String JCLOUDS_ENDPOINT = "jclouds.endpoint";
    +	public static final String CRON_PROPERTY = "cron";
    +	public static final String AMQP_CONNECTION_URL_PROPERTY = "amqpConnectionUrl";
    +	public static final String AMQP_INITIAL_CONTEXT_FACTORY_PROPERTY = "amqpInitialContextFactory";
    +	public static final String AMQP_TOPIC_CONNECTION_FACTORY_PROPERTY = "amqpTopicConnectionFactory";
    +	public static final String INSTANCE_TOPIC = "instance/*";
    +	// pre define a floating ip
    +	public static final String FLOATING_IP_PROPERTY = "floatingIp";
    +	public static final String DEFAULT_FLOATING_IP_POOL = "defaultFloatingIpPool";
    +	public static final String OPENSTACK_NETWORKING_PROVIDER = "openstack.networking.provider";
    +	public static final String OPENSTACK_NEUTRON_NETWORKING = "neutron";
     
    -    /**
    -     * XPath expressions
    -     */
    -    public static final String IAAS_PROVIDER_XPATH = "/"
    -            + CLOUD_CONTROLLER_ELEMENT + "/" + IAAS_PROVIDERS_ELEMENT + "/"
    -            + IAAS_PROVIDER_ELEMENT;
    -    public static final String PARTITION_XPATH = "/" + CLOUD_CONTROLLER_ELEMENT
    -            + "/" + PARTITIONS_ELEMENT + "/" + PARTITION_ELEMENT;
    -    public static final String REGION_XPATH = "/" + CLOUD_CONTROLLER_ELEMENT
    -            + "/" + IAAS_PROVIDERS_ELEMENT + "/" + IAAS_PROVIDER_ELEMENT + "/"
    -            + REGION_ELEMENT;
    -    public static final String ZONE_XPATH = "/" + CLOUD_CONTROLLER_ELEMENT
    -            + "/" + IAAS_PROVIDERS_ELEMENT + "/" + IAAS_PROVIDER_ELEMENT + "/"
    -            + REGION_ELEMENT + "/" + ZONE_ELEMENT;
    -    public static final String HOST_XPATH = "/" + CLOUD_CONTROLLER_ELEMENT
    -            + "/" + IAAS_PROVIDERS_ELEMENT + "/" + IAAS_PROVIDER_ELEMENT + "/"
    -            + REGION_ELEMENT + "/" + ZONE_ELEMENT + "/" + HOST_ELEMENT;
    -    public static final String PROPERTY_ELEMENT_XPATH = "/" + PROPERTY_ELEMENT;
    -    public static final String IMAGE_ID_ELEMENT_XPATH = "/" + IMAGE_ID_ELEMENT;
    -    public static final String SCALE_UP_ORDER_ELEMENT_XPATH = "/"
    -            + SCALE_UP_ORDER_ELEMENT;
    -    public static final String SCALE_DOWN_ORDER_ELEMENT_XPATH = "/"
    -            + SCALE_DOWN_ORDER_ELEMENT;
    -    public static final String PROVIDER_ELEMENT_XPATH = "/" + PROPERTY_ELEMENT;
    -    public static final String IDENTITY_ELEMENT_XPATH = "/" + IDENTITY_ELEMENT;
    -    public static final String CREDENTIAL_ELEMENT_XPATH = "/"
    -            + CREDENTIAL_ELEMENT;
    -    public static final String SERVICES_ELEMENT_XPATH = "/" + SERVICES_ELEMENT
    -            + "/" + SERVICE_ELEMENT;
    -    public static final String SERVICE_ELEMENT_XPATH = "/" + SERVICE_ELEMENT;
    -    public static final String CARTRIDGE_ELEMENT_XPATH = "/"
    -            + CARTRIDGE_ELEMENT;
    -    public static final String PAYLOAD_ELEMENT_XPATH = "/" + PAYLOAD_ELEMENT;
    -    public static final String HOST_ELEMENT_XPATH = "/" + HOST_ELEMENT;
    -    public static final String CARTRIDGES_ELEMENT_XPATH = "/"
    -            + CARTRIDGES_ELEMENT + "/" + CARTRIDGE_ELEMENT;
    -    public static final String IAAS_PROVIDER_ELEMENT_XPATH = "/"
    -            + IAAS_PROVIDER_ELEMENT;
    -    public static final String DEPLOYMENT_ELEMENT_XPATH = "/"
    -            + DEPLOYMENT_ELEMENT;
    -    public static final String PORT_MAPPING_ELEMENT_XPATH = "/"
    -            + PORT_MAPPING_ELEMENT;
    -    public static final String APP_TYPES_ELEMENT_XPATH = "/"
    -            + APP_TYPES_ELEMENT;
    +	/**
    +	 * XPath expressions
    +	 */
    +	public static final String IAAS_PROVIDER_XPATH =
    +			"/" + CLOUD_CONTROLLER_ELEMENT + "/" + IAAS_PROVIDERS_ELEMENT + "/" + IAAS_PROVIDER_ELEMENT;
    +	public static final String PARTITION_XPATH =
    +			"/" + CLOUD_CONTROLLER_ELEMENT + "/" + PARTITIONS_ELEMENT + "/" + PARTITION_ELEMENT;
    +	public static final String REGION_XPATH =
    +			"/" + CLOUD_CONTROLLER_ELEMENT + "/" + IAAS_PROVIDERS_ELEMENT + "/" + IAAS_PROVIDER_ELEMENT + "/" +
    +			REGION_ELEMENT;
    +	public static final String ZONE_XPATH =
    +			"/" + CLOUD_CONTROLLER_ELEMENT + "/" + IAAS_PROVIDERS_ELEMENT + "/" + IAAS_PROVIDER_ELEMENT + "/" +
    +			REGION_ELEMENT + "/" + ZONE_ELEMENT;
    +	public static final String HOST_XPATH =
    +			"/" + CLOUD_CONTROLLER_ELEMENT + "/" + IAAS_PROVIDERS_ELEMENT + "/" + IAAS_PROVIDER_ELEMENT + "/" +
    +			REGION_ELEMENT + "/" + ZONE_ELEMENT + "/" + HOST_ELEMENT;
    +	public static final String PROPERTY_ELEMENT_XPATH = "/" + PROPERTY_ELEMENT;
    +	public static final String IMAGE_ID_ELEMENT_XPATH = "/" + IMAGE_ID_ELEMENT;
    +	public static final String SCALE_UP_ORDER_ELEMENT_XPATH = "/" + SCALE_UP_ORDER_ELEMENT;
    +	public static final String SCALE_DOWN_ORDER_ELEMENT_XPATH = "/" + SCALE_DOWN_ORDER_ELEMENT;
    +	public static final String PROVIDER_ELEMENT_XPATH = "/" + PROPERTY_ELEMENT;
    +	public static final String IDENTITY_ELEMENT_XPATH = "/" + IDENTITY_ELEMENT;
    +	public static final String CREDENTIAL_ELEMENT_XPATH = "/" + CREDENTIAL_ELEMENT;
    +	public static final String SERVICES_ELEMENT_XPATH = "/" + SERVICES_ELEMENT + "/" + SERVICE_ELEMENT;
    +	public static final String SERVICE_ELEMENT_XPATH = "/" + SERVICE_ELEMENT;
    +	public static final String CARTRIDGE_ELEMENT_XPATH = "/" + CARTRIDGE_ELEMENT;
    +	public static final String PAYLOAD_ELEMENT_XPATH = "/" + PAYLOAD_ELEMENT;
    +	public static final String HOST_ELEMENT_XPATH = "/" + HOST_ELEMENT;
    +	public static final String CARTRIDGES_ELEMENT_XPATH = "/" + CARTRIDGES_ELEMENT + "/" + CARTRIDGE_ELEMENT;
    +	public static final String IAAS_PROVIDER_ELEMENT_XPATH = "/" + IAAS_PROVIDER_ELEMENT;
    +	public static final String DEPLOYMENT_ELEMENT_XPATH = "/" + DEPLOYMENT_ELEMENT;
    +	public static final String PORT_MAPPING_ELEMENT_XPATH = "/" + PORT_MAPPING_ELEMENT;
    +	public static final String APP_TYPES_ELEMENT_XPATH = "/" + APP_TYPES_ELEMENT;
     
    -    public static final String DATA_PUBLISHER_XPATH = "/"
    -            + CLOUD_CONTROLLER_ELEMENT + "/" + DATA_PUBLISHER_ELEMENT;
    -    public static final String TOPOLOGY_SYNC_XPATH = "/"
    -            + CLOUD_CONTROLLER_ELEMENT + "/" + TOPOLOGY_SYNC_ELEMENT;
    -    public static final String DATA_PUBLISHER_CRON_XPATH = "/"
    -            + CLOUD_CONTROLLER_ELEMENT + "/" + CRON_ELEMENT;
    -    public static final String BAM_SERVER_ADMIN_USERNAME_XPATH = "/"
    -            + CLOUD_CONTROLLER_ELEMENT + "/"
    -            + BAM_SERVER_ADMIN_USERNAME_ELEMENT;
    -    public static final String BAM_SERVER_ADMIN_PASSWORD_XPATH = "/"
    -            + CLOUD_CONTROLLER_ELEMENT + "/"
    -            + BAM_SERVER_ADMIN_PASSWORD_ELEMENT;
    -    // public static final String CASSANDRA_HOST_ADDRESS_XPATH =
    -    // "/"+CLOUD_CONTROLLER_ELEMENT+
    -    // "/"+CASSANDRA_HOST_ADDRESS;
    -    // public static final String CASSANDRA_HOST_PORT_XPATH =
    -    // "/"+CLOUD_CONTROLLER_ELEMENT+
    -    // "/"+CASSANDRA_HOST_PORT;
    +	public static final String DATA_PUBLISHER_XPATH = "/" + CLOUD_CONTROLLER_ELEMENT + "/" + DATA_PUBLISHER_ELEMENT;
    +	public static final String TOPOLOGY_SYNC_XPATH = "/" + CLOUD_CONTROLLER_ELEMENT + "/" + TOPOLOGY_SYNC_ELEMENT;
    +	public static final String DATA_PUBLISHER_CRON_XPATH = "/" + CLOUD_CONTROLLER_ELEMENT + "/" + CRON_ELEMENT;
    +	public static final String BAM_SERVER_ADMIN_USERNAME_XPATH =
    +			"/" + CLOUD_CONTROLLER_ELEMENT + "/" + BAM_SERVER_ADMIN_USERNAME_ELEMENT;
    +	public static final String BAM_SERVER_ADMIN_PASSWORD_XPATH =
    +			"/" + CLOUD_CONTROLLER_ELEMENT + "/" + BAM_SERVER_ADMIN_PASSWORD_ELEMENT;
    +	// public static final String CASSANDRA_HOST_ADDRESS_XPATH =
    --- End diff --
    
    Remove commented lines.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] stratos pull request: Data publisher integration

Posted by Thanu <gi...@git.apache.org>.
Github user Thanu commented on the pull request:

    https://github.com/apache/stratos/pull/403#issuecomment-124357143
  
    Closing this to make one commit for all the changes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] stratos pull request: Data publisher integration

Posted by lahirus <gi...@git.apache.org>.
Github user lahirus commented on a diff in the pull request:

    https://github.com/apache/stratos/pull/403#discussion_r35230668
  
    --- Diff: components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java ---
    @@ -44,347 +43,350 @@
      */
     public class RuleTasksDelegator {
     
    -    private static boolean arspiIsSet = false;
    -
    -    private static final Log log = LogFactory.getLog(RuleTasksDelegator.class);
    -
    -    public double getPredictedValueForNextMinute(float average, float gradient, float secondDerivative, int timeInterval) {
    -        double predictedValue;
    -//        s = u * t + 0.5 * a * t * t
    -        if (log.isDebugEnabled()) {
    -            log.debug(String.format("Predicting the value, [average]: %s , [gradient]: %s , [second derivative] " +
    -                    ": %s , [time intervals]: %s ", average, gradient, secondDerivative, timeInterval));
    -        }
    -        predictedValue = average + gradient * timeInterval + 0.5 * secondDerivative * timeInterval * timeInterval;
    -
    -        return predictedValue;
    -    }
    -
    -
    -    public int getNumberOfInstancesRequiredBasedOnRif(float rifPredictedValue, float rifThreshold) {
    -
    -        if (rifThreshold != 0) {
    -
    -            float requiredNumberOfInstances = rifPredictedValue / rifThreshold;
    -            return (int) Math.ceil(requiredNumberOfInstances);
    -        } else {
    -            log.error("Request in flight threshold is Zero");
    -            return 0;
    -        }
    -
    -    }
    -
    -    public int getNumberOfInstancesRequiredBasedOnMemoryConsumption(float threshold, double predictedValue,
    -                                                                    int min, int max) {
    -        double numberOfAdditionalInstancesRequired = 0;
    -        if (predictedValue != threshold) {
    -
    -            float scalingRange = 100 - threshold;
    -            int instanceRange = max - min;
    -
    -            if (instanceRange != 0) {
    -
    -                float gradient = scalingRange / instanceRange;
    -                numberOfAdditionalInstancesRequired = (predictedValue - threshold) / gradient;
    -            }
    -
    -            if (predictedValue < threshold) {
    -                //Since predicted-value is less, it can be scale-down
    -                return min - 1;
    -            }
    -        }
    -
    -        return (int) Math.ceil(min + numberOfAdditionalInstancesRequired);
    -    }
    -
    -    public int getNumberOfInstancesRequiredBasedOnLoadAverage(float threshold, double predictedValue,
    -                                                              int min) {
    -
    -        double numberOfInstances;
    -        if (threshold != 0) {
    -
    -            numberOfInstances = (min * predictedValue) / threshold;
    -            return (int) Math.ceil(numberOfInstances);
    -        }
    -
    -        return min;
    -    }
    -
    -    public int getMaxNumberOfInstancesRequired(int numberOfInstancesRequiredBasedOnRif,
    -                                               int numberOfInstancesRequiredBasedOnMemoryConsumption,
    -                                               boolean mcReset, int numberOfInstancesReuquiredBasedOnLoadAverage,
    -                                               boolean laReset) {
    -        int numberOfInstances = 0;
    -
    -        int rifBasedRequiredInstances = 0;
    -        int mcBasedRequiredInstances = 0;
    -        int laBasedRequiredInstances = 0;
    -        if (arspiIsSet) {
    -            rifBasedRequiredInstances = numberOfInstancesRequiredBasedOnRif;
    -        }
    -        if (mcReset) {
    -            mcBasedRequiredInstances = numberOfInstancesRequiredBasedOnMemoryConsumption;
    -        }
    -        if (laReset) {
    -            laBasedRequiredInstances = numberOfInstancesReuquiredBasedOnLoadAverage;
    -        }
    -        numberOfInstances = Math.max(Math.max(numberOfInstancesRequiredBasedOnMemoryConsumption,
    -                numberOfInstancesReuquiredBasedOnLoadAverage), numberOfInstancesRequiredBasedOnRif);
    -        return numberOfInstances;
    -    }
    -
    -    public PartitionAlgorithm getPartitionAlgorithm(String partitionAlgorithm) {
    -
    -        PartitionAlgorithm autoscaleAlgorithm = null;
    -        //FIXME to not parse for algo when partition is chosen by the parent
    -
    -        if (partitionAlgorithm == null) {
    -            //Send one after another as default
    -            partitionAlgorithm = StratosConstants.PARTITION_ONE_AFTER_ANOTHER_ALGORITHM_ID;
    -        }
    -        if (log.isDebugEnabled()) {
    -            log.debug(String.format("Retrieving partition algorithm [Partition algorithm]: %s", partitionAlgorithm));
    -        }
    -        if (StratosConstants.PARTITION_ROUND_ROBIN_ALGORITHM_ID.equals(partitionAlgorithm)) {
    -            autoscaleAlgorithm = new RoundRobin();
    -        } else if (StratosConstants.PARTITION_ONE_AFTER_ANOTHER_ALGORITHM_ID.equals(partitionAlgorithm)) {
    -            autoscaleAlgorithm = new OneAfterAnother();
    -        } else {
    -            if (log.isErrorEnabled()) {
    -                log.error(String.format("Partition algorithm %s could not be identified !", partitionAlgorithm));
    -            }
    -        }
    -        return autoscaleAlgorithm;
    -    }
    -
    -    public void delegateInstanceCleanup(String memberId) {
    -        try {
    -            // send the instance notification event.
    -            InstanceNotificationPublisher.getInstance().sendInstanceCleanupEventForMember(memberId);
    -            log.info("Instance clean up event sent for [member] " + memberId);
    -
    -        } catch (Exception e) {
    -            log.error("Cannot terminate instance", e);
    -        }
    -    }
    -
    -    /**
    -     * Invoked from drools to start an instance.
    -     *
    -     * @param clusterMonitorPartitionContext Cluster monitor partition context
    -     * @param clusterId                      Cluster id
    -     * @param clusterInstanceId              Instance id
    -     * @param isPrimary                      Is a primary member
    -     */
    -    public void delegateSpawn(ClusterLevelPartitionContext clusterMonitorPartitionContext, String clusterId,
    -                              String clusterInstanceId, boolean isPrimary) {
    -
    -        try {
    -            String nwPartitionId = clusterMonitorPartitionContext.getNetworkPartitionId();
    -
    -            // Calculate accumulation of minimum counts of all the partition of current network partition
    -            int minimumCountOfNetworkPartition;
    -            ClusterMonitor clusterMonitor = AutoscalerContext.getInstance().getClusterMonitor(clusterId);
    -            ClusterContext clusterContext = clusterMonitor.getClusterContext();
    -            ClusterLevelNetworkPartitionContext clusterLevelNetworkPartitionContext =
    -                    clusterContext.getNetworkPartitionCtxt(nwPartitionId);
    -            ClusterInstanceContext clusterInstanceContext =
    -                    (ClusterInstanceContext) clusterLevelNetworkPartitionContext.
    -                            getInstanceContext(clusterInstanceId);
    -            minimumCountOfNetworkPartition = clusterInstanceContext.getMinInstanceCount();
    -
    -            MemberContext memberContext =
    -                    AutoscalerCloudControllerClient.getInstance()
    -                            .startInstance(clusterMonitorPartitionContext.getPartition(),
    -                                    clusterId,
    -                                    clusterInstanceId, clusterMonitorPartitionContext.getNetworkPartitionId(),
    -                                    isPrimary,
    -                                    minimumCountOfNetworkPartition);
    -            if (memberContext != null) {
    -                ClusterLevelPartitionContext partitionContext = clusterInstanceContext.
    -                        getPartitionCtxt(clusterMonitorPartitionContext.getPartitionId());
    -                partitionContext.addPendingMember(memberContext);
    -                partitionContext.addMemberStatsContext(new MemberStatsContext(memberContext.getMemberId()));
    -                if (log.isDebugEnabled()) {
    -                    log.debug(String.format("Pending member added, [member] %s [partition] %s", memberContext.getMemberId(),
    -                            memberContext.getPartition().getId()));
    -                }
    -
    -            } else {
    -                if (log.isErrorEnabled()) {
    -                    log.error("Member context returned from cloud controller is null");
    -                }
    -            }
    -        } catch (Exception e) {
    -            String message = String.format("Could not start instance: [cluster-id] %s [instance-id] %s",
    -                    clusterId, clusterInstanceId);
    -            log.error(message, e);
    -            throw new RuntimeException(message, e);
    -        }
    -    }
    -
    -    public void delegateScalingDependencyNotification(String clusterId, String networkPartitionId, String instanceId,
    -                                                      int requiredInstanceCount, int minimumInstanceCount) {
    -
    -        if (log.isDebugEnabled()) {
    -            log.debug("Scaling dependent notification is going to the [parentInstance] " + instanceId);
    -        }
    -        //Notify parent for checking scaling dependencies
    -        ClusterMonitor clusterMonitor = AutoscalerContext.getInstance().getClusterMonitor(clusterId);
    -        float fMinimumInstanceCount = minimumInstanceCount;
    -        float factor = requiredInstanceCount / fMinimumInstanceCount;
    -        clusterMonitor.sendClusterScalingEvent(networkPartitionId, instanceId, factor);
    -    }
    -
    -    public void delegateScalingOverMaxNotification(String clusterId, String networkPartitionId, String instanceId) {
    -        if (log.isDebugEnabled()) {
    -            log.debug("Scaling max out notification is going to the [parentInstance] " + instanceId);
    -        }
    -        //Notify parent for checking scaling dependencies
    -        ClusterMonitor clusterMonitor = AutoscalerContext.getInstance().getClusterMonitor(clusterId);
    -        clusterMonitor.sendScalingOverMaxEvent(networkPartitionId, instanceId);
    -    }
    -
    -    public void delegateScalingDownBeyondMinNotification(String clusterId, String networkPartitionId, String instanceId) {
    -        if (log.isDebugEnabled()) {
    -            log.debug("Scaling down lower min notification is going to the [parentInstance] " + instanceId);
    -        }
    -        //Notify parent for checking scaling dependencies
    -        ClusterMonitor clusterMonitor = AutoscalerContext.getInstance().getClusterMonitor(clusterId);
    -        clusterMonitor.sendScalingDownBeyondMinEvent(networkPartitionId, instanceId);
    -    }
    -
    -    public void delegateTerminate(ClusterLevelPartitionContext clusterMonitorPartitionContext, String memberId) {
    -
    -        try {
    -            //Moving member to pending termination list
    -            if (clusterMonitorPartitionContext.activeMemberAvailable(memberId)) {
    -
    -                log.info(String.format("[scale-down] Moving active member to termination pending list [member id] %s " +
    -                                "[partition] %s [network partition] %s", memberId,
    -                        clusterMonitorPartitionContext.getPartitionId(),
    -                        clusterMonitorPartitionContext.getNetworkPartitionId()));
    -                clusterMonitorPartitionContext.moveActiveMemberToTerminationPendingMembers(memberId);
    -                clusterMonitorPartitionContext.removeMemberStatsContext(memberId);
    -            } else if (clusterMonitorPartitionContext.pendingMemberAvailable(memberId)) {
    -
    -                log.info(String.format("[scale-down] Moving pending member to termination pending list [member id] %s " +
    -                                "[partition] %s [network partition] %s", memberId,
    -                        clusterMonitorPartitionContext.getPartitionId(),
    -                        clusterMonitorPartitionContext.getNetworkPartitionId()));
    -                clusterMonitorPartitionContext.movePendingMemberToObsoleteMembers(memberId);
    -                clusterMonitorPartitionContext.removeMemberStatsContext(memberId);
    -            }
    -        } catch (Exception e) {
    -            log.error("[scale-down] Cannot move member to termination pending list ", e);
    -        }
    -    }
    -
    -    public void delegateTerminateDependency(ClusterLevelPartitionContext clusterMonitorPartitionContext, String memberId) {
    -        try {
    -            //calling SM to send the instance notification event.
    -            if (log.isDebugEnabled()) {
    -                log.debug("delegateTerminateDependency:memberId:" + memberId);
    -            }
    -            //InstanceNotificationClient.getInstance().sendMemberCleanupEvent(memberId);
    -            //partitionContext.moveActiveMemberToTerminationPendingMembers(memberId);
    -            //CloudControllerClient.getInstance().terminate(memberId);
    -        } catch (Exception e) {
    -            log.error("Cannot terminate instance", e);
    -        }
    -    }
    -
    -    public void terminateObsoleteInstance(String memberId) {
    -        try {
    -            AutoscalerCloudControllerClient.getInstance().terminateInstance(memberId);
    -        } catch (Exception e) {
    -            log.error("Cannot terminate instance", e);
    -        }
    -    }
    -
    -    //Grouping
    -    public void delegateTerminateAll(String clusterId) {
    -        try {
    -            if (log.isDebugEnabled()) {
    -                log.debug("delegateTerminateAll - begin");
    -            }
    -            AutoscalerCloudControllerClient.getInstance().terminateAllInstances(clusterId);
    -            if (log.isDebugEnabled()) {
    -                log.debug("delegateTerminateAll - done");
    -            }
    -        } catch (Exception e) {
    -            log.error("Cannot terminate instance", e);
    -        }
    -    }
    -
    -    public int getPredictedReplicasForStat(int minReplicas, float statUpperLimit, float statPredictedValue) {
    -        if (statUpperLimit == 0) {
    -            return 0;
    -        }
    -        float predictedValue = ((minReplicas / statUpperLimit) * statPredictedValue);
    -        return (int) Math.ceil(predictedValue);
    -    }
    -
    -    public double getLoadAveragePredictedValue(ClusterInstanceContext clusterInstanceContext) {
    -        double loadAveragePredicted = 0.0d;
    -        int totalMemberCount = 0;
    -        for (ClusterLevelPartitionContext partitionContext : clusterInstanceContext.getPartitionCtxts()) {
    -            for (MemberStatsContext memberStatsContext : partitionContext.getMemberStatsContexts().values()) {
    -
    -                float memberAverageLoadAverage = memberStatsContext.getLoadAverage().getAverage();
    -                float memberGredientLoadAverage = memberStatsContext.getLoadAverage().getGradient();
    -                float memberSecondDerivativeLoadAverage = memberStatsContext.getLoadAverage().getSecondDerivative();
    -
    -                double memberPredictedLoadAverage = getPredictedValueForNextMinute(memberAverageLoadAverage,
    -                        memberGredientLoadAverage, memberSecondDerivativeLoadAverage, 1);
    -
    -                if (log.isDebugEnabled()) {
    -                    log.debug(String.format("[cluster-instance-id] %s [member-id] %s " +
    -                            "[predicted load average] %s "
    -                            , clusterInstanceContext.getId(), memberStatsContext.getMemberId()
    -                            , memberPredictedLoadAverage));
    -                }
    -                loadAveragePredicted += memberPredictedLoadAverage;
    -                ++totalMemberCount;
    -            }
    -        }
    -
    -        if (totalMemberCount > 0) {
    -            log.debug("Predicted load average : " + loadAveragePredicted / totalMemberCount);
    -            return loadAveragePredicted / totalMemberCount;
    -        } else {
    -            return 0;
    -        }
    -    }
    -
    -    public double getMemoryConsumptionPredictedValue(ClusterInstanceContext clusterInstanceContext) {
    -        double memoryConsumptionPredicted = 0.0d;
    -        int totalMemberCount = 0;
    -        for (ClusterLevelPartitionContext partitionContext : clusterInstanceContext.getPartitionCtxts()) {
    -            for (MemberStatsContext memberStatsContext : partitionContext.getMemberStatsContexts().values()) {
    -
    -                float memberMemoryConsumptionAverage = memberStatsContext.getMemoryConsumption().getAverage();
    -                float memberMemoryConsumptionGredient = memberStatsContext.getMemoryConsumption().getGradient();
    -                float memberMemoryConsumptionSecondDerivative = memberStatsContext.getMemoryConsumption().getSecondDerivative();
    -
    -                double memberPredictedMemoryConsumption = getPredictedValueForNextMinute(memberMemoryConsumptionAverage,
    -                        memberMemoryConsumptionGredient, memberMemoryConsumptionSecondDerivative, 1);
    -
    -                if (log.isDebugEnabled()) {
    -                    log.debug(String.format("[member-id] %s [predicted memory consumption] %s ",
    -                            memberStatsContext.getMemberId()
    -                            , memberPredictedMemoryConsumption));
    -                }
    -                memoryConsumptionPredicted += memberPredictedMemoryConsumption;
    -                ++totalMemberCount;
    -            }
    -        }
    -
    -        if (totalMemberCount > 0) {
    -            log.debug("Predicted memory consumption : " + memoryConsumptionPredicted / totalMemberCount);
    -            return memoryConsumptionPredicted / totalMemberCount;
    -        } else {
    -            return 0;
    -        }
    -    }
    +	private static boolean arspiIsSet = false;
    +
    +	private static final Log log = LogFactory.getLog(RuleTasksDelegator.class);
    +
    +	public double getPredictedValueForNextMinute(float average, float gradient, float secondDerivative,
    +	                                             int timeInterval) {
    +		double predictedValue;
    +		//        s = u * t + 0.5 * a * t * t
    +		if (log.isDebugEnabled()) {
    +			log.debug(String.format("Predicting the value, [average]: %s , [gradient]: %s , [second derivative] " +
    +			                        ": %s , [time intervals]: %s ", average, gradient, secondDerivative, timeInterval));
    +		}
    +		predictedValue = average + gradient * timeInterval + 0.5 * secondDerivative * timeInterval * timeInterval;
    +
    +		return predictedValue;
    +	}
    +
    +	public int getNumberOfInstancesRequiredBasedOnRif(float rifPredictedValue, float rifThreshold) {
    +
    +		if (rifThreshold != 0) {
    +
    +			float requiredNumberOfInstances = rifPredictedValue / rifThreshold;
    +			return (int) Math.ceil(requiredNumberOfInstances);
    +		} else {
    +			log.error("Request in flight threshold is Zero");
    +			return 0;
    +		}
    +
    +	}
    +
    +	public int getNumberOfInstancesRequiredBasedOnMemoryConsumption(float threshold, double predictedValue, int min,
    +	                                                                int max) {
    +		double numberOfAdditionalInstancesRequired = 0;
    +		if (predictedValue != threshold) {
    +
    +			float scalingRange = 100 - threshold;
    +			int instanceRange = max - min;
    +
    +			if (instanceRange != 0) {
    +
    +				float gradient = scalingRange / instanceRange;
    +				numberOfAdditionalInstancesRequired = (predictedValue - threshold) / gradient;
    +			}
    +
    +			if (predictedValue < threshold) {
    +				//Since predicted-value is less, it can be scale-down
    +				return min - 1;
    +			}
    +		}
    +
    +		return (int) Math.ceil(min + numberOfAdditionalInstancesRequired);
    +	}
    +
    +	public int getNumberOfInstancesRequiredBasedOnLoadAverage(float threshold, double predictedValue, int min) {
    +
    +		double numberOfInstances;
    +		if (threshold != 0) {
    +
    +			numberOfInstances = (min * predictedValue) / threshold;
    +			return (int) Math.ceil(numberOfInstances);
    +		}
    +
    +		return min;
    +	}
    +
    +	public int getMaxNumberOfInstancesRequired(int numberOfInstancesRequiredBasedOnRif,
    +	                                           int numberOfInstancesRequiredBasedOnMemoryConsumption, boolean mcReset,
    +	                                           int numberOfInstancesReuquiredBasedOnLoadAverage, boolean laReset) {
    +		int numberOfInstances = 0;
    +
    +		int rifBasedRequiredInstances = 0;
    +		int mcBasedRequiredInstances = 0;
    +		int laBasedRequiredInstances = 0;
    +		if (arspiIsSet) {
    +			rifBasedRequiredInstances = numberOfInstancesRequiredBasedOnRif;
    +		}
    +		if (mcReset) {
    +			mcBasedRequiredInstances = numberOfInstancesRequiredBasedOnMemoryConsumption;
    +		}
    +		if (laReset) {
    +			laBasedRequiredInstances = numberOfInstancesReuquiredBasedOnLoadAverage;
    +		}
    +		numberOfInstances = Math.max(Math.max(numberOfInstancesRequiredBasedOnMemoryConsumption,
    +		                                      numberOfInstancesReuquiredBasedOnLoadAverage),
    +		                             numberOfInstancesRequiredBasedOnRif);
    +		return numberOfInstances;
    +	}
    +
    +	public PartitionAlgorithm getPartitionAlgorithm(String partitionAlgorithm) {
    +
    +		PartitionAlgorithm autoscaleAlgorithm = null;
    +		//FIXME to not parse for algo when partition is chosen by the parent
    +
    +		if (partitionAlgorithm == null) {
    +			//Send one after another as default
    +			partitionAlgorithm = StratosConstants.PARTITION_ONE_AFTER_ANOTHER_ALGORITHM_ID;
    +		}
    +		if (log.isDebugEnabled()) {
    +			log.debug(String.format("Retrieving partition algorithm [Partition algorithm]: %s", partitionAlgorithm));
    +		}
    +		if (StratosConstants.PARTITION_ROUND_ROBIN_ALGORITHM_ID.equals(partitionAlgorithm)) {
    +			autoscaleAlgorithm = new RoundRobin();
    +		} else if (StratosConstants.PARTITION_ONE_AFTER_ANOTHER_ALGORITHM_ID.equals(partitionAlgorithm)) {
    +			autoscaleAlgorithm = new OneAfterAnother();
    +		} else {
    +			if (log.isErrorEnabled()) {
    +				log.error(String.format("Partition algorithm %s could not be identified !", partitionAlgorithm));
    +			}
    +		}
    +		return autoscaleAlgorithm;
    +	}
    +
    +	public void delegateInstanceCleanup(String memberId) {
    +		try {
    +			// send the instance notification event.
    +			InstanceNotificationPublisher.getInstance().sendInstanceCleanupEventForMember(memberId);
    +			log.info("Instance clean up event sent for [member] " + memberId);
    +
    +		} catch (Exception e) {
    +			log.error("Cannot terminate instance", e);
    +		}
    +	}
    +
    +	/**
    +	 * Invoked from drools to start an instance.
    +	 *
    +	 * @param clusterMonitorPartitionContext Cluster monitor partition context
    +	 * @param clusterId                      Cluster id
    +	 * @param clusterInstanceId              Instance id
    +	 * @param isPrimary                      Is a primary member
    +	 */
    +	public void delegateSpawn(ClusterLevelPartitionContext clusterMonitorPartitionContext, String clusterId,
    +	                          String clusterInstanceId, boolean isPrimary, String autoscalingReason, long scalingTime) {
    +
    +		try {
    +			String nwPartitionId = clusterMonitorPartitionContext.getNetworkPartitionId();
    +
    +			// Calculate accumulation of minimum counts of all the partition of current network partition
    +			int minimumCountOfNetworkPartition;
    +			ClusterMonitor clusterMonitor = AutoscalerContext.getInstance().getClusterMonitor(clusterId);
    +			ClusterContext clusterContext = clusterMonitor.getClusterContext();
    +			ClusterLevelNetworkPartitionContext clusterLevelNetworkPartitionContext =
    +					clusterContext.getNetworkPartitionCtxt(nwPartitionId);
    +			ClusterInstanceContext clusterInstanceContext =
    +					(ClusterInstanceContext) clusterLevelNetworkPartitionContext.
    +							                                                            getInstanceContext(
    +									                                                            clusterInstanceId);
    +			minimumCountOfNetworkPartition = clusterInstanceContext.getMinInstanceCount();
    +
    +			MemberContext memberContext = AutoscalerCloudControllerClient.getInstance().startInstance(
    +					clusterMonitorPartitionContext.getPartition(), clusterId, clusterInstanceId,
    +					clusterMonitorPartitionContext.getNetworkPartitionId(), isPrimary, minimumCountOfNetworkPartition,
    +					autoscalingReason, scalingTime);
    +			if (memberContext != null) {
    +				ClusterLevelPartitionContext partitionContext = clusterInstanceContext.
    +						                                                                      getPartitionCtxt(
    +								                                                                      clusterMonitorPartitionContext
    +										                                                                      .getPartitionId());
    +				partitionContext.addPendingMember(memberContext);
    +				partitionContext.addMemberStatsContext(new MemberStatsContext(memberContext.getMemberId()));
    +				if (log.isDebugEnabled()) {
    +					log.debug(String.format("Pending member added, [member] %s [partition] %s",
    +					                        memberContext.getMemberId(), memberContext.getPartition().getId()));
    +				}
    +
    +			} else {
    +				if (log.isErrorEnabled()) {
    +					log.error("Member context returned from cloud controller is null");
    +				}
    +			}
    +		} catch (Exception e) {
    +			String message = String.format("Could not start instance: [cluster-id] %s [instance-id] %s", clusterId,
    +			                               clusterInstanceId);
    +			log.error(message, e);
    +			throw new RuntimeException(message, e);
    +		}
    +	}
    +
    +	public void delegateScalingDependencyNotification(String clusterId, String networkPartitionId, String instanceId,
    +	                                                  int requiredInstanceCount, int minimumInstanceCount) {
    +
    +		if (log.isDebugEnabled()) {
    +			log.debug("Scaling dependent notification is going to the [parentInstance] " + instanceId);
    +		}
    +		//Notify parent for checking scaling dependencies
    +		ClusterMonitor clusterMonitor = AutoscalerContext.getInstance().getClusterMonitor(clusterId);
    +		float fMinimumInstanceCount = minimumInstanceCount;
    +		float factor = requiredInstanceCount / fMinimumInstanceCount;
    +		clusterMonitor.sendClusterScalingEvent(networkPartitionId, instanceId, factor);
    +	}
    +
    +	public void delegateScalingOverMaxNotification(String clusterId, String networkPartitionId, String instanceId) {
    +		if (log.isDebugEnabled()) {
    +			log.debug("Scaling max out notification is going to the [parentInstance] " + instanceId);
    +		}
    +		//Notify parent for checking scaling dependencies
    +		ClusterMonitor clusterMonitor = AutoscalerContext.getInstance().getClusterMonitor(clusterId);
    +		clusterMonitor.sendScalingOverMaxEvent(networkPartitionId, instanceId);
    +	}
    +
    +	public void delegateScalingDownBeyondMinNotification(String clusterId, String networkPartitionId,
    +	                                                     String instanceId) {
    +		if (log.isDebugEnabled()) {
    +			log.debug("Scaling down lower min notification is going to the [parentInstance] " + instanceId);
    +		}
    +		//Notify parent for checking scaling dependencies
    +		ClusterMonitor clusterMonitor = AutoscalerContext.getInstance().getClusterMonitor(clusterId);
    +		clusterMonitor.sendScalingDownBeyondMinEvent(networkPartitionId, instanceId);
    +	}
    +
    +	public void delegateTerminate(ClusterLevelPartitionContext clusterMonitorPartitionContext, String memberId) {
    +
    +		try {
    +			//Moving member to pending termination list
    +			if (clusterMonitorPartitionContext.activeMemberAvailable(memberId)) {
    +
    +				log.info(String.format("[scale-down] Moving active member to termination pending list [member id] %s " +
    +				                       "[partition] %s [network partition] %s", memberId,
    +				                       clusterMonitorPartitionContext.getPartitionId(),
    +				                       clusterMonitorPartitionContext.getNetworkPartitionId()));
    +				clusterMonitorPartitionContext.moveActiveMemberToTerminationPendingMembers(memberId);
    +				clusterMonitorPartitionContext.removeMemberStatsContext(memberId);
    +			} else if (clusterMonitorPartitionContext.pendingMemberAvailable(memberId)) {
    +
    +				log.info(String.format(
    +						"[scale-down] Moving pending member to termination pending list [member id] %s " +
    +						"[partition] %s [network partition] %s", memberId,
    +						clusterMonitorPartitionContext.getPartitionId(),
    +						clusterMonitorPartitionContext.getNetworkPartitionId()));
    +				clusterMonitorPartitionContext.movePendingMemberToObsoleteMembers(memberId);
    +				clusterMonitorPartitionContext.removeMemberStatsContext(memberId);
    +			}
    +		} catch (Exception e) {
    +			log.error("[scale-down] Cannot move member to termination pending list ", e);
    +		}
    +	}
    +
    +	public void delegateTerminateDependency(ClusterLevelPartitionContext clusterMonitorPartitionContext,
    +	                                        String memberId) {
    +		try {
    +			//calling SM to send the instance notification event.
    +			if (log.isDebugEnabled()) {
    +				log.debug("delegateTerminateDependency:memberId:" + memberId);
    +			}
    +			//InstanceNotificationClient.getInstance().sendMemberCleanupEvent(memberId);
    +			//partitionContext.moveActiveMemberToTerminationPendingMembers(memberId);
    --- End diff --
    
    remove commented lines


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---