Return-Path: X-Original-To: apmail-incubator-cloudstack-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-cloudstack-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 10134E3BB for ; Fri, 8 Feb 2013 11:21:15 +0000 (UTC) Received: (qmail 2493 invoked by uid 500); 8 Feb 2013 11:21:14 -0000 Delivered-To: apmail-incubator-cloudstack-dev-archive@incubator.apache.org Received: (qmail 2392 invoked by uid 500); 8 Feb 2013 11:21:13 -0000 Mailing-List: contact cloudstack-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list cloudstack-dev@incubator.apache.org Received: (qmail 2370 invoked by uid 99); 8 Feb 2013 11:21:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Feb 2013 11:21:12 +0000 Date: Fri, 8 Feb 2013 11:21:12 +0000 (UTC) From: "ASF subversion and git services (JIRA)" To: cloudstack-dev@incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CLOUDSTACK-1210) Make all pluggable services return list of api cmd classes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ 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 > 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