summaryrefslogtreecommitdiffstats
path: root/com.gluster.storage.management.client/src/com/gluster
diff options
context:
space:
mode:
Diffstat (limited to 'com.gluster.storage.management.client/src/com/gluster')
-rw-r--r--com.gluster.storage.management.client/src/com/gluster/storage/management/client/GlusterDataModelManager.java12
-rw-r--r--com.gluster.storage.management.client/src/com/gluster/storage/management/client/RunningTaskClient.java2
-rw-r--r--com.gluster.storage.management.client/src/com/gluster/storage/management/client/VolumesClient.java12
3 files changed, 20 insertions, 6 deletions
diff --git a/com.gluster.storage.management.client/src/com/gluster/storage/management/client/GlusterDataModelManager.java b/com.gluster.storage.management.client/src/com/gluster/storage/management/client/GlusterDataModelManager.java
index 01ba6468..4d594f36 100644
--- a/com.gluster.storage.management.client/src/com/gluster/storage/management/client/GlusterDataModelManager.java
+++ b/com.gluster.storage.management.client/src/com/gluster/storage/management/client/GlusterDataModelManager.java
@@ -135,13 +135,23 @@ public class GlusterDataModelManager {
}
}
- private Volume addVolume(List<Volume> volumes, String name, Cluster cluster, VOLUME_TYPE volumeType,
+ public Volume addVolume(List<Volume> volumes, String name, Cluster cluster, VOLUME_TYPE volumeType,
TRANSPORT_TYPE transportType, VOLUME_STATUS status) {
Volume volume = new Volume(name, cluster, volumeType, transportType, status);
volumes.add(volume);
return volume;
}
+
+ public void addVolume(Volume volume ) {
+ Cluster cluster = (Cluster)model.getChildren().get(0);
+ cluster.addVolume(volume);
+
+ for(ClusterListener listener : listeners) {
+ listener.volumeCreated(volume);
+ }
+ }
+
private void initializeVolumes(Cluster cluster) {
List<Volume> volumes = new ArrayList<Volume>();
diff --git a/com.gluster.storage.management.client/src/com/gluster/storage/management/client/RunningTaskClient.java b/com.gluster.storage.management.client/src/com/gluster/storage/management/client/RunningTaskClient.java
index d2305272..9309cdc8 100644
--- a/com.gluster.storage.management.client/src/com/gluster/storage/management/client/RunningTaskClient.java
+++ b/com.gluster.storage.management.client/src/com/gluster/storage/management/client/RunningTaskClient.java
@@ -8,7 +8,7 @@ import com.gluster.storage.management.core.model.RunningTask;
import com.gluster.storage.management.core.model.RunningTaskListResponse;
public class RunningTaskClient extends AbstractClient {
- private static final String RESOURCE_NAME = RESTConstants.PATH_PARAM_RUNNING_TASKS;
+ private static final String RESOURCE_NAME = RESTConstants.RESOURCE_PATH_RUNNING_TASKS;
public RunningTaskClient(String securityToken) {
super(securityToken);
diff --git a/com.gluster.storage.management.client/src/com/gluster/storage/management/client/VolumesClient.java b/com.gluster.storage.management.client/src/com/gluster/storage/management/client/VolumesClient.java
index f1abb5c1..03e83a31 100644
--- a/com.gluster.storage.management.client/src/com/gluster/storage/management/client/VolumesClient.java
+++ b/com.gluster.storage.management.client/src/com/gluster/storage/management/client/VolumesClient.java
@@ -32,7 +32,6 @@ import com.gluster.storage.management.core.model.Volume;
import com.sun.jersey.api.representation.Form;
public class VolumesClient extends AbstractClient {
- private static final String RESOURCE_NAME = "/cluster/volumes"; // TODO: move to common place
public VolumesClient(String securityToken) {
super(securityToken);
@@ -40,13 +39,17 @@ public class VolumesClient extends AbstractClient {
@Override
public String getResourceName() {
- return RESOURCE_NAME;
+ return RESTConstants.RESOURCE_PATH_VOLUMES;
}
@SuppressWarnings("unchecked")
public Status createVolume(Volume volume) {
- GenericResponse<String> response = (GenericResponse<String>) postObject(GenericResponse.class, volume);
- return response.getStatus();
+ GenericResponse<String> createVolumeResponse = (GenericResponse<String>) postObject(GenericResponse.class, volume);
+
+ if (!createVolumeResponse.getStatus().isSuccess()) {
+ return (Status) createVolumeResponse.getStatus();
+ }
+ return (Status) createVolumeResponse.getStatus();
}
private Status performOperation(String volumeName, String operation) {
@@ -64,6 +67,7 @@ public class VolumesClient extends AbstractClient {
return performOperation(volumeName, RESTConstants.FORM_PARAM_VALUE_STOP);
}
+
public static void main(String[] args) {
UsersClient usersClient = new UsersClient();
if (usersClient.authenticate("gluster", "gluster")) {