You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ml...@apache.org on 2013/01/10 01:48:36 UTC
[30/52] [partial] Summary: Fixes for api_refactoring
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/UpdateNetworkOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/UpdateNetworkOfferingCmd.java b/api/src/com/cloud/api/commands/UpdateNetworkOfferingCmd.java
deleted file mode 100755
index c303619..0000000
--- a/api/src/com/cloud/api/commands/UpdateNetworkOfferingCmd.java
+++ /dev/null
@@ -1,112 +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 org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.ServerApiException;
-import com.cloud.api.response.NetworkOfferingResponse;
-import com.cloud.offering.NetworkOffering;
-import com.cloud.user.Account;
-
-@Implementation(description="Updates a network offering.", responseObject=NetworkOfferingResponse.class)
-public class UpdateNetworkOfferingCmd extends BaseCmd {
- public static final Logger s_logger = Logger.getLogger(UpdateNetworkOfferingCmd.class.getName());
- private static final String _name = "updatenetworkofferingresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="network_offerings")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the id of the network offering")
- private Long id;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the network offering")
- private String networkOfferingName;
-
- @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="the display text of the network offering")
- private String displayText;
-
- @Parameter(name=ApiConstants.AVAILABILITY, type=CommandType.STRING, description="the availability of network offering." +
- " Default value is Required for Guest Virtual network offering; Optional for Guest Direct network offering")
- private String availability;
-
- @Parameter(name=ApiConstants.SORT_KEY, type=CommandType.INTEGER, description="sort key of the network offering, integer")
- private Integer sortKey;
-
- @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="update state for the network offering")
- private String state;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public String getNetworkOfferingName() {
- return networkOfferingName;
- }
-
- public String getDisplayText() {
- return displayText;
- }
-
- public Long getId() {
- return id;
- }
-
- public String getAvailability() {
- return availability;
- }
-
- public String getState() {
- return state;
- }
-
- public Integer getSortKey() {
- return sortKey;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
- @Override
- public String getCommandName() {
- return _name;
- }
-
- @Override
- public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
- }
-
- @Override
- public void execute(){
- NetworkOffering result = _configService.updateNetworkOffering(this);
- if (result != null) {
- NetworkOfferingResponse response = _responseGenerator.createNetworkOfferingResponse(result);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update network offering");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/UpdateNetworkServiceProviderCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/UpdateNetworkServiceProviderCmd.java b/api/src/com/cloud/api/commands/UpdateNetworkServiceProviderCmd.java
deleted file mode 100644
index bd52f35..0000000
--- a/api/src/com/cloud/api/commands/UpdateNetworkServiceProviderCmd.java
+++ /dev/null
@@ -1,111 +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.List;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseAsyncCmd;
-import com.cloud.api.BaseCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.ServerApiException;
-import com.cloud.api.response.ProviderResponse;
-import com.cloud.async.AsyncJob;
-import com.cloud.event.EventTypes;
-import com.cloud.network.PhysicalNetworkServiceProvider;
-import com.cloud.user.Account;
-
-@Implementation(description="Updates a network serviceProvider of a physical network", responseObject=ProviderResponse.class, since="3.0.0")
-public class UpdateNetworkServiceProviderCmd extends BaseAsyncCmd {
- public static final Logger s_logger = Logger.getLogger(UpdateNetworkServiceProviderCmd.class.getName());
-
- private static final String s_name = "updatenetworkserviceproviderresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="Enabled/Disabled/Shutdown the physical network service provider")
- private String state;
-
- @IdentityMapper(entityTableName="physical_network_service_providers")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="network service provider id")
- private Long id;
-
- @Parameter(name=ApiConstants.SERVICE_LIST, type=CommandType.LIST, collectionType = CommandType.STRING, description="the list of services to be enabled for this physical network service provider")
- private List<String> enabledServices;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public String getState() {
- return state;
- }
-
- private Long getId() {
- return id;
- }
-
- public List<String> getEnabledServices() {
- return enabledServices;
- }
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
- }
-
- @Override
- public void execute(){
- PhysicalNetworkServiceProvider result = _networkService.updateNetworkServiceProvider(getId(), getState(), getEnabledServices());
- if (result != null) {
- ProviderResponse response = _responseGenerator.createNetworkServiceProviderResponse(result);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update service provider");
- }
- }
-
- @Override
- public String getEventType() {
- return EventTypes.EVENT_SERVICE_PROVIDER_UPDATE;
- }
-
- @Override
- public String getEventDescription() {
- return "Updating physical network ServiceProvider: " + getId();
- }
-
- @Override
- public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.PhysicalNetworkServiceProvider;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/UpdatePhysicalNetworkCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/UpdatePhysicalNetworkCmd.java b/api/src/com/cloud/api/commands/UpdatePhysicalNetworkCmd.java
deleted file mode 100644
index a6abc03..0000000
--- a/api/src/com/cloud/api/commands/UpdatePhysicalNetworkCmd.java
+++ /dev/null
@@ -1,119 +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.List;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseAsyncCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.PhysicalNetworkResponse;
-import com.cloud.async.AsyncJob;
-import com.cloud.event.EventTypes;
-import com.cloud.network.PhysicalNetwork;
-import com.cloud.user.Account;
-
-@Implementation(description="Updates a physical network", responseObject=PhysicalNetworkResponse.class, since="3.0.0")
-public class UpdatePhysicalNetworkCmd extends BaseAsyncCmd {
- public static final Logger s_logger = Logger.getLogger(UpdatePhysicalNetworkCmd.class.getName());
-
- private static final String s_name = "updatephysicalnetworkresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
- @IdentityMapper(entityTableName="physical_network")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="physical network id")
- private Long id;
-
- @Parameter(name=ApiConstants.NETWORK_SPEED, type=CommandType.STRING, description="the speed for the physical network[1G/10G]")
- private String speed;
-
- @Parameter(name=ApiConstants.TAGS, type=CommandType.LIST, collectionType=CommandType.STRING, description="Tag the physical network")
- private List<String> tags;
-
- @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="Enabled/Disabled")
- private String state;
-
- @Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="the VLAN for the physical network")
- private String vlan;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public List<String> getTags() {
- return tags;
- }
-
- public String getNetworkSpeed() {
- return speed;
- }
-
- public String getState() {
- return state;
- }
-
- public Long getId() {
- return id;
- }
-
- public String getVlan() {
- return vlan;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
- }
-
- @Override
- public void execute(){
- PhysicalNetwork result = _networkService.updatePhysicalNetwork(getId(),getNetworkSpeed(), getTags(), getVlan(), getState());
- PhysicalNetworkResponse response = _responseGenerator.createPhysicalNetworkResponse(result);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-
- @Override
- public String getEventDescription() {
- return "Updating Physical network: " + getId();
- }
-
- @Override
- public String getEventType() {
- return EventTypes.EVENT_PHYSICAL_NETWORK_UPDATE;
- }
-
- @Override
- public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.PhysicalNetwork;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/UpdatePodCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/UpdatePodCmd.java b/api/src/com/cloud/api/commands/UpdatePodCmd.java
deleted file mode 100755
index f575c7c..0000000
--- a/api/src/com/cloud/api/commands/UpdatePodCmd.java
+++ /dev/null
@@ -1,119 +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 org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.ServerApiException;
-import com.cloud.api.response.PodResponse;
-import com.cloud.dc.Pod;
-import com.cloud.user.Account;
-
-@Implementation(description="Updates a Pod.", responseObject=PodResponse.class)
-public class UpdatePodCmd extends BaseCmd {
- public static final Logger s_logger = Logger.getLogger(UpdatePodCmd.class.getName());
-
- private static final String s_name = "updatepodresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="host_pod_ref")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the Pod")
- private Long id;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the Pod")
- private String podName;
-
- @Parameter(name=ApiConstants.START_IP, type=CommandType.STRING, description="the starting IP address for the Pod")
- private String startIp;
-
- @Parameter(name=ApiConstants.END_IP, type=CommandType.STRING, description="the ending IP address for the Pod")
- private String endIp;
-
- @Parameter(name=ApiConstants.NETMASK, type=CommandType.STRING, description="the netmask of the Pod")
- private String netmask;
-
- @Parameter(name=ApiConstants.GATEWAY, type=CommandType.STRING, description="the gateway for the Pod")
- private String gateway;
-
- @Parameter(name=ApiConstants.ALLOCATION_STATE, type=CommandType.STRING, description="Allocation state of this cluster for allocation of new resources")
- private String allocationState;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public String getNetmask() {
- return netmask;
- }
-
- public String getEndIp() {
- return endIp;
- }
-
- public String getGateway() {
- return gateway;
- }
-
- public Long getId() {
- return id;
- }
-
- public String getPodName() {
- return podName;
- }
-
- public String getStartIp() {
- return startIp;
- }
-
- public String getAllocationState() {
- return allocationState;
- }
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
- }
-
- @Override
- public void execute(){
- Pod result = _configService.editPod(this);
- if (result != null) {
- PodResponse response = _responseGenerator.createPodResponse(result,false);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update pod");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/UpdatePortForwardingRuleCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/UpdatePortForwardingRuleCmd.java b/api/src/com/cloud/api/commands/UpdatePortForwardingRuleCmd.java
deleted file mode 100644
index 37da43a..0000000
--- a/api/src/com/cloud/api/commands/UpdatePortForwardingRuleCmd.java
+++ /dev/null
@@ -1,129 +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 org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseAsyncCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.FirewallRuleResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.network.IpAddress;
-import com.cloud.user.Account;
-
-@Implementation(responseObject=FirewallRuleResponse.class, description="Updates a port forwarding rule. Only the private port and the virtual machine can be updated.")
-public class UpdatePortForwardingRuleCmd extends BaseAsyncCmd {
- public static final Logger s_logger = Logger.getLogger(UpdatePortForwardingRuleCmd.class.getName());
- private static final String s_name = "updateportforwardingruleresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name=ApiConstants.PRIVATE_IP, type=CommandType.STRING, description="the private IP address of the port forwarding rule")
- private String privateIp;
-
- @Parameter(name=ApiConstants.PRIVATE_PORT, type=CommandType.STRING, required=true, description="the private port of the port forwarding rule")
- private String privatePort;
-
- @Parameter(name=ApiConstants.PROTOCOL, type=CommandType.STRING, required=true, description="the protocol for the port fowarding rule. Valid values are TCP or UDP.")
- private String protocol;
-
- @IdentityMapper(entityTableName="user_ip_address")
- @Parameter(name=ApiConstants.IP_ADDRESS_ID, type=CommandType.LONG, required=true, description="the IP address id of the port forwarding rule")
- private Long publicIpId;
-
- @Parameter(name=ApiConstants.PUBLIC_PORT, type=CommandType.STRING, required=true, description="the public port of the port forwarding rule")
- private String publicPort;
-
- @IdentityMapper(entityTableName="vm_instance")
- @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, description="the ID of the virtual machine for the port forwarding rule")
- private Long virtualMachineId;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public String getPrivateIp() {
- return privateIp;
- }
-
- public String getPrivatePort() {
- return privatePort;
- }
-
- public String getProtocol() {
- return protocol;
- }
-
- public Long getPublicIpId() {
- return publicIpId;
- }
-
- public String getPublicPort() {
- return publicPort;
- }
-
- public Long getVirtualMachineId() {
- return virtualMachineId;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- IpAddress addr = _entityMgr.findById(IpAddress.class, getPublicIpId());
- if (addr != null) {
- return addr.getAccountId();
- }
-
- // bad address given, parent this command to SYSTEM so ERROR events are tracked
- return Account.ACCOUNT_ID_SYSTEM;
- }
-
- @Override
- public String getEventType() {
- return EventTypes.EVENT_NET_RULE_MODIFY;
- }
-
- @Override
- public String getEventDescription() {
- return "updating port forwarding rule";
- }
-
- @Override
- public void execute(){
-//FIXME: PortForwardingRule result = _mgr.updatePortForwardingRule(this);
-// if (result != null) {
-// FirewallRuleResponse response = _responseGenerator.createFirewallRuleResponse(result);
-// response.setResponseName(getName());
-// this.setResponseObject(response);
-// } else {
-// throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update port forwarding rule");
-// }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/UpdateProjectCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/UpdateProjectCmd.java b/api/src/com/cloud/api/commands/UpdateProjectCmd.java
deleted file mode 100644
index 0c90e16..0000000
--- a/api/src/com/cloud/api/commands/UpdateProjectCmd.java
+++ /dev/null
@@ -1,114 +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 org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseAsyncCmd;
-import com.cloud.api.BaseCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.ServerApiException;
-import com.cloud.api.response.ProjectResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.projects.Project;
-import com.cloud.user.UserContext;
-
-@Implementation(description="Updates a project", responseObject=ProjectResponse.class, since="3.0.0")
-public class UpdateProjectCmd extends BaseAsyncCmd {
- public static final Logger s_logger = Logger.getLogger(UpdateProjectCmd.class.getName());
-
- private static final String s_name = "updateprojectresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="projects")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="id of the project to be modified")
- private Long id;
-
- @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="new Admin account for the project")
- private String accountName;
-
- @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="display text of the project")
- private String displayText;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public String getAccountName() {
- return accountName;
- }
-
- public Long getId() {
- return id;
- }
-
- public String getDisplayText() {
- return displayText;
- }
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- Project project= _projectService.getProject(id);
- //verify input parameters
- if (project == null) {
- throw new InvalidParameterValueException("Unable to find project by id " + id);
- }
-
- return _projectService.getProjectOwner(id).getId();
- }
-
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public void execute() throws ResourceAllocationException{
- UserContext.current().setEventDetails("Project id: "+ getId());
- Project project = _projectService.updateProject(getId(), getDisplayText(), getAccountName());
- if (project != null) {
- ProjectResponse response = _responseGenerator.createProjectResponse(project);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update a project");
- }
- }
-
- @Override
- public String getEventType() {
- return EventTypes.EVENT_PROJECT_UPDATE;
- }
-
- @Override
- public String getEventDescription() {
- return "Updating project: " + id;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/UpdateProjectInvitationCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/UpdateProjectInvitationCmd.java b/api/src/com/cloud/api/commands/UpdateProjectInvitationCmd.java
deleted file mode 100644
index 20cb8c1..0000000
--- a/api/src/com/cloud/api/commands/UpdateProjectInvitationCmd.java
+++ /dev/null
@@ -1,112 +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 org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseAsyncCmd;
-import com.cloud.api.BaseCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.ServerApiException;
-import com.cloud.api.response.SuccessResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
-
-@Implementation(description = "Accepts or declines project invitation", responseObject = SuccessResponse.class, since = "3.0.0")
-public class UpdateProjectInvitationCmd extends BaseAsyncCmd {
- public static final Logger s_logger = Logger.getLogger(UpdateProjectInvitationCmd.class.getName());
- private static final String s_name = "updateprojectinvitationresponse";
-
- // ///////////////////////////////////////////////////
- // ////////////// API parameters /////////////////////
- // ///////////////////////////////////////////////////
- @IdentityMapper(entityTableName = "projects")
- @Parameter(name = ApiConstants.PROJECT_ID, required = true, type = CommandType.LONG, description = "id of the project to join")
- private Long projectId;
-
- @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "account that is joining the project")
- private String accountName;
-
- @Parameter(name = ApiConstants.TOKEN, type = CommandType.STRING, description = "list invitations for specified account; this parameter has to be specified with domainId")
- private String token;
-
- @Parameter(name = ApiConstants.ACCEPT, type = CommandType.BOOLEAN, description = "if true, accept the invitation, decline if false. True by default")
- private Boolean accept;
-
- // ///////////////////////////////////////////////////
- // ///////////////// Accessors ///////////////////////
- // ///////////////////////////////////////////////////
- public Long getProjectId() {
- return projectId;
- }
-
- public String getAccountName() {
- return accountName;
- }
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- public String getToken() {
- return token;
- }
-
- public Boolean getAccept() {
- if (accept == null) {
- return true;
- }
- return accept;
- }
-
- // ///////////////////////////////////////////////////
- // ///////////// API Implementation///////////////////
- // ///////////////////////////////////////////////////
- @Override
- public long getEntityOwnerId() {
- // TODO - return project entity ownerId
- return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are
-// tracked
- }
-
- @Override
- public void execute() {
- UserContext.current().setEventDetails("Project id: " + projectId + "; accountName " + accountName + "; accept " + getAccept());
- boolean result = _projectService.updateInvitation(projectId, accountName, token, getAccept());
- if (result) {
- SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to join the project");
- }
- }
-
- @Override
- public String getEventType() {
- return EventTypes.EVENT_PROJECT_INVITATION_UPDATE;
- }
-
- @Override
- public String getEventDescription() {
- return "Updating project invitation for projectId " + projectId;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/UpdateResourceCountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/UpdateResourceCountCmd.java b/api/src/com/cloud/api/commands/UpdateResourceCountCmd.java
deleted file mode 100644
index 6a71a4c..0000000
--- a/api/src/com/cloud/api/commands/UpdateResourceCountCmd.java
+++ /dev/null
@@ -1,132 +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 com.cloud.api.ApiConstants;
-import com.cloud.api.BaseCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.ServerApiException;
-import com.cloud.api.response.ListResponse;
-import com.cloud.api.response.ResourceCountResponse;
-import com.cloud.configuration.ResourceCount;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
-
-
-@Implementation(description="Recalculate and update resource count for an account or domain.", responseObject=ResourceCountResponse.class)
-public class UpdateResourceCountCmd extends BaseCmd {
- public static final Logger s_logger = Logger.getLogger(UpdateResourceCountCmd.class.getName());
-
- private static final String s_name = "updateresourcecountresponse";
-
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="Update resource count for a specified account. Must be used with the domainId parameter.")
- private String accountName;
-
- @IdentityMapper(entityTableName="domain")
- @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, required=true, description="If account parameter specified then updates resource counts for a specified account in this domain else update resource counts for all accounts & child domains in specified domain.")
- private Long domainId;
-
- @Parameter(name=ApiConstants.RESOURCE_TYPE, type=CommandType.INTEGER, description= "Type of resource to update. If specifies valid values are 0, 1, 2, 3, and 4. If not specified will update all resource counts" +
- "0 - Instance. Number of instances a user can create. " +
- "1 - IP. Number of public IP addresses a user can own. " +
- "2 - Volume. Number of disk volumes a user can create." +
- "3 - Snapshot. Number of snapshots a user can create." +
- "4 - Template. Number of templates that a user can register/create.")
- private Integer resourceType;
-
- @IdentityMapper(entityTableName="projects")
- @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="Update resource limits for project")
- private Long projectId;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public String getAccountName() {
- return accountName;
- }
-
- public Long getDomainId() {
- return domainId;
- }
-
- public Integer getResourceType() {
- return resourceType;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- Account account = UserContext.current().getCaller();
- if ((account == null) || isAdmin(account.getType())) {
- if ((domainId != null) && (accountName != null)) {
- Account userAccount = _responseGenerator.findAccountByNameDomain(accountName, domainId);
- if (userAccount != null) {
- return userAccount.getId();
- }
- }
- }
-
- if (account != null) {
- return account.getId();
- }
-
- return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
- }
-
- @Override
- public void execute(){
- List<? extends ResourceCount> result = _resourceLimitService.recalculateResourceCount(finalyzeAccountId(accountName, domainId, projectId, true), getDomainId(), getResourceType());
-
- if ((result != null) && (result.size()>0)){
- ListResponse<ResourceCountResponse> response = new ListResponse<ResourceCountResponse>();
- List<ResourceCountResponse> countResponses = new ArrayList<ResourceCountResponse>();
-
- for (ResourceCount count : result) {
- ResourceCountResponse resourceCountResponse = _responseGenerator.createResourceCountResponse(count);
- resourceCountResponse.setObjectName("resourcecount");
- countResponses.add(resourceCountResponse);
- }
-
- response.setResponses(countResponses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to recalculate resource counts");
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/UpdateResourceLimitCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/UpdateResourceLimitCmd.java b/api/src/com/cloud/api/commands/UpdateResourceLimitCmd.java
deleted file mode 100644
index 4c2801d..0000000
--- a/api/src/com/cloud/api/commands/UpdateResourceLimitCmd.java
+++ /dev/null
@@ -1,109 +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 org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.ServerApiException;
-import com.cloud.api.response.ResourceLimitResponse;
-import com.cloud.configuration.ResourceLimit;
-import com.cloud.user.UserContext;
-
-@Implementation(description="Updates resource limits for an account or domain.", responseObject=ResourceLimitResponse.class)
-public class UpdateResourceLimitCmd extends BaseCmd {
- public static final Logger s_logger = Logger.getLogger(UpdateResourceLimitCmd.class.getName());
-
- private static final String s_name = "updateresourcelimitresponse";
-
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="Update resource for a specified account. Must be used with the domainId parameter.")
- private String accountName;
-
- @IdentityMapper(entityTableName="domain")
- @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="Update resource limits for all accounts in specified domain. If used with the account parameter, updates resource limits for a specified account in specified domain.")
- private Long domainId;
-
- @IdentityMapper(entityTableName="projects")
- @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="Update resource limits for project")
- private Long projectId;
-
- @Parameter(name=ApiConstants.MAX, type=CommandType.LONG, description=" Maximum resource limit.")
- private Long max;
-
- @Parameter(name=ApiConstants.RESOURCE_TYPE, type=CommandType.INTEGER, required=true, description="Type of resource to update. Values are 0, 1, 2, 3, and 4. 0 - Instance. Number of instances a user can create. " +
- "1 - IP. Number of public IP addresses a user can own. " +
- "2 - Volume. Number of disk volumes a user can create." +
- "3 - Snapshot. Number of snapshots a user can create." +
- "4 - Template. Number of templates that a user can register/create.")
- private Integer resourceType;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getMax() {
- return max;
- }
-
- public Long getDomainId() {
- return domainId;
- }
-
- public Integer getResourceType() {
- return resourceType;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- Long accountId = finalyzeAccountId(accountName, domainId, projectId, true);
- if (accountId == null) {
- return UserContext.current().getCaller().getId();
- }
-
- return accountId;
- }
-
- @Override
- public void execute(){
- ResourceLimit result = _resourceLimitService.updateResourceLimit(finalyzeAccountId(accountName, domainId, projectId, true), getDomainId(), resourceType, max);
- if (result != null || (result == null && max != null && max.longValue() == -1L)){
- ResourceLimitResponse response = _responseGenerator.createResourceLimitResponse(result);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update resource limit");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/UpdateServiceOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/UpdateServiceOfferingCmd.java b/api/src/com/cloud/api/commands/UpdateServiceOfferingCmd.java
deleted file mode 100755
index b7c2cf6..0000000
--- a/api/src/com/cloud/api/commands/UpdateServiceOfferingCmd.java
+++ /dev/null
@@ -1,99 +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 org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.ServerApiException;
-import com.cloud.api.response.ServiceOfferingResponse;
-import com.cloud.offering.ServiceOffering;
-import com.cloud.user.Account;
-
-@Implementation(description="Updates a service offering.", responseObject=ServiceOfferingResponse.class)
-public class UpdateServiceOfferingCmd extends BaseCmd {
- public static final Logger s_logger = Logger.getLogger(UpdateServiceOfferingCmd.class.getName());
- private static final String s_name = "updateserviceofferingresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
- @IdentityMapper(entityTableName="disk_offering")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the service offering to be updated")
- private Long id;
-
- @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="the display text of the service offering to be updated")
- private String displayText;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the service offering to be updated")
- private String serviceOfferingName;
-
- @Parameter(name=ApiConstants.SORT_KEY, type=CommandType.INTEGER, description="sort key of the service offering, integer")
- private Integer sortKey;
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public String getDisplayText() {
- return displayText;
- }
-
- public Long getId() {
- return id;
- }
-
- public String getServiceOfferingName() {
- return serviceOfferingName;
- }
-
- public Integer getSortKey() {
- return sortKey;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
- }
-
- @Override
- public void execute(){
- //Note
- //Once an offering is created, we cannot update the domainId field (keeping consistent with zones logic)
- ServiceOffering result = _configService.updateServiceOffering(this);
- if (result != null){
- ServiceOfferingResponse response = _responseGenerator.createServiceOfferingResponse(result);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update service offering");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/UpdateStorageNetworkIpRangeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/UpdateStorageNetworkIpRangeCmd.java b/api/src/com/cloud/api/commands/UpdateStorageNetworkIpRangeCmd.java
deleted file mode 100755
index 7e0b05b..0000000
--- a/api/src/com/cloud/api/commands/UpdateStorageNetworkIpRangeCmd.java
+++ /dev/null
@@ -1,120 +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 org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseAsyncCmd;
-import com.cloud.api.BaseCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.ServerApiException;
-import com.cloud.api.response.StorageNetworkIpRangeResponse;
-import com.cloud.dc.StorageNetworkIpRange;
-import com.cloud.event.EventTypes;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.user.Account;
-
-@Implementation(description="Update a Storage network IP range, only allowed when no IPs in this range have been allocated.", responseObject=StorageNetworkIpRangeResponse.class, since="3.0.0")
-public class UpdateStorageNetworkIpRangeCmd extends BaseAsyncCmd {
- public static final Logger s_logger = Logger.getLogger(UpdateStorageNetworkIpRangeCmd.class);
- private static final String s_name = "updatestoragenetworkiprangeresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
- @IdentityMapper(entityTableName="dc_storage_network_ip_range")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="UUID of storage network ip range")
- private Long id;
-
- @Parameter(name=ApiConstants.START_IP, type=CommandType.STRING, description="the beginning IP address")
- private String startIp;
-
- @Parameter(name=ApiConstants.END_IP, type=CommandType.STRING, description="the ending IP address")
- private String endIp;
-
- @Parameter(name=ApiConstants.VLAN, type=CommandType.INTEGER, description="Optional. the vlan the ip range sits on")
- private Integer vlan;
-
- @Parameter(name=ApiConstants.NETMASK, type=CommandType.STRING, description="the netmask for storage network")
- private String netmask;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
- public String getEndIp() {
- return endIp;
- }
-
- public String getStartIp() {
- return startIp;
- }
-
- public Integer getVlan() {
- return vlan;
- }
-
- public String getNetmask() {
- return netmask;
- }
-
- public Long getId() {
- return id;
- }
-
- @Override
- public String getEventType() {
- return EventTypes.EVENT_STORAGE_IP_RANGE_UPDATE;
- }
-
- @Override
- public String getEventDescription() {
- return "Update storage ip range " + getId() + " [StartIp=" + getStartIp() + ", EndIp=" + getEndIp() + ", vlan=" + getVlan() + ", netmask=" + getNetmask() + ']';
- }
-
- @Override
- public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
- ResourceAllocationException {
- try {
- StorageNetworkIpRange result = _storageNetworkService.updateIpRange(this);
- StorageNetworkIpRangeResponse response = _responseGenerator.createStorageNetworkIpRangeResponse(result);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } catch (Exception e) {
- s_logger.warn("Update storage network IP range failed", e);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
- }
-
- }
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/UpdateStoragePoolCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/UpdateStoragePoolCmd.java b/api/src/com/cloud/api/commands/UpdateStoragePoolCmd.java
deleted file mode 100644
index 52b5a04..0000000
--- a/api/src/com/cloud/api/commands/UpdateStoragePoolCmd.java
+++ /dev/null
@@ -1,88 +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.List;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.ServerApiException;
-import com.cloud.api.response.StoragePoolResponse;
-import com.cloud.storage.StoragePool;
-import com.cloud.user.Account;
-
-@Implementation(description="Updates a storage pool.", responseObject=StoragePoolResponse.class, since="3.0.0")
-public class UpdateStoragePoolCmd extends BaseCmd {
- public static final Logger s_logger = Logger.getLogger(UpdateStoragePoolCmd.class.getName());
-
- private static final String s_name = "updatestoragepoolresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="storage_pool")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the Id of the storage pool")
- private Long id;
-
- @Parameter(name=ApiConstants.TAGS, type=CommandType.LIST, collectionType=CommandType.STRING, description="comma-separated list of tags for the storage pool")
- private List<String> tags;
-
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
- public List<String> getTags() {
- return tags;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
- }
-
- @Override
- public void execute(){
- StoragePool result = _storageService.updateStoragePool(this);
- if (result != null){
- StoragePoolResponse response = _responseGenerator.createStoragePoolResponse(result);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update storage pool");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/UpdateTemplateCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/UpdateTemplateCmd.java b/api/src/com/cloud/api/commands/UpdateTemplateCmd.java
deleted file mode 100755
index 47440e2..0000000
--- a/api/src/com/cloud/api/commands/UpdateTemplateCmd.java
+++ /dev/null
@@ -1,78 +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 org.apache.log4j.Logger;
-
-import com.cloud.api.BaseCmd;
-import com.cloud.api.Implementation;
-import com.cloud.api.ServerApiException;
-import com.cloud.api.response.TemplateResponse;
-import com.cloud.template.VirtualMachineTemplate;
-import com.cloud.user.Account;
-
-@Implementation(description="Updates attributes of a template.", responseObject=TemplateResponse.class)
-public class UpdateTemplateCmd extends UpdateTemplateOrIsoCmd {
- public static final Logger s_logger = Logger.getLogger(UpdateTemplateCmd.class.getName());
- private static final String s_name = "updatetemplateresponse";
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public Boolean isBootable() {
- return null;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @SuppressWarnings("unchecked")
- public TemplateResponse getResponse() {
- return null;
- }
-
- @Override
- public long getEntityOwnerId() {
- VirtualMachineTemplate template = _entityMgr.findById(VirtualMachineTemplate.class, getId());
- if (template != null) {
- return template.getAccountId();
- }
-
- return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
- }
-
- @Override
- public void execute(){
- VirtualMachineTemplate result = _mgr.updateTemplate(this);
- if (result != null) {
- TemplateResponse response = _responseGenerator.createIsoResponse(result);
- response.setObjectName("template");
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update template");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/UpdateTemplateOrIsoCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/UpdateTemplateOrIsoCmd.java b/api/src/com/cloud/api/commands/UpdateTemplateOrIsoCmd.java
deleted file mode 100755
index 89c4ee9..0000000
--- a/api/src/com/cloud/api/commands/UpdateTemplateOrIsoCmd.java
+++ /dev/null
@@ -1,95 +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 org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Parameter;
-import com.cloud.api.BaseCmd.CommandType;
-
-public abstract class UpdateTemplateOrIsoCmd extends BaseCmd {
- public static final Logger s_logger = Logger.getLogger(UpdateIsoCmd.class.getName());
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name=ApiConstants.BOOTABLE, type=CommandType.BOOLEAN, description="true if image is bootable, false otherwise")
- private Boolean bootable;
-
- @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="the display text of the image", length=4096)
- private String displayText;
-
- @IdentityMapper(entityTableName="vm_template")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the image file")
- private Long id;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the image file")
- private String templateName;
-
- @IdentityMapper(entityTableName="guest_os")
- @Parameter(name=ApiConstants.OS_TYPE_ID, type=CommandType.LONG, description="the ID of the OS type that best represents the OS of this image.")
- private Long osTypeId;
-
- @Parameter(name=ApiConstants.FORMAT, type=CommandType.STRING, description="the format for the image")
- private String format;
-
- @Parameter(name=ApiConstants.PASSWORD_ENABLED, type=CommandType.BOOLEAN, description="true if the image supports the password reset feature; default is false")
- private Boolean passwordEnabled;
-
- @Parameter(name=ApiConstants.SORT_KEY, type=CommandType.INTEGER, description="sort key of the template, integer")
- private Integer sortKey;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Boolean isBootable() {
- return bootable;
- }
-
- public String getDisplayText() {
- return displayText;
- }
-
- public Long getId() {
- return id;
- }
-
- public String getTemplateName() {
- return templateName;
- }
-
- public Long getOsTypeId() {
- return osTypeId;
- }
-
- public Boolean isPasswordEnabled() {
- return passwordEnabled;
- }
-
- public String getFormat() {
- return format;
- }
-
- public Integer getSortKey() {
- return sortKey;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/UpdateTemplateOrIsoPermissionsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/UpdateTemplateOrIsoPermissionsCmd.java b/api/src/com/cloud/api/commands/UpdateTemplateOrIsoPermissionsCmd.java
deleted file mode 100755
index 38a2e39..0000000
--- a/api/src/com/cloud/api/commands/UpdateTemplateOrIsoPermissionsCmd.java
+++ /dev/null
@@ -1,128 +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.List;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Parameter;
-import com.cloud.api.ServerApiException;
-import com.cloud.api.response.SuccessResponse;
-import com.cloud.exception.InvalidParameterValueException;
-
-public abstract class UpdateTemplateOrIsoPermissionsCmd extends BaseCmd {
- public Logger s_logger = getLogger();
- protected String s_name = getResponseName();
-
- // ///////////////////////////////////////////////////
- // ////////////// API parameters /////////////////////
- // ///////////////////////////////////////////////////
-
- @Parameter(name = ApiConstants.ACCOUNTS, type = CommandType.LIST, collectionType = CommandType.STRING, description = "a comma delimited list of accounts. If specified, \"op\" parameter has to be passed in.")
- private List<String> accountNames;
-
- @IdentityMapper(entityTableName="vm_template")
- @Parameter(name = ApiConstants.ID, type = CommandType.LONG, required = true, description = "the template ID")
- private Long id;
-
- @Parameter(name = ApiConstants.IS_FEATURED, type = CommandType.BOOLEAN, description = "true for featured template/iso, false otherwise")
- private Boolean featured;
-
- @Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, description = "true for public template/iso, false for private templates/isos")
- private Boolean isPublic;
-
- @Parameter(name = ApiConstants.IS_EXTRACTABLE, type = CommandType.BOOLEAN, description = "true if the template/iso is extractable, false other wise. Can be set only by root admin")
- private Boolean isExtractable;
-
- @Parameter(name = ApiConstants.OP, type = CommandType.STRING, description = "permission operator (add, remove, reset)")
- private String operation;
-
- @IdentityMapper(entityTableName="projects")
- @Parameter(name = ApiConstants.PROJECT_IDS, type = CommandType.LIST, collectionType = CommandType.LONG, description = "a comma delimited list of projects. If specified, \"op\" parameter has to be passed in.")
- private List<Long> projectIds;
-
- // ///////////////////////////////////////////////////
- // ///////////////// Accessors ///////////////////////
- // ///////////////////////////////////////////////////
-
- public List<String> getAccountNames() {
- if (accountNames != null && projectIds != null) {
- throw new InvalidParameterValueException("Accounts and projectIds can't be specified together");
- }
-
- return accountNames;
- }
-
- public Long getId() {
- return id;
- }
-
- public Boolean isFeatured() {
- return featured;
- }
-
- public Boolean isPublic() {
- return isPublic;
- }
-
- public Boolean isExtractable() {
- return isExtractable;
- }
-
- public String getOperation() {
- return operation;
- }
-
- public List<Long> getProjectIds() {
- if (accountNames != null && projectIds != null) {
- throw new InvalidParameterValueException("Accounts and projectIds can't be specified together");
- }
- return projectIds;
- }
-
- // ///////////////////////////////////////////////////
- // ///////////// API Implementation///////////////////
- // ///////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- protected String getResponseName() {
- return "updatetemplateorisopermissionsresponse";
- }
-
- protected Logger getLogger() {
- return Logger.getLogger(UpdateTemplateOrIsoPermissionsCmd.class.getName());
- }
-
- @Override
- public void execute(){
- boolean result = _templateService.updateTemplateOrIsoPermissions(this);
- if (result) {
- SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update template/iso permissions");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/UpdateTemplatePermissionsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/UpdateTemplatePermissionsCmd.java b/api/src/com/cloud/api/commands/UpdateTemplatePermissionsCmd.java
deleted file mode 100644
index b71ed98..0000000
--- a/api/src/com/cloud/api/commands/UpdateTemplatePermissionsCmd.java
+++ /dev/null
@@ -1,50 +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 org.apache.log4j.Logger;
-
-import com.cloud.api.Implementation;
-import com.cloud.api.response.SuccessResponse;
-import com.cloud.template.VirtualMachineTemplate;
-import com.cloud.user.Account;
-
-@Implementation(responseObject=SuccessResponse.class, description="Updates a template visibility permissions. " +
- "A public template is visible to all accounts within the same domain. " +
- "A private template is visible only to the owner of the template. " +
- "A priviledged template is a private template with account permissions added. " +
- "Only accounts specified under the template permissions are visible to them.")
-public class UpdateTemplatePermissionsCmd extends UpdateTemplateOrIsoPermissionsCmd {
- protected String getResponseName() {
- return "updatetemplatepermissionsresponse";
- }
-
- protected Logger getLogger() {
- return Logger.getLogger(UpdateTemplatePermissionsCmd.class.getName());
- }
-
- @Override
- public long getEntityOwnerId() {
- VirtualMachineTemplate template = _entityMgr.findById(VirtualMachineTemplate.class, getId());
- if (template != null) {
- return template.getAccountId();
- }
-
- return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/UpdateTrafficTypeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/UpdateTrafficTypeCmd.java b/api/src/com/cloud/api/commands/UpdateTrafficTypeCmd.java
deleted file mode 100644
index e23967a..0000000
--- a/api/src/com/cloud/api/commands/UpdateTrafficTypeCmd.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 org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseAsyncCmd;
-import com.cloud.api.BaseCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.ServerApiException;
-import com.cloud.api.response.TrafficTypeResponse;
-import com.cloud.async.AsyncJob;
-import com.cloud.event.EventTypes;
-import com.cloud.network.PhysicalNetworkTrafficType;
-import com.cloud.user.Account;
-
-@Implementation(description="Updates traffic type of a physical network", responseObject=TrafficTypeResponse.class, since="3.0.0")
-public class UpdateTrafficTypeCmd extends BaseAsyncCmd {
- public static final Logger s_logger = Logger.getLogger(UpdateTrafficTypeCmd.class.getName());
-
- private static final String s_name = "updatetraffictyperesponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="physical_network_traffic_types")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="traffic type id")
- private Long id;
-
- @Parameter(name=ApiConstants.XEN_NETWORK_LABEL, type=CommandType.STRING, description="The network name label of the physical device dedicated to this traffic on a XenServer host")
- private String xenLabel;
-
- @Parameter(name=ApiConstants.KVM_NETWORK_LABEL, type=CommandType.STRING, description="The network name label of the physical device dedicated to this traffic on a KVM host")
- private String kvmLabel;
-
- @Parameter(name=ApiConstants.VMWARE_NETWORK_LABEL, type=CommandType.STRING, description="The network name label of the physical device dedicated to this traffic on a VMware host")
- private String vmwareLabel;
-
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
- public String getXenLabel() {
- return xenLabel;
- }
-
- public String getKvmLabel() {
- return kvmLabel;
- }
-
- public String getVmwareLabel() {
- return vmwareLabel;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
- }
-
- @Override
- public void execute(){
- PhysicalNetworkTrafficType result = _networkService.updatePhysicalNetworkTrafficType(getId(), getXenLabel(), getKvmLabel(), getVmwareLabel());
- if (result != null) {
- TrafficTypeResponse response = _responseGenerator.createTrafficTypeResponse(result);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update traffic type");
- }
- }
-
- @Override
- public String getEventDescription() {
- return "Updating Traffic Type: " + getId();
- }
-
- @Override
- public String getEventType() {
- return EventTypes.EVENT_TRAFFIC_TYPE_UPDATE;
- }
-
- @Override
- public AsyncJob.Type getInstanceType() {
- return AsyncJob.Type.TrafficType;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4c9d2d8/api/src/com/cloud/api/commands/UpdateUserCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/UpdateUserCmd.java b/api/src/com/cloud/api/commands/UpdateUserCmd.java
deleted file mode 100644
index 634b5d6..0000000
--- a/api/src/com/cloud/api/commands/UpdateUserCmd.java
+++ /dev/null
@@ -1,142 +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 org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.ServerApiException;
-import com.cloud.api.response.UserResponse;
-import com.cloud.user.Account;
-import com.cloud.user.User;
-import com.cloud.user.UserAccount;
-import com.cloud.user.UserContext;
-
-@Implementation(description="Updates a user account", responseObject=UserResponse.class)
-public class UpdateUserCmd extends BaseCmd {
- public static final Logger s_logger = Logger.getLogger(UpdateUserCmd.class.getName());
-
- private static final String s_name = "updateuserresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name=ApiConstants.API_KEY, type=CommandType.STRING, description="The API key for the user. Must be specified with userSecretKey")
- private String apiKey;
-
- @Parameter(name=ApiConstants.EMAIL, type=CommandType.STRING, description="email")
- private String email;
-
- @Parameter(name=ApiConstants.FIRSTNAME, type=CommandType.STRING, description="first name")
- private String firstname;
-
- @IdentityMapper(entityTableName="user")
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="User id")
- private Long id;
-
- @Parameter(name=ApiConstants.LASTNAME, type=CommandType.STRING, description="last name")
- private String lastname;
-
- @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, description="Hashed password (default is MD5). If you wish to use any other hasing algorithm, you would need to write a custom authentication adapter")
- private String password;
-
- @Parameter(name=ApiConstants.SECRET_KEY, type=CommandType.STRING, description="The secret key for the user. Must be specified with userApiKey")
- private String secretKey;
-
- @Parameter(name=ApiConstants.TIMEZONE, type=CommandType.STRING, description="Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.")
- private String timezone;
-
- @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, description="Unique username")
- private String username;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public String getApiKey() {
- return apiKey;
- }
-
- public String getEmail() {
- return email;
- }
-
- public String getFirstname() {
- return firstname;
- }
-
- public Long getId() {
- return id;
- }
-
- public String getLastname() {
- return lastname;
- }
-
- public String getPassword() {
- return password;
- }
-
- public String getSecretKey() {
- return secretKey;
- }
-
- public String getTimezone() {
- return timezone;
- }
-
- public String getUsername() {
- return username;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- User user = _entityMgr.findById(User.class, getId());
- if (user != null) {
- return user.getAccountId();
- }
-
- return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
- }
-
- @Override
- public void execute(){
- UserContext.current().setEventDetails("UserId: "+getId());
- UserAccount user = _accountService.updateUser(this);
- if (user != null){
- UserResponse response = _responseGenerator.createUserResponse(user);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update user");
- }
- }
-}
\ No newline at end of file