You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2012/12/04 11:02:55 UTC

[13/55] [abbrv] git commit: api_refactor: refactor account apis

api_refactor: refactor account apis

- Fix refactored apis, fix mappings in commands*.in
- Fix comments etc.

Signed-off-by: Rohit Yadav <bh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/9a0df307
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/9a0df307
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/9a0df307

Branch: refs/heads/api_refactoring
Commit: 9a0df307667c43b56adddd98bf65c7f50b469dc1
Parents: 46353e0
Author: Rohit Yadav <bh...@apache.org>
Authored: Mon Dec 3 23:39:34 2012 -0800
Committer: Rohit Yadav <bh...@apache.org>
Committed: Mon Dec 3 23:42:13 2012 -0800

----------------------------------------------------------------------
 .../cloud/api/commands/AddAccountToProjectCmd.java |  124 --------------
 .../api/commands/DeleteAccountFromProjectCmd.java  |  108 ------------
 .../com/cloud/api/commands/DisableAccountCmd.java  |  129 ---------------
 .../com/cloud/api/commands/EnableAccountCmd.java   |  100 -----------
 .../com/cloud/api/commands/ListAccountsCmd.java    |  108 ------------
 .../cloud/api/commands/ListProjectAccountsCmd.java |   95 -----------
 api/src/com/cloud/user/AccountService.java         |    2 +-
 .../admin/account/command/DisableAccountCmd.java   |  129 +++++++++++++++
 .../admin/account/command/EnableAccountCmd.java    |  100 +++++++++++
 .../account/command/AddAccountToProjectCmd.java    |  124 ++++++++++++++
 .../command/DeleteAccountFromProjectCmd.java       |  108 ++++++++++++
 .../api/user/account/command/ListAccountsCmd.java  |  108 ++++++++++++
 .../account/command/ListProjectAccountsCmd.java    |   95 +++++++++++
 .../commands/test/AddAccountToProjectCmdTest.java  |    2 +-
 client/tomcatconf/commands.properties.in           |   12 +-
 server/src/com/cloud/user/AccountManagerImpl.java  |    2 +-
 .../com/cloud/user/MockAccountManagerImpl.java     |    2 +-
 17 files changed, 674 insertions(+), 674 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/9a0df307/api/src/com/cloud/api/commands/AddAccountToProjectCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/AddAccountToProjectCmd.java b/api/src/com/cloud/api/commands/AddAccountToProjectCmd.java
deleted file mode 100644
index 0e5fe56..0000000
--- a/api/src/com/cloud/api/commands/AddAccountToProjectCmd.java
+++ /dev/null
@@ -1,124 +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 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.exception.InvalidParameterValueException;
-import com.cloud.projects.Project;
-import com.cloud.user.UserContext;
-
-
-@Implementation(description="Adds acoount to a project", responseObject=SuccessResponse.class, since="3.0.0")
-public class AddAccountToProjectCmd extends BaseAsyncCmd {
-    public static final Logger s_logger = Logger.getLogger(AddAccountToProjectCmd.class.getName());
-
-    private static final String s_name = "addaccounttoprojectresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @IdentityMapper(entityTableName="projects")
-    @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, required=true, description="id of the project to add the account to")
-    private Long projectId;
-
-    @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="name of the account to be added to the project")
-    private String accountName;
-
-    @Parameter(name=ApiConstants.EMAIL, type=CommandType.STRING, description="email to which invitation to the project is going to be sent")
-    private String email;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-
-    public String getAccountName() {
-        return accountName;
-    }
-
-    public Long getProjectId() {
-        return projectId;
-    }
-
-
-    public String getEmail() {
-        return email;
-    }
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public void execute(){
-        if (accountName == null && email == null) {
-            throw new InvalidParameterValueException("Either accountName or email is required");
-        }
-
-        UserContext.current().setEventDetails("Project id: "+ projectId + "; accountName " + accountName);
-        boolean result = _projectService.addAccountToProject(getProjectId(), getAccountName(), getEmail());
-        if (result) {
-            SuccessResponse response = new SuccessResponse(getCommandName());
-            this.setResponseObject(response);
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add account to the project");
-        }
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        Project project= _projectService.getProject(getProjectId());
-        //verify input parameters
-        if (project == null) {
-            InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find project with specified id");
-            ex.addProxyObject(project, getProjectId(), "projectId");
-            throw ex;
-        }
-
-        return _projectService.getProjectOwner(getProjectId()).getId();
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_PROJECT_ACCOUNT_ADD;
-    }
-
-    @Override
-    public String getEventDescription() {
-        if (accountName != null) {
-            return  "Adding account " + getAccountName() + " to project: " + getProjectId();
-        } else {
-            return  "Sending invitation to email " + email + " to join project: " + getProjectId();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/9a0df307/api/src/com/cloud/api/commands/DeleteAccountFromProjectCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DeleteAccountFromProjectCmd.java b/api/src/com/cloud/api/commands/DeleteAccountFromProjectCmd.java
deleted file mode 100644
index d6e3494..0000000
--- a/api/src/com/cloud/api/commands/DeleteAccountFromProjectCmd.java
+++ /dev/null
@@ -1,108 +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.cloudstack.api.user.project.command.DeleteProjectCmd;
-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.exception.InvalidParameterValueException;
-import com.cloud.projects.Project;
-import com.cloud.user.UserContext;
-
-@Implementation(description="Deletes account from the project", responseObject=SuccessResponse.class, since="3.0.0")
-public class DeleteAccountFromProjectCmd extends BaseAsyncCmd {
-    public static final Logger s_logger = Logger.getLogger(DeleteProjectCmd.class.getName());
-
-    private static final String s_name = "deleteaccountfromprojectresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-    @IdentityMapper(entityTableName="projects")
-    @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, required=true, description="id of the project to remove the account from")
-    private Long projectId;
-
-    @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, required=true, description="name of the account to be removed from the project")
-    private String accountName;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-
-
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    public Long getProjectId() {
-        return projectId;
-    }
-
-    public String getAccountName() {
-        return accountName;
-    }
-
-    @Override
-    public void execute(){
-        UserContext.current().setEventDetails("Project id: "+ projectId + "; accountName " + accountName);
-        boolean result = _projectService.deleteAccountFromProject(projectId, accountName);
-        if (result) {
-            SuccessResponse response = new SuccessResponse(getCommandName());
-            this.setResponseObject(response);
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete account from the project");
-        }
-    }
-
-
-    @Override
-    public long getEntityOwnerId() {
-        Project project= _projectService.getProject(projectId);
-        //verify input parameters
-        if (project == null) {
-            throw new InvalidParameterValueException("Unable to find project by id " + projectId);
-        }
-
-        return _projectService.getProjectOwner(projectId).getId();
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_PROJECT_ACCOUNT_REMOVE;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return  "Removing account " + accountName + " from project: " + projectId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/9a0df307/api/src/com/cloud/api/commands/DisableAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DisableAccountCmd.java b/api/src/com/cloud/api/commands/DisableAccountCmd.java
deleted file mode 100644
index 6693786..0000000
--- a/api/src/com/cloud/api/commands/DisableAccountCmd.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 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/9a0df307/api/src/com/cloud/api/commands/EnableAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/EnableAccountCmd.java b/api/src/com/cloud/api/commands/EnableAccountCmd.java
deleted file mode 100644
index 36d9b7b..0000000
--- a/api/src/com/cloud/api/commands/EnableAccountCmd.java
+++ /dev/null
@@ -1,100 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.api.commands;
-
-import 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/9a0df307/api/src/com/cloud/api/commands/ListAccountsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListAccountsCmd.java b/api/src/com/cloud/api/commands/ListAccountsCmd.java
deleted file mode 100755
index ddf18cc..0000000
--- a/api/src/com/cloud/api/commands/ListAccountsCmd.java
+++ /dev/null
@@ -1,108 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.api.commands;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseListDomainResourcesCmd;
-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.api.response.ListResponse;
-import com.cloud.user.Account;
-import com.cloud.utils.Pair;
-
-@Implementation(description="Lists accounts and provides detailed account information for listed accounts", responseObject=AccountResponse.class)
-public class ListAccountsCmd extends BaseListDomainResourcesCmd {
-    public static final Logger s_logger = Logger.getLogger(ListAccountsCmd.class.getName());
-    private static final String s_name = "listaccountsresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @Parameter(name=ApiConstants.ACCOUNT_TYPE, type=CommandType.LONG, description="list accounts by account type. Valid account types are 1 (admin), 2 (domain-admin), and 0 (user).")
-    private Long accountType;
-
-    @IdentityMapper(entityTableName="account")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list account by account ID")
-    private Long id;
-
-    @Parameter(name=ApiConstants.IS_CLEANUP_REQUIRED, type=CommandType.BOOLEAN, description="list accounts by cleanuprequred attribute (values are true or false)")
-    private Boolean cleanupRequired;
-
-    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list account by account name")
-    private String searchName;
-
-    @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="list accounts by state. Valid states are enabled, disabled, and locked.")
-    private String state;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public Long getAccountType() {
-        return accountType;
-    }
-
-    public Long getId() {
-        return id;
-    }
-
-    public Boolean isCleanupRequired() {
-        return cleanupRequired;
-    }
-
-    public String getSearchName() {
-        return searchName;
-    }
-
-    public String getState() {
-        return state;
-    }
-
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public void execute(){
-        Pair<List<? extends Account>, Integer> accounts = _accountService.searchForAccounts(this);
-        ListResponse<AccountResponse> response = new ListResponse<AccountResponse>();
-        List<AccountResponse> accountResponses = new ArrayList<AccountResponse>();
-        for (Account account : accounts.first()) {
-            AccountResponse acctResponse = _responseGenerator.createAccountResponse(account);
-            acctResponse.setObjectName("account");
-            accountResponses.add(acctResponse);
-        }
-        response.setResponses(accountResponses, accounts.second());
-        response.setResponseName(getCommandName());
-
-        this.setResponseObject(response);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/9a0df307/api/src/com/cloud/api/commands/ListProjectAccountsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListProjectAccountsCmd.java b/api/src/com/cloud/api/commands/ListProjectAccountsCmd.java
deleted file mode 100644
index 4f8a6e3..0000000
--- a/api/src/com/cloud/api/commands/ListProjectAccountsCmd.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 java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseListCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import com.cloud.api.response.ListResponse;
-import com.cloud.api.response.ProjectAccountResponse;
-import com.cloud.api.response.ProjectResponse;
-import com.cloud.projects.ProjectAccount;
-import com.cloud.user.Account;
-import com.cloud.utils.Pair;
-
-@Implementation(description="Lists project's accounts", responseObject=ProjectResponse.class, since="3.0.0")
-public class ListProjectAccountsCmd extends BaseListCmd {
-    public static final Logger s_logger = Logger.getLogger(ListProjectAccountsCmd.class.getName());
-
-    private static final String s_name = "listprojectaccountsresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @IdentityMapper(entityTableName="projects")
-    @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, required=true, description="id of the project")
-    private Long projectId;
-
-    @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="list accounts of the project by account name")
-    private String accountName;
-
-    @Parameter(name=ApiConstants.ROLE, type=CommandType.STRING, description="list accounts of the project by role")
-    private String role;
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public String getAccountName() {
-        return accountName;
-    }
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @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
-    }
-
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public void execute(){
-        Pair<List<? extends ProjectAccount>, Integer> projectAccounts = _projectService.listProjectAccounts(projectId,
-                accountName, role, this.getStartIndex(), this.getPageSizeVal());
-        ListResponse<ProjectAccountResponse> response = new ListResponse<ProjectAccountResponse>();
-        List<ProjectAccountResponse> projectResponses = new ArrayList<ProjectAccountResponse>();
-        for (ProjectAccount projectAccount : projectAccounts.first()) {
-            ProjectAccountResponse projectAccountResponse = _responseGenerator.createProjectAccountResponse(projectAccount);
-            projectResponses.add(projectAccountResponse);
-        }
-        response.setResponses(projectResponses, projectAccounts.second());
-        response.setResponseName(getCommandName());
-
-        this.setResponseObject(response);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/9a0df307/api/src/com/cloud/user/AccountService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/user/AccountService.java b/api/src/com/cloud/user/AccountService.java
index ff4e3b7..001d498 100755
--- a/api/src/com/cloud/user/AccountService.java
+++ b/api/src/com/cloud/user/AccountService.java
@@ -22,7 +22,7 @@ import java.util.Map;
 import com.cloud.acl.ControlledEntity;
 import com.cloud.acl.SecurityChecker.AccessType;
 import com.cloud.api.commands.DeleteUserCmd;
-import com.cloud.api.commands.ListAccountsCmd;
+import org.apache.cloudstack.api.user.account.command.ListAccountsCmd;
 import com.cloud.api.commands.ListUsersCmd;
 import com.cloud.api.commands.RegisterCmd;
 import com.cloud.api.commands.UpdateAccountCmd;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/9a0df307/api/src/org/apache/cloudstack/api/admin/account/command/DisableAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/account/command/DisableAccountCmd.java b/api/src/org/apache/cloudstack/api/admin/account/command/DisableAccountCmd.java
new file mode 100644
index 0000000..e6e9fd5
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/account/command/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.admin.account.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.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/9a0df307/api/src/org/apache/cloudstack/api/admin/account/command/EnableAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/account/command/EnableAccountCmd.java b/api/src/org/apache/cloudstack/api/admin/account/command/EnableAccountCmd.java
new file mode 100644
index 0000000..ca0c952
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/account/command/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.admin.account.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.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/9a0df307/api/src/org/apache/cloudstack/api/user/account/command/AddAccountToProjectCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/account/command/AddAccountToProjectCmd.java b/api/src/org/apache/cloudstack/api/user/account/command/AddAccountToProjectCmd.java
new file mode 100644
index 0000000..56dea9e
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/account/command/AddAccountToProjectCmd.java
@@ -0,0 +1,124 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.user.account.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.exception.InvalidParameterValueException;
+import com.cloud.projects.Project;
+import com.cloud.user.UserContext;
+
+
+@Implementation(description="Adds acoount to a project", responseObject=SuccessResponse.class, since="3.0.0")
+public class AddAccountToProjectCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(AddAccountToProjectCmd.class.getName());
+
+    private static final String s_name = "addaccounttoprojectresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @IdentityMapper(entityTableName="projects")
+    @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, required=true, description="id of the project to add the account to")
+    private Long projectId;
+
+    @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="name of the account to be added to the project")
+    private String accountName;
+
+    @Parameter(name=ApiConstants.EMAIL, type=CommandType.STRING, description="email to which invitation to the project is going to be sent")
+    private String email;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+
+    public String getAccountName() {
+        return accountName;
+    }
+
+    public Long getProjectId() {
+        return projectId;
+    }
+
+
+    public String getEmail() {
+        return email;
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public void execute(){
+        if (accountName == null && email == null) {
+            throw new InvalidParameterValueException("Either accountName or email is required");
+        }
+
+        UserContext.current().setEventDetails("Project id: "+ projectId + "; accountName " + accountName);
+        boolean result = _projectService.addAccountToProject(getProjectId(), getAccountName(), getEmail());
+        if (result) {
+            SuccessResponse response = new SuccessResponse(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add account to the project");
+        }
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Project project= _projectService.getProject(getProjectId());
+        //verify input parameters
+        if (project == null) {
+            InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find project with specified id");
+            ex.addProxyObject(project, getProjectId(), "projectId");
+            throw ex;
+        }
+
+        return _projectService.getProjectOwner(getProjectId()).getId();
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_PROJECT_ACCOUNT_ADD;
+    }
+
+    @Override
+    public String getEventDescription() {
+        if (accountName != null) {
+            return  "Adding account " + getAccountName() + " to project: " + getProjectId();
+        } else {
+            return  "Sending invitation to email " + email + " to join project: " + getProjectId();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/9a0df307/api/src/org/apache/cloudstack/api/user/account/command/DeleteAccountFromProjectCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/account/command/DeleteAccountFromProjectCmd.java b/api/src/org/apache/cloudstack/api/user/account/command/DeleteAccountFromProjectCmd.java
new file mode 100644
index 0000000..d5ce0e9
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/account/command/DeleteAccountFromProjectCmd.java
@@ -0,0 +1,108 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.user.account.command;
+
+import org.apache.cloudstack.api.user.project.command.DeleteProjectCmd;
+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.exception.InvalidParameterValueException;
+import com.cloud.projects.Project;
+import com.cloud.user.UserContext;
+
+@Implementation(description="Deletes account from the project", responseObject=SuccessResponse.class, since="3.0.0")
+public class DeleteAccountFromProjectCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(DeleteProjectCmd.class.getName());
+
+    private static final String s_name = "deleteaccountfromprojectresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    @IdentityMapper(entityTableName="projects")
+    @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, required=true, description="id of the project to remove the account from")
+    private Long projectId;
+
+    @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, required=true, description="name of the account to be removed from the project")
+    private String accountName;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+
+
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getProjectId() {
+        return projectId;
+    }
+
+    public String getAccountName() {
+        return accountName;
+    }
+
+    @Override
+    public void execute(){
+        UserContext.current().setEventDetails("Project id: "+ projectId + "; accountName " + accountName);
+        boolean result = _projectService.deleteAccountFromProject(projectId, accountName);
+        if (result) {
+            SuccessResponse response = new SuccessResponse(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete account from the project");
+        }
+    }
+
+
+    @Override
+    public long getEntityOwnerId() {
+        Project project= _projectService.getProject(projectId);
+        //verify input parameters
+        if (project == null) {
+            throw new InvalidParameterValueException("Unable to find project by id " + projectId);
+        }
+
+        return _projectService.getProjectOwner(projectId).getId();
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_PROJECT_ACCOUNT_REMOVE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  "Removing account " + accountName + " from project: " + projectId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/9a0df307/api/src/org/apache/cloudstack/api/user/account/command/ListAccountsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/account/command/ListAccountsCmd.java b/api/src/org/apache/cloudstack/api/user/account/command/ListAccountsCmd.java
new file mode 100755
index 0000000..1a41285
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/account/command/ListAccountsCmd.java
@@ -0,0 +1,108 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.user.account.command;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListDomainResourcesCmd;
+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.api.response.ListResponse;
+import com.cloud.user.Account;
+import com.cloud.utils.Pair;
+
+@Implementation(description="Lists accounts and provides detailed account information for listed accounts", responseObject=AccountResponse.class)
+public class ListAccountsCmd extends BaseListDomainResourcesCmd {
+    public static final Logger s_logger = Logger.getLogger(ListAccountsCmd.class.getName());
+    private static final String s_name = "listaccountsresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name=ApiConstants.ACCOUNT_TYPE, type=CommandType.LONG, description="list accounts by account type. Valid account types are 1 (admin), 2 (domain-admin), and 0 (user).")
+    private Long accountType;
+
+    @IdentityMapper(entityTableName="account")
+    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list account by account ID")
+    private Long id;
+
+    @Parameter(name=ApiConstants.IS_CLEANUP_REQUIRED, type=CommandType.BOOLEAN, description="list accounts by cleanuprequred attribute (values are true or false)")
+    private Boolean cleanupRequired;
+
+    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list account by account name")
+    private String searchName;
+
+    @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="list accounts by state. Valid states are enabled, disabled, and locked.")
+    private String state;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getAccountType() {
+        return accountType;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public Boolean isCleanupRequired() {
+        return cleanupRequired;
+    }
+
+    public String getSearchName() {
+        return searchName;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public void execute(){
+        Pair<List<? extends Account>, Integer> accounts = _accountService.searchForAccounts(this);
+        ListResponse<AccountResponse> response = new ListResponse<AccountResponse>();
+        List<AccountResponse> accountResponses = new ArrayList<AccountResponse>();
+        for (Account account : accounts.first()) {
+            AccountResponse acctResponse = _responseGenerator.createAccountResponse(account);
+            acctResponse.setObjectName("account");
+            accountResponses.add(acctResponse);
+        }
+        response.setResponses(accountResponses, accounts.second());
+        response.setResponseName(getCommandName());
+
+        this.setResponseObject(response);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/9a0df307/api/src/org/apache/cloudstack/api/user/account/command/ListProjectAccountsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/account/command/ListProjectAccountsCmd.java b/api/src/org/apache/cloudstack/api/user/account/command/ListProjectAccountsCmd.java
new file mode 100644
index 0000000..3ad7fe6
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/account/command/ListProjectAccountsCmd.java
@@ -0,0 +1,95 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.user.account.command;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import com.cloud.api.response.ListResponse;
+import com.cloud.api.response.ProjectAccountResponse;
+import com.cloud.api.response.ProjectResponse;
+import com.cloud.projects.ProjectAccount;
+import com.cloud.user.Account;
+import com.cloud.utils.Pair;
+
+@Implementation(description="Lists project's accounts", responseObject=ProjectResponse.class, since="3.0.0")
+public class ListProjectAccountsCmd extends BaseListCmd {
+    public static final Logger s_logger = Logger.getLogger(ListProjectAccountsCmd.class.getName());
+
+    private static final String s_name = "listprojectaccountsresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @IdentityMapper(entityTableName="projects")
+    @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, required=true, description="id of the project")
+    private Long projectId;
+
+    @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="list accounts of the project by account name")
+    private String accountName;
+
+    @Parameter(name=ApiConstants.ROLE, type=CommandType.STRING, description="list accounts of the project by role")
+    private String role;
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public String getAccountName() {
+        return accountName;
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @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
+    }
+
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public void execute(){
+        Pair<List<? extends ProjectAccount>, Integer> projectAccounts = _projectService.listProjectAccounts(projectId,
+                accountName, role, this.getStartIndex(), this.getPageSizeVal());
+        ListResponse<ProjectAccountResponse> response = new ListResponse<ProjectAccountResponse>();
+        List<ProjectAccountResponse> projectResponses = new ArrayList<ProjectAccountResponse>();
+        for (ProjectAccount projectAccount : projectAccounts.first()) {
+            ProjectAccountResponse projectAccountResponse = _responseGenerator.createProjectAccountResponse(projectAccount);
+            projectResponses.add(projectAccountResponse);
+        }
+        response.setResponses(projectResponses, projectAccounts.second());
+        response.setResponseName(getCommandName());
+
+        this.setResponseObject(response);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/9a0df307/api/test/src/com/cloud/api/commands/test/AddAccountToProjectCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/src/com/cloud/api/commands/test/AddAccountToProjectCmdTest.java b/api/test/src/com/cloud/api/commands/test/AddAccountToProjectCmdTest.java
index 9b1606e..d719196 100644
--- a/api/test/src/com/cloud/api/commands/test/AddAccountToProjectCmdTest.java
+++ b/api/test/src/com/cloud/api/commands/test/AddAccountToProjectCmdTest.java
@@ -19,6 +19,7 @@ package src.com.cloud.api.commands.test;
 import junit.framework.Assert;
 import junit.framework.TestCase;
 
+import org.apache.cloudstack.api.user.account.command.AddAccountToProjectCmd;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -29,7 +30,6 @@ import com.cloud.exception.InvalidParameterValueException;
 import com.cloud.projects.Project;
 import com.cloud.projects.ProjectService;
 import com.cloud.user.Account;
-import com.cloud.api.commands.AddAccountToProjectCmd;
 
 public class AddAccountToProjectCmdTest extends TestCase {
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/9a0df307/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
index 378e471..48cca46 100755
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -22,10 +22,10 @@
 createAccount=com.cloud.api.commands.CreateAccountCmd;3
 deleteAccount=com.cloud.api.commands.DeleteAccountCmd;3
 updateAccount=com.cloud.api.commands.UpdateAccountCmd;3
-disableAccount=com.cloud.api.commands.DisableAccountCmd;7
-enableAccount=com.cloud.api.commands.EnableAccountCmd;7
+disableAccount=org.apache.cloudstack.api.admin.account.command.DisableAccountCmd;7
+enableAccount=org.apache.cloudstack.api.admin.account.command.EnableAccountCmd;7
 ###lockAccount=com.cloud.api.commands.LockAccountCmd;7
-listAccounts=com.cloud.api.commands.ListAccountsCmd;15
+listAccounts=org.apache.cloudstack.api.user.account.command.ListAccountsCmd;15
 markDefaultZoneForAccount=com.cloud.api.commands.MarkDefaultZoneForAccountCmd;1
 
 #### User commands
@@ -328,9 +328,9 @@ updateProject=org.apache.cloudstack.api.user.project.command.UpdateProjectCmd;15
 activateProject=org.apache.cloudstack.api.user.project.command.ActivateProjectCmd;15
 suspendProject=org.apache.cloudstack.api.user.project.command.SuspendProjectCmd;15
 listProjects=org.apache.cloudstack.api.user.project.command.ListProjectsCmd;15
-addAccountToProject=com.cloud.api.commands.AddAccountToProjectCmd;15
-deleteAccountFromProject=com.cloud.api.commands.DeleteAccountFromProjectCmd;15
-listProjectAccounts=com.cloud.api.commands.ListProjectAccountsCmd;15
+addAccountToProject=org.apache.cloudstack.api.user.account.command.AddAccountToProjectCmd;15
+deleteAccountFromProject=org.apache.cloudstack.api.user.account.command.DeleteAccountFromProjectCmd;15
+listProjectAccounts=org.apache.cloudstack.api.user.account.command.ListProjectAccountsCmd;15
 listProjectInvitations=org.apache.cloudstack.api.user.project.command.ListProjectInvitationsCmd;15
 updateProjectInvitation=org.apache.cloudstack.api.user.project.command.UpdateProjectInvitationCmd;15
 deleteProjectInvitation=org.apache.cloudstack.api.user.project.command.DeleteProjectInvitationCmd;15

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/9a0df307/server/src/com/cloud/user/AccountManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/user/AccountManagerImpl.java b/server/src/com/cloud/user/AccountManagerImpl.java
index f595478..5a1f840 100755
--- a/server/src/com/cloud/user/AccountManagerImpl.java
+++ b/server/src/com/cloud/user/AccountManagerImpl.java
@@ -44,7 +44,7 @@ import com.cloud.acl.SecurityChecker;
 import com.cloud.acl.SecurityChecker.AccessType;
 import com.cloud.api.ApiDBUtils;
 import com.cloud.api.commands.DeleteUserCmd;
-import com.cloud.api.commands.ListAccountsCmd;
+import org.apache.cloudstack.api.user.account.command.ListAccountsCmd;
 import com.cloud.api.commands.ListUsersCmd;
 import com.cloud.api.commands.RegisterCmd;
 import com.cloud.api.commands.UpdateAccountCmd;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/9a0df307/server/test/com/cloud/user/MockAccountManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/user/MockAccountManagerImpl.java b/server/test/com/cloud/user/MockAccountManagerImpl.java
index 08234fd..d464fc8 100644
--- a/server/test/com/cloud/user/MockAccountManagerImpl.java
+++ b/server/test/com/cloud/user/MockAccountManagerImpl.java
@@ -25,7 +25,7 @@ import javax.naming.ConfigurationException;
 import com.cloud.acl.ControlledEntity;
 import com.cloud.acl.SecurityChecker.AccessType;
 import com.cloud.api.commands.DeleteUserCmd;
-import com.cloud.api.commands.ListAccountsCmd;
+import org.apache.cloudstack.api.user.account.command.ListAccountsCmd;
 import com.cloud.api.commands.ListUsersCmd;
 import com.cloud.api.commands.RegisterCmd;
 import com.cloud.api.commands.UpdateAccountCmd;