Fix the way to retrieve details map from api input.

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2e285156
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2e285156
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2e285156

Branch: refs/heads/object_store
Commit: 2e28515624ca248d1435894f137d09efd6debcfd
Parents: 7ad263b
Author: Min Chen <[email protected]>
Authored: Mon May 6 11:30:34 2013 -0700
Committer: Min Chen <[email protected]>
Committed: Mon May 6 11:30:34 2013 -0700

----------------------------------------------------------------------
 .../command/admin/storage/AddImageStoreCmd.java    |   19 +++++++++++++-
 1 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2e285156/api/src/org/apache/cloudstack/api/command/admin/storage/AddImageStoreCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/admin/storage/AddImageStoreCmd.java 
b/api/src/org/apache/cloudstack/api/command/admin/storage/AddImageStoreCmd.java
index 190b36a..ef9921d 100644
--- 
a/api/src/org/apache/cloudstack/api/command/admin/storage/AddImageStoreCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/admin/storage/AddImageStoreCmd.java
@@ -16,6 +16,9 @@
 // under the License.
 package org.apache.cloudstack.api.command.admin.storage;
 
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.cloudstack.api.APICommand;
@@ -53,7 +56,7 @@ public class AddImageStoreCmd extends BaseCmd {
     private String providerName;
 
 
-    @Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, 
description="the details for the image store")
+    @Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, 
description="the details for the image store. Example: 
details[0].key=accesskey&details[0].value=s389ddssaa&details[1].key=secretkey&details[1].value=8dshfsss")
     private Map<String, String> details;
 
 
@@ -71,7 +74,19 @@ public class AddImageStoreCmd extends BaseCmd {
     }
 
      public Map<String, String> getDetails() {
-        return details;
+         Map<String, String> detailsMap = null;
+         if (!details.isEmpty()) {
+             detailsMap = new HashMap<String, String>();
+             Collection<?> props = details.values();
+             Iterator<?> iter = props.iterator();
+             while (iter.hasNext()) {
+                 HashMap<String, String> detail = (HashMap<String, String>) 
iter.next();
+                 String key = detail.get("key");
+                 String value = detail.get("value");
+                 detailsMap.put(key, value);
+             }
+         }
+        return detailsMap;
     }
 
     public String getProviderName() {

Reply via email to