fixing https://issues.apache.org/jira/browse/STRATOS-645 - for rest EP
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/57a60faa Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/57a60faa Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/57a60faa Branch: refs/heads/master Commit: 57a60faa8a77a386cdea54492ad2b4c2dafd32a2 Parents: ea1844f Author: Nirmal Fernando <[email protected]> Authored: Wed May 7 04:24:11 2014 +0530 Committer: Nirmal Fernando <[email protected]> Committed: Wed May 7 04:24:11 2014 +0530 ---------------------------------------------------------------------- .../policy/autoscale/LoadAverage.java | 36 ----------- .../policy/autoscale/LoadAverageThresholds.java | 30 +++++++++ .../policy/autoscale/LoadThresholds.java | 8 +-- .../policy/autoscale/MemoryConsumption.java | 36 ----------- .../autoscale/MemoryConsumptionThresholds.java | 30 +++++++++ .../policy/autoscale/RequestsInFlight.java | 36 ----------- .../autoscale/RequestsInFlightThresholds.java | 31 ++++++++++ .../bean/util/converter/PojoConverter.java | 65 +++++++------------- 8 files changed, 115 insertions(+), 157 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/57a60faa/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/LoadAverage.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/LoadAverage.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/LoadAverage.java deleted file mode 100644 index d500f90..0000000 --- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/LoadAverage.java +++ /dev/null @@ -1,36 +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.rest.endpoint.bean.autoscaler.policy.autoscale; - -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -public class LoadAverage { - - public float average; - - public float secondDerivative; - - public float gradient; - - public float scaleDownMarginOfGradient; - - public float scaleDownMarginOfSecondDerivative; -} http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/57a60faa/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/LoadAverageThresholds.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/LoadAverageThresholds.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/LoadAverageThresholds.java new file mode 100644 index 0000000..ee85353 --- /dev/null +++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/LoadAverageThresholds.java @@ -0,0 +1,30 @@ +/* + * 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.rest.endpoint.bean.autoscaler.policy.autoscale; + +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class LoadAverageThresholds { + + public float upperLimit; + + public float lowerLimit; +} http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/57a60faa/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/LoadThresholds.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/LoadThresholds.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/LoadThresholds.java index a53cf8c..30de3bd 100644 --- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/LoadThresholds.java +++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/LoadThresholds.java @@ -24,9 +24,7 @@ import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class LoadThresholds { - public RequestsInFlight requestsInFlight; - - public MemoryConsumption memoryConsumption; - - public LoadAverage loadAverage; + public RequestsInFlightThresholds requestsInFlight; + public MemoryConsumptionThresholds memoryConsumption; + public LoadAverageThresholds loadAverage; } http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/57a60faa/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/MemoryConsumption.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/MemoryConsumption.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/MemoryConsumption.java deleted file mode 100644 index b1c9675..0000000 --- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/MemoryConsumption.java +++ /dev/null @@ -1,36 +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.rest.endpoint.bean.autoscaler.policy.autoscale; - -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -public class MemoryConsumption { - - public float average; - - public float secondDerivative; - - public float gradient; - - public float scaleDownMarginOfGradient; - - public float scaleDownMarginOfSecondDerivative; -} http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/57a60faa/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/MemoryConsumptionThresholds.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/MemoryConsumptionThresholds.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/MemoryConsumptionThresholds.java new file mode 100644 index 0000000..261f07c --- /dev/null +++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/MemoryConsumptionThresholds.java @@ -0,0 +1,30 @@ +/* + * 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.rest.endpoint.bean.autoscaler.policy.autoscale; + +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class MemoryConsumptionThresholds { + + public float upperLimit; + + public float lowerLimit; +} http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/57a60faa/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/RequestsInFlight.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/RequestsInFlight.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/RequestsInFlight.java deleted file mode 100644 index 7e5b7cd..0000000 --- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/RequestsInFlight.java +++ /dev/null @@ -1,36 +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.rest.endpoint.bean.autoscaler.policy.autoscale; - -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -public class RequestsInFlight { - - public float average; - - public float secondDerivative; - - public float gradient; - - public float scaleDownMarginOfGradient; - - public float scaleDownMarginOfSecondDerivative; -} http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/57a60faa/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/RequestsInFlightThresholds.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/RequestsInFlightThresholds.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/RequestsInFlightThresholds.java new file mode 100644 index 0000000..d894169 --- /dev/null +++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale/RequestsInFlightThresholds.java @@ -0,0 +1,31 @@ +/* + * 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.rest.endpoint.bean.autoscaler.policy.autoscale; + +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class RequestsInFlightThresholds { + + public float upperLimit; + + public float lowerLimit; + +} http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/57a60faa/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/util/converter/PojoConverter.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/util/converter/PojoConverter.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/util/converter/PojoConverter.java index 1208967..3db3b24 100644 --- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/util/converter/PojoConverter.java +++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/util/converter/PojoConverter.java @@ -236,40 +236,31 @@ public class PojoConverter { if(autoscalePolicyBean.getLoadThresholds().loadAverage != null) { //set load average information - org.apache.stratos.autoscaler.policy.model.LoadAverage loadAverage = new - org.apache.stratos.autoscaler.policy.model.LoadAverage(); - loadAverage.setAverage(autoscalePolicyBean.getLoadThresholds().loadAverage.average); - loadAverage.setGradient(autoscalePolicyBean.getLoadThresholds().loadAverage.gradient); - loadAverage.setSecondDerivative(autoscalePolicyBean.getLoadThresholds().loadAverage.secondDerivative); - loadAverage.setScaleDownMarginOfGradient(autoscalePolicyBean.getLoadThresholds().loadAverage.scaleDownMarginOfGradient); - loadAverage.setScaleDownMarginOfSecondDerivative(autoscalePolicyBean.getLoadThresholds().loadAverage.scaleDownMarginOfSecondDerivative); + org.apache.stratos.autoscaler.policy.model.LoadAverageThresholds loadAverage = new + org.apache.stratos.autoscaler.policy.model.LoadAverageThresholds(); + loadAverage.setUpperLimit(autoscalePolicyBean.getLoadThresholds().loadAverage.upperLimit); + loadAverage.setLowerLimit(autoscalePolicyBean.getLoadThresholds().loadAverage.lowerLimit); //set load average loadThresholds.setLoadAverage(loadAverage); } if (autoscalePolicyBean.getLoadThresholds().requestsInFlight != null) { - org.apache.stratos.autoscaler.policy.model.RequestsInFlight requestsInFlight = new - org.apache.stratos.autoscaler.policy.model.RequestsInFlight(); + org.apache.stratos.autoscaler.policy.model.RequestsInFlightThresholds requestsInFlight = new + org.apache.stratos.autoscaler.policy.model.RequestsInFlightThresholds(); //set request in flight information - requestsInFlight.setAverage(autoscalePolicyBean.getLoadThresholds().requestsInFlight.average); - requestsInFlight.setGradient(autoscalePolicyBean.getLoadThresholds().requestsInFlight.gradient); - requestsInFlight.setSecondDerivative(autoscalePolicyBean.getLoadThresholds().requestsInFlight.secondDerivative); - requestsInFlight.setScaleDownMarginOfGradient(autoscalePolicyBean.getLoadThresholds().requestsInFlight.scaleDownMarginOfGradient); - requestsInFlight.setScaleDownMarginOfSecondDerivative(autoscalePolicyBean.getLoadThresholds().requestsInFlight.scaleDownMarginOfSecondDerivative); + requestsInFlight.setUpperLimit(autoscalePolicyBean.getLoadThresholds().requestsInFlight.upperLimit); + requestsInFlight.setLowerLimit(autoscalePolicyBean.getLoadThresholds().requestsInFlight.lowerLimit); //set request in flight loadThresholds.setRequestsInFlight(requestsInFlight); } if (autoscalePolicyBean.getLoadThresholds().memoryConsumption != null) { - org.apache.stratos.autoscaler.policy.model.MemoryConsumption memoryConsumption = new - org.apache.stratos.autoscaler.policy.model.MemoryConsumption(); + org.apache.stratos.autoscaler.policy.model.MemoryConsumptionThresholds memoryConsumption = new + org.apache.stratos.autoscaler.policy.model.MemoryConsumptionThresholds(); //set memory consumption information - memoryConsumption.setAverage(autoscalePolicyBean.getLoadThresholds().memoryConsumption.average); - memoryConsumption.setGradient(autoscalePolicyBean.getLoadThresholds().memoryConsumption.gradient); - memoryConsumption.setSecondDerivative(autoscalePolicyBean.getLoadThresholds().memoryConsumption.secondDerivative); - memoryConsumption.setScaleDownMarginOfGradient(autoscalePolicyBean.getLoadThresholds().memoryConsumption.scaleDownMarginOfGradient); - memoryConsumption.setScaleDownMarginOfSecondDerivative(autoscalePolicyBean.getLoadThresholds().memoryConsumption.scaleDownMarginOfSecondDerivative); + memoryConsumption.setUpperLimit(autoscalePolicyBean.getLoadThresholds().memoryConsumption.upperLimit); + memoryConsumption.setLowerLimit(autoscalePolicyBean.getLoadThresholds().memoryConsumption.lowerLimit); //set memory consumption loadThresholds.setMemoryConsumption(memoryConsumption); } @@ -475,35 +466,21 @@ public class PojoConverter { LoadThresholds loadThresholdBean = new LoadThresholds(); if(loadThresholds.getLoadAverage() != null) { - LoadAverage loadAverage = new LoadAverage(); - loadAverage.average = loadThresholds.getLoadAverage().getAverage(); - loadAverage.gradient = loadThresholds.getLoadAverage().getGradient(); - loadAverage.scaleDownMarginOfGradient = loadThresholds.getLoadAverage().getScaleDownMarginOfGradient(); - loadAverage.scaleDownMarginOfSecondDerivative = loadThresholds.getLoadAverage(). - getScaleDownMarginOfSecondDerivative(); - loadAverage.secondDerivative = loadThresholds.getLoadAverage().getSecondDerivative(); + LoadAverageThresholds loadAverage = new LoadAverageThresholds(); + loadAverage.upperLimit = loadThresholds.getLoadAverage().getUpperLimit(); + loadAverage.lowerLimit = loadThresholds.getLoadAverage().getLowerLimit(); loadThresholdBean.loadAverage = loadAverage; } if(loadThresholds.getMemoryConsumption() != null) { - MemoryConsumption memoryConsumption = new MemoryConsumption(); - memoryConsumption.average = loadThresholds.getMemoryConsumption().getAverage(); - memoryConsumption.gradient = loadThresholds.getMemoryConsumption().getGradient(); - memoryConsumption.scaleDownMarginOfGradient = loadThresholds.getMemoryConsumption(). - getScaleDownMarginOfGradient(); - memoryConsumption.scaleDownMarginOfSecondDerivative = loadThresholds.getMemoryConsumption(). - getScaleDownMarginOfSecondDerivative(); - memoryConsumption.secondDerivative = loadThresholds.getMemoryConsumption().getSecondDerivative(); + MemoryConsumptionThresholds memoryConsumption = new MemoryConsumptionThresholds(); + memoryConsumption.upperLimit = loadThresholds.getMemoryConsumption().getUpperLimit(); + memoryConsumption.lowerLimit = loadThresholds.getMemoryConsumption().getLowerLimit(); loadThresholdBean.memoryConsumption = memoryConsumption; } if(loadThresholds.getRequestsInFlight() != null) { - RequestsInFlight requestsInFlight = new RequestsInFlight(); - requestsInFlight.average = loadThresholds.getRequestsInFlight().getAverage(); - requestsInFlight.gradient = loadThresholds.getRequestsInFlight().getGradient(); - requestsInFlight.scaleDownMarginOfGradient = loadThresholds.getRequestsInFlight(). - getScaleDownMarginOfGradient(); - requestsInFlight.scaleDownMarginOfSecondDerivative = loadThresholds.getRequestsInFlight(). - getScaleDownMarginOfSecondDerivative(); - requestsInFlight.secondDerivative = loadThresholds.getRequestsInFlight().getSecondDerivative(); + RequestsInFlightThresholds requestsInFlight = new RequestsInFlightThresholds(); + requestsInFlight.upperLimit = loadThresholds.getRequestsInFlight().getUpperLimit(); + requestsInFlight.lowerLimit = loadThresholds.getRequestsInFlight().getLowerLimit(); loadThresholdBean.requestsInFlight = requestsInFlight; }
