You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2012/12/14 22:52:59 UTC

[2/3] git commit: API refactoring -- add annotation for cluster group cmds and response.

API refactoring -- add annotation for cluster group cmds and response.

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


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/a2a3ef63
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/a2a3ef63
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/a2a3ef63

Branch: refs/heads/api_refactoring
Commit: a2a3ef63c272c642457e57dfed00267ed2656bff
Parents: 7ea690c
Author: Fang Wang <fa...@citrix.com>
Authored: Fri Dec 14 12:39:07 2012 -0800
Committer: Rohit Yadav <bh...@apache.org>
Committed: Fri Dec 14 13:50:39 2012 -0800

----------------------------------------------------------------------
 .../api/command/admin/cluster/AddClusterCmd.java   |   12 +++++++-----
 .../command/admin/cluster/DeleteClusterCmd.java    |    5 +++--
 .../api/command/admin/cluster/ListClustersCmd.java |    6 ++++--
 .../command/admin/cluster/UpdateClusterCmd.java    |    4 ++--
 .../cloudstack/api/response/ClusterResponse.java   |    5 +++++
 .../cloudstack/api/response/PodResponse.java       |    5 +++++
 6 files changed, 26 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a2a3ef63/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
index 595963e..0728d66 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
@@ -30,6 +30,9 @@ import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.ServerApiException;
 import org.apache.cloudstack.api.response.ClusterResponse;
 import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.PodResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+
 import com.cloud.exception.DiscoveryException;
 import com.cloud.exception.ResourceInUseException;
 import com.cloud.org.Cluster;
@@ -48,8 +51,8 @@ public class AddClusterCmd extends BaseCmd {
     @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required=false, description="the password for the host")
     private String password;
 
-    @IdentityMapper(entityTableName="host_pod_ref")
-    @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, required=true, description="the Pod ID for the host")
+    //@IdentityMapper(entityTableName="host_pod_ref")
+    @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, required=true, description="the Pod ID for the host", entityType=PodResponse.class)
     private Long podId;
 
     @Parameter(name=ApiConstants.URL, type=CommandType.STRING, required=false, description="the URL")
@@ -58,9 +61,8 @@ public class AddClusterCmd extends BaseCmd {
     @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required=false, description="the username for the cluster")
     private String username;
 
-    @IdentityMapper(entityTableName="data_center")
-
-    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=true, description="the Zone ID for the cluster")
+    //@IdentityMapper(entityTableName="data_center")
+    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=true, description="the Zone ID for the cluster", entityType=ZoneResponse.class)
     private Long zoneId;
 
     @Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, required=true, description="hypervisor type of the cluster: XenServer,KVM,VMware,Hyperv,BareMetal,Simulator")

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a2a3ef63/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java
index 1a16ebc..1b41360 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java
@@ -24,6 +24,7 @@ import org.apache.cloudstack.api.IdentityMapper;
 import org.apache.cloudstack.api.Implementation;
 import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.ClusterResponse;
 import org.apache.cloudstack.api.response.SuccessResponse;
 import com.cloud.user.Account;
 
@@ -38,8 +39,8 @@ public class DeleteClusterCmd extends BaseCmd {
     //////////////// API parameters /////////////////////
     /////////////////////////////////////////////////////
 
-    @IdentityMapper(entityTableName="cluster")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the cluster ID")
+    //@IdentityMapper(entityTableName="cluster")
+    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the cluster ID", entityType=ClusterResponse.class)
     private Long id;
 
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a2a3ef63/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
index 06dba9d..1a3934e 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
@@ -29,6 +29,8 @@ import org.apache.cloudstack.api.Implementation;
 import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.response.ClusterResponse;
 import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+
 import com.cloud.org.Cluster;
 import com.cloud.utils.Pair;
 
@@ -53,8 +55,8 @@ public class ListClustersCmd extends BaseListCmd {
     @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="lists clusters by Pod ID")
     private Long podId;
 
-    @IdentityMapper(entityTableName="data_center")
-    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="lists clusters by Zone ID")
+    //@IdentityMapper(entityTableName="data_center")
+    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="lists clusters by Zone ID", entityType=ZoneResponse.class)
     private Long zoneId;
 
     @Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, description="lists clusters by hypervisor type")

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a2a3ef63/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
index 6695db2..1c98980 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
@@ -35,8 +35,8 @@ public class UpdateClusterCmd extends BaseCmd {
 
     private static final String s_name = "updateclusterresponse";
 
-    @IdentityMapper(entityTableName="cluster")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the Cluster")
+    //@IdentityMapper(entityTableName="cluster")
+    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the Cluster", entityType=ClusterResponse.class)
     private Long id;
 
     @Parameter(name=ApiConstants.CLUSTER_NAME, type=CommandType.STRING, description="the cluster name")

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a2a3ef63/api/src/org/apache/cloudstack/api/response/ClusterResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/ClusterResponse.java b/api/src/org/apache/cloudstack/api/response/ClusterResponse.java
index f657855..1e15653 100644
--- a/api/src/org/apache/cloudstack/api/response/ClusterResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/ClusterResponse.java
@@ -20,11 +20,16 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.Entity;
+
 import com.cloud.utils.IdentityProxy;
+import com.cloud.dc.DataCenter;
+import com.cloud.org.Cluster;
 import com.cloud.serializer.Param;
 import com.google.gson.annotations.SerializedName;
 import org.apache.cloudstack.api.BaseResponse;
 
+@Entity(value = Cluster.class)
 public class ClusterResponse extends BaseResponse {
     @SerializedName(ApiConstants.ID) @Param(description="the cluster ID")
     private IdentityProxy id = new IdentityProxy("cluster");

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a2a3ef63/api/src/org/apache/cloudstack/api/response/PodResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/PodResponse.java b/api/src/org/apache/cloudstack/api/response/PodResponse.java
index 1bd94ed..3e3cd4d 100644
--- a/api/src/org/apache/cloudstack/api/response/PodResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/PodResponse.java
@@ -19,11 +19,16 @@ package org.apache.cloudstack.api.response;
 import java.util.List;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.Entity;
+
 import com.cloud.utils.IdentityProxy;
+import com.cloud.dc.DataCenter;
+import com.cloud.dc.Pod;
 import com.cloud.serializer.Param;
 import com.google.gson.annotations.SerializedName;
 import org.apache.cloudstack.api.BaseResponse;
 
+@Entity(value = Pod.class)
 public class PodResponse extends BaseResponse {
     @SerializedName("id") @Param(description="the ID of the Pod")
     private IdentityProxy id = new IdentityProxy("host_pod_ref");