Moving POlicy related pojos to pojo package
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/531517a1 Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/531517a1 Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/531517a1 Branch: refs/heads/master Commit: 531517a1d6bb933cfe79a03b7c6dce9d943cd22c Parents: 54c8c97 Author: Lahiru Sandaruwan <[email protected]> Authored: Sat Nov 29 01:35:43 2014 +0530 Committer: Lahiru Sandaruwan <[email protected]> Committed: Sat Nov 29 01:35:43 2014 +0530 ---------------------------------------------------------------------- .../algorithm/AutoscaleAlgorithm.java | 4 +- .../autoscaler/algorithm/OneAfterAnother.java | 4 +- .../autoscaler/api/AutoScalerServiceImpl.java | 12 +- .../client/CloudControllerClient.java | 2 +- .../autoscaler/commands/ASPolicyCommands.java | 4 +- .../commands/DeploymentPolicyCommands.java | 4 +- .../autoscaler/commands/PartitionsCommands.java | 2 +- .../context/cluster/ClusterContextFactory.java | 11 +- .../cluster/KubernetesClusterContext.java | 8 +- .../context/cluster/VMClusterContext.java | 3 +- .../cluster/VMServiceClusterContext.java | 4 +- .../context/member/MemberStatsContext.java | 4 +- .../ClusterLevelNetworkPartitionContext.java | 7 +- .../interfaces/AutoScalerServiceInterface.java | 9 +- .../internal/AutoscalerServerComponent.java | 8 +- .../KubernetesServiceClusterMonitor.java | 2 +- .../monitor/cluster/VMLbClusterMonitor.java | 6 +- .../monitor/component/ApplicationMonitor.java | 7 +- .../monitor/component/GroupMonitor.java | 6 +- .../autoscaler/partition/PartitionManager.java | 177 ------------ .../ApplicationLevelNetworkPartition.java | 76 ----- .../network/ChildLevelNetworkPartition.java | 88 ------ .../partition/network/NetworkPartition.java | 44 --- .../autoscaler/pojo/policy/PolicyManager.java | 289 +++++++++++++++++++ .../pojo/policy/autoscale/AutoscalePolicy.java | 187 ++++++++++++ .../pojo/policy/autoscale/LoadAverage.java | 114 ++++++++ .../policy/autoscale/LoadAverageThresholds.java | 52 ++++ .../pojo/policy/autoscale/LoadThresholds.java | 106 +++++++ .../policy/autoscale/MemoryConsumption.java | 116 ++++++++ .../autoscale/MemoryConsumptionThresholds.java | 52 ++++ .../pojo/policy/autoscale/RequestsInFlight.java | 109 +++++++ .../autoscale/RequestsInFlightThresholds.java | 53 ++++ .../policy/deployment/DeploymentPolicy.java | 189 ++++++++++++ .../deployment/partition/PartitionManager.java | 177 ++++++++++++ .../ApplicationLevelNetworkPartition.java | 76 +++++ .../network/ChildLevelNetworkPartition.java | 88 ++++++ .../partition/network/NetworkPartition.java | 44 +++ .../autoscaler/policy/PolicyManager.java | 289 ------------------- .../policy/model/AutoscalePolicy.java | 187 ------------ .../policy/model/DeploymentPolicy.java | 189 ------------ .../autoscaler/policy/model/LoadAverage.java | 114 -------- .../policy/model/LoadAverageThresholds.java | 52 ---- .../autoscaler/policy/model/LoadThresholds.java | 106 ------- .../policy/model/MemoryConsumption.java | 116 -------- .../model/MemoryConsumptionThresholds.java | 52 ---- .../policy/model/RequestsInFlight.java | 109 ------- .../model/RequestsInFlightThresholds.java | 53 ---- .../autoscaler/registry/RegistryManager.java | 4 +- .../rule/AutoscalerRuleEvaluator.java | 2 +- .../autoscaler/rule/RuleTasksDelegator.java | 2 +- .../src/test/resources/autoscaler-old.drl | 10 +- .../src/test/resources/autoscaler.drl | 14 +- .../test/resources/minimum-autoscaler-rule.drl | 10 +- .../resources/test-minimum-autoscaler-rule.drl | 14 +- .../test-terminating-obsoleted-members-rule.drl | 14 +- .../src/main/conf/drools/container-scaling.drl | 6 +- .../src/main/conf/drools/dependent-scaling.drl | 12 +- .../src/main/conf/drools/mincheck.drl | 14 +- .../src/main/conf/drools/obsoletecheck.drl | 14 +- .../src/main/conf/drools/scaling.drl | 22 +- .../main/conf/drools/terminatedependency.drl | 2 +- .../pom.xml | 3 +- 62 files changed, 1774 insertions(+), 1780 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/AutoscaleAlgorithm.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/AutoscaleAlgorithm.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/AutoscaleAlgorithm.java index 685c0b4..33c3ac1 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/AutoscaleAlgorithm.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/AutoscaleAlgorithm.java @@ -44,7 +44,7 @@ public interface AutoscaleAlgorithm { public boolean scaleDownPartitionAvailable(String clusterId); /** - * Returns a {@link Partition} to scale up from the given {@link org.apache.stratos.autoscaler.partition.network.NetworkPartition} according to algorithm + * Returns a {@link Partition} to scale up from the given {@link org.apache.stratos.autoscaler.pojo.policy.deployment.partition.network.NetworkPartition} according to algorithm * @param clusterLevelNetworkPartitionContext {@link org.apache.stratos.autoscaler.context.partition.network.ClusterLevelNetworkPartitionContext} which need the {@link Partition} * @param clusterId Id of the cluster which need the {@link Partition} * @return {@link Partition} to scale up @@ -53,7 +53,7 @@ public interface AutoscaleAlgorithm { /** - * Returns a {@link Partition} to scale down from the given {@link org.apache.stratos.autoscaler.partition.network.NetworkPartition} according to algorithm + * Returns a {@link Partition} to scale down from the given {@link org.apache.stratos.autoscaler.pojo.policy.deployment.partition.network.NetworkPartition} according to algorithm * @param clusterLevelNetworkPartitionContext {@link org.apache.stratos.autoscaler.context.partition.network.ClusterLevelNetworkPartitionContext} which need the {@link Partition} * @param clusterId Id of the cluster which need the {@link Partition} * @return {@link Partition} to scale down http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/OneAfterAnother.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/OneAfterAnother.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/OneAfterAnother.java index 0d8aace..5a80176 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/OneAfterAnother.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/OneAfterAnother.java @@ -27,7 +27,7 @@ import org.apache.stratos.cloud.controller.stub.deployment.partition.Partition; import java.util.Arrays; import java.util.List; -//import org.apache.stratos.autoscaler.partition.networkPartitionContext; +//import org.apache.stratos.autoscaler.pojo.policy.deployment.partition.networkPartitionContext; /** * @@ -37,7 +37,7 @@ import java.util.List; * This class is used for selecting a {@link Partition} one after another and checking availability of * partitions of a {@link org.apache.stratos.autoscaler.context.partition.network.ClusterLevelNetworkPartitionContext} * One after another means it completes partitions in the order defined in - * {@link org.apache.stratos.autoscaler.policy.model.DeploymentPolicy}, and go to next if current one + * {@link org.apache.stratos.autoscaler.pojo.policy.deployment.DeploymentPolicy}, and go to next if current one * reached the max limit */ public class OneAfterAnother implements AutoscaleAlgorithm { http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/api/AutoScalerServiceImpl.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/api/AutoScalerServiceImpl.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/api/AutoScalerServiceImpl.java index a8f4a2e..aa6e332 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/api/AutoScalerServiceImpl.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/api/AutoScalerServiceImpl.java @@ -31,20 +31,18 @@ import org.apache.stratos.autoscaler.client.CloudControllerClient; import org.apache.stratos.autoscaler.exception.*; import org.apache.stratos.autoscaler.exception.application.ApplicationDefinitionException; import org.apache.stratos.autoscaler.exception.kubernetes.*; -import org.apache.stratos.autoscaler.exception.partition.InvalidPartitionException; import org.apache.stratos.autoscaler.exception.partition.PartitionValidationException; import org.apache.stratos.autoscaler.exception.policy.InvalidPolicyException; import org.apache.stratos.autoscaler.interfaces.AutoScalerServiceInterface; import org.apache.stratos.autoscaler.kubernetes.KubernetesManager; import org.apache.stratos.autoscaler.monitor.cluster.AbstractClusterMonitor; -import org.apache.stratos.autoscaler.partition.network.ApplicationLevelNetworkPartition; -import org.apache.stratos.autoscaler.partition.network.NetworkPartition; -//import org.apache.stratos.autoscaler.partition.PartitionManager; +import org.apache.stratos.autoscaler.pojo.policy.deployment.partition.network.ApplicationLevelNetworkPartition; +//import org.apache.stratos.autoscaler.pojo.policy.deployment.partition.PartitionManager; import org.apache.stratos.autoscaler.pojo.Dependencies; import org.apache.stratos.autoscaler.pojo.ServiceGroup; -import org.apache.stratos.autoscaler.policy.PolicyManager; -import org.apache.stratos.autoscaler.policy.model.AutoscalePolicy; -import org.apache.stratos.autoscaler.policy.model.DeploymentPolicy; +import org.apache.stratos.autoscaler.pojo.policy.PolicyManager; +import org.apache.stratos.autoscaler.pojo.policy.autoscale.AutoscalePolicy; +import org.apache.stratos.autoscaler.pojo.policy.deployment.DeploymentPolicy; import org.apache.stratos.autoscaler.registry.RegistryManager; import org.apache.stratos.cloud.controller.stub.deployment.partition.Partition; import org.apache.stratos.cloud.controller.stub.pojo.Properties; http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java index ee68c64..b9c052b 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java @@ -30,7 +30,7 @@ import org.apache.stratos.autoscaler.exception.cartridge.SpawningException; import org.apache.stratos.autoscaler.exception.cartridge.TerminationException; import org.apache.stratos.autoscaler.exception.kubernetes.NonExistingKubernetesGroupException; import org.apache.stratos.autoscaler.exception.partition.PartitionValidationException; -import org.apache.stratos.autoscaler.policy.model.DeploymentPolicy; +import org.apache.stratos.autoscaler.pojo.policy.deployment.DeploymentPolicy; import org.apache.stratos.autoscaler.kubernetes.KubernetesManager; import org.apache.stratos.autoscaler.util.ConfUtil; import org.apache.stratos.cloud.controller.stub.*; http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/commands/ASPolicyCommands.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/commands/ASPolicyCommands.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/commands/ASPolicyCommands.java index b1ead6f..4e0c66a 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/commands/ASPolicyCommands.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/commands/ASPolicyCommands.java @@ -19,8 +19,8 @@ package org.apache.stratos.autoscaler.commands; -import org.apache.stratos.autoscaler.policy.PolicyManager; -import org.apache.stratos.autoscaler.policy.model.AutoscalePolicy; +import org.apache.stratos.autoscaler.pojo.policy.PolicyManager; +import org.apache.stratos.autoscaler.pojo.policy.autoscale.AutoscalePolicy; import org.eclipse.osgi.framework.console.CommandInterpreter; import org.eclipse.osgi.framework.console.CommandProvider; http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/commands/DeploymentPolicyCommands.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/commands/DeploymentPolicyCommands.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/commands/DeploymentPolicyCommands.java index 9cd5d76..3eada6b 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/commands/DeploymentPolicyCommands.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/commands/DeploymentPolicyCommands.java @@ -20,8 +20,8 @@ package org.apache.stratos.autoscaler.commands; import org.apache.commons.lang.StringUtils; -import org.apache.stratos.autoscaler.policy.model.DeploymentPolicy; -import org.apache.stratos.autoscaler.policy.PolicyManager; +import org.apache.stratos.autoscaler.pojo.policy.deployment.DeploymentPolicy; +import org.apache.stratos.autoscaler.pojo.policy.PolicyManager; import org.eclipse.osgi.framework.console.CommandInterpreter; import org.eclipse.osgi.framework.console.CommandProvider; http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/commands/PartitionsCommands.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/commands/PartitionsCommands.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/commands/PartitionsCommands.java index 4ee575a..3e434ef 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/commands/PartitionsCommands.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/commands/PartitionsCommands.java @@ -20,7 +20,7 @@ //package org.apache.stratos.autoscaler.commands; // //import org.apache.commons.lang.StringUtils; -//import org.apache.stratos.autoscaler.partition.PartitionManager; +//import org.apache.stratos.autoscaler.pojo.policy.deployment.partition.PartitionManager; //import org.apache.stratos.cloud.controller.stub.deployment.partition.Partition; //import org.eclipse.osgi.framework.console.CommandInterpreter; //import org.eclipse.osgi.framework.console.CommandProvider; http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContextFactory.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContextFactory.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContextFactory.java index a6d026e..dc55a9e 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContextFactory.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContextFactory.java @@ -27,12 +27,11 @@ import org.apache.stratos.autoscaler.context.partition.network.ClusterLevelNetwo import org.apache.stratos.autoscaler.context.partition.ClusterLevelPartitionContext; import org.apache.stratos.autoscaler.exception.partition.PartitionValidationException; import org.apache.stratos.autoscaler.exception.policy.PolicyValidationException; -import org.apache.stratos.autoscaler.partition.network.ChildLevelNetworkPartition; -import org.apache.stratos.autoscaler.partition.network.NetworkPartition; -//import org.apache.stratos.autoscaler.partition.PartitionManager; -import org.apache.stratos.autoscaler.policy.PolicyManager; -import org.apache.stratos.autoscaler.policy.model.AutoscalePolicy; -import org.apache.stratos.autoscaler.policy.model.DeploymentPolicy; +import org.apache.stratos.autoscaler.pojo.policy.deployment.partition.network.ChildLevelNetworkPartition; +//import org.apache.stratos.autoscaler.pojo.policy.deployment.partition.PartitionManager; +import org.apache.stratos.autoscaler.pojo.policy.PolicyManager; +import org.apache.stratos.autoscaler.pojo.policy.autoscale.AutoscalePolicy; +import org.apache.stratos.autoscaler.pojo.policy.deployment.DeploymentPolicy; import org.apache.stratos.cloud.controller.stub.deployment.partition.Partition; import org.apache.stratos.cloud.controller.stub.pojo.MemberContext; import org.apache.stratos.cloud.controller.stub.pojo.Properties; http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/KubernetesClusterContext.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/KubernetesClusterContext.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/KubernetesClusterContext.java index 43b8db9..4f0b34f 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/KubernetesClusterContext.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/KubernetesClusterContext.java @@ -30,10 +30,10 @@ import org.apache.commons.configuration.XMLConfiguration; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.stratos.autoscaler.context.member.MemberStatsContext; -import org.apache.stratos.autoscaler.policy.model.AutoscalePolicy; -import org.apache.stratos.autoscaler.policy.model.LoadAverage; -import org.apache.stratos.autoscaler.policy.model.MemoryConsumption; -import org.apache.stratos.autoscaler.policy.model.RequestsInFlight; +import org.apache.stratos.autoscaler.pojo.policy.autoscale.AutoscalePolicy; +import org.apache.stratos.autoscaler.pojo.policy.autoscale.LoadAverage; +import org.apache.stratos.autoscaler.pojo.policy.autoscale.MemoryConsumption; +import org.apache.stratos.autoscaler.pojo.policy.autoscale.RequestsInFlight; import org.apache.stratos.autoscaler.util.ConfUtil; import org.apache.stratos.cloud.controller.stub.pojo.MemberContext; import org.apache.stratos.common.constants.StratosConstants; http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/VMClusterContext.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/VMClusterContext.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/VMClusterContext.java index f5c3baa..fb2de33 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/VMClusterContext.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/VMClusterContext.java @@ -21,7 +21,8 @@ package org.apache.stratos.autoscaler.context.cluster; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.stratos.autoscaler.context.partition.network.ClusterLevelNetworkPartitionContext; -import org.apache.stratos.autoscaler.policy.model.*; +import org.apache.stratos.autoscaler.pojo.policy.autoscale.AutoscalePolicy; +import org.apache.stratos.autoscaler.pojo.policy.deployment.DeploymentPolicy; import org.apache.stratos.messaging.domain.topology.Member; import java.util.*; http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/VMServiceClusterContext.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/VMServiceClusterContext.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/VMServiceClusterContext.java index 69720c4..35c704d 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/VMServiceClusterContext.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/VMServiceClusterContext.java @@ -21,8 +21,8 @@ package org.apache.stratos.autoscaler.context.cluster; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.stratos.autoscaler.context.partition.network.ClusterLevelNetworkPartitionContext; -import org.apache.stratos.autoscaler.policy.model.AutoscalePolicy; -import org.apache.stratos.autoscaler.policy.model.DeploymentPolicy; +import org.apache.stratos.autoscaler.pojo.policy.autoscale.AutoscalePolicy; +import org.apache.stratos.autoscaler.pojo.policy.deployment.DeploymentPolicy; import java.util.Map; http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/member/MemberStatsContext.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/member/MemberStatsContext.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/member/MemberStatsContext.java index 9999770..6981095 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/member/MemberStatsContext.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/member/MemberStatsContext.java @@ -19,8 +19,8 @@ package org.apache.stratos.autoscaler.context.member; -import org.apache.stratos.autoscaler.policy.model.LoadAverage; -import org.apache.stratos.autoscaler.policy.model.MemoryConsumption; +import org.apache.stratos.autoscaler.pojo.policy.autoscale.LoadAverage; +import org.apache.stratos.autoscaler.pojo.policy.autoscale.MemoryConsumption; /** * This class will keep additional parameters such as load average and memory consumption http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/partition/network/ClusterLevelNetworkPartitionContext.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/partition/network/ClusterLevelNetworkPartitionContext.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/partition/network/ClusterLevelNetworkPartitionContext.java index 10492f3..f9919e0 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/partition/network/ClusterLevelNetworkPartitionContext.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/partition/network/ClusterLevelNetworkPartitionContext.java @@ -22,11 +22,10 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.stratos.autoscaler.context.cluster.ClusterInstanceContext; import org.apache.stratos.autoscaler.context.partition.ClusterLevelPartitionContext; -import org.apache.stratos.autoscaler.policy.model.LoadAverage; -import org.apache.stratos.autoscaler.policy.model.MemoryConsumption; -import org.apache.stratos.autoscaler.policy.model.RequestsInFlight; +import org.apache.stratos.autoscaler.pojo.policy.autoscale.LoadAverage; +import org.apache.stratos.autoscaler.pojo.policy.autoscale.MemoryConsumption; +import org.apache.stratos.autoscaler.pojo.policy.autoscale.RequestsInFlight; import org.apache.stratos.cloud.controller.stub.deployment.partition.Partition; -import org.apache.stratos.messaging.domain.instance.Instance; import java.io.Serializable; import java.util.Arrays; http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/interfaces/AutoScalerServiceInterface.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/interfaces/AutoScalerServiceInterface.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/interfaces/AutoScalerServiceInterface.java index 4db8518..141b90f 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/interfaces/AutoScalerServiceInterface.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/interfaces/AutoScalerServiceInterface.java @@ -23,15 +23,12 @@ package org.apache.stratos.autoscaler.interfaces; import org.apache.stratos.autoscaler.applications.pojo.ApplicationContext; import org.apache.stratos.autoscaler.exception.kubernetes.*; -import org.apache.stratos.autoscaler.policy.model.DeploymentPolicy; +import org.apache.stratos.autoscaler.pojo.policy.deployment.DeploymentPolicy; import org.apache.stratos.autoscaler.exception.*; import org.apache.stratos.autoscaler.exception.application.ApplicationDefinitionException; -import org.apache.stratos.autoscaler.exception.partition.InvalidPartitionException; import org.apache.stratos.autoscaler.exception.policy.InvalidPolicyException; -import org.apache.stratos.autoscaler.partition.network.NetworkPartition; import org.apache.stratos.autoscaler.pojo.ServiceGroup; -import org.apache.stratos.autoscaler.policy.model.AutoscalePolicy; -import org.apache.stratos.cloud.controller.stub.deployment.partition.Partition; +import org.apache.stratos.autoscaler.pojo.policy.autoscale.AutoscalePolicy; import org.apache.stratos.cloud.controller.stub.pojo.Properties; import org.apache.stratos.common.kubernetes.KubernetesGroup; import org.apache.stratos.common.kubernetes.KubernetesHost; @@ -63,7 +60,7 @@ public interface AutoScalerServiceInterface { public AutoscalePolicy getAutoscalingPolicy(String autoscalingPolicyId); - public org.apache.stratos.autoscaler.partition.network.ApplicationLevelNetworkPartition[] getNetworkPartitions(String deploymentPolicyId); + public org.apache.stratos.autoscaler.pojo.policy.deployment.partition.network.ApplicationLevelNetworkPartition[] getNetworkPartitions(String deploymentPolicyId); // public Partition[] getPartitionsOfGroup(String deploymentPolicyId, String partitionGroup); // http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/internal/AutoscalerServerComponent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/internal/AutoscalerServerComponent.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/internal/AutoscalerServerComponent.java index 7623f32..4ee16aa 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/internal/AutoscalerServerComponent.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/internal/AutoscalerServerComponent.java @@ -22,14 +22,14 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; //import org.apache.stratos.autoscaler.NetworkPartitionLbHolder; import org.apache.stratos.autoscaler.applications.ApplicationSynchronizerTaskScheduler; -import org.apache.stratos.autoscaler.policy.model.DeploymentPolicy; +import org.apache.stratos.autoscaler.pojo.policy.deployment.DeploymentPolicy; import org.apache.stratos.autoscaler.exception.AutoScalerException; import org.apache.stratos.autoscaler.kubernetes.KubernetesManager; import org.apache.stratos.autoscaler.event.receiver.health.AutoscalerHealthStatEventReceiver; import org.apache.stratos.autoscaler.event.receiver.topology.AutoscalerTopologyEventReceiver; -//import org.apache.stratos.autoscaler.partition.PartitionManager; -import org.apache.stratos.autoscaler.policy.PolicyManager; -import org.apache.stratos.autoscaler.policy.model.AutoscalePolicy; +//import org.apache.stratos.autoscaler.pojo.policy.deployment.partition.PartitionManager; +import org.apache.stratos.autoscaler.pojo.policy.PolicyManager; +import org.apache.stratos.autoscaler.pojo.policy.autoscale.AutoscalePolicy; import org.apache.stratos.autoscaler.registry.RegistryManager; import org.apache.stratos.autoscaler.status.processor.cluster.ClusterStatusProcessorChain; import org.apache.stratos.autoscaler.status.processor.group.GroupStatusProcessorChain; http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/KubernetesServiceClusterMonitor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/KubernetesServiceClusterMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/KubernetesServiceClusterMonitor.java index a2652de..bf659be 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/KubernetesServiceClusterMonitor.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/KubernetesServiceClusterMonitor.java @@ -30,7 +30,7 @@ import org.apache.stratos.autoscaler.context.cluster.AbstractClusterContext; import org.apache.stratos.autoscaler.context.cluster.KubernetesClusterContext; import org.apache.stratos.autoscaler.exception.InvalidArgumentException; import org.apache.stratos.autoscaler.monitor.events.MonitorScalingEvent; -import org.apache.stratos.autoscaler.policy.model.AutoscalePolicy; +import org.apache.stratos.autoscaler.pojo.policy.autoscale.AutoscalePolicy; import org.apache.stratos.autoscaler.rule.AutoscalerRuleEvaluator; import org.apache.stratos.autoscaler.util.AutoScalerConstants; import org.apache.stratos.autoscaler.util.ConfUtil; http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMLbClusterMonitor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMLbClusterMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMLbClusterMonitor.java index fe639ed..370a2a3 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMLbClusterMonitor.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMLbClusterMonitor.java @@ -30,9 +30,9 @@ //import org.apache.stratos.autoscaler.context.partition.network.ClusterLevelNetworkPartitionContext; //import org.apache.stratos.autoscaler.context.partition.ClusterLevelPartitionContext; //import org.apache.stratos.autoscaler.monitor.events.MonitorScalingEvent; -//import org.apache.stratos.autoscaler.partition.PartitionManager; -//import org.apache.stratos.autoscaler.policy.PolicyManager; -//import org.apache.stratos.autoscaler.policy.model.DeploymentPolicy; +//import org.apache.stratos.autoscaler.pojo.policy.deployment.partition.PartitionManager; +//import org.apache.stratos.autoscaler.pojo.policy.PolicyManager; +//import org.apache.stratos.autoscaler.pojo.policy.deployment.DeploymentPolicy; //import org.apache.stratos.autoscaler.rule.AutoscalerRuleEvaluator; //import org.apache.stratos.autoscaler.util.AutoScalerConstants; //import org.apache.stratos.autoscaler.util.ConfUtil; http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ApplicationMonitor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ApplicationMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ApplicationMonitor.java index a8e0ca8..00fb406 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ApplicationMonitor.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ApplicationMonitor.java @@ -32,10 +32,9 @@ import org.apache.stratos.autoscaler.monitor.events.builder.MonitorStatusEventBu import org.apache.stratos.autoscaler.monitor.events.ApplicationStatusEvent; import org.apache.stratos.autoscaler.monitor.events.MonitorScalingEvent; import org.apache.stratos.autoscaler.monitor.events.MonitorStatusEvent; -import org.apache.stratos.autoscaler.partition.network.ApplicationLevelNetworkPartition; -import org.apache.stratos.autoscaler.partition.network.NetworkPartition; -import org.apache.stratos.autoscaler.policy.PolicyManager; -import org.apache.stratos.autoscaler.policy.model.DeploymentPolicy; +import org.apache.stratos.autoscaler.pojo.policy.deployment.partition.network.ApplicationLevelNetworkPartition; +import org.apache.stratos.autoscaler.pojo.policy.PolicyManager; +import org.apache.stratos.autoscaler.pojo.policy.deployment.DeploymentPolicy; import org.apache.stratos.messaging.domain.applications.Application; import org.apache.stratos.messaging.domain.applications.ApplicationStatus; import org.apache.stratos.messaging.domain.applications.GroupStatus; http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/GroupMonitor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/GroupMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/GroupMonitor.java index cbc9366..a072a8a 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/GroupMonitor.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/GroupMonitor.java @@ -36,9 +36,9 @@ import org.apache.stratos.autoscaler.monitor.events.GroupStatusEvent; import org.apache.stratos.autoscaler.monitor.events.MonitorScalingEvent; import org.apache.stratos.autoscaler.monitor.events.MonitorStatusEvent; import org.apache.stratos.autoscaler.monitor.events.builder.MonitorStatusEventBuilder; -import org.apache.stratos.autoscaler.partition.network.ChildLevelNetworkPartition; -import org.apache.stratos.autoscaler.policy.PolicyManager; -import org.apache.stratos.autoscaler.policy.model.DeploymentPolicy; +import org.apache.stratos.autoscaler.pojo.policy.deployment.partition.network.ChildLevelNetworkPartition; +import org.apache.stratos.autoscaler.pojo.policy.PolicyManager; +import org.apache.stratos.autoscaler.pojo.policy.deployment.DeploymentPolicy; import org.apache.stratos.messaging.domain.applications.Application; import org.apache.stratos.messaging.domain.applications.ApplicationStatus; import org.apache.stratos.messaging.domain.applications.Group; http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/partition/PartitionManager.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/partition/PartitionManager.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/partition/PartitionManager.java deleted file mode 100644 index 3f12e11..0000000 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/partition/PartitionManager.java +++ /dev/null @@ -1,177 +0,0 @@ -///* -// * Licensed to the Apache Software Foundation (ASF) under one -// * or more contributor license agreements. See the NOTICE file -// * distributed with this work for additional information -// * regarding copyright ownership. The ASF licenses this file -// * to you under the Apache License, Version 2.0 (the -// * "License"); you may not use this file except in compliance -// * with the License. You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, -// * software distributed under the License is distributed on an -// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// * KIND, either express or implied. See the License for the -// * specific language governing permissions and limitations -// * under the License. -// */ -// -//package org.apache.stratos.autoscaler.partition; -// -//import org.apache.commons.lang.StringUtils; -//import org.apache.commons.logging.Log; -//import org.apache.commons.logging.LogFactory; -////import org.apache.stratos.autoscaler.NetworkPartitionLbHolder; -//import org.apache.stratos.autoscaler.client.CloudControllerClient; -//import org.apache.stratos.autoscaler.policy.model.DeploymentPolicy; -//import org.apache.stratos.autoscaler.exception.AutoScalerException; -//import org.apache.stratos.autoscaler.exception.partition.InvalidPartitionException; -//import org.apache.stratos.autoscaler.exception.partition.PartitionValidationException; -//import org.apache.stratos.autoscaler.registry.RegistryManager; -//import org.apache.stratos.cloud.controller.stub.deployment.partition.Partition; -// -//import java.util.ArrayList; -//import java.util.HashMap; -//import java.util.List; -//import java.util.Map; -// -///** -// * The model class for managing Partitions. -// */ -//public class PartitionManager { -// -// private static final Log log = LogFactory.getLog(PartitionManager.class); -// -// // Partitions against partitionID -// private static Map<String, Partition> partitions = new HashMap<String, Partition>(); -// -// /* -// * Key - network partition id -// * Value - reference to NetworkPartition -// */ -//// private Map<String, NetworkPartitionLbHolder> networkPartitionLbHolders; -// -// private static class Holder { -// static final PartitionManager INSTANCE = new PartitionManager(); -// } -// -// public static PartitionManager getInstance() { -// return Holder.INSTANCE; -// } -// -// private PartitionManager() { -//// networkPartitionLbHolders = new HashMap<String, NetworkPartitionLbHolder>(); -// } -// -// -// public boolean partitionExist(String partitionId) { -// return partitions.containsKey(partitionId); -// } -// -// /* -// * Deploy a new partition to Auto Scaler. -// */ -// public boolean addNewPartition(Partition partition) throws InvalidPartitionException { -// if (StringUtils.isEmpty(partition.getId())) { -// throw new InvalidPartitionException("Partition id can not be empty"); -// } -// if (this.partitionExist(partition.getId())) { -// throw new InvalidPartitionException(String.format("Partition already exist in partition manager: [id] %s", partition.getId())); -// } -// if (null == partition.getProvider()) { -// throw new InvalidPartitionException("Mandatory field provider has not be set for partition " + partition.getId()); -// } -// try { -// validatePartitionViaCloudController(partition); -// RegistryManager.getInstance().persistPartition(partition); -// addPartitionToInformationModel(partition); -// if (log.isInfoEnabled()) { -// log.info(String.format("Partition is deployed successfully: [id] %s", partition.getId())); -// } -// return true; -// } catch (Exception e) { -// throw new InvalidPartitionException(e.getMessage(), e); -// } -// } -// -// -// public void addPartitionToInformationModel(Partition partition) { -// partitions.put(partition.getId(), partition); -// } -// -//// public NetworkPartitionLbHolder getNetworkPartitionLbHolder(String networkPartitionId) { -//// return this.networkPartitionLbHolders.get(networkPartitionId); -//// } -// -// public Partition getPartitionById(String partitionId) { -// if (partitionExist(partitionId)) -// return partitions.get(partitionId); -// else -// return null; -// } -// -// public Partition[] getAllPartitions() { -// return partitions.values().toArray(new Partition[0]); -// -// } -// -// public boolean validatePartitionViaCloudController(Partition partition) throws PartitionValidationException { -// if (log.isDebugEnabled()) { -// log.debug(String.format("Validating partition via cloud controller: [id] %s", partition.getId())); -// } -// return CloudControllerClient.getInstance().validatePartition(partition); -// } -// -//// public List<NetworkPartitionLbHolder> getNetworkPartitionLbHolders(DeploymentPolicy depPolicy) { -//// List<NetworkPartitionLbHolder> lbHolders = new ArrayList<NetworkPartitionLbHolder>(); -//// for (NetworkPartition networkPartition : depPolicy.getApplicationLevelNetworkPartitions()) { -//// String id = networkPartition.getId(); -//// NetworkPartitionLbHolder entry = networkPartitionLbHolders.get(id); -//// if (entry != null) { -//// lbHolders.add(entry); -//// } -//// } -//// return lbHolders; -//// } -// -//// public void deployNewNetworkPartitions(DeploymentPolicy depPolicy) { -//// for (NetworkPartition networkPartition : depPolicy.getApplicationLevelNetworkPartitions()) { -//// String id = networkPartition.getId(); -//// if (!networkPartitionLbHolders.containsKey(id)) { -//// NetworkPartitionLbHolder networkPartitionLbHolder = -//// new NetworkPartitionLbHolder(id); -//// addNetworkPartitionLbHolder(networkPartitionLbHolder); -//// RegistryManager.getInstance().persistNetworkPartitionIbHolder(networkPartitionLbHolder); -//// } -// -//// } -//// } -// -//// public void undeployNetworkPartitions(DeploymentPolicy depPolicy) { -//// for (NetworkPartition networkPartition : depPolicy.getApplicationLevelNetworkPartitions()) { -//// String id = networkPartition.getId(); -//// if (networkPartitionLbHolders.containsKey(id)) { -//// NetworkPartitionLbHolder netPartCtx = this.getNetworkPartitionLbHolder(id); -//// // remove from information model -//// this.removeNetworkPartitionLbHolder(netPartCtx); -//// //remove from the registry -//// RegistryManager.getInstance().removeNetworkPartition(this.getNetworkPartitionLbHolder(id).getNetworkPartitionId()); -//// } else { -//// String errMsg = "Network partition context not found for policy " + depPolicy; -//// log.error(errMsg); -//// throw new AutoScalerException(errMsg); -//// } -//// -//// } -//// } -//// -//// private void removeNetworkPartitionLbHolder(NetworkPartitionLbHolder nwPartLbHolder) { -//// networkPartitionLbHolders.remove(nwPartLbHolder.getNetworkPartitionId()); -//// } -//// -//// public void addNetworkPartitionLbHolder(NetworkPartitionLbHolder nwPartLbHolder) { -//// networkPartitionLbHolders.put(nwPartLbHolder.getNetworkPartitionId(), nwPartLbHolder); -//// } -// -//} http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/partition/network/ApplicationLevelNetworkPartition.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/partition/network/ApplicationLevelNetworkPartition.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/partition/network/ApplicationLevelNetworkPartition.java deleted file mode 100644 index f243ee5..0000000 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/partition/network/ApplicationLevelNetworkPartition.java +++ /dev/null @@ -1,76 +0,0 @@ -/* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -*/ - -package org.apache.stratos.autoscaler.partition.network; - -import org.apache.stratos.cloud.controller.stub.deployment.partition.Partition; - -import java.io.Serializable; -import java.util.Arrays; - -/** -* The model class for NetworkPartition definition. -*/ -public class ApplicationLevelNetworkPartition implements Serializable{ - - private static final long serialVersionUID = -8043298009352097370L; - private String id; - private boolean activeByDefault; - private Partition[] partitions; - - public void setPartitions(Partition[] partitions) { - if(partitions == null) { - this.partitions = partitions; - } else { - this.partitions = Arrays.copyOf(partitions, partitions.length); - } - } - - /** - * Gets the value of the partitions. - */ - public Partition[] getPartitions() { - if (partitions == null) { - partitions = new Partition[0]; - } - return this.partitions; - } - - /** - * Gets the value of the id. - */ - public String getId() { - return id; - } - - /** - * sets the value of the id. - */ - public void setId(String id) { - this.id = id; - } - - public boolean isActiveByDefault() { - return activeByDefault; - } - - public void setActiveByDefault(boolean activeByDefault) { - this.activeByDefault = activeByDefault; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/partition/network/ChildLevelNetworkPartition.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/partition/network/ChildLevelNetworkPartition.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/partition/network/ChildLevelNetworkPartition.java deleted file mode 100644 index cebea73..0000000 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/partition/network/ChildLevelNetworkPartition.java +++ /dev/null @@ -1,88 +0,0 @@ -/* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -*/ - -package org.apache.stratos.autoscaler.partition.network; - -import org.apache.stratos.cloud.controller.stub.deployment.partition.Partition; - -import java.io.Serializable; -import java.util.Arrays; - -/** -* The model class for NetworkPartition definition. -*/ -public class ChildLevelNetworkPartition implements Serializable { - - private static final long serialVersionUID = -8043298009352097370L; - private String id; - private String partitionAlgo; - private Partition[] partitions; - - /** - * Gets the value of the partitionAlgo property. - * - * @return possible object is - * {@link String } - */ - public String getPartitionAlgo() { - return partitionAlgo; - } - - /** - * Sets the value of the partitionAlgo property. - * - * @param value allowed object is - * {@link String } - */ - public void setPartitionAlgo(String value) { - this.partitionAlgo = value; - } - - public void setPartitions(Partition[] partitions) { - if (partitions == null) { - this.partitions = partitions; - } else { - this.partitions = Arrays.copyOf(partitions, partitions.length); - } - } - - /** - * Gets the value of the partitions. - */ - public Partition[] getPartitions() { - if (partitions == null) { - partitions = new Partition[0]; - } - return this.partitions; - } - - /** - * Gets the value of the id. - */ - public String getId() { - return id; - } - - /** - * sets the value of the id. - */ - public void setId(String id) { - this.id = id; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/partition/network/NetworkPartition.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/partition/network/NetworkPartition.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/partition/network/NetworkPartition.java deleted file mode 100644 index 07d4a9c..0000000 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/partition/network/NetworkPartition.java +++ /dev/null @@ -1,44 +0,0 @@ -/* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -*/ - -package org.apache.stratos.autoscaler.partition.network; - -import java.io.Serializable; -/** -* The model class for NetworkPartition definition. -*/ -public abstract class NetworkPartition implements Serializable { - - private static final long serialVersionUID = -8043298009352097370L; - private String id; - - /** - * Gets the value of the id. - */ - public String getId() { - return id; - } - - /** - * sets the value of the id. - */ - public void setId(String id) { - this.id = id; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/PolicyManager.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/PolicyManager.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/PolicyManager.java new file mode 100644 index 0000000..fd7a048 --- /dev/null +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/PolicyManager.java @@ -0,0 +1,289 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.stratos.autoscaler.pojo.policy; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.stratos.autoscaler.pojo.policy.deployment.DeploymentPolicy; +import org.apache.stratos.autoscaler.exception.AutoScalerException; +import org.apache.stratos.autoscaler.exception.partition.InvalidPartitionException; +import org.apache.stratos.autoscaler.exception.policy.InvalidPolicyException; +//import org.apache.stratos.autoscaler.pojo.policy.deployment.partition.PartitionManager; +import org.apache.stratos.autoscaler.pojo.policy.autoscale.AutoscalePolicy; +import org.apache.stratos.autoscaler.registry.RegistryManager; +import org.apache.stratos.cloud.controller.stub.deployment.partition.Partition; + +/** + * Manager class for the purpose of managing Autoscale/Deployment policy definitions. + */ +public class PolicyManager { + + private static final Log log = LogFactory.getLog(PolicyManager.class); + + private static Map<String, AutoscalePolicy> autoscalePolicyListMap = new HashMap<String, AutoscalePolicy>(); + + private static Map<String, DeploymentPolicy> deploymentPolicyListMap = new HashMap<String, DeploymentPolicy>(); + + /* An instance of a PolicyManager is created when the class is loaded. + * Since the class is loaded only once, it is guaranteed that an object of + * PolicyManager is created only once. Hence it is singleton. + */ + + private static class InstanceHolder { + private static final PolicyManager INSTANCE = new PolicyManager(); + } + + public static PolicyManager getInstance() { + return InstanceHolder.INSTANCE; + } + + private PolicyManager() { + } + + // Add the policy to information model and persist. + public boolean deployAutoscalePolicy(AutoscalePolicy policy) throws InvalidPolicyException { + if(StringUtils.isEmpty(policy.getId())){ + throw new AutoScalerException("Autoscaling policy id cannot be empty"); + } + this.addASPolicyToInformationModel(policy); + RegistryManager.getInstance().persistAutoscalerPolicy(policy); + if (log.isInfoEnabled()) { + log.info(String.format("Autoscaling policy is deployed successfully: [id] %s", policy.getId())); + } + return true; + } + + public boolean updateAutoscalePolicy(AutoscalePolicy policy) throws InvalidPolicyException { + if(StringUtils.isEmpty(policy.getId())){ + throw new AutoScalerException("Autoscaling policy id cannot be empty"); + } + this.updateASPolicyInInformationModel(policy); + RegistryManager.getInstance().persistAutoscalerPolicy(policy); + if (log.isInfoEnabled()) { + log.info(String.format("Autoscaling policy is updated successfully: [id] %s", policy.getId())); + } + return true; + } + + // Add the deployment policy to information model and persist. + public boolean deployDeploymentPolicy(DeploymentPolicy policy) throws InvalidPolicyException { + if(StringUtils.isEmpty(policy.getId())){ + throw new AutoScalerException("Deploying policy id cannot be empty"); + } + try { + if(log.isInfoEnabled()) { + log.info(String.format("Deploying deployment policy: [id] %s", policy.getId())); + } + fillPartitions(policy); + } catch (InvalidPartitionException e) { + log.error(e); + throw new InvalidPolicyException(String.format("Deployment policy is invalid: [id] %s", policy.getId()), e); + } + + addDeploymentPolicyToInformationModel(policy); + RegistryManager.getInstance().persistDeploymentPolicy(policy); + + if (log.isInfoEnabled()) { + log.info(String.format("Deployment policy is deployed successfully: [id] %s", policy.getId())); + } + return true; + } + + public boolean updateDeploymentPolicy(DeploymentPolicy policy) throws InvalidPolicyException { + if(StringUtils.isEmpty(policy.getId())){ + throw new AutoScalerException("Deploying policy id cannot be empty"); + } + try { + if(log.isInfoEnabled()) { + log.info(String.format("Updating deployment policy: [id] %s", policy.getId())); + } + fillPartitions(policy); + } catch (InvalidPartitionException e) { + log.error(e); + throw new InvalidPolicyException(String.format("Deployment policy is invalid: [id] %s", policy.getId()), e); + } + + updateDeploymentPolicyToInformationModel(policy); + RegistryManager.getInstance().persistDeploymentPolicy(policy); + + if (log.isInfoEnabled()) { + log.info(String.format("Deployment policy is updated successfully: [id] %s", policy.getId())); + } + return true; + } + + private void fillPartitions(DeploymentPolicy deploymentPolicy) throws InvalidPartitionException { + //TODO fill partition by extracting the partitions from policy +// PartitionManager partitionMgr = PartitionManager.getInstance(); +// for (Partition partition : deploymentPolicy.getAllPartitions()) { +// String partitionId = partition.getId(); +// if ((partitionId == null) || (!partitionMgr.partitionExist(partitionId))) { +// String msg = "Could not find partition: [id] " + partitionId + ". " + +// "Please deploy the partitions before deploying the deployment policies."; +// throw new InvalidPartitionException(msg); +// } +// +// fillPartition(partition, PartitionManager.getInstance().getPartitionById(partitionId)); +// } + } + + private static void fillPartition(Partition destPartition, Partition srcPartition) { + if(srcPartition.getProvider() == null) + throw new RuntimeException("Provider is not set in the deployed partition"); + + if (log.isDebugEnabled()) { + log.debug(String.format("Setting provider for partition: [id] %s [provider] %s", destPartition.getId(), srcPartition.getProvider())); + } + destPartition.setProvider(srcPartition.getProvider()); + + if (log.isDebugEnabled()) { + log.debug(String.format("Setting properties for partition: [id] %s [properties] %s", destPartition.getId(), srcPartition.getProperties())); + } + destPartition.setProperties(srcPartition.getProperties()); + } + + public void addASPolicyToInformationModel(AutoscalePolicy asPolicy) throws InvalidPolicyException { + if (!autoscalePolicyListMap.containsKey(asPolicy.getId())) { + if (log.isDebugEnabled()) { + log.debug("Adding autoscaling policy: " + asPolicy.getId()); + } + autoscalePolicyListMap.put(asPolicy.getId(), asPolicy); + } else { + String errMsg = "Specified autoscaling policy [" + asPolicy.getId() + "] already exists"; + log.error(errMsg); + throw new InvalidPolicyException(errMsg); + } + } + + public void updateASPolicyInInformationModel(AutoscalePolicy asPolicy) throws InvalidPolicyException { + if (autoscalePolicyListMap.containsKey(asPolicy.getId())) { + if (log.isDebugEnabled()) { + log.debug("Updating autoscaling policy: " + asPolicy.getId()); + } + autoscalePolicyListMap.put(asPolicy.getId(), asPolicy); + } + } + + /** + * Removes the specified policy + * + * @param policy + * @throws InvalidPolicyException + */ + public void undeployAutoscalePolicy(String policy) throws InvalidPolicyException { + if (autoscalePolicyListMap.containsKey(policy)) { + if (log.isDebugEnabled()) { + log.debug("Removing policy :" + policy); + } + autoscalePolicyListMap.remove(policy); + RegistryManager.getInstance().removeAutoscalerPolicy(this.getAutoscalePolicy(policy)); + } else { + throw new InvalidPolicyException("No such policy [" + policy + "] exists"); + } + } + + /** + * Returns an array of the Autoscale policies contained in this manager. + * + * @return + */ + public AutoscalePolicy[] getAutoscalePolicyList() { + return autoscalePolicyListMap.values().toArray(new AutoscalePolicy[0]); + } + + /** + * Returns the autoscale policy to which the specified id is mapped or null + * + * @param id + * @return + */ + public AutoscalePolicy getAutoscalePolicy(String id) { + return autoscalePolicyListMap.get(id); + } + + // Add the deployment policy to As in memmory information model. Does not persist. + public void addDeploymentPolicyToInformationModel(DeploymentPolicy policy) throws InvalidPolicyException { + if (!deploymentPolicyListMap.containsKey(policy.getId())) { + if (log.isDebugEnabled()) { + log.debug("Adding deployment policy: " + policy.getId()); + } +// PartitionManager.getInstance().deployNewNetworkPartitions(policy); + deploymentPolicyListMap.put(policy.getId(), policy); + } else { + String errMsg = "Specified deployment policy [" + policy.getId()+ "] already exists"; + log.error(errMsg); + throw new InvalidPolicyException(errMsg); + } + } + + public void updateDeploymentPolicyToInformationModel(DeploymentPolicy policy) throws InvalidPolicyException { + if (log.isDebugEnabled()) { + log.debug("Updating deployment policy: " + policy.getId()); + } + deploymentPolicyListMap.put(policy.getId(), policy); + } + + /** + * Removes the specified policy + * + * @param policy + * @throws InvalidPolicyException + */ + public void undeployDeploymentPolicy(String policy) throws InvalidPolicyException { + if (deploymentPolicyListMap.containsKey(policy)) { + if (log.isDebugEnabled()) { + log.debug("Removing deployment policy :" + policy); + } + DeploymentPolicy depPolicy = this.getDeploymentPolicy(policy); + // undeploy network partitions this deployment policy. +// PartitionManager.getInstance().undeployNetworkPartitions(depPolicy); + // undeploy the deployment policy. + RegistryManager.getInstance().removeDeploymentPolicy(depPolicy); + // remove from the infromation model. + deploymentPolicyListMap.remove(policy); + } else { + throw new InvalidPolicyException("No such policy [" + policy + "] exists"); + } + } + + /** + * Returns an array of the Deployment policies contained in this manager. + * + * @return + */ + public DeploymentPolicy[] getDeploymentPolicyList() { + return deploymentPolicyListMap.values().toArray(new DeploymentPolicy[0]); + } + + /** + * Returns the deployment policy to which the specified id is mapped or null + * + * @param id + * @return + */ + public DeploymentPolicy getDeploymentPolicy(String id) { + return deploymentPolicyListMap.get(id); + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/autoscale/AutoscalePolicy.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/autoscale/AutoscalePolicy.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/autoscale/AutoscalePolicy.java new file mode 100644 index 0000000..b448de5 --- /dev/null +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/autoscale/AutoscalePolicy.java @@ -0,0 +1,187 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.stratos.autoscaler.pojo.policy.autoscale; + +import java.io.Serializable; + +/** + * The model class for Autoscale-policy definition. + */ +public class AutoscalePolicy implements Serializable { + + private static final long serialVersionUID = 1754373171598089271L; + private LoadThresholds loadThresholds; + private String id; + private String displayName; + private String description; + private boolean isPublic; + private int tenantId; + private float instanceRoundingFactor; + + /** + * Gets the value of the loadThresholds property. + * + * @return + * possible object is + * {@link LoadThresholds } + * + */ + public LoadThresholds getLoadThresholds() { + return loadThresholds; + } + + /** + * Sets the value of the loadThresholds property. + * + * @param value + * allowed object is + * {@link LoadThresholds } + * + */ + public void setLoadThresholds(LoadThresholds value) { + this.loadThresholds = value; + } + + /** + * Gets the value of the id property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getId() { + return id; + } + + /** + * Sets the value of the id property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setId(String value) { + this.id = value; + } + + /** + * Gets the value of the displayName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDisplayName() { + return displayName; + } + + /** + * Sets the value of the displayName property. + * + * @param displayName + * allowed object is + * {@link String } + * + */ + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + /** + * Gets the value of the description property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDescription() { + return description; + } + + /** + * Sets the value of the description property. + * + * @param description + * allowed object is + * {@link String } + * + */ + public void setDescription(String description) { + this.description = description; + } + + /** + * Gets the value of the isPublic property. + * + * @return + * possible object is boolean + * + */ + public boolean getIsPublic() { + return isPublic; + } + + /** + * Sets the value of the isPublic property. + * + * @param isPublic + * allowed object is boolean + * + */ + public void setIsPublic(boolean isPublic) { + this.isPublic = isPublic; + } + + /** + * Gets the value of the tenantId property. + * + * + */ + public int getTenantId() { + return tenantId; + } + + /** + * Sets the value of the tenantId property. + * + * + */ + public void setTenantId(int tenantId) { + this.tenantId = tenantId; + } + + @Override + public String toString() { + return "ASPolicy [id=" + id + ", displayName=" + displayName + + ", description=" + description + ", isPublic=" + isPublic + "]"; + } + + public float getInstanceRoundingFactor() { + return instanceRoundingFactor; + } + + public void setInstanceRoundingFactor(float instanceRoundingFactor) { + this.instanceRoundingFactor = instanceRoundingFactor; + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/autoscale/LoadAverage.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/autoscale/LoadAverage.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/autoscale/LoadAverage.java new file mode 100644 index 0000000..ee72f62 --- /dev/null +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/autoscale/LoadAverage.java @@ -0,0 +1,114 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.stratos.autoscaler.pojo.policy.autoscale; + +import java.io.Serializable; + +/** + * The model class for LoadAverage definition. + */ +public class LoadAverage implements Serializable{ + + private static final long serialVersionUID = -2109860338694123343L; + private float average = 0.0f; + private float secondDerivative = 0.0f; + private float gradient = 0.0f; + private float scaleDownMarginOfGradient = 0.0f; + private float scaleDownMarginOfSecondDerivative = 0.0f; + + /** + * Gets the value of the average property. + */ + public float getAverage() { + return average; + } + + /** + * Sets the value of the average property. + */ + public void setAverage(float value) { + this.average = value; + } + + /** + * Gets the value of the second-derivative property. + */ + public float getSecondDerivative() { + return secondDerivative; + } + + /** + * Sets the value of the second-derivative property. + */ + public void setSecondDerivative(float value) { + this.secondDerivative = value; + } + + /** + * Gets the value of the gradient property. + */ + public float getGradient() { + return gradient; + } + + /** + * Sets the value of the gradient property. + * + */ + public void setGradient(float value) { + this.gradient = value; + } + + /** + * Gets the value of the scaleDownSlowerMarginOfGradient property. + */ + public float getScaleDownMarginOfGradient() { + return scaleDownMarginOfGradient; + } + + /** + * Sets the value of the scaleDownSlowerMarginOfGradient property. + * + */ + public void setScaleDownMarginOfGradient(float scaleDownMarginOfGradient) { + this.scaleDownMarginOfGradient = scaleDownMarginOfGradient; + } + + /** + * Gets the value of the scaleDownSlowerMarginOfSecondDerivative property. + */ + public float getScaleDownMarginOfSecondDerivative() { + return scaleDownMarginOfSecondDerivative; + } + + /** + * Sets the value of the scaleDownSlowerMarginOfSecondDerivative property. + * + */ + public void setScaleDownMarginOfSecondDerivative(float scaleDownMarginOfSecondDerivative) { + this.scaleDownMarginOfSecondDerivative = scaleDownMarginOfSecondDerivative; + } + + @Override + public String toString() { + return String.format("[average] %f [second-derivative] %f [gradient] %f [scale-down-margin-of-gradient] %f [scale-down-margin-of-second-derivative] %f", + getAverage(), getSecondDerivative(), getGradient(), getScaleDownMarginOfGradient(), getScaleDownMarginOfSecondDerivative()); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/autoscale/LoadAverageThresholds.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/autoscale/LoadAverageThresholds.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/autoscale/LoadAverageThresholds.java new file mode 100644 index 0000000..5d6b19f --- /dev/null +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/autoscale/LoadAverageThresholds.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.stratos.autoscaler.pojo.policy.autoscale; + +import java.io.Serializable; + +/** + * The model class for LoadAverage definition. + */ +public class LoadAverageThresholds implements Serializable{ + + private static final long serialVersionUID = -2109860338694123343L; + private float upperLimit = 80.0F; + private float lowerLimit = 20.0F; + + public float getUpperLimit() { + return upperLimit; + } + public void setUpperLimit(float upperLimit) { + this.upperLimit = upperLimit; + } + public float getLowerLimit() { + return lowerLimit; + } + public void setLowerLimit(float lowerLimit) { + this.lowerLimit = lowerLimit; + } + + @Override + public String toString() { + return "LoadAverage [upperLimit=" + upperLimit + ", lowerLimit=" + + lowerLimit + "]"; + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/autoscale/LoadThresholds.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/autoscale/LoadThresholds.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/autoscale/LoadThresholds.java new file mode 100644 index 0000000..4825c08 --- /dev/null +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/autoscale/LoadThresholds.java @@ -0,0 +1,106 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.stratos.autoscaler.pojo.policy.autoscale; + +import java.io.Serializable; + +/** + * The model class for LoadThresholds definition. + */ +public class LoadThresholds implements Serializable{ + + private static final long serialVersionUID = -8148571245537655867L; + private RequestsInFlightThresholds requestsInFlight; + private MemoryConsumptionThresholds memoryConsumption; + private LoadAverageThresholds loadAverage; + + /** + * Gets the value of the requestsInFlight property. + * + * @return + * possible object is + * {@link RequestsInFlightThresholds } + * + */ + public RequestsInFlightThresholds getRequestsInFlight() { + return requestsInFlight; + } + + /** + * Sets the value of the requestsInFlight property. + * + * @param value + * allowed object is + * {@link RequestsInFlightThresholds } + * + */ + public void setRequestsInFlight(RequestsInFlightThresholds value) { + this.requestsInFlight = value; + } + + /** + * Gets the value of the memoryConsumption property. + * + * @return + * possible object is + * {@link MemoryConsumptionThresholds } + * + */ + public MemoryConsumptionThresholds getMemoryConsumption() { + return memoryConsumption; + } + + /** + * Sets the value of the memoryConsumption property. + * + * @param value + * allowed object is + * {@link MemoryConsumptionThresholds } + * + */ + public void setMemoryConsumption(MemoryConsumptionThresholds value) { + this.memoryConsumption = value; + } + + /** + * Gets the value of the loadAverage property. + * + * @return + * possible object is + * {@link LoadAverageThresholds } + * + */ + public LoadAverageThresholds getLoadAverage() { + return loadAverage; + } + + /** + * Sets the value of the loadAverage property. + * + * @param value + * allowed object is + * {@link LoadAverageThresholds } + * + */ + public void setLoadAverage(LoadAverageThresholds value) { + this.loadAverage = value; + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/531517a1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/autoscale/MemoryConsumption.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/autoscale/MemoryConsumption.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/autoscale/MemoryConsumption.java new file mode 100644 index 0000000..ddaf3ef --- /dev/null +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/autoscale/MemoryConsumption.java @@ -0,0 +1,116 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.stratos.autoscaler.pojo.policy.autoscale; + +import java.io.Serializable; + +/** + * The model class for MemoryConsumption definition. + */ +public class MemoryConsumption implements Serializable { + + private static final long serialVersionUID = 5755634390464664663L; + private float average = 0.0f; + private float secondDerivative = 0.0f; + private float gradient = 0.0f; + private float scaleDownMarginOfGradient = 0.0f; + private float scaleDownMarginOfSecondDerivative = 0.0f; + + + /** + * Gets the value of the average property. + */ + public float getAverage() { + return average; + } + + /** + * Sets the value of the average property. + */ + public void setAverage(float value) { + this.average = value; + } + + /** + * Gets the value of the second-derivative property. + */ + public float getSecondDerivative() { + return secondDerivative; + } + + /** + * Sets the value of the second-derivative property. + */ + public void setSecondDerivative(float value) { + this.secondDerivative = value; + } + + /** + * Gets the value of the gradient property. + */ + public float getGradient() { + return gradient; + } + + /** + * Sets the value of the gradient property. + * + */ + public void setGradient(float value) { + this.gradient = value; + } + + + /** + * Gets the value of the scaleDownSlowerMarginOfGradient property. + */ + public float getScaleDownMarginOfGradient() { + return scaleDownMarginOfGradient; + } + + /** + * Sets the value of the scaleDownSlowerMarginOfGradient property. + * + */ + public void setScaleDownMarginOfGradient(float scaleDownMarginOfGradient) { + this.scaleDownMarginOfGradient = scaleDownMarginOfGradient; + } + + /** + * Gets the value of the scaleDownSlowerMarginOfSecondDerivative property. + */ + public float getScaleDownMarginOfSecondDerivative() { + return scaleDownMarginOfSecondDerivative; + } + + /** + * Sets the value of the scaleDownSlowerMarginOfSecondDerivative property. + * + */ + public void setScaleDownMarginOfSecondDerivative(float scaleDownMarginOfSecondDerivative) { + this.scaleDownMarginOfSecondDerivative = scaleDownMarginOfSecondDerivative; + } + + @Override + public String toString() { + return String.format("[average] %f [second-derivative] %f [gradient] %f [scale-down-margin-of-gradient] %f [scale-down-margin-of-second-derivative] %f", + getAverage(), getSecondDerivative(), getGradient(), getScaleDownMarginOfGradient(), getScaleDownMarginOfSecondDerivative()); + } +} \ No newline at end of file
