cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Huang <Alex.Hu...@citrix.com>
Subject RE: Invoking an API from an API plugin
Date Tue, 16 Jul 2013 14:04:46 GMT
Chris,

If it is then it was written wrong.  You can change it to public and send in a patch.

--Alex

> -----Original Message-----
> From: SuichII, Christopher [mailto:Chris.Suich@netapp.com]
> Sent: Monday, July 15, 2013 9:23 PM
> To: <dev@cloudstack.apache.org>
> Cc: Alex Huang; Chiradeep Vittal; Min Chen
> Subject: Re: Invoking an API from an API plugin
> 
> I thought about this approach, but all of the commands have private
> members/parameters and do not have setters.
> 
> Chris
> 
> On Jul 15, 2013, at 11:50 PM, Alex Huang <Alex.Huang@citrix.com>
>  wrote:
> 
> > Chris,
> >
> > You should be able to just create the command instances yourself and feed
> it to the service class.  It does not require the handler.
> >
> > --Alex
> >
> >> -----Original Message-----
> >> From: Chiradeep Vittal
> >> Sent: Monday, July 15, 2013 7:36 PM
> >> To: dev@cloudstack.apache.org
> >> Cc: Min Chen; Alex Huang
> >> Subject: Re: Invoking an API from an API plugin
> >>
> >> Yes, that is unfortunate design. The service interface was not
> >> supposed to do that.
> >> CC Min and Alex to see if they have a quick workaround.
> >> It would also help to know what exactly you are trying to achieve.
> >>
> >> On 7/15/13 11:12 PM, "SuichII, Christopher" <Chris.Suich@netapp.com>
> >> wrote:
> >>
> >>> It looks like the service interfaces all expect to be invoked
> >>> directly from an API handler (they only have Cmds for parameters).
> >>> For example,
> >>> QueryService/QueryManagerImpl.searchForServers() takes a
> ListHostsCmd.
> >>> This ListsHostsCmd can only be created by invoking the listHosts API.
> >>> If it had public setters, then the command could be instantiated and
> >>> execute() could be called directly, but that wouldn't be working at
> >>> the service interface level.
> >>>
> >>> Am I missing something here or is this not the service interface you
> >>> meant?
> >>>
> >>> -Chris
> >>>
> >>> On Jul 15, 2013, at 12:29 AM, Chiradeep Vittal
> >>> <Chiradeep.Vittal@citrix.com> wrote:
> >>>
> >>>> APIs should call the service interface directly and not call other APIs.
> >>>>
> >>>> On 7/12/13 1:40 AM, "SuichII, Christopher" <Chris.Suich@netapp.com>
> >>>> wrote:
> >>>>
> >>>>> Er, I should have mentioned that it is not as easy as simply
> >>>>> invoking one  API command from another since all the CS API
> >>>>> commands have private  @paramenter members. Because of this, I
> >>>>> cannot simply instantiate a  command, populate it with the
> >>>>> parameters and call
> >>>>> execute() on it.
> >>>>>
> >>>>> -Chris
> >>>>>
> >>>>> On Jul 11, 2013, at 4:09 PM, Chris Suich <chris.suich@netapp.com>
> >>>>> wrote:
> >>>>>
> >>>>>> I'm writing an API plugin that needs to consume an API that
> >>>>>> already exists in CS. The only way I can find to do this would
be
> >>>>>> to send the  REST/HTTP request from my plugin, but I'm hoping
> >>>>>> there is an easier way.
> >>>>>> Since both plugins are on the same Java classpath they have
the
> >>>>>> ability  to invoke each other.
> >>>>>>
> >>>>>> Is there a simple way to do this that I'm missing?
> >>>>>>
> >>>>>> -Chris
> >>>>>
> >>>>
> >>>
> >


Mime
View raw message