You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2014/05/23 10:10:19 UTC
git commit: updated refs/heads/4.4 to f002e4d
Repository: cloudstack
Updated Branches:
refs/heads/4.4 f1a586e9b -> f002e4d16
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/f002e4d1
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f002e4d1
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f002e4d1
Branch: refs/heads/4.4
Commit: f002e4d161bdf68f4af9e276d4eb006b32322056
Parents: f1a586e
Author: Min Chen <mi...@citrix.com>
Authored: Thu May 22 16:56:36 2014 -0700
Committer: Daan Hoogland <da...@onecht.net>
Committed: Fri May 23 10:10:12 2014 +0200
----------------------------------------------------------------------
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/f002e4d1/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();