cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rohit Yadav <bhais...@apache.org>
Subject Re: [DISCUSS] Question about @Parameter (entityType)
Date Mon, 28 Jan 2013 22:32:51 GMT
On Sun, Jan 27, 2013 at 8:37 PM, Kelven Yang <kelven.yang@citrix.com> wrote:
> I have a question about a change in @Parameter at API layer, in regards to
> entityType, does anyone know the reason behind why it has to go through
> with some Response class which in turn declares links to the entity class
> via @EntityReference annotation?
>
> And in DeployVMCmd as an example, there is also another special field
> (ipToNetworkList) declares entity reference directly, could someone
> clarify it?
>
> @ACL(checkKeyAccess=true)
>     @Parameter(name = ApiConstants.IP_NETWORK_LIST, type =
> CommandType.MAP, entityType={Network.class, IpAddress.class},
>             description = "ip to network mapping. Can't be specified with
> networkIds parameter." +
>                     " Example:
> iptonetworklist[0].ip=10.10.10.11&iptonetworklist[0].networkid=uuid -
> requests to use ip 10.10.10.11 in network id=uuid")
>     private Map ipToNetworkList;

Coming straight to the issue, if a parameter type is MAP, right now
the present annotation is insufficient to help ApiDispatcher process a
parameter which is of map type, so we just set the map as it is (i.e.
a string);

            case MAP:
            default:
                field.set(cmdObj, paramObj);
                break;

The ipToNetworkList of DeployVMCmd, is the only variable I found in
all apis which has this issue. So, in getIpToNetworkMap() we first try
to find a Network object using a network string value from the map's
"networkid" keyset and if we fail we try to parse long value. This
make the param backward compatible as well as accept both uuid and
ids. We can work on better ways to deal with maps in future.
Regards.

>
> Kelven
>
>

Mime
View raw message