summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorShireesh Anjal <shireesh@gluster.com>2011-07-01 16:15:23 +0530
committerShireesh Anjal <shireesh@gluster.com>2011-07-01 16:15:23 +0530
commit2c4ea3418784160bdf4f186b2488e974465161e7 (patch)
treedcbf4de394194c86f3d5df499fcb99b63dc35c5e /src
parent40d4024c47ca1e1e15e2500a5412791d364bd8b0 (diff)
[Bug 3117] New: Failing to create volume should throw error message instead of stack trace.
Diffstat (limited to 'src')
-rw-r--r--src/com.gluster.storage.management.client/src/com/gluster/storage/management/client/GlusterDataModelManager.java49
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/GlusterCoreUtil.java39
-rw-r--r--src/com.gluster.storage.management.gui/icons/tango/16x16/view-refresh.pngbin0 -> 912 bytes
-rw-r--r--src/com.gluster.storage.management.gui/icons/tango/32x32/view-refresh.pngbin0 -> 2024 bytes
-rw-r--r--src/com.gluster.storage.management.gui/icons/tango/scalable/view-refresh.svg393
-rw-r--r--src/com.gluster.storage.management.gui/plugin.xml76
-rw-r--r--src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/RefreshDataAction.java45
-rw-r--r--src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/VolumesResource.java25
8 files changed, 585 insertions, 42 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 9705501a..be7a9023 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
@@ -29,6 +29,7 @@ import com.gluster.storage.management.core.model.Cluster;
import com.gluster.storage.management.core.model.ClusterListener;
import com.gluster.storage.management.core.model.Disk;
import com.gluster.storage.management.core.model.Disk.DISK_STATUS;
+import com.gluster.storage.management.core.model.Entity;
import com.gluster.storage.management.core.model.Event;
import com.gluster.storage.management.core.model.Event.EVENT_TYPE;
import com.gluster.storage.management.core.model.GlusterDataModel;
@@ -43,6 +44,7 @@ import com.gluster.storage.management.core.model.Volume.TRANSPORT_TYPE;
import com.gluster.storage.management.core.model.Volume.VOLUME_STATUS;
import com.gluster.storage.management.core.model.Volume.VOLUME_TYPE;
import com.gluster.storage.management.core.model.VolumeOptionInfo;
+import com.gluster.storage.management.core.utils.GlusterCoreUtil;
public class GlusterDataModelManager {
private static GlusterDataModelManager instance = new GlusterDataModelManager();
@@ -80,10 +82,14 @@ public class GlusterDataModelManager {
}
public void initializeModel(String securityToken, String clusterName) {
- model = new GlusterDataModel("Gluster Data Model");
setSecurityToken(securityToken);
setClusterName(clusterName);
+ model = fetchData(clusterName);
+ }
+
+ public GlusterDataModel fetchData(String clusterName) {
+ GlusterDataModel model = new GlusterDataModel("Gluster Data Model");
Cluster cluster = new Cluster(clusterName, model);
initializeGlusterServers(cluster);
@@ -96,6 +102,46 @@ public class GlusterDataModelManager {
initializeVolumeOptionsDefaults();
model.addCluster(cluster);
+ return model;
+ }
+
+ public void updateModel(GlusterDataModel model) {
+ updateVolumes(model);
+ }
+
+ private void updateVolumes(GlusterDataModel model) {
+ List<Volume> currentVolumes = this.model.getCluster().getVolumes();
+ List<Volume> latestVolumes = model.getCluster().getVolumes();
+
+ List<Volume> addedVolumes = getAddedVolumes(currentVolumes, latestVolumes);
+ for(ClusterListener listener : listeners) {
+ for(Volume addedVolume : addedVolumes) {
+ listener.volumeAdded(addedVolume);
+ }
+ }
+
+ List<Volume> removedVolumes = getRemovedVolumes(currentVolumes, latestVolumes);
+ for(ClusterListener listener : listeners) {
+ for(Volume removedVolume : addedVolumes) {
+ listener.volumeRemoved(removedVolume);
+ }
+ }
+ }
+
+ private List<Volume> getRemovedVolumes(List<Volume> currentVolumes, List<Volume> latestVolumes) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ private List<Volume> getAddedVolumes(List<Volume> currentVolumes, List<Volume> newVolumes) {
+ List<Volume> addedVolumes = new ArrayList<Volume>();
+ for(Volume newVolume : addedVolumes) {
+ if(!GlusterCoreUtil.containsEntity(currentVolumes, newVolume, false)) {
+ // current volume list doesn't contain this volume. mark it.
+ addedVolumes.add(newVolume);
+ }
+ }
+ return addedVolumes;
}
private void initializeGlusterServers(Cluster cluster) {
@@ -465,5 +511,4 @@ public class GlusterDataModelManager {
}
return volumeNames;
}
-
}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/GlusterCoreUtil.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/GlusterCoreUtil.java
index 4194a642..20b652f4 100644
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/GlusterCoreUtil.java
+++ b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/GlusterCoreUtil.java
@@ -26,6 +26,7 @@ import java.util.Set;
import com.gluster.storage.management.core.model.Brick;
import com.gluster.storage.management.core.model.Disk;
+import com.gluster.storage.management.core.model.Entity;
public class GlusterCoreUtil {
@@ -45,4 +46,42 @@ public class GlusterCoreUtil {
}
return qualifiedBricks;
}
+
+ /**
+ * Compares the two entity lists and returns the list of entities present only in the second argument
+ * <code>newEntities</code>
+ *
+ * @param oldEntities
+ * @param newEntities
+ * @return List of entities that are present only in the second argument <code>newEntities</code>
+ */
+ public static List<Entity> getAddedEntities(List<? extends Entity> oldEntities, List<Entity> newEntities) {
+ List<Entity> addedEntities = new ArrayList<Entity>();
+ for(Entity newEntity : newEntities) {
+ if(!containsEntity(oldEntities, newEntity, false)) {
+ // old entity list doesn't contain this entity. mark it as new.
+ addedEntities.add(newEntity);
+ }
+ }
+ return addedEntities;
+ }
+
+ public static boolean containsEntity(List<? extends Entity> entityList, Entity searchEntity, boolean caseInsensitive) {
+ String searchEntityName = searchEntity.getName();
+ if(caseInsensitive) {
+ searchEntityName = searchEntityName.toUpperCase();
+ }
+
+ for(Entity entity : entityList) {
+ String nextEntityName = entity.getName();
+ if(caseInsensitive) {
+ nextEntityName = nextEntityName.toUpperCase();
+ }
+ if(nextEntityName.equals(searchEntityName)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
}
diff --git a/src/com.gluster.storage.management.gui/icons/tango/16x16/view-refresh.png b/src/com.gluster.storage.management.gui/icons/tango/16x16/view-refresh.png
new file mode 100644
index 00000000..3fd71d6e
--- /dev/null
+++ b/src/com.gluster.storage.management.gui/icons/tango/16x16/view-refresh.png
Binary files differ
diff --git a/src/com.gluster.storage.management.gui/icons/tango/32x32/view-refresh.png b/src/com.gluster.storage.management.gui/icons/tango/32x32/view-refresh.png
new file mode 100644
index 00000000..606ea9eb
--- /dev/null
+++ b/src/com.gluster.storage.management.gui/icons/tango/32x32/view-refresh.png
Binary files differ
diff --git a/src/com.gluster.storage.management.gui/icons/tango/scalable/view-refresh.svg b/src/com.gluster.storage.management.gui/icons/tango/scalable/view-refresh.svg
new file mode 100644
index 00000000..565f6dad
--- /dev/null
+++ b/src/com.gluster.storage.management.gui/icons/tango/scalable/view-refresh.svg
@@ -0,0 +1,393 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ inkscape:export-ydpi="90.000000"
+ inkscape:export-xdpi="90.000000"
+ inkscape:export-filename="/home/jimmac/Desktop/wi-fi.png"
+ width="48px"
+ height="48px"
+ id="svg11300"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ sodipodi:docbase="/home/jimmac/src/cvs/tango-icon-theme/scalable/actions"
+ sodipodi:docname="view-refresh.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs3">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 24 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="48 : 24 : 1"
+ inkscape:persp3d-origin="24 : 16 : 1"
+ id="perspective58" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient2690">
+ <stop
+ style="stop-color:#c4d7eb;stop-opacity:1;"
+ offset="0"
+ id="stop2692" />
+ <stop
+ style="stop-color:#c4d7eb;stop-opacity:0;"
+ offset="1"
+ id="stop2694" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2682">
+ <stop
+ style="stop-color:#3977c3;stop-opacity:1;"
+ offset="0"
+ id="stop2684" />
+ <stop
+ style="stop-color:#89aedc;stop-opacity:0;"
+ offset="1"
+ id="stop2686" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2402">
+ <stop
+ style="stop-color:#729fcf;stop-opacity:1;"
+ offset="0"
+ id="stop2404" />
+ <stop
+ style="stop-color:#528ac5;stop-opacity:1;"
+ offset="1"
+ id="stop2406" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2380">
+ <stop
+ style="stop-color:#b9cfe7;stop-opacity:1"
+ offset="0"
+ id="stop2382" />
+ <stop
+ style="stop-color:#729fcf;stop-opacity:1"
+ offset="1"
+ id="stop2384" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient2871">
+ <stop
+ style="stop-color:#3465a4;stop-opacity:1;"
+ offset="0"
+ id="stop2873" />
+ <stop
+ style="stop-color:#3465a4;stop-opacity:1"
+ offset="1"
+ id="stop2875" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient2847">
+ <stop
+ style="stop-color:#3465a4;stop-opacity:1;"
+ offset="0"
+ id="stop2849" />
+ <stop
+ style="stop-color:#3465a4;stop-opacity:0;"
+ offset="1"
+ id="stop2851" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2831">
+ <stop
+ style="stop-color:#3465a4;stop-opacity:1;"
+ offset="0"
+ id="stop2833" />
+ <stop
+ id="stop2855"
+ offset="0.33333334"
+ style="stop-color:#5b86be;stop-opacity:1;" />
+ <stop
+ style="stop-color:#83a8d8;stop-opacity:0;"
+ offset="1"
+ id="stop2835" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient2797">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop2799" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0;"
+ offset="1"
+ id="stop2801" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient8662">
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="0"
+ id="stop8664" />
+ <stop
+ style="stop-color:#000000;stop-opacity:0;"
+ offset="1"
+ id="stop8666" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2831"
+ id="linearGradient1486"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(0.465413,-0.277593)"
+ x1="13.478554"
+ y1="10.612206"
+ x2="15.419417"
+ y2="19.115122" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2847"
+ id="linearGradient1488"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(-1,0,0,-1,47.52791,45.84741)"
+ x1="37.128052"
+ y1="29.729605"
+ x2="37.065414"
+ y2="26.194071" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2797"
+ id="linearGradient1491"
+ gradientUnits="userSpaceOnUse"
+ x1="5.9649176"
+ y1="26.048164"
+ x2="52.854097"
+ y2="26.048164" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2797"
+ id="linearGradient1493"
+ gradientUnits="userSpaceOnUse"
+ x1="5.9649176"
+ y1="26.048164"
+ x2="52.854097"
+ y2="26.048164" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2871"
+ id="linearGradient1501"
+ gradientUnits="userSpaceOnUse"
+ x1="46.834816"
+ y1="45.264122"
+ x2="45.380436"
+ y2="50.939667" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient8662"
+ id="radialGradient1503"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.536723,-9.680928e-14,16.87306)"
+ cx="24.837126"
+ cy="36.421127"
+ fx="24.837126"
+ fy="36.421127"
+ r="15.644737" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2380"
+ id="linearGradient2386"
+ x1="62.513836"
+ y1="36.061237"
+ x2="15.984863"
+ y2="20.60858"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2402"
+ id="linearGradient2408"
+ x1="18.935766"
+ y1="23.667896"
+ x2="53.588622"
+ y2="26.649362"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2682"
+ id="linearGradient2688"
+ x1="36.713837"
+ y1="31.455952"
+ x2="37.124462"
+ y2="24.842253"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2690"
+ id="linearGradient2696"
+ x1="32.647972"
+ y1="30.748846"
+ x2="37.124462"
+ y2="24.842253"
+ gradientUnits="userSpaceOnUse" />
+ </defs>
+ <sodipodi:namedview
+ stroke="#3465a4"
+ fill="#729fcf"
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="0.25490196"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="5.6568542"
+ inkscape:cx="2.4438651"
+ inkscape:cy="18.153347"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:grid-bbox="true"
+ inkscape:document-units="px"
+ inkscape:showpageshadow="false"
+ inkscape:window-width="891"
+ inkscape:window-height="818"
+ inkscape:window-x="0"
+ inkscape:window-y="30" />
+ <metadata
+ id="metadata4">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Jakub Steiner</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <dc:source>http://jimmac.musichall.cz</dc:source>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/publicdomain/" />
+ <dc:title>View Refresh</dc:title>
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>reload</rdf:li>
+ <rdf:li>refresh</rdf:li>
+ <rdf:li>view</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/publicdomain/">
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#Reproduction" />
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#Distribution" />
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <path
+ transform="matrix(-1.489736,0,0,-1.001252,61.20865,75.2819)"
+ d="M 40.481863 36.421127 A 15.644737 8.3968935 0 1 1 9.1923885,36.421127 A 15.644737 8.3968935 0 1 1 40.481863 36.421127 z"
+ sodipodi:ry="8.3968935"
+ sodipodi:rx="15.644737"
+ sodipodi:cy="36.421127"
+ sodipodi:cx="24.837126"
+ id="path8660"
+ style="opacity:0.38333333;color:#000000;fill:url(#radialGradient1503);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ sodipodi:type="arc"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <path
+ style="color:#000000;fill:url(#linearGradient1486);fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient1488);stroke-width:0.99999958;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block;overflow:visible"
+ d="M 20.152913,10.409904 C 20.152913,10.409904 11.215413,9.784904 13.965413,20.284904 L 6.2779132,20.284904 C 6.2779132,20.284904 6.7779132,8.409904 20.152913,10.409904 z "
+ id="path2865"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true"
+ sodipodi:nodetypes="cccc" />
+ <g
+ id="g1878"
+ transform="matrix(-0.579051,-0.489228,-0.489228,0.579051,56.91585,13.37137)"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true"
+ style="fill:url(#linearGradient2386);fill-opacity:1.0;stroke:#3465a4;stroke-opacity:1">
+ <path
+ sodipodi:nodetypes="ccccccc"
+ id="path1880"
+ d="M 44.306783,50.229694 C 62.821497,35.818859 49.664587,13.411704 22.462411,12.49765 L 22.113843,3.1515478 L 7.6245439,20.496754 L 22.714328,33.219189 C 22.714328,33.219189 22.462411,23.337969 22.462411,23.337969 C 41.292171,24.336946 55.444038,37.409698 44.306783,50.229694 z "
+ style="opacity:1;color:#000000;fill:url(#linearGradient2386);fill-opacity:1.0;fill-rule:nonzero;stroke:url(#linearGradient1501);stroke-width:1.31916928;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block;overflow:visible"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ </g>
+ <path
+ sodipodi:nodetypes="cccc"
+ inkscape:r_cy="true"
+ inkscape:r_cx="true"
+ id="path2839"
+ d="M 28.375,33.4375 C 28.375,33.4375 37.3125,34.0625 34.5625,23.5625 L 42.338388,23.5625 C 42.338388,25.065102 41.75,35.4375 28.375,33.4375 z "
+ style="color:#000000;fill:url(#linearGradient2696);fill-opacity:1.0;fill-rule:nonzero;stroke:url(#linearGradient2688);stroke-width:0.99999958;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block;overflow:visible" />
+ <g
+ style="color:#000000;fill:url(#linearGradient2408);fill-opacity:1.0;fill-rule:nonzero;stroke:url(#linearGradient1501);stroke-width:1.31916928;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block;overflow:visible;opacity:1"
+ inkscape:r_cy="true"
+ inkscape:r_cx="true"
+ transform="matrix(0.579051,0.489228,0.489228,-0.579051,-7.921023,30.53599)"
+ id="g2779">
+ <path
+ inkscape:r_cy="true"
+ inkscape:r_cx="true"
+ style="opacity:1;color:#000000;fill:url(#linearGradient2408);fill-opacity:1.0;fill-rule:nonzero;stroke:url(#linearGradient1501);stroke-width:1.31916928;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block;overflow:visible"
+ d="M 44.306783,50.229694 C 62.821497,35.818859 49.664587,13.411704 22.462411,12.49765 L 22.399432,3.0690297 L 7.793943,20.424005 L 22.462411,33.006349 C 22.462411,33.006349 22.462411,23.337969 22.462411,23.337969 C 41.292171,24.336946 55.444038,37.409698 44.306783,50.229694 z "
+ id="path2781"
+ sodipodi:nodetypes="ccccccc" />
+ </g>
+ <path
+ style="opacity:0.27222224;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.99999982;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 7.0625,38.1875 L 7.125,23.3125 L 20.0625,22.9375 L 15.673627,28.116317 L 19.540852,30.489516 C 16.540852,32.739516 14.991304,32.911644 13.991304,35.474144 L 11.174446,33.363872 L 7.0625,38.1875 z "
+ id="path2791"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true"
+ sodipodi:nodetypes="cccccccc" />
+ <g
+ id="g2793"
+ transform="matrix(0.508536,0.429651,0.429651,-0.508536,-3.973188,30.54119)"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true"
+ style="opacity:0.5;fill:none;fill-opacity:1;stroke:#ffffff;stroke-opacity:1">
+ <path
+ sodipodi:nodetypes="ccccccc"
+ id="path2795"
+ d="M 51.090265,45.943705 C 60.210465,30.723955 46.631614,12.20113 19.485058,11.948579 L 19.513464,3.7032834 L 6.5341979,19.296639 L 19.367661,30.26876 C 19.367661,30.26876 19.423281,21.261882 19.423281,21.261882 C 36.951096,21.037973 54.618466,31.365254 51.090265,45.943705 z "
+ style="opacity:1;color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient1493);stroke-width:1.50208926;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block;overflow:visible"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ </g>
+ <g
+ style="opacity:0.5;fill:none;fill-opacity:1;stroke:#ffffff;stroke-opacity:1"
+ inkscape:r_cy="true"
+ inkscape:r_cx="true"
+ transform="matrix(-0.508536,-0.429651,-0.429651,0.508536,53.049,13.36548)"
+ id="g2805">
+ <path
+ inkscape:r_cy="true"
+ inkscape:r_cx="true"
+ style="opacity:1;color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient1491);stroke-width:1.50208926;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block;overflow:visible"
+ d="M 51.389927,46.505946 C 60.510127,31.286196 47.050763,12.432359 19.628482,12.069755 L 19.342824,4.0507204 L 6.3413093,19.379475 L 19.809059,30.764589 C 19.809059,30.764589 19.627294,21.311346 19.627294,21.311346 C 37.872231,21.693318 54.411175,32.236592 51.389927,46.505946 z "
+ id="path2807"
+ sodipodi:nodetypes="ccccccc" />
+ </g>
+ <path
+ style="opacity:0.27222224;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.99999982;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 6.8125,16.5 C 10.405935,6.0587275 23.256282,10.355393 27,12 C 31.175307,12.211475 32.674736,9.164996 36,9 C 21.950264,-0.7899963 7.1875,2.5 6.8125,16.5 z "
+ id="path2811"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true"
+ sodipodi:nodetypes="cccc" />
+ </g>
+</svg>
diff --git a/src/com.gluster.storage.management.gui/plugin.xml b/src/com.gluster.storage.management.gui/plugin.xml
index 112c8e81..5b18421f 100644
--- a/src/com.gluster.storage.management.gui/plugin.xml
+++ b/src/com.gluster.storage.management.gui/plugin.xml
@@ -392,36 +392,6 @@
<extension
point="org.eclipse.ui.actionSets">
<actionSet
- description="Set of Actions in &quot;Edit&quot; menu"
- id="com.gluster.storage.management.gui.actionsets.edit"
- label="Edit Action Set"
- visible="true">
- <action
- allowLabelUpdate="false"
- class="com.gluster.storage.management.gui.actions.PreferencesAction"
- definitionId="org.eclipse.ui.window.preferences"
- icon="icons/tango/32x32/settings.png"
- id="com.gluster.storage.management.gui.actions.AddServerAction"
- label="&amp;Settings"
- menubarPath="com.gluster.storage.management.gui.menu.edit/edit"
- mode="FORCE_TEXT"
- pulldown="false"
- retarget="false"
- state="false"
- style="push"
- toolbarPath="Normal"
- tooltip="Preferences">
- </action>
- <menu
- id="com.gluster.storage.management.gui.menu.edit"
- label="&amp;Edit"
- path="additions">
- <groupMarker
- name="edit">
- </groupMarker>
- </menu>
- </actionSet>
- <actionSet
description="Set of actions that can be performed on multiple Volumes"
id="com.gluster.storage.management.gui.actionsets.volumes"
label="Volumes Actions"
@@ -891,6 +861,52 @@
</groupMarker>
</menu>
</actionSet>
+ <actionSet
+ description="Set of Actions in &quot;Edit&quot; menu"
+ id="com.gluster.storage.management.gui.actionsets.edit"
+ label="Edit Action Set"
+ visible="true">
+ <action
+ allowLabelUpdate="false"
+ class="com.gluster.storage.management.gui.actions.RefreshDataAction"
+ definitionId="org.eclipse.ui.window.preferences"
+ icon="icons/tango/32x32/view-refresh.png"
+ id="com.gluster.storage.management.gui.actions.AddServerAction"
+ label="&amp;Refresh"
+ menubarPath="com.gluster.storage.management.gui.menu.edit/edit"
+ mode="FORCE_TEXT"
+ pulldown="false"
+ retarget="false"
+ state="false"
+ style="push"
+ toolbarPath="Normal"
+ tooltip="Refresh data from Gluster Management Gateway">
+ </action>
+ <action
+ allowLabelUpdate="false"
+ class="com.gluster.storage.management.gui.actions.PreferencesAction"
+ definitionId="org.eclipse.ui.window.preferences"
+ icon="icons/tango/32x32/settings.png"
+ id="com.gluster.storage.management.gui.actions.AddServerAction"
+ label="&amp;Settings"
+ menubarPath="com.gluster.storage.management.gui.menu.edit/edit"
+ mode="FORCE_TEXT"
+ pulldown="false"
+ retarget="false"
+ state="false"
+ style="push"
+ toolbarPath="Normal"
+ tooltip="Preferences">
+ </action>
+ <menu
+ id="com.gluster.storage.management.gui.menu.edit"
+ label="&amp;Edit"
+ path="additions">
+ <groupMarker
+ name="edit">
+ </groupMarker>
+ </menu>
+ </actionSet>
</extension>
<extension
point="org.eclipse.ui.perspectiveExtensions">
diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/RefreshDataAction.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/RefreshDataAction.java
new file mode 100644
index 00000000..4a569c50
--- /dev/null
+++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/RefreshDataAction.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * 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.gui.actions;
+
+import org.eclipse.jface.action.IAction;
+
+/**
+ *
+ */
+public class RefreshDataAction extends AbstractActionDelegate {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+ */
+ @Override
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see com.gluster.storage.management.gui.actions.AbstractActionDelegate#performAction(org.eclipse.jface.action.IAction)
+ */
+ @Override
+ protected void performAction(IAction action) {
+ // TODO Auto-generated method stub
+
+ }
+}
diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/VolumesResource.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/VolumesResource.java
index c9ae0fe5..d568d519 100644
--- a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/VolumesResource.java
+++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/VolumesResource.java
@@ -207,27 +207,32 @@ public class VolumesResource extends AbstractResource {
return badRequestResponse("Stripe count must be a positive integer");
}
+ try {
+ createVolume(clusterName, volumeName, volumeType, transportType, replicaCount, stripeCount, bricks, accessProtocols,
+ options);
+ return createdResponse(volumeName);
+ } catch (Exception e) {
+ return errorResponse(e.getMessage());
+ }
+ }
+
+ public void performCreateVolume(String clusterName, String volumeName, String volumeType, String transportType, Integer replicaCount,
+ Integer stripeCount, String bricks, String accessProtocols, String options) {
GlusterServer onlineServer = clusterService.getOnlineServer(clusterName);
if (onlineServer == null) {
- return errorResponse("No online servers found in cluster [" + clusterName + "]");
+ throw new GlusterRuntimeException("No online servers found in cluster [" + clusterName + "]");
}
- try {
+ try {
glusterUtil.createVolume(onlineServer.getName(), volumeName, volumeType, transportType, replicaCount, stripeCount, bricks, accessProtocols, options);
- return createdResponse(volumeName);
} catch (ConnectionException e) {
// online server has gone offline! try with a different one.
onlineServer = clusterService.getNewOnlineServer(clusterName);
if (onlineServer == null) {
- return errorResponse("No online servers found in cluster [" + clusterName + "]");
+ throw new GlusterRuntimeException("No online servers found in cluster [" + clusterName + "]");
}
- try {
- glusterUtil.createVolume(onlineServer.getName(), volumeName, volumeType, transportType, replicaCount, stripeCount, bricks, accessProtocols, options);
- return createdResponse(volumeName);
- } catch(Exception e1) {
- return errorResponse(e1.getMessage());
- }
+ glusterUtil.createVolume(onlineServer.getName(), volumeName, volumeType, transportType, replicaCount, stripeCount, bricks, accessProtocols, options);
}
}