You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2013/12/14 05:23:42 UTC
[2/3] git commit: Merge remote-tracking branch 'origin/master'
Merge remote-tracking branch 'origin/master'
Conflicts:
components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/partition/PartitionManager.java
components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/PolicyManager.java
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/a8bba54b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/a8bba54b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/a8bba54b
Branch: refs/heads/master
Commit: a8bba54bf11b961d2ddad02668fd4bb1fcb4a89a
Parents: 0091a76 68dcc68
Author: Imesh Gunaratne <im...@apache.org>
Authored: Sat Dec 14 09:46:31 2013 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Sat Dec 14 09:46:31 2013 +0530
----------------------------------------------------------------------
.../stratos/autoscaler/api/AutoScalerServiceImpl.java | 4 +++-
.../autoscaler/interfaces/AutoScalerServiceInterface.java | 4 +++-
.../stratos/autoscaler/partition/PartitionManager.java | 10 ++++++----
.../apache/stratos/autoscaler/policy/PolicyManager.java | 3 +++
4 files changed, 15 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/a8bba54b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/partition/PartitionManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/a8bba54b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/PolicyManager.java
----------------------------------------------------------------------
diff --cc components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/PolicyManager.java
index 49ee34b,bc3f0f4..51cc8e0
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/PolicyManager.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/PolicyManager.java
@@@ -109,113 -115,125 +109,116 @@@ public class PolicyManager
}
private static void fillPartition(Partition destPartition, Partition srcPartition) {
- if(null == srcPartition.getProvider())
- throw new RuntimeException("Provider is not set for the deployed partition.");
-
- if(log.isDebugEnabled())
- log.debug("Settting provider for Partition " + destPartition.getId() + " provider "+ srcPartition.getProvider());
++ 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.info("Settting properties for Partition " + destPartition.getId() + " provider "+ srcPartition.getProperties());
+
+ 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 policy :" + asPolicy.getId());
+ }
+ autoscalePolicyListMap.put(asPolicy.getId(), asPolicy);
+ } else {
+ throw new InvalidPolicyException("Specified policy [" + asPolicy.getId()
+ + "] already exists");
+ }
+ }
+
+ /**
+ * Removes the specified policy
+ *
+ * @param policy
+ * @throws InvalidPolicyException
+ */
+ public void removeAutoscalePolicy(String policy) throws InvalidPolicyException {
+ if (autoscalePolicyListMap.containsKey(policy)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Removing policy :" + policy);
+ }
+ autoscalePolicyListMap.remove(policy);
+ } else {
+ throw new InvalidPolicyException("No such policy [" + policy + "] exists");
+ }
+ }
+
+ /**
+ * Returns a List of the Autoscale policies contained in this manager.
+ *
+ * @return
+ */
+ public List<AutoscalePolicy> getAutoscalePolicyList() {
+ return Collections.unmodifiableList(new ArrayList<AutoscalePolicy>(autoscalePolicyListMap.values()));
+ }
+
+ /**
+ * 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 policy :" + policy.getId());
+ }
+ PartitionManager.getInstance().deployNewNetworkPartitions(policy);
+ deploymentPolicyListMap.put(policy.getId(), policy);
+ } else {
+ throw new InvalidPolicyException("Specified policy [" + policy.getId()
+ + "] already exists");
+ }
+ }
+
+ /**
+ * Removes the specified policy
+ *
+ * @param policy
+ * @throws InvalidPolicyException
+ */
+ public void removeDeploymentPolicy(String policy) throws InvalidPolicyException {
+ if (deploymentPolicyListMap.containsKey(policy)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Removing policy :" + policy);
+ }
+ deploymentPolicyListMap.remove(policy);
+ } else {
+ throw new InvalidPolicyException("No such policy [" + policy + "] exists");
+ }
+ }
+
+ /**
+ * Returns a List of the Deployment policies contained in this manager.
+ *
+ * @return
+ */
+ public List<DeploymentPolicy> getDeploymentPolicyList() {
+ return Collections.unmodifiableList(new ArrayList<DeploymentPolicy>(deploymentPolicyListMap.values()));
+ }
+ /**
+ * 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);
}
-
- public void addASPolicyToInformationModel(AutoscalePolicy asPolicy) throws InvalidPolicyException{
- if (!autoscalePolicyListMap.containsKey(asPolicy.getId())) {
- if(log.isDebugEnabled()){
- log.debug("Adding policy :" + asPolicy.getId());
- }
- autoscalePolicyListMap.put(asPolicy.getId(), asPolicy);
- } else {
- throw new InvalidPolicyException("Specified policy [" + asPolicy.getId()
- + "] already exists");
- }
- }
-
- private void persitASPolicy(String asResourcePath, AutoscalePolicy policy){
- try {
- RegistryManager.getInstance().persist(policy, asResourcePath);
- } catch (RegistryException e) {
- throw new AutoScalerException(e);
- }
- }
-
- private void persitDeploymentPolicy(String depResourcePath, DeploymentPolicy policy){
- try {
- RegistryManager.getInstance().persist(policy, depResourcePath);
- } catch (RegistryException e) {
- throw new AutoScalerException(e);
- }
- }
-
- /**
- * Removes the specified policy
- * @param policy
- * @throws InvalidPolicyException
- */
- public void removeAutoscalePolicy(String policy) throws InvalidPolicyException {
- if (autoscalePolicyListMap.containsKey(policy)) {
- if(log.isDebugEnabled()){
- log.debug("Removing policy :" + policy);
- }
- autoscalePolicyListMap.remove(policy);
- } else {
- throw new InvalidPolicyException("No such policy [" + policy + "] exists");
- }
- }
-
- /**
- * Returns a List of the Autoscale policies contained in this manager.
- * @return
- */
- public List<AutoscalePolicy> getAutoscalePolicyList() {
- return Collections.unmodifiableList(new ArrayList<AutoscalePolicy>(autoscalePolicyListMap.values()));
- }
-
- /**
- * 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 policy :" + policy.getId());
- }
- PartitionManager.getInstance().deployNewNetworkPartitions(policy);
- deploymentPolicyListMap.put(policy.getId(), policy);
- } else {
- throw new InvalidPolicyException("Specified policy [" + policy.getId()
- + "] already exists");
- }
- }
-
- /**
- * Removes the specified policy
- * @param policy
- * @throws InvalidPolicyException
- */
- public void removeDeploymentPolicy(String policy) throws InvalidPolicyException {
- if (deploymentPolicyListMap.containsKey(policy)) {
- if(log.isDebugEnabled()){
- log.debug("Removing policy :" + policy);
- }
- deploymentPolicyListMap.remove(policy);
- } else {
- throw new InvalidPolicyException("No such policy [" + policy + "] exists");
- }
- }
-
- /**
- * Returns a List of the Deployment policies contained in this manager.
- * @return
- */
- public List<DeploymentPolicy> getDeploymentPolicyList() {
- return Collections.unmodifiableList(new ArrayList<DeploymentPolicy>(deploymentPolicyListMap.values()));
- }
-
- /**
- * 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);
- }
}