Return-Path: X-Original-To: apmail-cloudstack-dev-archive@www.apache.org Delivered-To: apmail-cloudstack-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6A7A5FD73 for ; Mon, 8 Apr 2013 18:19:22 +0000 (UTC) Received: (qmail 1494 invoked by uid 500); 8 Apr 2013 18:19:21 -0000 Delivered-To: apmail-cloudstack-dev-archive@cloudstack.apache.org Received: (qmail 1446 invoked by uid 500); 8 Apr 2013 18:19:21 -0000 Mailing-List: contact dev-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list dev@cloudstack.apache.org Received: (qmail 1437 invoked by uid 99); 8 Apr 2013 18:19:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Apr 2013 18:19:21 +0000 X-ASF-Spam-Status: No, hits=1.7 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of rohityadav89@gmail.com designates 74.125.83.44 as permitted sender) Received: from [74.125.83.44] (HELO mail-ee0-f44.google.com) (74.125.83.44) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Apr 2013 18:19:17 +0000 Received: by mail-ee0-f44.google.com with SMTP id c41so1588563eek.3 for ; Mon, 08 Apr 2013 11:18:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type; bh=pRKmX0yITsJfs7J2bV+Sq3Ly0bLjLGq0Ipa6P0FB2bo=; b=WoWl7+E4PE8+84gglYqf8l3bTiGaa1zjGY2Qeou9UP+AdRSbNPhNjNcrx8fJjx8YTN w9/Guzb9c+e3BfVkqkN+OE07Tpk9HsX7vDdNlyvErGJN9RSMDrBZ42WX7PqSB6Gas9I1 X3dzfIJr0svH9lXode6YJ7kpxRVlXxDtqB2ae+Ty0JdpPMJ27LFWG7gNhgxaMin1eMOn ycIUF1DbSz01Ta7aLl+Vff9Slb5grF/umV/IfOPzGZOxat1kQgm2954fbdEIkhP8IYFD yFE9aS7I0EBQCfZonEbTw3b2Cmq/s45T8qVo0zOnhsD7PvzTBjGCEiOef8b5mjH69qFi E3wg== X-Received: by 10.15.81.136 with SMTP id x8mr51646182eey.9.1365445136619; Mon, 08 Apr 2013 11:18:56 -0700 (PDT) MIME-Version: 1.0 Sender: rohityadav89@gmail.com Received: by 10.223.159.198 with HTTP; Mon, 8 Apr 2013 11:18:36 -0700 (PDT) In-Reply-To: <93D78C4D-D0C0-491A-BD02-BB217C38B7E9@basho.com> References: <93D78C4D-D0C0-491A-BD02-BB217C38B7E9@basho.com> From: Rohit Yadav Date: Mon, 8 Apr 2013 23:48:36 +0530 X-Google-Sender-Auth: 9Fi9krIozJs-RAtUyDH8pI55qgE Message-ID: Subject: Re: [Discuss] API name alias To: dev@cloudstack.apache.org Content-Type: multipart/alternative; boundary=089e016813d0544e7304d9dd78ff X-Virus-Checked: Checked by ClamAV on apache.org --089e016813d0544e7304d9dd78ff Content-Type: text/plain; charset=ISO-8859-1 On Mon, Apr 8, 2013 at 7:10 PM, John Burwell wrote: > Rohit, > > Why would we need to rewrite any Java code to switch to an array? As I > mentioned, array annotation values are treated as varargs. Therefore, > annotations with single values can be left alone. Only cases where > multiple values are required would require the addition of curly braces. > For example, for an APICommand with one name, the following would continue > to work: > Hey John, you're right but it's a matter of code styling, I prefer writing; @APICommand(name = {'name1'}) even if it's only one name, this way any subsequent api author would know that name is an array and they can have aliases which is what Kishan wants. > > @APICommand(name="apiName1") > > While for an APICommand with multiple names, the following form would now > be supported: > > @APICommand(name={"apiName1", "apiName2", "apiName3"}) > > I am not familiar with the Marvin code, so I can not speak to the impact > of this change to it. However, the only changes to the Java code should be > the API commands with multiple names and the classes that actually consume > the value of this annotation. > Yes, you're right we can skip the code styling I referred then it won't consume much coding, we just need to fix these; - Fix APICommand annotation interface definition to accept name as an array - Fix method in ApiServer which creates apiname->cmdclass map to care for aliases - Fix ApiDiscovery to take care of the aliases (create different response objs for the same cmd class) - Fix apidocs XmlWriter class to take of the aliases and the api html generator to process the same. - Fix Marvin's codegenerator.py to take care of the aliases (which means create apiname related modules which would contain cmd and response boilterplate fields/class) Cheers. > > Thanks, > -John > > On Apr 8, 2013, at 9:22 AM, Rohit Yadav wrote: > > > On Mon, Apr 8, 2013 at 6:33 PM, Kishan Kavala >wrote: > > > >> APICommand annotation in API Cmd object has a name parameter. Currently > >> name parameter takes only one value. I plan to enhance this to support > >> comma separated values. This will allow multiple API names for the same > API > >> Cmd object. > >> > >> Current: > >> @APICommand(name = "apiName1", .. > >> > >> Proposed: > >> @APICommand(name = "apiName1, apiAlias2, apiAlias3", .. > >> > > > > It's a hack, but doable. While not elegant as John suggests, parsing > comma > > separated value can lead to some issues. > > > > Changing the name field to array would require a lot of rewriting the > > present apis annotation name fields, again doable by a small python > program > > (like the one I used in the last name field refactoring). > > > > This would really help remove duplicate cmd classes for apis such as copy > > iso and volume which does the same job but requires two different cmd > class > > implementations. > > > > Whatever way you decide, pl. make sure to fix ApiDiscovery, ApiServer > > cmdclass-apiname map generator method and apidocs generation accordingly. > > > > Cheers. > > > > > >> > >> Requirement: > >> As part of CLOUDSTACK-763, I'll be introducing NetworkACLList (grouping > of > >> NetworkACLItems). Current APIs use *NetworkACL (create > >> NetworkACL/deleteNetworkACL etc..) for NetworkACLItem related APIs. > These > >> APIs have to be changed to *NetworkACL Item(create > >> NetworkACLItem/deleteNetworkACLItem etc..) to get the terminology > right. We > >> also need to support old API names for backward compatibility. Hence the > >> need for API name alias. > >> > >> Terminology: > >> NetworkACLItem - Individual ACL Entry (was NetworlACL earlier). > >> NetworkACL - Group of Network ACL Items. API will use the term > >> NetworkACLList to differentiate from the existing NetworkACL APIs. > >> > >> > >> > > --089e016813d0544e7304d9dd78ff--