diff options
| author | Selvam <selvam@gluster.com> | 2011-04-15 16:54:07 +0530 |
|---|---|---|
| committer | Selvam <selvam@gluster.com> | 2011-04-15 19:17:54 +0530 |
| commit | c2201ef6fbbb50c3d2d362f5b4a0d3986571e5aa (patch) | |
| tree | b07f28f9798af85987170031aeca65381f883c04 /src/com.gluster.storage.management.client | |
| parent | 7e6efca549922972ab18074af8337b5105f0cfcd (diff) | |
Key listner to volume property page # access control
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.java | 25 |
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()); + } } |
