From c2201ef6fbbb50c3d2d362f5b4a0d3986571e5aa Mon Sep 17 00:00:00 2001 From: Selvam Date: Fri, 15 Apr 2011 16:54:07 +0530 Subject: Key listner to volume property page # access control --- .../management/client/GlusterDataModelManager.java | 25 +++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/com.gluster.storage.management.client') 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 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 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()); + } } -- cgit