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 11:02:55 UTC
[4/55] [abbrv] git commit: api_refactor: refactor serviceoffering apis
api_refactor: refactor serviceoffering apis
- Fix refactored apis, mappings in commands*.in
- Fix comments etc.
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/28df57ec
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/28df57ec
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/28df57ec
Branch: refs/heads/api_refactoring
Commit: 28df57ec7564a1004c392ff1a70bbc497df6da63
Parents: 73d1099
Author: Rohit Yadav <bh...@apache.org>
Authored: Tue Dec 4 00:27:19 2012 -0800
Committer: Rohit Yadav <bh...@apache.org>
Committed: Tue Dec 4 00:27:19 2012 -0800
----------------------------------------------------------------------
.../com/cloud/api/commands/ListClustersCmd.java | 1 +
.../api/commands/ListServiceOfferingsCmd.java | 117 ---------------
api/src/com/cloud/server/ManagementService.java | 2 +-
.../command/ListServiceOfferingsCmd.java | 117 +++++++++++++++
client/tomcatconf/commands.properties.in | 2 +-
.../api/commands/ListExternalFirewallsCmd.java | 1 +
.../cloud/api/commands/ListTrafficMonitorsCmd.java | 1 +
.../src/com/cloud/server/ManagementServerImpl.java | 2 +-
8 files changed, 123 insertions(+), 120 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28df57ec/api/src/com/cloud/api/commands/ListClustersCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListClustersCmd.java b/api/src/com/cloud/api/commands/ListClustersCmd.java
index a6bd549..a3f5506 100755
--- a/api/src/com/cloud/api/commands/ListClustersCmd.java
+++ b/api/src/com/cloud/api/commands/ListClustersCmd.java
@@ -19,6 +19,7 @@ package com.cloud.api.commands;
import java.util.ArrayList;
import java.util.List;
+import org.apache.cloudstack.api.user.serviceoffering.command.ListServiceOfferingsCmd;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28df57ec/api/src/com/cloud/api/commands/ListServiceOfferingsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListServiceOfferingsCmd.java b/api/src/com/cloud/api/commands/ListServiceOfferingsCmd.java
deleted file mode 100644
index 69763b9..0000000
--- a/api/src/com/cloud/api/commands/ListServiceOfferingsCmd.java
+++ /dev/null
@@ -1,117 +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.ServiceOfferingResponse;
-import com.cloud.offering.ServiceOffering;
-
-@Implementation(description="Lists all available service offerings.", responseObject=ServiceOfferingResponse.class)
-public class ListServiceOfferingsCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListServiceOfferingsCmd.class.getName());
-
- private static final String s_name = "listserviceofferingsresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="disk_offering")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="ID of the service offering")
- private Long id;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="name of the service offering")
- private String serviceOfferingName;
-
- @IdentityMapper(entityTableName="vm_instance")
- @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, description="the ID of the virtual machine. Pass this in if you want to see the available service offering that a virtual machine can be changed to.")
- private Long virtualMachineId;
-
- @IdentityMapper(entityTableName="domain")
- @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the ID of the domain associated with the service offering")
- private Long domainId;
-
- @Parameter(name=ApiConstants.IS_SYSTEM_OFFERING, type=CommandType.BOOLEAN, description="is this a system vm offering")
- private Boolean isSystem;
-
- @Parameter(name=ApiConstants.SYSTEM_VM_TYPE, type=CommandType.STRING, description="the system VM type. Possible types are \"consoleproxy\", \"secondarystoragevm\" or \"domainrouter\".")
- private String systemVmType;
-
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
- public String getServiceOfferingName() {
- return serviceOfferingName;
- }
-
- public Long getVirtualMachineId() {
- return virtualMachineId;
- }
-
- public Long getDomainId(){
- return domainId;
- }
-
- public Boolean getIsSystem() {
- return isSystem == null ? false : isSystem;
- }
-
- public String getSystemVmType(){
- return systemVmType;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- List<? extends ServiceOffering> offerings = _mgr.searchForServiceOfferings(this);
- ListResponse<ServiceOfferingResponse> response = new ListResponse<ServiceOfferingResponse>();
- List<ServiceOfferingResponse> offeringResponses = new ArrayList<ServiceOfferingResponse>();
- for (ServiceOffering offering : offerings) {
- ServiceOfferingResponse offeringResponse = _responseGenerator.createServiceOfferingResponse(offering);
- offeringResponse.setObjectName("serviceoffering");
- offeringResponses.add(offeringResponse);
- }
-
- response.setResponses(offeringResponses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28df57ec/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 a6a36ff..dded41e 100755
--- a/api/src/com/cloud/server/ManagementService.java
+++ b/api/src/com/cloud/server/ManagementService.java
@@ -47,7 +47,7 @@ import com.cloud.api.commands.ListPodsByCmd;
import com.cloud.api.commands.ListPublicIpAddressesCmd;
import com.cloud.api.commands.ListRoutersCmd;
import org.apache.cloudstack.api.user.ssh.command.ListSSHKeyPairsCmd;
-import com.cloud.api.commands.ListServiceOfferingsCmd;
+import org.apache.cloudstack.api.user.serviceoffering.command.ListServiceOfferingsCmd;
import com.cloud.api.commands.ListStoragePoolsCmd;
import com.cloud.api.commands.ListSystemVMsCmd;
import org.apache.cloudstack.api.user.vmgroup.command.ListVMGroupsCmd;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28df57ec/api/src/org/apache/cloudstack/api/user/serviceoffering/command/ListServiceOfferingsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/serviceoffering/command/ListServiceOfferingsCmd.java b/api/src/org/apache/cloudstack/api/user/serviceoffering/command/ListServiceOfferingsCmd.java
new file mode 100644
index 0000000..89334aa
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/serviceoffering/command/ListServiceOfferingsCmd.java
@@ -0,0 +1,117 @@
+// 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.serviceoffering.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.ServiceOfferingResponse;
+import com.cloud.offering.ServiceOffering;
+
+@Implementation(description="Lists all available service offerings.", responseObject=ServiceOfferingResponse.class)
+public class ListServiceOfferingsCmd extends BaseListCmd {
+ public static final Logger s_logger = Logger.getLogger(ListServiceOfferingsCmd.class.getName());
+
+ private static final String s_name = "listserviceofferingsresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @IdentityMapper(entityTableName="disk_offering")
+ @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="ID of the service offering")
+ private Long id;
+
+ @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="name of the service offering")
+ private String serviceOfferingName;
+
+ @IdentityMapper(entityTableName="vm_instance")
+ @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, description="the ID of the virtual machine. Pass this in if you want to see the available service offering that a virtual machine can be changed to.")
+ private Long virtualMachineId;
+
+ @IdentityMapper(entityTableName="domain")
+ @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the ID of the domain associated with the service offering")
+ private Long domainId;
+
+ @Parameter(name=ApiConstants.IS_SYSTEM_OFFERING, type=CommandType.BOOLEAN, description="is this a system vm offering")
+ private Boolean isSystem;
+
+ @Parameter(name=ApiConstants.SYSTEM_VM_TYPE, type=CommandType.STRING, description="the system VM type. Possible types are \"consoleproxy\", \"secondarystoragevm\" or \"domainrouter\".")
+ private String systemVmType;
+
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+ public String getServiceOfferingName() {
+ return serviceOfferingName;
+ }
+
+ public Long getVirtualMachineId() {
+ return virtualMachineId;
+ }
+
+ public Long getDomainId(){
+ return domainId;
+ }
+
+ public Boolean getIsSystem() {
+ return isSystem == null ? false : isSystem;
+ }
+
+ public String getSystemVmType(){
+ return systemVmType;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public void execute(){
+ List<? extends ServiceOffering> offerings = _mgr.searchForServiceOfferings(this);
+ ListResponse<ServiceOfferingResponse> response = new ListResponse<ServiceOfferingResponse>();
+ List<ServiceOfferingResponse> offeringResponses = new ArrayList<ServiceOfferingResponse>();
+ for (ServiceOffering offering : offerings) {
+ ServiceOfferingResponse offeringResponse = _responseGenerator.createServiceOfferingResponse(offering);
+ offeringResponse.setObjectName("serviceoffering");
+ offeringResponses.add(offeringResponse);
+ }
+
+ response.setResponses(offeringResponses);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28df57ec/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
index f7ce43b..d9d5ed0 100755
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -110,7 +110,7 @@ listOsCategories=org.apache.cloudstack.api.user.guest.command.ListGuestOsCategor
createServiceOffering=com.cloud.api.commands.CreateServiceOfferingCmd;1
deleteServiceOffering=com.cloud.api.commands.DeleteServiceOfferingCmd;1
updateServiceOffering=com.cloud.api.commands.UpdateServiceOfferingCmd;1
-listServiceOfferings=com.cloud.api.commands.ListServiceOfferingsCmd;15
+listServiceOfferings=org.apache.cloudstack.api.user.serviceoffering.command.ListServiceOfferingsCmd;15
#### disk offering commands
createDiskOffering=com.cloud.api.commands.CreateDiskOfferingCmd;1
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28df57ec/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListExternalFirewallsCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListExternalFirewallsCmd.java b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListExternalFirewallsCmd.java
index 29bf3d2..63a9ebd 100644
--- a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListExternalFirewallsCmd.java
+++ b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListExternalFirewallsCmd.java
@@ -19,6 +19,7 @@ package com.cloud.api.commands;
import java.util.ArrayList;
import java.util.List;
+import org.apache.cloudstack.api.user.serviceoffering.command.ListServiceOfferingsCmd;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28df57ec/server/src/com/cloud/api/commands/ListTrafficMonitorsCmd.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/commands/ListTrafficMonitorsCmd.java b/server/src/com/cloud/api/commands/ListTrafficMonitorsCmd.java
index 59683dc..a6ea5b3 100644
--- a/server/src/com/cloud/api/commands/ListTrafficMonitorsCmd.java
+++ b/server/src/com/cloud/api/commands/ListTrafficMonitorsCmd.java
@@ -19,6 +19,7 @@ package com.cloud.api.commands;
import java.util.ArrayList;
import java.util.List;
+import org.apache.cloudstack.api.user.serviceoffering.command.ListServiceOfferingsCmd;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/28df57ec/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 6a895e3..859354a 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -46,6 +46,7 @@ import org.apache.cloudstack.api.user.guest.command.ListGuestOsCategoriesCmd;
import org.apache.cloudstack.api.user.guest.command.ListGuestOsCmd;
import org.apache.cloudstack.api.user.iso.command.ListIsosCmd;
import org.apache.cloudstack.api.user.job.command.ListAsyncJobsCmd;
+import org.apache.cloudstack.api.user.serviceoffering.command.ListServiceOfferingsCmd;
import org.apache.cloudstack.api.user.ssh.command.DeleteSSHKeyPairCmd;
import org.apache.cloudstack.api.user.ssh.command.RegisterSSHKeyPairCmd;
import org.apache.cloudstack.api.user.template.command.ListTemplatesCmd;
@@ -83,7 +84,6 @@ import com.cloud.api.commands.ListPodsByCmd;
import com.cloud.api.commands.ListPublicIpAddressesCmd;
import com.cloud.api.commands.ListRoutersCmd;
import org.apache.cloudstack.api.user.ssh.command.ListSSHKeyPairsCmd;
-import com.cloud.api.commands.ListServiceOfferingsCmd;
import com.cloud.api.commands.ListStoragePoolsCmd;
import com.cloud.api.commands.ListSystemVMsCmd;
import com.cloud.api.commands.ListVlanIpRangesCmd;