CLOUDSTACK-6752: IAM command class separation caused ApiDoc warning of

duplicated cmd class for the same api name.
This commit is contained in:
Min Chen 2014-05-22 16:56:36 -07:00
parent e4e8931389
commit faa379b6c2

View File

@ -105,10 +105,21 @@ public class ApiXmlDocWriter {
for (Class<?> cmdClass : cmdClasses) { for (Class<?> cmdClass : cmdClasses) {
String apiName = cmdClass.getAnnotation(APICommand.class).name(); String apiName = cmdClass.getAnnotation(APICommand.class).name();
if (s_apiNameCmdClassMap.containsKey(apiName)) { if (s_apiNameCmdClassMap.containsKey(apiName)) {
System.out.println("Warning, API Cmd class " + cmdClass.getName() + " has non-unique apiname" + apiName); // handle API cmd separation into admin cmd and user cmd with the common api name
continue; 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(); LinkedProperties preProcessedCommands = new LinkedProperties();