You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mc...@apache.org on 2014/05/23 03:37:36 UTC
[3/3] git commit: updated refs/heads/master to faa379b
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/faa379b6
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/faa379b6
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/faa379b6
Branch: refs/heads/master
Commit: faa379b6c2d82d5c51ce034fbd698cb71f3dcecc
Parents: e4e8931
Author: Min Chen <mi...@citrix.com>
Authored: Thu May 22 16:56:36 2014 -0700
Committer: Min Chen <mi...@citrix.com>
Committed: Thu May 22 18:28:25 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/faa379b6/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();