summaryrefslogtreecommitdiffstats
path: root/src/com.gluster.storage.management.client
diff options
context:
space:
mode:
Diffstat (limited to 'src/com.gluster.storage.management.client')
-rw-r--r--src/com.gluster.storage.management.client/src/com/gluster/storage/management/client/GlusterDataModelManager.java25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/com.gluster.storage.management.client/src/com/gluster/storage/management/client/GlusterDataModelManager.java b/src/com.gluster.storage.management.client/src/com/gluster/storage/management/client/GlusterDataModelManager.java
index 815ba853..018ab75f 100644
--- a/src/com.gluster.storage.management.client/src/com/gluster/storage/management/client/GlusterDataModelManager.java
+++ b/src/com.gluster.storage.management.client/src/com/gluster/storage/management/client/GlusterDataModelManager.java
@@ -22,7 +22,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
-import java.util.Map;
import java.util.Map.Entry;
import com.gluster.storage.management.core.exceptions.GlusterRuntimeException;
@@ -398,4 +397,28 @@ public class GlusterDataModelManager {
public List<VolumeOptionInfo> getVolumeOptionsDefaults() {
return volumeOptionsDefaults;
}
+
+ public String getVolumeOptionDefaultValue(String optionKey) {
+ for(VolumeOptionInfo info : volumeOptionsDefaults) {
+ if(info.getName().equals(optionKey)) {
+ return info.getDefaultValue();
+ }
+ }
+ throw new GlusterRuntimeException("Invalid option key [" + optionKey
+ + "] passed to GlusterDataModelManager#getVolumeOptionDefaultValue");
+ }
+
+ public void setAccessControlList(Volume volume, String accessControlList) {
+ volume.setAccessControlList(accessControlList);
+ setVolumeOption(volume, getOptionEntry(volume, Volume.OPTION_AUTH_ALLOW));
+ }
+
+ private Entry<String, String> getOptionEntry(Volume volume, String optionKey) {
+ for(Entry entry : volume.getOptions().entrySet()) {
+ if(entry.getKey().equals(optionKey)) {
+ return entry;
+ }
+ }
+ throw new GlusterRuntimeException("Couldn't find entry for option [" + optionKey + "] on volume [" + volume.getName());
+ }
}