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:57 UTC
[39/55] [abbrv] api_refactor: refactor project apis
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/vm/RunningOn.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/RunningOn.java b/api/src/com/cloud/vm/RunningOn.java
index a04e28e..cb64293 100644
--- a/api/src/com/cloud/vm/RunningOn.java
+++ b/api/src/com/cloud/vm/RunningOn.java
@@ -17,7 +17,7 @@
package com.cloud.vm;
/**
- *
+ *
*/
public interface RunningOn {
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/vm/UserVmService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/UserVmService.java b/api/src/com/cloud/vm/UserVmService.java
index adc1ac5..5a1ff5d 100755
--- a/api/src/com/cloud/vm/UserVmService.java
+++ b/api/src/com/cloud/vm/UserVmService.java
@@ -59,7 +59,7 @@ import com.cloud.utils.exception.ExecutionException;
public interface UserVmService {
/**
* Destroys one virtual machine
- *
+ *
* @param userId
* the id of the user performing the action
* @param vmId
@@ -71,7 +71,7 @@ public interface UserVmService {
/**
* Destroys one virtual machine
- *
+ *
* @param userId
* the id of the user performing the action
* @param vmId
@@ -83,7 +83,7 @@ public interface UserVmService {
/**
* Resets the password of a virtual machine.
- *
+ *
* @param cmd
* - the command specifying vmId, password
* @return the VM if reset worked successfully, null otherwise
@@ -92,7 +92,7 @@ public interface UserVmService {
/**
* Attaches the specified volume to the specified VM
- *
+ *
* @param cmd
* - the command specifying volumeId and vmId
* @return the Volume object if attach worked successfully.
@@ -101,7 +101,7 @@ public interface UserVmService {
/**
* Detaches the specified volume from the VM it is currently attached to.
- *
+ *
* @param cmd
* - the command specifying volumeId
* @return the Volume object if detach worked successfully.
@@ -119,7 +119,7 @@ public interface UserVmService {
/**
* Create a template database record in preparation for creating a private template.
- *
+ *
* @param cmd
* the command object that defines the name, display text, snapshot/volume, bits, public/private, etc.
* for the
@@ -133,7 +133,7 @@ public interface UserVmService {
/**
* Creates a private template from a snapshot of a VM
- *
+ *
* @param cmd
* - the command specifying snapshotId, name, description
* @return a template if successfully created, null otherwise
@@ -142,7 +142,7 @@ public interface UserVmService {
/**
* Creates a Basic Zone User VM in the database and returns the VM to the caller.
- *
+ *
* @param zone
* - availability zone for the virtual machine
* @param serviceOffering
@@ -189,7 +189,7 @@ public interface UserVmService {
* - an optional domainId for the virtual machine. If the account parameter is used, domainId must also
* be used
* @return UserVm object if successful.
- *
+ *
* @throws InsufficientCapacityException
* if there is insufficient capacity to deploy the VM.
* @throws ConcurrentOperationException
@@ -205,7 +205,7 @@ public interface UserVmService {
/**
* Creates a User VM in Advanced Zone (Security Group feature is enabled) in the database and returns the VM to the
* caller.
- *
+ *
* @param zone
* - availability zone for the virtual machine
* @param serviceOffering
@@ -254,7 +254,7 @@ public interface UserVmService {
* - an optional domainId for the virtual machine. If the account parameter is used, domainId must also
* be used
* @return UserVm object if successful.
- *
+ *
* @throws InsufficientCapacityException
* if there is insufficient capacity to deploy the VM.
* @throws ConcurrentOperationException
@@ -271,7 +271,7 @@ public interface UserVmService {
/**
* Creates a User VM in Advanced Zone (Security Group feature is disabled) in the database and returns the VM to the
* caller.
- *
+ *
* @param zone
* - availability zone for the virtual machine
* @param serviceOffering
@@ -318,7 +318,7 @@ public interface UserVmService {
* - an optional domainId for the virtual machine. If the account parameter is used, domainId must also
* be used
* @return UserVm object if successful.
- *
+ *
* @throws InsufficientCapacityException
* if there is insufficient capacity to deploy the VM.
* @throws ConcurrentOperationException
@@ -333,7 +333,7 @@ public interface UserVmService {
/**
* Starts the virtual machine created from createVirtualMachine.
- *
+ *
* @param cmd
* Command to deploy.
* @return UserVm object if successful.
@@ -348,7 +348,7 @@ public interface UserVmService {
/**
* Creates a vm group.
- *
+ *
* @param name
* - name of the group
* @param accountId
@@ -360,7 +360,7 @@ public interface UserVmService {
/**
* upgrade the service offering of the virtual machine
- *
+ *
* @param cmd
* - the command specifying vmId and new serviceOfferingId
* @return the vm
@@ -374,7 +374,7 @@ public interface UserVmService {
/**
* Obtains a list of virtual machines by the specified search criteria. Can search by: "userId", "name", "state",
* "dataCenterId", "podId", "hostId"
- *
+ *
* @param cmd
* the API command that wraps the search criteria
* @return List of UserVMs.
@@ -392,7 +392,7 @@ public interface UserVmService {
* Migrate the given VM to the destination host provided. The API returns the migrated VM if migration succeeds.
* Only Root
* Admin can migrate a VM.
- *
+ *
* @param destinationStorage
* TODO
* @param Long
@@ -400,7 +400,7 @@ public interface UserVmService {
* vmId of The VM to migrate
* @param Host
* destinationHost to migrate the VM
- *
+ *
* @return VirtualMachine migrated VM
* @throws ManagementServerException
* in case we get error finding the VM or host or access errors or other internal errors.
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/vm/VirtualMachine.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/VirtualMachine.java b/api/src/com/cloud/vm/VirtualMachine.java
index af6d102..64ff9cd 100755
--- a/api/src/com/cloud/vm/VirtualMachine.java
+++ b/api/src/com/cloud/vm/VirtualMachine.java
@@ -27,7 +27,7 @@ import com.cloud.utils.fsm.StateObject;
/**
* VirtualMachine describes the properties held by a virtual machine
- *
+ *
*/
public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, StateObject<VirtualMachine.State> {
@@ -245,7 +245,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, S
/**
* returns the guest OS ID
- *
+ *
* @return guestOSId
*/
public long getGuestOSId();
@@ -290,6 +290,6 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, S
HypervisorType getHypervisorType();
public Map<String, String> getDetails();
-
+
boolean canPlugNics();
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/com/cloud/vm/VirtualMachineProfile.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/VirtualMachineProfile.java b/api/src/com/cloud/vm/VirtualMachineProfile.java
index 57277db..0fab443 100644
--- a/api/src/com/cloud/vm/VirtualMachineProfile.java
+++ b/api/src/com/cloud/vm/VirtualMachineProfile.java
@@ -30,7 +30,7 @@ import com.cloud.user.Account;
* VirtualMachineProfile describes one virtual machine. This object
* on what the virtual machine profile should look like before it is
* actually started on the hypervisor.
- *
+ *
* @param <T>
* a VirtualMachine
*/
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/org/apache/cloudstack/api/user/project/command/ActivateProjectCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/project/command/ActivateProjectCmd.java b/api/src/org/apache/cloudstack/api/user/project/command/ActivateProjectCmd.java
new file mode 100644
index 0000000..b5526c6
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/project/command/ActivateProjectCmd.java
@@ -0,0 +1,100 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.user.project.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.ProjectResponse;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.projects.Project;
+import com.cloud.user.UserContext;
+
+@Implementation(description="Activates a project", responseObject=ProjectResponse.class, since="3.0.0")
+public class ActivateProjectCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(ActivateProjectCmd.class.getName());
+
+ private static final String s_name = "activaterojectresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @IdentityMapper(entityTableName="projects")
+ @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="id of the project to be modified")
+ private Long id;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+
+ @Override
+ public long getEntityOwnerId() {
+ Project project= _projectService.getProject(getId());
+ //verify input parameters
+ if (project == null) {
+ throw new InvalidParameterValueException("Unable to find project by id " + getId());
+ }
+
+ return _projectService.getProjectOwner(getId()).getId();
+ }
+
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public void execute(){
+ UserContext.current().setEventDetails("Project id: "+ getId());
+ Project project = _projectService.activateProject(getId());
+ if (project != null) {
+ ProjectResponse response = _responseGenerator.createProjectResponse(project);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to activate a project");
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_PROJECT_ACTIVATE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Activating project: " + id;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/org/apache/cloudstack/api/user/project/command/CreateProjectCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/project/command/CreateProjectCmd.java b/api/src/org/apache/cloudstack/api/user/project/command/CreateProjectCmd.java
new file mode 100644
index 0000000..e66dc74
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/project/command/CreateProjectCmd.java
@@ -0,0 +1,149 @@
+// 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.project.command;
+
+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.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.ProjectResponse;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.projects.Project;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+
+@Implementation(description = "Creates a project", responseObject = ProjectResponse.class, since = "3.0.0")
+public class CreateProjectCmd extends BaseAsyncCreateCmd {
+ public static final Logger s_logger = Logger.getLogger(CreateProjectCmd.class.getName());
+
+ private static final String s_name = "createprojectresponse";
+
+ // ///////////////////////////////////////////////////
+ // ////////////// API parameters /////////////////////
+ // ///////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "account who will be Admin for the project")
+ private String accountName;
+
+ @IdentityMapper(entityTableName = "domain")
+ @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.LONG, description = "domain ID of the account owning a project")
+ private Long domainId;
+
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "name of the project")
+ private String name;
+
+ @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, required = true, description = "display text of the project")
+ private String displayText;
+
+ // ///////////////////////////////////////////////////
+ // ///////////////// Accessors ///////////////////////
+ // ///////////////////////////////////////////////////
+
+ public String getEntityTable() {
+ return "projects";
+ }
+
+ public String getAccountName() {
+ if (accountName != null) {
+ return accountName;
+ } else {
+ return UserContext.current().getCaller().getAccountName();
+ }
+ }
+
+ public Long getDomainId() {
+ if (domainId != null) {
+ return domainId;
+ } else {
+ return UserContext.current().getCaller().getDomainId();
+ }
+
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getDisplayText() {
+ return displayText;
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ Account caller = UserContext.current().getCaller();
+
+ if ((accountName != null && domainId == null) || (domainId != null && accountName == null)) {
+ throw new InvalidParameterValueException("Account name and domain id must be specified together");
+ }
+
+ if (accountName != null) {
+ return _accountService.finalizeOwner(caller, accountName, domainId, null).getId();
+ }
+
+ return caller.getId();
+ }
+
+ // ///////////////////////////////////////////////////
+ // ///////////// API Implementation///////////////////
+ // ///////////////////////////////////////////////////
+
+ @Override
+ public void execute() {
+ Project project = _projectService.enableProject(this.getEntityId());
+ if (project != null) {
+ ProjectResponse response = _responseGenerator.createProjectResponse(project);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a project");
+ }
+ }
+
+ @Override
+ public void create() throws ResourceAllocationException {
+ UserContext.current().setEventDetails("Project Name: " + getName());
+ Project project = _projectService.createProject(getName(), getDisplayText(), getAccountName(), getDomainId());
+ if (project != null) {
+ this.setEntityId(project.getId());
+ } else {
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a project");
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_PROJECT_CREATE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "creating project";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/org/apache/cloudstack/api/user/project/command/DeleteProjectCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/project/command/DeleteProjectCmd.java b/api/src/org/apache/cloudstack/api/user/project/command/DeleteProjectCmd.java
new file mode 100644
index 0000000..ca9e334
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/project/command/DeleteProjectCmd.java
@@ -0,0 +1,99 @@
+// 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.project.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="Deletes a project", responseObject=SuccessResponse.class, since="3.0.0")
+public class DeleteProjectCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(DeleteProjectCmd.class.getName());
+
+ private static final String s_name = "deleteprojectresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @IdentityMapper(entityTableName="projects")
+ @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="id of the project to be deleted")
+ private Long id;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+
+ public Long geId() {
+ return id;
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public void execute(){
+ UserContext.current().setEventDetails("Project Id: " + id);
+ boolean result = _projectService.deleteProject(id);
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete project");
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_PROJECT_DELETE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Deleting project: " + id;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ Project project= _projectService.getProject(id);
+ //verify input parameters
+ if (project == null) {
+ throw new InvalidParameterValueException("Unable to find project by id " + id);
+ }
+
+ return _projectService.getProjectOwner(id).getId();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/org/apache/cloudstack/api/user/project/command/DeleteProjectInvitationCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/project/command/DeleteProjectInvitationCmd.java b/api/src/org/apache/cloudstack/api/user/project/command/DeleteProjectInvitationCmd.java
new file mode 100644
index 0000000..9804bd6
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/project/command/DeleteProjectInvitationCmd.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.user.project.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;
+import com.cloud.user.UserContext;
+
+@Implementation(description = "Accepts or declines project invitation", responseObject = SuccessResponse.class, since = "3.0.0")
+public class DeleteProjectInvitationCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(DeleteProjectInvitationCmd.class.getName());
+ private static final String s_name = "deleteprojectinvitationresponse";
+
+ // ///////////////////////////////////////////////////
+ // ////////////// API parameters /////////////////////
+ // ///////////////////////////////////////////////////
+ @IdentityMapper(entityTableName = "project_invitations")
+ @Parameter(name = ApiConstants.ID, required = true, type = CommandType.LONG, description = "id of the invitation")
+ private Long id;
+
+ // ///////////////////////////////////////////////////
+ // ///////////////// Accessors ///////////////////////
+ // ///////////////////////////////////////////////////
+ public Long getId() {
+ return id;
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ // ///////////////////////////////////////////////////
+ // ///////////// API Implementation///////////////////
+ // ///////////////////////////////////////////////////
+ @Override
+ public long getEntityOwnerId() {
+ // TODO - return project entity ownerId
+ return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are
+// tracked
+ }
+
+ @Override
+ public void execute() {
+ UserContext.current().setEventDetails("Project invitation id " + id);
+ boolean result = _projectService.deleteProjectInvitation(id);
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete the project invitation");
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_PROJECT_INVITATION_REMOVE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Project invitatino id " + id + " is being removed";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/org/apache/cloudstack/api/user/project/command/ListProjectInvitationsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/project/command/ListProjectInvitationsCmd.java b/api/src/org/apache/cloudstack/api/user/project/command/ListProjectInvitationsCmd.java
new file mode 100644
index 0000000..276ff8c
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/project/command/ListProjectInvitationsCmd.java
@@ -0,0 +1,101 @@
+// 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.project.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.BaseListAccountResourcesCmd;
+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.ProjectInvitationResponse;
+import com.cloud.projects.ProjectInvitation;
+import com.cloud.utils.Pair;
+
+@Implementation(description = "Lists projects and provides detailed information for listed projects", responseObject = ProjectInvitationResponse.class, since = "3.0.0")
+public class ListProjectInvitationsCmd extends BaseListAccountResourcesCmd {
+ public static final Logger s_logger = Logger.getLogger(ListProjectInvitationsCmd.class.getName());
+ private static final String s_name = "listprojectinvitationsresponse";
+
+ // ///////////////////////////////////////////////////
+ // ////////////// API parameters /////////////////////
+ // ///////////////////////////////////////////////////
+ @IdentityMapper(entityTableName = "projects")
+ @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.LONG, description = "list by project id")
+ private Long projectId;
+
+ @Parameter(name = ApiConstants.ACTIVE_ONLY, type = CommandType.BOOLEAN, description = "if true, list only active invitations - having Pending state and ones that are not timed out yet")
+ private boolean activeOnly;
+
+ @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "list invitations by state")
+ private String state;
+
+ @IdentityMapper(entityTableName = "project_invitations")
+ @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "list invitations by id")
+ private Long id;
+
+ // ///////////////////////////////////////////////////
+ // ///////////////// Accessors ///////////////////////
+ // ///////////////////////////////////////////////////
+ public Long getProjectId() {
+ return projectId;
+ }
+
+ public boolean isActiveOnly() {
+ return activeOnly;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ // ///////////////////////////////////////////////////
+ // ///////////// API Implementation///////////////////
+ // ///////////////////////////////////////////////////
+
+ @Override
+ public void execute() {
+ Pair<List<? extends ProjectInvitation>, Integer> invites = _projectService.listProjectInvitations(id, projectId,
+ this.getAccountName(), this.getDomainId(), state, activeOnly, this.getStartIndex(), this.getPageSizeVal(),
+ this.isRecursive(), this.listAll());
+ ListResponse<ProjectInvitationResponse> response = new ListResponse<ProjectInvitationResponse>();
+ List<ProjectInvitationResponse> projectInvitationResponses = new ArrayList<ProjectInvitationResponse>();
+ for (ProjectInvitation invite : invites.first()) {
+ ProjectInvitationResponse projectResponse = _responseGenerator.createProjectInvitationResponse(invite);
+ projectInvitationResponses.add(projectResponse);
+ }
+ response.setResponses(projectInvitationResponses, invites.second());
+ response.setResponseName(getCommandName());
+
+ this.setResponseObject(response);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/org/apache/cloudstack/api/user/project/command/ListProjectsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/project/command/ListProjectsCmd.java b/api/src/org/apache/cloudstack/api/user/project/command/ListProjectsCmd.java
new file mode 100644
index 0000000..d8afc64
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/project/command/ListProjectsCmd.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.project.command;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListAccountResourcesCmd;
+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.ProjectResponse;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.projects.Project;
+import com.cloud.utils.Pair;
+
+@Implementation(description="Lists projects and provides detailed information for listed projects", responseObject=ProjectResponse.class, since="3.0.0")
+public class ListProjectsCmd extends BaseListAccountResourcesCmd {
+ public static final Logger s_logger = Logger.getLogger(ListProjectsCmd.class.getName());
+ private static final String s_name = "listprojectsresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @IdentityMapper(entityTableName="projects")
+ @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list projects by project ID")
+ private Long id;
+
+ @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list projects by name")
+ private String name;
+
+ @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="list projects by display text")
+ private String displayText;
+
+ @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="list projects by state")
+ private String state;
+
+ @Parameter(name = ApiConstants.TAGS, type = CommandType.MAP, description = "List projects by tags (key/value pairs)")
+ private Map tags;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getDisplayText() {
+ return displayText;
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ public Map<String, String> getTags() {
+ Map<String, String> tagsMap = null;
+ if (tags != null && !tags.isEmpty()) {
+ tagsMap = new HashMap<String, String>();
+ Collection<?> servicesCollection = tags.values();
+ Iterator<?> iter = servicesCollection.iterator();
+ while (iter.hasNext()) {
+ HashMap<String, String> services = (HashMap<String, String>) iter.next();
+ String key = services.get("key");
+ String value = services.get("value");
+ if (value == null) {
+ throw new InvalidParameterValueException("No value is passed in for key " + key);
+ }
+ tagsMap.put(key, value);
+ }
+ }
+ return tagsMap;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public void execute(){
+ Pair<List<? extends Project>, Integer> projects = _projectService.listProjects(id, name, displayText, state,
+ this.getAccountName(), this.getDomainId(), this.getKeyword(), this.getStartIndex(), this.getPageSizeVal(),
+ this.listAll(), this.isRecursive(), getTags());
+ ListResponse<ProjectResponse> response = new ListResponse<ProjectResponse>();
+ List<ProjectResponse> projectResponses = new ArrayList<ProjectResponse>();
+ for (Project project : projects.first()) {
+ ProjectResponse projectResponse = _responseGenerator.createProjectResponse(project);
+ projectResponses.add(projectResponse);
+ }
+ response.setResponses(projectResponses, projects.second());
+ response.setResponseName(getCommandName());
+
+ this.setResponseObject(response);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/org/apache/cloudstack/api/user/project/command/SuspendProjectCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/project/command/SuspendProjectCmd.java b/api/src/org/apache/cloudstack/api/user/project/command/SuspendProjectCmd.java
new file mode 100644
index 0000000..4a60d5f
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/project/command/SuspendProjectCmd.java
@@ -0,0 +1,102 @@
+// 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.project.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.ProjectResponse;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.projects.Project;
+import com.cloud.user.UserContext;
+
+@Implementation(description="Suspends a project", responseObject=ProjectResponse.class, since="3.0.0")
+public class SuspendProjectCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(SuspendProjectCmd.class.getName());
+
+ private static final String s_name = "suspendprojectresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @IdentityMapper(entityTableName="projects")
+ @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="id of the project to be suspended")
+ private Long id;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+
+ public Long geId() {
+ return id;
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public void execute() throws ConcurrentOperationException, ResourceUnavailableException{
+ UserContext.current().setEventDetails("Project Id: " + id);
+ Project project = _projectService.suspendProject(id);
+ if (project != null) {
+ ProjectResponse response = _responseGenerator.createProjectResponse(project);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to suspend a project");
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_PROJECT_SUSPEND;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Suspending project: " + id;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ Project project= _projectService.getProject(id);
+ //verify input parameters
+ if (project == null) {
+ throw new InvalidParameterValueException("Unable to find project by id " + id);
+ }
+
+ return _projectService.getProjectOwner(id).getId();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/org/apache/cloudstack/api/user/project/command/UpdateProjectCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/project/command/UpdateProjectCmd.java b/api/src/org/apache/cloudstack/api/user/project/command/UpdateProjectCmd.java
new file mode 100644
index 0000000..f0bfbdf
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/project/command/UpdateProjectCmd.java
@@ -0,0 +1,114 @@
+// 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.project.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.ProjectResponse;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.projects.Project;
+import com.cloud.user.UserContext;
+
+@Implementation(description="Updates a project", responseObject=ProjectResponse.class, since="3.0.0")
+public class UpdateProjectCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(UpdateProjectCmd.class.getName());
+
+ private static final String s_name = "updateprojectresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @IdentityMapper(entityTableName="projects")
+ @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="id of the project to be modified")
+ private Long id;
+
+ @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="new Admin account for the project")
+ private String accountName;
+
+ @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="display text of the project")
+ private String displayText;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public String getAccountName() {
+ return accountName;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public String getDisplayText() {
+ return displayText;
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ Project project= _projectService.getProject(id);
+ //verify input parameters
+ if (project == null) {
+ throw new InvalidParameterValueException("Unable to find project by id " + id);
+ }
+
+ return _projectService.getProjectOwner(id).getId();
+ }
+
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public void execute() throws ResourceAllocationException{
+ UserContext.current().setEventDetails("Project id: "+ getId());
+ Project project = _projectService.updateProject(getId(), getDisplayText(), getAccountName());
+ if (project != null) {
+ ProjectResponse response = _responseGenerator.createProjectResponse(project);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update a project");
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_PROJECT_UPDATE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Updating project: " + id;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/org/apache/cloudstack/api/user/project/command/UpdateProjectInvitationCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/project/command/UpdateProjectInvitationCmd.java b/api/src/org/apache/cloudstack/api/user/project/command/UpdateProjectInvitationCmd.java
new file mode 100644
index 0000000..8c24b2c
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/project/command/UpdateProjectInvitationCmd.java
@@ -0,0 +1,112 @@
+// 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.project.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;
+import com.cloud.user.UserContext;
+
+@Implementation(description = "Accepts or declines project invitation", responseObject = SuccessResponse.class, since = "3.0.0")
+public class UpdateProjectInvitationCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(UpdateProjectInvitationCmd.class.getName());
+ private static final String s_name = "updateprojectinvitationresponse";
+
+ // ///////////////////////////////////////////////////
+ // ////////////// API parameters /////////////////////
+ // ///////////////////////////////////////////////////
+ @IdentityMapper(entityTableName = "projects")
+ @Parameter(name = ApiConstants.PROJECT_ID, required = true, type = CommandType.LONG, description = "id of the project to join")
+ private Long projectId;
+
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "account that is joining the project")
+ private String accountName;
+
+ @Parameter(name = ApiConstants.TOKEN, type = CommandType.STRING, description = "list invitations for specified account; this parameter has to be specified with domainId")
+ private String token;
+
+ @Parameter(name = ApiConstants.ACCEPT, type = CommandType.BOOLEAN, description = "if true, accept the invitation, decline if false. True by default")
+ private Boolean accept;
+
+ // ///////////////////////////////////////////////////
+ // ///////////////// Accessors ///////////////////////
+ // ///////////////////////////////////////////////////
+ public Long getProjectId() {
+ return projectId;
+ }
+
+ public String getAccountName() {
+ return accountName;
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ public String getToken() {
+ return token;
+ }
+
+ public Boolean getAccept() {
+ if (accept == null) {
+ return true;
+ }
+ return accept;
+ }
+
+ // ///////////////////////////////////////////////////
+ // ///////////// API Implementation///////////////////
+ // ///////////////////////////////////////////////////
+ @Override
+ public long getEntityOwnerId() {
+ // TODO - return project entity ownerId
+ return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are
+// tracked
+ }
+
+ @Override
+ public void execute() {
+ UserContext.current().setEventDetails("Project id: " + projectId + "; accountName " + accountName + "; accept " + getAccept());
+ boolean result = _projectService.updateInvitation(projectId, accountName, token, getAccept());
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to join the project");
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_PROJECT_INVITATION_UPDATE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Updating project invitation for projectId " + projectId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/org/apache/cloudstack/api/user/vm/command/ListVMsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/vm/command/ListVMsCmd.java b/api/src/org/apache/cloudstack/api/user/vm/command/ListVMsCmd.java
old mode 100755
new mode 100644
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/src/org/apache/cloudstack/api/user/vm/command/RestoreVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/vm/command/RestoreVMCmd.java b/api/src/org/apache/cloudstack/api/user/vm/command/RestoreVMCmd.java
old mode 100755
new mode 100644
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/api/test/src/com/cloud/api/commands/test/ActivateProjectCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/src/com/cloud/api/commands/test/ActivateProjectCmdTest.java b/api/test/src/com/cloud/api/commands/test/ActivateProjectCmdTest.java
index fb8bfeb..facbdcf 100644
--- a/api/test/src/com/cloud/api/commands/test/ActivateProjectCmdTest.java
+++ b/api/test/src/com/cloud/api/commands/test/ActivateProjectCmdTest.java
@@ -25,7 +25,7 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.mockito.Mockito;
-import com.cloud.api.commands.ActivateProjectCmd;
+import org.apache.cloudstack.api.user.project.command.ActivateProjectCmd;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.projects.Project;
import com.cloud.projects.ProjectService;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5e0501d1/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
index 2dd9c16..faa3166 100755
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -322,18 +322,18 @@ deleteSSHKeyPair=com.cloud.api.commands.DeleteSSHKeyPairCmd;15
listSSHKeyPairs=com.cloud.api.commands.ListSSHKeyPairsCmd;15
#### Projects commands
-createProject=com.cloud.api.commands.CreateProjectCmd;15
-deleteProject=com.cloud.api.commands.DeleteProjectCmd;15
-updateProject=com.cloud.api.commands.UpdateProjectCmd;15
-activateProject=com.cloud.api.commands.ActivateProjectCmd;15
-suspendProject=com.cloud.api.commands.SuspendProjectCmd;15
-listProjects=com.cloud.api.commands.ListProjectsCmd;15
+createProject=org.apache.cloudstack.api.user.project.command.CreateProjectCmd;15
+deleteProject=org.apache.cloudstack.api.user.project.command.DeleteProjectCmd;15
+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
-listProjectInvitations=com.cloud.api.commands.ListProjectInvitationsCmd;15
-updateProjectInvitation=com.cloud.api.commands.UpdateProjectInvitationCmd;15
-deleteProjectInvitation=com.cloud.api.commands.DeleteProjectInvitationCmd;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
####
createFirewallRule=com.cloud.api.commands.CreateFirewallRuleCmd;15