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/03/17 19:00:06 UTC

[45/50] [abbrv] stratos git commit: Adding PartitionContext and VolumeContext classes

Adding PartitionContext and VolumeContext classes


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

Branch: refs/heads/master
Commit: b5e765637302bf2a26fc7dd21869c51f82d4a469
Parents: 495e86f
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Tue Mar 17 23:06:19 2015 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Tue Mar 17 23:06:19 2015 +0530

----------------------------------------------------------------------
 .../applications/pojo/PersistenceContext.java   |  54 ++++++++
 .../applications/pojo/VolumeContext.java        | 126 +++++++++++++++++++
 2 files changed, 180 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/b5e76563/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/pojo/PersistenceContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/pojo/PersistenceContext.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/pojo/PersistenceContext.java
new file mode 100644
index 0000000..113089f
--- /dev/null
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/pojo/PersistenceContext.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.autoscaler.applications.pojo;
+
+import java.io.Serializable;
+import java.util.Arrays;
+
+public class PersistenceContext implements Serializable{
+	
+	private static final long serialVersionUID = 3455721979991902731L;
+
+    private boolean persistanceRequired;
+	private Volume[] volumes;
+
+    public String toString () {
+        return "Persistence Required: " + isPersistanceRequired();
+    }
+
+    public boolean isPersistanceRequired() {
+        return persistanceRequired;
+    }
+
+    public void setPersistanceRequired(boolean persistanceRequired) {
+        this.persistanceRequired = persistanceRequired;
+    }
+
+    public Volume[] getVolumes() {
+        return volumes;
+    }
+
+    public void setVolumes(Volume[] volumes) {
+        if(volumes == null) {
+            this.volumes = new Volume[0];
+        } else {
+            this.volumes = Arrays.copyOf(volumes, volumes.length);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/b5e76563/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/pojo/VolumeContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/pojo/VolumeContext.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/pojo/VolumeContext.java
new file mode 100644
index 0000000..a51cc2c
--- /dev/null
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/pojo/VolumeContext.java
@@ -0,0 +1,126 @@
+/*
+ * 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.applications.pojo;
+
+import java.io.Serializable;
+
+public class VolumeContext implements Serializable {
+
+    private static final long serialVersionUID = -794601157257089446L;
+    private String id;
+    private int size;
+	private String device;
+	private boolean removeOntermination;
+    private String mappingPath;
+    private String iaasType;
+    private String snapshotId;
+    private String volumeId;
+
+    public String toString () {
+        return "Persistence Required: " + ", Size: " + getSize() + ", device: " + getDevice() +
+                " mapping path : " + mappingPath + " remove on termination " + isRemoveOntermination() + " SnaphotId " + snapshotId;
+    }
+
+    public int getSize() {
+        return size;
+    }
+
+    public void setSize(int size) {
+        this.size = size;
+    }
+
+    public String getDevice() {
+        return device;
+    }
+
+    public void setDevice(String device) {
+        this.device = device;
+    }
+
+    public boolean isRemoveOntermination() {return removeOntermination;}
+
+    public void setRemoveOntermination(boolean removeOntermination) {
+        this.removeOntermination = removeOntermination;
+    }
+
+    public String getMappingPath() {
+        return mappingPath;
+    }
+
+    public void setMappingPath(String mappingPath) {
+        this.mappingPath = mappingPath;
+    }
+
+	public String getId() {
+		return id;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result + ((id == null) ? 0 : id.hashCode());
+		return result;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		VolumeContext other = (VolumeContext) obj;
+		if (id == null) {
+			if (other.id != null)
+				return false;
+		} else if (!id.equals(other.id))
+			return false;
+		return true;
+	}
+
+	public String getIaasType() {
+		return iaasType;
+	}
+
+	public void setIaasType(String iaasType) {
+		this.iaasType = iaasType;
+	}
+
+	public String getSnapshotId() {
+		return snapshotId;
+	}
+
+	public void setSnapshotId(String snapshotId) {
+		this.snapshotId = snapshotId;
+	}
+
+    public String getVolumeId() {
+        return volumeId;
+    }
+
+    public void setVolumeId(String volumeId) {
+        this.volumeId = volumeId;
+    }
+}