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/08 04:29:52 UTC

[33/57] api: move and group all under command, org.apache.cloudstack.command.*

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/af28c069/api/src/org/apache/cloudstack/api/admin/vm/command/MigrateVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/vm/command/MigrateVMCmd.java b/api/src/org/apache/cloudstack/api/admin/vm/command/MigrateVMCmd.java
deleted file mode 100644
index 6103a86..0000000
--- a/api/src/org/apache/cloudstack/api/admin/vm/command/MigrateVMCmd.java
+++ /dev/null
@@ -1,174 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.api.admin.vm.command;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-
-import com.cloud.api.response.HostResponse;
-import com.cloud.api.response.StoragePoolResponse;
-import com.cloud.api.response.UserVmResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.ManagementServerException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.exception.VirtualMachineMigrationException;
-import com.cloud.host.Host;
-import com.cloud.storage.StoragePool;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
-import com.cloud.uservm.UserVm;
-import com.cloud.vm.VirtualMachine;
-
-@Implementation(description="Attempts Migration of a VM to a different host or Root volume of the vm to a different storage pool", responseObject=UserVmResponse.class)
-public class MigrateVMCmd extends BaseAsyncCmd {
-    public static final Logger s_logger = Logger.getLogger(MigrateVMCmd.class.getName());
-
-    private static final String s_name = "migratevirtualmachineresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    //@IdentityMapper(entityTableName="host")
-    @Parameter(name=ApiConstants.HOST_ID, type=CommandType.LONG, required=false, description="Destination Host ID to migrate VM to. Required for live migrating a VM from host to host", entityType=HostResponse.class)
-    private Long hostId;
-
-    @IdentityMapper(entityTableName="vm_instance")
-    @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, required=true, description="the ID of the virtual machine", entityType=UserVmResponse.class)
-    private Long virtualMachineId;
-
-    @IdentityMapper(entityTableName="storage_pool")
-    @Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.LONG, required=false, description="Destination storage pool ID to migrate VM volumes to. Required for migrating the root disk volume", entityType=StoragePoolResponse.class)
-    private Long storageId;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public Long getHostId() {
-        return hostId;
-    }
-
-    public Long getVirtualMachineId() {
-        return virtualMachineId;
-    }
-
-    public Long getStoragePoolId() {
-        return storageId;
-    }
-
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        UserVm userVm = _entityMgr.findById(UserVm.class, getVirtualMachineId());
-        if (userVm != null) {
-            return userVm.getAccountId();
-        }
-
-        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_VM_MIGRATE;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return  "Attempting to migrate VM Id: " + getVirtualMachineId() + " to host Id: "+ getHostId();
-    }
-
-    @Override
-    public void execute(){
-        if (getHostId() == null && getStoragePoolId() == null) {
-            throw new InvalidParameterValueException("either hostId or storageId must be specified");
-        }
-
-        if (getHostId() != null && getStoragePoolId() != null) {
-            throw new InvalidParameterValueException("only one of hostId and storageId can be specified");
-        }
-
-        UserVm userVm = _userVmService.getUserVm(getVirtualMachineId());
-        if (userVm == null) {
-            throw new InvalidParameterValueException("Unable to find the VM by id=" + getVirtualMachineId());
-        }
-
-        Host destinationHost = null;
-        if (getHostId() != null) {
-            destinationHost = _resourceService.getHost(getHostId());
-            if (destinationHost == null) {
-                throw new InvalidParameterValueException("Unable to find the host to migrate the VM, host id=" + getHostId());
-            }
-            UserContext.current().setEventDetails("VM Id: " + getVirtualMachineId() + " to host Id: "+ getHostId());
-        }
-
-        StoragePool destStoragePool = null;
-        if (getStoragePoolId() != null) {
-            destStoragePool = _storageService.getStoragePool(getStoragePoolId());
-            if (destStoragePool == null) {
-                throw new InvalidParameterValueException("Unable to find the storage pool to migrate the VM");
-            }
-            UserContext.current().setEventDetails("VM Id: " + getVirtualMachineId() + " to storage pool Id: "+ getStoragePoolId());
-        }
-
-        try{
-            VirtualMachine migratedVm = null;
-            if (getHostId() != null) {
-                migratedVm = _userVmService.migrateVirtualMachine(getVirtualMachineId(), destinationHost);
-            } else if (getStoragePoolId() != null) {
-                migratedVm = _userVmService.vmStorageMigration(getVirtualMachineId(), destStoragePool);
-            }
-            if (migratedVm != null) {
-                UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", (UserVm)migratedVm).get(0);
-                response.setResponseName(getCommandName());
-                this.setResponseObject(response);
-            } else {
-                throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to migrate vm");
-            }
-        } catch (ResourceUnavailableException ex) {
-            s_logger.warn("Exception: ", ex);
-            throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
-        } catch (ConcurrentOperationException e) {
-            s_logger.warn("Exception: ", e);
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
-        } catch (ManagementServerException e) {
-            s_logger.warn("Exception: ", e);
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
-        } catch (VirtualMachineMigrationException e) {
-            s_logger.warn("Exception: ", e);
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/af28c069/api/src/org/apache/cloudstack/api/admin/vm/command/RecoverVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/vm/command/RecoverVMCmd.java b/api/src/org/apache/cloudstack/api/admin/vm/command/RecoverVMCmd.java
deleted file mode 100644
index c10907c..0000000
--- a/api/src/org/apache/cloudstack/api/admin/vm/command/RecoverVMCmd.java
+++ /dev/null
@@ -1,85 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.api.admin.vm.command;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import com.cloud.api.response.UserVmResponse;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.user.Account;
-import com.cloud.uservm.UserVm;
-
-@Implementation(description="Recovers a virtual machine.", responseObject=UserVmResponse.class)
-public class RecoverVMCmd extends BaseCmd {
-    public static final Logger s_logger = Logger.getLogger(RecoverVMCmd.class.getName());
-
-    private static final String s_name = "recovervirtualmachineresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    //@IdentityMapper(entityTableName="vm_instance")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="The ID of the virtual machine", entityType=UserVmResponse.class)
-    private Long id;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public Long getId() {
-        return id;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        UserVm userVm = _entityMgr.findById(UserVm.class, getId());
-        if (userVm != null) {
-            return userVm.getAccountId();
-        }
-
-        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
-    }
-
-    @Override
-    public void execute() throws ResourceAllocationException{
-        UserVm result = _userVmService.recoverVirtualMachine(this);
-        if (result != null){
-            UserVmResponse recoverVmResponse = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0);
-            recoverVmResponse.setResponseName(getCommandName());
-            this.setResponseObject(recoverVmResponse);
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to recover vm");
-        }
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/af28c069/api/src/org/apache/cloudstack/api/admin/vpc/command/CreatePrivateGatewayCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/vpc/command/CreatePrivateGatewayCmd.java b/api/src/org/apache/cloudstack/api/admin/vpc/command/CreatePrivateGatewayCmd.java
deleted file mode 100644
index 8abb0be..0000000
--- a/api/src/org/apache/cloudstack/api/admin/vpc/command/CreatePrivateGatewayCmd.java
+++ /dev/null
@@ -1,182 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.api.admin.vpc.command;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseAsyncCreateCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import com.cloud.api.response.PrivateGatewayResponse;
-import com.cloud.async.AsyncJob;
-import com.cloud.event.EventTypes;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.vpc.PrivateGateway;
-import com.cloud.network.vpc.Vpc;
-import com.cloud.user.Account;
-
-@Implementation(description="Creates a private gateway", responseObject=PrivateGatewayResponse.class)
-public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd {
-    public static final Logger s_logger = Logger.getLogger(CreatePrivateGatewayCmd.class.getName());
-
-    private static final String s_name = "createprivategatewayresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @IdentityMapper(entityTableName="physical_network")
-    @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, description="the Physical Network ID the network belongs to")
-    private Long physicalNetworkId;
-
-    @Parameter(name=ApiConstants.GATEWAY, type=CommandType.STRING, required=true, description="the gateway of the Private gateway")
-    private String gateway;
-
-    @Parameter(name=ApiConstants.NETMASK, type=CommandType.STRING, required=true, description="the netmask of the Private gateway")
-    private String netmask;
-
-    @Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, required=true, description="the IP address of the Private gateaway")
-    private String ipAddress;
-
-    @Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, required=true, description="the Vlan for the private gateway")
-    private String vlan;
-
-    @IdentityMapper(entityTableName="vpc")
-    @Parameter(name=ApiConstants.VPC_ID, type=CommandType.LONG, required=true, description="the VPC network belongs to")
-    private Long vpcId;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public String getGateway() {
-        return gateway;
-    }
-
-    public String getVlan() {
-        return vlan;
-    }
-
-    public String getNetmask() {
-        return netmask;
-    }
-
-    public String getStartIp() {
-        return ipAddress;
-    }
-
-    public Long getPhysicalNetworkId() {
-        return physicalNetworkId;
-    }
-
-    public Long getVpcId() {
-        return vpcId;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-
-    @Override
-    public void create() throws ResourceAllocationException {
-        PrivateGateway result = null;
-        try {
-            result = _vpcService.createVpcPrivateGateway(getVpcId(), getPhysicalNetworkId(),
-                    getVlan(), getStartIp(), getGateway(), getNetmask(), getEntityOwnerId());
-        } catch (InsufficientCapacityException ex){
-            s_logger.info(ex);
-            s_logger.trace(ex);
-            throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
-        } catch (ConcurrentOperationException ex) {
-            s_logger.warn("Exception: ", ex);
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
-        }
-
-        if (result != null) {
-            this.setEntityId(result.getId());
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create private gateway");
-        }
-    }
-
-    @Override
-    public void execute() throws InsufficientCapacityException, ConcurrentOperationException,
-    ResourceAllocationException, ResourceUnavailableException {
-        PrivateGateway result = _vpcService.applyVpcPrivateGateway(getEntityId(), true);
-        if (result != null) {
-            PrivateGatewayResponse response = _responseGenerator.createPrivateGatewayResponse(result);
-            response.setResponseName(getCommandName());
-            this.setResponseObject(response);
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create private gateway");
-        }
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        return Account.ACCOUNT_ID_SYSTEM;
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_PRIVATE_GATEWAY_CREATE;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return  "creating private gateway";
-    }
-
-    @Override
-    public String getEntityTable() {
-        return "vpc_gateways";
-    }
-
-
-    @Override
-    public String getSyncObjType() {
-        return BaseAsyncCmd.vpcSyncObject;
-    }
-
-    @Override
-    public Long getSyncObjId() {
-        Vpc vpc =  _vpcService.getVpc(vpcId);
-        if (vpc == null) {
-            throw new InvalidParameterValueException("Invalid id is specified for the vpc");
-        }
-        return vpc.getId();
-    }
-
-    @Override
-    public AsyncJob.Type getInstanceType() {
-        return AsyncJob.Type.PrivateGateway;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/af28c069/api/src/org/apache/cloudstack/api/admin/vpc/command/CreateVPCOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/vpc/command/CreateVPCOfferingCmd.java b/api/src/org/apache/cloudstack/api/admin/vpc/command/CreateVPCOfferingCmd.java
deleted file mode 100644
index 23d1d9b..0000000
--- a/api/src/org/apache/cloudstack/api/admin/vpc/command/CreateVPCOfferingCmd.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 org.apache.cloudstack.api.admin.vpc.command;
-
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCreateCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import com.cloud.api.response.VpcOfferingResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.network.vpc.VpcOffering;
-import com.cloud.user.Account;
-
-@Implementation(description="Creates VPC offering", responseObject=VpcOfferingResponse.class)
-public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd{
-    public static final Logger s_logger = Logger.getLogger(CreateVPCOfferingCmd.class.getName());
-    private static final String _name = "createvpcofferingresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="the name of the vpc offering")
-    private String vpcOfferingName;
-
-    @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, required=true, description="the display text of " +
-            "the vpc offering")
-    private String displayText;
-
-    @Parameter(name=ApiConstants.SUPPORTED_SERVICES, type=CommandType.LIST, required=true, collectionType=CommandType.STRING,
-            description="services supported by the vpc offering")
-    private List<String> supportedServices;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public String getVpcOfferingName() {
-        return vpcOfferingName;
-    }
-
-    public String getDisplayText() {
-        return displayText;
-    }
-
-    public List<String> getSupportedServices() {
-        return supportedServices;
-    }
-
-
-    @Override
-    public void create() throws ResourceAllocationException {
-        VpcOffering vpcOff = _vpcService.createVpcOffering(getVpcOfferingName(), getDisplayText(), getSupportedServices());
-        if (vpcOff != null) {
-            this.setEntityId(vpcOff.getId());
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a VPC offering");
-        }
-    }
-
-    @Override
-    public void execute() {
-        VpcOffering vpc = _vpcService.getVpcOffering(this.getEntityId());
-        if (vpc != null) {
-            VpcOfferingResponse response = _responseGenerator.createVpcOfferingResponse(vpc);
-            response.setResponseName(getCommandName());
-            this.setResponseObject(response);
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create VPC offering");
-        }
-    }
-
-    @Override
-    public String getEntityTable() {
-       return "vpc_offerings";
-    }
-
-    @Override
-    public String getEventType() {
-       return EventTypes.EVENT_VPC_OFFERING_CREATE;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return  "creating VPC offering. Id: " + getEntityId();
-    }
-
-    @Override
-    public String getCommandName() {
-        return _name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-       return Account.ACCOUNT_ID_SYSTEM;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/af28c069/api/src/org/apache/cloudstack/api/admin/vpc/command/DeletePrivateGatewayCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/vpc/command/DeletePrivateGatewayCmd.java b/api/src/org/apache/cloudstack/api/admin/vpc/command/DeletePrivateGatewayCmd.java
deleted file mode 100644
index 4128e10..0000000
--- a/api/src/org/apache/cloudstack/api/admin/vpc/command/DeletePrivateGatewayCmd.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 org.apache.cloudstack.api.admin.vpc.command;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import com.cloud.api.response.SuccessResponse;
-import com.cloud.async.AsyncJob;
-import com.cloud.event.EventTypes;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.vpc.VpcGateway;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
-
-@Implementation(description="Deletes a Private gateway", responseObject=SuccessResponse.class)
-public class DeletePrivateGatewayCmd extends BaseAsyncCmd {
-    public static final Logger s_logger = Logger.getLogger(DeletePrivateGatewayCmd.class.getName());
-    private static final String s_name = "deleteprivategatewayresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @IdentityMapper(entityTableName="vpc_gateways")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the private gateway")
-    private Long id;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public Long getId() {
-        return id;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_PRIVATE_GATEWAY_DELETE;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return  ("Deleting private gateway id=" + id);
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        return Account.ACCOUNT_ID_SYSTEM;
-    }
-
-    @Override
-    public void execute() throws ResourceUnavailableException, ConcurrentOperationException {
-        UserContext.current().setEventDetails("Network ACL Id: " + id);
-        boolean result = _vpcService.deleteVpcPrivateGateway(id);
-        if (result) {
-            SuccessResponse response = new SuccessResponse(getCommandName());
-            this.setResponseObject(response);
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete private gateway");
-        }
-    }
-
-
-    @Override
-    public String getSyncObjType() {
-        return BaseAsyncCmd.vpcSyncObject;
-    }
-
-    @Override
-    public Long getSyncObjId() {
-        VpcGateway gateway = _vpcService.getVpcPrivateGateway(getId());
-        if (gateway == null) {
-            throw new InvalidParameterValueException("Invalid private gateway id");
-        }
-        return gateway.getVpcId();
-    }
-
-    @Override
-    public AsyncJob.Type getInstanceType() {
-        return AsyncJob.Type.PrivateGateway;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/af28c069/api/src/org/apache/cloudstack/api/admin/vpc/command/DeleteVPCOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/vpc/command/DeleteVPCOfferingCmd.java b/api/src/org/apache/cloudstack/api/admin/vpc/command/DeleteVPCOfferingCmd.java
deleted file mode 100644
index b929eff..0000000
--- a/api/src/org/apache/cloudstack/api/admin/vpc/command/DeleteVPCOfferingCmd.java
+++ /dev/null
@@ -1,92 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.api.admin.vpc.command;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import com.cloud.api.response.SuccessResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.user.Account;
-
-@Implementation(description="Deletes VPC offering", responseObject=SuccessResponse.class)
-public class DeleteVPCOfferingCmd extends BaseAsyncCmd{
-    public static final Logger s_logger = Logger.getLogger(DeleteVPCOfferingCmd.class.getName());
-    private static final String s_name = "deletevpcofferingresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @IdentityMapper(entityTableName="vpc_offerings")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the VPC offering")
-    private Long id;
-
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public Long getId() {
-        return id;
-    }
-
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        return Account.ACCOUNT_ID_SYSTEM;
-    }
-
-    @Override
-    public void execute(){
-        boolean result = _vpcService.deleteVpcOffering(getId());
-        if (result) {
-            SuccessResponse response = new SuccessResponse(getCommandName());
-            this.setResponseObject(response);
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete VPC offering");
-        }
-    }
-
-    @Override
-    public String getEventType(){
-        return EventTypes.EVENT_VPC_OFFERING_DELETE;
-    }
-
-
-    @Override
-    public String getEventDescription() {
-        return "Deleting VPC offering id=" + getId();
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/af28c069/api/src/org/apache/cloudstack/api/admin/vpc/command/UpdateVPCOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/vpc/command/UpdateVPCOfferingCmd.java b/api/src/org/apache/cloudstack/api/admin/vpc/command/UpdateVPCOfferingCmd.java
deleted file mode 100644
index df40876..0000000
--- a/api/src/org/apache/cloudstack/api/admin/vpc/command/UpdateVPCOfferingCmd.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 org.apache.cloudstack.api.admin.vpc.command;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import com.cloud.api.response.VpcOfferingResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.network.vpc.VpcOffering;
-import com.cloud.user.Account;
-
-@Implementation(description="Updates VPC offering", responseObject=VpcOfferingResponse.class)
-public class UpdateVPCOfferingCmd extends BaseAsyncCmd{
-    public static final Logger s_logger = Logger.getLogger(UpdateVPCOfferingCmd.class.getName());
-    private static final String _name = "updatevpcofferingresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @IdentityMapper(entityTableName="vpc_offerings")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the id of the VPC offering")
-    private Long id;
-
-    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the VPC offering")
-    private String vpcOffName;
-
-    @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="the display text of the VPC offering")
-    private String displayText;
-
-    @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="update state for the VPC offering; " +
-            "supported states - Enabled/Disabled")
-    private String state;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public String getVpcOfferingName() {
-        return vpcOffName;
-    }
-
-    public String getDisplayText() {
-        return displayText;
-    }
-
-    public Long getId() {
-        return id;
-    }
-
-    public String getState() {
-        return state;
-    }
-
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-    @Override
-    public String getCommandName() {
-        return _name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        return Account.ACCOUNT_ID_SYSTEM;
-    }
-
-    @Override
-    public void execute(){
-        VpcOffering result = _vpcService.updateVpcOffering(getId(), getVpcOfferingName(), getDisplayText(), getState());
-        if (result != null) {
-            VpcOfferingResponse response = _responseGenerator.createVpcOfferingResponse(result);
-            response.setResponseName(getCommandName());
-            this.setResponseObject(response);
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update VPC offering");
-        }
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_VPC_OFFERING_UPDATE;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return "Updating VPC offering id=" + getId();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/af28c069/api/src/org/apache/cloudstack/api/admin/zone/command/CreateZoneCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/zone/command/CreateZoneCmd.java b/api/src/org/apache/cloudstack/api/admin/zone/command/CreateZoneCmd.java
deleted file mode 100755
index 64dfbee..0000000
--- a/api/src/org/apache/cloudstack/api/admin/zone/command/CreateZoneCmd.java
+++ /dev/null
@@ -1,163 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.api.admin.zone.command;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-
-import com.cloud.api.response.DomainResponse;
-import com.cloud.api.response.ZoneResponse;
-import com.cloud.dc.DataCenter;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
-
-@Implementation(description="Creates a Zone.", responseObject=ZoneResponse.class)
-public class CreateZoneCmd extends BaseCmd {
-    public static final Logger s_logger = Logger.getLogger(CreateZoneCmd.class.getName());
-
-    private static final String s_name = "createzoneresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @Parameter(name=ApiConstants.DNS1, type=CommandType.STRING, required=true, description="the first DNS for the Zone")
-    private String dns1;
-
-    @Parameter(name=ApiConstants.DNS2, type=CommandType.STRING, description="the second DNS for the Zone")
-    private String dns2;
-
-    @Parameter(name=ApiConstants.GUEST_CIDR_ADDRESS, type=CommandType.STRING, description="the guest CIDR address for the Zone")
-    private String guestCidrAddress;
-
-    @Parameter(name=ApiConstants.INTERNAL_DNS1, type=CommandType.STRING, required=true, description="the first internal DNS for the Zone")
-    private String internalDns1;
-
-    @Parameter(name=ApiConstants.INTERNAL_DNS2, type=CommandType.STRING, description="the second internal DNS for the Zone")
-    private String internalDns2;
-
-    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="the name of the Zone")
-    private String zoneName;
-
-    @Parameter(name=ApiConstants.DOMAIN, type=CommandType.STRING, description="Network domain name for the networks in the zone")
-    private String domain;
-
-    //@IdentityMapper(entityTableName="domain")
-    @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the ID of the containing domain, null for public zones", entityType=DomainResponse.class)
-    private Long domainId;
-
-    @Parameter(name=ApiConstants.NETWORK_TYPE, type=CommandType.STRING, required=true, description="network type of the zone, can be Basic or Advanced")
-    private String networkType;
-
-    @Parameter(name=ApiConstants.ALLOCATION_STATE, type=CommandType.STRING, description="Allocation state of this Zone for allocation of new resources")
-    private String allocationState;
-
-    @Parameter(name=ApiConstants.SECURITY_GROUP_EANBLED, type=CommandType.BOOLEAN, description="true if network is security group enabled, false otherwise")
-    private Boolean securitygroupenabled;
-
-    @Parameter(name=ApiConstants.LOCAL_STORAGE_ENABLED, type=CommandType.BOOLEAN, description="true if local storage offering enabled, false otherwise")
-    private Boolean localStorageEnabled;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public String getDns1() {
-        return dns1;
-    }
-
-    public String getDns2() {
-        return dns2;
-    }
-
-    public String getGuestCidrAddress() {
-        return guestCidrAddress;
-    }
-
-    public String getInternalDns1() {
-        return internalDns1;
-    }
-
-    public String getInternalDns2() {
-        return internalDns2;
-    }
-
-    public String getZoneName() {
-        return zoneName;
-    }
-
-    public String getDomain() {
-        return domain;
-    }
-
-    public Long getDomainId(){
-        return domainId;
-    }
-
-    public String getNetworkType(){
-        return networkType;
-    }
-
-    public String getAllocationState() {
-        return allocationState;
-    }
-
-    public Boolean getSecuritygroupenabled() {
-        if (securitygroupenabled == null) {
-            return false;
-        }
-        return securitygroupenabled;
-    }
-
-    public Boolean getLocalStorageEnabled() {
-        if (localStorageEnabled == null) {
-            return false;
-        }
-        return localStorageEnabled;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        return Account.ACCOUNT_ID_SYSTEM;
-    }
-
-    @Override
-    public void execute(){
-        UserContext.current().setEventDetails("Zone Name: "+getZoneName());
-        DataCenter result = _configService.createZone(this);
-        if (result != null){
-            ZoneResponse response = _responseGenerator.createZoneResponse(result,false);
-            response.setResponseName(getCommandName());
-            this.setResponseObject(response);
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a zone");
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/af28c069/api/src/org/apache/cloudstack/api/admin/zone/command/DeleteZoneCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/zone/command/DeleteZoneCmd.java b/api/src/org/apache/cloudstack/api/admin/zone/command/DeleteZoneCmd.java
deleted file mode 100644
index 7577067..0000000
--- a/api/src/org/apache/cloudstack/api/admin/zone/command/DeleteZoneCmd.java
+++ /dev/null
@@ -1,81 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.api.admin.zone.command;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import com.cloud.api.response.SuccessResponse;
-import com.cloud.api.response.ZoneResponse;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
-
-@Implementation(description="Deletes a Zone.", responseObject=SuccessResponse.class)
-public class DeleteZoneCmd extends BaseCmd {
-    public static final Logger s_logger = Logger.getLogger(DeleteZoneCmd.class.getName());
-
-    private static final String s_name = "deletezoneresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    //@IdentityMapper(entityTableName="data_center")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the Zone", entityType=ZoneResponse.class)
-    private Long id;
-
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public Long getId() {
-        return id;
-    }
-
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        return Account.ACCOUNT_ID_SYSTEM;
-    }
-
-    @Override
-    public void execute(){
-        UserContext.current().setEventDetails("Zone Id: "+getId());
-        boolean result = _configService.deleteZone(this);
-        if (result) {
-            SuccessResponse response = new SuccessResponse(getCommandName());
-            this.setResponseObject(response);
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete zone");
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/af28c069/api/src/org/apache/cloudstack/api/admin/zone/command/MarkDefaultZoneForAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/zone/command/MarkDefaultZoneForAccountCmd.java b/api/src/org/apache/cloudstack/api/admin/zone/command/MarkDefaultZoneForAccountCmd.java
deleted file mode 100644
index fdb1d9c..0000000
--- a/api/src/org/apache/cloudstack/api/admin/zone/command/MarkDefaultZoneForAccountCmd.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 org.apache.cloudstack.api.admin.zone.command;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.IdentityMapper;
-import com.cloud.user.Account;
-import com.cloud.event.EventTypes;
-import com.cloud.async.AsyncJob;
-import com.cloud.api.response.AccountResponse;
-import com.cloud.api.response.DomainResponse;
-import com.cloud.api.response.ZoneResponse;
-
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.BaseCmd;
-
-@Implementation(description="Marks a default zone for this account", responseObject=AccountResponse.class, since="4.0")
-public class MarkDefaultZoneForAccountCmd extends BaseAsyncCmd {
-    public static final Logger s_logger = Logger.getLogger(MarkDefaultZoneForAccountCmd.class.getName());
-
-    private static final String s_name = "markdefaultzoneforaccountresponse";
-
-    /////////////////////////////////////////////////////
-    ////////////////API parameters //////////////////////
-    /////////////////////////////////////////////////////
-
-    //@IdentityMapper(entityTableName="account")
-    @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, required=true, description="Name of the account that is to be marked.", entityType=AccountResponse.class)
-    private String accountName;
-
-    //@IdentityMapper(entityTableName="domain")
-    @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, required=true, description="Marks the account that belongs to the specified domain.", entityType=DomainResponse.class)
-    private Long domainId;
-
-    //@IdentityMapper(entityTableName="data_center")
-    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=true, description="The Zone ID with which the account is to be marked.", entityType=ZoneResponse.class)
-    private Long defaultZoneId;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public String getAccountName() {
-        return accountName;
-    }
-
-    public Long getDomainId() {
-        return domainId;
-    }
-
-    public Long getDefaultZoneId() {
-        return defaultZoneId;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        return Account.ACCOUNT_ID_SYSTEM;
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_ACCOUNT_MARK_DEFAULT_ZONE;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return  "Marking account with the default zone: " + getDefaultZoneId();
-    }
-
-    @Override
-    public AsyncJob.Type getInstanceType() {
-        return AsyncJob.Type.Account;
-    }
-
-    @Override
-    public void execute(){
-        Account result = _configService.markDefaultZone(getAccountName(),getDomainId(), getDefaultZoneId());
-        if (result != null) {
-            AccountResponse response = _responseGenerator.createAccountResponse(result);
-            response.setResponseName(getCommandName());
-            this.setResponseObject(response);
-        }
-        else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to mark the account with the default zone");
-        }
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/af28c069/api/src/org/apache/cloudstack/api/admin/zone/command/UpdateZoneCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/zone/command/UpdateZoneCmd.java b/api/src/org/apache/cloudstack/api/admin/zone/command/UpdateZoneCmd.java
deleted file mode 100755
index f1e9f73..0000000
--- a/api/src/org/apache/cloudstack/api/admin/zone/command/UpdateZoneCmd.java
+++ /dev/null
@@ -1,174 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.api.admin.zone.command;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import com.cloud.api.response.ZoneResponse;
-import com.cloud.dc.DataCenter;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
-
-@Implementation(description="Updates a Zone.", responseObject=ZoneResponse.class)
-public class UpdateZoneCmd extends BaseCmd {
-    public static final Logger s_logger = Logger.getLogger(UpdateZoneCmd.class.getName());
-
-    private static final String s_name = "updatezoneresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @Parameter(name=ApiConstants.DNS1, type=CommandType.STRING, description="the first DNS for the Zone")
-    private String dns1;
-
-    @Parameter(name=ApiConstants.DNS2, type=CommandType.STRING, description="the second DNS for the Zone")
-    private String dns2;
-
-    @Parameter(name=ApiConstants.GUEST_CIDR_ADDRESS, type=CommandType.STRING, description="the guest CIDR address for the Zone")
-    private String guestCidrAddress;
-
-    //@IdentityMapper(entityTableName="data_center")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the Zone", entityType=ZoneResponse.class)
-    private Long id;
-
-    @Parameter(name=ApiConstants.INTERNAL_DNS1, type=CommandType.STRING, description="the first internal DNS for the Zone")
-    private String internalDns1;
-
-    @Parameter(name=ApiConstants.INTERNAL_DNS2, type=CommandType.STRING, description="the second internal DNS for the Zone")
-    private String internalDns2;
-
-    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the Zone")
-    private String zoneName;
-
-    @Parameter(name=ApiConstants.IS_PUBLIC, type=CommandType.BOOLEAN, description="updates a private zone to public if set, but not vice-versa")
-    private Boolean isPublic;
-
-    @Parameter(name=ApiConstants.ALLOCATION_STATE, type=CommandType.STRING, description="Allocation state of this cluster for allocation of new resources")
-    private String allocationState;
-
-    @Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, description="the details for the Zone")
-    private Map details;
-
-    @Parameter(name=ApiConstants.DHCP_PROVIDER, type=CommandType.STRING, description="the dhcp Provider for the Zone")
-    private String dhcpProvider;
-
-    @Parameter(name=ApiConstants.DOMAIN, type=CommandType.STRING, description="Network domain name for the networks in the zone; empty string will update domain with NULL value")
-    private String domain;
-
-    @Parameter(name=ApiConstants.DNS_SEARCH_ORDER, type=CommandType.LIST, collectionType = CommandType.STRING, description="the dns search order list")
-    private List<String> dnsSearchOrder;
-
-    @Parameter(name=ApiConstants.LOCAL_STORAGE_ENABLED, type=CommandType.BOOLEAN, description="true if local storage offering enabled, false otherwise")
-    private Boolean localStorageEnabled;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public String getDns1() {
-        return dns1;
-    }
-
-    public String getDns2() {
-        return dns2;
-    }
-
-    public String getGuestCidrAddress() {
-        return guestCidrAddress;
-    }
-
-    public Long getId() {
-        return id;
-    }
-
-    public String getInternalDns1() {
-        return internalDns1;
-    }
-
-    public String getInternalDns2() {
-        return internalDns2;
-    }
-
-    public String getZoneName() {
-        return zoneName;
-    }
-
-    public Boolean isPublic() {
-        return isPublic;
-    }
-
-    public String getAllocationState() {
-        return allocationState;
-    }
-
-    public Map getDetails() {
-        return details;
-    }
-
-    public String getDhcpProvider() {
-        return dhcpProvider;
-    }
-
-    public String getDomain() {
-        return domain;
-    }
-
-    public List<String> getDnsSearchOrder() {
-        return dnsSearchOrder;
-    }
-
-    public Boolean getLocalStorageEnabled() {
-        return localStorageEnabled;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        return Account.ACCOUNT_ID_SYSTEM;
-    }
-
-    @Override
-    public void execute(){
-        UserContext.current().setEventDetails("Zone Id: "+getId());
-        DataCenter result = _configService.editZone(this);
-        if (result != null) {
-            ZoneResponse response = _responseGenerator.createZoneResponse(result, false);
-            response.setResponseName(getCommandName());
-            this.setResponseObject(response);
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update zone; internal error.");
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/af28c069/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
new file mode 100755
index 0000000..2818725
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
@@ -0,0 +1,159 @@
+// 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.command.admin.account;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.AccountResponse;
+import com.cloud.api.response.UserResponse;
+import com.cloud.user.Account;
+import com.cloud.user.UserAccount;
+import com.cloud.user.UserContext;
+
+@Implementation(description="Creates an account", responseObject=UserResponse.class)
+public class CreateAccountCmd extends BaseCmd {
+    public static final Logger s_logger = Logger.getLogger(CreateAccountCmd.class.getName());
+
+    private static final String s_name = "createaccountresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="Creates the user under the specified account. If no account is specified, the username will be used as the account name.")
+    private String accountName;
+
+    @Parameter(name=ApiConstants.ACCOUNT_TYPE, type=CommandType.SHORT, required=true, description="Type of the account.  Specify 0 for user, 1 for root admin, and 2 for domain admin")
+    private Short accountType;
+
+    @IdentityMapper(entityTableName="domain")
+    @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="Creates the user under the specified domain.")
+    private Long domainId;
+
+    @Parameter(name=ApiConstants.EMAIL, type=CommandType.STRING, required=true, description="email")
+    private String email;
+
+    @Parameter(name=ApiConstants.FIRSTNAME, type=CommandType.STRING, required=true, description="firstname")
+    private String firstName;
+
+    @Parameter(name=ApiConstants.LASTNAME, type=CommandType.STRING, required=true, description="lastname")
+    private String lastName;
+
+    @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required=true, description="Hashed password (Default is MD5). If you wish to use any other hashing algorithm, you would need to write a custom authentication adapter See Docs section.")
+    private String password;
+
+    @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, required=true, description="Unique username.")
+    private String userName;
+
+    @Parameter(name=ApiConstants.NETWORK_DOMAIN, type=CommandType.STRING, description="Network domain for the account's networks")
+    private String networkDomain;
+
+    @Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "details for account used to store specific parameters")
+    private Map<String, String> details;
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public String getAccountName() {
+        return accountName;
+    }
+
+    public Short getAccountType() {
+        return accountType;
+    }
+
+    public Long getDomainId() {
+        return domainId;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public String getFirstName() {
+        return firstName;
+    }
+
+    public String getLastName() {
+        return lastName;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public String getTimeZone() {
+        return timeZone;
+    }
+
+    public String getUsername() {
+        return userName;
+    }
+
+    public String getNetworkDomain() {
+        return networkDomain;
+    }
+
+    public Map<String, String> getDetails() {
+        if (details == null || details.isEmpty()) {
+            return null;
+        }
+
+        Collection<String> paramsCollection = details.values();
+        Map<String, String> params = (Map<String, String>) (paramsCollection.toArray())[0];
+        return params;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public void execute(){
+        UserContext.current().setEventDetails("Account Name: "+getAccountName()+", Domain Id:"+getDomainId());
+        UserAccount userAccount = _accountService.createUserAccount(getUsername(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimeZone(), getAccountName(), getAccountType(), getDomainId(), getNetworkDomain(), getDetails());
+        if (userAccount != null) {
+            AccountResponse response = _responseGenerator.createUserAccountResponse(userAccount);
+            response.setResponseName(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a user account");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/af28c069/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
new file mode 100755
index 0000000..81e2efd
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
@@ -0,0 +1,109 @@
+// 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.command.admin.account;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.SuccessResponse;
+import com.cloud.async.AsyncJob;
+import com.cloud.event.EventTypes;
+import com.cloud.user.Account;
+import com.cloud.user.User;
+import com.cloud.user.UserContext;
+
+@Implementation(description="Deletes a account, and all users associated with this account", responseObject=SuccessResponse.class)
+public class DeleteAccountCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(DeleteAccountCmd.class.getName());
+    private static final String s_name = "deleteaccountresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+
+    @IdentityMapper(entityTableName="account")
+    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="Account id")
+    private Long id;
+
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    public static String getStaticName() {
+        return s_name;
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Account account = UserContext.current().getCaller();// Let's give the caller here for event logging.
+        if (account != null) {
+            return account.getAccountId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_ACCOUNT_DELETE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        User user = _responseGenerator.findUserById(getId());
+        return (user != null ? ("deleting User " + user.getUsername() + " (id: " + user.getId() + ") and accountId = " + user.getAccountId()) : "user delete, but this user does not exist in the system");
+    }
+
+    @Override
+    public void execute(){
+        UserContext.current().setEventDetails("Account Id: "+getId());
+        boolean result = _accountService.deleteUserAccount(getId());
+        if (result) {
+            SuccessResponse response = new SuccessResponse(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete user account and all corresponding users");
+        }
+    }
+
+    @Override
+    public AsyncJob.Type getInstanceType() {
+        return AsyncJob.Type.Account;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/af28c069/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
new file mode 100644
index 0000000..cf519df
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
@@ -0,0 +1,129 @@
+// 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.command.admin.account;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.AccountResponse;
+import com.cloud.async.AsyncJob;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+
+@Implementation(description="Disables an account", responseObject=AccountResponse.class)
+public class DisableAccountCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(DisableAccountCmd.class.getName());
+    private static final String s_name = "disableaccountresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    @IdentityMapper(entityTableName="account")
+    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="Account id")
+    private Long id;
+
+    @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="Disables specified account.")
+    private String accountName;
+
+    @IdentityMapper(entityTableName="domain")
+    @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="Disables specified account in this domain.")
+    private Long domainId;
+
+    @Parameter(name=ApiConstants.LOCK, type=CommandType.BOOLEAN, required=true, description="If true, only lock the account; else disable the account")
+    private Boolean lockRequested;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    public String getAccountName() {
+        return accountName;
+    }
+
+    public Long getDomainId() {
+        return domainId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_ACCOUNT_DISABLE;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Account account = _entityMgr.findById(Account.class, getId());
+        if (account != null) {
+            return account.getAccountId();
+        }
+
+        account = _accountService.getActiveAccountByName(getAccountName(), getDomainId());
+        if (account != null) {
+            return account.getAccountId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  "disabling account: " + getAccountName() + " in domain: " + getDomainId();
+    }
+
+    @Override
+    public void execute() throws ConcurrentOperationException, ResourceUnavailableException{
+        UserContext.current().setEventDetails("Account Name: "+getAccountName()+", Domain Id:"+getDomainId());
+        Account result = null;
+        if(lockRequested)
+            result = _accountService.lockAccount(getAccountName(), getDomainId(), getId());
+        else
+            result = _accountService.disableAccount(getAccountName(), getDomainId(), getId());
+        if (result != null){
+            AccountResponse response = _responseGenerator.createAccountResponse(result);
+            response.setResponseName(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, lockRequested == true ? "Failed to lock account" : "Failed to disable account" );
+        }
+    }
+
+    @Override
+    public AsyncJob.Type getInstanceType() {
+        return AsyncJob.Type.Account;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/af28c069/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
new file mode 100644
index 0000000..91e24b0
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
@@ -0,0 +1,100 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.account;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.AccountResponse;
+import com.cloud.user.Account;
+
+@Implementation(description="Enables an account", responseObject=AccountResponse.class)
+public class EnableAccountCmd extends BaseCmd {
+    public static final Logger s_logger = Logger.getLogger(EnableAccountCmd.class.getName());
+    private static final String s_name = "enableaccountresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    @IdentityMapper(entityTableName="account")
+    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="Account id")
+    private Long id;
+
+    @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="Enables specified account.")
+    private String accountName;
+
+    @IdentityMapper(entityTableName="domain")
+    @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="Enables specified account in this domain.")
+    private Long domainId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    public String getAccountName() {
+        return accountName;
+    }
+
+    public Long getDomainId() {
+        return domainId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Account account = _entityMgr.findById(Account.class, getId());
+        if (account != null) {
+            return account.getAccountId();
+        }
+
+        account = _accountService.getActiveAccountByName(getAccountName(), getDomainId());
+        if (account != null) {
+            return account.getAccountId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public void execute(){
+        Account result = _accountService.enableAccount(getAccountName(), getDomainId(), getId());
+        if (result != null){
+            AccountResponse response = _responseGenerator.createAccountResponse(result);
+            response.setResponseName(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to enable account");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/af28c069/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java
new file mode 100644
index 0000000..6f9bea0
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java
@@ -0,0 +1,89 @@
+// 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.command.admin.account;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import com.cloud.api.response.AccountResponse;
+import com.cloud.user.Account;
+
+@Implementation(description="Locks an account", responseObject=AccountResponse.class)
+public class LockAccountCmd extends BaseCmd {
+    public static final Logger s_logger = Logger.getLogger(LockAccountCmd.class.getName());
+
+    private static final String s_name = "lockaccountresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, required=true, description="Locks the specified account.")
+    private String accountName;
+
+    @IdentityMapper(entityTableName="domain")
+    @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, required=true, description="Locks the specified account on this domain.")
+    private Long domainId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public String getAccountName() {
+        return accountName;
+    }
+
+    public Long getDomainId() {
+        return domainId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Account account = _accountService.getActiveAccountByName(getAccountName(), getDomainId());
+        if (account != null) {
+            return account.getAccountId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public void execute(){
+//        Account result = null;
+        //result = _accountService.lockAccount(this);
+//        if (result != null){
+//            AccountResponse response = _responseGenerator.createAccountResponse(result);
+//            response.setResponseName(getCommandName());
+//            this.setResponseObject(response);
+//        } else {
+//            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to lock account");
+//        }
+    }
+}