incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [13/18] git commit: api_refactor: move listzones and listcapabilities to dc
Date Tue, 04 Dec 2012 19:32:06 GMT
api_refactor: move listzones and listcapabilities to dc

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

Branch: refs/heads/api_refactoring
Commit: 7f9c490b5a7865adae1d9ad4ee17895aa0cd49ed
Parents: a34fc1f
Author: Rohit Yadav <bhaisaab@apache.org>
Authored: Tue Dec 4 11:06:34 2012 -0800
Committer: Rohit Yadav <bhaisaab@apache.org>
Committed: Tue Dec 4 11:06:34 2012 -0800

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


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7f9c490b/api/src/com/cloud/api/commands/GetCloudIdentifierCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/GetCloudIdentifierCmd.java b/api/src/com/cloud/api/commands/GetCloudIdentifierCmd.java
deleted file mode 100644
index f3bdab5..0000000
--- a/api/src/com/cloud/api/commands/GetCloudIdentifierCmd.java
+++ /dev/null
@@ -1,83 +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 com.cloud.api.commands;
-
-import java.util.ArrayList;
-
-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 org.apache.cloudstack.api.ServerApiException;
-import com.cloud.api.response.CloudIdentifierResponse;
-import com.cloud.user.Account;
-
-@Implementation(description="Retrieves a cloud identifier.", responseObject=CloudIdentifierResponse.class)
-public class GetCloudIdentifierCmd extends BaseCmd {
-    public static final Logger s_logger = Logger.getLogger(GetCloudIdentifierCmd.class.getName());
-    private static final String s_name = "getcloudidentifierresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @IdentityMapper(entityTableName="user")
-    @Parameter(name=ApiConstants.USER_ID, type=CommandType.LONG, required=true, description="the
user ID for the cloud identifier")
-    private Long userid;
-
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public Long getUserId() {
-        return userid;
-    }
-
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        return Account.ACCOUNT_ID_SYSTEM;
-    }
-
-    @Override
-    public void execute(){
-        ArrayList<String> result = _mgr.getCloudIdentifierResponse(userid);
-        CloudIdentifierResponse response = new CloudIdentifierResponse();
-        if (result != null) {
-            response.setCloudIdentifier(result.get(0));
-            response.setSignature(result.get(1));
-            response.setObjectName("cloudidentifier");
-            response.setResponseName(getCommandName());
-            this.setResponseObject(response);
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to get cloud identifier");
-        }
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7f9c490b/api/src/com/cloud/api/commands/ListZonesByCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListZonesByCmd.java b/api/src/com/cloud/api/commands/ListZonesByCmd.java
deleted file mode 100755
index 63822b7..0000000
--- a/api/src/com/cloud/api/commands/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 com.cloud.api.commands;
-
-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/7f9c490b/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 e9fcf65..0169d76 100755
--- a/api/src/com/cloud/server/ManagementService.java
+++ b/api/src/com/cloud/server/ManagementService.java
@@ -52,7 +52,7 @@ import com.cloud.api.commands.ListStoragePoolsCmd;
 import com.cloud.api.commands.ListSystemVMsCmd;
 import org.apache.cloudstack.api.user.vmgroup.command.ListVMGroupsCmd;
 import com.cloud.api.commands.ListVlanIpRangesCmd;
-import com.cloud.api.commands.ListZonesByCmd;
+import org.apache.cloudstack.api.user.datacenter.command.ListZonesByCmd;
 import com.cloud.api.commands.RebootSystemVmCmd;
 import org.apache.cloudstack.api.user.ssh.command.RegisterSSHKeyPairCmd;
 import com.cloud.api.commands.StopSystemVmCmd;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7f9c490b/api/src/org/apache/cloudstack/api/user/datacenter/command/GetCloudIdentifierCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/datacenter/command/GetCloudIdentifierCmd.java
b/api/src/org/apache/cloudstack/api/user/datacenter/command/GetCloudIdentifierCmd.java
new file mode 100644
index 0000000..f836625
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/datacenter/command/GetCloudIdentifierCmd.java
@@ -0,0 +1,83 @@
+// 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 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 org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.CloudIdentifierResponse;
+import com.cloud.user.Account;
+
+@Implementation(description="Retrieves a cloud identifier.", responseObject=CloudIdentifierResponse.class)
+public class GetCloudIdentifierCmd extends BaseCmd {
+    public static final Logger s_logger = Logger.getLogger(GetCloudIdentifierCmd.class.getName());
+    private static final String s_name = "getcloudidentifierresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @IdentityMapper(entityTableName="user")
+    @Parameter(name=ApiConstants.USER_ID, type=CommandType.LONG, required=true, description="the
user ID for the cloud identifier")
+    private Long userid;
+
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getUserId() {
+        return userid;
+    }
+
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public void execute(){
+        ArrayList<String> result = _mgr.getCloudIdentifierResponse(userid);
+        CloudIdentifierResponse response = new CloudIdentifierResponse();
+        if (result != null) {
+            response.setCloudIdentifier(result.get(0));
+            response.setSignature(result.get(1));
+            response.setObjectName("cloudidentifier");
+            response.setResponseName(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to get cloud identifier");
+        }
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7f9c490b/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
new file mode 100755
index 0000000..9e6e2fd
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/datacenter/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.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/7f9c490b/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
index dd0c7fa..4ea3974 100755
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -46,7 +46,7 @@ listDomains=com.cloud.api.commands.ListDomainsCmd;7
 listDomainChildren=com.cloud.api.commands.ListDomainChildrenCmd;7
 
 ####Cloud Identifier commands
-getCloudIdentifier=com.cloud.api.commands.GetCloudIdentifierCmd;15
+getCloudIdentifier=org.apache.cloudstack.api.user.datacenter.command.GetCloudIdentifierCmd;15
 
 #### Limit commands
 updateResourceLimit=com.cloud.api.commands.UpdateResourceLimitCmd;7
@@ -211,7 +211,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=com.cloud.api.commands.ListZonesByCmd;15
+listZones=org.apache.cloudstack.api.user.datacenter.command.ListZonesByCmd;15
 
 #### events commands
 listEvents=org.apache.cloudstack.api.user.event.command.ListEventsCmd;15

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7f9c490b/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 2f8575f..bd95adb 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -87,7 +87,7 @@ import org.apache.cloudstack.api.user.ssh.command.ListSSHKeyPairsCmd;
 import com.cloud.api.commands.ListStoragePoolsCmd;
 import com.cloud.api.commands.ListSystemVMsCmd;
 import com.cloud.api.commands.ListVlanIpRangesCmd;
-import com.cloud.api.commands.ListZonesByCmd;
+import org.apache.cloudstack.api.user.datacenter.command.ListZonesByCmd;
 import com.cloud.api.commands.RebootSystemVmCmd;
 import com.cloud.api.commands.StopSystemVmCmd;
 import com.cloud.api.commands.UpdateDomainCmd;


Mime
View raw message