marvin : cloudstack-version is not reqd for json load

To build back cloudstack response we don't need to load the
'cloudstack-version' string, only the response
api: Enforce InternalIdentity interface on AsyncJobVO

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
Enforce InternalIdentity interface on all VO classes that impls long getId()

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
Rename @Entity to @EntityReference used in Response classes

- Renames to @EntityReference as @Entity is too general and used in javax's pkg
- Remove redundant imports

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
Rename Implementation annotation to APICommand

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
api: Introduce name field which would hold the OTW api command name

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
api: ListTemplateCmd returns TemplateInfo not UserVmResponse

Correcting the incorrecty response entity when LIstTemplatesCmd was
caled
api: Entities will extend InternalIdentity and Identity

Entities correlated to the Identity and carry a uuid and those
correlated to InternalIdentity carry an id. Those entities that carry
both will correlated to Identity and InternalIdentity.

This refactors entities wherever possible to ensure the VO only
implements the first class entity.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
api: EntityReference for serviceOfferingResponse

ServiceOfferingResponse's entityReference was missed

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
Simulator: Fixing the listTemplatesCommand

Should return the ListTemplatesAnswer and ListVolumes returns
ListVolumesAnswer

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
api: Make APIServer backward compatible to accept both uuid and id for pre 3.x apis

- Allow both uuid and id in param for pre 3.x apis
- Enforce uuid as param for all >= 3.x apis
- Use regex to better match uuid param

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
api: Annotate and fill name field of @APICommand from commands.properties.in

- Reads and fills name field of all cmd class and api name mapping from
  commands.properties.in
- Automation using following python script ensures correctness of the change

import os
file_prefix = "api/src/"
search_pattern = "@APICommand("
pattern_len = len(search_pattern)
prop_file = "client/tomcatconf/commands.properties.in"
f = open(prop_file, 'r')
data = f.read()
f.close()
apis = filter(lambda x: x.strip()!='' and (not x.startswith('#')), data.split('\n'))
for api in apis:
    api_name = api.split('=')[0]
    cmd_name = file_prefix + api.split('=')[1].split(';')[0].replace('.', '/').strip() + ".java"
    if not os.path.exists(cmd_name):
        print cmd_name, api_name
    f = open(cmd_name, 'r')
    d = f.read()
    f.close()
    idx = d.find(search_pattern) + pattern_len
    new_str = d[:idx] + "name = \"%s\", " % api_name + d[idx:]
    f = open(cmd_name, 'w')
    f.write(new_str)
    f.close()

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
api: Annotate all remaining cmd classes with APICommand name field

Automates name field filling using following python program which reads from
various *commands.properties.in files and populates name fields based on the
name cmd class mapping defined in them.

import os
search_pattern = "@APICommand("
pattern_len = len(search_pattern)
prop_files = [
"client/tomcatconf/cisconexusvsm_commands.properties.in",
"client/tomcatconf/f5bigip_commands.properties.in",
"client/tomcatconf/junipersrx_commands.properties.in",
"client/tomcatconf/netapp_commands.properties.in",
"client/tomcatconf/netscalerloadbalancer_commands.properties.in",
"client/tomcatconf/nicira-nvp_commands.properties.in",
"client/tomcatconf/simulator_commands.properties.in",]
file_prefixes = [
"plugins/hypervisors/vmware/src/",
"plugins/network-elements/f5/src/",
"plugins/network-elements/juniper-srx/src/",
"plugins/file-systems/netapp/src/",
"plugins/network-elements/netscaler/src/",
"plugins/network-elements/nicira-nvp/src/",
"plugins/hypervisors/simulator/src/",]
counter = 0
for prop_file in prop_files:
    f = open(prop_file, 'r')
    data = f.read()
    f.close()
    file_prefix = file_prefixes[counter]
    apis = filter(lambda x: x.strip()!='' and (not x.startswith('#')), data.split('\n'))
    for api in apis:
        api_name = api.split('=')[0].strip()
        cmd_name = file_prefix + api.split('=')[1].split(';')[0].replace('.', '/').strip() + ".java"
        if not os.path.exists(cmd_name):
            print cmd_name, api_name
        f = open(cmd_name, 'r')
        d = f.read()
        f.close()
        idx = d.find(search_pattern) + pattern_len
        new_str = d[:idx] + "name = \"%s\", " % api_name + d[idx:]
        f = open(cmd_name, 'w')
        f.write(new_str)
        f.close()
    counter += 1

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
api: Fix name field in @APICommand for CopyTemplateCmd.java

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
api: Add CopyIsoCmd, boilerplate cmd class for api copyIso

Two apis, copyIso and copyTemplate point to the same Cmd class, the commit adds
the child class CopyIsoCmd that extends on CopyTemplateCmd. This just serves as
the boilerplate class. Every api cmd name maps 1:1 to a cmd class.

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