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/05/13 19:46:16 UTC

[3/7] stratos git commit: s/NetworkPartition.java/NetworkPartitionRef.java and s/Partition.java/PartitionRef.java for Deployment policy references

s/NetworkPartition.java/NetworkPartitionRef.java and s/Partition.java/PartitionRef.java for Deployment policy references


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

Branch: refs/heads/master
Commit: 6457e891fcf1fc5886b33529acee55ac791ba7fd
Parents: 940053f
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Wed May 13 12:20:48 2015 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Wed May 13 23:16:03 2015 +0530

----------------------------------------------------------------------
 .../common/partition/NetworkPartition.java      | 102 -------------
 .../common/partition/NetworkPartitionRef.java   |  93 ++++++++++++
 .../stratos/common/partition/Partition.java     | 151 -------------------
 .../stratos/common/partition/PartitionRef.java  | 124 +++++++++++++++
 4 files changed, 217 insertions(+), 253 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/6457e891/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
deleted file mode 100644
index b42b4bb..0000000
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/NetworkPartition.java
+++ /dev/null
@@ -1,102 +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.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/6457e891/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/NetworkPartitionRef.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/NetworkPartitionRef.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/NetworkPartitionRef.java
new file mode 100644
index 0000000..c24e8bb
--- /dev/null
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/NetworkPartitionRef.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.common.partition;
+
+import java.io.Serializable;
+import java.util.Arrays;
+
+/**
+ * The model class for NetworkPartition information passed in deployment policy.
+ */
+public class NetworkPartitionRef implements Serializable {
+
+    private static final long serialVersionUID = -8043298009352097370L;
+
+    private String id;
+    private String provider;
+    private PartitionRef[] partitions;
+    private String partitionAlgo;
+
+    public void setPartitions(PartitionRef[] partitions) {
+        if (partitions == null) {
+            this.partitions = partitions;
+        } else {
+            this.partitions = Arrays.copyOf(partitions, partitions.length);
+        }
+    }
+
+    /**
+     * Gets the value of the partitions.
+     */
+    public PartitionRef[] getPartitions() {
+        if (partitions == null) {
+            partitions = new PartitionRef[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 PartitionRef getPartition(String partitionId) {
+        for (PartitionRef 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/6457e891/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
deleted file mode 100644
index 110fdad..0000000
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/Partition.java
+++ /dev/null
@@ -1,151 +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.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 int partitionMax;
-    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();
-    }
-
-    public int getPartitionMax() {
-        return partitionMax;
-    }
-
-    public void setPartitionMax(int partitionMax) {
-        this.partitionMax = partitionMax;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/6457e891/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/PartitionRef.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/PartitionRef.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/PartitionRef.java
new file mode 100644
index 0000000..249cc2c
--- /dev/null
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/PartitionRef.java
@@ -0,0 +1,124 @@
+/*
+ * 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 passed in deployment policy
+ */
+public class PartitionRef implements Serializable {
+
+    private static final long serialVersionUID = 3725971287992010720L;
+
+    private static final String KUBERNETES_CLUSTER = "cluster";
+
+    /**
+     * provider should match with an IaasProvider type.
+     */
+    private String id;
+    private String description;
+    private int partitionMax;
+    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;
+    }
+
+    public Properties getProperties() {
+        return properties;
+    }
+
+    public void setProperties(Properties properties) {
+        this.properties = properties;
+    }
+
+    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 + ", properties=" + properties + "]";
+    }
+
+    public boolean equals(Object obj) {
+        if (obj != null && obj instanceof PartitionRef) {
+            return this.id.equals(((PartitionRef) obj).getId());
+        }
+        return false;
+
+    }
+
+    @Override
+    public int hashCode() {
+        return this.id.hashCode();
+    }
+
+    public int getPartitionMax() {
+        return partitionMax;
+    }
+
+    public void setPartitionMax(int partitionMax) {
+        this.partitionMax = partitionMax;
+    }
+}