incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [9/14] git commit: api_refactor: move zone and hypervisor user level apis to appropriate pkg names
Date Thu, 06 Dec 2012 19:14:32 GMT
api_refactor: move zone and hypervisor user level apis to appropriate pkg names

Signed-off-by: Rohit Yadav <bhaisaab@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/7f61d29c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/7f61d29c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/7f61d29c

Branch: refs/heads/api_refactoring
Commit: 7f61d29c371f7bd51309ec13572d8f2496be0854
Parents: cc386b7
Author: Rohit Yadav <bhaisaab@apache.org>
Authored: Thu Dec 6 10:36:26 2012 -0800
Committer: Rohit Yadav <bhaisaab@apache.org>
Committed: Thu Dec 6 10:36:26 2012 -0800

----------------------------------------------------------------------
 api/src/com/cloud/server/ManagementService.java    |    2 +-
 .../datacenter/command/ListHypervisorsCmd.java     |   85 ------------
 .../user/datacenter/command/ListZonesByCmd.java    |  100 ---------------
 .../hypervisor/command/ListHypervisorsCmd.java     |   85 ++++++++++++
 .../api/user/zone/command/ListZonesByCmd.java      |  100 +++++++++++++++
 client/tomcatconf/commands.properties.in           |    4 +-
 .../src/com/cloud/server/ManagementServerImpl.java |    2 +-
 7 files changed, 189 insertions(+), 189 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7f61d29c/api/src/com/cloud/server/ManagementService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/server/ManagementService.java b/api/src/com/cloud/server/ManagementService.java
index 00f5abd..936bb79 100755
--- a/api/src/com/cloud/server/ManagementService.java
+++ b/api/src/com/cloud/server/ManagementService.java
@@ -53,7 +53,7 @@ import org.apache.cloudstack.api.admin.storagepool.command.ListStoragePoolsCmd;
 import org.apache.cloudstack.api.admin.systemvm.command.ListSystemVMsCmd;
 import org.apache.cloudstack.api.user.vmgroup.command.ListVMGroupsCmd;
 import com.cloud.api.commands.ListVlanIpRangesCmd;
-import org.apache.cloudstack.api.user.datacenter.command.ListZonesByCmd;
+import org.apache.cloudstack.api.user.zone.command.ListZonesByCmd;
 import org.apache.cloudstack.api.admin.systemvm.command.RebootSystemVmCmd;
 import org.apache.cloudstack.api.user.ssh.command.RegisterSSHKeyPairCmd;
 import org.apache.cloudstack.api.admin.systemvm.command.StopSystemVmCmd;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7f61d29c/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
deleted file mode 100644
index ac7abab..0000000
--- a/api/src/org/apache/cloudstack/api/user/datacenter/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.datacenter.command;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.cloudstack.api.admin.router.command.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/7f61d29c/api/src/org/apache/cloudstack/api/user/datacenter/command/ListZonesByCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/datacenter/command/ListZonesByCmd.java
b/api/src/org/apache/cloudstack/api/user/datacenter/command/ListZonesByCmd.java
deleted file mode 100755
index 9e6e2fd..0000000
--- a/api/src/org/apache/cloudstack/api/user/datacenter/command/ListZonesByCmd.java
+++ /dev/null
@@ -1,100 +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.datacenter.command;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseListCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import com.cloud.api.response.ListResponse;
-import com.cloud.api.response.ZoneResponse;
-import com.cloud.dc.DataCenter;
-
-@Implementation(description="Lists zones", responseObject=ZoneResponse.class)
-public class ListZonesByCmd extends BaseListCmd {
-    public static final Logger s_logger = Logger.getLogger(ListZonesByCmd.class.getName());
-
-    private static final String s_name = "listzonesresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-    @IdentityMapper(entityTableName="data_center")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the ID of the zone")
-    private Long id;
-
-    @Parameter(name=ApiConstants.AVAILABLE, type=CommandType.BOOLEAN, description="true if
you want to retrieve all available Zones. False if you only want to return the Zones from
which you have at least one VM. Default is false.")
-    private Boolean available;
-
-    @IdentityMapper(entityTableName="domain")
-    @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the ID of
the domain associated with the zone")
-    private Long domainId;
-
-    @Parameter(name=ApiConstants.SHOW_CAPACITIES, type=CommandType.BOOLEAN, description="flag
to display the capacity of the zones")
-    private Boolean showCapacities;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public Long getId() {
-        return id;
-    }
-
-    public Boolean isAvailable() {
-        return available;
-    }
-
-    public Long getDomainId(){
-        return domainId;
-    }
-
-    public Boolean getShowCapacities() {
-        return showCapacities;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public void execute(){
-        List<? extends DataCenter> dataCenters = _mgr.listDataCenters(this);
-        ListResponse<ZoneResponse> response = new ListResponse<ZoneResponse>();
-        List<ZoneResponse> zoneResponses = new ArrayList<ZoneResponse>();
-        for (DataCenter dataCenter : dataCenters) {
-            ZoneResponse zoneResponse = _responseGenerator.createZoneResponse(dataCenter,
showCapacities);
-            zoneResponse.setObjectName("zone");
-            zoneResponses.add(zoneResponse);
-        }
-
-        response.setResponses(zoneResponses);
-        response.setResponseName(getCommandName());
-        this.setResponseObject(response);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7f61d29c/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
new file mode 100644
index 0000000..2055f99
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/hypervisor/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.hypervisor.command;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cloudstack.api.admin.router.command.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/7f61d29c/api/src/org/apache/cloudstack/api/user/zone/command/ListZonesByCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/zone/command/ListZonesByCmd.java b/api/src/org/apache/cloudstack/api/user/zone/command/ListZonesByCmd.java
new file mode 100755
index 0000000..16403b8
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/zone/command/ListZonesByCmd.java
@@ -0,0 +1,100 @@
+// 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.zone.command;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import com.cloud.api.response.ListResponse;
+import com.cloud.api.response.ZoneResponse;
+import com.cloud.dc.DataCenter;
+
+@Implementation(description="Lists zones", responseObject=ZoneResponse.class)
+public class ListZonesByCmd extends BaseListCmd {
+    public static final Logger s_logger = Logger.getLogger(ListZonesByCmd.class.getName());
+
+    private static final String s_name = "listzonesresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    @IdentityMapper(entityTableName="data_center")
+    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the ID of the zone")
+    private Long id;
+
+    @Parameter(name=ApiConstants.AVAILABLE, type=CommandType.BOOLEAN, description="true if
you want to retrieve all available Zones. False if you only want to return the Zones from
which you have at least one VM. Default is false.")
+    private Boolean available;
+
+    @IdentityMapper(entityTableName="domain")
+    @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the ID of
the domain associated with the zone")
+    private Long domainId;
+
+    @Parameter(name=ApiConstants.SHOW_CAPACITIES, type=CommandType.BOOLEAN, description="flag
to display the capacity of the zones")
+    private Boolean showCapacities;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    public Boolean isAvailable() {
+        return available;
+    }
+
+    public Long getDomainId(){
+        return domainId;
+    }
+
+    public Boolean getShowCapacities() {
+        return showCapacities;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public void execute(){
+        List<? extends DataCenter> dataCenters = _mgr.listDataCenters(this);
+        ListResponse<ZoneResponse> response = new ListResponse<ZoneResponse>();
+        List<ZoneResponse> zoneResponses = new ArrayList<ZoneResponse>();
+        for (DataCenter dataCenter : dataCenters) {
+            ZoneResponse zoneResponse = _responseGenerator.createZoneResponse(dataCenter,
showCapacities);
+            zoneResponse.setObjectName("zone");
+            zoneResponses.add(zoneResponse);
+        }
+
+        response.setResponses(zoneResponses);
+        response.setResponseName(getCommandName());
+        this.setResponseObject(response);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7f61d29c/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
index 2964ae1..1379504 100755
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -212,7 +212,7 @@ listPods=com.cloud.api.commands.ListPodsByCmd;3
 createZone=com.cloud.api.commands.CreateZoneCmd;1
 updateZone=com.cloud.api.commands.UpdateZoneCmd;1
 deleteZone=com.cloud.api.commands.DeleteZoneCmd;1
-listZones=org.apache.cloudstack.api.user.datacenter.command.ListZonesByCmd;15
+listZones=org.apache.cloudstack.api.user.zone.command.ListZonesByCmd;15
 
 #### events commands
 listEvents=org.apache.cloudstack.api.user.event.command.ListEventsCmd;15
@@ -291,7 +291,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.datacenter.command.ListHypervisorsCmd;15
+listHypervisors=org.apache.cloudstack.api.user.hypervisor.command.ListHypervisorsCmd;15
 
 ### VPN
 createRemoteAccessVpn=org.apache.cloudstack.api.user.vpn.command.CreateRemoteAccessVpnCmd;15

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7f61d29c/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index dd91d60..7ee9fdf 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -55,6 +55,7 @@ import org.apache.cloudstack.api.user.ssh.command.RegisterSSHKeyPairCmd;
 import org.apache.cloudstack.api.user.template.command.ListTemplatesCmd;
 import org.apache.cloudstack.api.user.template.command.UpdateTemplateCmd;
 import org.apache.cloudstack.api.user.vmgroup.command.ListVMGroupsCmd;
+import org.apache.cloudstack.api.user.zone.command.ListZonesByCmd;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.log4j.Logger;
 
@@ -87,7 +88,6 @@ import org.apache.cloudstack.api.user.ssh.command.ListSSHKeyPairsCmd;
 import org.apache.cloudstack.api.admin.storagepool.command.ListStoragePoolsCmd;
 import org.apache.cloudstack.api.admin.systemvm.command.ListSystemVMsCmd;
 import com.cloud.api.commands.ListVlanIpRangesCmd;
-import org.apache.cloudstack.api.user.datacenter.command.ListZonesByCmd;
 import org.apache.cloudstack.api.admin.systemvm.command.RebootSystemVmCmd;
 import org.apache.cloudstack.api.admin.systemvm.command.StopSystemVmCmd;
 import com.cloud.api.commands.UpdateDomainCmd;


Mime
View raw message