incubator-cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF subversion and git services (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLOUDSTACK-1210) Make all pluggable services return list of api cmd classes
Date Fri, 08 Feb 2013 11:21:12 GMT

    [ https://issues.apache.org/jira/browse/CLOUDSTACK-1210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13574400#comment-13574400
] 

ASF subversion and git services commented on CLOUDSTACK-1210:
-------------------------------------------------------------

Commit b59a18d1a1be114405b4cb3aa80b3938058ae664 in branch refs/heads/master from [~bhaisaab]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-cloudstack.git;h=b59a18d ]

CLOUDSTACK-1210: Fix pluggable service, apiserver, mgmt server impl, api-discovery

- Mgmt server impl is a pluggable service, fix it's method
- Fix getCommands() to return all cmd api classes supported by this mgmt server
- For api-discovery, get commands from pluggable services only, don't use reflections
- Don't use reflections in ApiServer, iterate pluggableservices
- Fix api discovery unit test
- The fix was done automatically using following python program along with
  following step:

1. Get all apis provided by default mgmt server, all of them are in cloud-api now
   cd api/src/org/apache/cloudstack/api/command
   find . >> apis
2. For all apis, generate java code that adds the class to the cmdList arraylist:
   f = open('apis', 'r')
   data = f.read()
   f.close()
   output = ""
   for a in data.split('\n'):
     output += "cmdList.add(%s);" % a.split('/')[-1].replace('.java', '.class')
   # wrote output to a file, copied content to mgmt server impl's getCommands()
   # similarly, fixed import statements using same code, splitting on /

Testing:
Ran apiserver, put breakpoints in ApiServer's init() where classes are processed
Total cmd classes found by reflections (ReflectUtil) = 354
Total cmd classes found by getCommands for all pluggable services = 354

Next, copied the comma separated values for each set to a string in ipython, a & b
set(a).difference(set(b)) returned null.

The above test implies both set of cmd classes found by both methods, i.e. using
reflections and using getCommands() had same set of apis and all were unique.

Conclusion:
The changes are idempotent and don't break api server's cmd class api discovery
processing.

BUG-ID: CLOUDSTACK-1210

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>

                
> Make all pluggable services return list of api cmd classes
> ----------------------------------------------------------
>
>                 Key: CLOUDSTACK-1210
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-1210
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the default.) 
>          Components: API
>    Affects Versions: 4.1.0
>            Reporter: Rohit Yadav
>             Fix For: 4.1.0
>
>
> In ApiServer, ApiDiscovery and in apidoc generator, we're using reflections to go through
all classes under package namespace org.apache.cloudstack and com.cloud and process those
with APICommand annotation. This is the method we use to get info about apis. This is ambiguous,
as a plugin or component may want to only expose certain no. of api.
> As part of api_refactoring, Rohit Yadav fixed the method getCommands() for most plugins
so they return a list of api cmd classes and only through them commands should be processed.
> The issue is to fix any leftover plugin, fix mgmt server class's getCommands() to return
list of all these 300 apis and get rid of the reflections code which does the trick now.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message