You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by la...@apache.org on 2015/04/07 05:06:31 UTC
[01/20] stratos git commit: Deployment policy move:Move partition and
exception files
Repository: stratos
Updated Branches:
refs/heads/master 571bda5d5 -> 53ad7f4b5
Deployment policy move:Move partition and exception files
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/54f5075e
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/54f5075e
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/54f5075e
Branch: refs/heads/master
Commit: 54f5075e12ed143b91c34857b76521cdc1c1ec3e
Parents: 571bda5
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Tue Apr 7 07:42:39 2015 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Tue Apr 7 07:42:39 2015 +0530
----------------------------------------------------------------------
.../DeploymentPolicyAlreadyExistsException.java | 30 ++++
.../DeploymentPolicyNotExistsException.java | 30 ++++
.../InvalidDeploymentPolicyException.java | 26 ++++
.../policy/deployment/DeploymentPolicy.java | 87 +++++++++++
.../controller/domain/DeploymentPolicy.java | 87 -----------
.../controller/domain/NetworkPartitionRef.java | 82 ----------
.../cloud/controller/domain/PartitionRef.java | 53 -------
.../DeploymentPolicyAlreadyExistsException.java | 30 ----
.../DeploymentPolicyNotExistsException.java | 30 ----
.../InvalidDeploymentPolicyException.java | 26 ----
.../partition/NetworkPartitionRefBean.java | 57 -------
.../beans/partition/PartitionRefBean.java | 46 ------
.../common/partition/NetworkPartition.java | 102 +++++++++++++
.../stratos/common/partition/Partition.java | 153 +++++++++++++++++++
14 files changed, 428 insertions(+), 411 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/54f5075e/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/exception/policy/DeploymentPolicyAlreadyExistsException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/exception/policy/DeploymentPolicyAlreadyExistsException.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/exception/policy/DeploymentPolicyAlreadyExistsException.java
new file mode 100644
index 0000000..44a22fd
--- /dev/null
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/exception/policy/DeploymentPolicyAlreadyExistsException.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.autoscaler.exception.policy;
+
+/**
+ * Cartridge already exists exception.
+ */
+public class DeploymentPolicyAlreadyExistsException extends Exception {
+
+ public DeploymentPolicyAlreadyExistsException(String message) {
+ super(message);
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/54f5075e/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/exception/policy/DeploymentPolicyNotExistsException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/exception/policy/DeploymentPolicyNotExistsException.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/exception/policy/DeploymentPolicyNotExistsException.java
new file mode 100644
index 0000000..07ff247
--- /dev/null
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/exception/policy/DeploymentPolicyNotExistsException.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.autoscaler.exception.policy;
+
+/**
+ * Cartridge already exists exception.
+ */
+public class DeploymentPolicyNotExistsException extends Exception {
+
+ public DeploymentPolicyNotExistsException(String message) {
+ super(message);
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/54f5075e/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/exception/policy/InvalidDeploymentPolicyException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/exception/policy/InvalidDeploymentPolicyException.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/exception/policy/InvalidDeploymentPolicyException.java
new file mode 100644
index 0000000..fb865bc
--- /dev/null
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/exception/policy/InvalidDeploymentPolicyException.java
@@ -0,0 +1,26 @@
+/*
+ * 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.exception.policy;
+
+public class InvalidDeploymentPolicyException extends Exception{
+
+ public InvalidDeploymentPolicyException(String message) {
+ super(message);
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/54f5075e/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/deployment/DeploymentPolicy.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/deployment/DeploymentPolicy.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/deployment/DeploymentPolicy.java
new file mode 100644
index 0000000..dddc189
--- /dev/null
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/deployment/DeploymentPolicy.java
@@ -0,0 +1,87 @@
+/*
+ * 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.deployment;
+
+import java.io.Serializable;
+import java.util.Arrays;
+
+/**
+ * The model class for Deployment-Policy definition.
+ */
+public class DeploymentPolicy implements Serializable{
+
+ private static final long serialVersionUID = 5675507196284400099L;
+ private String deploymentPolicyID;
+ private NetworkPartitionRef[] applicationLevelNetworkPartitions;
+
+ public String getDeploymentPolicyID() {
+ return deploymentPolicyID;
+ }
+
+ public void setDeploymentPolicyID(String deploymentPolicyID) {
+ this.deploymentPolicyID = deploymentPolicyID;
+ }
+
+ public NetworkPartitionRef[] getNetworkPartitionsRef() {
+ return applicationLevelNetworkPartitions;
+ }
+
+ public void setNetworkPartitionsRef(NetworkPartitionRef[] applicationLevelNetworkPartitions) {
+ this.applicationLevelNetworkPartitions = applicationLevelNetworkPartitions;
+ }
+
+ /**
+ * Get network partition reference object by network partition id.
+ * @param networkPartitionId
+ * @return the {@link NetworkPartitionRef}
+ */
+ public NetworkPartitionRef getNetworkPartitionRefByNetworkPartitionId(String networkPartitionId) {
+ if (applicationLevelNetworkPartitions != null) {
+ for (NetworkPartitionRef networkPartitionRef : applicationLevelNetworkPartitions) {
+ if (networkPartitionRef.getId().equals(networkPartitionId)) {
+ return networkPartitionRef;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Get partition references by network partition id.
+ * @param networkPartitionId
+ * @return an array of {@link PartitionRef}
+ */
+ public PartitionRef[] getPartitionRefsByNetworkPartitionId(String networkPartitionId) {
+ if (applicationLevelNetworkPartitions != null) {
+ for (NetworkPartitionRef networkPartitionRef : applicationLevelNetworkPartitions) {
+ if (networkPartitionRef.getId().equals(networkPartitionId)) {
+ return networkPartitionRef.getPartitions();
+ }
+ }
+ }
+ return null;
+ }
+
+ public String toString() {
+ return String.format("{ deployment-policy-id : %s, network-partitions : %s", deploymentPolicyID,
+ Arrays.toString(applicationLevelNetworkPartitions));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/54f5075e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/DeploymentPolicy.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/DeploymentPolicy.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/DeploymentPolicy.java
deleted file mode 100644
index 275d544..0000000
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/DeploymentPolicy.java
+++ /dev/null
@@ -1,87 +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.cloud.controller.domain;
-
-import java.io.Serializable;
-import java.util.Arrays;
-
-/**
- * The model class for Deployment-Policy definition.
- */
-public class DeploymentPolicy implements Serializable{
-
- private static final long serialVersionUID = 5675507196284400099L;
- private String deploymentPolicyID;
- private NetworkPartitionRef[] applicationLevelNetworkPartitions;
-
- public String getDeploymentPolicyID() {
- return deploymentPolicyID;
- }
-
- public void setDeploymentPolicyID(String deploymentPolicyID) {
- this.deploymentPolicyID = deploymentPolicyID;
- }
-
- public NetworkPartitionRef[] getNetworkPartitionsRef() {
- return applicationLevelNetworkPartitions;
- }
-
- public void setNetworkPartitionsRef(NetworkPartitionRef[] applicationLevelNetworkPartitions) {
- this.applicationLevelNetworkPartitions = applicationLevelNetworkPartitions;
- }
-
- /**
- * Get network partition reference object by network partition id.
- * @param networkPartitionId
- * @return the {@link NetworkPartitionRef}
- */
- public NetworkPartitionRef getNetworkPartitionRefByNetworkPartitionId(String networkPartitionId) {
- if (applicationLevelNetworkPartitions != null) {
- for (NetworkPartitionRef networkPartitionRef : applicationLevelNetworkPartitions) {
- if (networkPartitionRef.getId().equals(networkPartitionId)) {
- return networkPartitionRef;
- }
- }
- }
- return null;
- }
-
- /**
- * Get partition references by network partition id.
- * @param networkPartitionId
- * @return an array of {@link PartitionRef}
- */
- public PartitionRef[] getPartitionRefsByNetworkPartitionId(String networkPartitionId) {
- if (applicationLevelNetworkPartitions != null) {
- for (NetworkPartitionRef networkPartitionRef : applicationLevelNetworkPartitions) {
- if (networkPartitionRef.getId().equals(networkPartitionId)) {
- return networkPartitionRef.getPartitions();
- }
- }
- }
- return null;
- }
-
- public String toString() {
- return String.format("{ deployment-policy-id : %s, network-partitions : %s", deploymentPolicyID,
- Arrays.toString(applicationLevelNetworkPartitions));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/54f5075e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/NetworkPartitionRef.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/NetworkPartitionRef.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/NetworkPartitionRef.java
deleted file mode 100644
index 92b906a..0000000
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/NetworkPartitionRef.java
+++ /dev/null
@@ -1,82 +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.cloud.controller.domain;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-import java.io.Serializable;
-import java.util.Arrays;
-
-@XmlRootElement
-public class NetworkPartitionRef implements Serializable{
-
- private static final long serialVersionUID = 3725971214092010720L;
-
- private String id;
-
- private String partitionAlgo;
-
- private PartitionRef[] partitions;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getPartitionAlgo() {
- return partitionAlgo;
- }
-
- public void setPartitionAlgo(String partitionAlgo) {
- this.partitionAlgo = partitionAlgo;
- }
-
- public PartitionRef[] getPartitions() {
- return partitions;
- }
-
- public void setPartitions(PartitionRef[] partitions) {
- this.partitions = partitions;
- }
-
- /**
- * Get partition reference by partition id
- * @param partitionId
- * @return {@link PartitionRef}
- */
- public PartitionRef getPartitionRef(String partitionId) {
- if (partitions != null && partitions.length != 0) {
- for (PartitionRef partitionRef : partitions) {
- if (partitionRef.getId().equals(partitionId)) {
- return partitionRef;
- }
- }
- }
- return null;
- }
-
- @Override
- public String toString() {
- return String.format("{ network-partition-id : %s, partition-algo : %s, partitions : %s }", id, partitionAlgo, Arrays.toString(partitions));
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/54f5075e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/PartitionRef.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/PartitionRef.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/PartitionRef.java
deleted file mode 100644
index b198c9c..0000000
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/PartitionRef.java
+++ /dev/null
@@ -1,53 +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.cloud.controller.domain;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-import java.io.Serializable;
-
-@XmlRootElement
-public class PartitionRef implements Serializable {
-
- private static final long serialVersionUID = 3725971214092010720L;
- private String id;
- private int max;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public int getMax() {
- return max;
- }
-
- public void setMax(int max) {
- this.max = max;
- }
-
- @Override
- public String toString() {
- return String.format("{ partion-id : %s, partition-max : %s }", id, max);
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/54f5075e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/exception/DeploymentPolicyAlreadyExistsException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/exception/DeploymentPolicyAlreadyExistsException.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/exception/DeploymentPolicyAlreadyExistsException.java
deleted file mode 100644
index 383af49..0000000
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/exception/DeploymentPolicyAlreadyExistsException.java
+++ /dev/null
@@ -1,30 +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.cloud.controller.exception;
-
-/**
- * Cartridge already exists exception.
- */
-public class DeploymentPolicyAlreadyExistsException extends Exception {
-
- public DeploymentPolicyAlreadyExistsException(String message) {
- super(message);
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/54f5075e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/exception/DeploymentPolicyNotExistsException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/exception/DeploymentPolicyNotExistsException.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/exception/DeploymentPolicyNotExistsException.java
deleted file mode 100644
index 698133e..0000000
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/exception/DeploymentPolicyNotExistsException.java
+++ /dev/null
@@ -1,30 +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.cloud.controller.exception;
-
-/**
- * Cartridge already exists exception.
- */
-public class DeploymentPolicyNotExistsException extends Exception {
-
- public DeploymentPolicyNotExistsException(String message) {
- super(message);
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/54f5075e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/exception/InvalidDeploymentPolicyException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/exception/InvalidDeploymentPolicyException.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/exception/InvalidDeploymentPolicyException.java
deleted file mode 100644
index 7bce66e..0000000
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/exception/InvalidDeploymentPolicyException.java
+++ /dev/null
@@ -1,26 +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.cloud.controller.exception;
-
-public class InvalidDeploymentPolicyException extends Exception{
-
- public InvalidDeploymentPolicyException(String message) {
- super(message);
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/54f5075e/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/NetworkPartitionRefBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/NetworkPartitionRefBean.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/NetworkPartitionRefBean.java
deleted file mode 100644
index 2411479..0000000
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/NetworkPartitionRefBean.java
+++ /dev/null
@@ -1,57 +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.common.beans.partition;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import java.util.List;
-
-@XmlRootElement
-public class NetworkPartitionRefBean {
-
- private String id;
-
- private String partitionAlgo;
-
- private List<PartitionRefBean> partitions;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public List<PartitionRefBean> getPartitions() {
- return partitions;
- }
-
- public void setPartitions(List<PartitionRefBean> partitions) {
- this.partitions = partitions;
- }
-
- public String getPartitionAlgo() {
- return partitionAlgo;
- }
-
- public void setPartitionAlgo(String partitionAlgo) {
- this.partitionAlgo = partitionAlgo;
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/54f5075e/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/PartitionRefBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/PartitionRefBean.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/PartitionRefBean.java
deleted file mode 100644
index 9c9fc00..0000000
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/PartitionRefBean.java
+++ /dev/null
@@ -1,46 +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.common.beans.partition;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement
-public class PartitionRefBean {
-
- private String id;
-
- private int partitionMax;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public int getPartitionMax() {
- return partitionMax;
- }
-
- public void setPartitionMax(int partitionMax) {
- this.partitionMax = partitionMax;
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/54f5075e/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/NetworkPartition.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/NetworkPartition.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/NetworkPartition.java
new file mode 100644
index 0000000..a155a1a
--- /dev/null
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/NetworkPartition.java
@@ -0,0 +1,102 @@
+/*
+* 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.common.partition;
+
+import java.io.Serializable;
+import java.util.Arrays;
+
+/**
+* The model class for NetworkPartition definition.
+*/
+public class NetworkPartition implements Serializable {
+
+ private static final long serialVersionUID = -8043298009352097370L;
+
+ private String id;
+ private String provider;
+ private boolean activeByDefault;
+ private Partition[] partitions;
+ private String partitionAlgo;
+
+ 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;
+ }
+
+ public Partition getPartition(String partitionId) {
+ for(Partition partition : partitions) {
+ if(partition.getId().equals(partitionId)) {
+ return partition;
+ }
+ }
+ return null;
+ }
+
+ public String getProvider() {
+ return provider;
+ }
+
+ public void setProvider(String provider) {
+ this.provider = provider;
+ }
+
+ public String getPartitionAlgo() {
+ return partitionAlgo;
+ }
+
+ public void setPartitionAlgo(String partitionAlgo) {
+ this.partitionAlgo = partitionAlgo;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/54f5075e/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/Partition.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/Partition.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/Partition.java
new file mode 100644
index 0000000..54b93e4
--- /dev/null
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/Partition.java
@@ -0,0 +1,153 @@
+/*
+ * 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.common.partition;
+
+import org.apache.stratos.common.Properties;
+import org.apache.stratos.common.Property;
+
+import java.io.Serializable;
+
+/**
+ * This is keep the partition information
+ */
+public class Partition implements Serializable {
+
+ private static final long serialVersionUID = 3725971287992010720L;
+
+ private static final String KUBERNETES_CLUSTER = "cluster";
+
+ /**
+ * provider should match with an IaasProvider type.
+ */
+ private String provider;
+ private String id;
+ private String description;
+ private boolean isPublic;
+ private Properties properties = new Properties();
+
+ /**
+ * 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 id
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * 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 isPublic property.
+ *
+ */
+ public boolean getIsPublic() {
+ return isPublic;
+ }
+
+ public Properties getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Properties properties) {
+ this.properties = properties;
+ }
+
+ public String getProvider() {
+ return provider;
+ }
+
+ public void setProvider(String provider) {
+ this.provider = provider;
+ }
+
+ public String getKubernetesClusterId() {
+ Property property = properties.getProperty(KUBERNETES_CLUSTER);
+ if(property != null) {
+ return property.getValue();
+ }
+ return null;
+ }
+
+ @Override
+ public String toString() {
+ return "Partition [id=" + id + ", description=" + description + ", isPublic=" + isPublic
+ + ", provider=" + provider + ", properties=" + properties + "]";
+ }
+
+ public boolean equals(Object obj) {
+ if(obj != null && obj instanceof Partition) {
+ return this.id.equals(((Partition) obj).getId());
+ }
+ return false;
+
+ }
+
+ @Override
+ public int hashCode() {
+ return this.id.hashCode();
+ }
+}
[08/20] stratos git commit: Deployment policy move:Update autoscaler
context classes
Posted by la...@apache.org.
Deployment policy move:Update autoscaler context classes
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/abb01bd5
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/abb01bd5
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/abb01bd5
Branch: refs/heads/master
Commit: abb01bd5e27c493d0136afbc3084e349d82717f9
Parents: c662b19
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Tue Apr 7 08:04:10 2015 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Tue Apr 7 08:04:10 2015 +0530
----------------------------------------------------------------------
.../context/cluster/ClusterContext.java | 233 +++++++++----------
.../partition/ClusterLevelPartitionContext.java | 2 +-
.../context/partition/PartitionContext.java | 2 +-
3 files changed, 113 insertions(+), 124 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/abb01bd5/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContext.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContext.java
index 51aca64..c9996dd 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContext.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContext.java
@@ -30,13 +30,14 @@ import org.apache.stratos.autoscaler.context.partition.network.ClusterLevelNetwo
import org.apache.stratos.autoscaler.exception.AutoScalerException;
import org.apache.stratos.autoscaler.exception.partition.PartitionValidationException;
import org.apache.stratos.autoscaler.exception.policy.PolicyValidationException;
+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.util.AutoscalerObjectConverter;
import org.apache.stratos.autoscaler.util.AutoscalerUtil;
-import org.apache.stratos.cloud.controller.stub.domain.DeploymentPolicy;
import org.apache.stratos.cloud.controller.stub.domain.MemberContext;
-import org.apache.stratos.cloud.controller.stub.domain.NetworkPartitionRef;
-import org.apache.stratos.cloud.controller.stub.domain.Partition;
-import org.apache.stratos.cloud.controller.stub.domain.PartitionRef;
+import org.apache.stratos.common.partition.NetworkPartition;
+import org.apache.stratos.common.partition.Partition;
import org.apache.stratos.common.client.CloudControllerServiceClient;
import org.apache.stratos.messaging.domain.application.Application;
import org.apache.stratos.messaging.domain.application.ClusterDataHolder;
@@ -52,7 +53,7 @@ public class ClusterContext extends AbstractClusterContext {
private static final long serialVersionUID = 17570842529682141L;
- private static final Log log = LogFactory.getLog(ClusterContext.class);
+ private static final Log log = LogFactory.getLog(ClusterContext.class);
// Map<NetworkpartitionId, Network Partition Context>
protected Map<String, ClusterLevelNetworkPartitionContext> networkPartitionCtxts;
@@ -114,39 +115,32 @@ public class ClusterContext extends AbstractClusterContext {
throws PolicyValidationException, PartitionValidationException {
ClusterLevelNetworkPartitionContext networkPartitionContext = null;
ClusterInstance clusterInstance = cluster.getInstanceContexts(instanceId);
-
+
String deploymentPolicyName = AutoscalerUtil.getDeploymentPolicyIdByAlias(cluster.getAppId(), AutoscalerUtil.getAliasFromClusterId(clusterId));
- DeploymentPolicy deploymentPolicy;
- try {
- deploymentPolicy = CloudControllerServiceClient.getInstance().getDeploymentPolicy(deploymentPolicyName);
- } catch (Exception e) {
- String msg = String.format("Error while getting deployment policy from cloud controller [deployment-policy-id] %s", deploymentPolicyName);
- log.error(msg, e);
- throw new AutoScalerException(msg, e);
- }
-
+ DeploymentPolicy deploymentPolicy = PolicyManager.getInstance().getDeploymentPolicy(deploymentPolicyName);
+
if (networkPartitionCtxts.containsKey(clusterInstance.getNetworkPartitionId())) {
networkPartitionContext = this.networkPartitionCtxts.get(
clusterInstance.getNetworkPartitionId());
} else {
-
- NetworkPartitionRef[] networkPartitionRefs = deploymentPolicy.getNetworkPartitionsRef();
- NetworkPartitionRef networkPartitionRef = null;
- if (networkPartitionRefs != null && networkPartitionRefs.length != 0) {
- for (NetworkPartitionRef i : networkPartitionRefs) {
- if (i.getId().equals(clusterInstance.getNetworkPartitionId())) {
- networkPartitionRef = i;
- }
- }
- }
-
- if (networkPartitionRef == null) {
- //Parent should have the partition specified
- networkPartitionContext = new ClusterLevelNetworkPartitionContext(clusterInstance.getNetworkPartitionId());
- } else {
- networkPartitionContext = new ClusterLevelNetworkPartitionContext(networkPartitionRef.getId(),
- networkPartitionRef.getPartitionAlgo(), 0);
- }
+
+ NetworkPartition[] networkPartitions = deploymentPolicy.getNetworkPartitions();
+ NetworkPartition networkPartition = null;
+ if (networkPartitions != null && networkPartitions.length != 0) {
+ for (NetworkPartition i : networkPartitions) {
+ if (i.getId().equals(clusterInstance.getNetworkPartitionId())) {
+ networkPartition = i;
+ }
+ }
+ }
+
+ if (networkPartition == null) {
+ //Parent should have the partition specified
+ networkPartitionContext = new ClusterLevelNetworkPartitionContext(clusterInstance.getNetworkPartitionId());
+ } else {
+ networkPartitionContext = new ClusterLevelNetworkPartitionContext(networkPartition.getId(),
+ networkPartition.getPartitionAlgo(), 0);
+ }
}
if (clusterInstance.getPartitionId() != null) {
@@ -169,76 +163,68 @@ public class ClusterContext extends AbstractClusterContext {
}
- private ClusterLevelNetworkPartitionContext parseDeploymentPolicy(
- ClusterInstance clusterInstance,
- Cluster cluster,
- ClusterLevelNetworkPartitionContext clusterLevelNetworkPartitionContext,
- boolean hasGroupScalingDependent, boolean groupScalingEnabledSubtree)
- throws PolicyValidationException, PartitionValidationException {
-
- String deploymentPolicyName = AutoscalerUtil.getDeploymentPolicyIdByAlias(cluster.getAppId(), AutoscalerUtil.getAliasFromClusterId(clusterId));
- DeploymentPolicy deploymentPolicy;
- try {
- deploymentPolicy = CloudControllerServiceClient.getInstance().getDeploymentPolicy(deploymentPolicyName);
- } catch (Exception e) {
- String msg = String
- .format("Error while getting deployment policy from cloud controller [deployment-policy-id] %s",
- deploymentPolicyName);
- log.error(msg, e);
- throw new AutoScalerException(msg, e);
- }
-
- NetworkPartitionRef[] networkPartitionRefs = deploymentPolicy
- .getNetworkPartitionsRef();
- PartitionRef[] partitionRefs = null;
- if (networkPartitionRefs != null && networkPartitionRefs.length != 0) {
- for (NetworkPartitionRef networkPartitionRef : networkPartitionRefs) {
- if (networkPartitionRef.getId().equals(
- clusterLevelNetworkPartitionContext.getId())) {
- partitionRefs = networkPartitionRef.getPartitions();
- }
- }
- }
-
- if (partitionRefs == null) {
- String msg = "PartitionRefs are null in deployment policy for [cluster-alias] "
- + AutoscalerUtil.getAliasFromClusterId(clusterId);
- log.error(msg);
- throw new PolicyValidationException(msg);
- }
-
- // Retrieving the ChildLevelNetworkPartition and create NP Context
- NetworkPartitionRef networkPartitionRef = null;
- if (networkPartitionRefs != null && networkPartitionRefs.length != 0) {
- for (NetworkPartitionRef networkPartitionRef2 : networkPartitionRefs) {
- if (networkPartitionRef2.getId().equals(
- clusterInstance.getNetworkPartitionId())) {
- networkPartitionRef = networkPartitionRef2;
- }
- }
- }
-
- // Fill cluster instance context with child level partitions
- if (networkPartitionRef != null) {
- for (PartitionRef partitionRef : networkPartitionRef
- .getPartitions()) {
- addPartition(clusterInstance, cluster,
- clusterLevelNetworkPartitionContext, partitionRef,
- hasGroupScalingDependent, groupScalingEnabledSubtree);
- }
- }
-
- return clusterLevelNetworkPartitionContext;
- }
+ private ClusterLevelNetworkPartitionContext parseDeploymentPolicy(
+ ClusterInstance clusterInstance,
+ Cluster cluster,
+ ClusterLevelNetworkPartitionContext clusterLevelNetworkPartitionContext,
+ boolean hasGroupScalingDependent, boolean groupScalingEnabledSubtree)
+ throws PolicyValidationException, PartitionValidationException {
+
+ String deploymentPolicyName = AutoscalerUtil.getDeploymentPolicyIdByAlias(cluster.getAppId(), AutoscalerUtil.getAliasFromClusterId(clusterId));
+ DeploymentPolicy deploymentPolicy = PolicyManager.getInstance().getDeploymentPolicy(deploymentPolicyName);
+
+
+ NetworkPartition[] networkPartitions = deploymentPolicy
+ .getNetworkPartitions();
+ Partition[] partitions = null;
+ if (networkPartitions != null && networkPartitions.length != 0) {
+ for (NetworkPartition networkPartition : networkPartitions) {
+ if (networkPartition.getId().equals(
+ clusterLevelNetworkPartitionContext.getId())) {
+ partitions = networkPartition.getPartitions();
+ }
+ }
+ }
+
+ if (partitions == null) {
+ String msg = "Partitions are null in deployment policy for [cluster-alias] "
+ + AutoscalerUtil.getAliasFromClusterId(clusterId);
+ log.error(msg);
+ throw new PolicyValidationException(msg);
+ }
+
+ // Retrieving the ChildLevelNetworkPartition and create NP Context
+ NetworkPartition networkPartition = null;
+ if (networkPartitions != null && networkPartitions.length != 0) {
+ for (NetworkPartition networkPartition2 : networkPartitions) {
+ if (networkPartition2.getId().equals(
+ clusterInstance.getNetworkPartitionId())) {
+ networkPartition = networkPartition2;
+ }
+ }
+ }
+
+ // Fill cluster instance context with child level partitions
+ if (networkPartition != null) {
+ for (Partition partition : networkPartition
+ .getPartitions()) {
+ addPartition(clusterInstance, cluster,
+ clusterLevelNetworkPartitionContext, partition,
+ hasGroupScalingDependent, groupScalingEnabledSubtree);
+ }
+ }
+
+ return clusterLevelNetworkPartitionContext;
+ }
private ClusterLevelNetworkPartitionContext addPartition(
ClusterInstance clusterInstance,
Cluster cluster,
ClusterLevelNetworkPartitionContext clusterLevelNetworkPartitionContext,
- PartitionRef partitionRef,
+ Partition partition,
boolean hasScalingDependents, boolean groupScalingEnabledSubtree)
throws PolicyValidationException, PartitionValidationException {
-
+
if (clusterLevelNetworkPartitionContext == null) {
String msg = "Network Partition is null in deployment policy : [cluster-alias]: " + clusterInstance.getAlias();
log.error(msg);
@@ -248,10 +234,10 @@ public class ClusterContext extends AbstractClusterContext {
String nPartitionId = clusterLevelNetworkPartitionContext.getId();
//Getting the associated partition
- if (clusterInstance.getPartitionId() == null && partitionRef == null) {
+ if (clusterInstance.getPartitionId() == null && partition == null) {
String msg = "[Partition] " + clusterInstance.getPartitionId() + " for [networkPartition] " +
- clusterInstance.getNetworkPartitionId() + "is null " +
- "in deployment policy: [cluster-alias]: " + clusterInstance.getAlias();
+ clusterInstance.getNetworkPartitionId() + "is null " +
+ "in deployment policy: [cluster-alias]: " + clusterInstance.getAlias();
log.error(msg);
throw new PolicyValidationException(msg);
}
@@ -278,33 +264,35 @@ public class ClusterContext extends AbstractClusterContext {
minInstances, maxInstances, nPartitionId, clusterId, hasScalingDependents, groupScalingEnabledSubtree);
}
String partitionId;
- if (partitionRef != null) {
+ if (partition != null) {
//use it own defined partition
- partitionId = partitionRef.getId();
- maxInstances = partitionRef.getMax();
+ partitionId = partition.getId();
+ maxInstances = partition.getPartitionMax();
} else {
//handling the partition given by the parent
partitionId = clusterInstance.getPartitionId();
}
-
+
//Retrieving the actual partition from application
- Partition[] partitions = null;
- try {
- partitions = CloudControllerServiceClient.getInstance().getNetworkPartition(nPartitionId).getPartitions();
- } catch (Exception e) {
- String msg = String.format("Error while getting network partitioin from cloud controller : [network-partition-id] %s", nPartitionId);
- log.error(msg, e);
- throw new AutoScalerException(msg, e);
- }
-
- Partition partition = null;
+ Partition[] partitions;
+ try {
+
+ partitions = AutoscalerObjectConverter.convertCCPartitionsToPartitions(
+ CloudControllerServiceClient.getInstance().getNetworkPartition(nPartitionId).getPartitions());
+ } catch (Exception e) {
+ String msg = String.format("Error while getting network partitioin from cloud controller : [network-partition-id] %s", nPartitionId);
+ log.error(msg, e);
+ throw new AutoScalerException(msg, e);
+ }
+
+ Partition partition3 = null;
if (partitions != null && partitions.length != 0) {
- for (Partition partition2 : partitions) {
- if (partition2.getId().equals(partitionId)) {
- partition = partition2;
- }
- }
- }
+ for (Partition partition2 : partitions) {
+ if (partition2.getId().equals(partitionId)) {
+ partition3 = partition2;
+ }
+ }
+ }
//Creating cluster level partition context
ClusterLevelPartitionContext clusterLevelPartitionContext = new ClusterLevelPartitionContext(
@@ -315,7 +303,7 @@ public class ClusterContext extends AbstractClusterContext {
clusterLevelPartitionContext.setProperties(cluster.getProperties());
//add members to partition Context
- addMembersFromTopology(cluster, partition, clusterLevelPartitionContext,
+ addMembersFromTopology(cluster, partition3, clusterLevelPartitionContext,
clusterInstanceContext.getId());
//adding it to the monitors context
@@ -335,8 +323,9 @@ public class ClusterContext extends AbstractClusterContext {
return clusterLevelNetworkPartitionContext;
}
+
private void addMembersFromTopology(Cluster cluster,
- org.apache.stratos.cloud.controller.stub.domain.Partition partition,
+ Partition partition,
ClusterLevelPartitionContext clusterLevelPartitionContext,
String ClusterInstanceId) {
for (Member member : cluster.getMembers()) {
@@ -347,7 +336,7 @@ public class ClusterContext extends AbstractClusterContext {
memberContext.setClusterId(member.getClusterId());
memberContext.setMemberId(memberId);
memberContext.setInitTime(member.getInitTime());
- memberContext.setPartition(partition);
+ memberContext.setPartition(AutoscalerObjectConverter.convertPartitionToCCPartition(partition));
memberContext.setProperties(AutoscalerUtil.toStubProperties(member.getProperties()));
if (MemberStatus.Active.equals(member.getStatus())) {
http://git-wip-us.apache.org/repos/asf/stratos/blob/abb01bd5/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/partition/ClusterLevelPartitionContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/partition/ClusterLevelPartitionContext.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/partition/ClusterLevelPartitionContext.java
index d8bbf52..5032f0b 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/partition/ClusterLevelPartitionContext.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/partition/ClusterLevelPartitionContext.java
@@ -24,7 +24,7 @@ import org.apache.commons.logging.LogFactory;
import org.apache.stratos.autoscaler.context.member.MemberStatsContext;
import org.apache.stratos.autoscaler.util.ConfUtil;
import org.apache.stratos.cloud.controller.stub.domain.MemberContext;
-import org.apache.stratos.cloud.controller.stub.domain.Partition;
+import org.apache.stratos.common.partition.Partition;
import org.apache.stratos.common.client.CloudControllerServiceClient;
import org.apache.stratos.common.constants.StratosConstants;
http://git-wip-us.apache.org/repos/asf/stratos/blob/abb01bd5/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/partition/PartitionContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/partition/PartitionContext.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/partition/PartitionContext.java
index 426e8a0..63818ac 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/partition/PartitionContext.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/partition/PartitionContext.java
@@ -20,7 +20,7 @@ package org.apache.stratos.autoscaler.context.partition;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.cloud.controller.stub.domain.Partition;
+import org.apache.stratos.common.partition.Partition;
import java.io.Serializable;
import java.util.Properties;
[07/20] stratos git commit: Deployment policy move:Update monitors
and related classes
Posted by la...@apache.org.
Deployment policy move:Update monitors and related classes
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/c662b19c
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/c662b19c
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/c662b19c
Branch: refs/heads/master
Commit: c662b19cc96425712ef7d1e8d65d79b4b415bf1a
Parents: 1009773
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Tue Apr 7 08:03:25 2015 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Tue Apr 7 08:03:25 2015 +0530
----------------------------------------------------------------------
.../autoscaler/monitor/MonitorFactory.java | 114 ++++++++-----
.../monitor/cluster/ClusterMonitor.java | 7 +-
.../monitor/component/GroupMonitor.java | 169 ++++++++-----------
3 files changed, 147 insertions(+), 143 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/c662b19c/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/MonitorFactory.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/MonitorFactory.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/MonitorFactory.java
index e30957c..b4c83b7 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/MonitorFactory.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/MonitorFactory.java
@@ -33,12 +33,13 @@ import org.apache.stratos.autoscaler.monitor.cluster.ClusterMonitor;
import org.apache.stratos.autoscaler.monitor.component.ApplicationMonitor;
import org.apache.stratos.autoscaler.monitor.component.GroupMonitor;
import org.apache.stratos.autoscaler.monitor.component.ParentComponentMonitor;
+import org.apache.stratos.autoscaler.pojo.policy.PolicyManager;
+import org.apache.stratos.autoscaler.pojo.policy.deployment.DeploymentPolicy;
import org.apache.stratos.autoscaler.util.AutoscalerUtil;
-import org.apache.stratos.cloud.controller.stub.domain.DeploymentPolicy;
-import org.apache.stratos.cloud.controller.stub.domain.NetworkPartition;
-import org.apache.stratos.cloud.controller.stub.domain.NetworkPartitionRef;
-import org.apache.stratos.cloud.controller.stub.domain.Partition;
+import org.apache.stratos.common.Property;
import org.apache.stratos.common.client.CloudControllerServiceClient;
+import org.apache.stratos.common.partition.NetworkPartition;
+import org.apache.stratos.common.partition.Partition;
import org.apache.stratos.messaging.domain.application.Application;
import org.apache.stratos.messaging.domain.application.Group;
import org.apache.stratos.messaging.domain.application.ScalingDependentList;
@@ -137,7 +138,7 @@ public class MonitorFactory {
} else {
groupMonitor.setHasStartupDependents(false);
}
- groupMonitor.startScheduler();
+ groupMonitor.startScheduler();
}
} finally {
ApplicationHolder.releaseReadLock();
@@ -223,8 +224,8 @@ public class MonitorFactory {
* @throws org.apache.stratos.autoscaler.exception.partition.PartitionValidationException
*/
public static ClusterMonitor getClusterMonitor(ParentComponentMonitor parentMonitor,
- ClusterChildContext context,
- List<String> parentInstanceIds)
+ ClusterChildContext context,
+ List<String> parentInstanceIds)
throws PolicyValidationException,
PartitionValidationException,
TopologyInConsistentException {
@@ -249,46 +250,38 @@ public class MonitorFactory {
serviceName, clusterId);
throw new RuntimeException(msg);
}
-
-
+
+
// deployment policy validation
String deploymentPolicyId = AutoscalerUtil.getDeploymentPolicyIdByAlias(parentMonitor.appId, AutoscalerUtil.getAliasFromClusterId(clusterId));
DeploymentPolicy deploymentPolicy = null;
- try {
- deploymentPolicy = CloudControllerServiceClient.getInstance().getDeploymentPolicy(deploymentPolicyId);
- } catch (Exception e) {
- String msg = String.format("Error while getting deployment policy from cloud controller [deployment-policy-id] %s", deploymentPolicyId);
- log.error(msg, e);
- throw new RuntimeException(msg, e);
- }
-
+ try {
+ deploymentPolicy = PolicyManager.getInstance().getDeploymentPolicy(deploymentPolicyId);
+ } catch (Exception e) {
+ String msg = String.format("Error while getting deployment policy from cloud controller [deployment-policy-id] %s", deploymentPolicyId);
+ log.error(msg, e);
+ throw new RuntimeException(msg, e);
+ }
+
List<Partition> partitionList = new ArrayList<Partition>();
- for (NetworkPartitionRef networkPartitionRef : deploymentPolicy.getNetworkPartitionsRef()) {
-
- if (networkPartitionRef != null) {
- NetworkPartition networkPartition = null;
- try {
- networkPartition = CloudControllerServiceClient.getInstance().getNetworkPartition(networkPartitionRef.getId());
- } catch (Exception e) {
- String msg = String.format("Error while getting deployment policy from cloud controller [network-partition-id] %s", networkPartitionRef.getId());
- log.error(msg, e);
- throw new RuntimeException(msg, e);
- }
-
- if (networkPartition != null) {
- for (Partition partition : networkPartition.getPartitions()) {
- partitionList.add(partition);
- }
- }
-
- try {
- CloudControllerServiceClient.getInstance().validateDeploymentPolicy(serviceName, partitionList.toArray(new Partition[partitionList.size()]));
- } catch (Exception e) {
- String msg = String.format("Error while validating deployment policy from cloud controller [network-partition-id] %s", networkPartitionRef.getId());
- log.error(msg, e);
- throw new RuntimeException(msg, e);
- }
- }
+ for (NetworkPartition networkPartition : deploymentPolicy.getNetworkPartitions()) {
+
+ if (networkPartition != null) {
+
+ for (Partition partition : networkPartition.getPartitions()) {
+ partitionList.add(partition);
+ }
+
+ try {
+ org.apache.stratos.cloud.controller.stub.domain.Partition[] partitions
+ = convertPartitionsToCCPartitions(partitionList.toArray(new Partition[partitionList.size()]));
+ CloudControllerServiceClient.getInstance().validateDeploymentPolicy(serviceName, networkPartition.getId());
+ } catch (Exception e) {
+ String msg = String.format("Error while validating deployment policy from cloud controller [network-partition-id] %s", networkPartition.getId());
+ log.error(msg, e);
+ throw new RuntimeException(msg, e);
+ }
+ }
}
// deployment policy validation ends
@@ -339,6 +332,39 @@ public class MonitorFactory {
}
}
+ private static org.apache.stratos.cloud.controller.stub.domain.Partition[] convertPartitionsToCCPartitions(
+ Partition[] partitions) {
+
+ org.apache.stratos.cloud.controller.stub.domain.Partition[] ccPartitions
+ = new org.apache.stratos.cloud.controller.stub.domain.Partition[partitions.length];
+ for(int i = 0; i < partitions.length; i++){
+ org.apache.stratos.cloud.controller.stub.domain.Partition ccPartition
+ = new org.apache.stratos.cloud.controller.stub.domain.Partition();
+ ccPartition.setId(partitions[i].getId());
+ ccPartition.setDescription(partitions[i].getDescription());
+ ccPartition.setIsPublic(partitions[i].getIsPublic());
+ ccPartition.setKubernetesClusterId(partitions[i].getKubernetesClusterId());
+ ccPartition.setProperties(AutoscalerUtil.toStubProperties(partitions[i].getProperties()));
+ ccPartition.setProvider(partitions[i].getProvider());
+ ccPartitions[i] = ccPartition;
+ }
+ return ccPartitions;
+ }
+
+// private static org.apache.stratos.cloud.controller.stub.Properties convertPropertiesToCCProperties(
+// Properties properties) {
+//
+// org.apache.stratos.cloud.controller.stub.Properties ccProperties
+// = new org.apache.stratos.cloud.controller.stub.Properties();
+// Property[] propertyArray = properties.getProperties();
+// for(int i = 0; i < propertyArray.length; i++){
+//
+// ccProperties.getProperties()[i].setName(properties.getProperties()[i].getName());
+// ccProperties.getProperties()[i].setValue(properties.getProperties()[i].getValue());
+// }
+// return ccProperties;
+// }
+
private static boolean findIfChildIsInGroupScalingEnabledSubTree(GroupMonitor groupMonitor) {
boolean groupScalingEnabledSubtree = false;
ParentComponentMonitor parentComponentMonitor = groupMonitor.getParent();
@@ -350,4 +376,4 @@ public class MonitorFactory {
}
return groupScalingEnabledSubtree;
}
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/c662b19c/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java
index c29521d..8fd5ec8 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java
@@ -45,10 +45,7 @@ import org.apache.stratos.autoscaler.rule.AutoscalerRuleEvaluator;
import org.apache.stratos.autoscaler.status.processor.cluster.ClusterStatusActiveProcessor;
import org.apache.stratos.autoscaler.status.processor.cluster.ClusterStatusInactiveProcessor;
import org.apache.stratos.autoscaler.status.processor.cluster.ClusterStatusTerminatedProcessor;
-import org.apache.stratos.autoscaler.util.AutoscalerConstants;
-import org.apache.stratos.autoscaler.util.AutoscalerUtil;
-import org.apache.stratos.autoscaler.util.ConfUtil;
-import org.apache.stratos.autoscaler.util.ServiceReferenceHolder;
+import org.apache.stratos.autoscaler.util.*;
import org.apache.stratos.cloud.controller.stub.domain.MemberContext;
import org.apache.stratos.common.Properties;
import org.apache.stratos.common.Property;
@@ -437,7 +434,7 @@ public class ClusterMonitor extends Monitor implements Runnable {
}
private boolean isPrimaryMember(MemberContext memberContext) {
- Properties props = AutoscalerUtil.toCommonProperties(memberContext.getProperties());
+ Properties props = AutoscalerObjectConverter.convertCCPropertiesToProperties(memberContext.getProperties());
if (log.isDebugEnabled()) {
log.debug(" Properties [" + props + "] ");
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/c662b19c/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 bbc19df..f7b5798 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
@@ -45,14 +45,13 @@ import org.apache.stratos.autoscaler.monitor.events.ScalingDownBeyondMinEvent;
import org.apache.stratos.autoscaler.monitor.events.ScalingEvent;
import org.apache.stratos.autoscaler.monitor.events.ScalingUpBeyondMaxEvent;
import org.apache.stratos.autoscaler.monitor.events.builder.MonitorStatusEventBuilder;
+import org.apache.stratos.autoscaler.pojo.policy.PolicyManager;
+import org.apache.stratos.autoscaler.pojo.policy.deployment.DeploymentPolicy;
import org.apache.stratos.autoscaler.util.AutoscalerConstants;
import org.apache.stratos.autoscaler.util.AutoscalerUtil;
import org.apache.stratos.autoscaler.util.ServiceReferenceHolder;
-import org.apache.stratos.cloud.controller.stub.CloudControllerServiceDeploymentPolicyNotExistsExceptionException;
-import org.apache.stratos.cloud.controller.stub.domain.DeploymentPolicy;
-import org.apache.stratos.cloud.controller.stub.domain.NetworkPartitionRef;
-import org.apache.stratos.cloud.controller.stub.domain.PartitionRef;
-import org.apache.stratos.common.client.CloudControllerServiceClient;
+import org.apache.stratos.common.partition.NetworkPartition;
+import org.apache.stratos.common.partition.Partition;
import org.apache.stratos.common.threading.StratosThreadPool;
import org.apache.stratos.messaging.domain.application.Application;
import org.apache.stratos.messaging.domain.application.ApplicationStatus;
@@ -189,7 +188,7 @@ public class GroupMonitor extends ParentComponentMonitor {
nwPartitionContext).getMinInstanceCount();
float factor = (nwPartitionContext.getNonTerminatedInstancesCount() - 1)/minInstances;
ScalingEvent scalingEvent = new ScalingEvent(this.id, nwPartitionContext.getId(),
- instanceContext.getId(),factor);
+ instanceContext.getId(),factor);
this.parent.onChildScalingEvent(scalingEvent);
} else {
//Parent has to handle this scale down as by dependent scale down
@@ -437,7 +436,7 @@ public class GroupMonitor extends ParentComponentMonitor {
if (instance != null) {
if (log.isInfoEnabled()) {
log.info(String.format("Publishing Group terminating event for [application] %s [group] %s " +
- "[instance] %s", appId, id, instanceId));
+ "[instance] %s", appId, id, instanceId));
}
ApplicationBuilder.handleGroupTerminatingEvent(appId, id, instanceId);
} else {
@@ -479,7 +478,7 @@ public class GroupMonitor extends ParentComponentMonitor {
float factor = scalingEvent.getFactor();
int currentInstances = networkPartitionContext.getNonTerminatedInstancesCount();
float requiredInstances = factor * ((GroupLevelNetworkPartitionContext)
- networkPartitionContext).getMinInstanceCount();
+ networkPartitionContext).getMinInstanceCount();
int ceilingRequiredInstances = (int) Math.ceil(requiredInstances);
if(ceilingRequiredInstances > currentInstances) {
@@ -546,42 +545,31 @@ public class GroupMonitor extends ParentComponentMonitor {
Instance parentInstanceContext) {
GroupLevelNetworkPartitionContext groupLevelNetworkPartitionContext;
String deploymentPolicyId = AutoscalerUtil.getDeploymentPolicyIdByAlias(appId, groupAlias);
- DeploymentPolicy deploymentPolicy = null;
- try {
- deploymentPolicy = CloudControllerServiceClient.getInstance().getDeploymentPolicy(deploymentPolicyId);
- } catch (CloudControllerServiceDeploymentPolicyNotExistsExceptionException e) {
- //ignore it
- String msg = String.format("Deployment policy not exists [deployment-policy-id] %s ", deploymentPolicyId);
- log.warn(msg);
- } catch (Exception e) {
- String msg = String.format("Error occured while getting deployment policy [%s] from cloud controller service %s", deploymentPolicyId, e);
- log.error(msg, e);
- throw new org.apache.stratos.autoscaler.exception.AutoScalerException(msg, e);
- }
-
+ DeploymentPolicy deploymentPolicy = PolicyManager.getInstance().getDeploymentPolicy(deploymentPolicyId);
+
String networkPartitionId = parentInstanceContext.getNetworkPartitionId();
if (this.networkPartitionCtxts.containsKey(networkPartitionId)) {
groupLevelNetworkPartitionContext = (GroupLevelNetworkPartitionContext) this.networkPartitionCtxts.
get(networkPartitionId);
} else {
if (deploymentPolicy != null) {
- NetworkPartitionRef[] networkPartitionRefs = deploymentPolicy.getNetworkPartitionsRef();
- NetworkPartitionRef networkPartitionRef = null;
- for (int i = 0; i < networkPartitionRefs.length; i++) {
- if (networkPartitionRefs[i].getId().equals(networkPartitionId)) {
- networkPartitionRef = networkPartitionRefs[i];
- }
- }
-
- if (networkPartitionRef != null) {
- groupLevelNetworkPartitionContext = new GroupLevelNetworkPartitionContext(
- networkPartitionId,
- networkPartitionRef.getPartitionAlgo());
- } else {
- groupLevelNetworkPartitionContext = new GroupLevelNetworkPartitionContext(
- networkPartitionId);
- }
-
+ NetworkPartition[] networkPartitions = deploymentPolicy.getNetworkPartitions();
+ NetworkPartition networkPartition = null;
+ for (int i = 0; i < networkPartitions.length; i++) {
+ if (networkPartitions[i].getId().equals(networkPartitionId)) {
+ networkPartition = networkPartitions[i];
+ }
+ }
+
+ if (networkPartition != null) {
+ groupLevelNetworkPartitionContext = new GroupLevelNetworkPartitionContext(
+ networkPartitionId,
+ networkPartition.getPartitionAlgo());
+ } else {
+ groupLevelNetworkPartitionContext = new GroupLevelNetworkPartitionContext(
+ networkPartitionId);
+ }
+
} else {
groupLevelNetworkPartitionContext = new GroupLevelNetworkPartitionContext(
networkPartitionId);
@@ -611,62 +599,55 @@ public class GroupMonitor extends ParentComponentMonitor {
List<GroupLevelPartitionContext> childPartitionContexts = new ArrayList<GroupLevelPartitionContext>();
String deploymentPolicyId = AutoscalerUtil.getDeploymentPolicyIdByAlias(appId, groupAlias);
- DeploymentPolicy deploymentPolicy = null;
- try {
- deploymentPolicy = CloudControllerServiceClient.getInstance().getDeploymentPolicy(deploymentPolicyId);
- } catch (CloudControllerServiceDeploymentPolicyNotExistsExceptionException e) {
- //ignore it
- String msg = String.format("Deployment policy not exists [deployment-policy-id] %s ", deploymentPolicyId);
- log.warn(msg);
- } catch (Exception e) {
- String msg = String.format("Error occured while getting deployment policy [%s] from cloud controller service %s", deploymentPolicyId, e);
- log.error(msg, e);
- throw new org.apache.stratos.autoscaler.exception.AutoScalerException(msg, e);
- }
-
- if (deploymentPolicy == null) {
-
- String parentPartitionId = parentInstanceContext.getPartitionId();
- if (parentPartitionId != null && networkPartitionContext.getPartitionCtxt(parentPartitionId) == null) {
- GroupLevelPartitionContext partitionContext = new GroupLevelPartitionContext(parentPartitionId, networkPartitionId);
- networkPartitionContext.addPartitionContext((GroupLevelPartitionContext) partitionContext);
- if (log.isInfoEnabled()) {
- log.info("[Partition] " + parentPartitionId + "has been added for the " + "[Group] " + this.id);
- }
- }
-
- } else {
-
- NetworkPartitionRef[] networkPartitionRefs = deploymentPolicy.getNetworkPartitionsRef();
- NetworkPartitionRef networkPartitionRef = null;
- if (networkPartitionRefs != null && networkPartitionRefs.length != 0) {
- for (NetworkPartitionRef i : networkPartitionRefs) {
- if (i.getId().equals(networkPartitionId)) {
- networkPartitionRef = i;
- }
- }
- }
-
- if (networkPartitionRef != null) {
- if (networkPartitionContext.getPartitionCtxts().isEmpty()) {
- PartitionRef[] partitionRefs = networkPartitionRef.getPartitions();
- if (partitionRefs != null && partitionRefs.length != 0) {
- for (PartitionRef partitionRef : partitionRefs) {
- if (networkPartitionContext.getPartitionCtxt(partitionRef.getId()) == null) {
- GroupLevelPartitionContext groupLevelPartitionContext = new GroupLevelPartitionContext(partitionRef.getMax(),
- partitionRef.getId(), networkPartitionId);
- childPartitionContexts.add(groupLevelPartitionContext);
- networkPartitionContext.addPartitionContext(groupLevelPartitionContext);
- if (log.isInfoEnabled()) {
- log.info(String.format("[Partition] %s has been added for the [Group] %s",
- partitionRef.getId(), this.id));
- }
- }
- }
- }
- }
- }
- }
+ DeploymentPolicy deploymentPolicy = PolicyManager.getInstance().getDeploymentPolicy(deploymentPolicyId);
+
+ if (deploymentPolicy == null) {
+
+ String parentPartitionId = parentInstanceContext.getPartitionId();
+ if (parentPartitionId != null && networkPartitionContext.getPartitionCtxt(parentPartitionId) == null) {
+ GroupLevelPartitionContext partitionContext = new GroupLevelPartitionContext(parentPartitionId, networkPartitionId);
+ networkPartitionContext.addPartitionContext((GroupLevelPartitionContext) partitionContext);
+ if (log.isInfoEnabled()) {
+ log.info("[Partition] " + parentPartitionId + "has been added for the " + "[Group] " + this.id);
+ }
+ }
+
+ } else {
+
+ NetworkPartition[] networkPartitions = deploymentPolicy.getNetworkPartitions();
+ NetworkPartition networkPartition = null;
+ if (networkPartitions != null && networkPartitions.length != 0) {
+ for (NetworkPartition i : networkPartitions) {
+ if (i.getId().equals(networkPartitionId)) {
+ networkPartition = i;
+ }
+ }
+ }
+
+ if (networkPartition != null) {
+ if (networkPartitionContext.getPartitionCtxts().isEmpty()) {
+ Partition[] partitions = networkPartition.getPartitions();
+ if (partitions != null && partitions.length != 0) {
+ for (Partition partition : partitions) {
+
+ if (networkPartitionContext.getPartitionCtxt(partition.getId()) == null) {
+
+ GroupLevelPartitionContext groupLevelPartitionContext = new GroupLevelPartitionContext(
+ networkPartition.getPartition(partition.getId()).getPartitionMax()
+ , partition.getId(), networkPartitionId);
+
+ childPartitionContexts.add(groupLevelPartitionContext);
+ networkPartitionContext.addPartitionContext(groupLevelPartitionContext);
+ if (log.isInfoEnabled()) {
+ log.info(String.format("[Partition] %s has been added for the [Group] %s",
+ partition.getId(), this.id));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
}
/**
[17/20] stratos git commit: Deployment policy move: Update autoscaler
stub
Posted by la...@apache.org.
Deployment policy move: Update autoscaler stub
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/0981c4ed
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/0981c4ed
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/0981c4ed
Branch: refs/heads/master
Commit: 0981c4edfba636438ea8fea77c61fc13a15da74b
Parents: cad2fc9
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Tue Apr 7 08:22:59 2015 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Tue Apr 7 08:22:59 2015 +0530
----------------------------------------------------------------------
.../pom.xml | 3 +-
.../src/main/resources/AutoscalerService.wsdl | 588 ++++++++++++++-----
2 files changed, 455 insertions(+), 136 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/0981c4ed/service-stubs/org.apache.stratos.autoscaler.service.stub/pom.xml
----------------------------------------------------------------------
diff --git a/service-stubs/org.apache.stratos.autoscaler.service.stub/pom.xml b/service-stubs/org.apache.stratos.autoscaler.service.stub/pom.xml
index 637f243..714937c 100644
--- a/service-stubs/org.apache.stratos.autoscaler.service.stub/pom.xml
+++ b/service-stubs/org.apache.stratos.autoscaler.service.stub/pom.xml
@@ -50,7 +50,7 @@
<java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
<arg line="-uri src/main/resources/AutoscalerService.wsdl -u -uw -o target/generated-code
-p org.apache.stratos.autoscaler.stub
- -ns2p http://policy.exception.autoscaler.stratos.apache.org/xsd=org.apache.stratos.autoscaler.stub.exception,http://application.exception.autoscaler.stratos.apache.org/xsd=org.apache.stratos.autoscaler.stub.exception,http://autoscale.policy.pojo.autoscaler.stratos.apache.org/xsd=org.apache.stratos.autoscaler.stub.autoscale.policy,http://deployment.policy.pojo.autoscaler.stratos.apache.org/xsd=org.apache.stratos.autoscaler.stub.deployment.policy,http://exception.autoscaler.stratos.apache.org/xsd=org.apache.stratos.autoscaler.stub.exception,http://network.partition.deployment.policy.pojo.autoscaler.stratos.apache.org/xsd=org.apache.stratos.autoscaler.stub.deployment.partition,http://pojo.applications.autoscaler.stratos.apache.org/xsd=org.apache.stratos.autoscaler.stub.pojo,http://pojo.autoscaler.stratos.apache.org/xsd=org.apache.stratos.autoscaler.stub.pojo,http://kubernetes.exception.autoscaler.stratos.apache.org/xsd=org.apache.stratos.autoscaler.stub.exception,http://impl.se
rvices.autoscaler.stratos.apache.org=org.apache.stratos.autoscaler.stub.impl,http://common.stratos.apache.org/xsd=org.apache.stratos.autoscaler.stub,http://kubernetes.common.stratos.apache.org/xsd=org.apache.stratos.autoscaler.stub.kubernetes"/>
+ -ns2p http://policy.exception.autoscaler.stratos.apache.org/xsd=org.apache.stratos.autoscaler.stub.exception,http://application.exception.autoscaler.stratos.apache.org/xsd=org.apache.stratos.autoscaler.stub.exception,http://autoscale.policy.pojo.autoscaler.stratos.apache.org/xsd=org.apache.stratos.autoscaler.stub.autoscale.policy,http://deployment.policy.pojo.autoscaler.stratos.apache.org/xsd=org.apache.stratos.autoscaler.stub.deployment.policy,http://partition.common.stratos.apache.org/xsd=org.apache.stratos.autoscaler.stub.partition,http://exception.autoscaler.stratos.apache.org/xsd=org.apache.stratos.autoscaler.stub.exception,http://network.partition.deployment.policy.pojo.autoscaler.stratos.apache.org/xsd=org.apache.stratos.autoscaler.stub.deployment.partition,http://pojo.applications.autoscaler.stratos.apache.org/xsd=org.apache.stratos.autoscaler.stub.pojo,http://pojo.autoscaler.stratos.apache.org/xsd=org.apache.stratos.autoscaler.stub.pojo,http://kubernetes.exception.a
utoscaler.stratos.apache.org/xsd=org.apache.stratos.autoscaler.stub.exception,http://impl.services.autoscaler.stratos.apache.org=org.apache.stratos.autoscaler.stub.impl,http://common.stratos.apache.org/xsd=org.apache.stratos.autoscaler.stub,http://kubernetes.common.stratos.apache.org/xsd=org.apache.stratos.autoscaler.stub.kubernetes"/>
<classpath refid="maven.dependency.classpath"/>
<classpath refid="maven.compile.classpath"/>
<classpath refid="maven.runtime.classpath"/>
@@ -97,6 +97,7 @@
org.apache.stratos.autoscaler.stub.exception.*; version=${project.version},
org.apache.stratos.autoscaler.stub.api.*; version=${project.version},
org.apache.stratos.autoscaler.stub.*; version=${project.version},
+ org.apache.stratos.autoscaler.stub.partition.*; version=${project.version},
</Export-Package>
<Private-Package>
</Private-Package>
http://git-wip-us.apache.org/repos/asf/stratos/blob/0981c4ed/service-stubs/org.apache.stratos.autoscaler.service.stub/src/main/resources/AutoscalerService.wsdl
----------------------------------------------------------------------
diff --git a/service-stubs/org.apache.stratos.autoscaler.service.stub/src/main/resources/AutoscalerService.wsdl b/service-stubs/org.apache.stratos.autoscaler.service.stub/src/main/resources/AutoscalerService.wsdl
index a4299c3..5b6932e 100644
--- a/service-stubs/org.apache.stratos.autoscaler.service.stub/src/main/resources/AutoscalerService.wsdl
+++ b/service-stubs/org.apache.stratos.autoscaler.service.stub/src/main/resources/AutoscalerService.wsdl
@@ -1,10 +1,10 @@
-<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ax29="http://autoscale.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:ns="http://impl.services.autoscaler.stratos.apache.org" xmlns:ax27="http://pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax25="http://application.exception.autoscaler.stratos.apache.org/xsd" xmlns:ax21="http://pojo.applications.autoscaler.stratos.apache.org/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ax22="http://common.stratos.apache.org/xsd" xmlns:ax216="http://policy.exception.autoscaler.stratos.apache.org/xsd" xmlns:ax219="http://rmi.java/xsd" xmlns:ax214="http://exception.autoscaler.stratos.apache.org/xsd" xmlns:ax220="http://io.java/xsd" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ax211="http://deployment.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:mime="http://schemas.x
mlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://impl.services.autoscaler.stratos.apache.org">
+<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ax29="http://common.stratos.apache.org/xsd" xmlns:ns="http://impl.services.autoscaler.stratos.apache.org" xmlns:ax27="http://exception.autoscaler.stratos.apache.org/xsd" xmlns:ax25="http://application.exception.autoscaler.stratos.apache.org/xsd" xmlns:ax23="http://autoscale.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax217="http://deployment.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax21="http://policy.exception.autoscaler.stratos.apache.org/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ax218="http://partition.common.stratos.apache.org/xsd" xmlns:ax214="http://io.java/xsd" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ax213="http://rmi.java/xsd" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:ax223="http://pojo.applications.autoscaler.stratos.apache.org/xsd" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ax211="http://pojo.au
toscaler.stratos.apache.org/xsd" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://impl.services.autoscaler.stratos.apache.org">
<wsdl:types>
- <xs:schema xmlns:ax221="http://io.java/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://rmi.java/xsd">
+ <xs:schema xmlns:ax215="http://io.java/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://rmi.java/xsd">
<xs:import namespace="http://io.java/xsd"/>
<xs:complexType name="RemoteException">
<xs:complexContent>
- <xs:extension base="ax220:IOException">
+ <xs:extension base="ax214:IOException">
<xs:sequence>
<xs:element minOccurs="0" name="cause" nillable="true" type="xs:anyType"/>
<xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
@@ -21,7 +21,7 @@
<xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="instanceRoundingFactor" type="xs:float"/>
<xs:element minOccurs="0" name="isPublic" type="xs:boolean"/>
- <xs:element minOccurs="0" name="loadThresholds" nillable="true" type="ax29:LoadThresholds"/>
+ <xs:element minOccurs="0" name="loadThresholds" nillable="true" type="ax23:LoadThresholds"/>
<xs:element minOccurs="0" name="tenantId" type="xs:int"/>
</xs:sequence>
</xs:complexType>
@@ -33,17 +33,17 @@
</xs:sequence>
</xs:complexType>
</xs:schema>
- <xs:schema xmlns:ax23="http://common.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://pojo.applications.autoscaler.stratos.apache.org/xsd">
+ <xs:schema xmlns:ax224="http://common.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://pojo.applications.autoscaler.stratos.apache.org/xsd">
<xs:import namespace="http://common.stratos.apache.org/xsd"/>
<xs:complexType name="ApplicationContext">
<xs:sequence>
<xs:element minOccurs="0" name="alias" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="components" nillable="true" type="ax21:ComponentContext"/>
+ <xs:element minOccurs="0" name="components" nillable="true" type="ax223:ComponentContext"/>
<xs:element minOccurs="0" name="description" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="multiTenant" type="xs:boolean"/>
<xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="properties" nillable="true" type="ax23:Properties"/>
+ <xs:element minOccurs="0" name="properties" nillable="true" type="ax29:Properties"/>
<xs:element minOccurs="0" name="status" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="tenantAdminUsername" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="tenantDomain" nillable="true" type="xs:string"/>
@@ -52,10 +52,10 @@
</xs:complexType>
<xs:complexType name="ComponentContext">
<xs:sequence>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="applicationClusterContexts" nillable="true" type="ax21:ApplicationClusterContext"/>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="cartridgeContexts" nillable="true" type="ax21:CartridgeContext"/>
- <xs:element minOccurs="0" name="dependencyContext" nillable="true" type="ax21:DependencyContext"/>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="groupContexts" nillable="true" type="ax21:GroupContext"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="applicationClusterContexts" nillable="true" type="ax223:ApplicationClusterContext"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="cartridgeContexts" nillable="true" type="ax223:CartridgeContext"/>
+ <xs:element minOccurs="0" name="dependencyContext" nillable="true" type="ax223:DependencyContext"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="groupContexts" nillable="true" type="ax223:GroupContext"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ApplicationClusterContext">
@@ -66,8 +66,8 @@
<xs:element maxOccurs="unbounded" minOccurs="0" name="dependencyClusterIds" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="deploymentPolicyName" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="hostName" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="persistenceContext" nillable="true" type="ax21:PersistenceContext"/>
- <xs:element minOccurs="0" name="properties" nillable="true" type="ax23:Properties"/>
+ <xs:element minOccurs="0" name="persistenceContext" nillable="true" type="ax223:PersistenceContext"/>
+ <xs:element minOccurs="0" name="properties" nillable="true" type="ax29:Properties"/>
<xs:element minOccurs="0" name="tenantRange" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="textPayload" nillable="true" type="xs:string"/>
</xs:sequence>
@@ -75,7 +75,7 @@
<xs:complexType name="PersistenceContext">
<xs:sequence>
<xs:element minOccurs="0" name="persistenceRequired" type="xs:boolean"/>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="volumes" nillable="true" type="ax21:VolumeContext"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="volumes" nillable="true" type="ax223:VolumeContext"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="VolumeContext">
@@ -94,21 +94,21 @@
<xs:sequence>
<xs:element minOccurs="0" name="cartridgeMax" type="xs:int"/>
<xs:element minOccurs="0" name="cartridgeMin" type="xs:int"/>
- <xs:element minOccurs="0" name="subscribableInfoContext" nillable="true" type="ax21:SubscribableInfoContext"/>
+ <xs:element minOccurs="0" name="subscribableInfoContext" nillable="true" type="ax223:SubscribableInfoContext"/>
<xs:element minOccurs="0" name="type" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SubscribableInfoContext">
<xs:sequence>
<xs:element minOccurs="0" name="alias" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="artifactRepositoryContext" nillable="true" type="ax21:ArtifactRepositoryContext"/>
+ <xs:element minOccurs="0" name="artifactRepositoryContext" nillable="true" type="ax223:ArtifactRepositoryContext"/>
<xs:element minOccurs="0" name="autoscalingPolicy" nillable="true" type="xs:string"/>
<xs:element maxOccurs="unbounded" minOccurs="0" name="dependencyAliases" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="deploymentPolicy" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="maxMembers" type="xs:int"/>
<xs:element minOccurs="0" name="minMembers" type="xs:int"/>
- <xs:element minOccurs="0" name="persistenceContext" nillable="true" type="ax21:PersistenceContext"/>
- <xs:element minOccurs="0" name="properties" nillable="true" type="ax23:Properties"/>
+ <xs:element minOccurs="0" name="persistenceContext" nillable="true" type="ax223:PersistenceContext"/>
+ <xs:element minOccurs="0" name="properties" nillable="true" type="ax29:Properties"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ArtifactRepositoryContext">
@@ -130,9 +130,9 @@
<xs:complexType name="GroupContext">
<xs:sequence>
<xs:element minOccurs="0" name="alias" nillable="true" type="xs:string"/>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="cartridgeContexts" nillable="true" type="ax21:CartridgeContext"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="cartridgeContexts" nillable="true" type="ax223:CartridgeContext"/>
<xs:element minOccurs="0" name="deploymentPolicy" nillable="true" type="xs:string"/>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="groupContexts" nillable="true" type="ax21:GroupContext"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="groupContexts" nillable="true" type="ax223:GroupContext"/>
<xs:element minOccurs="0" name="groupMaxInstances" type="xs:int"/>
<xs:element minOccurs="0" name="groupMinInstances" type="xs:int"/>
<xs:element minOccurs="0" name="groupScalingEnabled" type="xs:boolean"/>
@@ -144,8 +144,8 @@
<xs:complexType name="ServiceGroup">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="cartridges" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="dependencies" nillable="true" type="ax27:Dependencies"/>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="groups" nillable="true" type="ax27:ServiceGroup"/>
+ <xs:element minOccurs="0" name="dependencies" nillable="true" type="ax211:Dependencies"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="groups" nillable="true" type="ax211:ServiceGroup"/>
<xs:element minOccurs="0" name="groupscalingEnabled" type="xs:boolean"/>
<xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
</xs:sequence>
@@ -158,39 +158,93 @@
</xs:sequence>
</xs:complexType>
</xs:schema>
- <xs:schema xmlns:ax28="http://pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax26="http://application.exception.autoscaler.stratos.apache.org/xsd" xmlns:ax24="http://pojo.applications.autoscaler.stratos.apache.org/xsd" xmlns:ax217="http://policy.exception.autoscaler.stratos.apache.org/xsd" xmlns:ax218="http://common.stratos.apache.org/xsd" xmlns:ax215="http://exception.autoscaler.stratos.apache.org/xsd" xmlns:ax222="http://rmi.java/xsd" xmlns:ax213="http://deployment.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax210="http://autoscale.policy.pojo.autoscaler.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://impl.services.autoscaler.stratos.apache.org">
- <xs:import namespace="http://pojo.applications.autoscaler.stratos.apache.org/xsd"/>
- <xs:import namespace="http://application.exception.autoscaler.stratos.apache.org/xsd"/>
- <xs:import namespace="http://pojo.autoscaler.stratos.apache.org/xsd"/>
+ <xs:schema xmlns:ax220="http://partition.common.stratos.apache.org/xsd" xmlns:ax222="http://common.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://deployment.policy.pojo.autoscaler.stratos.apache.org/xsd">
+ <xs:import namespace="http://partition.common.stratos.apache.org/xsd"/>
+ <xs:import namespace="http://common.stratos.apache.org/xsd"/>
+ <xs:complexType name="DeploymentPolicy">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="deploymentPolicyID" nillable="true" type="xs:string"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="networkPartitions" nillable="true" type="ax218:NetworkPartition"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="ApplicationPolicy">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="algorithm" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="networkPartitionGroups" nillable="true" type="xs:string"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="networkPartitions" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="properties" nillable="true" type="ax29:Properties"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:schema>
+ <xs:schema xmlns:ax28="http://exception.autoscaler.stratos.apache.org/xsd" xmlns:ax26="http://application.exception.autoscaler.stratos.apache.org/xsd" xmlns:ax24="http://autoscale.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax216="http://rmi.java/xsd" xmlns:ax22="http://policy.exception.autoscaler.stratos.apache.org/xsd" xmlns:ax212="http://pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax221="http://deployment.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax210="http://common.stratos.apache.org/xsd" xmlns:ax225="http://pojo.applications.autoscaler.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://impl.services.autoscaler.stratos.apache.org">
+ <xs:import namespace="http://policy.exception.autoscaler.stratos.apache.org/xsd"/>
<xs:import namespace="http://autoscale.policy.pojo.autoscaler.stratos.apache.org/xsd"/>
- <xs:import namespace="http://deployment.policy.pojo.autoscaler.stratos.apache.org/xsd"/>
+ <xs:import namespace="http://application.exception.autoscaler.stratos.apache.org/xsd"/>
<xs:import namespace="http://exception.autoscaler.stratos.apache.org/xsd"/>
- <xs:import namespace="http://policy.exception.autoscaler.stratos.apache.org/xsd"/>
<xs:import namespace="http://common.stratos.apache.org/xsd"/>
+ <xs:import namespace="http://pojo.autoscaler.stratos.apache.org/xsd"/>
<xs:import namespace="http://rmi.java/xsd"/>
- <xs:element name="getApplications">
+ <xs:import namespace="http://deployment.policy.pojo.autoscaler.stratos.apache.org/xsd"/>
+ <xs:import namespace="http://pojo.applications.autoscaler.stratos.apache.org/xsd"/>
+ <xs:element name="AutoscalerServiceInvalidPolicyException">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="InvalidPolicyException" nillable="true" type="ax21:InvalidPolicyException"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="addAutoScalingPolicy">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="autoscalePolicy" nillable="true" type="ax23:AutoscalePolicy"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="addAutoScalingPolicyResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" type="xs:boolean"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getAutoScalingPolicies">
<xs:complexType>
<xs:sequence/>
</xs:complexType>
</xs:element>
- <xs:element name="getApplicationsResponse">
+ <xs:element name="getAutoScalingPoliciesResponse">
<xs:complexType>
<xs:sequence>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax24:ApplicationContext"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax23:AutoscalePolicy"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getApplication">
+ <xs:element name="updateAutoScalingPolicy">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="autoscalePolicy" nillable="true" type="ax23:AutoscalePolicy"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getApplicationResponse">
+ <xs:element name="updateAutoScalingPolicyResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="return" nillable="true" type="ax24:ApplicationContext"/>
+ <xs:element minOccurs="0" name="return" type="xs:boolean"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="removeAutoScalingPolicy">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="autoscalePolicyId" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="removeAutoScalingPolicyResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
</xs:element>
@@ -201,315 +255,359 @@
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="addApplication">
+ <xs:element name="deployApplication">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="applicationContext" nillable="true" type="ax24:ApplicationContext"/>
+ <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="applicationPolicyId" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getServiceGroup">
+ <xs:element name="deployApplicationResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="return" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getServiceGroupResponse">
+ <xs:element name="undeployApplication">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="return" nillable="true" type="ax27:ServiceGroup"/>
+ <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="force" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getAutoscalingPolicy">
+ <xs:element name="AutoscalerServiceInvalidArgumentException">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="autoscalingPolicyId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="InvalidArgumentException" nillable="true" type="ax27:InvalidArgumentException"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getAutoscalingPolicyResponse">
+ <xs:element name="updateClusterMonitor">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="return" nillable="true" type="ax29:AutoscalePolicy"/>
+ <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="properties" nillable="true" type="ax29:Properties"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getApplicationPolicy">
+ <xs:element name="AutoscalerServiceInvalidServiceGroupException">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="applicationPolicyId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="InvalidServiceGroupException" nillable="true" type="ax25:InvalidServiceGroupException"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getApplicationPolicyResponse">
+ <xs:element name="addServiceGroup">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="return" nillable="true" type="ax213:ApplicationPolicy"/>
+ <xs:element minOccurs="0" name="servicegroup" nillable="true" type="ax212:ServiceGroup"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="serviceGroupExist">
+ <xs:element name="findClusterId">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="serviceName" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="alias" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="serviceGroupExistResponse">
+ <xs:element name="findClusterIdResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="return" type="xs:boolean"/>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="AutoscalerServiceAutoScalerException">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="AutoScalerException" nillable="true" type="ax214:AutoScalerException"/>
+ <xs:element minOccurs="0" name="AutoScalerException" nillable="true" type="ax27:AutoScalerException"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getServiceGroups">
+ <xs:element name="getApplicationNetworkPartitions">
<xs:complexType>
- <xs:sequence/>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
+ </xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getServiceGroupsResponse">
+ <xs:element name="getApplicationNetworkPartitionsResponse">
<xs:complexType>
<xs:sequence>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax27:ServiceGroup"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="removeServiceGroup">
+ <xs:element name="AutoscalerServiceRemoteException">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="groupName" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="RemoteException" nillable="true" type="ax216:RemoteException"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="AutoscalerServiceInvalidPolicyException">
+ <xs:element name="AutoscalerServiceInvalidDeploymentPolicyException">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="InvalidPolicyException" nillable="true" type="ax217:InvalidPolicyException"/>
+ <xs:element minOccurs="0" name="InvalidDeploymentPolicyException" nillable="true" type="ax21:InvalidDeploymentPolicyException"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="removeApplicationPolicy">
+ <xs:element name="AutoscalerServiceDeploymentPolicyNotExistsException">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="applicationPolicyId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="DeploymentPolicyNotExistsException" nillable="true" type="ax21:DeploymentPolicyNotExistsException"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getAutoScalingPolicies">
+ <xs:element name="AutoscalerServiceDeploymentPolicyAlreadyExistsException">
<xs:complexType>
- <xs:sequence/>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="DeploymentPolicyAlreadyExistsException" nillable="true" type="ax21:DeploymentPolicyAlreadyExistsException"/>
+ </xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getAutoScalingPoliciesResponse">
+ <xs:element name="addDeployementPolicy">
<xs:complexType>
<xs:sequence>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax29:AutoscalePolicy"/>
+ <xs:element minOccurs="0" name="deploymentPolicy" nillable="true" type="ax217:DeploymentPolicy"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="addAutoScalingPolicy">
+ <xs:element name="updateDeployementPolicy">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="autoscalePolicy" nillable="true" type="ax29:AutoscalePolicy"/>
+ <xs:element minOccurs="0" name="deploymentPolicy" nillable="true" type="ax217:DeploymentPolicy"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="addAutoScalingPolicyResponse">
+ <xs:element name="removeDeployementPolicy">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="return" type="xs:boolean"/>
+ <xs:element minOccurs="0" name="deploymentPolicyID" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="updateAutoScalingPolicy">
+ <xs:element name="undeployServiceGroup">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="autoscalePolicy" nillable="true" type="ax29:AutoscalePolicy"/>
+ <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="updateAutoScalingPolicyResponse">
+ <xs:element name="getDeploymentPolicies">
+ <xs:complexType>
+ <xs:sequence/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getDeploymentPoliciesResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="return" type="xs:boolean"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax217:DeploymentPolicy"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="removeAutoScalingPolicy">
+ <xs:element name="AutoscalerServiceInvalidApplicationPolicyException">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="autoscalePolicyId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="InvalidApplicationPolicyException" nillable="true" type="ax25:InvalidApplicationPolicyException"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="removeAutoScalingPolicyResponse">
+ <xs:element name="addApplicationPolicy">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="return" type="xs:boolean"/>
+ <xs:element minOccurs="0" name="applicationPolicy" nillable="true" type="ax217:ApplicationPolicy"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="deployApplication">
+ <xs:element name="removeApplicationPolicy">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="applicationPolicyId" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="deployApplicationResponse">
+ <xs:element name="AutoscalerServiceApplicatioinPolicyNotExistsException">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="return" type="xs:boolean"/>
+ <xs:element minOccurs="0" name="ApplicatioinPolicyNotExistsException" nillable="true" type="ax21:ApplicatioinPolicyNotExistsException"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="undeployApplication">
+ <xs:element name="updateApplicationPolicy">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="force" type="xs:boolean"/>
+ <xs:element minOccurs="0" name="applicationPolicy" nillable="true" type="ax217:ApplicationPolicy"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="deleteApplication">
+ <xs:element name="getApplicationPolicies">
+ <xs:complexType>
+ <xs:sequence/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getApplicationPoliciesResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax217:ApplicationPolicy"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="AutoscalerServiceInvalidArgumentException">
+ <xs:element name="serviceGroupExist">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="InvalidArgumentException" nillable="true" type="ax214:InvalidArgumentException"/>
+ <xs:element minOccurs="0" name="serviceName" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="updateClusterMonitor">
+ <xs:element name="serviceGroupExistResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="properties" nillable="true" type="ax22:Properties"/>
+ <xs:element minOccurs="0" name="return" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="AutoscalerServiceInvalidServiceGroupException">
+ <xs:element name="getServiceGroups">
+ <xs:complexType>
+ <xs:sequence/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getServiceGroupsResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="InvalidServiceGroupException" nillable="true" type="ax25:InvalidServiceGroupException"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax212:ServiceGroup"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="addServiceGroup">
+ <xs:element name="removeServiceGroup">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="servicegroup" nillable="true" type="ax27:ServiceGroup"/>
+ <xs:element minOccurs="0" name="groupName" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="findClusterId">
+ <xs:element name="getApplicationPolicy">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="alias" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="applicationPolicyId" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="findClusterIdResponse">
+ <xs:element name="getApplicationPolicyResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="return" nillable="true" type="ax217:ApplicationPolicy"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="undeployServiceGroup">
+ <xs:element name="getApplications">
+ <xs:complexType>
+ <xs:sequence/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getApplicationsResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax223:ApplicationContext"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getApplicationNetworkPartitions">
+ <xs:element name="addApplication">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="applicationContext" nillable="true" type="ax223:ApplicationContext"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getApplicationNetworkPartitionsResponse">
+ <xs:element name="getServiceGroup">
<xs:complexType>
<xs:sequence>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="AutoscalerServiceRemoteException">
+ <xs:element name="getServiceGroupResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="RemoteException" nillable="true" type="ax219:RemoteException"/>
+ <xs:element minOccurs="0" name="return" nillable="true" type="ax212:ServiceGroup"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="AutoscalerServiceInvalidApplicationPolicyException">
+ <xs:element name="getAutoscalingPolicy">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="InvalidApplicationPolicyException" nillable="true" type="ax25:InvalidApplicationPolicyException"/>
+ <xs:element minOccurs="0" name="autoscalingPolicyId" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="addApplicationPolicy">
+ <xs:element name="getAutoscalingPolicyResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="applicationPolicy" nillable="true" type="ax213:ApplicationPolicy"/>
+ <xs:element minOccurs="0" name="return" nillable="true" type="ax23:AutoscalePolicy"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="AutoscalerServiceApplicatioinPolicyNotExistsException">
+ <xs:element name="getDeploymentPolicy">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="ApplicatioinPolicyNotExistsException" nillable="true" type="ax217:ApplicatioinPolicyNotExistsException"/>
+ <xs:element minOccurs="0" name="deploymentPolicyID" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="updateApplicationPolicy">
+ <xs:element name="getDeploymentPolicyResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="applicationPolicy" nillable="true" type="ax213:ApplicationPolicy"/>
+ <xs:element minOccurs="0" name="return" nillable="true" type="ax217:DeploymentPolicy"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getApplicationPolicies">
+ <xs:element name="getApplication">
<xs:complexType>
- <xs:sequence/>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
+ </xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getApplicationPoliciesResponse">
+ <xs:element name="getApplicationResponse">
<xs:complexType>
<xs:sequence>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax213:ApplicationPolicy"/>
+ <xs:element minOccurs="0" name="return" nillable="true" type="ax223:ApplicationContext"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="deleteApplication">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
- <xs:schema xmlns:ax212="http://common.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://deployment.policy.pojo.autoscaler.stratos.apache.org/xsd">
+ <xs:schema xmlns:ax219="http://common.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://partition.common.stratos.apache.org/xsd">
<xs:import namespace="http://common.stratos.apache.org/xsd"/>
- <xs:complexType name="ApplicationPolicy">
+ <xs:complexType name="NetworkPartition">
<xs:sequence>
- <xs:element minOccurs="0" name="algorithm" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="activeByDefault" type="xs:boolean"/>
<xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="networkPartitionGroups" nillable="true" type="xs:string"/>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="networkPartitions" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="properties" nillable="true" type="ax22:Properties"/>
+ <xs:element minOccurs="0" name="partitionAlgo" nillable="true" type="xs:string"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="partitions" nillable="true" type="ax218:Partition"/>
+ <xs:element minOccurs="0" name="provider" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="Partition">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="description" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="isPublic" type="xs:boolean"/>
+ <xs:element minOccurs="0" name="kubernetesClusterId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="partitionMax" type="xs:int"/>
+ <xs:element minOccurs="0" name="properties" nillable="true" type="ax29:Properties"/>
+ <xs:element minOccurs="0" name="provider" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
@@ -533,7 +631,7 @@
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://common.stratos.apache.org/xsd">
<xs:complexType name="Properties">
<xs:sequence>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="properties" nillable="true" type="ax22:Property"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="properties" nillable="true" type="ax29:Property"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Property">
@@ -549,6 +647,15 @@
<xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
+ <xs:complexType name="InvalidDeploymentPolicyException">
+ <xs:sequence/>
+ </xs:complexType>
+ <xs:complexType name="DeploymentPolicyNotExistsException">
+ <xs:sequence/>
+ </xs:complexType>
+ <xs:complexType name="DeploymentPolicyAlreadyExistsException">
+ <xs:sequence/>
+ </xs:complexType>
<xs:complexType name="ApplicatioinPolicyNotExistsException">
<xs:sequence>
<xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
@@ -561,6 +668,11 @@
</xs:complexType>
</xs:schema>
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://exception.autoscaler.stratos.apache.org/xsd">
+ <xs:complexType name="InvalidArgumentException">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
<xs:complexType name="AutoScalerException">
<xs:complexContent>
<xs:extension base="xs:RuntimeException">
@@ -568,11 +680,6 @@
</xs:extension>
</xs:complexContent>
</xs:complexType>
- <xs:complexType name="InvalidArgumentException">
- <xs:sequence>
- <xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
- </xs:sequence>
- </xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="removeAutoScalingPolicyRequest">
@@ -605,6 +712,12 @@
<wsdl:message name="AutoscalerServiceInvalidApplicationPolicyException">
<wsdl:part name="parameters" element="ns:AutoscalerServiceInvalidApplicationPolicyException"/>
</wsdl:message>
+ <wsdl:message name="getDeploymentPoliciesRequest">
+ <wsdl:part name="parameters" element="ns:getDeploymentPolicies"/>
+ </wsdl:message>
+ <wsdl:message name="getDeploymentPoliciesResponse">
+ <wsdl:part name="parameters" element="ns:getDeploymentPoliciesResponse"/>
+ </wsdl:message>
<wsdl:message name="getServiceGroupsRequest">
<wsdl:part name="parameters" element="ns:getServiceGroups"/>
</wsdl:message>
@@ -647,12 +760,30 @@
<wsdl:message name="serviceGroupExistResponse">
<wsdl:part name="parameters" element="ns:serviceGroupExistResponse"/>
</wsdl:message>
+ <wsdl:message name="getDeploymentPolicyRequest">
+ <wsdl:part name="parameters" element="ns:getDeploymentPolicy"/>
+ </wsdl:message>
+ <wsdl:message name="getDeploymentPolicyResponse">
+ <wsdl:part name="parameters" element="ns:getDeploymentPolicyResponse"/>
+ </wsdl:message>
<wsdl:message name="addAutoScalingPolicyRequest">
<wsdl:part name="parameters" element="ns:addAutoScalingPolicy"/>
</wsdl:message>
<wsdl:message name="addAutoScalingPolicyResponse">
<wsdl:part name="parameters" element="ns:addAutoScalingPolicyResponse"/>
</wsdl:message>
+ <wsdl:message name="addDeployementPolicyRequest">
+ <wsdl:part name="parameters" element="ns:addDeployementPolicy"/>
+ </wsdl:message>
+ <wsdl:message name="AutoscalerServiceInvalidDeploymentPolicyException">
+ <wsdl:part name="parameters" element="ns:AutoscalerServiceInvalidDeploymentPolicyException"/>
+ </wsdl:message>
+ <wsdl:message name="AutoscalerServiceDeploymentPolicyNotExistsException">
+ <wsdl:part name="parameters" element="ns:AutoscalerServiceDeploymentPolicyNotExistsException"/>
+ </wsdl:message>
+ <wsdl:message name="AutoscalerServiceDeploymentPolicyAlreadyExistsException">
+ <wsdl:part name="parameters" element="ns:AutoscalerServiceDeploymentPolicyAlreadyExistsException"/>
+ </wsdl:message>
<wsdl:message name="addServiceGroupRequest">
<wsdl:part name="parameters" element="ns:addServiceGroup"/>
</wsdl:message>
@@ -671,12 +802,18 @@
<wsdl:message name="undeployServiceGroupRequest">
<wsdl:part name="parameters" element="ns:undeployServiceGroup"/>
</wsdl:message>
+ <wsdl:message name="updateDeployementPolicyRequest">
+ <wsdl:part name="parameters" element="ns:updateDeployementPolicy"/>
+ </wsdl:message>
<wsdl:message name="getAutoscalingPolicyRequest">
<wsdl:part name="parameters" element="ns:getAutoscalingPolicy"/>
</wsdl:message>
<wsdl:message name="getAutoscalingPolicyResponse">
<wsdl:part name="parameters" element="ns:getAutoscalingPolicyResponse"/>
</wsdl:message>
+ <wsdl:message name="removeDeployementPolicyRequest">
+ <wsdl:part name="parameters" element="ns:removeDeployementPolicy"/>
+ </wsdl:message>
<wsdl:message name="updateAutoScalingPolicyRequest">
<wsdl:part name="parameters" element="ns:updateAutoScalingPolicy"/>
</wsdl:message>
@@ -739,6 +876,10 @@
<wsdl:fault message="ns:AutoscalerServiceInvalidApplicationPolicyException" name="AutoscalerServiceInvalidApplicationPolicyException" wsaw:Action="urn:addApplicationPolicyAutoscalerServiceInvalidApplicationPolicyException"/>
<wsdl:fault message="ns:AutoscalerServiceInvalidPolicyException" name="AutoscalerServiceInvalidPolicyException" wsaw:Action="urn:addApplicationPolicyAutoscalerServiceInvalidPolicyException"/>
</wsdl:operation>
+ <wsdl:operation name="getDeploymentPolicies">
+ <wsdl:input message="ns:getDeploymentPoliciesRequest" wsaw:Action="urn:getDeploymentPolicies"/>
+ <wsdl:output message="ns:getDeploymentPoliciesResponse" wsaw:Action="urn:getDeploymentPoliciesResponse"/>
+ </wsdl:operation>
<wsdl:operation name="getServiceGroups">
<wsdl:input message="ns:getServiceGroupsRequest" wsaw:Action="urn:getServiceGroups"/>
<wsdl:output message="ns:getServiceGroupsResponse" wsaw:Action="urn:getServiceGroupsResponse"/>
@@ -768,11 +909,22 @@
<wsdl:input message="ns:serviceGroupExistRequest" wsaw:Action="urn:serviceGroupExist"/>
<wsdl:output message="ns:serviceGroupExistResponse" wsaw:Action="urn:serviceGroupExistResponse"/>
</wsdl:operation>
+ <wsdl:operation name="getDeploymentPolicy">
+ <wsdl:input message="ns:getDeploymentPolicyRequest" wsaw:Action="urn:getDeploymentPolicy"/>
+ <wsdl:output message="ns:getDeploymentPolicyResponse" wsaw:Action="urn:getDeploymentPolicyResponse"/>
+ </wsdl:operation>
<wsdl:operation name="addAutoScalingPolicy">
<wsdl:input message="ns:addAutoScalingPolicyRequest" wsaw:Action="urn:addAutoScalingPolicy"/>
<wsdl:output message="ns:addAutoScalingPolicyResponse" wsaw:Action="urn:addAutoScalingPolicyResponse"/>
<wsdl:fault message="ns:AutoscalerServiceInvalidPolicyException" name="AutoscalerServiceInvalidPolicyException" wsaw:Action="urn:addAutoScalingPolicyAutoscalerServiceInvalidPolicyException"/>
</wsdl:operation>
+ <wsdl:operation name="addDeployementPolicy">
+ <wsdl:input message="ns:addDeployementPolicyRequest" wsaw:Action="urn:addDeployementPolicy"/>
+ <wsdl:fault message="ns:AutoscalerServiceRemoteException" name="AutoscalerServiceRemoteException" wsaw:Action="urn:addDeployementPolicyAutoscalerServiceRemoteException"/>
+ <wsdl:fault message="ns:AutoscalerServiceInvalidDeploymentPolicyException" name="AutoscalerServiceInvalidDeploymentPolicyException" wsaw:Action="urn:addDeployementPolicyAutoscalerServiceInvalidDeploymentPolicyException"/>
+ <wsdl:fault message="ns:AutoscalerServiceDeploymentPolicyNotExistsException" name="AutoscalerServiceDeploymentPolicyNotExistsException" wsaw:Action="urn:addDeployementPolicyAutoscalerServiceDeploymentPolicyNotExistsException"/>
+ <wsdl:fault message="ns:AutoscalerServiceDeploymentPolicyAlreadyExistsException" name="AutoscalerServiceDeploymentPolicyAlreadyExistsException" wsaw:Action="urn:addDeployementPolicyAutoscalerServiceDeploymentPolicyAlreadyExistsException"/>
+ </wsdl:operation>
<wsdl:operation name="addServiceGroup">
<wsdl:input message="ns:addServiceGroupRequest" wsaw:Action="urn:addServiceGroup"/>
<wsdl:fault message="ns:AutoscalerServiceInvalidServiceGroupException" name="AutoscalerServiceInvalidServiceGroupException" wsaw:Action="urn:addServiceGroupAutoscalerServiceInvalidServiceGroupException"/>
@@ -788,10 +940,20 @@
<wsdl:input message="ns:undeployServiceGroupRequest" wsaw:Action="urn:undeployServiceGroup"/>
<wsdl:fault message="ns:AutoscalerServiceAutoScalerException" name="AutoscalerServiceAutoScalerException" wsaw:Action="urn:undeployServiceGroupAutoscalerServiceAutoScalerException"/>
</wsdl:operation>
+ <wsdl:operation name="updateDeployementPolicy">
+ <wsdl:input message="ns:updateDeployementPolicyRequest" wsaw:Action="urn:updateDeployementPolicy"/>
+ <wsdl:fault message="ns:AutoscalerServiceRemoteException" name="AutoscalerServiceRemoteException" wsaw:Action="urn:updateDeployementPolicyAutoscalerServiceRemoteException"/>
+ <wsdl:fault message="ns:AutoscalerServiceInvalidDeploymentPolicyException" name="AutoscalerServiceInvalidDeploymentPolicyException" wsaw:Action="urn:updateDeployementPolicyAutoscalerServiceInvalidDeploymentPolicyException"/>
+ <wsdl:fault message="ns:AutoscalerServiceDeploymentPolicyNotExistsException" name="AutoscalerServiceDeploymentPolicyNotExistsException" wsaw:Action="urn:updateDeployementPolicyAutoscalerServiceDeploymentPolicyNotExistsException"/>
+ </wsdl:operation>
<wsdl:operation name="getAutoscalingPolicy">
<wsdl:input message="ns:getAutoscalingPolicyRequest" wsaw:Action="urn:getAutoscalingPolicy"/>
<wsdl:output message="ns:getAutoscalingPolicyResponse" wsaw:Action="urn:getAutoscalingPolicyResponse"/>
</wsdl:operation>
+ <wsdl:operation name="removeDeployementPolicy">
+ <wsdl:input message="ns:removeDeployementPolicyRequest" wsaw:Action="urn:removeDeployementPolicy"/>
+ <wsdl:fault message="ns:AutoscalerServiceDeploymentPolicyNotExistsException" name="AutoscalerServiceDeploymentPolicyNotExistsException" wsaw:Action="urn:removeDeployementPolicyAutoscalerServiceDeploymentPolicyNotExistsException"/>
+ </wsdl:operation>
<wsdl:operation name="updateAutoScalingPolicy">
<wsdl:input message="ns:updateAutoScalingPolicyRequest" wsaw:Action="urn:updateAutoScalingPolicy"/>
<wsdl:output message="ns:updateAutoScalingPolicyResponse" wsaw:Action="urn:updateAutoScalingPolicyResponse"/>
@@ -851,6 +1013,15 @@
<soap:fault use="literal" name="AutoscalerServiceInvalidPolicyException"/>
</wsdl:fault>
</wsdl:operation>
+ <wsdl:operation name="getDeploymentPolicies">
+ <soap:operation soapAction="urn:getDeploymentPolicies" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
<wsdl:operation name="addApplicationPolicy">
<soap:operation soapAction="urn:addApplicationPolicy" style="document"/>
<wsdl:input>
@@ -944,6 +1115,15 @@
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
+ <wsdl:operation name="getDeploymentPolicy">
+ <soap:operation soapAction="urn:getDeploymentPolicy" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
<wsdl:operation name="addAutoScalingPolicy">
<soap:operation soapAction="urn:addAutoScalingPolicy" style="document"/>
<wsdl:input>
@@ -956,6 +1136,24 @@
<soap:fault use="literal" name="AutoscalerServiceInvalidPolicyException"/>
</wsdl:fault>
</wsdl:operation>
+ <wsdl:operation name="addDeployementPolicy">
+ <soap:operation soapAction="urn:addDeployementPolicy" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:fault name="AutoscalerServiceRemoteException">
+ <soap:fault use="literal" name="AutoscalerServiceRemoteException"/>
+ </wsdl:fault>
+ <wsdl:fault name="AutoscalerServiceDeploymentPolicyNotExistsException">
+ <soap:fault use="literal" name="AutoscalerServiceDeploymentPolicyNotExistsException"/>
+ </wsdl:fault>
+ <wsdl:fault name="AutoscalerServiceDeploymentPolicyAlreadyExistsException">
+ <soap:fault use="literal" name="AutoscalerServiceDeploymentPolicyAlreadyExistsException"/>
+ </wsdl:fault>
+ <wsdl:fault name="AutoscalerServiceInvalidDeploymentPolicyException">
+ <soap:fault use="literal" name="AutoscalerServiceInvalidDeploymentPolicyException"/>
+ </wsdl:fault>
+ </wsdl:operation>
<wsdl:operation name="addServiceGroup">
<soap:operation soapAction="urn:addServiceGroup" style="document"/>
<wsdl:input>
@@ -989,6 +1187,21 @@
<soap:fault use="literal" name="AutoscalerServiceAutoScalerException"/>
</wsdl:fault>
</wsdl:operation>
+ <wsdl:operation name="updateDeployementPolicy">
+ <soap:operation soapAction="urn:updateDeployementPolicy" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:fault name="AutoscalerServiceRemoteException">
+ <soap:fault use="literal" name="AutoscalerServiceRemoteException"/>
+ </wsdl:fault>
+ <wsdl:fault name="AutoscalerServiceDeploymentPolicyNotExistsException">
+ <soap:fault use="literal" name="AutoscalerServiceDeploymentPolicyNotExistsException"/>
+ </wsdl:fault>
+ <wsdl:fault name="AutoscalerServiceInvalidDeploymentPolicyException">
+ <soap:fault use="literal" name="AutoscalerServiceInvalidDeploymentPolicyException"/>
+ </wsdl:fault>
+ </wsdl:operation>
<wsdl:operation name="getAutoscalingPolicy">
<soap:operation soapAction="urn:getAutoscalingPolicy" style="document"/>
<wsdl:input>
@@ -998,6 +1211,15 @@
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
+ <wsdl:operation name="removeDeployementPolicy">
+ <soap:operation soapAction="urn:removeDeployementPolicy" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:fault name="AutoscalerServiceDeploymentPolicyNotExistsException">
+ <soap:fault use="literal" name="AutoscalerServiceDeploymentPolicyNotExistsException"/>
+ </wsdl:fault>
+ </wsdl:operation>
<wsdl:operation name="updateAutoScalingPolicy">
<soap:operation soapAction="urn:updateAutoScalingPolicy" style="document"/>
<wsdl:input>
@@ -1100,6 +1322,15 @@
<soap12:fault use="literal" name="AutoscalerServiceInvalidPolicyException"/>
</wsdl:fault>
</wsdl:operation>
+ <wsdl:operation name="getDeploymentPolicies">
+ <soap12:operation soapAction="urn:getDeploymentPolicies" style="document"/>
+ <wsdl:input>
+ <soap12:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
<wsdl:operation name="addApplicationPolicy">
<soap12:operation soapAction="urn:addApplicationPolicy" style="document"/>
<wsdl:input>
@@ -1193,6 +1424,15 @@
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
+ <wsdl:operation name="getDeploymentPolicy">
+ <soap12:operation soapAction="urn:getDeploymentPolicy" style="document"/>
+ <wsdl:input>
+ <soap12:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
<wsdl:operation name="addAutoScalingPolicy">
<soap12:operation soapAction="urn:addAutoScalingPolicy" style="document"/>
<wsdl:input>
@@ -1205,6 +1445,24 @@
<soap12:fault use="literal" name="AutoscalerServiceInvalidPolicyException"/>
</wsdl:fault>
</wsdl:operation>
+ <wsdl:operation name="addDeployementPolicy">
+ <soap12:operation soapAction="urn:addDeployementPolicy" style="document"/>
+ <wsdl:input>
+ <soap12:body use="literal"/>
+ </wsdl:input>
+ <wsdl:fault name="AutoscalerServiceRemoteException">
+ <soap12:fault use="literal" name="AutoscalerServiceRemoteException"/>
+ </wsdl:fault>
+ <wsdl:fault name="AutoscalerServiceDeploymentPolicyNotExistsException">
+ <soap12:fault use="literal" name="AutoscalerServiceDeploymentPolicyNotExistsException"/>
+ </wsdl:fault>
+ <wsdl:fault name="AutoscalerServiceDeploymentPolicyAlreadyExistsException">
+ <soap12:fault use="literal" name="AutoscalerServiceDeploymentPolicyAlreadyExistsException"/>
+ </wsdl:fault>
+ <wsdl:fault name="AutoscalerServiceInvalidDeploymentPolicyException">
+ <soap12:fault use="literal" name="AutoscalerServiceInvalidDeploymentPolicyException"/>
+ </wsdl:fault>
+ </wsdl:operation>
<wsdl:operation name="addServiceGroup">
<soap12:operation soapAction="urn:addServiceGroup" style="document"/>
<wsdl:input>
@@ -1238,6 +1496,21 @@
<soap12:fault use="literal" name="AutoscalerServiceAutoScalerException"/>
</wsdl:fault>
</wsdl:operation>
+ <wsdl:operation name="updateDeployementPolicy">
+ <soap12:operation soapAction="urn:updateDeployementPolicy" style="document"/>
+ <wsdl:input>
+ <soap12:body use="literal"/>
+ </wsdl:input>
+ <wsdl:fault name="AutoscalerServiceRemoteException">
+ <soap12:fault use="literal" name="AutoscalerServiceRemoteException"/>
+ </wsdl:fault>
+ <wsdl:fault name="AutoscalerServiceDeploymentPolicyNotExistsException">
+ <soap12:fault use="literal" name="AutoscalerServiceDeploymentPolicyNotExistsException"/>
+ </wsdl:fault>
+ <wsdl:fault name="AutoscalerServiceInvalidDeploymentPolicyException">
+ <soap12:fault use="literal" name="AutoscalerServiceInvalidDeploymentPolicyException"/>
+ </wsdl:fault>
+ </wsdl:operation>
<wsdl:operation name="getAutoscalingPolicy">
<soap12:operation soapAction="urn:getAutoscalingPolicy" style="document"/>
<wsdl:input>
@@ -1247,6 +1520,15 @@
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
+ <wsdl:operation name="removeDeployementPolicy">
+ <soap12:operation soapAction="urn:removeDeployementPolicy" style="document"/>
+ <wsdl:input>
+ <soap12:body use="literal"/>
+ </wsdl:input>
+ <wsdl:fault name="AutoscalerServiceDeploymentPolicyNotExistsException">
+ <soap12:fault use="literal" name="AutoscalerServiceDeploymentPolicyNotExistsException"/>
+ </wsdl:fault>
+ </wsdl:operation>
<wsdl:operation name="updateAutoScalingPolicy">
<soap12:operation soapAction="urn:updateAutoScalingPolicy" style="document"/>
<wsdl:input>
@@ -1346,6 +1628,15 @@
<mime:content type="text/xml" part="parameters"/>
</wsdl:output>
</wsdl:operation>
+ <wsdl:operation name="getDeploymentPolicies">
+ <http:operation location="getDeploymentPolicies"/>
+ <wsdl:input>
+ <mime:content type="text/xml" part="parameters"/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="parameters"/>
+ </wsdl:output>
+ </wsdl:operation>
<wsdl:operation name="addApplicationPolicy">
<http:operation location="addApplicationPolicy"/>
<wsdl:input>
@@ -1412,6 +1703,15 @@
<mime:content type="text/xml" part="parameters"/>
</wsdl:output>
</wsdl:operation>
+ <wsdl:operation name="getDeploymentPolicy">
+ <http:operation location="getDeploymentPolicy"/>
+ <wsdl:input>
+ <mime:content type="text/xml" part="parameters"/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="parameters"/>
+ </wsdl:output>
+ </wsdl:operation>
<wsdl:operation name="addAutoScalingPolicy">
<http:operation location="addAutoScalingPolicy"/>
<wsdl:input>
@@ -1421,6 +1721,12 @@
<mime:content type="text/xml" part="parameters"/>
</wsdl:output>
</wsdl:operation>
+ <wsdl:operation name="addDeployementPolicy">
+ <http:operation location="addDeployementPolicy"/>
+ <wsdl:input>
+ <mime:content type="text/xml" part="parameters"/>
+ </wsdl:input>
+ </wsdl:operation>
<wsdl:operation name="addServiceGroup">
<http:operation location="addServiceGroup"/>
<wsdl:input>
@@ -1448,6 +1754,12 @@
<mime:content type="text/xml" part="parameters"/>
</wsdl:input>
</wsdl:operation>
+ <wsdl:operation name="updateDeployementPolicy">
+ <http:operation location="updateDeployementPolicy"/>
+ <wsdl:input>
+ <mime:content type="text/xml" part="parameters"/>
+ </wsdl:input>
+ </wsdl:operation>
<wsdl:operation name="getAutoscalingPolicy">
<http:operation location="getAutoscalingPolicy"/>
<wsdl:input>
@@ -1457,6 +1769,12 @@
<mime:content type="text/xml" part="parameters"/>
</wsdl:output>
</wsdl:operation>
+ <wsdl:operation name="removeDeployementPolicy">
+ <http:operation location="removeDeployementPolicy"/>
+ <wsdl:input>
+ <mime:content type="text/xml" part="parameters"/>
+ </wsdl:input>
+ </wsdl:operation>
<wsdl:operation name="updateAutoScalingPolicy">
<http:operation location="updateAutoScalingPolicy"/>
<wsdl:input>
[06/20] stratos git commit: Fix DeploymentPolicy class and persist in
policy manager
Posted by la...@apache.org.
Fix DeploymentPolicy class and persist in policy manager
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/1009773a
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/1009773a
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/1009773a
Branch: refs/heads/master
Commit: 1009773a89dbda1d60007c00e7c2eadc5b2d86b0
Parents: c9940dd
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Tue Apr 7 08:01:33 2015 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Tue Apr 7 08:01:33 2015 +0530
----------------------------------------------------------------------
.../autoscaler/pojo/policy/PolicyManager.java | 305 +++++++++++++------
.../policy/deployment/DeploymentPolicy.java | 40 +--
2 files changed, 232 insertions(+), 113 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/1009773a/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
index 8406549..b81a09f 100644
--- 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
@@ -1,18 +1,18 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one
+ * 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
+ * "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.
*/
@@ -23,13 +23,16 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.autoscaler.exception.AutoScalerException;
+import org.apache.stratos.autoscaler.exception.policy.DeploymentPolicyAlreadyExistsException;
import org.apache.stratos.autoscaler.exception.policy.InvalidPolicyException;
import org.apache.stratos.autoscaler.pojo.policy.autoscale.AutoscalePolicy;
import org.apache.stratos.autoscaler.pojo.policy.deployment.ApplicationPolicy;
import org.apache.stratos.autoscaler.registry.RegistryManager;
import org.apache.stratos.autoscaler.util.ServiceReferenceHolder;
import org.apache.stratos.common.services.DistributedObjectProvider;
+import org.apache.stratos.autoscaler.pojo.policy.deployment.DeploymentPolicy;
+import java.util.Collection;
import java.util.Map;
/**
@@ -38,31 +41,39 @@ import java.util.Map;
public class PolicyManager {
private static final Log log = LogFactory.getLog(PolicyManager.class);
-
+
private static final String AS_POLICY_ID_TO_AUTOSCALE_POLICY_MAP = "AS_POLICY_ID_TO_AUTOSCALE_POLICY_MAP";
private static final String APPLICATION_ID_TO_APPLICATION_POLICY_MAP = "APPLICATION_ID_TO_APPLICATION_POLICY_MAP";
-
+ private static final String DEPLOYMENT_POLICY_ID_TO_DEPLOYMENT_POLICY_MAP = "DEPLOYMENT_POLICY_ID_TO_DEPLOYMENT_POLICY_MAP";
+
private static Map<String, AutoscalePolicy> autoscalePolicyListMap;
+ private static Map<String, DeploymentPolicy> deploymentPolicyListMap;
+
private static Map<String, ApplicationPolicy> applicationPolicyListMap;
-
- /* 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
+
+ public Collection<DeploymentPolicy> getDeploymentPolicies() {
+ return deploymentPolicyListMap.values();
+ }
+
+ /* 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();
+ private static final PolicyManager INSTANCE = new PolicyManager();
}
public static PolicyManager getInstance() {
return InstanceHolder.INSTANCE;
- }
-
+ }
+
private PolicyManager() {
- // Initialize distributed object provider
+ // Initialize distributed object provider
DistributedObjectProvider distributedObjectProvider = ServiceReferenceHolder.getInstance().getDistributedObjectProvider();
autoscalePolicyListMap = distributedObjectProvider.getMap(AS_POLICY_ID_TO_AUTOSCALE_POLICY_MAP);
+ deploymentPolicyListMap = distributedObjectProvider.getMap(DEPLOYMENT_POLICY_ID_TO_DEPLOYMENT_POLICY_MAP);
applicationPolicyListMap = distributedObjectProvider.getMap(APPLICATION_ID_TO_APPLICATION_POLICY_MAP);
}
@@ -94,17 +105,48 @@ public class PolicyManager {
return true;
}
- public boolean removeAutoscalePolicy(String policyID) throws InvalidPolicyException {
- if (StringUtils.isEmpty(policyID)) {
- throw new AutoScalerException("Autoscaling policy id cannot be empty");
- }
- this.removeASPolicyInInformationModel(policyID);
- RegistryManager.getInstance().removeAutoscalerPolicy(policyID);
- if (log.isInfoEnabled()) {
- log.info(String.format("Autoscaling policy is removed successfully: [id] %s", policyID));
- }
- return true;
- }
+ public boolean removeAutoscalePolicy(String policyID) throws InvalidPolicyException {
+ if (StringUtils.isEmpty(policyID)) {
+ throw new AutoScalerException("Autoscaling policy id cannot be empty");
+ }
+ this.removeASPolicyInInformationModel(policyID);
+ RegistryManager.getInstance().removeAutoscalerPolicy(policyID);
+ if (log.isInfoEnabled()) {
+ log.info(String.format("Autoscaling policy is removed successfully: [id] %s", policyID));
+ }
+ return true;
+ }
+
+
+ /**
+ * Add deployment policy to in memory map and persist.
+ * @param policy
+ * @throws InvalidPolicyException
+ */
+ public void addDeploymentPolicy(DeploymentPolicy policy) {
+ addDeploymentPolicyToPolicyListMap(policy);
+ RegistryManager.getInstance().persistDeploymentPolicy(policy);
+
+ if (log.isInfoEnabled()) {
+ log.info(String.format("Deployment policy is added successfully: [deployment-policy-id] %s",
+ policy.getDeploymentPolicyID()));
+ }
+ }
+
+ /**
+ * Remove deployment policy from in memory map and registry.
+ * @param deploymentPolicyID
+ * @throws InvalidPolicyException
+ */
+ public void removeDeploymentPolicy(String deploymentPolicyID) {
+ removeDeploymentPolicyFromMap(deploymentPolicyID);
+ RegistryManager.getInstance().removeDeploymentPolicy(deploymentPolicyID);
+
+ if (log.isInfoEnabled()) {
+ log.info(String.format("Deployment policy is removed successfully: [deployment-policy-id] %s",
+ deploymentPolicyID));
+ }
+ }
public void addASPolicyToInformationModel(AutoscalePolicy asPolicy) throws InvalidPolicyException {
if (!autoscalePolicyListMap.containsKey(asPolicy.getId())) {
@@ -113,8 +155,8 @@ public class PolicyManager {
}
autoscalePolicyListMap.put(asPolicy.getId(), asPolicy);
} else {
- String errMsg = "Specified autoscaling policy [" + asPolicy.getId() + "] already exists";
- log.error(errMsg);
+ String errMsg = "Specified autoscaling policy [" + asPolicy.getId() + "] already exists";
+ log.error(errMsg);
throw new InvalidPolicyException(errMsg);
}
}
@@ -128,30 +170,30 @@ public class PolicyManager {
}
}
- public void removeASPolicyInInformationModel(String policyID) throws InvalidPolicyException {
- if (autoscalePolicyListMap.containsKey(policyID)) {
- if (log.isDebugEnabled()) {
- log.debug("Updating autoscaling policy: " + policyID);
- }
- autoscalePolicyListMap.remove(policyID);
- }
- else{
- throw new InvalidPolicyException("No such policy ID [" + policyID + "] exists");
- }
- }
-
- public void removeApplicationPolicyInInformationModel(String applicationId) throws InvalidPolicyException {
- if (applicationPolicyListMap.containsKey(applicationId)) {
- if (log.isDebugEnabled()) {
- log.debug("Removing application policy [application-id] " + applicationId);
- }
- applicationPolicyListMap.remove(applicationId);
- }
- else{
- throw new InvalidPolicyException("No such application id [" + applicationId + "] exists");
- }
- }
-
+ public void removeASPolicyInInformationModel(String policyID) throws InvalidPolicyException {
+ if (autoscalePolicyListMap.containsKey(policyID)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Updating autoscaling policy: " + policyID);
+ }
+ autoscalePolicyListMap.remove(policyID);
+ }
+ else{
+ throw new InvalidPolicyException("No such policy ID [" + policyID + "] exists");
+ }
+ }
+
+ public void removeApplicationPolicyInInformationModel(String applicationId) throws InvalidPolicyException {
+ if (applicationPolicyListMap.containsKey(applicationId)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Removing application policy [application-id] " + applicationId);
+ }
+ applicationPolicyListMap.remove(applicationId);
+ }
+ else{
+ throw new InvalidPolicyException("No such application id [" + applicationId + "] exists");
+ }
+ }
+
/**
* Removes the specified policy
*
@@ -175,7 +217,7 @@ public class PolicyManager {
*
* @return
*/
- public AutoscalePolicy[] getAutoscalePolicyList() {
+ public AutoscalePolicy[] getAutoscalePolicyList() {
return autoscalePolicyListMap.values().toArray(new AutoscalePolicy[0]);
}
@@ -189,55 +231,128 @@ public class PolicyManager {
return autoscalePolicyListMap.get(id);
}
- public void addApplicationPolicy(ApplicationPolicy applicationPolicy) throws InvalidPolicyException {
- String applicationPolicyId = applicationPolicy.getId();
- if (log.isInfoEnabled()) {
- log.info(String.format("Adding application policy : [application-policy-id] %s", applicationPolicyId));
- }
- this.addApplicationPolicyToInformationModel(applicationPolicy);
- RegistryManager.getInstance().persistApplicationPolicy(applicationPolicy);
-
- if (log.isInfoEnabled()) {
- log.info(String
- .format("Application policy is added successfully: [application-policy-id] %s",
- applicationPolicyId));
- }
-
- }
-
- public boolean removeApplicationPolicy(String applicationPolicyId) throws InvalidPolicyException {
- if (StringUtils.isEmpty(applicationPolicyId)) {
- throw new AutoScalerException("Application policy id cannot be empty");
- }
- this.removeApplicationPolicyInInformationModel(applicationPolicyId);
- RegistryManager.getInstance().removeApplicationPolicy(applicationPolicyId);
- if (log.isInfoEnabled()) {
- log.info(String.format("Application policy is removed successfully: [id] %s", applicationPolicyId));
- }
- return true;
- }
-
- public void addApplicationPolicyToInformationModel(ApplicationPolicy applicationPolicy) throws InvalidPolicyException {
- String applicationPolicyId = applicationPolicy.getId();
+
+
+ private void addDeploymentPolicyToPolicyListMap(DeploymentPolicy policy) {
+ if (StringUtils.isEmpty(policy.getDeploymentPolicyID())) {
+ throw new RuntimeException("Application id is not found in the deployment policy");
+ }
+ if (!deploymentPolicyListMap.containsKey(policy.getDeploymentPolicyID())) {
+ if (log.isDebugEnabled()) {
+ log.debug("Adding deployment policy: [deployment-policy-id] " + policy.getDeploymentPolicyID());
+ }
+ deploymentPolicyListMap.put(policy.getDeploymentPolicyID(), policy);
+ } else {
+ String errMsg = "Deployment policy already exists: [deployment-policy-id] " + policy.getDeploymentPolicyID();
+ log.error(errMsg);
+ }
+ }
+
+ private void removeDeploymentPolicyFromMap(String applicationId) {
+ if(deploymentPolicyListMap.containsKey(applicationId)) {
+ deploymentPolicyListMap.remove(applicationId);
+ }
+ }
+
+ public void updateDeploymentPolicyToInformationModel(DeploymentPolicy policy) throws InvalidPolicyException {
+ if (log.isDebugEnabled()) {
+ log.debug("Updating deployment policy: " + policy.getDeploymentPolicyID());
+ }
+ deploymentPolicyListMap.put(policy.getDeploymentPolicyID(), 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(policy);
+ // 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);
+ }
+
+
+ public void addApplicationPolicy(ApplicationPolicy applicationPolicy) throws InvalidPolicyException {
+ String applicationPolicyId = applicationPolicy.getId();
+ if (log.isInfoEnabled()) {
+ log.info(String.format("Adding application policy : [application-policy-id] %s", applicationPolicyId));
+ }
+ this.addApplicationPolicyToInformationModel(applicationPolicy);
+ RegistryManager.getInstance().persistApplicationPolicy(applicationPolicy);
+
+ if (log.isInfoEnabled()) {
+ log.info(String
+ .format("Application policy is added successfully: [application-policy-id] %s",
+ applicationPolicyId));
+ }
+
+ }
+
+ public boolean removeApplicationPolicy(String applicationPolicyId) throws InvalidPolicyException {
+ if (StringUtils.isEmpty(applicationPolicyId)) {
+ throw new AutoScalerException("Application policy id cannot be empty");
+ }
+ this.removeApplicationPolicyInInformationModel(applicationPolicyId);
+ RegistryManager.getInstance().removeApplicationPolicy(applicationPolicyId);
+ if (log.isInfoEnabled()) {
+ log.info(String.format("Application policy is removed successfully: [id] %s", applicationPolicyId));
+ }
+ return true;
+ }
+
+ public void addApplicationPolicyToInformationModel(ApplicationPolicy applicationPolicy) throws InvalidPolicyException {
+ String applicationPolicyId = applicationPolicy.getId();
if (!applicationPolicyListMap.containsKey(applicationPolicyId)) {
if (log.isDebugEnabled()) {
log.debug("Adding application policy : " + applicationPolicyId);
}
applicationPolicyListMap.put(applicationPolicyId, applicationPolicy);
} else {
- String errMsg = "Application policy already exists : " + applicationPolicyId;
- log.error(errMsg);
+ String errMsg = "Application policy already exists : " + applicationPolicyId;
+ log.error(errMsg);
throw new InvalidPolicyException(errMsg);
}
-
+
}
-
- /**
- * Retruns an ApplicationPolicy of a given application
- *
- * @param applicationPolicyId
- * @return
- */
+
+ /**
+ * Retruns an ApplicationPolicy of a given application
+ *
+ * @param applicationPolicyId
+ * @return
+ */
public ApplicationPolicy getApplicationPolicy(String applicationPolicyId) {
return applicationPolicyListMap.get(applicationPolicyId);
}
@@ -250,7 +365,7 @@ public class PolicyManager {
applicationPolicyListMap.put(applicationPolicy.getId(), applicationPolicy);
}
}
-
+
public boolean updateApplicationPolicy(ApplicationPolicy applicationPolicy) {
if(StringUtils.isEmpty(applicationPolicy.getId())){
throw new AutoScalerException("Application policy id cannot be empty");
@@ -262,8 +377,8 @@ public class PolicyManager {
}
return true;
}
-
- public ApplicationPolicy[] getApplicationPolicies() {
+
+ public ApplicationPolicy[] getApplicationPolicies() {
return applicationPolicyListMap.values().toArray(new ApplicationPolicy[0]);
}
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/1009773a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/deployment/DeploymentPolicy.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/deployment/DeploymentPolicy.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/deployment/DeploymentPolicy.java
index dddc189..2ff0ee6 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/deployment/DeploymentPolicy.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/deployment/DeploymentPolicy.java
@@ -19,6 +19,10 @@
package org.apache.stratos.autoscaler.pojo.policy.deployment;
+
+import org.apache.stratos.common.partition.NetworkPartition;
+import org.apache.stratos.common.partition.Partition;
+
import java.io.Serializable;
import java.util.Arrays;
@@ -29,7 +33,7 @@ public class DeploymentPolicy implements Serializable{
private static final long serialVersionUID = 5675507196284400099L;
private String deploymentPolicyID;
- private NetworkPartitionRef[] applicationLevelNetworkPartitions;
+ private NetworkPartition[] networkPartitions;
public String getDeploymentPolicyID() {
return deploymentPolicyID;
@@ -39,24 +43,24 @@ public class DeploymentPolicy implements Serializable{
this.deploymentPolicyID = deploymentPolicyID;
}
- public NetworkPartitionRef[] getNetworkPartitionsRef() {
- return applicationLevelNetworkPartitions;
+ public NetworkPartition[] getNetworkPartitions() {
+ return networkPartitions;
}
- public void setNetworkPartitionsRef(NetworkPartitionRef[] applicationLevelNetworkPartitions) {
- this.applicationLevelNetworkPartitions = applicationLevelNetworkPartitions;
+ public void setNetworkPartitions(NetworkPartition[] networkPartitions) {
+ this.networkPartitions = networkPartitions;
}
/**
* Get network partition reference object by network partition id.
* @param networkPartitionId
- * @return the {@link NetworkPartitionRef}
+ * @return the {@link NetworkPartition}
*/
- public NetworkPartitionRef getNetworkPartitionRefByNetworkPartitionId(String networkPartitionId) {
- if (applicationLevelNetworkPartitions != null) {
- for (NetworkPartitionRef networkPartitionRef : applicationLevelNetworkPartitions) {
- if (networkPartitionRef.getId().equals(networkPartitionId)) {
- return networkPartitionRef;
+ public NetworkPartition getNetworkPartitionByNetworkPartitionId(String networkPartitionId) {
+ if (networkPartitions != null) {
+ for (NetworkPartition networkPartition : networkPartitions) {
+ if (networkPartition.getId().equals(networkPartitionId)) {
+ return networkPartition;
}
}
}
@@ -66,13 +70,13 @@ public class DeploymentPolicy implements Serializable{
/**
* Get partition references by network partition id.
* @param networkPartitionId
- * @return an array of {@link PartitionRef}
+ * @return an array of {@link Partition}
*/
- public PartitionRef[] getPartitionRefsByNetworkPartitionId(String networkPartitionId) {
- if (applicationLevelNetworkPartitions != null) {
- for (NetworkPartitionRef networkPartitionRef : applicationLevelNetworkPartitions) {
- if (networkPartitionRef.getId().equals(networkPartitionId)) {
- return networkPartitionRef.getPartitions();
+ public Partition[] getPartitionsByNetworkPartitionId(String networkPartitionId) {
+ if (networkPartitions != null) {
+ for (NetworkPartition networkPartition : networkPartitions) {
+ if (networkPartition.getId().equals(networkPartitionId)) {
+ return networkPartition.getPartitions();
}
}
}
@@ -81,7 +85,7 @@ public class DeploymentPolicy implements Serializable{
public String toString() {
return String.format("{ deployment-policy-id : %s, network-partitions : %s", deploymentPolicyID,
- Arrays.toString(applicationLevelNetworkPartitions));
+ Arrays.toString(networkPartitions));
}
}
[11/20] stratos git commit: Deployment policy move:Update util classes
Posted by la...@apache.org.
Deployment policy move:Update util classes
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/520b9401
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/520b9401
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/520b9401
Branch: refs/heads/master
Commit: 520b9401cde4af70b74b012c91173478fd67dda7
Parents: 171e622
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Tue Apr 7 08:07:57 2015 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Tue Apr 7 08:07:57 2015 +0530
----------------------------------------------------------------------
.../autoscaler/util/AutoscalerConstants.java | 95 +--
.../util/AutoscalerObjectConverter.java | 203 ++++--
.../stratos/autoscaler/util/AutoscalerUtil.java | 666 +++++++++----------
3 files changed, 544 insertions(+), 420 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/520b9401/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerConstants.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerConstants.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerConstants.java
index 1423cc4..6fdecf9 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerConstants.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerConstants.java
@@ -24,60 +24,61 @@ import java.io.File;
public final class AutoscalerConstants {
- /**
- * Constant values for Autoscaler
- */
- public static final String ID_ELEMENT = "id";
- public static final String PARTITION_ELEMENT = "partition";
- public static final String PARTITIONS_ELEMENT = "partitions";
- public static final String PROPERTY_ELEMENT = "property";
- public static final String PROPERTY_NAME_ATTR= "name";
- public static final String PROPERTY_VALUE_ATTR = "value";
- public static final String AUTOSCALER_THREAD_POOL_ID = "autoscaler.thread.pool";
- public static final String THREAD_POOL_SIZE_KEY = "autoscaler.thread.pool.size";
- public static final String AUTOSCALER_SCHEDULER_ID = "autoscaler.scheduler.thread.pool";
- public static final String SCHEDULER_THREAD_POOL_SIZE_KEY = "autoscaler.scheduler.thread.pool.size";
- public static final int AUTOSCALER_SCHEDULER_THREAD_POOL_SIZE = 5;
- public static final int AUTOSCALER_THREAD_POOL_SIZE = 50;
- public static final String COMPONENTS_CONFIG = CarbonUtils.getCarbonConfigDirPath() +
- File.separator + "stratos-config.xml";
-
- /**
+ /**
+ * Constant values for Autoscaler
+ */
+ public static final String ID_ELEMENT = "id";
+ public static final String PARTITION_ELEMENT = "partition";
+ public static final String PARTITIONS_ELEMENT = "partitions";
+ public static final String PROPERTY_ELEMENT = "property";
+ public static final String PROPERTY_NAME_ATTR= "name";
+ public static final String PROPERTY_VALUE_ATTR = "value";
+ public static final String AUTOSCALER_THREAD_POOL_ID = "autoscaler.thread.pool";
+ public static final String THREAD_POOL_SIZE_KEY = "autoscaler.thread.pool.size";
+ public static final String AUTOSCALER_SCHEDULER_ID = "autoscaler.scheduler.thread.pool";
+ public static final String SCHEDULER_THREAD_POOL_SIZE_KEY = "autoscaler.scheduler.thread.pool.size";
+ public static final int AUTOSCALER_SCHEDULER_THREAD_POOL_SIZE = 5;
+ public static final int AUTOSCALER_THREAD_POOL_SIZE = 50;
+ public static final String COMPONENTS_CONFIG = CarbonUtils.getCarbonConfigDirPath() +
+ File.separator + "stratos-config.xml";
+
+ /**
* Persistence
*/
public static final String AUTOSCALER_RESOURCE = "/autoscaler";
public static final String AS_POLICY_RESOURCE = "/policies/autoscalingPolicies";
- public static final String APPLICATIONS_RESOURCE = "/applications";
- public static final String APPLICATION_CONTEXTS_RESOURCE = "/applicationContexts";
- public static final String APPLICATION_POLICY_RESOURCE = "/policies/applicationPolicies";
- public static final String NETWORK_PARTITION_ALGO_CTX_RESOURCE = "/algorithms/networkPartitionAlgorithmContext";
+ public static final String APPLICATIONS_RESOURCE = "/applications";
+ public static final String APPLICATION_CONTEXTS_RESOURCE = "/applicationContexts";
+ public static final String APPLICATION_POLICY_RESOURCE = "/policies/applicationPolicies";
+ public static final String NETWORK_PARTITION_ALGO_CTX_RESOURCE = "/algorithms/networkPartitionAlgorithmContext";
+ public static final String DEPLOYMENT_POLICY_RESOURCE = "/policies/deploymentPolicies";
+
+ /**
+ * Cluster monitoring interval
+ */
+ public static final String Cluster_MONITOR_INTERVAL = "autoscaler.cluster.monitorInterval";
- /**
- * Cluster monitoring interval
- */
- public static final String Cluster_MONITOR_INTERVAL = "autoscaler.cluster.monitorInterval";
+ public static final String SERVICE_GROUP = "/groups";
- public static final String SERVICE_GROUP = "/groups";
+ /**
+ * PortRange min max
+ */
+ public static final int PORT_RANGE_MAX = 65535;
+ public static final int PORT_RANGE_MIN = 1;
- /**
- * PortRange min max
- */
- public static final int PORT_RANGE_MAX = 65535;
- public static final int PORT_RANGE_MIN = 1;
-
- /**
- * Payload values
- */
- public static final String PAYLOAD_DEPLOYMENT = "default";
+ /**
+ * Payload values
+ */
+ public static final String PAYLOAD_DEPLOYMENT = "default";
- public static final String APPLICATION_MONITOR_THREAD_POOL_ID = "application.monitor.thread.pool";
- public static final String APPLICATION_MONITOR_THREAD_POOL_SIZE = "application.monitor.thread.pool.size";
- public static final String GROUP_MONITOR_THREAD_POOL_ID = "group.monitor.thread.pool";
- public static final String GROUP_MONITOR_THREAD_POOL_SIZE = "group.monitor.thread.pool.size";
- public static final String CLUSTER_MONITOR_SCHEDULER_ID = "cluster.monitor.scheduler";
- public static final String CLUSTER_MONITOR_THREAD_POOL_ID = "cluster.monitor.thread.pool";
- public static final String CLUSTER_MONITOR_THREAD_POOL_SIZE = "cluster.monitor.thread.pool.size";
- public static final String MEMBER_FAULT_EVENT_NAME = "member_fault";
+ public static final String APPLICATION_MONITOR_THREAD_POOL_ID = "application.monitor.thread.pool";
+ public static final String APPLICATION_MONITOR_THREAD_POOL_SIZE = "application.monitor.thread.pool.size";
+ public static final String GROUP_MONITOR_THREAD_POOL_ID = "group.monitor.thread.pool";
+ public static final String GROUP_MONITOR_THREAD_POOL_SIZE = "group.monitor.thread.pool.size";
+ public static final String CLUSTER_MONITOR_SCHEDULER_ID = "cluster.monitor.scheduler";
+ public static final String CLUSTER_MONITOR_THREAD_POOL_ID = "cluster.monitor.thread.pool";
+ public static final String CLUSTER_MONITOR_THREAD_POOL_SIZE = "cluster.monitor.thread.pool.size";
+ public static final String MEMBER_FAULT_EVENT_NAME = "member_fault";
//scheduler
public static final int SCHEDULE_DEFAULT_INITIAL_DELAY = 30;
public static final int SCHEDULE_DEFAULT_PERIOD = 15;
@@ -121,4 +122,4 @@ public final class AutoscalerConstants {
public static final String IDENTITY_APPLICATION_SERVICE_SFX = "services/IdentityApplicationManagementService";
public static final String TOKEN_ENDPOINT_SFX = "oauth2/token";
public static final String TERMINATE_DEPENDENTS = "terminate-dependents";
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/520b9401/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerObjectConverter.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerObjectConverter.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerObjectConverter.java
index b1fe55e..b6828da 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerObjectConverter.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerObjectConverter.java
@@ -19,9 +19,9 @@
package org.apache.stratos.autoscaler.util;
-import org.apache.stratos.cloud.controller.stub.Property;
-import org.apache.stratos.cloud.controller.stub.domain.Partition;
import org.apache.stratos.common.Properties;
+import org.apache.stratos.common.Property;
+import org.apache.stratos.common.partition.Partition;
import java.util.ArrayList;
import java.util.List;
@@ -31,44 +31,167 @@ import java.util.List;
*/
public class AutoscalerObjectConverter {
-// /**
-// * Convert autoscaler partitions to cloud controller stub partitions
-// * @param partitions
-// * @return
-// */
-// public static org.apache.stratos.cloud.controller.stub.domain.Partition[]
-// convertASPartitionsToCCStubPartitions(org.apache.stratos.autoscaler.pojo.policy.deployment.partition.network.Partition[] partitions) {
+ /**
+ * Convert autoscaler partitions to cloud controller stub partitions
+ * @param partitions
+ * @return
+ */
+ public static org.apache.stratos.cloud.controller.stub.domain.Partition[]
+ convertPartitionsToCCPartitions(Partition[] partitions) {
+
+ List<org.apache.stratos.cloud.controller.stub.domain.Partition> cloudControllerPartitions
+ = new ArrayList<org.apache.stratos.cloud.controller.stub.domain.Partition>();
+ for(Partition partition : partitions) {
+ org.apache.stratos.cloud.controller.stub.domain.Partition cloudControllerPartition = convertPartitionToCCPartition(partition);
+ cloudControllerPartitions.add(cloudControllerPartition);
+ }
+ return cloudControllerPartitions.toArray(
+ new org.apache.stratos.cloud.controller.stub.domain.Partition[cloudControllerPartitions.size()]);
+ }
+
+ /**
+ * Convert autoscaler partition to cloud controller partition
+ * @param partition
+ * @return
+ */
+ public static org.apache.stratos.cloud.controller.stub.domain.Partition
+ convertPartitionToCCPartition(Partition partition) {
+
+ org.apache.stratos.cloud.controller.stub.domain.Partition cloudControllerPartition = new
+ org.apache.stratos.cloud.controller.stub.domain.Partition();
+
+ cloudControllerPartition.setId(partition.getId());
+ cloudControllerPartition.setProvider(partition.getProvider());
+ cloudControllerPartition.setDescription(partition.getDescription());
+ cloudControllerPartition.setKubernetesClusterId(partition.getKubernetesClusterId());
+ cloudControllerPartition.setIsPublic(partition.getIsPublic());
+ cloudControllerPartition.setProperties(AutoscalerUtil.toStubProperties(partition.getProperties()));
+
+ return cloudControllerPartition;
+ }
+
+
+ public static org.apache.stratos.cloud.controller.stub.Properties convertPropertiesToCCProperties(Properties properties) {
+
+ org.apache.stratos.cloud.controller.stub.Properties ccProperties
+ = new org.apache.stratos.cloud.controller.stub.Properties();
+
+ Property[] propertyArray = properties.getProperties();
+
+ for(Property property : properties.getProperties()){
+
+ org.apache.stratos.cloud.controller.stub.Property ccProperty
+ = new org.apache.stratos.cloud.controller.stub.Property();
+ ccProperty.setName(property.getName());
+ ccProperty.setName(property.getName());
+ ccProperties.addProperties(ccProperty);
+ }
+ return ccProperties;
+ }
+
+ public static Properties convertCCPropertiesToProperties(
+ org.apache.stratos.cloud.controller.stub.Properties ccProperties) {
+
+ Properties properties = new Properties();
+
+ if(ccProperties.getProperties() != null){
+ for(org.apache.stratos.cloud.controller.stub.Property ccProperty : ccProperties.getProperties()){
+
+ Property property = new Property();
+ property.setName(ccProperty.getName());
+ property.setValue(ccProperty.getValue());
+ properties.addProperty(property);
+ }
+ }
+ return properties;
+ }
+
+ public static Partition[] convertCCPartitionsToPartitions(org.apache.stratos.cloud.controller.stub.domain.Partition[] ccPartitions) {
+
+ List<Partition> partitions = new ArrayList<Partition>();
+ for(org.apache.stratos.cloud.controller.stub.domain.Partition ccPartition : ccPartitions) {
+ Partition partition = convertCCPartitionToPartition(ccPartition);
+ partitions.add(partition);
+ }
+ return partitions.toArray(new Partition[ccPartitions.length]);
+
+ }
+
+ public static Partition convertCCPartitionToPartition(org.apache.stratos.cloud.controller.stub.domain.Partition ccPartition) {
+
+ Partition partition = new Partition();
+
+ partition.setId(ccPartition.getId());
+ partition.setProvider(ccPartition.getProvider());
+ partition.setDescription(ccPartition.getDescription());
+ partition.setIsPublic(ccPartition.getIsPublic());
+ partition.setProperties(convertCCPropertiesToProperties(ccPartition.getProperties()));
+
+ return partition;
+ }
+
+//
+// public static org.apache.stratos.cloud.controller.stub.Properties toStubProperties(
+// org.apache.stratos.common.Properties properties) {
+// org.apache.stratos.cloud.controller.stub.Properties stubProps = new org.apache.stratos.cloud.controller.stub.Properties();
+//
+// if (properties != null && properties.getProperties() != null) {
+// for (org.apache.stratos.common.Property property : properties.getProperties()) {
+// if ((property != null) && (property.getValue() != null)) {
+// org.apache.stratos.cloud.controller.stub.Property newProperty = new org.apache.stratos.cloud.controller.stub.Property();
+// newProperty.setName(property.getName());
+// newProperty.setValue(property.getValue());
+// stubProps.addProperties(newProperty);
+// }
+// }
//
-// List<Partition> cloudControllerPartitions = new ArrayList<Partition>();
-// for(org.apache.stratos.autoscaler.pojo.policy.deployment.partition.network.Partition partition : partitions) {
-// Partition cloudControllerPartition = convertASPartitionToCCPartition(partition);
-// cloudControllerPartitions.add(cloudControllerPartition);
// }
-// return cloudControllerPartitions.toArray(new Partition[cloudControllerPartitions.size()]);
+// return stubProps;
+// }
+//
+// public static org.apache.stratos.cloud.controller.stub.Properties toStubProperties(
+// java.util.Properties properties) {
+// org.apache.stratos.cloud.controller.stub.Properties stubProperties = new org.apache.stratos.cloud.controller.stub.Properties();
+// if(properties != null) {
+// for(Map.Entry<Object, Object> entry : properties.entrySet()) {
+// org.apache.stratos.cloud.controller.stub.Property newProperty = new org.apache.stratos.cloud.controller.stub.Property();
+// newProperty.setName(entry.getKey().toString());
+// newProperty.setValue(entry.getValue().toString());
+// stubProperties.addProperties(newProperty);
+// }
+// }
+// return stubProperties;
// }
-
-// /**
-// * Convert autoscaler partition to cloud controller partition
-// * @param partition
-// * @return
-// */
-// public static org.apache.stratos.cloud.controller.stub.domain.Partition
-// convertASPartitionToCCPartition(org.apache.stratos.autoscaler.pojo.policy.deployment.partition.network.Partition partition) {
//
-// org.apache.stratos.cloud.controller.stub.domain.Partition cloudControllerPartition = new
-// org.apache.stratos.cloud.controller.stub.domain.Partition();
+// public static org.apache.stratos.common.Properties toCommonProperties(
+// org.apache.stratos.cloud.controller.stub.Properties properties) {
+// org.apache.stratos.common.Properties commonProps = new org.apache.stratos.common.Properties();
+//
+// if (properties != null && properties.getProperties() != null) {
//
-// cloudControllerPartition.setId(partition.getId());
-// cloudControllerPartition.setProvider(partition.getProvider());
-// cloudControllerPartition.setDescription(partition.getDescription());
-// cloudControllerPartition.setKubernetesClusterId(partition.getKubernetesClusterId());
-// cloudControllerPartition.setIsPublic(partition.getIsPublic());
-// cloudControllerPartition.setProperties(AutoscalerUtil.toStubProperties(partition.getProperties()));
+// for (org.apache.stratos.cloud.controller.stub.Property property : properties.getProperties()) {
+// if ((property != null) && (property.getValue() != null)) {
+// org.apache.stratos.common.Property newProperty = new org.apache.stratos.common.Property();
+// newProperty.setName(property.getName());
+// newProperty.setValue(property.getValue());
+// commonProps.addProperty(newProperty);
+// }
+// }
//
-// return cloudControllerPartition;
+// }
+//
+// return commonProps;
// }
-
-
+//
+// public static org.apache.stratos.common.Properties toCommonProperties(
+// org.apache.stratos.cloud.controller.stub.Property[] propertyArray) {
+//
+// org.apache.stratos.cloud.controller.stub.Properties properties = new org.apache.stratos.cloud.controller.stub.Properties();
+// properties.setProperties(propertyArray);
+// return toCommonProperties(properties);
+// }
+//
+
// public static NetworkPartition convertNetworkParitionStubToPojo(org.apache.stratos.cloud.controller.stub.domain.NetworkPartition np) {
//
// NetworkPartition networkPartition = new NetworkPartition();
@@ -79,15 +202,15 @@ public class AutoscalerObjectConverter {
// return networkPartition;
// }
-// private static org.apache.stratos.autoscaler.pojo.policy.deployment.partition.network.Partition[] convertPartitionStubToPojo(
+// private static Partition[] convertPartitionStubToPojo(
// Partition[] partitions) {
//
-// List<org.apache.stratos.autoscaler.pojo.policy.deployment.partition.network.Partition> partitionList =
-// new ArrayList<org.apache.stratos.autoscaler.pojo.policy.deployment.partition.network.Partition>();
+// List<Partition> partitionList =
+// new ArrayList<Partition>();
//
// for (Partition p : partitions) {
-// org.apache.stratos.autoscaler.pojo.policy.deployment.partition.network.Partition partition =
-// new org.apache.stratos.autoscaler.pojo.policy.deployment.partition.network.Partition();
+// Partition partition =
+// new Partition();
// partition.setDescription(p.getDescription());
// partition.setId(p.getId());
// partition.setIsPublic(p.getIsPublic());
@@ -97,7 +220,7 @@ public class AutoscalerObjectConverter {
// }
//
// return partitionList.toArray(
-// new org.apache.stratos.autoscaler.pojo.policy.deployment.partition.network.Partition[partitions.length]);
+// new Partition[partitions.length]);
// }
// private static Properties convertProperties(
@@ -106,7 +229,7 @@ public class AutoscalerObjectConverter {
// Properties props = new Properties();
// Property[] propArray = properties.getProperties();
// for (Property property : propArray) {
-// props.addProperty(new org.apache.stratos.common.Property(property.getName(),property.getValue()));
+// props.addProperty(new Property(property.getName(),property.getValue()));
// }
//
// return props;
http://git-wip-us.apache.org/repos/asf/stratos/blob/520b9401/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
index c43a0fd..5b3fd4b 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
@@ -52,9 +52,9 @@ import org.apache.stratos.autoscaler.monitor.MonitorFactory;
import org.apache.stratos.autoscaler.monitor.component.ApplicationMonitor;
import org.apache.stratos.autoscaler.pojo.policy.PolicyManager;
import org.apache.stratos.autoscaler.pojo.policy.deployment.ApplicationPolicy;
+import org.apache.stratos.autoscaler.pojo.policy.deployment.DeploymentPolicy;
import org.apache.stratos.autoscaler.registry.RegistryManager;
-import org.apache.stratos.cloud.controller.stub.domain.DeploymentPolicy;
-import org.apache.stratos.cloud.controller.stub.domain.NetworkPartitionRef;
+import org.apache.stratos.common.partition.NetworkPartition;
import org.apache.stratos.common.Properties;
import org.apache.stratos.common.Property;
import org.apache.stratos.common.client.CloudControllerServiceClient;
@@ -72,7 +72,7 @@ import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
*/
public class AutoscalerUtil {
- private static final Log log = LogFactory.getLog(AutoscalerUtil.class);
+ private static final Log log = LogFactory.getLog(AutoscalerUtil.class);
private AutoscalerUtil() {
}
@@ -81,7 +81,7 @@ public class AutoscalerUtil {
return Holder.INSTANCE;
}
- private static class Holder {
+ private static class Holder {
private static final AutoscalerUtil INSTANCE = new AutoscalerUtil();
}
@@ -175,21 +175,21 @@ public class AutoscalerUtil {
OMElement prop = (OMElement) it.next();
if (prop.getAttribute(new QName(AutoscalerConstants.PROPERTY_NAME_ATTR)) == null ||
- prop.getAttribute(new QName(AutoscalerConstants.PROPERTY_VALUE_ATTR)) == null) {
+ prop.getAttribute(new QName(AutoscalerConstants.PROPERTY_VALUE_ATTR)) == null) {
String msg =
- "Property element's, name and value attributes should be specified. "
- + "Property: ";
+ "Property element's, name and value attributes should be specified. "
+ + "Property: ";
log.warn(msg + prop.toString());
}
String name =
- prop.getAttribute(new QName(AutoscalerConstants.PROPERTY_NAME_ATTR))
- .getAttributeValue();
+ prop.getAttribute(new QName(AutoscalerConstants.PROPERTY_NAME_ATTR))
+ .getAttributeValue();
String value =
- prop.getAttribute(new QName(AutoscalerConstants.PROPERTY_VALUE_ATTR))
- .getAttributeValue();
+ prop.getAttribute(new QName(AutoscalerConstants.PROPERTY_VALUE_ATTR))
+ .getAttributeValue();
Property property = new Property();
property.setName(name);
@@ -269,18 +269,18 @@ public class AutoscalerUtil {
public synchronized void startApplicationMonitor(String applicationId) {
- AutoscalerContext autoscalerContext = AutoscalerContext.getInstance();
- if (autoscalerContext.getAppMonitor(applicationId) == null) {
- autoscalerContext.addApplicationPendingMonitor(applicationId);
- ServiceReferenceHolder.getInstance().getExecutorService().submit(new ApplicationMonitorAdder(applicationId));
+ AutoscalerContext autoscalerContext = AutoscalerContext.getInstance();
+ if (autoscalerContext.getAppMonitor(applicationId) == null) {
+ autoscalerContext.addApplicationPendingMonitor(applicationId);
+ ServiceReferenceHolder.getInstance().getExecutorService().submit(new ApplicationMonitorAdder(applicationId));
log.info(String.format("Monitor scheduled: [application] %s ", applicationId));
- } else {
- if (log.isDebugEnabled()) {
- log.debug(String.format("Application monitor thread already exists: " +
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug(String.format("Application monitor thread already exists: " +
"[application] %s ", applicationId));
- }
- }
+ }
+ }
}
private class ApplicationMonitorAdder implements Runnable {
@@ -378,7 +378,7 @@ public class AutoscalerUtil {
}
return "*";
}
-
+
/**
* Get network partition ids referred in an application. Network partition ids are not referred directly.
* Cartridge or cartridge group can refer deployment policy which has network partition references.
@@ -386,67 +386,67 @@ public class AutoscalerUtil {
* @return list of network partition ids
*/
public static List<String> getNetworkPartitionIdsReferedInApplication(String applicationId) {
-
- List<String> deploymentPolicyIdsReferedInApplication = getDeploymentPolicyIdsReferedInApplication(applicationId);
- if (deploymentPolicyIdsReferedInApplication == null) {
- return null;
- }
-
- List<String> networkPartitionIds = new ArrayList<String>();
- for (String deploymentPolicyId : deploymentPolicyIdsReferedInApplication) {
- try {
- DeploymentPolicy deploymentPolicy = CloudControllerServiceClient.getInstance().getDeploymentPolicy(deploymentPolicyId);
- if (deploymentPolicy != null) {
- for (NetworkPartitionRef networkPartitionRef : deploymentPolicy.getNetworkPartitionsRef()) {
- if (networkPartitionRef != null) {
- if (!networkPartitionIds.contains(networkPartitionRef.getId())) {
- networkPartitionIds.add(networkPartitionRef.getId());
- }
- }
- }
- }
- }
- catch (Exception e) {
- String msg = String.format("Error while getting deployment policy from cloud controller [deployment-policy-id] %s ", deploymentPolicyId);
- log.error(msg, e);
- throw new AutoScalerException(msg, e);
- }
- }
- return networkPartitionIds;
- }
-
+
+ List<String> deploymentPolicyIdsReferedInApplication = getDeploymentPolicyIdsReferedInApplication(applicationId);
+ if (deploymentPolicyIdsReferedInApplication == null) {
+ return null;
+ }
+
+ List<String> networkPartitionIds = new ArrayList<String>();
+ for (String deploymentPolicyId : deploymentPolicyIdsReferedInApplication) {
+ try {
+ DeploymentPolicy deploymentPolicy = PolicyManager.getInstance().getDeploymentPolicy(deploymentPolicyId);
+ if (deploymentPolicy != null) {
+ for (NetworkPartition networkPartition : deploymentPolicy.getNetworkPartitions()) {
+ if (networkPartition != null) {
+ if (!networkPartitionIds.contains(networkPartition.getId())) {
+ networkPartitionIds.add(networkPartition.getId());
+ }
+ }
+ }
+ }
+ }
+ catch (Exception e) {
+ String msg = String.format("Error while getting deployment policy from cloud controller [deployment-policy-id] %s ", deploymentPolicyId);
+ log.error(msg, e);
+ throw new AutoScalerException(msg, e);
+ }
+ }
+ return networkPartitionIds;
+ }
+
/**
* Get deployment policy ids referred in an application.
* @param applicationId the application id
* @return list of deployment policy ids
*/
private static List<String> getDeploymentPolicyIdsReferedInApplication(String applicationId) {
-
- if (applicationId == null || StringUtils.isBlank(applicationId)) {
- return null;
- }
-
- Application application = ApplicationHolder.getApplications().getApplication(applicationId);
- if (application == null) {
- return null;
- }
-
- Map<String, String> aliasToDeploymentPolicyIdMap = application.getAliasToDeploymentPolicyIdMap();
- if (aliasToDeploymentPolicyIdMap == null) {
- return null;
- }
-
- List<String> deploymentPolicyIds = new ArrayList<String>();
-
- for (Map.Entry<String, String> entry : aliasToDeploymentPolicyIdMap.entrySet()) {
- if (!deploymentPolicyIds.contains(entry.getValue())) {
- deploymentPolicyIds.add(entry.getValue());
- }
- }
-
- return deploymentPolicyIds;
+
+ if (applicationId == null || StringUtils.isBlank(applicationId)) {
+ return null;
+ }
+
+ Application application = ApplicationHolder.getApplications().getApplication(applicationId);
+ if (application == null) {
+ return null;
+ }
+
+ Map<String, String> aliasToDeploymentPolicyIdMap = application.getAliasToDeploymentPolicyIdMap();
+ if (aliasToDeploymentPolicyIdMap == null) {
+ return null;
+ }
+
+ List<String> deploymentPolicyIds = new ArrayList<String>();
+
+ for (Map.Entry<String, String> entry : aliasToDeploymentPolicyIdMap.entrySet()) {
+ if (!deploymentPolicyIds.contains(entry.getValue())) {
+ deploymentPolicyIds.add(entry.getValue());
+ }
+ }
+
+ return deploymentPolicyIds;
}
-
+
/**
* Get deployment policy id of an alias in the given application
* @param applicationId the application id
@@ -454,286 +454,286 @@ public class AutoscalerUtil {
* @return the deployment policy id if found, null otherwise
*/
public static String getDeploymentPolicyIdByAlias(String applicationId, String alias) {
-
- if (alias == null || StringUtils.isBlank(alias)) {
- return null;
- }
-
- if (applicationId == null || StringUtils.isBlank(applicationId)) {
- return null;
- }
-
- Application application = ApplicationHolder.getApplications().getApplication(applicationId);
- if (application == null) {
- return null;
- }
-
- Map<String, String> aliasToDeploymentPolicyIdMap = application.getAliasToDeploymentPolicyIdMap();
-
- if (aliasToDeploymentPolicyIdMap == null) {
- return null;
- }
-
- return aliasToDeploymentPolicyIdMap.get(alias);
+
+ if (alias == null || StringUtils.isBlank(alias)) {
+ return null;
+ }
+
+ if (applicationId == null || StringUtils.isBlank(applicationId)) {
+ return null;
+ }
+
+ Application application = ApplicationHolder.getApplications().getApplication(applicationId);
+ if (application == null) {
+ return null;
+ }
+
+ Map<String, String> aliasToDeploymentPolicyIdMap = application.getAliasToDeploymentPolicyIdMap();
+
+ if (aliasToDeploymentPolicyIdMap == null) {
+ return null;
+ }
+
+ return aliasToDeploymentPolicyIdMap.get(alias);
}
-
+
/**
* Get alias to deployment policy id map in the given application.
* @param applicationId the application id
* @return alias to deployment policy map
*/
public static Map<String, String> getAliasToDeploymentPolicyIdMapOfApplication(ApplicationContext applicationContext) {
-
- if (applicationContext == null) {
- return null;
- }
-
- ComponentContext componentContext = applicationContext.getComponents();
- if (componentContext == null) {
- return null;
- }
-
- Map<String, String> aliasToDeploymentPolicyIdMap = new HashMap<String, String>();
-
- CartridgeContext[] cartridgeContexts = componentContext.getCartridgeContexts();
- if (cartridgeContexts != null && cartridgeContexts.length != 0) {
- getAliasToDeployloymentPolicyIdMapFromChildCartridgeContexts(aliasToDeploymentPolicyIdMap, cartridgeContexts);
- }
-
- GroupContext[] groupContexts = componentContext.getGroupContexts();
- if (groupContexts != null && groupContexts.length != 0) {
- getAliasToDeployloymentPolicyIdMapFromChildGroupContexts(aliasToDeploymentPolicyIdMap, groupContexts);
- }
-
- return aliasToDeploymentPolicyIdMap;
+
+ if (applicationContext == null) {
+ return null;
+ }
+
+ ComponentContext componentContext = applicationContext.getComponents();
+ if (componentContext == null) {
+ return null;
+ }
+
+ Map<String, String> aliasToDeploymentPolicyIdMap = new HashMap<String, String>();
+
+ CartridgeContext[] cartridgeContexts = componentContext.getCartridgeContexts();
+ if (cartridgeContexts != null && cartridgeContexts.length != 0) {
+ getAliasToDeployloymentPolicyIdMapFromChildCartridgeContexts(aliasToDeploymentPolicyIdMap, cartridgeContexts);
+ }
+
+ GroupContext[] groupContexts = componentContext.getGroupContexts();
+ if (groupContexts != null && groupContexts.length != 0) {
+ getAliasToDeployloymentPolicyIdMapFromChildGroupContexts(aliasToDeploymentPolicyIdMap, groupContexts);
+ }
+
+ return aliasToDeploymentPolicyIdMap;
}
-
+
private static void getAliasToDeployloymentPolicyIdMapFromChildCartridgeContexts(
- Map<String, String> aliasToDeploymentPolicyIdMap, CartridgeContext[] cartridgeContexts) {
-
- if (cartridgeContexts != null && cartridgeContexts.length != 0) {
- for (CartridgeContext cartridgeContext : cartridgeContexts) {
- if (cartridgeContext != null) {
- aliasToDeploymentPolicyIdMap.put(
- cartridgeContext.getSubscribableInfoContext().getAlias(),
- cartridgeContext.getSubscribableInfoContext().getDeploymentPolicy());
- }
- }
- }
+ Map<String, String> aliasToDeploymentPolicyIdMap, CartridgeContext[] cartridgeContexts) {
+
+ if (cartridgeContexts != null && cartridgeContexts.length != 0) {
+ for (CartridgeContext cartridgeContext : cartridgeContexts) {
+ if (cartridgeContext != null) {
+ aliasToDeploymentPolicyIdMap.put(
+ cartridgeContext.getSubscribableInfoContext().getAlias(),
+ cartridgeContext.getSubscribableInfoContext().getDeploymentPolicy());
+ }
+ }
+ }
}
-
+
private static void getAliasToDeployloymentPolicyIdMapFromChildGroupContexts(
- Map<String, String> aliasToDeploymentPolicyIdMap, GroupContext[] groupContexts) {
-
- if (groupContexts != null && groupContexts.length != 0) {
- for (GroupContext groupContext : groupContexts) {
- if (groupContext != null) {
- if (groupContext.getDeploymentPolicy() == null || groupContext.getDeploymentPolicy().isEmpty()) {
- // if group does not have a deployment policy, children should have
- getAliasToDeployloymentPolicyIdMapFromChildCartridgeContexts(aliasToDeploymentPolicyIdMap, groupContext.getCartridgeContexts());
- getAliasToDeployloymentPolicyIdMapFromChildGroupContexts(aliasToDeploymentPolicyIdMap, groupContext.getGroupContexts());
- } else {
- // if group have a deployment policy, it is the same for all the children
- String deploymentPolicyId = groupContext.getDeploymentPolicy();
- aliasToDeploymentPolicyIdMap.put(groupContext.getAlias(), deploymentPolicyId);
- if (groupContext.getCartridgeContexts() != null && groupContext.getCartridgeContexts().length != 0) {
- setDeploymentPolicyIdToChildCartridgeContexts(aliasToDeploymentPolicyIdMap, deploymentPolicyId, groupContext.getCartridgeContexts());
- }
- if (groupContext.getGroupContexts() != null && groupContext.getGroupContexts().length != 0) {
- setDeploymentPolicyIdToChildGroupContexts(aliasToDeploymentPolicyIdMap, deploymentPolicyId, groupContext.getGroupContexts());
- }
-
- }
- }
- }
- }
+ Map<String, String> aliasToDeploymentPolicyIdMap, GroupContext[] groupContexts) {
+
+ if (groupContexts != null && groupContexts.length != 0) {
+ for (GroupContext groupContext : groupContexts) {
+ if (groupContext != null) {
+ if (groupContext.getDeploymentPolicy() == null || groupContext.getDeploymentPolicy().isEmpty()) {
+ // if group does not have a deployment policy, children should have
+ getAliasToDeployloymentPolicyIdMapFromChildCartridgeContexts(aliasToDeploymentPolicyIdMap, groupContext.getCartridgeContexts());
+ getAliasToDeployloymentPolicyIdMapFromChildGroupContexts(aliasToDeploymentPolicyIdMap, groupContext.getGroupContexts());
+ } else {
+ // if group have a deployment policy, it is the same for all the children
+ String deploymentPolicyId = groupContext.getDeploymentPolicy();
+ aliasToDeploymentPolicyIdMap.put(groupContext.getAlias(), deploymentPolicyId);
+ if (groupContext.getCartridgeContexts() != null && groupContext.getCartridgeContexts().length != 0) {
+ setDeploymentPolicyIdToChildCartridgeContexts(aliasToDeploymentPolicyIdMap, deploymentPolicyId, groupContext.getCartridgeContexts());
+ }
+ if (groupContext.getGroupContexts() != null && groupContext.getGroupContexts().length != 0) {
+ setDeploymentPolicyIdToChildGroupContexts(aliasToDeploymentPolicyIdMap, deploymentPolicyId, groupContext.getGroupContexts());
+ }
+
+ }
+ }
+ }
+ }
}
-
+
private static void setDeploymentPolicyIdToChildCartridgeContexts(
- Map<String, String> aliasToDeploymentPolicyIdMap, String deploymentPolicyId, CartridgeContext[] cartridgeContexts) {
-
- if (cartridgeContexts != null && cartridgeContexts.length != 0) {
- for (CartridgeContext cartridgeContext : cartridgeContexts) {
- if (cartridgeContext != null) {
- aliasToDeploymentPolicyIdMap.put(cartridgeContext.getSubscribableInfoContext().getAlias(), deploymentPolicyId);
- }
- }
- }
+ Map<String, String> aliasToDeploymentPolicyIdMap, String deploymentPolicyId, CartridgeContext[] cartridgeContexts) {
+
+ if (cartridgeContexts != null && cartridgeContexts.length != 0) {
+ for (CartridgeContext cartridgeContext : cartridgeContexts) {
+ if (cartridgeContext != null) {
+ aliasToDeploymentPolicyIdMap.put(cartridgeContext.getSubscribableInfoContext().getAlias(), deploymentPolicyId);
+ }
+ }
+ }
}
private static void setDeploymentPolicyIdToChildGroupContexts(
- Map<String, String> aliasToDeploymentPolicyIdMap, String deploymentPolicyId, GroupContext[] groupContexts) {
-
- if (groupContexts != null && groupContexts.length != 0) {
- for (GroupContext groupContext : groupContexts) {
- if (groupContext != null) {
- if (groupContext.getCartridgeContexts() != null && groupContext.getCartridgeContexts().length != 0) {
- setDeploymentPolicyIdToChildCartridgeContexts(aliasToDeploymentPolicyIdMap, deploymentPolicyId, groupContext.getCartridgeContexts());
- }
- if (groupContext.getGroupContexts() != null && groupContext.getGroupContexts().length != 0) {
- setDeploymentPolicyIdToChildGroupContexts(aliasToDeploymentPolicyIdMap, deploymentPolicyId, groupContext.getGroupContexts());
- }
- }
- }
- }
+ Map<String, String> aliasToDeploymentPolicyIdMap, String deploymentPolicyId, GroupContext[] groupContexts) {
+
+ if (groupContexts != null && groupContexts.length != 0) {
+ for (GroupContext groupContext : groupContexts) {
+ if (groupContext != null) {
+ if (groupContext.getCartridgeContexts() != null && groupContext.getCartridgeContexts().length != 0) {
+ setDeploymentPolicyIdToChildCartridgeContexts(aliasToDeploymentPolicyIdMap, deploymentPolicyId, groupContext.getCartridgeContexts());
+ }
+ if (groupContext.getGroupContexts() != null && groupContext.getGroupContexts().length != 0) {
+ setDeploymentPolicyIdToChildGroupContexts(aliasToDeploymentPolicyIdMap, deploymentPolicyId, groupContext.getGroupContexts());
+ }
+ }
+ }
+ }
}
-
+
/**
* Validates Application Policy against the given application.
* @param applicationPolicy the application policy to be validated
* @throws InvalidApplicationPolicyException if application policy is not valid
* @throws RemoteException is anything went wrong while communicating with CC to validate network partitions
*/
- public static void validateApplicationPolicy(ApplicationPolicy applicationPolicy)
- throws InvalidApplicationPolicyException, RemoteException {
-
- // application policy can't be null
- if (null == applicationPolicy) {
- String msg = "Invalid Application Policy. Cause -> Application Policy is null";
- log.error(msg);
- throw new InvalidApplicationPolicyException(msg);
- }
-
- // application policy id can't be null
- if (applicationPolicy.getId() == null || StringUtils.isBlank(applicationPolicy.getId())) {
- String msg = "Invalid Application Policy. Cause -> Application policy id null or empty";
- log.error(msg);
- throw new InvalidApplicationPolicyException(msg);
- }
-
- // network partition algorithm can't null or empty
- String algorithm = applicationPolicy.getAlgorithm();
- if (algorithm == null || StringUtils.isBlank(algorithm)) {
- String msg = "Invalid Application Policy. Cause -> Network partition algorithm is null or empty";
- log.error(msg);
- throw new InvalidApplicationPolicyException(msg);
- }
-
- // network partition algorithm should be either one-after-another or all-at-once
- if (!algorithm.equals(StratosConstants.NETWORK_PARTITION_ONE_AFTER_ANOTHER_ALGORITHM_ID)
- && !algorithm.equals(StratosConstants.NETWORK_PARTITION_ALL_AT_ONCE_ALGORITHM_ID)) {
- String msg = String.format("Invalid Application Policy. Cause -> Invalid network partition algorithm. "
- + "It should be either %s or %s, but found %s",
- StratosConstants.NETWORK_PARTITION_ONE_AFTER_ANOTHER_ALGORITHM_ID,
- StratosConstants.NETWORK_PARTITION_ALL_AT_ONCE_ALGORITHM_ID, algorithm);
- log.error(msg);
- throw new InvalidApplicationPolicyException(msg);
- }
-
- // application policy should contain at least one network partition reference
- String[] networkPartitionIds = applicationPolicy.getNetworkPartitions();
- if (null == networkPartitionIds || networkPartitionIds.length == 0) {
- String msg = "Invalid Application Policy. "
- + "Cause -> Application Policy is not containing any network partition reference";
- log.error(msg);
- throw new InvalidApplicationPolicyException(msg);
- }
-
- // validating all network partition references
- for (String networkPartitionId : networkPartitionIds) {
-
- // network-partition-id can't be null or empty
- if (null == networkPartitionId || networkPartitionId.isEmpty()) {
- String msg = String.format("Invalid Application Policy. "
- + "Cause -> Invalid network-partition-id : %s", networkPartitionId);
- log.error(msg);
- throw new InvalidApplicationPolicyException(msg);
- }
-
- // network partitions should be added already
- if (null == CloudControllerServiceClient.getInstance().getNetworkPartition(networkPartitionId)) {
- String msg = String.format("Invalid Application Policy. "
- + "Cause -> Network partition not found for network-partition-id : %s", networkPartitionId);
- log.error(msg);
- throw new InvalidApplicationPolicyException(msg);
- }
-
- }
-
- // if networkPartitionGroups property is set, we need to validate that too
- Properties properties = applicationPolicy.getProperties();
- if (properties!= null) {
- Property networkPartitionGroupsProperty = properties.getProperty(StratosConstants.APPLICATION_POLICY_NETWORK_PARTITION_GROUPS);
- if (networkPartitionGroupsProperty != null) {
- String networkPartitionGroupsPropertyValue = networkPartitionGroupsProperty.getValue();
- if (networkPartitionGroupsPropertyValue != null) {
- String[] networkPartitionGroups = networkPartitionGroupsPropertyValue.split(StratosConstants.APPLICATION_POLICY_NETWORK_PARTITION_GROUPS_SPLITTER);
- if (networkPartitionGroups != null) {
- for (String networkPartitionIdsString : networkPartitionGroups) {
- networkPartitionIds = networkPartitionIdsString.split(StratosConstants.APPLICATION_POLICY_NETWORK_PARTITIONS_SPLITTER);
- if (networkPartitionIds != null) {
- for (String networkPartitionId : networkPartitionIds) {
- // network-partition-id can't be null or empty
- if (null == networkPartitionId || networkPartitionId.isEmpty()) {
- String msg = String.format("Invalid Application Policy. "
- + "Cause -> Invalid network-partition-id : %s", networkPartitionId);
- log.error(msg);
- throw new InvalidApplicationPolicyException(msg);
- }
-
- // network partitions should be added already
- if (null == CloudControllerServiceClient.getInstance().getNetworkPartition(networkPartitionId)) {
- String msg = String.format("Invalid Application Policy. "
- + "Cause -> Network partition not found for network-partition-id : %s", networkPartitionId);
- log.error(msg);
- throw new InvalidApplicationPolicyException(msg);
- }
- }
- }
- }
- // populating network partition groups in application policy
- applicationPolicy.setNetworkPartitionGroups(networkPartitionGroups);
- }
- }
- }
- }
+ public static void validateApplicationPolicy(ApplicationPolicy applicationPolicy)
+ throws InvalidApplicationPolicyException, RemoteException {
+
+ // application policy can't be null
+ if (null == applicationPolicy) {
+ String msg = "Invalid Application Policy. Cause -> Application Policy is null";
+ log.error(msg);
+ throw new InvalidApplicationPolicyException(msg);
+ }
+
+ // application policy id can't be null
+ if (applicationPolicy.getId() == null || StringUtils.isBlank(applicationPolicy.getId())) {
+ String msg = "Invalid Application Policy. Cause -> Application policy id null or empty";
+ log.error(msg);
+ throw new InvalidApplicationPolicyException(msg);
+ }
+
+ // network partition algorithm can't null or empty
+ String algorithm = applicationPolicy.getAlgorithm();
+ if (algorithm == null || StringUtils.isBlank(algorithm)) {
+ String msg = "Invalid Application Policy. Cause -> Network partition algorithm is null or empty";
+ log.error(msg);
+ throw new InvalidApplicationPolicyException(msg);
+ }
+
+ // network partition algorithm should be either one-after-another or all-at-once
+ if (!algorithm.equals(StratosConstants.NETWORK_PARTITION_ONE_AFTER_ANOTHER_ALGORITHM_ID)
+ && !algorithm.equals(StratosConstants.NETWORK_PARTITION_ALL_AT_ONCE_ALGORITHM_ID)) {
+ String msg = String.format("Invalid Application Policy. Cause -> Invalid network partition algorithm. "
+ + "It should be either %s or %s, but found %s",
+ StratosConstants.NETWORK_PARTITION_ONE_AFTER_ANOTHER_ALGORITHM_ID,
+ StratosConstants.NETWORK_PARTITION_ALL_AT_ONCE_ALGORITHM_ID, algorithm);
+ log.error(msg);
+ throw new InvalidApplicationPolicyException(msg);
+ }
+
+ // application policy should contain at least one network partition reference
+ String[] networkPartitionIds = applicationPolicy.getNetworkPartitions();
+ if (null == networkPartitionIds || networkPartitionIds.length == 0) {
+ String msg = "Invalid Application Policy. "
+ + "Cause -> Application Policy is not containing any network partition reference";
+ log.error(msg);
+ throw new InvalidApplicationPolicyException(msg);
+ }
+
+ // validating all network partition references
+ for (String networkPartitionId : networkPartitionIds) {
+
+ // network-partition-id can't be null or empty
+ if (null == networkPartitionId || networkPartitionId.isEmpty()) {
+ String msg = String.format("Invalid Application Policy. "
+ + "Cause -> Invalid network-partition-id : %s", networkPartitionId);
+ log.error(msg);
+ throw new InvalidApplicationPolicyException(msg);
+ }
+
+ // network partitions should be added already
+ if (null == CloudControllerServiceClient.getInstance().getNetworkPartition(networkPartitionId)) {
+ String msg = String.format("Invalid Application Policy. "
+ + "Cause -> Network partition not found for network-partition-id : %s", networkPartitionId);
+ log.error(msg);
+ throw new InvalidApplicationPolicyException(msg);
+ }
+
+ }
+
+ // if networkPartitionGroups property is set, we need to validate that too
+ Properties properties = applicationPolicy.getProperties();
+ if (properties!= null) {
+ Property networkPartitionGroupsProperty = properties.getProperty(StratosConstants.APPLICATION_POLICY_NETWORK_PARTITION_GROUPS);
+ if (networkPartitionGroupsProperty != null) {
+ String networkPartitionGroupsPropertyValue = networkPartitionGroupsProperty.getValue();
+ if (networkPartitionGroupsPropertyValue != null) {
+ String[] networkPartitionGroups = networkPartitionGroupsPropertyValue.split(StratosConstants.APPLICATION_POLICY_NETWORK_PARTITION_GROUPS_SPLITTER);
+ if (networkPartitionGroups != null) {
+ for (String networkPartitionIdsString : networkPartitionGroups) {
+ networkPartitionIds = networkPartitionIdsString.split(StratosConstants.APPLICATION_POLICY_NETWORK_PARTITIONS_SPLITTER);
+ if (networkPartitionIds != null) {
+ for (String networkPartitionId : networkPartitionIds) {
+ // network-partition-id can't be null or empty
+ if (null == networkPartitionId || networkPartitionId.isEmpty()) {
+ String msg = String.format("Invalid Application Policy. "
+ + "Cause -> Invalid network-partition-id : %s", networkPartitionId);
+ log.error(msg);
+ throw new InvalidApplicationPolicyException(msg);
+ }
+
+ // network partitions should be added already
+ if (null == CloudControllerServiceClient.getInstance().getNetworkPartition(networkPartitionId)) {
+ String msg = String.format("Invalid Application Policy. "
+ + "Cause -> Network partition not found for network-partition-id : %s", networkPartitionId);
+ log.error(msg);
+ throw new InvalidApplicationPolicyException(msg);
+ }
+ }
+ }
+ }
+ // populating network partition groups in application policy
+ applicationPolicy.setNetworkPartitionGroups(networkPartitionGroups);
+ }
+ }
+ }
+ }
+ }
+
+
+ /**
+ * Validates an application policy against the application
+ * @param applicationId
+ * @param applicationPolicyId
+ * @throws ApplicatioinPolicyNotExistsException
+ * @throws InvalidApplicationPolicyException
+ */
+ public static void validateApplicationPolicyAgainstApplication(String applicationId, String applicationPolicyId)
+ throws ApplicatioinPolicyNotExistsException, InvalidApplicationPolicyException {
+
+ ApplicationPolicy applicationPolicy = PolicyManager.getInstance().getApplicationPolicy(applicationPolicyId);
+ if (applicationPolicy == null) {
+ String msg = String.format("Application Policy not exists for [application-policy-id] %s", applicationPolicyId);
+ log.error(msg);
+ throw new ApplicatioinPolicyNotExistsException(msg);
+ }
+
+ String[] networkPartitionIds = applicationPolicy.getNetworkPartitions();
+
+ for (String applicationPolicyNetworkPartitionerence : networkPartitionIds) {
+ String networkPartitionId = applicationPolicyNetworkPartitionerence;
+ // validate application policy against the given application
+ if (!isAppUsingNetworkPartitionId(applicationId, networkPartitionId)) {
+ String msg = String.format("Invalid Application Policy. "
+ + "Cause -> Network partition [network-partition-id] %s is not used in application [application-id] %s. "
+ + "Hence application bursting will fail. Either remove %s from application policy or make all the cartridges available in %s",
+ networkPartitionId, applicationId, networkPartitionId, networkPartitionId);
+ log.error(msg);
+ throw new InvalidApplicationPolicyException(msg);
+ }
+ }
+ }
+
+ private static boolean isAppUsingNetworkPartitionId(String applicationId, String networkPartitionId) {
+ if (applicationId == null || StringUtils.isBlank(applicationId)
+ || networkPartitionId == null || StringUtils.isBlank(networkPartitionId)) {
+ return false;
+ }
+ List<String> networkPartitionsReferredInApplication = AutoscalerUtil.getNetworkPartitionIdsReferedInApplication(applicationId);
+ for (String appNetworkPartitionId : networkPartitionsReferredInApplication) {
+ if (appNetworkPartitionId != null && appNetworkPartitionId.equals(networkPartitionId)) {
+ return true;
+ }
+ }
+ return false;
}
-
-
- /**
- * Validates an application policy against the application
- * @param applicationId
- * @param applicationPolicyId
- * @throws ApplicatioinPolicyNotExistsException
- * @throws InvalidApplicationPolicyException
- */
- public static void validateApplicationPolicyAgainstApplication(String applicationId, String applicationPolicyId)
- throws ApplicatioinPolicyNotExistsException, InvalidApplicationPolicyException {
-
- ApplicationPolicy applicationPolicy = PolicyManager.getInstance().getApplicationPolicy(applicationPolicyId);
- if (applicationPolicy == null) {
- String msg = String.format("Application Policy not exists for [application-policy-id] %s", applicationPolicyId);
- log.error(msg);
- throw new ApplicatioinPolicyNotExistsException(msg);
- }
-
- String[] networkPartitionIds = applicationPolicy.getNetworkPartitions();
-
- for (String applicationPolicyNetworkPartitionReference : networkPartitionIds) {
- String networkPartitionId = applicationPolicyNetworkPartitionReference;
- // validate application policy against the given application
- if (!isAppUsingNetworkPartitionId(applicationId, networkPartitionId)) {
- String msg = String.format("Invalid Application Policy. "
- + "Cause -> Network partition [network-partition-id] %s is not used in application [application-id] %s. "
- + "Hence application bursting will fail. Either remove %s from application policy or make all the cartridges available in %s",
- networkPartitionId, applicationId, networkPartitionId, networkPartitionId);
- log.error(msg);
- throw new InvalidApplicationPolicyException(msg);
- }
- }
- }
-
- private static boolean isAppUsingNetworkPartitionId(String applicationId, String networkPartitionId) {
- if (applicationId == null || StringUtils.isBlank(applicationId)
- || networkPartitionId == null || StringUtils.isBlank(networkPartitionId)) {
- return false;
- }
- List<String> networkPartitionsReferredInApplication = AutoscalerUtil.getNetworkPartitionIdsReferedInApplication(applicationId);
- for (String appNetworkPartitionId : networkPartitionsReferredInApplication) {
- if (appNetworkPartitionId != null && appNetworkPartitionId.equals(networkPartitionId)) {
- return true;
- }
- }
- return false;
- }
}
[02/20] stratos git commit: Deployment policy move:Update CC service
files and instance creator
Posted by la...@apache.org.
Deployment policy move:Update CC service files and instance creator
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/886553bd
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/886553bd
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/886553bd
Branch: refs/heads/master
Commit: 886553bd15ae578e0f4e7adca9c463abcc526b77
Parents: 54f5075
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Tue Apr 7 07:50:20 2015 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Tue Apr 7 07:50:20 2015 +0530
----------------------------------------------------------------------
.../services/CloudControllerService.java | 49 +-------
.../impl/CloudControllerServiceImpl.java | 114 ++---------------
.../impl/CloudControllerServiceUtil.java | 123 +------------------
.../services/impl/InstanceCreator.java | 1 +
4 files changed, 14 insertions(+), 273 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/886553bd/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/CloudControllerService.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/CloudControllerService.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/CloudControllerService.java
index 0799862..52a3727 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/CloudControllerService.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/CloudControllerService.java
@@ -128,12 +128,12 @@ public interface CloudControllerService {
* Validate a given deployment policy
*
* @param cartridgeType type of the cartridge
- * @param partitions partitions
+ * @param networkPartitionId id of network partition to be validated
* @return whether the policy is a valid one against the given Cartridge.
* @throws InvalidPartitionException if the policy contains at least one invalid partition.
* @throws InvalidCartridgeTypeException if the given Cartridge type is not a valid one.
*/
- boolean validateDeploymentPolicy(String cartridgeType, Partition[] partitions)
+ boolean validateDeploymentPolicyNetworkPartition(String cartridgeType, String networkPartitionId)
throws InvalidPartitionException, InvalidCartridgeTypeException;
/**
@@ -340,51 +340,6 @@ public interface CloudControllerService {
public boolean updateKubernetesMaster(KubernetesMaster kubernetesMaster)
throws InvalidKubernetesMasterException, NonExistingKubernetesMasterException;
- /**
- * Add a deployment policy
- *
- * @param deploymentPolicy DeployementPolicy
- * @throws InvalidDeploymentPolicyException if the deployment policy is not valid
- * @throws InvalidCartridgeDefinitionException if the cartridge configuration is not valid.
- * @throws InvalidIaasProviderException if the iaas providers configured are not valid.
- * @throws IllegalArgumentException if the provided argument is not valid.
- */
- public void addDeployementPolicy(DeploymentPolicy deploymentPolicy) throws DeploymentPolicyAlreadyExistsException, InvalidDeploymentPolicyException;
-
- /**
- * Update existing deployment policy
- *
- * @param deploymentPolicy DeployementPolicy
- * @throws InvalidDeploymentPolicyException if the deployment policy is not valid
- * @throws InvalidCartridgeDefinitionException if the cartridge configuration is not valid.
- * @throws InvalidIaasProviderException if the iaas providers configured are not valid.
- * @throws IllegalArgumentException if the provided argument is not valid.
- */
- public void updateDeployementPolicy(DeploymentPolicy deploymentPolicy) throws DeploymentPolicyNotExistsException, InvalidDeploymentPolicyException;
-
- /**
- * Remove deployment policy
- *
- * @param deploymentPolicyID deploymentPolicyID
- * @throws InvalidCartridgeDefinitionException if the cartridge configuration is not valid.
- * @throws InvalidIaasProviderException if the iaas providers configured are not valid.
- * @throws IllegalArgumentException if the provided argument is not valid.
- */
- public void removeDeployementPolicy(String deploymentPolicyID) throws DeploymentPolicyNotExistsException;
-
- /**
- * Get deployment policy definition
- * @param deploymentPolicyID
- * @return
- */
- public DeploymentPolicy getDeploymentPolicy(String deploymentPolicyID);
-
- /**
- * Get deployment policies
- * @return array of {@link DeploymentPolicy}
- */
- public DeploymentPolicy[] getDeploymentPolicies();
-
/**
* Add network partition
* @param networkPartition
http://git-wip-us.apache.org/repos/asf/stratos/blob/886553bd/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
index 3df93de..77a3466 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
@@ -33,8 +33,9 @@ import org.apache.stratos.cloud.controller.iaases.Iaas;
import org.apache.stratos.cloud.controller.messaging.topology.TopologyBuilder;
import org.apache.stratos.cloud.controller.messaging.topology.TopologyManager;
import org.apache.stratos.cloud.controller.services.CloudControllerService;
-import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
import org.apache.stratos.cloud.controller.util.CloudControllerUtil;
+import org.apache.stratos.cloud.controller.domain.NetworkPartition;
+
import org.apache.stratos.common.Property;
import org.apache.stratos.common.domain.LoadBalancingIPType;
import org.apache.stratos.common.threading.StratosThreadPool;
@@ -704,10 +705,10 @@ public class CloudControllerServiceImpl implements CloudControllerService {
throw new CartridgeNotFoundException(msg);
}
- Properties properties = CloudControllerUtil.toJavaUtilProperties(registrant.getProperties());
- String property = properties.getProperty(CloudControllerConstants.IS_LOAD_BALANCER);
- boolean isLb = property != null ? Boolean.parseBoolean(property) : false;
- TopologyBuilder.handleClusterCreated(registrant, isLb);
+// Properties properties = CloudControllerUtil.toJavaUtilProperties(registrant.getProperties());
+// Property property = properties.getProperty(CloudControllerConstants.IS_LOAD_BALANCER);
+// boolean isLb = property != null ? Boolean.parseBoolean(property.getValue()) : false;
+ TopologyBuilder.handleClusterCreated(registrant);
CloudControllerContext.getInstance().persist();
log.info("Successfully registered service: " + registrant);
@@ -888,9 +889,10 @@ public class CloudControllerServiceImpl implements CloudControllerService {
* FIXME: A validate method shouldn't persist data
*/
@Override
- public boolean validateDeploymentPolicy(String cartridgeType, Partition[] partitions)
+ public boolean validateDeploymentPolicyNetworkPartition(String cartridgeType, String networkPartitionId)
throws InvalidPartitionException, InvalidCartridgeTypeException {
+ NetworkPartition networkPartition = CloudControllerContext.getInstance().getNetworkPartition(networkPartitionId);
Lock lock = null;
try {
lock = CloudControllerContext.getInstance().acquireCartridgesWriteLock();
@@ -918,7 +920,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
}
Map<String, Future<IaasProvider>> jobList = new HashMap<String, Future<IaasProvider>>();
- for (Partition partition : partitions) {
+ for (Partition partition : networkPartition.getPartitions()) {
if (validatedPartitions != null && validatedPartitions.contains(partition.getId())) {
// partition cache hit
String provider = partition.getProvider();
@@ -969,7 +971,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
// persist data
CloudControllerContext.getInstance().persist();
- log.info("All partitions [" + CloudControllerUtil.getPartitionIds(partitions) + "]" +
+ log.info("All partitions [" + CloudControllerUtil.getPartitionIds(networkPartition.getPartitions()) + "]" +
" were validated successfully, against the cartridge: " + cartridgeType);
return true;
@@ -1350,102 +1352,6 @@ public class CloudControllerServiceImpl implements CloudControllerService {
}
@Override
- public void addDeployementPolicy(DeploymentPolicy deploymentPolicy)
- throws DeploymentPolicyAlreadyExistsException, InvalidDeploymentPolicyException {
-
- CloudControllerServiceUtil.validateDeploymentPolicy(deploymentPolicy);
-
- if (log.isInfoEnabled()) {
- log.info("Adding deployment policy: [deployment-policy-id] " + deploymentPolicy.getDeploymentPolicyID());
- }
- if (log.isDebugEnabled()) {
- log.debug("Deployment policy definition: " + deploymentPolicy.toString());
- }
-
- String deploymentPolicyID = deploymentPolicy.getDeploymentPolicyID();
- if (cloudControllerContext.getDeploymentPolicy(deploymentPolicyID) != null) {
- String message = "Deployment policy already exists: [deployment-policy-id] " + deploymentPolicyID;
- log.error(message);
- throw new DeploymentPolicyAlreadyExistsException(message);
- }
-
- // Add cartridge to the cloud controller context and persist
- CloudControllerContext.getInstance().addDeploymentPolicy(deploymentPolicy);
- CloudControllerContext.getInstance().persist();
-
- if (log.isInfoEnabled()) {
- log.info("Successfully added deployment policy: [deployment-policy-id] " + deploymentPolicyID);
- }
-
- }
-
- @Override
- public void updateDeployementPolicy(DeploymentPolicy deploymentPolicy)
- throws DeploymentPolicyNotExistsException, InvalidDeploymentPolicyException {
-
- CloudControllerServiceUtil.validateDeploymentPolicy(deploymentPolicy);
-
- if (log.isInfoEnabled()) {
- log.info("Updating deployment policy: [deployment-policy-id] " + deploymentPolicy.getDeploymentPolicyID());
- }
- if (log.isDebugEnabled()) {
- log.debug("Updating deployment policy definition: " + deploymentPolicy.toString());
- }
-
- String deploymentPolicyID = deploymentPolicy.getDeploymentPolicyID();
- if (cloudControllerContext.getDeploymentPolicy(deploymentPolicyID) == null) {
- String message = "Deployment policy does not exist: [deployment-policy-id] " + deploymentPolicyID;
- log.error(message);
- throw new DeploymentPolicyNotExistsException(message);
- }
-
- // Add cartridge to the cloud controller context and persist
- CloudControllerContext.getInstance().addDeploymentPolicy(deploymentPolicy);
- CloudControllerContext.getInstance().persist();
-
- if (log.isInfoEnabled()) {
- log.info("Successfully updated deployment policy: [deployment-policy-id] " + deploymentPolicyID);
- }
- }
-
- @Override
- public void removeDeployementPolicy(String deploymentPolicyID) throws DeploymentPolicyNotExistsException {
- if (log.isInfoEnabled()) {
- log.info("Removing deployment policy: [deployment-policy_id] " + deploymentPolicyID);
- }
- if (cloudControllerContext.getDeploymentPolicy(deploymentPolicyID) == null) {
- String message = "Deployment policy not exists: [deployment-policy-id] " + deploymentPolicyID;
- log.error(message);
- throw new DeploymentPolicyNotExistsException(message);
- }
- CloudControllerContext.getInstance().removeDeploymentPolicy(deploymentPolicyID);
- if (log.isInfoEnabled()) {
- log.info("Successfully removed deployment policy: [deployment_policy_id] " + deploymentPolicyID);
- }
-
- }
-
- @Override
- public DeploymentPolicy getDeploymentPolicy(String deploymentPolicyID) {
- if (log.isDebugEnabled()) {
- log.debug("Getting deployment policy: [deployment-policy_id] " + deploymentPolicyID);
- }
- return CloudControllerContext.getInstance().getDeploymentPolicy(deploymentPolicyID);
- }
-
- @Override
- public DeploymentPolicy[] getDeploymentPolicies() {
- try {
- Collection<DeploymentPolicy> deploymentPolicies = cloudControllerContext.getDeploymentPolicies();
- return deploymentPolicies.toArray(new DeploymentPolicy[deploymentPolicies.size()]);
- } catch (Exception e) {
- String message = "Could not get deployment policies";
- log.error(message);
- throw new CloudControllerException(message, e);
- }
- }
-
- @Override
public boolean updateKubernetesHost(KubernetesHost kubernetesHost) throws
InvalidKubernetesHostException, NonExistingKubernetesHostException {
http://git-wip-us.apache.org/repos/asf/stratos/blob/886553bd/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java
index 23f49fe..9611b31 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java
@@ -24,7 +24,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.cloud.controller.context.CloudControllerContext;
import org.apache.stratos.cloud.controller.domain.*;
-import org.apache.stratos.cloud.controller.exception.InvalidDeploymentPolicyException;
import org.apache.stratos.cloud.controller.exception.InvalidIaasProviderException;
import org.apache.stratos.cloud.controller.exception.InvalidPartitionException;
import org.apache.stratos.cloud.controller.iaases.Iaas;
@@ -32,7 +31,7 @@ import org.apache.stratos.cloud.controller.iaases.PartitionValidator;
import org.apache.stratos.cloud.controller.statistics.publisher.BAMUsageDataPublisher;
import org.apache.stratos.cloud.controller.messaging.topology.TopologyBuilder;
import org.apache.stratos.cloud.controller.util.CloudControllerUtil;
-import org.apache.stratos.common.constants.StratosConstants;
+
import org.apache.stratos.messaging.domain.topology.MemberStatus;
import java.util.Properties;
@@ -107,124 +106,4 @@ public class CloudControllerServiceUtil {
validatePartitionAndGetIaasProvider(partition, iaasProvider);
return true;
}
-
- /**
- * Validates deployment policy. This method will not validate whether the deployment policy is already deployed or not.
- * Reason is this method has to be used in add/update deployment policy APIs which have different view on "already deployed deployment policies".
- * It is the caller's responsibility to validate whether the deployment policy is already deployed or not.
- * @param deploymentPolicy the {@link DeploymentPolicy} to be validated
- * @throws InvalidDeploymentPolicyException will be thrown if the given {@link DeploymentPolicy} is not valid
- */
- public static void validateDeploymentPolicy(DeploymentPolicy deploymentPolicy) throws InvalidDeploymentPolicyException {
-
- // deployment policy can't be null
- if (null == deploymentPolicy) {
- String msg = "Invalid deployment policy. Cause -> Deployment policy is null";
- log.error(msg);
- throw new InvalidDeploymentPolicyException(msg);
- }
-
- if (log.isInfoEnabled()) {
- log.info(String.format("Validating deployment policy %s", deploymentPolicy.toString()));
- }
-
- // deployment policy id can't be null or empty
- if (null == deploymentPolicy.getDeploymentPolicyID() || deploymentPolicy.getDeploymentPolicyID().isEmpty()) {
- String msg = String.format("Invalid deployment policy. Cause -> Invalid deployment policy id [deployment-policy-id] %s",
- deploymentPolicy.getDeploymentPolicyID());
- log.error(msg);
- throw new InvalidDeploymentPolicyException(msg);
- }
-
- // deployment policy should contain at least one network partition reference
- if (null == deploymentPolicy.getNetworkPartitionsRef() || deploymentPolicy.getNetworkPartitionsRef().length == 0) {
- String msg = String.format("Invalid deployment policy - [deployment-policy-id] %s. "
- + "Cause -> Deployment policy doesn't have at least one network partition reference",
- deploymentPolicy.getDeploymentPolicyID());
- log.error(msg);
- throw new InvalidDeploymentPolicyException(msg);
- }
-
- // validate each network partition references
- for (NetworkPartitionRef networkPartitionRef : deploymentPolicy.getNetworkPartitionsRef()) {
-
- // network partition id can't be null or empty
- if (null == networkPartitionRef.getId() || networkPartitionRef.getId().isEmpty()) {
- String msg = String.format("Invalid deployment policy - [deployment-policy-id] %s. "
- + "Cause -> Invalid network partition id in network partition references section",
- deploymentPolicy.getDeploymentPolicyID());
- log.error(msg);
- throw new InvalidDeploymentPolicyException(msg);
- }
-
- // network partitions should be already added
- if (null == CloudControllerContext.getInstance().getNetworkPartition(networkPartitionRef.getId())) {
- String msg = String.format("Invalid deployment policy - [deployment-policy-id] %s. "
- + "Cause -> Network partition is not added - [network-partition-id] %s",
- deploymentPolicy.getDeploymentPolicyID(), networkPartitionRef.getId());
- log.error(msg);
- throw new InvalidDeploymentPolicyException(msg);
- }
-
- // partition algorithm can't be null or empty
- if (null == networkPartitionRef.getPartitionAlgo() || networkPartitionRef.getPartitionAlgo().isEmpty()) {
- String msg = String.format("Invalid deployment policy - [deployment-policy-id] %s. "
- + "Cause -> Invalid partition algorithm - [network-partition-id] %s [partition-algo] %s",
- deploymentPolicy.getDeploymentPolicyID(), networkPartitionRef.getId(), networkPartitionRef.getPartitionAlgo());
- log.error(msg);
- throw new InvalidDeploymentPolicyException(msg);
- }
-
- // partition algorithm should be either one-after-another or round-robin
- if (!StratosConstants.PARTITION_ROUND_ROBIN_ALGORITHM_ID.equals(networkPartitionRef.getPartitionAlgo())
- && !StratosConstants.PARTITION_ONE_AFTER_ANOTHER_ALGORITHM_ID.equals(networkPartitionRef.getPartitionAlgo())) {
- String msg = String.format("Invalid deployment policy - [deployment-policy-id] %s. "
- + "Cause -> Invalid partition algorithm - [network-partition-id] %s [partition-algo] %s",
- deploymentPolicy.getDeploymentPolicyID(), networkPartitionRef.getId(), networkPartitionRef.getPartitionAlgo());
- log.error(msg);
- throw new InvalidDeploymentPolicyException(msg);
- }
-
- // a network partition reference should contain at least one partition reference
- if (null == networkPartitionRef.getPartitions() || networkPartitionRef.getPartitions().length == 0) {
- String msg = String.format("Invalid deployment policy - [deployment-policy-id] %s. "
- + "Cause -> Network partition reference doesn't have at lease one partition reference - "
- + "[network-partition-id] %s", deploymentPolicy.getDeploymentPolicyID(), networkPartitionRef.getId());
- log.error(msg);
- throw new InvalidDeploymentPolicyException(msg);
- }
-
- // validate each partition reference defined in network partition reference
- for (PartitionRef partitionRef : networkPartitionRef.getPartitions()) {
-
- // partition id can't be null or empty
- if (null == partitionRef.getId() || partitionRef.getId().isEmpty()) {
- String msg = String.format("Invalid deployment policy - [deployment-policy-id] %s. "
- + "Cause -> Invalid partition id for a partition defined in the netwok partition - [network-partition-id] %s",
- deploymentPolicy.getDeploymentPolicyID(), networkPartitionRef.getId());
- log.error(msg);
- throw new InvalidDeploymentPolicyException(msg);
- }
-
- // partition should be defined in the relevant network partitions (on network partition deployment)
- NetworkPartition networkPartition = CloudControllerContext.getInstance().getNetworkPartition(networkPartitionRef.getId());
- if (null == networkPartition.getPartition(partitionRef.getId())) {
- String msg = String.format("Invalid deployment policy - [deployment-policy-id] %s. "
- + "Cause -> Partition not found in the network partition definition - [network-partition-id] %s [partition-id] %s",
- deploymentPolicy.getDeploymentPolicyID(), networkPartitionRef.getId(), partitionRef.getId());
- log.error(msg);
- throw new InvalidDeploymentPolicyException(msg);
- }
-
- // partition reference should have a valid max value
- if (partitionRef.getMax() <= 0) {
- String msg = String.format("Invalid deployment policy - [deployment-policy-id] %s. "
- + "Cause -> Partition max value is not valid - [network-partition-id] %s [partition-id] %s [max-value] %s",
- deploymentPolicy.getDeploymentPolicyID(), networkPartitionRef.getId(), partitionRef.getId(), partitionRef.getMax());
- log.error(msg);
- throw new InvalidDeploymentPolicyException(msg);
- }
- }
- }
- }
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/886553bd/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/InstanceCreator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/InstanceCreator.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/InstanceCreator.java
index e8d2c77..49065c9 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/InstanceCreator.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/InstanceCreator.java
@@ -28,6 +28,7 @@ import org.apache.stratos.cloud.controller.exception.CartridgeNotFoundException;
import org.apache.stratos.cloud.controller.iaases.Iaas;
import org.apache.stratos.cloud.controller.statistics.publisher.BAMUsageDataPublisher;
import org.apache.stratos.cloud.controller.messaging.topology.TopologyBuilder;
+import org.apache.stratos.cloud.controller.domain.Partition;
import org.apache.stratos.messaging.domain.topology.MemberStatus;
import java.util.concurrent.locks.Lock;
[09/20] stratos git commit: Deployment policy move:Registry manager
and CC client is updated
Posted by la...@apache.org.
Deployment policy move:Registry manager and CC client is updated
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/dc761492
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/dc761492
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/dc761492
Branch: refs/heads/master
Commit: dc7614920919c07399b12da6b73248ac89d1e0ba
Parents: abb01bd
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Tue Apr 7 08:07:00 2015 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Tue Apr 7 08:07:00 2015 +0530
----------------------------------------------------------------------
.../client/CloudControllerClient.java | 5 +-
.../autoscaler/registry/RegistryManager.java | 65 +++++++++++++++++---
2 files changed, 61 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/dc761492/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 8808498..d242b23 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
@@ -27,17 +27,18 @@ import org.apache.stratos.autoscaler.applications.pojo.ApplicationClusterContext
import org.apache.stratos.autoscaler.applications.pojo.VolumeContext;
import org.apache.stratos.autoscaler.exception.cartridge.SpawningException;
import org.apache.stratos.autoscaler.util.AutoscalerConstants;
+import org.apache.stratos.autoscaler.util.AutoscalerObjectConverter;
import org.apache.stratos.autoscaler.util.AutoscalerUtil;
import org.apache.stratos.autoscaler.util.ConfUtil;
import org.apache.stratos.cloud.controller.stub.*;
import org.apache.stratos.cloud.controller.stub.domain.Cartridge;
import org.apache.stratos.cloud.controller.stub.domain.InstanceContext;
import org.apache.stratos.cloud.controller.stub.domain.MemberContext;
-import org.apache.stratos.cloud.controller.stub.domain.Partition;
import org.apache.stratos.cloud.controller.stub.domain.Volume;
import org.apache.stratos.common.Properties;
import org.apache.stratos.common.Property;
import org.apache.stratos.common.constants.StratosConstants;
+import org.apache.stratos.common.partition.Partition;
import java.rmi.RemoteException;
import java.util.ArrayList;
@@ -101,7 +102,7 @@ public class CloudControllerClient {
InstanceContext instanceContext = new InstanceContext();
instanceContext.setClusterId(clusterId);
instanceContext.setClusterInstanceId(clusterInstanceId);
- instanceContext.setPartition(partition);
+ instanceContext.setPartition(AutoscalerObjectConverter.convertPartitionToCCPartition(partition));
instanceContext.setInitTime(System.currentTimeMillis());
instanceContext.setObsoleteExpiryTime(expiryTime);
instanceContext.setNetworkPartitionId(networkPartitionId);
http://git-wip-us.apache.org/repos/asf/stratos/blob/dc761492/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java
index b1ae493..2fc6d08 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java
@@ -39,6 +39,7 @@ import org.wso2.carbon.registry.core.Resource;
import org.wso2.carbon.registry.core.exceptions.RegistryException;
import org.wso2.carbon.registry.core.exceptions.ResourceNotFoundException;
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
+import org.apache.stratos.autoscaler.pojo.policy.deployment.DeploymentPolicy;
import java.io.IOException;
import java.util.ArrayList;
@@ -159,6 +160,14 @@ public class RegistryManager {
}
}
+ public void persistDeploymentPolicy(DeploymentPolicy deploymentPolicy) {
+ String resourcePath = AutoscalerConstants.AUTOSCALER_RESOURCE + AutoscalerConstants.DEPLOYMENT_POLICY_RESOURCE + "/" + deploymentPolicy.getDeploymentPolicyID();
+ persist(deploymentPolicy, resourcePath);
+ if (log.isDebugEnabled()) {
+ log.debug(String.format("Deployment policy written to registry: %s", deploymentPolicy.toString()));
+ }
+ }
+
public void persistAutoscalerPolicy(AutoscalePolicy autoscalePolicy) {
try {
startTenantFlow();
@@ -379,7 +388,39 @@ public class RegistryManager {
endTenantFlow();
}
}
-
+
+ public List<DeploymentPolicy> retrieveDeploymentPolicies() {
+ List<DeploymentPolicy> depPolicyList = new ArrayList<DeploymentPolicy>();
+ RegistryManager registryManager = RegistryManager.getInstance();
+ String[] depPolicyResourceList = (String[]) registryManager.retrieve(AutoscalerConstants.AUTOSCALER_RESOURCE
+ + AutoscalerConstants.DEPLOYMENT_POLICY_RESOURCE);
+
+ if (depPolicyResourceList != null) {
+ DeploymentPolicy depPolicy;
+ for (String resourcePath : depPolicyResourceList) {
+ Object serializedObj = registryManager.retrieve(resourcePath);
+ if (serializedObj != null) {
+ try {
+ Object dataObj = Deserializer.deserializeFromByteArray((byte[]) serializedObj);
+ if (dataObj instanceof DeploymentPolicy) {
+ depPolicy = (DeploymentPolicy) dataObj;
+ if (log.isDebugEnabled()) {
+ log.debug(depPolicy.toString());
+ }
+ depPolicyList.add(depPolicy);
+ } else {
+ return null;
+ }
+ } catch (Exception e) {
+ String msg = "Unable to retrieve data from Registry. Hence, any historical deployment policies will not get reflected.";
+ log.warn(msg, e);
+ }
+ }
+ }
+ }
+ return depPolicyList;
+ }
+
public List<ApplicationPolicy> retrieveApplicationPolicies() {
try {
startTenantFlow();
@@ -417,7 +458,7 @@ public class RegistryManager {
endTenantFlow();
}
}
-
+
public List<NetworkPartitionAlgorithmContext> retrieveNetworkPartitionAlgorithmContexts() {
try {
startTenantFlow();
@@ -557,7 +598,17 @@ public class RegistryManager {
endTenantFlow();
}
}
-
+
+ public void removeDeploymentPolicy(String deploymentPolicyID) {
+ String resourcePath = AutoscalerConstants.AUTOSCALER_RESOURCE + AutoscalerConstants.DEPLOYMENT_POLICY_RESOURCE + "/" +
+ deploymentPolicyID;
+ this.delete(resourcePath);
+ if (log.isDebugEnabled()) {
+ log.debug(String.format("Deployment policy deleted from registry: [id] %s",
+ deploymentPolicyID));
+ }
+ }
+
public void removeApplicationPolicy(String applicationPolicyId) {
try {
startTenantFlow();
@@ -571,7 +622,7 @@ public class RegistryManager {
endTenantFlow();
}
}
-
+
public void removeNetworkPartitionAlgorithmContext(String applicationPolicyId) {
try {
startTenantFlow();
@@ -586,7 +637,7 @@ public class RegistryManager {
}
}
- public void persistApplicationPolicy(ApplicationPolicy applicationPolicy) {
+ public void persistApplicationPolicy(ApplicationPolicy applicationPolicy) {
try {
startTenantFlow();
String resourcePath = AutoscalerConstants.AUTOSCALER_RESOURCE +
@@ -599,8 +650,8 @@ public class RegistryManager {
endTenantFlow();
}
}
-
- public void persistNetworkPartitionAlgorithmContext(NetworkPartitionAlgorithmContext algorithmContext) {
+
+ public void persistNetworkPartitionAlgorithmContext(NetworkPartitionAlgorithmContext algorithmContext) {
try {
startTenantFlow();
String applicationId = algorithmContext.getApplicationId();
[12/20] stratos git commit: Deployment policy move:replace max with
partitionMax in test classes
Posted by la...@apache.org.
Deployment policy move:replace max with partitionMax in test classes
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/cdd26720
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/cdd26720
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/cdd26720
Branch: refs/heads/master
Commit: cdd26720cf5cf7d83ecae5992fcc7dc431117acf
Parents: 520b940
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Tue Apr 7 08:10:26 2015 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Tue Apr 7 08:10:26 2015 +0530
----------------------------------------------------------------------
.../src/test/resources/deployment-policy.xml | 4 ++--
.../src/test/resources/partition.xml | 2 +-
.../src/test/resources/partitions.xml | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/cdd26720/components/org.apache.stratos.autoscaler/src/test/resources/deployment-policy.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/test/resources/deployment-policy.xml b/components/org.apache.stratos.autoscaler/src/test/resources/deployment-policy.xml
index e4ca79e..d14fadd 100644
--- a/components/org.apache.stratos.autoscaler/src/test/resources/deployment-policy.xml
+++ b/components/org.apache.stratos.autoscaler/src/test/resources/deployment-policy.xml
@@ -5,11 +5,11 @@
<partition id="P1" >
<provider>ec2</provider>
<property name="region" value="ap-southeast-1"/>
- <max>3</max>
+ <partitionMax>3</partitionMax>
<min>1</min>
</partition>
<!--partition id="P2" >
- <max>5</max>
+ <partitionMax>5</partitionMax>
<min>1</min>
</partition-->
</partitionGroup>
http://git-wip-us.apache.org/repos/asf/stratos/blob/cdd26720/components/org.apache.stratos.autoscaler/src/test/resources/partition.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/test/resources/partition.xml b/components/org.apache.stratos.autoscaler/src/test/resources/partition.xml
index 8377abc..fcff113 100644
--- a/components/org.apache.stratos.autoscaler/src/test/resources/partition.xml
+++ b/components/org.apache.stratos.autoscaler/src/test/resources/partition.xml
@@ -4,7 +4,7 @@
<provider>ec2</provider>
<property name="region" value="ap-southeast-1"/>
<property name="zone" value="ap-southeast-1-a"/>
- <max>3</max>
+ <partitionMax>3</partitionMax>
<min>1</min>
</partition>
</partitions>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/cdd26720/components/org.apache.stratos.autoscaler/src/test/resources/partitions.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/test/resources/partitions.xml b/components/org.apache.stratos.autoscaler/src/test/resources/partitions.xml
index a41d633..1c26e84 100644
--- a/components/org.apache.stratos.autoscaler/src/test/resources/partitions.xml
+++ b/components/org.apache.stratos.autoscaler/src/test/resources/partitions.xml
@@ -3,13 +3,13 @@
<partition id="P1" >
<provider>ec2</provider>
<property name="region" value="ap-southeast-1"/>
- <max>3</max>
+ <partitionMax>3</partitionMax>
<min>1</min>
</partition>
<partition id="P2" >
<provider>openstack</provider>
<property name="region" value="region-1"/>
- <max>5</max>
+ <partitionMax>5</partitionMax>
<min>1</min>
</partition>
</partitions>
\ No newline at end of file
[05/20] stratos git commit: Deployment policy move:Remove deployment
policy persistence and util tasks
Posted by la...@apache.org.
Deployment policy move:Remove deployment policy persistence and util tasks
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/c9940dd0
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/c9940dd0
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/c9940dd0
Branch: refs/heads/master
Commit: c9940dd0c3da5ef8cf51c22c53126be9f33353e3
Parents: af2c64c
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Tue Apr 7 07:55:36 2015 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Tue Apr 7 07:55:36 2015 +0530
----------------------------------------------------------------------
.../concurrent/PartitionValidatorCallable.java | 2 +-
.../context/CloudControllerContext.java | 46 +++++---------------
.../cloud/controller/iaases/JcloudsIaas.java | 1 +
.../iaases/kubernetes/KubernetesIaas.java | 1 +
.../controller/util/CloudControllerUtil.java | 3 +-
5 files changed, 16 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/c9940dd0/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/concurrent/PartitionValidatorCallable.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/concurrent/PartitionValidatorCallable.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/concurrent/PartitionValidatorCallable.java
index 04aefb1..2f73f8f 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/concurrent/PartitionValidatorCallable.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/concurrent/PartitionValidatorCallable.java
@@ -23,9 +23,9 @@ import java.util.concurrent.Callable;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.cloud.controller.context.CloudControllerContext;
-import org.apache.stratos.cloud.controller.domain.Partition;
import org.apache.stratos.cloud.controller.domain.Cartridge;
import org.apache.stratos.cloud.controller.domain.IaasProvider;
+import org.apache.stratos.cloud.controller.domain.Partition;
import org.apache.stratos.cloud.controller.services.impl.CloudControllerServiceUtil;
public class PartitionValidatorCallable implements Callable<IaasProvider> {
http://git-wip-us.apache.org/repos/asf/stratos/blob/c9940dd0/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/context/CloudControllerContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/context/CloudControllerContext.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/context/CloudControllerContext.java
index ccbd763..52036c5 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/context/CloudControllerContext.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/context/CloudControllerContext.java
@@ -32,6 +32,7 @@ import org.apache.stratos.cloud.controller.exception.NonExistingKubernetesHostEx
import org.apache.stratos.cloud.controller.internal.ServiceReferenceHolder;
import org.apache.stratos.cloud.controller.registry.RegistryManager;
import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
+import org.apache.stratos.cloud.controller.domain.NetworkPartition;
import org.apache.stratos.common.services.DistributedObjectProvider;
import org.apache.stratos.common.threading.StratosThreadPool;
import org.wso2.carbon.databridge.agent.thrift.AsyncDataPublisher;
@@ -61,7 +62,6 @@ public class CloudControllerContext implements Serializable {
private static final String CC_CARTRIDGE_TYPE_TO_PARTITION_IDS_MAP = "CC_CARTRIDGE_TYPE_TO_PARTITION_IDS_MAP";
private static final String CC_CARTRIDGE_TYPE_TO_CARTRIDGES_MAP = "CC_CARTRIDGE_TYPE_TO_CARTRIDGES_MAP";
private static final String CC_SERVICE_GROUP_NAME_TO_SERVICE_GROUP_MAP = "CC_SERVICE_GROUP_NAME_TO_SERVICE_GROUP_MAP";
- private static final String CC_DEPLOYMENT_POLICY_ID_TO_DEPLOYMENT_POLICY_MAP = "CC_DEPLOYMENT_POLICY_ID_TO_DEPLOYMENT_POLICY_MAP";
private static final String CC_NETWORK_PARTITION_ID_TO_NETWORK_PARTITION_MAP = "CC_NETWORK_PARTITION_ID_TO_NETWORK_PARTITION_MAP";
private static final String CC_CLUSTER_CTX_WRITE_LOCK = "CC_CLUSTER_CTX_WRITE_LOCK";
@@ -145,13 +145,6 @@ public class CloudControllerContext implements Serializable {
private Map<String, ServiceGroup> serviceGroupNameToServiceGroupMap;
/**
- * Map of deploy policy
- * Key - deployment policy id
- * Value deployment policy
- */
- private Map<String, DeploymentPolicy> deploymentPolicyIDToDeployPolicyMap;
-
- /**
* Map of network partitions
* Key - network partition id
* Value network partition
@@ -199,7 +192,6 @@ public class CloudControllerContext implements Serializable {
cartridgeTypeToPartitionIdsMap = distributedObjectProvider.getMap(CC_CARTRIDGE_TYPE_TO_PARTITION_IDS_MAP);
cartridgeTypeToCartridgeMap = distributedObjectProvider.getMap(CC_CARTRIDGE_TYPE_TO_CARTRIDGES_MAP);
serviceGroupNameToServiceGroupMap = distributedObjectProvider.getMap(CC_SERVICE_GROUP_NAME_TO_SERVICE_GROUP_MAP);
- deploymentPolicyIDToDeployPolicyMap=distributedObjectProvider.getMap(CC_DEPLOYMENT_POLICY_ID_TO_DEPLOYMENT_POLICY_MAP);
networkPartitionIDToNetworkPartitionMap = distributedObjectProvider.getMap(CC_NETWORK_PARTITION_ID_TO_NETWORK_PARTITION_MAP);
partitionToIaasProviderByCartridge = distributedObjectProvider.getMap(CC_PARTITION_TO_IAAS_PROVIDER_BY_CARTRIDGE_MAP);
cartridgeTypeToIaasProviders = distributedObjectProvider.getMap(CC_CARTRIDGE_TYPE_TO_IAAS_PROVIDER_MAP);
@@ -282,24 +274,6 @@ public class CloudControllerContext implements Serializable {
cartridgeTypeToCartridgeMap.put(cartridge.getType(), cartridge);
}
- public void addDeploymentPolicy(DeploymentPolicy deploymentPolicy) {
- deploymentPolicyIDToDeployPolicyMap.put(deploymentPolicy.getDeploymentPolicyID(), deploymentPolicy);
- }
-
- public DeploymentPolicy getDeploymentPolicy(String deploymentPolicyID) {
- return deploymentPolicyIDToDeployPolicyMap.get(deploymentPolicyID);
- }
-
- public Collection<DeploymentPolicy> getDeploymentPolicies() {
- return deploymentPolicyIDToDeployPolicyMap.values();
- }
-
- public void removeDeploymentPolicy(String deploymentPolicyID) {
- if (deploymentPolicyIDToDeployPolicyMap.containsKey(deploymentPolicyID)) {
- deploymentPolicyIDToDeployPolicyMap.remove(deploymentPolicyID);
- }
- }
-
public void addNetworkPartition(NetworkPartition networkPartition) {
networkPartitionIDToNetworkPartitionMap.put(networkPartition.getId(), networkPartition);
}
@@ -709,7 +683,6 @@ public class CloudControllerContext implements Serializable {
copyMap(serializedObj.cartridgeTypeToPartitionIdsMap, cartridgeTypeToPartitionIdsMap);
copyMap(serializedObj.cartridgeTypeToCartridgeMap, cartridgeTypeToCartridgeMap);
copyMap(serializedObj.serviceGroupNameToServiceGroupMap, serviceGroupNameToServiceGroupMap);
- copyMap(serializedObj.deploymentPolicyIDToDeployPolicyMap, deploymentPolicyIDToDeployPolicyMap);
copyMap(serializedObj.networkPartitionIDToNetworkPartitionMap, networkPartitionIDToNetworkPartitionMap);
if (log.isDebugEnabled()) {
@@ -756,18 +729,23 @@ public class CloudControllerContext implements Serializable {
}
public void addIaasProviders(String cartridgeType, Map<String, IaasProvider> map) {
- Map<String, IaasProvider> partitionToIaasProviders = new ConcurrentHashMap<String, IaasProvider>();
+ Map<String, IaasProvider> partitionToIaasProviders;
+ if(partitionToIaasProviderByCartridge.get(cartridgeType) != null) {
+ partitionToIaasProviders = partitionToIaasProviderByCartridge.get(cartridgeType);
+ } else {
+ partitionToIaasProviders = new ConcurrentHashMap<String, IaasProvider>();
+ }
for (Iterator<String> iterator = map.keySet().iterator(); iterator.hasNext(); ) {
String key = iterator.next();
IaasProvider value = map.get(key);
partitionToIaasProviders.put(key, value);
- if (log.isDebugEnabled()) {
- log.debug("Partition map updated for the Cartridge: " + cartridgeType + ". "
- + "Current Partition List: " + partitionToIaasProviders.keySet().toString());
- }
}
- this.partitionToIaasProviderByCartridge.put(cartridgeType, partitionToIaasProviders);
+ partitionToIaasProviderByCartridge.put(cartridgeType, partitionToIaasProviders);
+ if (log.isInfoEnabled()) {
+ log.info("Partition map updated for the Cartridge: " + cartridgeType + ". "
+ + "Current Partition List: " + partitionToIaasProviderByCartridge.get(cartridgeType).keySet().toString());
+ }
}
public IaasProvider getIaasProviderOfPartition(String cartridgeType, String partitionId) {
http://git-wip-us.apache.org/repos/asf/stratos/blob/c9940dd0/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/JcloudsIaas.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/JcloudsIaas.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/JcloudsIaas.java
index f1c8448..7956528 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/JcloudsIaas.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/JcloudsIaas.java
@@ -30,6 +30,7 @@ import org.apache.stratos.cloud.controller.exception.InvalidIaasProviderExceptio
import org.apache.stratos.cloud.controller.exception.InvalidMemberException;
import org.apache.stratos.cloud.controller.services.impl.CloudControllerServiceUtil;
import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
+
import org.jclouds.compute.ComputeService;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.NodeMetadataBuilder;
http://git-wip-us.apache.org/repos/asf/stratos/blob/c9940dd0/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/kubernetes/KubernetesIaas.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/kubernetes/KubernetesIaas.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/kubernetes/KubernetesIaas.java
index e557692..554ea6c 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/kubernetes/KubernetesIaas.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/kubernetes/KubernetesIaas.java
@@ -33,6 +33,7 @@ import org.apache.stratos.cloud.controller.exception.*;
import org.apache.stratos.cloud.controller.iaases.Iaas;
import org.apache.stratos.cloud.controller.iaases.PartitionValidator;
import org.apache.stratos.cloud.controller.util.CloudControllerUtil;
+import org.apache.stratos.cloud.controller.domain.Partition;
import org.apache.stratos.common.Property;
import org.apache.stratos.common.constants.StratosConstants;
import org.apache.stratos.common.domain.NameValuePair;
http://git-wip-us.apache.org/repos/asf/stratos/blob/c9940dd0/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
index 4619341..400b389 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
@@ -32,6 +32,7 @@ import org.apache.stratos.cloud.controller.exception.InvalidKubernetesHostExcept
import org.apache.stratos.cloud.controller.exception.InvalidKubernetesMasterException;
import org.apache.stratos.cloud.controller.iaases.Iaas;
import org.apache.stratos.cloud.controller.registry.RegistryManager;
+
import org.apache.stratos.common.Property;
import org.apache.stratos.cloud.controller.domain.kubernetes.KubernetesCluster;
import org.apache.stratos.cloud.controller.domain.kubernetes.KubernetesHost;
@@ -43,11 +44,9 @@ import org.wso2.carbon.registry.core.exceptions.RegistryException;
import com.google.common.net.InetAddresses;
import java.lang.reflect.Constructor;
-import java.util.Arrays;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
[20/20] stratos git commit: Fix NPE occurs due to passing wrong
partition object
Posted by la...@apache.org.
Fix NPE occurs due to passing wrong partition object
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/53ad7f4b
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/53ad7f4b
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/53ad7f4b
Branch: refs/heads/master
Commit: 53ad7f4b5afdef4cbb4d2a49983c40c8b4450c28
Parents: ea98c48
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Tue Apr 7 08:27:36 2015 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Tue Apr 7 08:27:36 2015 +0530
----------------------------------------------------------------------
.../apache/stratos/autoscaler/context/cluster/ClusterContext.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/53ad7f4b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContext.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContext.java
index c9996dd..296e43f 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContext.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContext.java
@@ -297,7 +297,7 @@ public class ClusterContext extends AbstractClusterContext {
//Creating cluster level partition context
ClusterLevelPartitionContext clusterLevelPartitionContext = new ClusterLevelPartitionContext(
maxInstances,
- partition,
+ partition3,
clusterInstance.getNetworkPartitionId());
clusterLevelPartitionContext.setServiceName(cluster.getServiceName());
clusterLevelPartitionContext.setProperties(cluster.getProperties());
[04/20] stratos git commit: Remove isLb parameter
Posted by la...@apache.org.
Remove isLb parameter
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/af2c64c1
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/af2c64c1
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/af2c64c1
Branch: refs/heads/master
Commit: af2c64c18e1941149df061e15be2675682afebd2
Parents: 443367a
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Tue Apr 7 07:54:39 2015 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Tue Apr 7 07:54:39 2015 +0530
----------------------------------------------------------------------
.../cloud/controller/messaging/topology/TopologyBuilder.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/af2c64c1/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
index abc0d91..b3ff4e8 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
@@ -328,7 +328,7 @@ public class TopologyBuilder {
- public static void handleClusterCreated(Registrant registrant, boolean isLb) {
+ public static void handleClusterCreated(Registrant registrant) {
/*Topology topology = TopologyManager.getTopology();
Service service;
try {
[14/20] stratos git commit: Deployment policy move:common clients
updated
Posted by la...@apache.org.
Deployment policy move:common clients updated
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/6fccb2cb
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/6fccb2cb
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/6fccb2cb
Branch: refs/heads/master
Commit: 6fccb2cb5c4ae76da5b2ea49454a9e92da27a210
Parents: 9b92792
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Tue Apr 7 08:12:18 2015 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Tue Apr 7 08:12:18 2015 +0530
----------------------------------------------------------------------
.../common/client/AutoscalerServiceClient.java | 27 +++++++++++++++++
.../client/CloudControllerServiceClient.java | 32 ++------------------
2 files changed, 30 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/6fccb2cb/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/AutoscalerServiceClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/AutoscalerServiceClient.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/AutoscalerServiceClient.java
index 9a95a36..ca1fb12 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/AutoscalerServiceClient.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/AutoscalerServiceClient.java
@@ -26,6 +26,7 @@ import org.apache.commons.logging.LogFactory;
import org.apache.stratos.autoscaler.stub.*;
import org.apache.stratos.autoscaler.stub.autoscale.policy.AutoscalePolicy;
import org.apache.stratos.autoscaler.stub.deployment.policy.ApplicationPolicy;
+import org.apache.stratos.autoscaler.stub.deployment.policy.DeploymentPolicy;
import org.apache.stratos.autoscaler.stub.pojo.ApplicationContext;
import org.apache.stratos.autoscaler.stub.pojo.ServiceGroup;
import org.apache.stratos.common.constants.StratosConstants;
@@ -185,4 +186,30 @@ public class AutoscalerServiceClient {
public String findClusterId(String applicationId, String alias) throws RemoteException {
return stub.findClusterId(applicationId, alias);
}
+
+ public void addDeploymentPolicy(DeploymentPolicy deploymentPolicy) throws RemoteException,
+ AutoscalerServiceDeploymentPolicyNotExistsExceptionException, AutoscalerServiceRemoteExceptionException,
+ AutoscalerServiceInvalidDeploymentPolicyExceptionException, AutoscalerServiceDeploymentPolicyAlreadyExistsExceptionException {
+ stub.addDeployementPolicy(deploymentPolicy);
+ }
+
+ public void updateDeploymentPolicy(DeploymentPolicy deploymentPolicy) throws RemoteException,
+ AutoscalerServiceDeploymentPolicyNotExistsExceptionException,
+ AutoscalerServiceInvalidDeploymentPolicyExceptionException, AutoscalerServiceRemoteExceptionException {
+ stub.updateDeployementPolicy(deploymentPolicy);
+ }
+
+ public void removeDeploymentPolicy(String deploymentPolicyID) throws RemoteException,
+ AutoscalerServiceDeploymentPolicyNotExistsExceptionException {
+ stub.removeDeployementPolicy(deploymentPolicyID);
+ }
+
+ public DeploymentPolicy getDeploymentPolicy(String deploymentPolicyID) throws RemoteException {
+ return stub.getDeploymentPolicy(deploymentPolicyID);
+ }
+
+ public DeploymentPolicy[] getDeploymentPolicies() throws RemoteException{
+ return stub.getDeploymentPolicies();
+ }
+
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6fccb2cb/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/CloudControllerServiceClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/CloudControllerServiceClient.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/CloudControllerServiceClient.java
index ebfaa80..cdb92e0 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/CloudControllerServiceClient.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/CloudControllerServiceClient.java
@@ -211,41 +211,15 @@ public class CloudControllerServiceClient {
CloudControllerServiceNonExistingKubernetesHostExceptionException {
return stub.updateKubernetesHost(kubernetesHost);
}
-
- public void addDeploymentPolicy(DeploymentPolicy deploymentPolicy)
- throws CloudControllerServiceDeploymentPolicyAlreadyExistsExceptionException, RemoteException,
- CloudControllerServiceInvalidDeploymentPolicyExceptionException {
- stub.addDeployementPolicy(deploymentPolicy);
- }
-
- public void updateDeploymentPolicy(DeploymentPolicy deploymentPolicy)
- throws CloudControllerServiceDeploymentPolicyNotExistsExceptionException, RemoteException,
- CloudControllerServiceInvalidDeploymentPolicyExceptionException {
- stub.updateDeployementPolicy(deploymentPolicy);
- }
-
- public void removeDeploymentPolicy(String deploymentPolicyID)
- throws CloudControllerServiceDeploymentPolicyNotExistsExceptionException, RemoteException {
- stub.removeDeployementPolicy(deploymentPolicyID);
- }
-
- public DeploymentPolicy getDeploymentPolicy(String deploymentPolicyID)
- throws CloudControllerServiceDeploymentPolicyNotExistsExceptionException, RemoteException {
- return stub.getDeploymentPolicy(deploymentPolicyID);
- }
-
- public DeploymentPolicy[] getDeploymentPolicies() throws RemoteException{
- return stub.getDeploymentPolicies();
- }
- public void validateDeploymentPolicy(String cartridgeType, Partition[] partitions)
+ public void validateDeploymentPolicy(String cartridgeType, String networkPartitionId)
throws RemoteException,
CloudControllerServiceInvalidPartitionExceptionException,
CloudControllerServiceInvalidCartridgeTypeExceptionException {
- stub.validateDeploymentPolicy(cartridgeType, partitions);
+ stub.validateDeploymentPolicyNetworkPartition(cartridgeType, networkPartitionId);
}
- public void addNetworkPartition(NetworkPartition networkPartition) throws RemoteException,
+ public void addNetworkPartition(NetworkPartition networkPartition) throws RemoteException,
CloudControllerServiceNetworkPartitionAlreadyExistsExceptionException {
stub.addNetworkPartition(networkPartition);
}
[13/20] stratos git commit: Deployment policy move:common classes
beans updated
Posted by la...@apache.org.
Deployment policy move:common classes beans updated
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/9b92792a
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/9b92792a
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/9b92792a
Branch: refs/heads/master
Commit: 9b92792a343aa1af5775d44022e6d7fb281b0a71
Parents: cdd2672
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Tue Apr 7 08:11:41 2015 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Tue Apr 7 08:11:41 2015 +0530
----------------------------------------------------------------------
.../common/beans/partition/NetworkPartitionBean.java | 9 +++++++++
.../stratos/common/beans/partition/PartitionBean.java | 9 +++++++++
.../beans/policy/deployment/DeploymentPolicyBean.java | 8 ++++----
3 files changed, 22 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/9b92792a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/NetworkPartitionBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/NetworkPartitionBean.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/NetworkPartitionBean.java
index 95a22fa..b2bc015 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/NetworkPartitionBean.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/NetworkPartitionBean.java
@@ -28,6 +28,7 @@ public class NetworkPartitionBean {
private String id;
private String provider;
private List<PartitionBean> partitions;
+ private String partitionAlgo;
public String getId() {
return id;
@@ -52,4 +53,12 @@ public class NetworkPartitionBean {
public void setProvider(String provider) {
this.provider = provider;
}
+
+ public String getPartitionAlgo() {
+ return partitionAlgo;
+ }
+
+ public void setPartitionAlgo(String partitionAlgo) {
+ this.partitionAlgo = partitionAlgo;
+ }
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/9b92792a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/PartitionBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/PartitionBean.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/PartitionBean.java
index a94cdfc..1354f1c 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/PartitionBean.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/PartitionBean.java
@@ -32,6 +32,7 @@ public class PartitionBean {
private boolean isPublic;
private String kubernetesClusterId;
private List<PropertyBean> property;
+ private int partitionMax;
public String getId() {
return id;
@@ -76,4 +77,12 @@ public class PartitionBean {
public void setKubernetesClusterId(String kubernetesClusterId) {
this.kubernetesClusterId = kubernetesClusterId;
}
+
+ public int getPartitionMax() {
+ return partitionMax;
+ }
+
+ public void setPartitionMax(int partitionMax) {
+ this.partitionMax = partitionMax;
+ }
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/9b92792a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/policy/deployment/DeploymentPolicyBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/policy/deployment/DeploymentPolicyBean.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/policy/deployment/DeploymentPolicyBean.java
index 4de9373..bf0513a 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/policy/deployment/DeploymentPolicyBean.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/policy/deployment/DeploymentPolicyBean.java
@@ -19,7 +19,7 @@
package org.apache.stratos.common.beans.policy.deployment;
-import org.apache.stratos.common.beans.partition.NetworkPartitionRefBean;
+import org.apache.stratos.common.beans.partition.NetworkPartitionBean;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;
@@ -29,7 +29,7 @@ public class DeploymentPolicyBean {
private String id;
- private List<NetworkPartitionRefBean> networkPartitions;
+ private List<NetworkPartitionBean> networkPartitions;
public String getId() {
return id;
@@ -39,11 +39,11 @@ public class DeploymentPolicyBean {
this.id = id;
}
- public List<NetworkPartitionRefBean> getNetworkPartitions() {
+ public List<NetworkPartitionBean> getNetworkPartitions() {
return networkPartitions;
}
- public void setNetworkPartitions(List<NetworkPartitionRefBean> networkPartitions) {
+ public void setNetworkPartitions(List<NetworkPartitionBean> networkPartitions) {
this.networkPartitions = networkPartitions;
}
}
[03/20] stratos git commit: Deployment policy move:Add partiton max
and partition algo to partition classes
Posted by la...@apache.org.
Deployment policy move:Add partiton max and partition algo to partition classes
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/443367ac
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/443367ac
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/443367ac
Branch: refs/heads/master
Commit: 443367ac919c775c2d6d6453a4821d51b3e1e33f
Parents: 886553b
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Tue Apr 7 07:51:20 2015 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Tue Apr 7 07:51:20 2015 +0530
----------------------------------------------------------------------
.../stratos/cloud/controller/domain/NetworkPartition.java | 9 +++++++++
.../apache/stratos/cloud/controller/domain/Partition.java | 9 +++++++++
2 files changed, 18 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/443367ac/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/NetworkPartition.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/NetworkPartition.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/NetworkPartition.java
index 9a8f67b..54be9b0 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/NetworkPartition.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/NetworkPartition.java
@@ -33,6 +33,7 @@ public class NetworkPartition implements Serializable {
private String provider;
private boolean activeByDefault;
private Partition[] partitions;
+ private String partitionAlgo;
public void setPartitions(Partition[] partitions) {
if(partitions == null) {
@@ -90,4 +91,12 @@ public class NetworkPartition implements Serializable {
public void setProvider(String provider) {
this.provider = provider;
}
+
+ public String getPartitionAlgo() {
+ return partitionAlgo;
+ }
+
+ public void setPartitionAlgo(String partitionAlgo) {
+ this.partitionAlgo = partitionAlgo;
+ }
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/443367ac/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/Partition.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/Partition.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/Partition.java
index c69d07a..4625a35 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/Partition.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/Partition.java
@@ -40,6 +40,7 @@ public class Partition implements Serializable {
private String description;
private boolean isPublic;
private Properties properties = new Properties();
+ private int partitionMax;
/**
* Gets the value of the id property.
@@ -150,4 +151,12 @@ public class Partition implements Serializable {
public int hashCode() {
return this.id.hashCode();
}
+
+ public int getPartitionMax() {
+ return partitionMax;
+ }
+
+ public void setPartitionMax(int partitionMax) {
+ this.partitionMax = partitionMax;
+ }
}
[16/20] stratos git commit: Deployment policy move: Update rest API
classes with updated back end
Posted by la...@apache.org.
Deployment policy move: Update rest API classes with updated back end
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/cad2fc90
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/cad2fc90
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/cad2fc90
Branch: refs/heads/master
Commit: cad2fc90a7d59cbae3c03a8c5fc6d98a690e4ebc
Parents: abf417f
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Tue Apr 7 08:14:48 2015 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Tue Apr 7 08:14:48 2015 +0530
----------------------------------------------------------------------
.../rest/endpoint/api/StratosApiV41Utils.java | 53 ++--
.../stratos/rest/endpoint/mock/MockContext.java | 30 +-
.../rest/endpoint/mock/StratosApiV40Mock.java | 4 +-
.../util/converter/ObjectConverter.java | 311 +++++++++++++------
4 files changed, 261 insertions(+), 137 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/cad2fc90/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
index 7ed3fdc..bfbb4ae 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
@@ -25,15 +25,17 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.autoscaler.stub.*;
import org.apache.stratos.autoscaler.stub.deployment.policy.ApplicationPolicy;
+import org.apache.stratos.autoscaler.stub.deployment.policy.DeploymentPolicy;
import org.apache.stratos.autoscaler.stub.pojo.ApplicationContext;
import org.apache.stratos.autoscaler.stub.pojo.ServiceGroup;
import org.apache.stratos.cloud.controller.stub.*;
-import org.apache.stratos.cloud.controller.stub.domain.Cartridge;
-import org.apache.stratos.cloud.controller.stub.domain.DeploymentPolicy;
-import org.apache.stratos.cloud.controller.stub.domain.Persistence;
-import org.apache.stratos.cloud.controller.stub.domain.Volume;
+import org.apache.stratos.cloud.controller.stub.domain.*;
import org.apache.stratos.common.beans.PropertyBean;
-import org.apache.stratos.common.beans.application.*;
+import org.apache.stratos.common.beans.application.ApplicationBean;
+import org.apache.stratos.common.beans.application.ApplicationNetworkPartitionIdListBean;
+import org.apache.stratos.common.beans.application.ComponentBean;
+import org.apache.stratos.common.beans.application.GroupBean;
+import org.apache.stratos.common.beans.application.GroupReferenceBean;
import org.apache.stratos.common.beans.application.domain.mapping.ApplicationDomainMappingsBean;
import org.apache.stratos.common.beans.application.domain.mapping.DomainMappingBean;
import org.apache.stratos.common.beans.application.signup.ApplicationSignUpBean;
@@ -2040,17 +2042,16 @@ public class StratosApiV41Utils {
deployementPolicyDefinitionBean.getId()));
}
- DeploymentPolicy deploymentPolicy =
+ org.apache.stratos.autoscaler.stub.deployment.policy.DeploymentPolicy deploymentPolicy =
- ObjectConverter.convetToCCDeploymentPolicy(deployementPolicyDefinitionBean);
- CloudControllerServiceClient cloudControllerServiceClient = CloudControllerServiceClient.getInstance();
- cloudControllerServiceClient.addDeploymentPolicy(deploymentPolicy);
+ ObjectConverter.convertToASDeploymentPolicy(deployementPolicyDefinitionBean);
+ AutoscalerServiceClient.getInstance().addDeploymentPolicy(deploymentPolicy);
- if (log.isDebugEnabled()) {
- log.debug(String.format("Successfully added deploymentPolicy: [deployment-policy-id] %s ",
- deployementPolicyDefinitionBean.getId()));
- }
- } catch (CloudControllerServiceDeploymentPolicyAlreadyExistsExceptionException e) {
+ if (log.isDebugEnabled()) {
+ log.debug(String.format("Successfully added deploymentPolicy: [deployment-policy-id] %s ",
+ deployementPolicyDefinitionBean.getId()));
+ }
+ } catch (AutoscalerServiceDeploymentPolicyNotExistsExceptionException e) {
String msg =
"Deployment policy already exist [Deployment-policy-id]" + deployementPolicyDefinitionBean.getId();
log.error(msg, e);
@@ -2071,8 +2072,9 @@ public class StratosApiV41Utils {
DeploymentPolicyBean deploymentPolicyBean = null;
try {
- CloudControllerServiceClient cloudControllerServiceClient = CloudControllerServiceClient.getInstance();
- DeploymentPolicy deploymentPolicy = cloudControllerServiceClient.getDeploymentPolicy(deploymentPolicyID);
+
+ org.apache.stratos.autoscaler.stub.deployment.policy.DeploymentPolicy deploymentPolicy
+ = AutoscalerServiceClient.getInstance().getDeploymentPolicy(deploymentPolicyID);
if(deploymentPolicy == null) {
return null;
}
@@ -2092,9 +2094,9 @@ public class StratosApiV41Utils {
*/
public static DeploymentPolicyBean[] getDeployementPolicies() {
try {
- CloudControllerServiceClient serviceClient = CloudControllerServiceClient.getInstance();
- DeploymentPolicy[] deploymentPolicies = serviceClient.getDeploymentPolicies();
- return ObjectConverter.convertCCStubDeploymentPoliciesToDeploymentPolicies(deploymentPolicies);
+ org.apache.stratos.autoscaler.stub.deployment.policy.DeploymentPolicy[] deploymentPolicies
+ = AutoscalerServiceClient.getInstance().getDeploymentPolicies();
+ return ObjectConverter.convertASStubDeploymentPoliciesToDeploymentPolicies(deploymentPolicies);
} catch (Exception e) {
String message = "Could not get network partitions";
log.error(message);
@@ -2115,16 +2117,16 @@ public class StratosApiV41Utils {
deploymentPolicyDefinitionBean.getId()));
}
- DeploymentPolicy deploymentPolicy =
- ObjectConverter.convetToCCDeploymentPolicy(deploymentPolicyDefinitionBean);
- CloudControllerServiceClient cloudControllerServiceClient = CloudControllerServiceClient.getInstance();
- cloudControllerServiceClient.updateDeploymentPolicy(deploymentPolicy);
+ org.apache.stratos.autoscaler.stub.deployment.policy.DeploymentPolicy deploymentPolicy =
+ ObjectConverter.convertToASDeploymentPolicy(deploymentPolicyDefinitionBean);
+
+ AutoscalerServiceClient.getInstance().updateDeploymentPolicy(deploymentPolicy);
if (log.isDebugEnabled()) {
log.debug(String.format("DeploymentPolicy updates successfully : [deployment-policy-id] %s ",
deploymentPolicyDefinitionBean.getId()));
}
- } catch (CloudControllerServiceDeploymentPolicyNotExistsExceptionException e) {
+ } catch (AutoscalerServiceDeploymentPolicyNotExistsExceptionException e) {
String msg =
"Deployment policy already exist [Deployment-policy-id]" + deploymentPolicyDefinitionBean.getId();
log.error(msg, e);
@@ -2144,8 +2146,7 @@ public class StratosApiV41Utils {
public static void removeDeploymentPolicy(String deploymentPolicyID)
throws RestAPIException {
try {
- CloudControllerServiceClient cloudControllerServiceClient = CloudControllerServiceClient.getInstance();
- cloudControllerServiceClient.removeDeploymentPolicy(deploymentPolicyID);
+ AutoscalerServiceClient.getInstance().removeDeploymentPolicy(deploymentPolicyID);
}
catch(Exception e){
String msg = "Could not remove deployment policy";
http://git-wip-us.apache.org/repos/asf/stratos/blob/cad2fc90/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/mock/MockContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/mock/MockContext.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/mock/MockContext.java
index e4e55ef..2c9df3e 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/mock/MockContext.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/mock/MockContext.java
@@ -22,9 +22,9 @@ import org.apache.stratos.common.beans.ApiResponseBean;
import org.apache.stratos.common.beans.TenantInfoBean;
import org.apache.stratos.common.beans.UserInfoBean;
import org.apache.stratos.common.beans.cartridge.CartridgeBean;
-import org.apache.stratos.common.beans.partition.NetworkPartitionRefBean;
+import org.apache.stratos.common.beans.partition.NetworkPartitionBean;
+import org.apache.stratos.common.beans.partition.PartitionBean;
import org.apache.stratos.common.beans.partition.PartitionBean;
-import org.apache.stratos.common.beans.partition.PartitionRefBean;
import org.apache.stratos.common.beans.policy.autoscale.AutoscalePolicyBean;
import org.apache.stratos.common.beans.policy.deployment.DeploymentPolicyBean;
import org.apache.stratos.common.beans.topology.ClusterBean;
@@ -551,7 +551,7 @@ public class MockContext {
if(!(deploymentPolicyMap.get(PUBLIC_DEFINITION)).containsKey(deploymentPolicyId)){
throw new RestAPIException(Status.NO_CONTENT,"There is no deployment policy with id: " + deploymentPolicyId);
}
- List<PartitionRefBean> partitions = (deploymentPolicyMap.get(PUBLIC_DEFINITION)).get(deploymentPolicyId).getNetworkPartitions().get(0).getPartitions();
+ List<PartitionBean> partitions = (deploymentPolicyMap.get(PUBLIC_DEFINITION)).get(deploymentPolicyId).getNetworkPartitions().get(0).getPartitions();
return partitions.toArray(new PartitionBean[partitions.size()]);
}
}
@@ -560,12 +560,12 @@ public class MockContext {
throw new RestAPIException(Status.NO_CONTENT,"There is no deployment policy with id: " + deploymentPolicyId);
}
//FIXME to parse thr all the NW partitions
- List<PartitionRefBean> partitions = (deploymentPolicyMap.get(tenantId)).
+ List<PartitionBean> partitions = (deploymentPolicyMap.get(tenantId)).
get(deploymentPolicyId).getNetworkPartitions().get(0).getPartitions();
return partitions.toArray(new PartitionBean[partitions.size()]);
}
- public NetworkPartitionRefBean[] getPartitionGroups(String deploymentPolicyId) throws RestAPIException{
+ public NetworkPartitionBean[] getPartitionGroups(String deploymentPolicyId) throws RestAPIException{
int tenantId = getTenantId();
if(!deploymentPolicyMap.containsKey(tenantId)){
if(!deploymentPolicyMap.containsKey(PUBLIC_DEFINITION)){
@@ -575,16 +575,16 @@ public class MockContext {
if(!(deploymentPolicyMap.get(PUBLIC_DEFINITION)).containsKey(deploymentPolicyId)){
throw new RestAPIException(Status.NO_CONTENT,"There is no deployment policy with id: " + deploymentPolicyId);
}
- List<NetworkPartitionRefBean> networkPartitionsList = (deploymentPolicyMap.get(PUBLIC_DEFINITION)).get(deploymentPolicyId).getNetworkPartitions();
- return networkPartitionsList.toArray(new NetworkPartitionRefBean[networkPartitionsList.size()]);
+ List<NetworkPartitionBean> networkPartitionsList = (deploymentPolicyMap.get(PUBLIC_DEFINITION)).get(deploymentPolicyId).getNetworkPartitions();
+ return networkPartitionsList.toArray(new NetworkPartitionBean[networkPartitionsList.size()]);
}
}
if(!(deploymentPolicyMap.get(tenantId)).containsKey(deploymentPolicyId)){
throw new RestAPIException(Status.NO_CONTENT,"There is no deployment policy with id: " + deploymentPolicyId);
}
- List<NetworkPartitionRefBean> networkPartitionsList = (deploymentPolicyMap.get(tenantId)).get(deploymentPolicyId).getNetworkPartitions();
- return networkPartitionsList.toArray(new NetworkPartitionRefBean[networkPartitionsList.size()]);
+ List<NetworkPartitionBean> networkPartitionsList = (deploymentPolicyMap.get(tenantId)).get(deploymentPolicyId).getNetworkPartitions();
+ return networkPartitionsList.toArray(new NetworkPartitionBean[networkPartitionsList.size()]);
}
public AutoscalePolicyBean[] getAutoscalePolicies() throws RestAPIException{
@@ -719,17 +719,17 @@ public class MockContext {
}
}
- PartitionBean[] partitions = null;
- for(NetworkPartitionRefBean networkPartition : deploymentPolicy.getNetworkPartitions()){
+ PartitionBean[] partitionsArray = null;
+ for(NetworkPartitionBean networkPartition : deploymentPolicy.getNetworkPartitions()){
if(networkPartition.getId().equals(partitionGroupId)){
- List<PartitionRefBean> partitionRefs = networkPartition.getPartitions();
- partitions = partitionRefs.toArray(new PartitionBean[partitionRefs.size()]);
+ List<PartitionBean> partitions = networkPartition.getPartitions();
+ partitionsArray = partitions.toArray(new PartitionBean[partitions.size()]);
}
}
- if(partitions == null){
+ if(partitionsArray == null){
throw new RestAPIException(Status.NO_CONTENT,"Partition not found");
}
- return partitions;
+ return partitionsArray;
}
public ClusterBean[] getClusters() throws RestAPIException{
http://git-wip-us.apache.org/repos/asf/stratos/blob/cad2fc90/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/mock/StratosApiV40Mock.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/mock/StratosApiV40Mock.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/mock/StratosApiV40Mock.java
index df40774..feca47d 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/mock/StratosApiV40Mock.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/mock/StratosApiV40Mock.java
@@ -24,7 +24,7 @@ import org.apache.stratos.common.beans.ApiResponseBean;
import org.apache.stratos.common.beans.TenantInfoBean;
import org.apache.stratos.common.beans.UserInfoBean;
import org.apache.stratos.common.beans.cartridge.CartridgeBean;
-import org.apache.stratos.common.beans.partition.NetworkPartitionRefBean;
+import org.apache.stratos.common.beans.partition.NetworkPartitionBean;
import org.apache.stratos.common.beans.partition.PartitionBean;
import org.apache.stratos.common.beans.policy.autoscale.AutoscalePolicyBean;
import org.apache.stratos.common.beans.policy.deployment.DeploymentPolicyBean;
@@ -332,7 +332,7 @@ public class StratosApiV40Mock {
@Produces("application/json")
@Consumes("application/json")
@AuthorizationAction("/permission/protected/manage/monitor/tenants")
- public NetworkPartitionRefBean[] getPartitionGroups (@PathParam("deploymentPolicyId") String deploymentPolicyId)
+ public NetworkPartitionBean[] getPartitionGroups (@PathParam("deploymentPolicyId") String deploymentPolicyId)
throws RestAPIException {
return MockContext.getInstance().getPartitionGroups(deploymentPolicyId);
http://git-wip-us.apache.org/repos/asf/stratos/blob/cad2fc90/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java
index eff8097..49ed3c8 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java
@@ -21,6 +21,7 @@ package org.apache.stratos.rest.endpoint.util.converter;
import org.apache.commons.lang.StringUtils;
import org.apache.stratos.autoscaler.stub.deployment.policy.ApplicationPolicy;
+import org.apache.stratos.autoscaler.stub.deployment.policy.DeploymentPolicy;
import org.apache.stratos.autoscaler.stub.pojo.*;
import org.apache.stratos.autoscaler.stub.pojo.Dependencies;
import org.apache.stratos.autoscaler.stub.pojo.ServiceGroup;
@@ -333,18 +334,18 @@ public class ObjectConverter {
return floatingNetworks;
}
- public static PartitionRef convertStubPartitionToPartitionRef
- (PartitionRefBean partition) {
+ public static org.apache.stratos.cloud.controller.stub.domain.Partition convertPartitionToStubPartition
+ (PartitionBean partition) {
if (partition == null) {
return null;
}
- org.apache.stratos.cloud.controller.stub.domain.PartitionRef stubPartition = new
- org.apache.stratos.cloud.controller.stub.domain.PartitionRef();
+ org.apache.stratos.cloud.controller.stub.domain.Partition stubPartition = new
+ org.apache.stratos.cloud.controller.stub.domain.Partition();
stubPartition.setId(partition.getId());
- stubPartition.setMax(partition.getPartitionMax());
+ stubPartition.setPartitionMax(partition.getPartitionMax());
return stubPartition;
}
@@ -396,26 +397,6 @@ public class ObjectConverter {
return autoscalePolicy;
}
- public static org.apache.stratos.cloud.controller.stub.domain.DeploymentPolicy convetToCCDeploymentPolicy(
- DeploymentPolicyBean deploymentPolicyBean) {
-
- if (deploymentPolicyBean == null) {
- return null;
- }
-
- org.apache.stratos.cloud.controller.stub.domain.DeploymentPolicy deploymentPolicy =
- new org.apache.stratos.cloud.controller.stub.domain.DeploymentPolicy();
-
- deploymentPolicy.setDeploymentPolicyID(deploymentPolicyBean.getId());
-
- if (deploymentPolicyBean.getNetworkPartitions() != null) {
- deploymentPolicy.setNetworkPartitionsRef(convertNetworkPartitionRefToStubNetworkPartitionRef(
- deploymentPolicyBean.getNetworkPartitions()));
- }
-
- return deploymentPolicy;
- }
-
public static NetworkPartitionBean convertCCStubNetworkPartitionToNetworkPartition(
org.apache.stratos.cloud.controller.stub.domain.NetworkPartition stubNetworkPartition) {
if (stubNetworkPartition == null) {
@@ -426,7 +407,7 @@ public class ObjectConverter {
networkPartition.setId(stubNetworkPartition.getId());
if (stubNetworkPartition.getPartitions() != null) {
List<PartitionBean> partitionList = new ArrayList<PartitionBean>();
- for (Partition stubPartition : stubNetworkPartition.getPartitions()) {
+ for (org.apache.stratos.cloud.controller.stub.domain.Partition stubPartition : stubNetworkPartition.getPartitions()) {
if (stubPartition != null) {
partitionList.add(convertCCStubPartitionToPartition(stubPartition));
}
@@ -481,25 +462,6 @@ public class ObjectConverter {
return applicationPolicyBeans;
}
- public static Partition convertPartitionToCCPartitionPojo(PartitionBean partitionBean) {
-
- if (partitionBean == null) {
- return null;
- }
-
- Partition partition = new Partition();
- partition.setId(partitionBean.getId());
- partition.setDescription(partitionBean.getDescription());
- partition.setIsPublic(partitionBean.isPublic());
-
- if (partitionBean.getProperty() != null
- && !partitionBean.getProperty().isEmpty()) {
- partition.setProperties(getCCProperties(partitionBean.getProperty()));
- }
-
- return partition;
- }
-
public static org.apache.stratos.autoscaler.stub.Properties getASProperties(List<PropertyBean> propertyBeans) {
if (propertyBeans == null || propertyBeans.isEmpty()) {
@@ -575,7 +537,7 @@ public class ObjectConverter {
return properties;
}
- private static PartitionBean convertCCStubPartitionToPartition(Partition stubPartition) {
+ private static PartitionBean convertCCStubPartitionToPartition(org.apache.stratos.cloud.controller.stub.domain.Partition stubPartition) {
if (stubPartition == null) {
return null;
@@ -608,39 +570,53 @@ public class ObjectConverter {
networkPartition.setId(networkPartitionBean.getId());
networkPartition.setProvider(networkPartitionBean.getProvider());
if (networkPartitionBean.getPartitions() != null && !networkPartitionBean.getPartitions().isEmpty()) {
- networkPartition.setPartitions(convertPartitionToCCPartitionPojos(networkPartitionBean.getPartitions()));
+ networkPartition.setPartitions(convertToStubPartitions(networkPartitionBean.getPartitions()));
}
return networkPartition;
}
- public static NetworkPartitionRef[] convertNetworkPartitionRefToStubNetworkPartitionRef(
- List<NetworkPartitionRefBean> networkPartitionBean) {
+ public static org.apache.stratos.cloud.controller.stub.domain.NetworkPartition[] convertNetworkPartitionToStubNetworkPartition(
+ List<NetworkPartitionBean> networkPartitionBean) {
- org.apache.stratos.cloud.controller.stub.domain.NetworkPartitionRef[] networkPartition =
- new NetworkPartitionRef[networkPartitionBean.size()];
+ org.apache.stratos.cloud.controller.stub.domain.NetworkPartition[] networkPartition =
+ new org.apache.stratos.cloud.controller.stub.domain.NetworkPartition[networkPartitionBean.size()];
for (int i = 0; i < networkPartitionBean.size(); i++) {
- networkPartition[i] = new NetworkPartitionRef();
+ networkPartition[i] = new org.apache.stratos.cloud.controller.stub.domain.NetworkPartition();
networkPartition[i].setId(networkPartitionBean.get(i).getId());
networkPartition[i].setPartitionAlgo(networkPartitionBean.get(i).getPartitionAlgo());
- networkPartition[i].setPartitions(convertToCCPartitionRefPojos(networkPartitionBean.get(i).getPartitions()));
+ networkPartition[i].setPartitions(convertToStubPartitions(networkPartitionBean.get(i).getPartitions()));
}
return networkPartition;
}
- public static List<NetworkPartitionRefBean> convertCCStubNetwotkPartitionRefsToNetworkPartitionRefs(
- NetworkPartitionRef[] networkPartitionRefs) {
+ public static List<NetworkPartitionBean> convertCCStubNetwotkPartitionsToNetworkPartitions(
+ org.apache.stratos.cloud.controller.stub.domain.NetworkPartition[] networkPartitions) {
- List<NetworkPartitionRefBean> networkPartitionRefBeans = new ArrayList<NetworkPartitionRefBean>();
- for (int i = 0; i < networkPartitionRefs.length; i++) {
- NetworkPartitionRefBean networkPartitionRefBean = new NetworkPartitionRefBean();
- networkPartitionRefBean.setId(networkPartitionRefs[i].getId());
- networkPartitionRefBean.setPartitionAlgo(networkPartitionRefs[i].getPartitionAlgo());
- networkPartitionRefBean.setPartitions(convertCCStubPartitionRefsToPartitionRefs(networkPartitionRefs[i].getPartitions()));
- networkPartitionRefBeans.add(networkPartitionRefBean);
+ List<NetworkPartitionBean> networkPartitionBeans = new ArrayList<NetworkPartitionBean>();
+ for (int i = 0; i < networkPartitions.length; i++) {
+ NetworkPartitionBean networkPartitionBean = new NetworkPartitionBean();
+ networkPartitionBean.setId(networkPartitions[i].getId());
+ networkPartitionBean.setPartitionAlgo(networkPartitions[i].getPartitionAlgo());
+ networkPartitionBean.setPartitions(convertCCStubPartitionsToPartitions(networkPartitions[i].getPartitions()));
+ networkPartitionBeans.add(networkPartitionBean);
}
- return networkPartitionRefBeans;
+ return networkPartitionBeans;
+ }
+ public static List<NetworkPartitionBean> convertASStubNetwotkPartitionsToNetworkPartitions(
+ org.apache.stratos.autoscaler.stub.partition.NetworkPartition[] networkPartitions) {
+
+ List<NetworkPartitionBean> networkPartitionBeans = new ArrayList<NetworkPartitionBean>();
+ for (int i = 0; i < networkPartitions.length; i++) {
+ NetworkPartitionBean networkPartitionBean = new NetworkPartitionBean();
+ networkPartitionBean.setId(networkPartitions[i].getId());
+ networkPartitionBean.setPartitionAlgo(networkPartitions[i].getPartitionAlgo());
+ networkPartitionBean.setPartitions(convertASStubPartitionsToPartitions(networkPartitions[i].getPartitions()));
+ networkPartitionBeans.add(networkPartitionBean);
+ }
+
+ return networkPartitionBeans;
}
public static ClusterBean convertClusterToClusterBean(Cluster cluster, String alias) {
@@ -782,39 +758,54 @@ public class ObjectConverter {
return kubernetesServiceBeans;
}
- private static Partition[] convertPartitionToCCPartitionPojos(
- List<PartitionBean> partitionList) {
+// private static Partition[] convertPartitionToCCPartitionPojos(
+// List<PartitionBean> partitionList) {
+//
+// Partition[] partitions = new Partition[partitionList.size()];
+// for (int i = 0; i < partitionList.size(); i++) {
+// partitions[i] = convertPartitionToCCPartitionPojo(partitionList.get(i));
+// }
+//
+// return partitions;
+// }
+
+ private static org.apache.stratos.cloud.controller.stub.domain.Partition[] convertToStubPartitions
+ (List<PartitionBean> partitionList) {
- Partition[] partitions = new Partition[partitionList.size()];
+ org.apache.stratos.cloud.controller.stub.domain.Partition[] partitions
+ = new org.apache.stratos.cloud.controller.stub.domain.Partition[partitionList.size()];
for (int i = 0; i < partitionList.size(); i++) {
- partitions[i] = convertPartitionToCCPartitionPojo(partitionList.get(i));
+ partitions[i] = convertPartitionToStubPartition(partitionList.get(i));
}
return partitions;
}
- private static PartitionRef[] convertToCCPartitionRefPojos
- (List<PartitionRefBean> partitionList) {
+ private static List<PartitionBean> convertCCStubPartitionsToPartitions(
+ org.apache.stratos.cloud.controller.stub.domain.Partition[] partitions) {
- PartitionRef[] partitions = new PartitionRef[partitionList.size()];
- for (int i = 0; i < partitionList.size(); i++) {
- partitions[i] = convertStubPartitionToPartitionRef(partitionList.get(i));
+ List<PartitionBean> partitionBeans = new ArrayList<PartitionBean>();
+ for (int i = 0; i < partitions.length; i++) {
+ PartitionBean partitionBean = new PartitionBean();
+ partitionBean.setId(partitions[i].getId());
+ partitionBean.setPartitionMax(partitions[i].getPartitionMax());
+ partitionBeans.add(partitionBean);
}
- return partitions;
+ return partitionBeans;
}
+ private static List<PartitionBean> convertASStubPartitionsToPartitions(
+ org.apache.stratos.autoscaler.stub.partition.Partition[] partitions) {
- private static List<PartitionRefBean> convertCCStubPartitionRefsToPartitionRefs(PartitionRef[] partitionRefs) {
-
- List<PartitionRefBean> partitionRefBeans = new ArrayList<PartitionRefBean>();
- for (int i = 0; i < partitionRefs.length; i++) {
- PartitionRefBean partitionRefBean = new PartitionRefBean();
- partitionRefBean.setId(partitionRefs[i].getId());
- partitionRefBean.setPartitionMax(partitionRefs[i].getMax());
- partitionRefBeans.add(partitionRefBean);
+ List<PartitionBean> partitionBeans = new ArrayList<PartitionBean>();
+ for (int i = 0; i < partitions.length; i++) {
+ PartitionBean partitionBean = new PartitionBean();
+ partitionBean.setId(partitions[i].getId());
+ partitionBean.setPartitionMax(partitions[i].getPartitionMax());
+ partitionBeans.add(partitionBean);
}
- return partitionRefBeans;
+ return partitionBeans;
}
public static PartitionBean[] populatePartitionPojos(org.apache.stratos.cloud.controller.stub.domain.Partition[]
@@ -833,8 +824,7 @@ public class ObjectConverter {
return partitionBeans;
}
- public static PartitionBean populatePartitionPojo(org.apache.stratos.cloud.controller.stub.domain.Partition
- partition) {
+ public static PartitionBean populatePartitionPojo(org.apache.stratos.cloud.controller.stub.domain.Partition partition) {
PartitionBean partitionBeans = new PartitionBean();
if (partition == null) {
@@ -844,8 +834,8 @@ public class ObjectConverter {
partitionBeans.setId(partition.getId());
partitionBeans.setDescription(partition.getDescription());
partitionBeans.setPublic(partition.getIsPublic());
- /*partitionBeans.partitionMin = partition.getPartitionMin();
- partitionBeans.partitionMax = partition.getPartitionMax();*/
+// partitionBeans.partitionMin = partition.getPartitionMin();
+ partitionBeans.setPartitionMax(partition.getPartitionMax());
//properties
if (partition.getProperties() != null) {
List<org.apache.stratos.common.beans.cartridge.PropertyBean> propertyBeans
@@ -937,24 +927,24 @@ public class ObjectConverter {
}
public static NetworkPartitionBean[] convertCCStubNetworkPartitionsToNetworkPartitions(
- org.apache.stratos.cloud.controller.stub.domain.NetworkPartition[] partitionGroups) {
+ org.apache.stratos.cloud.controller.stub.domain.NetworkPartition[] networkPartitions) {
NetworkPartitionBean[] networkPartitionGroupsBeans;
- if (partitionGroups == null) {
+ if (networkPartitions == null) {
networkPartitionGroupsBeans = new NetworkPartitionBean[0];
return networkPartitionGroupsBeans;
}
- networkPartitionGroupsBeans = new NetworkPartitionBean[partitionGroups.length];
+ networkPartitionGroupsBeans = new NetworkPartitionBean[networkPartitions.length];
- for (int i = 0; i < partitionGroups.length; i++) {
- networkPartitionGroupsBeans[i] = convertCCStubNetworkPartitionToNetworkPartition(partitionGroups[i]);
+ for (int i = 0; i < networkPartitions.length; i++) {
+ networkPartitionGroupsBeans[i] = convertCCStubNetworkPartitionToNetworkPartition(networkPartitions[i]);
}
return networkPartitionGroupsBeans;
}
- public static DeploymentPolicyBean[] convertCCStubDeploymentPoliciesToDeploymentPolicies(
+ public static DeploymentPolicyBean[] convertASDeploymentPoliciesToDeploymentPolicies(
DeploymentPolicy[] deploymentPolicies) {
DeploymentPolicyBean[] deploymentPolicyBeans;
if (null == deploymentPolicies) {
@@ -1937,8 +1927,8 @@ public class ObjectConverter {
DeploymentPolicyBean deploymentPolicyBean = new DeploymentPolicyBean();
deploymentPolicyBean.setId(deploymentPolicy.getDeploymentPolicyID());
- deploymentPolicyBean.setNetworkPartitions(convertCCStubNetwotkPartitionRefsToNetworkPartitionRefs(
- deploymentPolicy.getNetworkPartitionsRef()));
+ deploymentPolicyBean.setNetworkPartitions(convertASStubNetwotkPartitionsToNetworkPartitions(
+ deploymentPolicy.getNetworkPartitions()));
return deploymentPolicyBean;
}
@@ -1958,4 +1948,137 @@ public class ObjectConverter {
}
return applicationPolicy;
}
+
+
+ public static DeploymentPolicy convertToASDeploymentPolicy(
+ DeploymentPolicyBean deploymentPolicyBean) {
+
+ if (deploymentPolicyBean == null) {
+ return null;
+ }
+
+ DeploymentPolicy deploymentPolicy =
+ new DeploymentPolicy();
+
+ deploymentPolicy.setDeploymentPolicyID(deploymentPolicyBean.getId());
+
+ if (deploymentPolicyBean.getNetworkPartitions() != null) {
+ deploymentPolicy.setNetworkPartitions(convertNetworkPartitionToASStubNetworkPartition(
+ deploymentPolicyBean.getNetworkPartitions()));
+ }
+
+ return deploymentPolicy;
+ }
+
+
+ public static DeploymentPolicyBean[] convertASStubDeploymentPoliciesToDeploymentPolicies(
+ DeploymentPolicy[] deploymentPolicies) {
+ DeploymentPolicyBean[] deploymentPolicyBeans;
+ if (null == deploymentPolicies) {
+ deploymentPolicyBeans = new DeploymentPolicyBean[0];
+ return deploymentPolicyBeans;
+ }
+
+ deploymentPolicyBeans = new DeploymentPolicyBean[deploymentPolicies.length];
+ for (int i = 0; i < deploymentPolicies.length; i++) {
+ deploymentPolicyBeans[i] = convetASStubDeploymentPolicytoDeploymentPolicy(deploymentPolicies[i]);
+ }
+ return deploymentPolicyBeans;
+ }
+
+
+ public static DeploymentPolicyBean convetASStubDeploymentPolicytoDeploymentPolicy(DeploymentPolicy deploymentPolicy) {
+
+ if (deploymentPolicy == null) {
+ return null;
+ }
+
+ DeploymentPolicyBean deploymentPolicyBean = new DeploymentPolicyBean();
+ deploymentPolicyBean.setId(deploymentPolicy.getDeploymentPolicyID());
+ deploymentPolicyBean.setNetworkPartitions(convertASStubNetwotkPartitionRefsToNetworkPartitions(
+ deploymentPolicy.getNetworkPartitions()));
+ return deploymentPolicyBean;
+ }
+
+ public static List<NetworkPartitionBean> convertASStubNetwotkPartitionRefsToNetworkPartitions(
+ org.apache.stratos.autoscaler.stub.partition.NetworkPartition[] networkPartitions) {
+
+ List<NetworkPartitionBean> networkPartitionBeans = new ArrayList<NetworkPartitionBean>();
+ for (int i = 0; i < networkPartitions.length; i++) {
+ NetworkPartitionBean networkPartitionBean = new NetworkPartitionBean();
+ networkPartitionBean.setId(networkPartitions[i].getId());
+ networkPartitionBean.setPartitionAlgo(networkPartitions[i].getPartitionAlgo());
+ networkPartitionBean.setPartitions(convertASStubPartitionRefsToPartitionRefs(networkPartitions[i].getPartitions()));
+ networkPartitionBeans.add(networkPartitionBean);
+ }
+
+ return networkPartitionBeans;
+ }
+
+
+ private static List<PartitionBean> convertASStubPartitionRefsToPartitionRefs(
+ org.apache.stratos.autoscaler.stub.partition.Partition[] partitions) {
+
+ List<PartitionBean> partitionRefBeans = new ArrayList<PartitionBean>();
+ for (int i = 0; i < partitions.length; i++) {
+ PartitionBean partitionRefBean = new PartitionBean();
+ partitionRefBean.setId(partitions[i].getId());
+ partitionRefBean.setPartitionMax(partitions[i].getPartitionMax());
+ partitionRefBeans.add(partitionRefBean);
+ }
+
+ return partitionRefBeans;
+ }
+
+ public static org.apache.stratos.autoscaler.stub.partition.Partition convertPartitionToASStubPartition(
+ PartitionBean partition) {
+
+ if (partition == null) {
+ return null;
+ }
+
+ org.apache.stratos.autoscaler.stub.partition.Partition stubPartition = new
+ org.apache.stratos.autoscaler.stub.partition.Partition();
+
+ stubPartition.setId(partition.getId());
+ stubPartition.setPartitionMax(partition.getPartitionMax());
+
+ return stubPartition;
+ }
+
+
+
+
+
+
+ private static org.apache.stratos.autoscaler.stub.partition.Partition[] convertToASStubPartitions
+ (List<PartitionBean> partitionList) {
+
+ org.apache.stratos.autoscaler.stub.partition.Partition[] partitions
+ = new org.apache.stratos.autoscaler.stub.partition.Partition[partitionList.size()];
+ for (int i = 0; i < partitionList.size(); i++) {
+ partitions[i] = convertPartitionToASStubPartition(partitionList.get(i));
+ }
+
+ return partitions;
+ }
+
+
+
+
+ public static org.apache.stratos.autoscaler.stub.partition.NetworkPartition[] convertNetworkPartitionToASStubNetworkPartition(
+ List<NetworkPartitionBean> networkPartitionBean) {
+
+ org.apache.stratos.autoscaler.stub.partition.NetworkPartition[] networkPartition =
+ new org.apache.stratos.autoscaler.stub.partition.NetworkPartition[networkPartitionBean.size()];
+ for (int i = 0; i < networkPartitionBean.size(); i++) {
+ networkPartition[i] = new org.apache.stratos.autoscaler.stub.partition.NetworkPartition();
+ networkPartition[i].setId(networkPartitionBean.get(i).getId());
+ networkPartition[i].setPartitionAlgo(networkPartitionBean.get(i).getPartitionAlgo());
+ networkPartition[i].setPartitions(convertToASStubPartitions(networkPartitionBean.get(i).getPartitions()));
+ }
+
+ return networkPartition;
+ }
+
}
[18/20] stratos git commit: Deployment policy move: Update CC stub
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/ea98c489/service-stubs/org.apache.stratos.cloud.controller.service.stub/src/main/resources/CloudControllerService.wsdl
----------------------------------------------------------------------
diff --git a/service-stubs/org.apache.stratos.cloud.controller.service.stub/src/main/resources/CloudControllerService.wsdl b/service-stubs/org.apache.stratos.cloud.controller.service.stub/src/main/resources/CloudControllerService.wsdl
index 0096097..1adf2f3 100644
--- a/service-stubs/org.apache.stratos.cloud.controller.service.stub/src/main/resources/CloudControllerService.wsdl
+++ b/service-stubs/org.apache.stratos.cloud.controller.service.stub/src/main/resources/CloudControllerService.wsdl
@@ -12,34 +12,6 @@
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getCartridge">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" name="cartridgeType" nillable="true" type="xs:string"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="getCartridgeResponse">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" name="return" nillable="true" type="ax26:Cartridge"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="getClusterContext">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="getClusterContextResponse">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" name="return" nillable="true" type="ax26:ClusterContext"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
<xs:element name="CloudControllerServiceInvalidIaasProviderException">
<xs:complexType>
<xs:sequence>
@@ -89,36 +61,29 @@
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="CloudControllerServiceNonExistingKubernetesClusterException">
+ <xs:element name="getCartridges">
<xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" name="NonExistingKubernetesClusterException" nillable="true" type="ax21:NonExistingKubernetesClusterException"/>
- </xs:sequence>
+ <xs:sequence/>
</xs:complexType>
</xs:element>
- <xs:element name="getKubernetesCluster">
+ <xs:element name="getCartridgesResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="kubernetesClusterId" nillable="true" type="xs:string"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getKubernetesClusterResponse">
+ <xs:element name="getCartridge">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="return" nillable="true" type="ax29:KubernetesCluster"/>
+ <xs:element minOccurs="0" name="cartridgeType" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getCartridges">
- <xs:complexType>
- <xs:sequence/>
- </xs:complexType>
- </xs:element>
- <xs:element name="getCartridgesResponse">
+ <xs:element name="getCartridgeResponse">
<xs:complexType>
<xs:sequence>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="return" nillable="true" type="ax26:Cartridge"/>
</xs:sequence>
</xs:complexType>
</xs:element>
@@ -143,244 +108,204 @@
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="CloudControllerServiceCartridgeDefinitionNotExistsException">
+ <xs:element name="CloudControllerServiceNetworkPartitionAlreadyExistsException">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="CartridgeDefinitionNotExistsException" nillable="true" type="ax21:CartridgeDefinitionNotExistsException"/>
+ <xs:element minOccurs="0" name="NetworkPartitionAlreadyExistsException" nillable="true" type="ax21:NetworkPartitionAlreadyExistsException"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="updateCartridge">
+ <xs:element name="addNetworkPartition">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="cartridgeConfig" nillable="true" type="ax26:Cartridge"/>
+ <xs:element minOccurs="0" name="networkPartition" nillable="true" type="ax26:NetworkPartition"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="removeCartridge">
+ <xs:element name="getNetworkPartition">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="cartridgeType" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="networkPartitionId" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="CloudControllerServiceInvalidServiceGroupException">
+ <xs:element name="getNetworkPartitionResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="InvalidServiceGroupException" nillable="true" type="ax21:InvalidServiceGroupException"/>
+ <xs:element minOccurs="0" name="return" nillable="true" type="ax26:NetworkPartition"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="addServiceGroup">
+ <xs:element name="getNetworkPartitions">
<xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" name="servicegroup" nillable="true" type="ax26:ServiceGroup"/>
- </xs:sequence>
+ <xs:sequence/>
</xs:complexType>
</xs:element>
- <xs:element name="removeServiceGroup">
+ <xs:element name="getNetworkPartitionsResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax26:NetworkPartition"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getServiceGroup">
+ <xs:element name="CloudControllerServiceNetworkPartitionNotExistsException">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="NetworkPartitionNotExistsException" nillable="true" type="ax21:NetworkPartitionNotExistsException"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getServiceGroupResponse">
+ <xs:element name="removeNetworkPartition">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="return" nillable="true" type="ax26:ServiceGroup"/>
+ <xs:element minOccurs="0" name="networkPartitionId" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getServiceGroupSubGroups">
+ <xs:element name="removeCartridge">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="cartridgeType" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getServiceGroupSubGroupsResponse">
+ <xs:element name="CloudControllerServiceCartridgeDefinitionNotExistsException">
<xs:complexType>
<xs:sequence>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="CartridgeDefinitionNotExistsException" nillable="true" type="ax21:CartridgeDefinitionNotExistsException"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getServiceGroupCartridges">
+ <xs:element name="updateCartridge">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="cartridgeConfig" nillable="true" type="ax26:Cartridge"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getServiceGroupCartridgesResponse">
+ <xs:element name="CloudControllerServiceInvalidServiceGroupException">
<xs:complexType>
<xs:sequence>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="InvalidServiceGroupException" nillable="true" type="ax21:InvalidServiceGroupException"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getServiceGroupDependencies">
+ <xs:element name="getServiceGroup">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getServiceGroupDependenciesResponse">
+ <xs:element name="getServiceGroupResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="return" nillable="true" type="ax26:Dependencies"/>
+ <xs:element minOccurs="0" name="return" nillable="true" type="ax26:ServiceGroup"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="CloudControllerServiceInvalidPartitionException">
+ <xs:element name="addServiceGroup">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="InvalidPartitionException" nillable="true" type="ax21:InvalidPartitionException"/>
+ <xs:element minOccurs="0" name="servicegroup" nillable="true" type="ax26:ServiceGroup"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="validatePartition">
+ <xs:element name="removeServiceGroup">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="partition" nillable="true" type="ax26:Partition"/>
+ <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="validatePartitionResponse">
+ <xs:element name="getClusterContext">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="return" type="xs:boolean"/>
+ <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="validateDeploymentPolicy">
+ <xs:element name="getClusterContextResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="cartridgeType" nillable="true" type="xs:string"/>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="partitions" nillable="true" type="ax26:Partition"/>
+ <xs:element minOccurs="0" name="return" nillable="true" type="ax26:ClusterContext"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="validateDeploymentPolicyResponse">
+ <xs:element name="CloudControllerServiceNonExistingKubernetesClusterException">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="return" type="xs:boolean"/>
+ <xs:element minOccurs="0" name="NonExistingKubernetesClusterException" nillable="true" type="ax21:NonExistingKubernetesClusterException"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="registerService">
+ <xs:element name="removeKubernetesCluster">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="registrant" nillable="true" type="ax26:Registrant"/>
+ <xs:element minOccurs="0" name="kubernetesClusterId" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="registerServiceResponse">
+ <xs:element name="removeKubernetesClusterResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="startInstances">
- <xs:complexType>
- <xs:sequence>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="instanceContexts" nillable="true" type="ax26:InstanceContext"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="startInstancesResponse">
- <xs:complexType>
- <xs:sequence>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax26:MemberContext"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="terminateInstanceForcefully">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" name="memberId" nillable="true" type="xs:string"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="CloudControllerServiceInvalidClusterException">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" name="InvalidClusterException" nillable="true" type="ax21:InvalidClusterException"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="terminateInstances">
+ <xs:element name="CloudControllerServiceNonExistingKubernetesHostException">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="NonExistingKubernetesHostException" nillable="true" type="ax21:NonExistingKubernetesHostException"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="updateClusterStatus">
+ <xs:element name="removeKubernetesHost">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="serviceName" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="instanceId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="status" nillable="true" type="ax212:ClusterStatus"/>
+ <xs:element minOccurs="0" name="kubernetesHostId" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="CloudControllerServiceUnregisteredClusterException">
+ <xs:element name="removeKubernetesHostResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="UnregisteredClusterException" nillable="true" type="ax21:UnregisteredClusterException"/>
+ <xs:element minOccurs="0" name="return" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="unregisterService">
+ <xs:element name="CloudControllerServiceInvalidKubernetesClusterException">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="InvalidKubernetesClusterException" nillable="true" type="ax21:InvalidKubernetesClusterException"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="CloudControllerServiceApplicationClusterRegistrationException">
+ <xs:element name="addKubernetesCluster">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="ApplicationClusterRegistrationException" nillable="true" type="ax21:ApplicationClusterRegistrationException"/>
+ <xs:element minOccurs="0" name="kubernetesCluster" nillable="true" type="ax29:KubernetesCluster"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="createApplicationClusters">
+ <xs:element name="addKubernetesClusterResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="appId" nillable="true" type="xs:string"/>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="appClustersContexts" nillable="true" type="ax26:ApplicationClusterContext"/>
+ <xs:element minOccurs="0" name="return" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="CloudControllerServiceClusterInstanceCreationException">
+ <xs:element name="getKubernetesCluster">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="ClusterInstanceCreationException" nillable="true" type="ax21:ClusterInstanceCreationException"/>
+ <xs:element minOccurs="0" name="kubernetesClusterId" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="createClusterInstance">
+ <xs:element name="getKubernetesClusterResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="serviceType" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="alias" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="instanceId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="partitionId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="networkPartitionId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="return" nillable="true" type="ax29:KubernetesCluster"/>
</xs:sequence>
</xs:complexType>
</xs:element>
@@ -396,280 +321,287 @@
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getMasterForKubernetesCluster">
+ <xs:element name="registerService">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="kubernetesClusterId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="registrant" nillable="true" type="ax26:Registrant"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getMasterForKubernetesClusterResponse">
+ <xs:element name="registerServiceResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="return" nillable="true" type="ax29:KubernetesMaster"/>
+ <xs:element minOccurs="0" name="return" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getHostsForKubernetesCluster">
+ <xs:element name="getServiceGroupSubGroups">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="kubernetesClusterId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getHostsForKubernetesClusterResponse">
+ <xs:element name="getServiceGroupSubGroupsResponse">
<xs:complexType>
<xs:sequence>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax29:KubernetesHost"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="CloudControllerServiceInvalidKubernetesClusterException">
+ <xs:element name="CloudControllerServiceInvalidPartitionException">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="InvalidKubernetesClusterException" nillable="true" type="ax21:InvalidKubernetesClusterException"/>
+ <xs:element minOccurs="0" name="InvalidPartitionException" nillable="true" type="ax21:InvalidPartitionException"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="addKubernetesCluster">
+ <xs:element name="validatePartition">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="kubernetesCluster" nillable="true" type="ax29:KubernetesCluster"/>
+ <xs:element minOccurs="0" name="partition" nillable="true" type="ax26:Partition"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="addKubernetesClusterResponse">
+ <xs:element name="validatePartitionResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="CloudControllerServiceInvalidKubernetesHostException">
+ <xs:element name="getServiceGroupCartridges">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="InvalidKubernetesHostException" nillable="true" type="ax21:InvalidKubernetesHostException"/>
+ <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="addKubernetesHost">
+ <xs:element name="getServiceGroupCartridgesResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="kubernetesClusterId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="kubernetesHost" nillable="true" type="ax29:KubernetesHost"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="addKubernetesHostResponse">
+ <xs:element name="getServiceGroupDependencies">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="return" type="xs:boolean"/>
+ <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="CloudControllerServiceNonExistingKubernetesHostException">
+ <xs:element name="getServiceGroupDependenciesResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="NonExistingKubernetesHostException" nillable="true" type="ax21:NonExistingKubernetesHostException"/>
+ <xs:element minOccurs="0" name="return" nillable="true" type="ax26:Dependencies"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="updateKubernetesHost">
+ <xs:element name="validateDeploymentPolicyNetworkPartition">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="kubernetesHost" nillable="true" type="ax29:KubernetesHost"/>
+ <xs:element minOccurs="0" name="cartridgeType" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="networkPartitionId" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="updateKubernetesHostResponse">
+ <xs:element name="validateDeploymentPolicyNetworkPartitionResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="removeKubernetesCluster">
+ <xs:element name="startInstances">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="kubernetesClusterId" nillable="true" type="xs:string"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="instanceContexts" nillable="true" type="ax26:InstanceContext"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="removeKubernetesClusterResponse">
+ <xs:element name="startInstancesResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="return" type="xs:boolean"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax26:MemberContext"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="removeKubernetesHost">
+ <xs:element name="terminateInstanceForcefully">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="kubernetesHostId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="memberId" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="removeKubernetesHostResponse">
+ <xs:element name="CloudControllerServiceInvalidClusterException">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="return" type="xs:boolean"/>
+ <xs:element minOccurs="0" name="InvalidClusterException" nillable="true" type="ax21:InvalidClusterException"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="CloudControllerServiceInvalidKubernetesMasterException">
+ <xs:element name="terminateInstances">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="InvalidKubernetesMasterException" nillable="true" type="ax21:InvalidKubernetesMasterException"/>
+ <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="CloudControllerServiceNonExistingKubernetesMasterException">
+ <xs:element name="updateClusterStatus">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="NonExistingKubernetesMasterException" nillable="true" type="ax21:NonExistingKubernetesMasterException"/>
+ <xs:element minOccurs="0" name="serviceName" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="instanceId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="status" nillable="true" type="ax212:ClusterStatus"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="updateKubernetesMaster">
+ <xs:element name="CloudControllerServiceUnregisteredClusterException">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="kubernetesMaster" nillable="true" type="ax29:KubernetesMaster"/>
+ <xs:element minOccurs="0" name="UnregisteredClusterException" nillable="true" type="ax21:UnregisteredClusterException"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="updateKubernetesMasterResponse">
+ <xs:element name="unregisterService">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="return" type="xs:boolean"/>
+ <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="CloudControllerServiceDeploymentPolicyAlreadyExistsException">
+ <xs:element name="CloudControllerServiceApplicationClusterRegistrationException">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="DeploymentPolicyAlreadyExistsException" nillable="true" type="ax21:DeploymentPolicyAlreadyExistsException"/>
+ <xs:element minOccurs="0" name="ApplicationClusterRegistrationException" nillable="true" type="ax21:ApplicationClusterRegistrationException"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="CloudControllerServiceInvalidDeploymentPolicyException">
+ <xs:element name="createApplicationClusters">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="InvalidDeploymentPolicyException" nillable="true" type="ax21:InvalidDeploymentPolicyException"/>
+ <xs:element minOccurs="0" name="appId" nillable="true" type="xs:string"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="appClustersContexts" nillable="true" type="ax26:ApplicationClusterContext"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="addDeployementPolicy">
+ <xs:element name="CloudControllerServiceClusterInstanceCreationException">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="deploymentPolicy" nillable="true" type="ax26:DeploymentPolicy"/>
+ <xs:element minOccurs="0" name="ClusterInstanceCreationException" nillable="true" type="ax21:ClusterInstanceCreationException"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="CloudControllerServiceDeploymentPolicyNotExistsException">
+ <xs:element name="createClusterInstance">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="DeploymentPolicyNotExistsException" nillable="true" type="ax21:DeploymentPolicyNotExistsException"/>
+ <xs:element minOccurs="0" name="serviceType" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="alias" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="instanceId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="partitionId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="networkPartitionId" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="updateDeployementPolicy">
+ <xs:element name="getMasterForKubernetesCluster">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="deploymentPolicy" nillable="true" type="ax26:DeploymentPolicy"/>
+ <xs:element minOccurs="0" name="kubernetesClusterId" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="removeDeployementPolicy">
+ <xs:element name="getMasterForKubernetesClusterResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="deploymentPolicyID" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="return" nillable="true" type="ax29:KubernetesMaster"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getDeploymentPolicy">
+ <xs:element name="getHostsForKubernetesCluster">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="deploymentPolicyID" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="kubernetesClusterId" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getDeploymentPolicyResponse">
+ <xs:element name="getHostsForKubernetesClusterResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="return" nillable="true" type="ax26:DeploymentPolicy"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax29:KubernetesHost"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getDeploymentPolicies">
- <xs:complexType>
- <xs:sequence/>
- </xs:complexType>
- </xs:element>
- <xs:element name="getDeploymentPoliciesResponse">
+ <xs:element name="CloudControllerServiceInvalidKubernetesHostException">
<xs:complexType>
<xs:sequence>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax26:DeploymentPolicy"/>
+ <xs:element minOccurs="0" name="InvalidKubernetesHostException" nillable="true" type="ax21:InvalidKubernetesHostException"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="CloudControllerServiceNetworkPartitionAlreadyExistsException">
+ <xs:element name="addKubernetesHost">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="NetworkPartitionAlreadyExistsException" nillable="true" type="ax21:NetworkPartitionAlreadyExistsException"/>
+ <xs:element minOccurs="0" name="kubernetesClusterId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="kubernetesHost" nillable="true" type="ax29:KubernetesHost"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="addNetworkPartition">
+ <xs:element name="addKubernetesHostResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="networkPartition" nillable="true" type="ax26:NetworkPartition"/>
+ <xs:element minOccurs="0" name="return" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="CloudControllerServiceNetworkPartitionNotExistsException">
+ <xs:element name="updateKubernetesHost">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="NetworkPartitionNotExistsException" nillable="true" type="ax21:NetworkPartitionNotExistsException"/>
+ <xs:element minOccurs="0" name="kubernetesHost" nillable="true" type="ax29:KubernetesHost"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="removeNetworkPartition">
+ <xs:element name="updateKubernetesHostResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="networkPartitionId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="return" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="updateNetworkPartition">
+ <xs:element name="CloudControllerServiceInvalidKubernetesMasterException">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="networkPartition" nillable="true" type="ax26:NetworkPartition"/>
+ <xs:element minOccurs="0" name="InvalidKubernetesMasterException" nillable="true" type="ax21:InvalidKubernetesMasterException"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getNetworkPartitions">
+ <xs:element name="CloudControllerServiceNonExistingKubernetesMasterException">
<xs:complexType>
- <xs:sequence/>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="NonExistingKubernetesMasterException" nillable="true" type="ax21:NonExistingKubernetesMasterException"/>
+ </xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getNetworkPartitionsResponse">
+ <xs:element name="updateKubernetesMaster">
<xs:complexType>
<xs:sequence>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax26:NetworkPartition"/>
+ <xs:element minOccurs="0" name="kubernetesMaster" nillable="true" type="ax29:KubernetesMaster"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getNetworkPartition">
+ <xs:element name="updateKubernetesMasterResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="networkPartitionId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="return" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="getNetworkPartitionResponse">
+ <xs:element name="updateNetworkPartition">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="return" nillable="true" type="ax26:NetworkPartition"/>
+ <xs:element minOccurs="0" name="networkPartition" nillable="true" type="ax26:NetworkPartition"/>
</xs:sequence>
</xs:complexType>
</xs:element>
@@ -726,11 +658,6 @@
<xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="NonExistingKubernetesClusterException">
- <xs:sequence>
- <xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
- </xs:sequence>
- </xs:complexType>
<xs:complexType name="InvalidCartridgeDefinitionException">
<xs:sequence>
<xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
@@ -739,6 +666,12 @@
<xs:complexType name="CartridgeAlreadyExistsException">
<xs:sequence/>
</xs:complexType>
+ <xs:complexType name="NetworkPartitionAlreadyExistsException">
+ <xs:sequence/>
+ </xs:complexType>
+ <xs:complexType name="NetworkPartitionNotExistsException">
+ <xs:sequence/>
+ </xs:complexType>
<xs:complexType name="CartridgeDefinitionNotExistsException">
<xs:sequence>
<xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
@@ -749,42 +682,47 @@
<xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="InvalidPartitionException">
+ <xs:complexType name="NonExistingKubernetesClusterException">
<xs:sequence>
<xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="InvalidClusterException">
+ <xs:complexType name="NonExistingKubernetesHostException">
<xs:sequence>
<xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="UnregisteredClusterException">
+ <xs:complexType name="InvalidKubernetesClusterException">
<xs:sequence>
<xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="ApplicationClusterRegistrationException">
+ <xs:complexType name="InvalidPartitionException">
<xs:sequence>
<xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="ClusterInstanceCreationException">
+ <xs:complexType name="InvalidClusterException">
<xs:sequence>
<xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="InvalidKubernetesClusterException">
+ <xs:complexType name="UnregisteredClusterException">
<xs:sequence>
<xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="InvalidKubernetesHostException">
+ <xs:complexType name="ApplicationClusterRegistrationException">
<xs:sequence>
<xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="NonExistingKubernetesHostException">
+ <xs:complexType name="ClusterInstanceCreationException">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="InvalidKubernetesHostException">
<xs:sequence>
<xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
</xs:sequence>
@@ -799,21 +737,6 @@
<xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="DeploymentPolicyAlreadyExistsException">
- <xs:sequence/>
- </xs:complexType>
- <xs:complexType name="InvalidDeploymentPolicyException">
- <xs:sequence/>
- </xs:complexType>
- <xs:complexType name="DeploymentPolicyNotExistsException">
- <xs:sequence/>
- </xs:complexType>
- <xs:complexType name="NetworkPartitionAlreadyExistsException">
- <xs:sequence/>
- </xs:complexType>
- <xs:complexType name="NetworkPartitionNotExistsException">
- <xs:sequence/>
- </xs:complexType>
</xs:schema>
<xs:schema xmlns:ax210="http://common.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://kubernetes.domain.controller.cloud.stratos.apache.org/xsd">
<xs:import namespace="http://common.stratos.apache.org/xsd"/>
@@ -866,10 +789,87 @@
</xs:extension>
</xs:complexContent>
</xs:complexType>
- </xs:schema>
- <xs:schema xmlns:ax28="http://domain.common.stratos.apache.org/xsd" xmlns:ax25="http://common.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://domain.controller.cloud.stratos.apache.org/xsd">
- <xs:import namespace="http://common.stratos.apache.org/xsd"/>
- <xs:import namespace="http://domain.common.stratos.apache.org/xsd"/>
+ </xs:schema>
+ <xs:schema xmlns:ax28="http://domain.common.stratos.apache.org/xsd" xmlns:ax25="http://common.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://domain.controller.cloud.stratos.apache.org/xsd">
+ <xs:import namespace="http://common.stratos.apache.org/xsd"/>
+ <xs:import namespace="http://domain.common.stratos.apache.org/xsd"/>
+ <xs:complexType name="InstanceContext">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="cartridgeType" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="clusterInstanceId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="initTime" type="xs:long"/>
+ <xs:element minOccurs="0" name="networkPartitionId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="obsoleteExpiryTime" type="xs:long"/>
+ <xs:element minOccurs="0" name="partition" nillable="true" type="ax23:Partition"/>
+ <xs:element minOccurs="0" name="properties" nillable="true" type="ax25:Properties"/>
+ <xs:element minOccurs="0" name="volumeRequired" type="xs:boolean"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="volumes" nillable="true" type="ax23:Volume"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="Partition">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="description" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="isPublic" type="xs:boolean"/>
+ <xs:element minOccurs="0" name="kubernetesClusterId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="partitionMax" type="xs:int"/>
+ <xs:element minOccurs="0" name="properties" nillable="true" type="ax25:Properties"/>
+ <xs:element minOccurs="0" name="provider" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="Volume">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="device" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="iaasType" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="mappingPath" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="removeOntermination" type="xs:boolean"/>
+ <xs:element minOccurs="0" name="size" type="xs:int"/>
+ <xs:element minOccurs="0" name="snapshotId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="volumeId" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="MemberContext">
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="allocatedIPs" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="cartridgeType" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="clusterInstanceId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="defaultPrivateIP" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="defaultPublicIP" nillable="true" type="xs:string"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="dynamicPayload" nillable="true" type="ax27:NameValuePair"/>
+ <xs:element minOccurs="0" name="initTime" type="xs:long"/>
+ <xs:element minOccurs="0" name="instanceId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="instanceMetadata" nillable="true" type="ax23:InstanceMetadata"/>
+ <xs:element minOccurs="0" name="kubernetesPodId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="kubernetesPodLabel" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="lbClusterId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="loadBalancingIPType" nillable="true" type="ax27:LoadBalancingIPType"/>
+ <xs:element minOccurs="0" name="memberId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="networkPartitionId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="obsoleteExpiryTime" type="xs:long"/>
+ <xs:element minOccurs="0" name="obsoleteInitTime" type="xs:long"/>
+ <xs:element minOccurs="0" name="partition" nillable="true" type="ax23:Partition"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="privateIPs" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="properties" nillable="true" type="ax25:Properties"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="publicIPs" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="InstanceMetadata">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="hostname" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="hypervisor" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="imageId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="loginPort" type="xs:int"/>
+ <xs:element minOccurs="0" name="operatingSystem64bit" type="xs:boolean"/>
+ <xs:element minOccurs="0" name="operatingSystemArchitecture" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="operatingSystemName" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="operatingSystemVersion" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="ram" type="xs:int"/>
+ </xs:sequence>
+ </xs:complexType>
<xs:complexType name="Cartridge">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="appTypeMappings" nillable="true" type="ax23:AppType"/>
@@ -945,18 +945,6 @@
<xs:element maxOccurs="unbounded" minOccurs="0" name="volumes" nillable="true" type="ax23:Volume"/>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="Volume">
- <xs:sequence>
- <xs:element minOccurs="0" name="device" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="iaasType" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="mappingPath" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="removeOntermination" type="xs:boolean"/>
- <xs:element minOccurs="0" name="size" type="xs:int"/>
- <xs:element minOccurs="0" name="snapshotId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="volumeId" nillable="true" type="xs:string"/>
- </xs:sequence>
- </xs:complexType>
<xs:complexType name="PortMapping">
<xs:sequence>
<xs:element minOccurs="0" name="kubernetesServicePort" type="xs:int"/>
@@ -966,86 +954,15 @@
<xs:element minOccurs="0" name="proxyPort" type="xs:int"/>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="ClusterContext">
- <xs:sequence>
- <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="cartridgeType" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="hostName" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="kubernetesClusterId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="kubernetesServices" nillable="true" type="xs:anyType"/>
- <xs:element minOccurs="0" name="lbCluster" type="xs:boolean"/>
- <xs:element minOccurs="0" name="payload" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="properties" nillable="true" type="ax25:Properties"/>
- <xs:element minOccurs="0" name="timeoutInMillis" type="xs:long"/>
- <xs:element minOccurs="0" name="volumeRequired" type="xs:boolean"/>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="volumes" nillable="true" type="ax23:Volume"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="InstanceContext">
- <xs:sequence>
- <xs:element minOccurs="0" name="cartridgeType" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="clusterInstanceId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="initTime" type="xs:long"/>
- <xs:element minOccurs="0" name="networkPartitionId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="obsoleteExpiryTime" type="xs:long"/>
- <xs:element minOccurs="0" name="partition" nillable="true" type="ax23:Partition"/>
- <xs:element minOccurs="0" name="properties" nillable="true" type="ax25:Properties"/>
- <xs:element minOccurs="0" name="volumeRequired" type="xs:boolean"/>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="volumes" nillable="true" type="ax23:Volume"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="Partition">
+ <xs:complexType name="NetworkPartition">
<xs:sequence>
- <xs:element minOccurs="0" name="description" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="activeByDefault" type="xs:boolean"/>
<xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="isPublic" type="xs:boolean"/>
- <xs:element minOccurs="0" name="kubernetesClusterId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="properties" nillable="true" type="ax25:Properties"/>
+ <xs:element minOccurs="0" name="partitionAlgo" nillable="true" type="xs:string"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="partitions" nillable="true" type="ax23:Partition"/>
<xs:element minOccurs="0" name="provider" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="MemberContext">
- <xs:sequence>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="allocatedIPs" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="cartridgeType" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="clusterInstanceId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="defaultPrivateIP" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="defaultPublicIP" nillable="true" type="xs:string"/>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="dynamicPayload" nillable="true" type="ax27:NameValuePair"/>
- <xs:element minOccurs="0" name="initTime" type="xs:long"/>
- <xs:element minOccurs="0" name="instanceId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="instanceMetadata" nillable="true" type="ax23:InstanceMetadata"/>
- <xs:element minOccurs="0" name="kubernetesPodId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="kubernetesPodLabel" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="lbClusterId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="loadBalancingIPType" nillable="true" type="ax27:LoadBalancingIPType"/>
- <xs:element minOccurs="0" name="memberId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="networkPartitionId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="obsoleteExpiryTime" type="xs:long"/>
- <xs:element minOccurs="0" name="obsoleteInitTime" type="xs:long"/>
- <xs:element minOccurs="0" name="partition" nillable="true" type="ax23:Partition"/>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="privateIPs" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="properties" nillable="true" type="ax25:Properties"/>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="publicIPs" nillable="true" type="xs:string"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="InstanceMetadata">
- <xs:sequence>
- <xs:element minOccurs="0" name="hostname" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="hypervisor" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="imageId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="loginPort" type="xs:int"/>
- <xs:element minOccurs="0" name="operatingSystem64bit" type="xs:boolean"/>
- <xs:element minOccurs="0" name="operatingSystemArchitecture" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="operatingSystemName" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="operatingSystemVersion" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="ram" type="xs:int"/>
- </xs:sequence>
- </xs:complexType>
<xs:complexType name="ServiceGroup">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="cartridges" nillable="true" type="xs:string"/>
@@ -1060,6 +977,22 @@
<xs:element maxOccurs="unbounded" minOccurs="0" name="startupOrders" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
+ <xs:complexType name="ClusterContext">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="cartridgeType" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="hostName" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="kubernetesClusterId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="kubernetesServices" nillable="true" type="xs:anyType"/>
+ <xs:element minOccurs="0" name="lbCluster" type="xs:boolean"/>
+ <xs:element minOccurs="0" name="payload" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="properties" nillable="true" type="ax25:Properties"/>
+ <xs:element minOccurs="0" name="timeoutInMillis" type="xs:long"/>
+ <xs:element minOccurs="0" name="volumeRequired" type="xs:boolean"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="volumes" nillable="true" type="ax23:Volume"/>
+ </xs:sequence>
+ </xs:complexType>
<xs:complexType name="Registrant">
<xs:sequence>
<xs:element minOccurs="0" name="autoScalerPolicyName" nillable="true" type="xs:string"/>
@@ -1089,41 +1022,8 @@
<xs:element maxOccurs="unbounded" minOccurs="0" name="volumes" nillable="true" type="ax23:Volume"/>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="DeploymentPolicy">
- <xs:sequence>
- <xs:element minOccurs="0" name="deploymentPolicyID" nillable="true" type="xs:string"/>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="networkPartitionsRef" nillable="true" type="ax23:NetworkPartitionRef"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="NetworkPartitionRef">
- <xs:sequence>
- <xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="partitionAlgo" nillable="true" type="xs:string"/>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="partitions" nillable="true" type="ax23:PartitionRef"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="PartitionRef">
- <xs:sequence>
- <xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="max" type="xs:int"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="NetworkPartition">
- <xs:sequence>
- <xs:element minOccurs="0" name="activeByDefault" type="xs:boolean"/>
- <xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="partitions" nillable="true" type="ax23:Partition"/>
- <xs:element minOccurs="0" name="provider" nillable="true" type="xs:string"/>
- </xs:sequence>
- </xs:complexType>
</xs:schema>
</wsdl:types>
- <wsdl:message name="getDeploymentPoliciesRequest">
- <wsdl:part name="parameters" element="ns:getDeploymentPolicies"/>
- </wsdl:message>
- <wsdl:message name="getDeploymentPoliciesResponse">
- <wsdl:part name="parameters" element="ns:getDeploymentPoliciesResponse"/>
- </wsdl:message>
<wsdl:message name="getCartridgesRequest">
<wsdl:part name="parameters" element="ns:getCartridges"/>
</wsdl:message>
@@ -1157,12 +1057,6 @@
<wsdl:message name="CloudControllerServiceApplicationClusterRegistrationException">
<wsdl:part name="parameters" element="ns:CloudControllerServiceApplicationClusterRegistrationException"/>
</wsdl:message>
- <wsdl:message name="getDeploymentPolicyRequest">
- <wsdl:part name="parameters" element="ns:getDeploymentPolicy"/>
- </wsdl:message>
- <wsdl:message name="getDeploymentPolicyResponse">
- <wsdl:part name="parameters" element="ns:getDeploymentPolicyResponse"/>
- </wsdl:message>
<wsdl:message name="removeKubernetesClusterRequest">
<wsdl:part name="parameters" element="ns:removeKubernetesCluster"/>
</wsdl:message>
@@ -1172,14 +1066,14 @@
<wsdl:message name="CloudControllerServiceNonExistingKubernetesClusterException">
<wsdl:part name="parameters" element="ns:CloudControllerServiceNonExistingKubernetesClusterException"/>
</wsdl:message>
- <wsdl:message name="validateDeploymentPolicyRequest">
- <wsdl:part name="parameters" element="ns:validateDeploymentPolicy"/>
+ <wsdl:message name="getServiceGroupCartridgesRequest">
+ <wsdl:part name="parameters" element="ns:getServiceGroupCartridges"/>
</wsdl:message>
- <wsdl:message name="validateDeploymentPolicyResponse">
- <wsdl:part name="parameters" element="ns:validateDeploymentPolicyResponse"/>
+ <wsdl:message name="getServiceGroupCartridgesResponse">
+ <wsdl:part name="parameters" element="ns:getServiceGroupCartridgesResponse"/>
</wsdl:message>
- <wsdl:message name="CloudControllerServiceInvalidCartridgeTypeException">
- <wsdl:part name="parameters" element="ns:CloudControllerServiceInvalidCartridgeTypeException"/>
+ <wsdl:message name="CloudControllerServiceInvalidServiceGroupException">
+ <wsdl:part name="parameters" element="ns:CloudControllerServiceInvalidServiceGroupException"/>
</wsdl:message>
<wsdl:message name="getCartridgeRequest">
<wsdl:part name="parameters" element="ns:getCartridge"/>
@@ -1190,6 +1084,15 @@
<wsdl:message name="CloudControllerServiceCartridgeNotFoundException">
<wsdl:part name="parameters" element="ns:CloudControllerServiceCartridgeNotFoundException"/>
</wsdl:message>
+ <wsdl:message name="addKubernetesClusterRequest">
+ <wsdl:part name="parameters" element="ns:addKubernetesCluster"/>
+ </wsdl:message>
+ <wsdl:message name="addKubernetesClusterResponse">
+ <wsdl:part name="parameters" element="ns:addKubernetesClusterResponse"/>
+ </wsdl:message>
+ <wsdl:message name="CloudControllerServiceInvalidKubernetesClusterException">
+ <wsdl:part name="parameters" element="ns:CloudControllerServiceInvalidKubernetesClusterException"/>
+ </wsdl:message>
<wsdl:message name="registerServiceRequest">
<wsdl:part name="parameters" element="ns:registerService"/>
</wsdl:message>
@@ -1199,42 +1102,18 @@
<wsdl:message name="addServiceGroupRequest">
<wsdl:part name="parameters" element="ns:addServiceGroup"/>
</wsdl:message>
- <wsdl:message name="CloudControllerServiceInvalidServiceGroupException">
- <wsdl:part name="parameters" element="ns:CloudControllerServiceInvalidServiceGroupException"/>
- </wsdl:message>
<wsdl:message name="terminateInstanceRequest">
<wsdl:part name="parameters" element="ns:terminateInstance"/>
</wsdl:message>
<wsdl:message name="CloudControllerServiceInvalidMemberException">
<wsdl:part name="parameters" element="ns:CloudControllerServiceInvalidMemberException"/>
</wsdl:message>
+ <wsdl:message name="CloudControllerServiceInvalidCartridgeTypeException">
+ <wsdl:part name="parameters" element="ns:CloudControllerServiceInvalidCartridgeTypeException"/>
+ </wsdl:message>
<wsdl:message name="CloudControllerServiceCloudControllerException">
<wsdl:part name="parameters" element="ns:CloudControllerServiceCloudControllerException"/>
</wsdl:message>
- <wsdl:message name="addDeployementPolicyRequest">
- <wsdl:part name="parameters" element="ns:addDeployementPolicy"/>
- </wsdl:message>
- <wsdl:message name="CloudControllerServiceDeploymentPolicyAlreadyExistsException">
- <wsdl:part name="parameters" element="ns:CloudControllerServiceDeploymentPolicyAlreadyExistsException"/>
- </wsdl:message>
- <wsdl:message name="CloudControllerServiceInvalidDeploymentPolicyException">
- <wsdl:part name="parameters" element="ns:CloudControllerServiceInvalidDeploymentPolicyException"/>
- </wsdl:message>
- <wsdl:message name="getServiceGroupCartridgesRequest">
- <wsdl:part name="parameters" element="ns:getServiceGroupCartridges"/>
- </wsdl:message>
- <wsdl:message name="getServiceGroupCartridgesResponse">
- <wsdl:part name="parameters" element="ns:getServiceGroupCartridgesResponse"/>
- </wsdl:message>
- <wsdl:message name="addKubernetesClusterRequest">
- <wsdl:part name="parameters" element="ns:addKubernetesCluster"/>
- </wsdl:message>
- <wsdl:message name="addKubernetesClusterResponse">
- <wsdl:part name="parameters" element="ns:addKubernetesClusterResponse"/>
- </wsdl:message>
- <wsdl:message name="CloudControllerServiceInvalidKubernetesClusterException">
- <wsdl:part name="parameters" element="ns:CloudControllerServiceInvalidKubernetesClusterException"/>
- </wsdl:message>
<wsdl:message name="getServiceGroupDependenciesRequest">
<wsdl:part name="parameters" element="ns:getServiceGroupDependencies"/>
</wsdl:message>
@@ -1271,15 +1150,6 @@
<wsdl:message name="CloudControllerServiceInvalidKubernetesHostException">
<wsdl:part name="parameters" element="ns:CloudControllerServiceInvalidKubernetesHostException"/>
</wsdl:message>
- <wsdl:message name="updateDeployementPolicyRequest">
- <wsdl:part name="parameters" element="ns:updateDeployementPolicy"/>
- </wsdl:message>
- <wsdl:message name="CloudControllerServiceDeploymentPolicyNotExistsException">
- <wsdl:part name="parameters" element="ns:CloudControllerServiceDeploymentPolicyNotExistsException"/>
- </wsdl:message>
- <wsdl:message name="removeDeployementPolicyRequest">
- <wsdl:part name="parameters" element="ns:removeDeployementPolicy"/>
- </wsdl:message>
<wsdl:message name="createClusterInstanceRequest">
<wsdl:part name="parameters" element="ns:createClusterInstance"/>
</wsdl:message>
@@ -1322,6 +1192,12 @@
<wsdl:message name="getMasterForKubernetesClusterResponse">
<wsdl:part name="parameters" element="ns:getMasterForKubernetesClusterResponse"/>
</wsdl:message>
+ <wsdl:message name="validateDeploymentPolicyNetworkPartitionRequest">
+ <wsdl:part name="parameters" element="ns:validateDeploymentPolicyNetworkPartition"/>
+ </wsdl:message>
+ <wsdl:message name="validateDeploymentPolicyNetworkPartitionResponse">
+ <wsdl:part name="parameters" element="ns:validateDeploymentPolicyNetworkPartitionResponse"/>
+ </wsdl:message>
<wsdl:message name="startInstancesRequest">
<wsdl:part name="parameters" element="ns:startInstances"/>
</wsdl:message>
@@ -1346,18 +1222,18 @@
<wsdl:message name="startInstanceResponse">
<wsdl:part name="parameters" element="ns:startInstanceResponse"/>
</wsdl:message>
- <wsdl:message name="getNetworkPartitionRequest">
- <wsdl:part name="parameters" element="ns:getNetworkPartition"/>
- </wsdl:message>
- <wsdl:message name="getNetworkPartitionResponse">
- <wsdl:part name="parameters" element="ns:getNetworkPartitionResponse"/>
- </wsdl:message>
<wsdl:message name="terminateInstancesRequest">
<wsdl:part name="parameters" element="ns:terminateInstances"/>
</wsdl:message>
<wsdl:message name="CloudControllerServiceInvalidClusterException">
<wsdl:part name="parameters" element="ns:CloudControllerServiceInvalidClusterException"/>
</wsdl:message>
+ <wsdl:message name="getNetworkPartitionRequest">
+ <wsdl:part name="parameters" element="ns:getNetworkPartition"/>
+ </wsdl:message>
+ <wsdl:message name="getNetworkPartitionResponse">
+ <wsdl:part name="parameters" element="ns:getNetworkPartitionResponse"/>
+ </wsdl:message>
<wsdl:message name="updateClusterStatusRequest">
<wsdl:part name="parameters" element="ns:updateClusterStatus"/>
</wsdl:message>
@@ -1404,10 +1280,6 @@
<wsdl:part name="parameters" element="ns:CloudControllerServiceCartridgeAlreadyExistsException"/>
</wsdl:message>
<wsdl:portType name="CloudControllerServicePortType">
- <wsdl:operation name="getDeploymentPolicies">
- <wsdl:input message="ns:getDeploymentPoliciesRequest" wsaw:Action="urn:getDeploymentPolicies"/>
- <wsdl:output message="ns:getDeploymentPoliciesResponse" wsaw:Action="urn:getDeploymentPoliciesResponse"/>
- </wsdl:operation>
<wsdl:operation name="getCartridges">
<wsdl:input message="ns:getCartridgesRequest" wsaw:Action="urn:getCartridges"/>
<wsdl:output message="ns:getCartridgesResponse" wsaw:Action="urn:getCartridgesResponse"/>
@@ -1427,26 +1299,26 @@
<wsdl:input message="ns:createApplicationClustersRequest" wsaw:Action="urn:createApplicationClusters"/>
<wsdl:fault message="ns:CloudControllerServiceApplicationClusterRegistrationException" name="CloudControllerServiceApplicationClusterRegistrationException" wsaw:Action="urn:createApplicationClustersCloudControllerServiceApplicationClusterRegistrationException"/>
</wsdl:operation>
- <wsdl:operation name="getDeploymentPolicy">
- <wsdl:input message="ns:getDeploymentPolicyRequest" wsaw:Action="urn:getDeploymentPolicy"/>
- <wsdl:output message="ns:getDeploymentPolicyResponse" wsaw:Action="urn:getDeploymentPolicyResponse"/>
- </wsdl:operation>
<wsdl:operation name="removeKubernetesCluster">
<wsdl:input message="ns:removeKubernetesClusterRequest" wsaw:Action="urn:removeKubernetesCluster"/>
<wsdl:output message="ns:removeKubernetesClusterResponse" wsaw:Action="urn:removeKubernetesClusterResponse"/>
<wsdl:fault message="ns:CloudControllerServiceNonExistingKubernetesClusterException" name="CloudControllerServiceNonExistingKubernetesClusterException" wsaw:Action="urn:removeKubernetesClusterCloudControllerServiceNonExistingKubernetesClusterException"/>
</wsdl:operation>
- <wsdl:operation name="validateDeploymentPolicy">
- <wsdl:input message="ns:validateDeploymentPolicyRequest" wsaw:Action="urn:validateDeploymentPolicy"/>
- <wsdl:output message="ns:validateDeploymentPolicyResponse" wsaw:Action="urn:validateDeploymentPolicyResponse"/>
- <wsdl:fault message="ns:CloudControllerServiceInvalidPartitionException" name="CloudControllerServiceInvalidPartitionException" wsaw:Action="urn:validateDeploymentPolicyCloudControllerServiceInvalidPartitionException"/>
- <wsdl:fault message="ns:CloudControllerServiceInvalidCartridgeTypeException" name="CloudControllerServiceInvalidCartridgeTypeException" wsaw:Action="urn:validateDeploymentPolicyCloudControllerServiceInvalidCartridgeTypeException"/>
+ <wsdl:operation name="getServiceGroupCartridges">
+ <wsdl:input message="ns:getServiceGroupCartridgesRequest" wsaw:Action="urn:getServiceGroupCartridges"/>
+ <wsdl:output message="ns:getServiceGroupCartridgesResponse" wsaw:Action="urn:getServiceGroupCartridgesResponse"/>
+ <wsdl:fault message="ns:CloudControllerServiceInvalidServiceGroupException" name="CloudControllerServiceInvalidServiceGroupException" wsaw:Action="urn:getServiceGroupCartridgesCloudControllerServiceInvalidServiceGroupException"/>
</wsdl:operation>
<wsdl:operation name="getCartridge">
<wsdl:input message="ns:getCartridgeRequest" wsaw:Action="urn:getCartridge"/>
<wsdl:output message="ns:getCartridgeResponse" wsaw:Action="urn:getCartridgeResponse"/>
<wsdl:fault message="ns:CloudControllerServiceCartridgeNotFoundException" name="CloudControllerServiceCartridgeNotFoundException" wsaw:Action="urn:getCartridgeCloudControllerServiceCartridgeNotFoundException"/>
</wsdl:operation>
+ <wsdl:operation name="addKubernetesCluster">
+ <wsdl:input message="ns:addKubernetesClusterRequest" wsaw:Action="urn:addKubernetesCluster"/>
+ <wsdl:output message="ns:addKubernetesClusterResponse" wsaw:Action="urn:addKubernetesClusterResponse"/>
+ <wsdl:fault message="ns:CloudControllerServiceInvalidKubernetesClusterException" name="CloudControllerServiceInvalidKubernetesClusterException" wsaw:Action="urn:addKubernetesClusterCloudControllerServiceInvalidKubernetesClusterException"/>
+ </wsdl:operation>
<wsdl:operation name="registerService">
<wsdl:input message="ns:registerServiceRequest" wsaw:Action="urn:registerService"/>
<wsdl:output message="ns:registerServiceResponse" wsaw:Action="urn:registerServiceResponse"/>
@@ -1462,21 +1334,6 @@
<wsdl:fault message="ns:CloudControllerServiceInvalidCartridgeTypeException" name="CloudControllerServiceInvalidCartridgeTypeException" wsaw:Action="urn:terminateInstanceCloudControllerServiceInvalidCartridgeTypeException"/>
<wsdl:fault message="ns:CloudControllerServiceCloudControllerException" name="CloudControllerServiceCloudControllerException" wsaw:Action="urn:terminateInstanceCloudControllerServiceCloudControllerException"/>
</wsdl:operation>
- <wsdl:operation name="addDeployementPolicy">
- <wsdl:input message="ns:addDeployementPolicyRequest" wsaw:Action="urn:addDeployementPolicy"/>
- <wsdl:fault message="ns:CloudControllerServiceDeploymentPolicyAlreadyExistsException" name="CloudControllerServiceDeploymentPolicyAlreadyExistsException" wsaw:Action="urn:addDeployementPolicyCloudControllerServiceDeploymentPolicyAlreadyExistsException"/>
- <wsdl:fault message="ns:CloudControllerServiceInvalidDeploymentPolicyException" name="CloudControllerServiceInvalidDeploymentPolicyException" wsaw:Action="urn:addDeployementPolicyCloudControllerServiceInvalidDeploymentPolicyException"/>
- </wsdl:operation>
- <wsdl:operation name="getServiceGroupCartridges">
- <wsdl:input message="ns:getServiceGroupCartridgesRequest" wsaw:Action="urn:getServiceGroupCartridges"/>
- <wsdl:output message="ns:getServiceGroupCartridgesResponse" wsaw:Action="urn:getServiceGroupCartridgesResponse"/>
- <wsdl:fault message="ns:CloudControllerServiceInvalidServiceGroupException" name="CloudControllerServiceInvalidServiceGroupException" wsaw:Action="urn:getServiceGroupCartridgesCloudControllerServiceInvalidServiceGroupException"/>
- </wsdl:operation>
- <wsdl:operation name="addKubernetesCluster">
- <wsdl:input message="ns:addKubernetesClusterRequest" wsaw:Action="urn:addKubernetesCluster"/>
- <wsdl:output message="ns:addKubernetesClusterResponse" wsaw:Action="urn:addKubernetesClusterResponse"/>
- <wsdl:fault message="ns:CloudControllerServiceInvalidKubernetesClusterException" name="CloudControllerServiceInvalidKubernetesClusterException" wsaw:Action="urn:addKubernetesClusterCloudControllerServiceInvalidKubernetesClusterException"/>
- </wsdl:operation>
<wsdl:operation name="getServiceGroupDependencies">
<wsdl:input message="ns:getServiceGroupDependenciesRequest" wsaw:Action="urn:getServiceGroupDependencies"/>
<wsdl:output message="ns:getServiceGroupDependenciesResponse" wsaw:Action="urn:getServiceGroupDependenciesResponse"/>
@@ -1506,15 +1363,6 @@
<wsdl:fault message="ns:CloudControllerServiceInvalidKubernetesHostException" name="CloudControllerServiceInvalidKubernetesHostException" wsaw:Action="urn:addKubernetesHostCloudControllerServiceInvalidKubernetesHostException"/>
<wsdl:fault message="ns:CloudControllerServiceNonExistingKubernetesClusterException" name="CloudControllerServiceNonExistingKubernetesClusterException" wsaw:Action="urn:addKubernetesHostCloudControllerServiceNonExistingKubernetesClusterException"/>
</wsdl:operation>
- <wsdl:operation name="updateDeployementPolicy">
- <wsdl:input message="ns:updateDeployementPolicyRequest" wsaw:Action="urn:updateDeployementPolicy"/>
- <wsdl:fault message="ns:CloudControllerServiceDeploymentPolicyNotExistsException" name="CloudControllerServiceDeploymentPolicyNotExistsException" wsaw:Action="urn:updateDeployementPolicyCloudControllerServiceDeploymentPolicyNotExistsException"/>
- <wsdl:fault message="ns:CloudControllerServiceInvalidDeploymentPolicyException" name="CloudControllerServiceInvalidDeploymentPolicyException" wsaw:Action="urn:updateDeployementPolicyCloudControllerServiceInvalidDeploymentPolicyException"/>
- </wsdl:operation>
- <wsdl:operation name="removeDeployementPolicy">
- <wsdl:input message="ns:removeDeployementPolicyRequest" wsaw:Action="urn:removeDeployementPolicy"/>
- <wsdl:fault message="ns:CloudControllerServiceDeploymentPolicyNotExistsException" name="CloudControllerServiceDeploymentPolicyNotExistsException" wsaw:Action="urn:removeDeployementPolicyCloudControllerServiceDeploymentPolicyNotExistsException"/>
- </wsdl:operation>
<wsdl:operation name="createClusterInstance">
<wsdl:input message="ns:createClusterInstanceRequest" wsaw:Action="urn:createClusterInstance"/>
<wsdl:fault message="ns:CloudControllerServiceClusterInstanceCreationException" name="CloudControllerServiceClusterInstanceCreationException" wsaw:Action="urn:createClusterInstanceCloudControllerServiceClusterInstanceCreationException"/>
@@ -1545,6 +1393,12 @@
<wsdl:output message="ns:getMasterForKubernetesClusterResponse" wsaw:Action="urn:getMasterForKubernetesClusterResponse"/>
<wsdl:fault message="ns:CloudControllerServiceNonExistingKubernetesClusterException" name="CloudControllerServiceNonExistingKubernetesClusterException" wsaw:Action="urn:getMasterForKubernetesClu
<TRUNCATED>
[15/20] stratos git commit: Deployment policy move: add partition max
to Partition class
Posted by la...@apache.org.
Deployment policy move: add partition max to Partition class
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/abf417f5
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/abf417f5
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/abf417f5
Branch: refs/heads/master
Commit: abf417f5d6f11861d636b9046345c6aeca64c18e
Parents: 6fccb2c
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Tue Apr 7 08:13:29 2015 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Tue Apr 7 08:13:29 2015 +0530
----------------------------------------------------------------------
.../java/org/apache/stratos/common/partition/Partition.java | 9 +++++++++
1 file changed, 9 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/abf417f5/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/Partition.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/Partition.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/Partition.java
index 54b93e4..ceadab4 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/Partition.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/Partition.java
@@ -39,6 +39,7 @@ public class Partition implements Serializable {
private String id;
private String description;
private boolean isPublic;
+ private int partitionMax;
private Properties properties = new Properties();
/**
@@ -150,4 +151,12 @@ public class Partition implements Serializable {
public int hashCode() {
return this.id.hashCode();
}
+
+ public int getPartitionMax() {
+ return partitionMax;
+ }
+
+ public void setPartitionMax(int partitionMax) {
+ this.partitionMax = partitionMax;
+ }
}
[19/20] stratos git commit: Deployment policy move: Update CC stub
Posted by la...@apache.org.
Deployment policy move: Update CC stub
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/ea98c489
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/ea98c489
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/ea98c489
Branch: refs/heads/master
Commit: ea98c489d9e119d43e890350fcec6a6d4985a5c6
Parents: 0981c4e
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Tue Apr 7 08:23:25 2015 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Tue Apr 7 08:23:25 2015 +0530
----------------------------------------------------------------------
.../pom.xml | 1 +
.../main/resources/CloudControllerService.wsdl | 1136 +++++++-----------
2 files changed, 427 insertions(+), 710 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/ea98c489/service-stubs/org.apache.stratos.cloud.controller.service.stub/pom.xml
----------------------------------------------------------------------
diff --git a/service-stubs/org.apache.stratos.cloud.controller.service.stub/pom.xml b/service-stubs/org.apache.stratos.cloud.controller.service.stub/pom.xml
index 4169f7d..13b1605 100644
--- a/service-stubs/org.apache.stratos.cloud.controller.service.stub/pom.xml
+++ b/service-stubs/org.apache.stratos.cloud.controller.service.stub/pom.xml
@@ -93,6 +93,7 @@
org.apache.stratos.cloud.controller.stub.services.impl.*; version=${project.version},
org.apache.stratos.cloud.controller.stub.kubernetes.*; version=${project.version},
org.apache.stratos.cloud.controller.stub.*; version=${project.version},
+ org.apache.stratos.common.partition.xsd.*; version=${project.version},
</Export-Package>
<Import-Package>
*;resolution:=optional
[10/20] stratos git commit: Deployment policy move:Add deployment
policy management stuff to AS service
Posted by la...@apache.org.
Deployment policy move:Add deployment policy management stuff to AS service
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/171e6227
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/171e6227
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/171e6227
Branch: refs/heads/master
Commit: 171e622742f9ddeb15e3099d2331be5184fa498b
Parents: dc76149
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Tue Apr 7 08:07:33 2015 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Tue Apr 7 08:07:33 2015 +0530
----------------------------------------------------------------------
.../autoscaler/services/AutoscalerService.java | 44 +-
.../services/impl/AutoscalerServiceImpl.java | 504 +++++++++++++------
2 files changed, 388 insertions(+), 160 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/171e6227/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/AutoscalerService.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/AutoscalerService.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/AutoscalerService.java
index ae268bd..a461706 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/AutoscalerService.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/AutoscalerService.java
@@ -27,11 +27,11 @@ import org.apache.stratos.autoscaler.exception.InvalidArgumentException;
import org.apache.stratos.autoscaler.exception.application.ApplicationDefinitionException;
import org.apache.stratos.autoscaler.exception.application.InvalidApplicationPolicyException;
import org.apache.stratos.autoscaler.exception.application.InvalidServiceGroupException;
-import org.apache.stratos.autoscaler.exception.policy.ApplicatioinPolicyNotExistsException;
-import org.apache.stratos.autoscaler.exception.policy.InvalidPolicyException;
+import org.apache.stratos.autoscaler.exception.policy.*;
import org.apache.stratos.autoscaler.pojo.ServiceGroup;
import org.apache.stratos.autoscaler.pojo.policy.autoscale.AutoscalePolicy;
import org.apache.stratos.autoscaler.pojo.policy.deployment.ApplicationPolicy;
+import org.apache.stratos.autoscaler.pojo.policy.deployment.DeploymentPolicy;
import org.apache.stratos.common.Properties;
import java.rmi.RemoteException;
@@ -190,4 +190,44 @@ public interface AutoscalerService {
public String findClusterId(String applicationId, String alias);
public String[] getApplicationNetworkPartitions(String applicationId) throws AutoScalerException;
+
+ /**
+ * Add a deployment policy
+ *
+ * @param deploymentPolicy DeployementPolicy
+ * @throws InvalidDeploymentPolicyException if the deployment policy is not valid
+ * @throws IllegalArgumentException if the provided argument is not valid.
+ */
+ public void addDeployementPolicy(DeploymentPolicy deploymentPolicy) throws DeploymentPolicyAlreadyExistsException,
+ InvalidDeploymentPolicyException, RemoteException, DeploymentPolicyNotExistsException;
+
+ /**
+ * Update existing deployment policy
+ *
+ * @param deploymentPolicy DeployementPolicy
+ * @throws IllegalArgumentException if the provided argument is not valid.
+ */
+ public void updateDeployementPolicy(DeploymentPolicy deploymentPolicy) throws DeploymentPolicyNotExistsException, InvalidDeploymentPolicyException, RemoteException;
+
+ /**
+ * Remove deployment policy
+ *
+ * @param deploymentPolicyID deploymentPolicyID
+ * @throws IllegalArgumentException if the provided argument is not valid.
+ */
+ public void removeDeployementPolicy(String deploymentPolicyID) throws DeploymentPolicyNotExistsException, DeploymentPolicyNotExistsException;
+
+ /**
+ * Get deployment policy definition
+ * @param deploymentPolicyID
+ * @return
+ */
+ public DeploymentPolicy getDeploymentPolicy(String deploymentPolicyID);
+
+ /**
+ * Get deployment policies
+ * @return array of {@link DeploymentPolicy}
+ */
+ public DeploymentPolicy[] getDeploymentPolicies();
+
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/171e6227/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java
index b48148b..e801ac5 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java
@@ -33,8 +33,7 @@ import org.apache.stratos.autoscaler.exception.InvalidArgumentException;
import org.apache.stratos.autoscaler.exception.application.ApplicationDefinitionException;
import org.apache.stratos.autoscaler.exception.application.InvalidApplicationPolicyException;
import org.apache.stratos.autoscaler.exception.application.InvalidServiceGroupException;
-import org.apache.stratos.autoscaler.exception.policy.ApplicatioinPolicyNotExistsException;
-import org.apache.stratos.autoscaler.exception.policy.InvalidPolicyException;
+import org.apache.stratos.autoscaler.exception.policy.*;
import org.apache.stratos.autoscaler.monitor.cluster.ClusterMonitor;
import org.apache.stratos.autoscaler.monitor.component.ApplicationMonitor;
import org.apache.stratos.autoscaler.pojo.Dependencies;
@@ -42,12 +41,15 @@ import org.apache.stratos.autoscaler.pojo.ServiceGroup;
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.ApplicationPolicy;
+import org.apache.stratos.autoscaler.pojo.policy.deployment.DeploymentPolicy;
import org.apache.stratos.autoscaler.registry.RegistryManager;
import org.apache.stratos.autoscaler.services.AutoscalerService;
import org.apache.stratos.autoscaler.util.AutoscalerUtil;
import org.apache.stratos.common.Properties;
import org.apache.stratos.common.client.CloudControllerServiceClient;
import org.apache.stratos.common.client.StratosManagerServiceClient;
+import org.apache.stratos.common.constants.StratosConstants;
+import org.apache.stratos.common.partition.NetworkPartition;
import org.apache.stratos.common.util.CommonUtil;
import org.apache.stratos.manager.service.stub.domain.application.signup.ApplicationSignUp;
import org.apache.stratos.manager.service.stub.domain.application.signup.ArtifactRepository;
@@ -84,35 +86,35 @@ public class AutoscalerServiceImpl implements AutoscalerService {
return PolicyManager.getInstance().updateAutoscalePolicy(autoscalePolicy);
}
- @Override
- public boolean removeAutoScalingPolicy(String autoscalePolicyId) throws InvalidPolicyException {
- if(validateAutoScalerPolicy(autoscalePolicyId)) {
- return PolicyManager.getInstance().removeAutoscalePolicy(autoscalePolicyId);
- }
- else{
- throw new InvalidPolicyException("This autoscaler policy cannot be removed, since it is used in applications.");
- }
- }
-
- /**
- * Validate the Auto Scalar policy removal
- * @param autoscalePolicyId Auto Scalar policy id boolean
- * @return
- */
- private boolean validateAutoScalerPolicy(String autoscalePolicyId) {
- boolean canRemove=true;
- Collection<ApplicationContext> appContexts= AutoscalerContext.getInstance().getApplicationContexts();
- for(ApplicationContext app:appContexts){
- CartridgeContext[] cartrideContexts=app.getComponents().getCartridgeContexts();
- for(CartridgeContext cartridgeContext: cartrideContexts) {
- SubscribableInfoContext subscribableInfoContexts = cartridgeContext.getSubscribableInfoContext();
- if (subscribableInfoContexts.getAutoscalingPolicy().equals(autoscalePolicyId)) {
- canRemove=false;
- }
- }
- }
- return canRemove;
- }
+ @Override
+ public boolean removeAutoScalingPolicy(String autoscalePolicyId) throws InvalidPolicyException {
+ if (validateAutoScalerPolicy(autoscalePolicyId)) {
+ return PolicyManager.getInstance().removeAutoscalePolicy(autoscalePolicyId);
+ } else {
+ throw new InvalidPolicyException("This autoscaler policy cannot be removed, since it is used in applications.");
+ }
+ }
+
+ /**
+ * Validate the Auto Scalar policy removal
+ *
+ * @param autoscalePolicyId Auto Scalar policy id boolean
+ * @return
+ */
+ private boolean validateAutoScalerPolicy(String autoscalePolicyId) {
+ boolean canRemove = true;
+ Collection<ApplicationContext> appContexts = AutoscalerContext.getInstance().getApplicationContexts();
+ for (ApplicationContext app : appContexts) {
+ CartridgeContext[] cartrideContexts = app.getComponents().getCartridgeContexts();
+ for (CartridgeContext cartridgeContext : cartrideContexts) {
+ SubscribableInfoContext subscribableInfoContexts = cartridgeContext.getSubscribableInfoContext();
+ if (subscribableInfoContexts.getAutoscalingPolicy().equals(autoscalePolicyId)) {
+ canRemove = false;
+ }
+ }
+ }
+ return canRemove;
+ }
@Override
public AutoscalePolicy getAutoscalingPolicy(String autoscalingPolicyId) {
@@ -123,7 +125,7 @@ public class AutoscalerServiceImpl implements AutoscalerService {
public void addApplication(ApplicationContext applicationContext)
throws ApplicationDefinitionException {
- if(log.isInfoEnabled()) {
+ if (log.isInfoEnabled()) {
log.info(String.format("Adding application: [application-id] %s",
applicationContext.getApplicationId()));
}
@@ -140,7 +142,7 @@ public class AutoscalerServiceImpl implements AutoscalerService {
applicationContext.setStatus(ApplicationContext.STATUS_CREATED);
AutoscalerContext.getInstance().addApplicationContext(applicationContext);
- if(log.isInfoEnabled()) {
+ if (log.isInfoEnabled()) {
log.info(String.format("Application added successfully: [application-id] %s",
applicationContext.getApplicationId()));
}
@@ -169,40 +171,40 @@ public class AutoscalerServiceImpl implements AutoscalerService {
if (applicationContext == null) {
throw new RuntimeException("Application context not found: " + applicationId);
}
-
+
// Create application clusters in cloud controller and send application created event
ApplicationBuilder.handleApplicationCreatedEvent(application, applicationContext.getComponents().getApplicationClusterContexts());
- // validating application policy against the application
+ // validating application policy against the application
AutoscalerUtil.validateApplicationPolicyAgainstApplication(applicationId, applicationPolicyId);
// Setting application policy id in application object
try {
- ApplicationHolder.acquireWriteLock();
- application = ApplicationHolder.getApplications().getApplication(applicationId);
- application.setApplicationPolicyId(applicationPolicyId);
- ApplicationHolder.persistApplication(application);
+ ApplicationHolder.acquireWriteLock();
+ application = ApplicationHolder.getApplications().getApplication(applicationId);
+ application.setApplicationPolicyId(applicationPolicyId);
+ ApplicationHolder.persistApplication(application);
} finally {
- ApplicationHolder.releaseWriteLock();
+ ApplicationHolder.releaseWriteLock();
}
-
+
// adding network partition algorithm context to registry
ApplicationPolicy applicationPolicy = PolicyManager.getInstance().getApplicationPolicy(applicationPolicyId);
- NetworkPartitionAlgorithmContext algorithmContext = new NetworkPartitionAlgorithmContext(applicationId, applicationPolicy, 0);
- AutoscalerContext.getInstance().addNetworkPartitionAlgorithmContext(algorithmContext);
+ NetworkPartitionAlgorithmContext algorithmContext = new NetworkPartitionAlgorithmContext(applicationId, applicationPolicy, 0);
+ AutoscalerContext.getInstance().addNetworkPartitionAlgorithmContext(algorithmContext);
- if(!applicationContext.isMultiTenant()) {
- // Add application signup for single tenant applications
- addApplicationSignUp(applicationContext, application.getKey(), findApplicationClusterIds(application));
- }
- applicationContext.setStatus(ApplicationContext.STATUS_DEPLOYED);
- AutoscalerContext.getInstance().updateApplicationContext(applicationContext);
+ if (!applicationContext.isMultiTenant()) {
+ // Add application signup for single tenant applications
+ addApplicationSignUp(applicationContext, application.getKey(), findApplicationClusterIds(application));
+ }
+ applicationContext.setStatus(ApplicationContext.STATUS_DEPLOYED);
+ AutoscalerContext.getInstance().updateApplicationContext(applicationContext);
log.info("Waiting for application clusters to be created: [application] " + applicationId);
return true;
} catch (Exception e) {
ApplicationContext applicationContext = RegistryManager.getInstance().getApplicationContext(applicationId);
- if(applicationContext != null) {
+ if (applicationContext != null) {
// Revert application status
applicationContext.setStatus(ApplicationContext.STATUS_CREATED);
AutoscalerContext.getInstance().updateApplicationContext(applicationContext);
@@ -215,12 +217,13 @@ public class AutoscalerServiceImpl implements AutoscalerService {
/**
* Find application cluster ids.
+ *
* @param application
* @return
*/
private List<String> findApplicationClusterIds(Application application) {
List<String> clusterIds = new ArrayList<String>();
- for(ClusterDataHolder clusterDataHolder : application.getClusterDataRecursively()) {
+ for (ClusterDataHolder clusterDataHolder : application.getClusterDataRecursively()) {
clusterIds.add(clusterDataHolder.getClusterId());
}
return clusterIds;
@@ -228,6 +231,7 @@ public class AutoscalerServiceImpl implements AutoscalerService {
/**
* Add application signup.
+ *
* @param applicationContext
* @param applicationKey
* @param clusterIds
@@ -236,7 +240,7 @@ public class AutoscalerServiceImpl implements AutoscalerService {
List<String> clusterIds) {
try {
- if(log.isInfoEnabled()) {
+ if (log.isInfoEnabled()) {
log.info(String.format("Adding application signup: [application-id] %s",
applicationContext.getApplicationId()));
}
@@ -255,7 +259,7 @@ public class AutoscalerServiceImpl implements AutoscalerService {
updateArtifactRepositoryList(artifactRepositoryList, cartridgeContexts);
}
- if(components.getGroupContexts() != null){
+ if (components.getGroupContexts() != null) {
CartridgeContext[] cartridgeContextsOfGroups = getCartridgeContextsOfGroupsRecursively(
components.getGroupContexts());
if (cartridgeContextsOfGroups != null) {
@@ -273,7 +277,7 @@ public class AutoscalerServiceImpl implements AutoscalerService {
StratosManagerServiceClient serviceClient = StratosManagerServiceClient.getInstance();
serviceClient.addApplicationSignUp(applicationSignUp);
- if(log.isInfoEnabled()) {
+ if (log.isInfoEnabled()) {
log.info(String.format("Application signup added successfully: [application-id] %s",
applicationContext.getApplicationId()));
}
@@ -290,15 +294,15 @@ public class AutoscalerServiceImpl implements AutoscalerService {
List<CartridgeContext> cartridgeContextsList = new ArrayList<CartridgeContext>();
- for(GroupContext groupContext : passedGroupContexts){
- if(groupContext.getCartridgeContexts() != null){
- for(CartridgeContext cartridgeContext : groupContext.getCartridgeContexts()){
+ for (GroupContext groupContext : passedGroupContexts) {
+ if (groupContext.getCartridgeContexts() != null) {
+ for (CartridgeContext cartridgeContext : groupContext.getCartridgeContexts()) {
cartridgeContextsList.add(cartridgeContext);
}
}
- if(groupContext.getGroupContexts() != null){
- for(CartridgeContext cartridgeContext : getCartridgeContextsOfGroupsRecursively(groupContext.getGroupContexts())){
+ if (groupContext.getGroupContexts() != null) {
+ for (CartridgeContext cartridgeContext : getCartridgeContextsOfGroupsRecursively(groupContext.getGroupContexts())) {
cartridgeContextsList.add(cartridgeContext);
}
@@ -307,7 +311,7 @@ public class AutoscalerServiceImpl implements AutoscalerService {
return cartridgeContextsList.toArray(new CartridgeContext[0]);
}
- private void removeApplicationSignUp(ApplicationContext applicationContext){
+ private void removeApplicationSignUp(ApplicationContext applicationContext) {
try {
if (log.isInfoEnabled()) {
log.info(String.format("Removing application signup: [application-id] %s",
@@ -317,15 +321,15 @@ public class AutoscalerServiceImpl implements AutoscalerService {
StratosManagerServiceClient serviceClient = StratosManagerServiceClient.getInstance();
ApplicationSignUp applicationSignUp[] = serviceClient.getApplicationSignUps(applicationContext.getApplicationId());
- if ( applicationSignUp != null){
- for(ApplicationSignUp appSignUp : applicationSignUp) {
- if ( appSignUp != null) {
+ if (applicationSignUp != null) {
+ for (ApplicationSignUp appSignUp : applicationSignUp) {
+ if (appSignUp != null) {
serviceClient.removeApplicationSignUp(appSignUp.getApplicationId(), appSignUp.getTenantId());
}
}
}
- }catch(Exception e){
+ } catch (Exception e) {
String message = "Could not remove application signup(s)";
log.error(message, e);
throw new RuntimeException(message, e);
@@ -334,6 +338,7 @@ public class AutoscalerServiceImpl implements AutoscalerService {
/**
* Encrypt artifact repository passwords.
+ *
* @param applicationSignUp
* @param applicationKey
*/
@@ -357,15 +362,15 @@ public class AutoscalerServiceImpl implements AutoscalerService {
}
private void updateArtifactRepositoryList(List<ArtifactRepository> artifactRepositoryList, CartridgeContext[] cartridgeContexts) {
-
- if (cartridgeContexts == null) {
- return;
- }
-
- for(CartridgeContext cartridgeContext : cartridgeContexts) {
+
+ if (cartridgeContexts == null) {
+ return;
+ }
+
+ for (CartridgeContext cartridgeContext : cartridgeContexts) {
SubscribableInfoContext subscribableInfoContext = cartridgeContext.getSubscribableInfoContext();
ArtifactRepositoryContext artifactRepositoryContext = subscribableInfoContext.getArtifactRepositoryContext();
- if(artifactRepositoryContext != null) {
+ if (artifactRepositoryContext != null) {
ArtifactRepository artifactRepository = new ArtifactRepository();
artifactRepository.setCartridgeType(cartridgeContext.getType());
@@ -380,37 +385,37 @@ public class AutoscalerServiceImpl implements AutoscalerService {
}
}
- public void undeployApplication(String applicationId, boolean force){
+ public void undeployApplication(String applicationId, boolean force) {
AutoscalerContext asCtx = AutoscalerContext.getInstance();
ApplicationMonitor appMonitor = asCtx.getAppMonitor(applicationId);
- if(appMonitor == null){
+ if (appMonitor == null) {
log.info(String.format("Could not find application monitor for the application %s, hence returning", applicationId));
return;
}
- if(! force){
+ if (!force) {
// Gracefull undeployment flow
- if(appMonitor.isTerminating()){
+ if (appMonitor.isTerminating()) {
log.info("Application monitor is already in terminating, graceful undeployment is has already been attempted thus not invoking again");
return;
- }else{
+ } else {
log.info(String.format("Gracefully undeploying the application " + applicationId));
undeployApplicationGracefully(applicationId);
}
- }else{
+ } else {
// force undeployment flow
if (appMonitor.isTerminating()) {
- if(appMonitor.isForce()){
+ if (appMonitor.isForce()) {
log.warn("Force undeployment is already in progress, hence not invoking again");
return;
- }else{
+ } else {
log.info(String.format("Previous gracefull undeployment is in progress for [application-id] %s , thus terminating instances directly", applicationId));
appMonitor.setForce(true);
terminateAllApplicationMembersForcefully(applicationId);
}
- }else{
+ } else {
log.info(String.format("Forcefully undeploying the application " + applicationId));
appMonitor.setForce(true);
undeployApplicationGracefully(applicationId);
@@ -445,7 +450,7 @@ public class AutoscalerServiceImpl implements AutoscalerService {
AutoscalerContext.getInstance().removeNetworkPartitionAlgorithmContext(applicationId);
ApplicationBuilder.handleApplicationUnDeployedEvent(applicationId);
-
+
if (log.isInfoEnabled()) {
log.info("Application undeployment process started: [application-id] " + applicationId);
}
@@ -514,7 +519,7 @@ public class AutoscalerServiceImpl implements AutoscalerService {
}
- if(log.isInfoEnabled()) {
+ if (log.isInfoEnabled()) {
log.info(String.format("Adding cartridge group: [group-name] %s", servicegroup.getName()));
}
String groupName = servicegroup.getName();
@@ -567,7 +572,7 @@ public class AutoscalerServiceImpl implements AutoscalerService {
}
RegistryManager.getInstance().persistServiceGroup(servicegroup);
- if(log.isInfoEnabled()) {
+ if (log.isInfoEnabled()) {
log.info(String.format("Cartridge group successfully added: [group-name] %s", servicegroup.getName()));
}
}
@@ -575,16 +580,16 @@ public class AutoscalerServiceImpl implements AutoscalerService {
@Override
public void removeServiceGroup(String groupName) {
try {
- if(log.isInfoEnabled()) {
+ if (log.isInfoEnabled()) {
log.info(String.format("Starting to remove cartridge group: [group-name] %s", groupName));
}
- if(RegistryManager.getInstance().serviceGroupExist(groupName)) {
+ if (RegistryManager.getInstance().serviceGroupExist(groupName)) {
RegistryManager.getInstance().removeServiceGroup(groupName);
- if(log.isInfoEnabled()) {
+ if (log.isInfoEnabled()) {
log.info(String.format("Cartridge group removed: [group-name] %s", groupName));
}
} else {
- if(log.isWarnEnabled()) {
+ if (log.isWarnEnabled()) {
log.warn(String.format("Cartridge group not found: [group-name] %s", groupName));
}
}
@@ -610,10 +615,10 @@ public class AutoscalerServiceImpl implements AutoscalerService {
public String findClusterId(String applicationId, String alias) {
try {
Application application = ApplicationManager.getApplications().getApplication(applicationId);
- if(application != null) {
+ if (application != null) {
ClusterDataHolder clusterData = application.getClusterDataHolderRecursivelyByAlias(alias);
- if(clusterData != null) {
+ if (clusterData != null) {
return clusterData.getClusterId();
}
}
@@ -642,87 +647,87 @@ public class AutoscalerServiceImpl implements AutoscalerService {
}
- @Override
- public String[] getApplicationNetworkPartitions(String applicationId)
- throws AutoScalerException {
- List<String> networkPartitionIds = AutoscalerUtil.getNetworkPartitionIdsReferedInApplication(applicationId);
- if (networkPartitionIds == null) {
- return null;
- }
- return networkPartitionIds.toArray(new String[networkPartitionIds.size()]);
- }
-
- @Override
- public void addApplicationPolicy(ApplicationPolicy applicationPolicy)
- throws RemoteException, InvalidApplicationPolicyException, InvalidPolicyException {
-
- // validating application policy
- AutoscalerUtil.validateApplicationPolicy(applicationPolicy);
- // Add application policy to the registry
- PolicyManager.getInstance().addApplicationPolicy(applicationPolicy);
- }
-
- @Override
- public ApplicationPolicy getApplicationPolicy(String applicationPolicyId) {
- return PolicyManager.getInstance().getApplicationPolicy(applicationPolicyId);
- }
-
- @Override
- public void removeApplicationPolicy(String applicationPolicyId) throws InvalidPolicyException {
- PolicyManager.getInstance().removeApplicationPolicy(applicationPolicyId);
- }
-
- @Override
- public void updateApplicationPolicy(ApplicationPolicy applicationPolicy)
- throws InvalidApplicationPolicyException, RemoteException, ApplicatioinPolicyNotExistsException {
-
- if (applicationPolicy == null) {
- String msg = "Application policy is null";
- log.error(msg);
- throw new InvalidApplicationPolicyException(msg);
- }
-
- String applicationPolicyId = applicationPolicy.getId();
- ApplicationPolicy existingApplicationPolicy = PolicyManager.getInstance().getApplicationPolicy(applicationPolicyId);
- if (existingApplicationPolicy == null) {
- String msg = String.format("No such application poliicy found [application-policy-id] %s", applicationPolicyId);
- log.error(msg);
- throw new ApplicatioinPolicyNotExistsException(msg);
- }
-
- // validating application policy
- AutoscalerUtil.validateApplicationPolicy(applicationPolicy);
-
- // updating application policy
- PolicyManager.getInstance().updateApplicationPolicy(applicationPolicy);
- }
-
- @Override
- public ApplicationPolicy[] getApplicationPolicies() {
- return PolicyManager.getInstance().getApplicationPolicies();
- }
-
- private void terminateAllApplicationMembersForcefully(String applicationId) {
- if (StringUtils.isEmpty(applicationId)){
+ @Override
+ public String[] getApplicationNetworkPartitions(String applicationId)
+ throws AutoScalerException {
+ List<String> networkPartitionIds = AutoscalerUtil.getNetworkPartitionIdsReferedInApplication(applicationId);
+ if (networkPartitionIds == null) {
+ return null;
+ }
+ return networkPartitionIds.toArray(new String[networkPartitionIds.size()]);
+ }
+
+ @Override
+ public void addApplicationPolicy(ApplicationPolicy applicationPolicy)
+ throws RemoteException, InvalidApplicationPolicyException, InvalidPolicyException {
+
+ // validating application policy
+ AutoscalerUtil.validateApplicationPolicy(applicationPolicy);
+ // Add application policy to the registry
+ PolicyManager.getInstance().addApplicationPolicy(applicationPolicy);
+ }
+
+ @Override
+ public ApplicationPolicy getApplicationPolicy(String applicationPolicyId) {
+ return PolicyManager.getInstance().getApplicationPolicy(applicationPolicyId);
+ }
+
+ @Override
+ public void removeApplicationPolicy(String applicationPolicyId) throws InvalidPolicyException {
+ PolicyManager.getInstance().removeApplicationPolicy(applicationPolicyId);
+ }
+
+ @Override
+ public void updateApplicationPolicy(ApplicationPolicy applicationPolicy)
+ throws InvalidApplicationPolicyException, RemoteException, ApplicatioinPolicyNotExistsException {
+
+ if (applicationPolicy == null) {
+ String msg = "Application policy is null";
+ log.error(msg);
+ throw new InvalidApplicationPolicyException(msg);
+ }
+
+ String applicationPolicyId = applicationPolicy.getId();
+ ApplicationPolicy existingApplicationPolicy = PolicyManager.getInstance().getApplicationPolicy(applicationPolicyId);
+ if (existingApplicationPolicy == null) {
+ String msg = String.format("No such application poliicy found [application-policy-id] %s", applicationPolicyId);
+ log.error(msg);
+ throw new ApplicatioinPolicyNotExistsException(msg);
+ }
+
+ // validating application policy
+ AutoscalerUtil.validateApplicationPolicy(applicationPolicy);
+
+ // updating application policy
+ PolicyManager.getInstance().updateApplicationPolicy(applicationPolicy);
+ }
+
+ @Override
+ public ApplicationPolicy[] getApplicationPolicies() {
+ return PolicyManager.getInstance().getApplicationPolicies();
+ }
+
+ private void terminateAllApplicationMembersForcefully(String applicationId) {
+ if (StringUtils.isEmpty(applicationId)) {
throw new IllegalArgumentException("Application Id can not be empty");
}
Application application;
- try{
+ try {
ApplicationManager.acquireReadLockForApplication(applicationId);
application = ApplicationManager.getApplications().getApplication(applicationId);
- if(application == null){
+ if (application == null) {
log.warn(String.format("Could not find application, thus no members to be terminated [application-id] %s", applicationId));
return;
}
- }finally {
+ } finally {
ApplicationManager.releaseReadLockForApplication(applicationId);
}
Set<ClusterDataHolder> allClusters = application.getClusterDataRecursively();
//CloudControllerServiceClient cloudControllerServiceClient = CloudControllerServiceClient.getInstance().ter
- for(ClusterDataHolder clusterDataHolder : allClusters){
+ for (ClusterDataHolder clusterDataHolder : allClusters) {
String serviceType = clusterDataHolder.getServiceType();
String clusterId = clusterDataHolder.getClusterId();
@@ -730,16 +735,16 @@ public class AutoscalerServiceImpl implements AutoscalerService {
try {
TopologyManager.acquireReadLockForCluster(serviceType, clusterId);
cluster = TopologyManager.getTopology().getService(serviceType).getCluster(clusterId);
- }finally {
+ } finally {
TopologyManager.releaseReadLockForCluster(serviceType, clusterId);
}
List<String> memberListToTerminate = new LinkedList<String>();
- for(Member member : cluster.getMembers()){
+ for (Member member : cluster.getMembers()) {
memberListToTerminate.add(member.getMemberId());
}
- for(String memberIdToTerminate : memberListToTerminate){
+ for (String memberIdToTerminate : memberListToTerminate) {
try {
log.info(String.format("Terminating member forcefully [member-id] %s of the cluster [cluster-id] %s [application-id] %s", memberIdToTerminate, clusterId, application));
CloudControllerServiceClient.getInstance().terminateInstanceForcefully(memberIdToTerminate);
@@ -750,4 +755,187 @@ public class AutoscalerServiceImpl implements AutoscalerService {
}
}
+
+
+ @Override
+ public void addDeployementPolicy(DeploymentPolicy deploymentPolicy) throws RemoteException,
+ InvalidDeploymentPolicyException, DeploymentPolicyNotExistsException, DeploymentPolicyAlreadyExistsException {
+
+ validateDeploymentPolicy(deploymentPolicy);
+
+ if (log.isInfoEnabled()) {
+ log.info("Adding deployment policy: [deployment-policy-id] " + deploymentPolicy.getDeploymentPolicyID());
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("Deployment policy definition: " + deploymentPolicy.toString());
+ }
+
+ String deploymentPolicyID = deploymentPolicy.getDeploymentPolicyID();
+ if (PolicyManager.getInstance().getDeploymentPolicy(deploymentPolicyID) != null) {
+ String message = "Deployment policy already exists: [deployment-policy-id] " + deploymentPolicyID;
+ log.error(message);
+ throw new DeploymentPolicyAlreadyExistsException(message);
+ }
+ // Add cartridge to the cloud controller context and persist
+ PolicyManager.getInstance().addDeploymentPolicy(deploymentPolicy);
+
+ // PolicyManager.getInstance().persist();
+
+ if (log.isInfoEnabled()) {
+ log.info("Successfully added deployment policy: [deployment-policy-id] " + deploymentPolicyID);
+ }
+ }
+
+ private boolean validateDeploymentPolicy(DeploymentPolicy deploymentPolicy) throws DeploymentPolicyNotExistsException,
+ InvalidDeploymentPolicyException, RemoteException {
+
+ // deployment policy can't be null
+ if (null == deploymentPolicy) {
+ String msg = "Invalid deployment policy. Cause -> Deployment policy is null";
+ log.error(msg);
+ throw new InvalidDeploymentPolicyException(msg);
+ }
+
+ if (log.isInfoEnabled()) {
+ log.info(String.format("Validating deployment policy %s", deploymentPolicy.toString()));
+ }
+
+ // deployment policy id can't be null or empty
+ if (null == deploymentPolicy.getDeploymentPolicyID() || deploymentPolicy.getDeploymentPolicyID().isEmpty()) {
+ String msg = String.format("Invalid deployment policy. Cause -> Invalid deployment policy id [deployment-policy-id] %s",
+ deploymentPolicy.getDeploymentPolicyID());
+ log.error(msg);
+ throw new InvalidDeploymentPolicyException(msg);
+ }
+
+ // deployment policy should contain at least one network partition reference
+ if (null == deploymentPolicy.getNetworkPartitions() || deploymentPolicy.getNetworkPartitions().length == 0) {
+ String msg = String.format("Invalid deployment policy - [deployment-policy-id] %s. "
+ + "Cause -> Deployment policy doesn't have at least one network partition reference",
+ deploymentPolicy.getDeploymentPolicyID());
+ log.error(msg);
+ throw new InvalidDeploymentPolicyException(msg);
+ }
+
+ // validate each network partition references
+ for (NetworkPartition networkPartition : deploymentPolicy.getNetworkPartitions()) {
+
+ // network partition id can't be null or empty
+ if (null == networkPartition.getId() || networkPartition.getId().isEmpty()) {
+ String msg = String.format("Invalid deployment policy - [deployment-policy-id] %s. "
+ + "Cause -> Invalid network partition id in network partition references section",
+ deploymentPolicy.getDeploymentPolicyID());
+ log.error(msg);
+ throw new InvalidDeploymentPolicyException(msg);
+ }
+
+ // network partitions should be already added
+ if (null == CloudControllerServiceClient.getInstance().getNetworkPartition(networkPartition.getId())) {
+ String msg = String.format("Invalid deployment policy - [deployment-policy-id] %s. "
+ + "Cause -> Network partition is not added - [network-partition-id] %s",
+ deploymentPolicy.getDeploymentPolicyID(), networkPartition.getId());
+ log.error(msg);
+ throw new InvalidDeploymentPolicyException(msg);
+ }
+
+ // partition algorithm can't be null or empty
+ if (null == networkPartition.getPartitionAlgo() || networkPartition.getPartitionAlgo().isEmpty()) {
+ String msg = String.format("Invalid deployment policy - [deployment-policy-id] %s. "
+ + "Cause -> Invalid partition algorithm - [network-partition-id] %s [partition-algo] %s",
+ deploymentPolicy.getDeploymentPolicyID(), networkPartition.getId(), networkPartition.getPartitionAlgo());
+ log.error(msg);
+ throw new InvalidDeploymentPolicyException(msg);
+ }
+
+ // partition algorithm should be either one-after-another or round-robin
+ if (!StratosConstants.PARTITION_ROUND_ROBIN_ALGORITHM_ID.equals(networkPartition.getPartitionAlgo())
+ && !StratosConstants.PARTITION_ONE_AFTER_ANOTHER_ALGORITHM_ID.equals(networkPartition.getPartitionAlgo())) {
+ String msg = String.format("Invalid deployment policy - [deployment-policy-id] %s. "
+ + "Cause -> Invalid partition algorithm - [network-partition-id] %s [partition-algo] %s",
+ deploymentPolicy.getDeploymentPolicyID(), networkPartition.getId(), networkPartition.getPartitionAlgo());
+ log.error(msg);
+ throw new InvalidDeploymentPolicyException(msg);
+ }
+
+ // a network partition reference should contain at least one partition reference
+ if (null == networkPartition.getPartitions() || networkPartition.getPartitions().length == 0) {
+ String msg = String.format("Invalid deployment policy - [deployment-policy-id] %s. "
+ + "Cause -> Network partition reference doesn't have at lease one partition reference - "
+ + "[network-partition-id] %s", deploymentPolicy.getDeploymentPolicyID(), networkPartition.getId());
+ log.error(msg);
+ throw new InvalidDeploymentPolicyException(msg);
+ }
+
+ }
+ return true;
+
+ }
+
+ @Override
+ public void updateDeployementPolicy(DeploymentPolicy deploymentPolicy) throws RemoteException,
+ InvalidDeploymentPolicyException, DeploymentPolicyNotExistsException {
+
+ validateDeploymentPolicy(deploymentPolicy);
+
+ if (log.isInfoEnabled()) {
+ log.info("Updating deployment policy: [deployment-policy-id] " + deploymentPolicy.getDeploymentPolicyID());
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("Updating Deployment policy definition: " + deploymentPolicy.toString());
+ }
+
+ String deploymentPolicyID = deploymentPolicy.getDeploymentPolicyID();
+ if (PolicyManager.getInstance().getDeploymentPolicy(deploymentPolicyID) == null) {
+ String message = "Deployment policy not exists: [deployment-policy-id] " + deploymentPolicyID;
+ log.error(message);
+ throw new DeploymentPolicyNotExistsException(message);
+ }
+
+ // Add cartridge to the cloud controller context and persist
+ PolicyManager.getInstance().addDeploymentPolicy(deploymentPolicy);
+ // PolicyManager.getInstance().persist();
+
+ if (log.isInfoEnabled()) {
+ log.info("Successfully updated deployment policy: [deployment-policy-id] " + deploymentPolicyID);
+ }
+
+ }
+
+ @Override
+ public void removeDeployementPolicy(String deploymentPolicyID) throws DeploymentPolicyNotExistsException {
+ if (log.isInfoEnabled()) {
+ log.info("Removing deployment policy: [deployment-policy_id] " + deploymentPolicyID);
+ }
+ if (PolicyManager.getInstance().getDeploymentPolicy(deploymentPolicyID) == null) {
+ String message = "Deployment policy not exists: [deployment-policy-id] " + deploymentPolicyID;
+ log.error(message);
+ throw new DeploymentPolicyNotExistsException(message);
+ }
+ PolicyManager.getInstance().removeDeploymentPolicy(deploymentPolicyID);
+ if (log.isInfoEnabled()) {
+ log.info("Successfully removed deployment policy: [deployment_policy_id] " + deploymentPolicyID);
+ }
+
+ }
+
+ @Override
+ public DeploymentPolicy getDeploymentPolicy(String deploymentPolicyID) {
+ if (log.isDebugEnabled()) {
+ log.debug("Getting deployment policy: [deployment-policy_id] " + deploymentPolicyID);
+ }
+ return PolicyManager.getInstance().getDeploymentPolicy(deploymentPolicyID);
+ }
+
+ @Override
+ public DeploymentPolicy[] getDeploymentPolicies() {
+ try {
+ Collection<DeploymentPolicy> deploymentPolicies = PolicyManager.getInstance().getDeploymentPolicies();
+ return deploymentPolicies.toArray(new DeploymentPolicy[deploymentPolicies.size()]);
+ } catch (Exception e) {
+ String message = "Could not get deployment policies";
+ log.error(message);
+ throw new AutoScalerException(message, e);
+ }
+ }
+
}