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/04 20:32:06 UTC

[15/18] git commit: api_refactor: move listhyperisor to datacenter

api_refactor: move listhyperisor to datacenter

will use this for all organizational units

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/d3261e5b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/d3261e5b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/d3261e5b

Branch: refs/heads/api_refactoring
Commit: d3261e5bb3d0d31a25514b3769d91d06d74c5c27
Parents: 658cf56
Author: Rohit Yadav <bh...@apache.org>
Authored: Tue Dec 4 10:41:22 2012 -0800
Committer: Rohit Yadav <bh...@apache.org>
Committed: Tue Dec 4 10:41:22 2012 -0800

----------------------------------------------------------------------
 .../datacenter/command/ListHypervisorsCmd.java     |   85 +++++++++++++++
 .../hypervisor/command/ListHypervisorsCmd.java     |   85 ---------------
 client/tomcatconf/commands.properties.in           |    2 +-
 3 files changed, 86 insertions(+), 86 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d3261e5b/api/src/org/apache/cloudstack/api/user/datacenter/command/ListHypervisorsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/datacenter/command/ListHypervisorsCmd.java b/api/src/org/apache/cloudstack/api/user/datacenter/command/ListHypervisorsCmd.java
new file mode 100644
index 0000000..4b5a60f
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/datacenter/command/ListHypervisorsCmd.java
@@ -0,0 +1,85 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.user.datacenter.command;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.cloud.api.commands.UpgradeRouterCmd;
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import com.cloud.api.response.HypervisorResponse;
+import com.cloud.api.response.ListResponse;
+import com.cloud.user.Account;
+
+@Implementation(description = "List hypervisors", responseObject = HypervisorResponse.class)
+public class ListHypervisorsCmd extends BaseCmd {
+    public static final Logger s_logger = Logger.getLogger(UpgradeRouterCmd.class.getName());
+    private static final String s_name = "listhypervisorsresponse";
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    // ///////////////////////////////////////////////////
+    // ////////////// API parameters /////////////////////
+    // ///////////////////////////////////////////////////
+
+    @IdentityMapper(entityTableName="data_center")
+    @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.LONG, description = "the zone id for listing hypervisors.")
+    private Long zoneId;
+
+    // ///////////////////////////////////////////////////
+    // ///////////////// Accessors ///////////////////////
+    // ///////////////////////////////////////////////////
+
+    public Long getZoneId() {
+        return this.zoneId;
+    }
+
+    // ///////////////////////////////////////////////////
+    // ///////////// API Implementation///////////////////
+    // ///////////////////////////////////////////////////
+    @Override
+    public long getEntityOwnerId() {
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public void execute() {
+        List<String> result = _mgr.getHypervisors(getZoneId());
+        ListResponse<HypervisorResponse> response = new ListResponse<HypervisorResponse>();
+        ArrayList<HypervisorResponse> responses = new ArrayList<HypervisorResponse>();
+        if (result != null) {
+            for (String hypervisor : result) {
+                HypervisorResponse hypervisorResponse = new HypervisorResponse();
+                hypervisorResponse.setName(hypervisor);
+                hypervisorResponse.setObjectName("hypervisor");
+                responses.add(hypervisorResponse);
+            }
+        }
+        response.setResponses(responses);
+        response.setResponseName(getCommandName());
+        this.setResponseObject(response);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d3261e5b/api/src/org/apache/cloudstack/api/user/hypervisor/command/ListHypervisorsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/hypervisor/command/ListHypervisorsCmd.java b/api/src/org/apache/cloudstack/api/user/hypervisor/command/ListHypervisorsCmd.java
deleted file mode 100644
index abab724..0000000
--- a/api/src/org/apache/cloudstack/api/user/hypervisor/command/ListHypervisorsCmd.java
+++ /dev/null
@@ -1,85 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.api.user.hypervisor.command;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.cloud.api.commands.UpgradeRouterCmd;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import com.cloud.api.response.HypervisorResponse;
-import com.cloud.api.response.ListResponse;
-import com.cloud.user.Account;
-
-@Implementation(description = "List hypervisors", responseObject = HypervisorResponse.class)
-public class ListHypervisorsCmd extends BaseCmd {
-    public static final Logger s_logger = Logger.getLogger(UpgradeRouterCmd.class.getName());
-    private static final String s_name = "listhypervisorsresponse";
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    // ///////////////////////////////////////////////////
-    // ////////////// API parameters /////////////////////
-    // ///////////////////////////////////////////////////
-
-    @IdentityMapper(entityTableName="data_center")
-    @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.LONG, description = "the zone id for listing hypervisors.")
-    private Long zoneId;
-
-    // ///////////////////////////////////////////////////
-    // ///////////////// Accessors ///////////////////////
-    // ///////////////////////////////////////////////////
-
-    public Long getZoneId() {
-        return this.zoneId;
-    }
-
-    // ///////////////////////////////////////////////////
-    // ///////////// API Implementation///////////////////
-    // ///////////////////////////////////////////////////
-    @Override
-    public long getEntityOwnerId() {
-        return Account.ACCOUNT_ID_SYSTEM;
-    }
-
-    @Override
-    public void execute() {
-        List<String> result = _mgr.getHypervisors(getZoneId());
-        ListResponse<HypervisorResponse> response = new ListResponse<HypervisorResponse>();
-        ArrayList<HypervisorResponse> responses = new ArrayList<HypervisorResponse>();
-        if (result != null) {
-            for (String hypervisor : result) {
-                HypervisorResponse hypervisorResponse = new HypervisorResponse();
-                hypervisorResponse.setName(hypervisor);
-                hypervisorResponse.setObjectName("hypervisor");
-                responses.add(hypervisorResponse);
-            }
-        }
-        response.setResponses(responses);
-        response.setResponseName(getCommandName());
-        this.setResponseObject(response);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d3261e5b/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
index 66dbae3..f778ddd 100755
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -290,7 +290,7 @@ listInstanceGroups=org.apache.cloudstack.api.user.vmgroup.command.ListVMGroupsCm
 uploadCustomCertificate=com.cloud.api.commands.UploadCustomCertificateCmd;1
 
 ### other commands
-listHypervisors=org.apache.cloudstack.api.user.hypervisor.command.ListHypervisorsCmd;15
+listHypervisors=org.apache.cloudstack.api.user.datacenter.command.ListHypervisorsCmd;15
 
 ### VPN
 createRemoteAccessVpn=org.apache.cloudstack.api.user.vpn.command.CreateRemoteAccessVpnCmd;15