Updated Branches:
  refs/heads/master 46e919a54 -> 6417e33f8

Refracting policy models

Signed-off-by: Lahiru Sandaruwan <[email protected]>


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

Branch: refs/heads/master
Commit: 8f639eb1ce418c056de673e55b25f98897d6451f
Parents: ecef467
Author: Melan Nimesh <[email protected]>
Authored: Thu Oct 24 15:03:37 2013 +0530
Committer: Lahiru Sandaruwan <[email protected]>
Committed: Thu Oct 24 15:18:21 2013 +0530

----------------------------------------------------------------------
 .../autoscaler/policy/PolicyManager.java        |  2 +-
 .../policy/deployers/PolicyReader.java          | 19 +++++----
 .../autoscaler/policy/model/LoadAverage.java    | 42 +++++++++----------
 .../policy/model/MemoryConsumption.java         | 43 ++++++++++----------
 .../autoscaler/policy/model/Partition.java      | 25 ++++++++++++
 .../policy/model/RequestsInFlight.java          | 43 ++++++++++----------
 6 files changed, 101 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/8f639eb1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/PolicyManager.java
----------------------------------------------------------------------
diff --git 
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
index 3c57964..90fba2f 100644
--- 
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
@@ -127,7 +127,7 @@ public class PolicyManager {
         * @param id
         * @return
         */
-       public AutoscalePolicy Policy(String id) {
+       public AutoscalePolicy getPolicy(String id) {
                return policyListMap.get(id);
        }
 

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/8f639eb1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/deployers/PolicyReader.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/deployers/PolicyReader.java
 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/deployers/PolicyReader.java
index 6d44af1..8aed5fc 100644
--- 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/deployers/PolicyReader.java
+++ 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/deployers/PolicyReader.java
@@ -90,25 +90,25 @@ public class PolicyReader  {
                                //RequestsInFlight
                                OMElement reqInFlightEle = 
loadThresholdsEle.getFirstChildWithName(new QName("RequestsInFlight"));
                                RequestsInFlight reqInFlight = new 
RequestsInFlight();
-                               
reqInFlight.setUpperLimit(Integer.valueOf(readValueAttr(reqInFlightEle,"UpperLimit")));
-                               
reqInFlight.setLowerLimit(Integer.valueOf(readValueAttr(reqInFlightEle,"LowerLimit")));
-                               
reqInFlight.setIdealGraidient(Integer.valueOf(readValueAttr(reqInFlightEle,"IdealGraidient")));
+                               
reqInFlight.setAverage(Float.valueOf(readValueAttr(reqInFlightEle,"Average")));
+                               
reqInFlight.setGradient(Float.valueOf(readValueAttr(reqInFlightEle,"Gradient")));
+                               
reqInFlight.setSecondDerivative(Float.valueOf(readValueAttr(reqInFlightEle,"SecondDerivative")));
                                loadThresholds.setRequestsInFlight(reqInFlight);
                                
                                //MemoryConsumption
                                OMElement memConsumptionEle = 
loadThresholdsEle.getFirstChildWithName(new QName("MemoryConsumption"));
                                MemoryConsumption memConsumption = new 
MemoryConsumption();
-                               
memConsumption.setUpperLimit(Integer.valueOf(readValueAttr(memConsumptionEle,"UpperLimit")));
-                               
memConsumption.setLowerLimit(Integer.valueOf(readValueAttr(memConsumptionEle,"LowerLimit")));
-                               
memConsumption.setIdealGraidient(Integer.valueOf(readValueAttr(memConsumptionEle,"IdealGraidient")));
+                               
memConsumption.setAverage(Float.valueOf(readValueAttr(memConsumptionEle,"Average")));
+                               
memConsumption.setGradient(Float.valueOf(readValueAttr(memConsumptionEle,"Gradient")));
+                               
memConsumption.setSecondDerivative(Float.valueOf(readValueAttr(memConsumptionEle,"SecondDerivative")));
                                
loadThresholds.setMemoryConsumption(memConsumption);
                                
                                //LoadAverage
                                OMElement loadAvrEle = 
loadThresholdsEle.getFirstChildWithName(new QName("LoadAverage"));
                                LoadAverage loadAvr = new LoadAverage();
-                               
loadAvr.setUpperLimit(Integer.valueOf(readValueAttr(loadAvrEle,"UpperLimit")));
-                               
loadAvr.setLowerLimit(Integer.valueOf(readValueAttr(loadAvrEle,"LowerLimit")));
-                               
loadAvr.setIdealGraidient(Integer.valueOf(readValueAttr(loadAvrEle,"IdealGraidient")));
+                               
loadAvr.setAverage(Float.valueOf(readValueAttr(loadAvrEle,"Average")));
+                               
loadAvr.setGradient(Float.valueOf(readValueAttr(loadAvrEle,"Gradient")));
+                               
loadAvr.setSecondDerivative(Float.valueOf(readValueAttr(loadAvrEle,"SecondDerivative")));
                                loadThresholds.setLoadAverage(loadAvr);
                                
                                policy.setLoadThresholds(loadThresholds);
@@ -128,6 +128,7 @@ public class PolicyReader  {
                                                Partition partition = new 
Partition();
                                                
partition.setIaas(partitionEle.getAttributeValue(new QName("iaas")));
                                                
partition.setZone(partitionEle.getAttributeValue(new QName("zone")));
+                                               
partition.setId(partitionEle.getAttributeValue(new QName("id")));
                                                
partition.setPartitionMax(Integer.valueOf(readValue(partitionEle, 
"PartitionMax")));
                                                
partition.setPartitionMin(Integer.valueOf(readValue(partitionEle, 
"PartitionMin")));
                                                
haPolicy.getPartition().add(partition);

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/8f639eb1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/model/LoadAverage.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/model/LoadAverage.java
 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/model/LoadAverage.java
index dcfec49..3e54d81 100644
--- 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/model/LoadAverage.java
+++ 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/model/LoadAverage.java
@@ -24,51 +24,51 @@ package org.apache.stratos.autoscaler.policy.model;
  */
 public class LoadAverage {
 
-    private int upperLimit;
-    private int lowerLimit;
-    private int idealGraidient;
+    private float average;
+    private float secondDerivative;
+    private float gradient;
 
     /**
-     * Gets the value of the upperLimit property.   
+     * Gets the value of the average property.   
      */
-    public int getUpperLimit() {
-        return upperLimit;
+    public float getAverage() {
+        return average;
     }
 
     /**
-     * Sets the value of the upperLimit property.   
+     * Sets the value of the average property.   
      */
-    public void setUpperLimit(int value) {
-        this.upperLimit = value;
+    public void setAverage(float value) {
+        this.average = value;
     }
 
     /**
-     * Gets the value of the lowerLimit property. 
+     * Gets the value of the second-derivative property. 
      */
-    public int getLowerLimit() {
-        return lowerLimit;
+    public float getSecondDerivative() {
+        return secondDerivative;
     }
 
     /**
-     * Sets the value of the lowerLimit property.   
+     * Sets the value of the second-derivative property.   
      */
-    public void setLowerLimit(int value) {
-        this.lowerLimit = value;
+    public void setSecondDerivative(float value) {
+        this.secondDerivative = value;
     }
 
     /**
-     * Gets the value of the idealGraidient property. 
+     * Gets the value of the gradient property. 
      */
-    public int getIdealGraidient() {
-        return idealGraidient;
+    public float getGradient() {
+        return gradient;
     }
 
     /**
-     * Sets the value of the idealGraidient property.
+     * Sets the value of the gradient property.
      *     
      */
-    public void setIdealGraidient(int value) {
-        this.idealGraidient = value;
+    public void setGradient(float value) {
+        this.gradient = value;
     }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/8f639eb1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/model/MemoryConsumption.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/model/MemoryConsumption.java
 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/model/MemoryConsumption.java
index 210c29c..39161b6 100644
--- 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/model/MemoryConsumption.java
+++ 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/model/MemoryConsumption.java
@@ -24,50 +24,51 @@ package org.apache.stratos.autoscaler.policy.model;
  */
 public class MemoryConsumption {
 
-       private int upperLimit;
-       private int lowerLimit;
-       private int idealGraidient;
+    private float average;
+    private float secondDerivative;
+    private float gradient;
 
     /**
-     * Gets the value of the upperLimit property.  
+     * Gets the value of the average property.   
      */
-    public int getUpperLimit() {
-        return upperLimit;
+    public float getAverage() {
+        return average;
     }
 
     /**
-     * Sets the value of the upperLimit property.   
+     * Sets the value of the average property.   
      */
-    public void setUpperLimit(int value) {
-        this.upperLimit = value;
+    public void setAverage(float value) {
+        this.average = value;
     }
 
     /**
-     * Gets the value of the lowerLimit property. 
+     * Gets the value of the second-derivative property. 
      */
-    public int getLowerLimit() {
-        return lowerLimit;
+    public float getSecondDerivative() {
+        return secondDerivative;
     }
 
     /**
-     * Sets the value of the lowerLimit property. 
+     * Sets the value of the second-derivative property.   
      */
-    public void setLowerLimit(int value) {
-        this.lowerLimit = value;
+    public void setSecondDerivative(float value) {
+        this.secondDerivative = value;
     }
 
     /**
-     * Gets the value of the idealGraidient property.   
+     * Gets the value of the gradient property. 
      */
-    public int getIdealGraidient() {
-        return idealGraidient;
+    public float getGradient() {
+        return gradient;
     }
 
     /**
-     * Sets the value of the idealGraidient property.    
+     * Sets the value of the gradient property.
+     *     
      */
-    public void setIdealGraidient(int value) {
-        this.idealGraidient = value;
+    public void setGradient(float value) {
+        this.gradient = value;
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/8f639eb1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/model/Partition.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/model/Partition.java
 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/model/Partition.java
index e4d9e18..403c968 100644
--- 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/model/Partition.java
+++ 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/model/Partition.java
@@ -26,6 +26,7 @@ public class Partition {
 
        private int partitionMax;
        private int partitionMin;
+       private String id;
        private String iaas;
        private String zone;
 
@@ -109,4 +110,28 @@ public class Partition {
         this.zone = 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 id) {
+               this.id = id;
+       }
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/8f639eb1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/model/RequestsInFlight.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/model/RequestsInFlight.java
 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/model/RequestsInFlight.java
index 507b7aa..bc6afbe 100644
--- 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/model/RequestsInFlight.java
+++ 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/model/RequestsInFlight.java
@@ -24,50 +24,51 @@ package org.apache.stratos.autoscaler.policy.model;
  */
 public class RequestsInFlight {
 
-       private int upperLimit;
-       private int lowerLimit;
-       private int idealGraidient;
+    private float average;
+    private float secondDerivative;
+    private float gradient;
 
     /**
-     * Gets the value of the upperLimit property.    
+     * Gets the value of the average property.   
      */
-    public int getUpperLimit() {
-        return upperLimit;
+    public float getAverage() {
+        return average;
     }
 
     /**
-     * Sets the value of the upperLimit property.
+     * Sets the value of the average property.   
      */
-    public void setUpperLimit(int value) {
-        this.upperLimit = value;
+    public void setAverage(float value) {
+        this.average = value;
     }
 
     /**
-     * Gets the value of the lowerLimit property. 
+     * Gets the value of the second-derivative property. 
      */
-    public int getLowerLimit() {
-        return lowerLimit;
+    public float getSecondDerivative() {
+        return secondDerivative;
     }
 
     /**
-     * Sets the value of the lowerLimit property.
+     * Sets the value of the second-derivative property.   
      */
-    public void setLowerLimit(int value) {
-        this.lowerLimit = value;
+    public void setSecondDerivative(float value) {
+        this.secondDerivative = value;
     }
 
     /**
-     * Gets the value of the idealGraidient property. 
+     * Gets the value of the gradient property. 
      */
-    public int getIdealGraidient() {
-        return idealGraidient;
+    public float getGradient() {
+        return gradient;
     }
 
     /**
-     * Sets the value of the idealGraidient property.
+     * Sets the value of the gradient property.
+     *     
      */
-    public void setIdealGraidient(int value) {
-        this.idealGraidient = value;
+    public void setGradient(float value) {
+        this.gradient = value;
     }
 
 }
\ No newline at end of file

Reply via email to