You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ni...@apache.org on 2013/11/28 17:03:41 UTC
[5/8] git commit: CC API uses these POJOs, hence they've added to CC
CC API uses these POJOs, hence they've added to CC
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/25555e86
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/25555e86
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/25555e86
Branch: refs/heads/master
Commit: 25555e861f71de1ee93d7d990b0772e8b81dd6a8
Parents: 2eaac66
Author: Nirmal Fernando <ni...@apache.org>
Authored: Thu Nov 28 21:27:33 2013 +0530
Committer: Nirmal Fernando <ni...@apache.org>
Committed: Thu Nov 28 21:27:33 2013 +0530
----------------------------------------------------------------------
.../deployment/partition/Partition.java | 130 +++++++++++++++++++
.../deployment/partition/PartitionGroup.java | 87 +++++++++++++
.../deployment/policy/DeploymentPolicy.java | 93 +++++++++++++
.../cloud/controller/pojo/Properties.java | 37 ++++++
.../stratos/cloud/controller/pojo/Property.java | 54 ++++++++
5 files changed, 401 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/25555e86/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployment/partition/Partition.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployment/partition/Partition.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployment/partition/Partition.java
new file mode 100644
index 0000000..e434a86
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployment/partition/Partition.java
@@ -0,0 +1,130 @@
+/*
+ * 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.deployment.partition;
+
+import java.io.Serializable;
+
+import org.apache.stratos.cloud.controller.pojo.Properties;
+
+/**
+ * The model class for Partition definition.
+ */
+public class Partition implements Serializable{
+
+ private static final long serialVersionUID = 3725971214092010720L;
+ private int partitionMax;
+ private int partitionMin;
+ /**
+ * provider should match with an IaasProvider type.
+ */
+ private String provider;
+ private Properties properties = new Properties();
+ private String id;
+
+
+ /**
+ * Gets the value of the partitionMax property.
+ *
+ */
+ public int getPartitionMembersMax() {
+ return partitionMax;
+ }
+
+ /**
+ * Sets the value of the partitionMax property.
+ *
+ */
+ public void setPartitionMax(int value) {
+ this.partitionMax = value;
+ }
+
+ /**
+ * Gets the value of the partitionMin property.
+ *
+ */
+ public int getPartitionMembersMin() {
+ return partitionMin;
+ }
+
+ /**
+ * Sets the value of the partitionMin property.
+ *
+ */
+ public void setPartitionMin(int value) {
+ this.partitionMin = value;
+ }
+ /**
+ * Gets the value of the id property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Sets the value of the id property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ 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 toString() {
+ return "Partition Id: "+this.id+", Partition Provider: "+this.provider;
+ }
+
+ 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();
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/25555e86/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployment/partition/PartitionGroup.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployment/partition/PartitionGroup.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployment/partition/PartitionGroup.java
new file mode 100644
index 0000000..2a74c0a
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployment/partition/PartitionGroup.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.cloud.controller.deployment.partition;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * The model class for PartitionGroup definition.
+ */
+public class PartitionGroup implements Serializable{
+
+ private static final long serialVersionUID = -8043298009352097370L;
+ private String id;
+ private String partitionAlgo;
+ private Partition[] partitions;
+
+ /**
+ * Gets the value of the partitionAlgo property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getPartitionAlgo() {
+ return partitionAlgo;
+ }
+
+ /**
+ * Sets the value of the partitionAlgo property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setPartitionAlgo(String value) {
+ this.partitionAlgo = value;
+ }
+
+ public void setPartitions(Partition[] partitions) {
+ this.partitions = partitions;
+ }
+
+ /**
+ * Gets the value of the partitions.
+ */
+ public Partition[] getPartitions() {
+ if (partitions == null) {
+ partitions = new Partition[0];
+ }
+ return this.partitions;
+ }
+
+ /**
+ * Gets the value of the id.
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * sets the value of the id.
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/25555e86/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployment/policy/DeploymentPolicy.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployment/policy/DeploymentPolicy.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployment/policy/DeploymentPolicy.java
new file mode 100644
index 0000000..d8f7ff3
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployment/policy/DeploymentPolicy.java
@@ -0,0 +1,93 @@
+/*
+ * 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.deployment.policy;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.stratos.cloud.controller.deployment.partition.Partition;
+import org.apache.stratos.cloud.controller.deployment.partition.PartitionGroup;
+
+/**
+ * The model class for Deployment-Policy definition.
+ */
+public class DeploymentPolicy implements Serializable{
+
+ private static final long serialVersionUID = 5675507196284400099L;
+ private String id;
+ private PartitionGroup[] partitionGroups;
+
+ /**
+ * Gets the value of the id property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Sets the value of the id property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setId(String value) {
+ this.id = value;
+ }
+
+ public void setPartitionGroup(PartitionGroup[] groups) {
+ this.partitionGroups = groups;
+ }
+
+ /**
+ * Gets the value of the partition-groups.
+ */
+ public PartitionGroup[] getPartitionGroups() {
+
+ return this.partitionGroups;
+ }
+
+ /**
+ * Returns all the partitions referenced by this policy.
+ * @return List of {@link Partition}
+ */
+ public List<Partition> getAllPartitions() {
+ List<Partition> partitions = new ArrayList<Partition>();
+ for (PartitionGroup group : partitionGroups) {
+ if (group != null) {
+ partitions.addAll(Arrays.asList(group.getPartitions()));
+ }
+ }
+ return partitions;
+ }
+
+ public String toString() {
+ return "Deployment Policy: "+this.id;
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/25555e86/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Properties.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Properties.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Properties.java
new file mode 100644
index 0000000..a13ad12
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Properties.java
@@ -0,0 +1,37 @@
+/*
+ * 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.pojo;
+
+/**
+ * Had to wrap {@link Property} array using a class, since there's a bug in current
+ * stub generation.
+ */
+public class Properties {
+
+ private Property[] properties;
+
+ public Property[] getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Property[] properties) {
+ this.properties = properties;
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/25555e86/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Property.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Property.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Property.java
new file mode 100644
index 0000000..1ffddad
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Property.java
@@ -0,0 +1,54 @@
+/*
+ * 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.pojo;
+
+/**
+ * Holds a property
+ */
+public class Property {
+
+ private String name;
+ private String value;
+
+ public Property(){
+
+ }
+
+ public Property(String name, String value){
+ this.setName(name);
+ this.setValue(value);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+}