cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject git commit: updated refs/heads/4.4-forward to da5ad74
Date Thu, 22 May 2014 23:57:39 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.4-forward 40207929f -> da5ad74d5


CLOUDSTACK-6752: IAM command class separation caused ApiDoc warning of
duplicated cmd class for the same api name.


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

Branch: refs/heads/4.4-forward
Commit: da5ad74d5f4388c4aa1df2f2e5f9053bfb70d83d
Parents: 4020792
Author: Min Chen <min.chen@citrix.com>
Authored: Thu May 22 16:56:36 2014 -0700
Committer: Min Chen <min.chen@citrix.com>
Committed: Thu May 22 16:57:00 2014 -0700

----------------------------------------------------------------------
 server/src/com/cloud/api/doc/ApiXmlDocWriter.java | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/da5ad74d/server/src/com/cloud/api/doc/ApiXmlDocWriter.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/doc/ApiXmlDocWriter.java b/server/src/com/cloud/api/doc/ApiXmlDocWriter.java
index c19f7af..0194f07 100644
--- a/server/src/com/cloud/api/doc/ApiXmlDocWriter.java
+++ b/server/src/com/cloud/api/doc/ApiXmlDocWriter.java
@@ -105,10 +105,21 @@ public class ApiXmlDocWriter {
         for (Class<?> cmdClass : cmdClasses) {
             String apiName = cmdClass.getAnnotation(APICommand.class).name();
             if (s_apiNameCmdClassMap.containsKey(apiName)) {
-                System.out.println("Warning, API Cmd class " + cmdClass.getName() + " has
non-unique apiname" + apiName);
-                continue;
+                // handle API cmd separation into admin cmd and user cmd with the common
api name
+                Class<?> curCmd = s_apiNameCmdClassMap.get(apiName);
+                if (curCmd.isAssignableFrom(cmdClass)) {
+                    // api_cmd map always keep the admin cmd class to get full response and
parameters
+                    s_apiNameCmdClassMap.put(apiName, cmdClass);
+                } else if (cmdClass.isAssignableFrom(curCmd)) {
+                    // just skip this one without warning
+                    continue;
+                } else {
+                    System.out.println("Warning, API Cmd class " + cmdClass.getName() + "
has non-unique apiname " + apiName);
+                    continue;
+                }
+            } else {
+                s_apiNameCmdClassMap.put(apiName, cmdClass);
             }
-            s_apiNameCmdClassMap.put(apiName, cmdClass);
         }
 
         LinkedProperties preProcessedCommands = new LinkedProperties();


Mime
View raw message