diff options
author | Selvasundaram <selvam@gluster.com> | 2011-06-20 16:06:23 +0530 |
---|---|---|
committer | Selvasundaram <selvam@gluster.com> | 2011-06-21 12:11:46 +0530 |
commit | 924badad2e1c674ab2021cfdae0037098bf131db (patch) | |
tree | a02fb42c23f2a07f90d1637a5907c12926820fdc /src/com.gluster.storage.management.core/src/com/gluster/storage/management | |
parent | 2bddfe0603ffaba22f3e8bc83e179e49476da018 (diff) | |
parent | d61fa3b93293c6323c29006c97a88968fa2843bf (diff) |
Merge branch 'tasks'
Diffstat (limited to 'src/com.gluster.storage.management.core/src/com/gluster/storage/management')
5 files changed, 17 insertions, 182 deletions
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/RESTConstants.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/RESTConstants.java index 40f13fbe..a082d49b 100644 --- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/RESTConstants.java +++ b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/RESTConstants.java @@ -36,25 +36,28 @@ public class RESTConstants { public static final String RESOURCE_DOWNLOAD = "download"; public static final String RESOURCE_BRICKS = "bricks"; public static final String RESOURCE_DISKS = "disks"; - public static final String RESOURCE_RUNNING_TASKS = "runningtasks"; public static final String RESOURCE_ALERTS = "alerts"; public static final String RESOURCE_SERVERS = "servers"; public static final String RESOURCE_TASKS = "tasks"; + + public static final String TASK_START = "start"; + public static final String TASK_PAUSE = "pause"; + public static final String TASK_RESUME = "resume"; + public static final String TASK_STOP = "stop"; + public static final String TASK_STATUS = "status"; + public static final String TASK_DELETE = "delete"; public static final String FORM_PARAM_CLUSTER_NAME = "clusterName"; public static final String FORM_PARAM_SERVER_NAME = "serverName"; public static final String FORM_PARAM_DISKS = "disks"; public static final String FORM_PARAM_OPERATION = "operation"; - public static final String FORM_PARAM_VALUE_START = "start"; - public static final String FORM_PARAM_VALUE_STOP = "stop"; - public static final String FORM_PARAM_VALUE_PAUSE = "pause"; public static final String FORM_PARAM_VALUE_STATUS = "status"; public static final String FORM_PARAM_OPTION_KEY = "key"; public static final String FORM_PARAM_OPTION_VALUE = "value"; public static final String FORM_PARAM_SOURCE = "source"; public static final String FORM_PARAM_TARGET = "target"; public static final String FORM_PARAM_BRICKS = "bricks"; - public static final String FROM_PARAM_AUTO_COMMIT = "autoCommit"; + public static final String FORM_PARAM_AUTO_COMMIT = "autoCommit"; public static final String PATH_PARAM_VOLUME_NAME = "volumeName"; public static final String PATH_PARAM_CLUSTER_NAME = "clusterName"; @@ -72,5 +75,4 @@ public class RESTConstants { public static final String QUERY_PARAM_TO_TIMESTAMP = "toTimestamp"; public static final String QUERY_PARAM_DOWNLOAD = "download"; public static final String QUERY_PARAM_SERVER_NAME = "serverName"; - public static final String QUERY_PARAM_TASK_OPERATION = "taskOperation"; } diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Cluster.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Cluster.java index adeb72dc..0c094e99 100644 --- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Cluster.java +++ b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Cluster.java @@ -28,7 +28,7 @@ public class Cluster extends Entity { List<GlusterServer> servers = new ArrayList<GlusterServer>(); List<Server> discoveredServers = new ArrayList<Server>(); List<Volume> volumes = new ArrayList<Volume>(); - List<RunningTask> runningTasks = new ArrayList<RunningTask>(); + List<TaskInfo> taskInfoList = new ArrayList<TaskInfo>(); List<Alert> alerts = new ArrayList<Alert>(); public Cluster() { @@ -104,12 +104,16 @@ public class Cluster extends Entity { setVolumes(volumes); } - public List<RunningTask> getRunningTasks() { - return runningTasks; + public List<TaskInfo> getTaskInfoList() { + return taskInfoList; } - public void setRunningTasks(List<RunningTask> runningTasks) { - this.runningTasks = runningTasks; + public void setTaskInfoList(List<TaskInfo> taskInfoList) { + this.taskInfoList = taskInfoList; + } + + public void addTaskInfo(TaskInfo taskInfo) { + this.taskInfoList.add(taskInfo); } public List<Alert> getAlerts() { diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/RunningTask.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/RunningTask.java deleted file mode 100644 index 773137bb..00000000 --- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/RunningTask.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com> - * This file is part of Gluster Management Console. - * - * Gluster Management Console is free software; you can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * Gluster Management Console is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License - * for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * <http://www.gnu.org/licenses/>. - *******************************************************************************/ -package com.gluster.storage.management.core.model; - -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -public class RunningTask { - public enum TASK_TYPES { - DISK_FORMAT, BRICK_MIGRATE, VOLUME_REBALANCE - }; - - public String[] TASK_TYPE_STR = { "Formatting Disk", "Brick Migration", "Volume Rebalance" }; - - protected String id; - protected TASK_TYPES type; - protected String reference; // Server name / Volume name / Disk name - protected String taskInfo; - protected RunningTaskStatus status; // TODO redefine - - public RunningTask() { - - } - - public String getTaskType(TASK_TYPES type) { - return TASK_TYPE_STR[type.ordinal()]; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public TASK_TYPES getType() { - return type; - } - - public void setType(TASK_TYPES type) { - this.type = type; - } - - public String getReference() { - return reference; - } - - public void setReference(String reference) { - this.reference = reference; - } - - public String getTaskInfo() { - return taskInfo; - } - - public void setTaskInfo(String taskInfo) { - this.taskInfo = taskInfo; - } - - public RunningTaskStatus getStatus() { - return status; - } - - public void setStatus(RunningTaskStatus status) { - this.status = status; - } -} diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/RunningTaskStatus.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/RunningTaskStatus.java deleted file mode 100644 index 7ffeb4b8..00000000 --- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/RunningTaskStatus.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.gluster.storage.management.core.model; - -public class RunningTaskStatus extends Status { - - private String status; - private boolean isPercentageSupported; - private float percentCompleted; - private String description; - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public boolean isPercentageSupported() { - return isPercentageSupported; - } - - public void setPercentageSupported(boolean isPercentageSupported) { - this.isPercentageSupported = isPercentageSupported; - } - - public float getPercentCompleted() { - return percentCompleted; - } - - public void getPercentCompleted(float percentCompleted) { - this.percentCompleted = percentCompleted; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getDescription() { - return description; - } -}
\ No newline at end of file diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/RunningTaskListResponse.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/RunningTaskListResponse.java deleted file mode 100644 index 73dc074a..00000000 --- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/RunningTaskListResponse.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.gluster.storage.management.core.response; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementWrapper; -import javax.xml.bind.annotation.XmlRootElement; - -import com.gluster.storage.management.core.model.RunningTask; -import com.gluster.storage.management.core.model.Status; - -@XmlRootElement(name = "response") -public class RunningTaskListResponse extends AbstractResponse { - private List<RunningTask> runningTasks = new ArrayList<RunningTask>(); - - public RunningTaskListResponse() { - - } - - - public RunningTaskListResponse(Status status, List<RunningTask> runningTasks) { - setStatus(status); - setRunningTasks(runningTasks); - } - - @XmlElementWrapper(name = "runningTasks") - @XmlElement(name = "runningTask", type=RunningTask.class) - public List<RunningTask> getRunningTasks() { - return runningTasks; - } - - /** - * @param runningTasks - * the runningTasks to set - */ - public void setRunningTasks(List<RunningTask> runningTasks) { - this.runningTasks = runningTasks; - } - - @Override - public Object getData() { - return getRunningTasks(); - } - -} |