You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ke...@apache.org on 2013/02/02 00:27:31 UTC
[44/50] [abbrv] git commit: refs/heads/master - Sync master to
javelin one more time
Sync master to javelin one more time
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/7b75f0d9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/7b75f0d9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/7b75f0d9
Branch: refs/heads/master
Commit: 7b75f0d990ae11a16cf25a29ae73e631c7999b25
Parents: 7bd8bec 4f53eb1
Author: Kelven Yang <ke...@gmail.com>
Authored: Fri Feb 1 11:37:33 2013 -0800
Committer: Kelven Yang <ke...@gmail.com>
Committed: Fri Feb 1 11:37:33 2013 -0800
----------------------------------------------------------------------
api/src/com/cloud/domain/Domain.java | 4 +
api/src/com/cloud/event/EventCategory.java | 55 +
api/src/com/cloud/event/EventTypes.java | 351 ++++++-
api/src/com/cloud/network/Network.java | 62 +-
api/src/com/cloud/storage/Snapshot.java | 37 +-
api/src/com/cloud/user/Account.java | 5 +-
api/src/com/cloud/user/AccountService.java | 96 +--
api/src/com/cloud/user/DomainService.java | 13 +-
api/src/com/cloud/user/User.java | 1 +
.../org/apache/cloudstack/api/ApiConstants.java | 3 +
api/src/org/apache/cloudstack/api/BaseCmd.java | 1 +
.../apache/cloudstack/api/ResponseGenerator.java | 4 +
.../command/admin/account/CreateAccountCmd.java | 28 +-
.../command/admin/account/DeleteAccountCmd.java | 16 +-
.../command/admin/account/DisableAccountCmd.java | 22 +-
.../command/admin/account/EnableAccountCmd.java | 14 +-
.../command/admin/account/UpdateAccountCmd.java | 14 +-
.../api/command/admin/domain/CreateDomainCmd.java | 16 +-
.../api/command/admin/domain/DeleteDomainCmd.java | 13 +-
.../api/command/admin/domain/UpdateDomainCmd.java | 16 +-
.../api/command/admin/region/AddRegionCmd.java | 109 ++
.../api/command/admin/region/RemoveRegionCmd.java | 79 ++
.../api/command/admin/region/UpdateRegionCmd.java | 108 ++
.../api/command/admin/user/CreateUserCmd.java | 16 +-
.../api/command/admin/user/DeleteUserCmd.java | 14 +-
.../api/command/admin/user/DisableUserCmd.java | 16 +-
.../api/command/admin/user/EnableUserCmd.java | 14 +-
.../api/command/admin/user/UpdateUserCmd.java | 15 +-
.../api/command/user/region/ListRegionsCmd.java | 88 ++
.../cloudstack/api/response/RegionResponse.java | 62 +
.../cloudstack/api/response/SnapshotResponse.java | 13 +-
api/src/org/apache/cloudstack/region/Region.java | 35 +
.../apache/cloudstack/region/RegionService.java | 157 +++
.../org/apache/cloudstack/region/RegionSync.java | 33 +
.../cloudstack/api/command/test/RegionCmdTest.java | 104 ++
client/pom.xml | 5 +
client/tomcatconf/commands.properties.in | 6 +
client/tomcatconf/componentContext.xml.in | 1 +
client/tomcatconf/components.xml.in | 1 +
client/tomcatconf/db.properties.in | 1 +
client/tomcatconf/environment.properties.in | 2 +-
core/src/com/cloud/storage/SnapshotVO.java | 26 +-
core/src/com/cloud/user/AccountVO.java | 26 +-
core/src/com/cloud/user/UserVO.java | 20 +-
.../cloudstack/storage/snapshot/db/SnapshotVO.java | 10 +-
.../storage/snapshot/SnapshotEntityImpl.java | 11 +-
framework/events/pom.xml | 47 +
.../apache/cloudstack/framework/events/Event.java | 94 ++
.../cloudstack/framework/events/EventBus.java | 55 +
.../framework/events/EventBusException.java | 26 +
.../framework/events/EventSubscriber.java | 28 +
.../cloudstack/framework/events/EventTopic.java | 57 +
framework/pom.xml | 1 +
plugins/event-bus/rabbitmq/pom.xml | 46 +
.../cloudstack/mom/rabbitmq/RabbitMQEventBus.java | 556 +++++++++
.../cloud/network/guru/OvsGuestNetworkGuru.java | 4 +-
plugins/pom.xml | 1 +
server/pom.xml | 5 +
server/src/com/cloud/alert/AlertManagerImpl.java | 64 ++
server/src/com/cloud/api/ApiDBUtils.java | 77 +-
server/src/com/cloud/api/ApiResponseHelper.java | 107 +--
server/src/com/cloud/api/ApiServer.java | 12 +-
.../cloud/baremetal/BareMetalTemplateAdapter.java | 12 +-
.../cloud/baremetal/BareMetalVmManagerImpl.java | 28 +-
.../configuration/DefaultInterceptorLibrary.java | 8 +-
server/src/com/cloud/domain/DomainVO.java | 32 +-
server/src/com/cloud/domain/dao/DomainDaoImpl.java | 2 +-
.../src/com/cloud/event/ActionEventCallback.java | 135 ---
server/src/com/cloud/event/ActionEventUtils.java | 296 +++++
server/src/com/cloud/event/AlertGenerator.java | 93 ++
server/src/com/cloud/event/UsageEventUtils.java | 143 +++
.../src/com/cloud/network/NetworkManagerImpl.java | 140 +--
.../src/com/cloud/network/NetworkServiceImpl.java | 37 +-
.../com/cloud/network/NetworkStateListener.java | 98 ++
server/src/com/cloud/network/dao/NetworkDao.java | 4 +-
.../src/com/cloud/network/dao/NetworkDaoImpl.java | 22 +-
server/src/com/cloud/network/dao/NetworkVO.java | 1 +
.../com/cloud/network/dao/UserIpv6AddressDao.java | 16 +
.../cloud/network/dao/UserIpv6AddressDaoImpl.java | 16 +
.../network/firewall/FirewallManagerImpl.java | 16 +-
.../network/guru/ExternalGuestNetworkGuru.java | 4 +-
.../com/cloud/network/guru/GuestNetworkGuru.java | 11 +-
.../network/lb/LoadBalancingRulesManagerImpl.java | 14 +-
.../com/cloud/network/rules/RulesManagerImpl.java | 12 +-
.../network/security/SecurityGroupManagerImpl.java | 33 +-
.../network/vpn/RemoteAccessVpnManagerImpl.java | 27 +-
.../src/com/cloud/projects/ProjectManagerImpl.java | 2 +-
.../com/cloud/server/ConfigurationServerImpl.java | 14 +-
.../src/com/cloud/server/ManagementServerImpl.java | 12 +-
.../src/com/cloud/storage/StorageManagerImpl.java | 131 +--
server/src/com/cloud/storage/dao/SnapshotDao.java | 13 +-
.../src/com/cloud/storage/dao/SnapshotDaoImpl.java | 31 +-
.../storage/download/DownloadMonitorImpl.java | 48 +-
.../storage/listener/SnapshotStateListener.java | 94 ++
.../storage/listener/VolumeStateListener.java | 92 ++
.../storage/snapshot/SnapshotManagerImpl.java | 163 ++--
.../storage/snapshot/SnapshotSchedulerImpl.java | 6 +-
.../cloud/template/HyervisorTemplateAdapter.java | 16 +-
.../com/cloud/template/TemplateManagerImpl.java | 50 +-
server/src/com/cloud/user/AccountManager.java | 97 ++-
server/src/com/cloud/user/AccountManagerImpl.java | 77 +-
server/src/com/cloud/user/DomainManager.java | 25 +-
server/src/com/cloud/user/DomainManagerImpl.java | 120 ++-
server/src/com/cloud/user/dao/AccountDaoImpl.java | 1 +
.../src/com/cloud/user/dao/UserAccountDaoImpl.java | 1 +
server/src/com/cloud/user/dao/UserDaoImpl.java | 1 +
server/src/com/cloud/vm/UserVmManagerImpl.java | 106 +--
server/src/com/cloud/vm/UserVmStateListener.java | 80 ++-
.../apache/cloudstack/region/RegionAccount.java | 287 +++++
.../org/apache/cloudstack/region/RegionDomain.java | 61 +
.../apache/cloudstack/region/RegionManager.java | 216 ++++
.../cloudstack/region/RegionManagerImpl.java | 877 +++++++++++++++
.../cloudstack/region/RegionServiceImpl.java | 299 +++++
.../org/apache/cloudstack/region/RegionSyncVO.java | 93 ++
.../org/apache/cloudstack/region/RegionUser.java | 76 ++
.../src/org/apache/cloudstack/region/RegionVO.java | 93 ++
.../apache/cloudstack/region/RegionsApiUtil.java | 306 +++++
.../apache/cloudstack/region/dao/RegionDao.java | 27 +
.../cloudstack/region/dao/RegionDaoImpl.java | 48 +
.../cloudstack/region/dao/RegionSyncDao.java | 24 +
.../cloudstack/region/dao/RegionSyncDaoImpl.java | 35 +
.../test/com/cloud/async/TestAsyncJobManager.java | 12 +-
.../test/com/cloud/snapshot/SnapshotDaoTest.java | 5 +-
.../com/cloud/user/MockAccountManagerImpl.java | 48 +-
.../test/com/cloud/user/MockDomainManagerImpl.java | 34 +-
.../cloud/vpc/MockConfigurationManagerImpl.java | 3 +-
.../test/com/cloud/vpc/dao/MockNetworkDaoImpl.java | 17 +-
.../cloudstack/region/RegionManagerTest.java | 74 ++
server/test/resources/VpcApiUnitTestContext.xml | 42 +
setup/db/create-schema.sql | 24 +-
setup/db/db/schema-40to410.sql | 4 +
tools/whisker/LICENSE | 500 ++++++++-
tools/whisker/descriptor-for-packaging.xml | 18 +
utils/conf/db.properties | 1 +
utils/src/com/cloud/utils/db/GenericDao.java | 2 +
utils/src/com/cloud/utils/db/GenericDaoBase.java | 5 +
utils/src/com/cloud/utils/db/Transaction.java | 7 +
137 files changed, 7375 insertions(+), 1166 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/api/src/com/cloud/domain/Domain.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/api/src/com/cloud/network/Network.java
----------------------------------------------------------------------
diff --cc api/src/com/cloud/network/Network.java
index 27977f9,a70bf02..889b9af
--- a/api/src/com/cloud/network/Network.java
+++ b/api/src/com/cloud/network/Network.java
@@@ -16,27 -16,25 +16,38 @@@
// under the License.
package com.cloud.network;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.cloudstack.acl.ControlledEntity;
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+import com.cloud.network.Networks.BroadcastDomainType;
+import com.cloud.network.Networks.Mode;
+import com.cloud.network.Networks.TrafficType;
- import com.cloud.utils.fsm.FiniteState;
- import com.cloud.utils.fsm.StateMachine;
+ import com.cloud.network.Networks.BroadcastDomainType;
+ import com.cloud.network.Networks.Mode;
+ import com.cloud.network.Networks.TrafficType;
+ import com.cloud.utils.fsm.StateMachine2;
+ import com.cloud.utils.fsm.StateObject;
++
+ import org.apache.cloudstack.acl.ControlledEntity;
+ import org.apache.cloudstack.api.Identity;
+ import org.apache.cloudstack.api.InternalIdentity;
+
+ import java.net.URI;
+ import java.util.ArrayList;
+ import java.util.List;
/**
* owned by an account.
*/
- public interface Network extends ControlledEntity, InternalIdentity, Identity {
+ public interface Network extends ControlledEntity, StateObject<Network.State>, InternalIdentity, Identity {
- public enum GuestType {
+ public enum GuestType {
Shared,
Isolated
}
@@@ -254,8 -222,17 +235,17 @@@
s_fsm.addTransition(State.Shutdown, Event.OperationSucceeded, State.Allocated);
s_fsm.addTransition(State.Shutdown, Event.OperationFailed, State.Implemented);
}
+
+ public static StateMachine2<State, Network.Event, Network> getStateMachine() {
+ return s_fsm;
+ }
+
+ String _description;
+ private State(String description) {
+ _description = description;
+ }
}
-
+
public class IpAddresses {
private String ip4Address;
private String ip6Address;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/api/src/com/cloud/storage/Snapshot.java
----------------------------------------------------------------------
diff --cc api/src/com/cloud/storage/Snapshot.java
index 6810a67,2e2965a..3f6b8f5
--- a/api/src/com/cloud/storage/Snapshot.java
+++ b/api/src/com/cloud/storage/Snapshot.java
@@@ -16,15 -16,16 +16,16 @@@
// under the License.
package com.cloud.storage;
+import java.util.Date;
+
+ import com.cloud.hypervisor.Hypervisor.HypervisorType;
+ import com.cloud.utils.fsm.StateMachine2;
+ import com.cloud.utils.fsm.StateObject;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
- import com.cloud.hypervisor.Hypervisor.HypervisorType;
-
- public interface Snapshot extends ControlledEntity, Identity, InternalIdentity {
-import java.util.Date;
-
+ public interface Snapshot extends ControlledEntity, Identity, InternalIdentity, StateObject<Snapshot.State> {
public enum Type {
MANUAL,
RECURRING,
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/api/src/com/cloud/user/AccountService.java
----------------------------------------------------------------------
diff --cc api/src/com/cloud/user/AccountService.java
index acc298f,0c1fc77..8026891
--- a/api/src/com/cloud/user/AccountService.java
+++ b/api/src/com/cloud/user/AccountService.java
@@@ -22,15 -22,11 +22,15 @@@ import java.util.Map
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.command.admin.account.UpdateAccountCmd;
+import org.apache.cloudstack.api.command.admin.user.DeleteUserCmd;
+import org.apache.cloudstack.api.command.admin.user.RegisterCmd;
+import org.apache.cloudstack.api.command.admin.user.UpdateUserCmd;
+ import org.apache.cloudstack.api.command.admin.user.RegisterCmd;
+
import com.cloud.domain.Domain;
- import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.PermissionDeniedException;
- import com.cloud.exception.ResourceUnavailableException;
import com.cloud.utils.Pair;
public interface AccountService {
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/api/src/com/cloud/user/User.java
----------------------------------------------------------------------
diff --cc api/src/com/cloud/user/User.java
index 3742c7b,ed1e405..7d80c43
--- a/api/src/com/cloud/user/User.java
+++ b/api/src/com/cloud/user/User.java
@@@ -72,5 -72,6 +72,6 @@@ public interface User extends OwnedBy,
String getRegistrationToken();
boolean isRegistered();
-
+
+ public int getRegionId();
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/api/src/org/apache/cloudstack/api/ApiConstants.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/api/src/org/apache/cloudstack/api/BaseCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/BaseCmd.java
index ae968d6,070360e..d8e2bff
--- a/api/src/org/apache/cloudstack/api/BaseCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseCmd.java
@@@ -25,9 -25,8 +25,10 @@@ import java.util.List
import java.util.Map;
import java.util.regex.Pattern;
+import javax.inject.Inject;
+
import org.apache.cloudstack.query.QueryService;
+ import org.apache.cloudstack.region.RegionService;
import org.apache.log4j.Logger;
import com.cloud.configuration.ConfigurationService;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/api/src/org/apache/cloudstack/api/ResponseGenerator.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/ResponseGenerator.java
index f589b18,0b9eb50..b95f182
--- a/api/src/org/apache/cloudstack/api/ResponseGenerator.java
+++ b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
@@@ -312,7 -314,9 +314,9 @@@ public interface ResponseGenerator
LDAPConfigResponse createLDAPConfigResponse(String hostname, Integer port, Boolean useSSL, String queryFilter, String baseSearch, String dn);
StorageNetworkIpRangeResponse createStorageNetworkIpRangeResponse(StorageNetworkIpRange result);
-
+
+ RegionResponse createRegionResponse(Region region);
+
/**
* @param resourceTag
* @param keyValueOnly TODO
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
index 57789c9,7c2f2d1..b0f73d1
--- a/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
@@@ -77,7 -73,20 +77,20 @@@ public class CreateAccountCmd extends B
@Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "details for account used to store specific parameters")
private Map<String, String> details;
-
+
+ //@Parameter(name = ApiConstants.REGION_DETAILS, type = CommandType.MAP, description = "details for account used to store region specific parameters")
+ //private Map<String, String> regionDetails;
+
+ @Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.STRING, description="Account UUID, required for adding account from another Region")
+ private String accountUUID;
+
+ @Parameter(name=ApiConstants.USER_ID, type=CommandType.STRING, description="User UUID, required for adding account from another Region")
+ private String userUUID;
+
+ @Parameter(name=ApiConstants.REGION_ID, type=CommandType.INTEGER, description="Id of the Region creating the account")
+ private Integer regionId;
+
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
index ba41606,22cab8a..959d7ce
--- a/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
@@@ -16,16 -16,12 +16,19 @@@
// under the License.
package org.apache.cloudstack.api.command.admin.account;
-import org.apache.cloudstack.api.*;
-import org.apache.log4j.Logger;
++import javax.inject.Inject;
+
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
++import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
@@@ -45,14 -41,22 +48,24 @@@ public class DeleteAccountCmd extends B
required=true, description="Account id")
private Long id;
+ @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
+ private Boolean isPropagate;
+
++ @Inject RegionService _regionService;
++
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
+
- public Long getId() {
+ public Long getId() {
return id;
}
-
+
+ public Boolean getIsPropagate() {
+ return isPropagate;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
index e08ffbc,e78a09c..60e9fd5
--- a/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
@@@ -16,15 -16,12 +16,18 @@@
// under the License.
package org.apache.cloudstack.api.command.admin.account;
-import org.apache.cloudstack.api.*;
-import org.apache.log4j.Logger;
++import javax.inject.Inject;
+
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.DomainResponse;
++import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
@@@ -55,6 -52,9 +58,11 @@@ public class DisableAccountCmd extends
@Parameter(name=ApiConstants.LOCK, type=CommandType.BOOLEAN, required=true, description="If true, only lock the account; else disable the account")
private Boolean lockRequested;
+ @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
+ private Boolean isPropagate;
+
++ @Inject RegionService _regionService;
++
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
index efd5d59,09aafea..9a92f78
--- a/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
@@@ -16,7 -16,8 +16,9 @@@
// under the License.
package org.apache.cloudstack.api.command.admin.account;
-import org.apache.log4j.Logger;
++import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
@@@ -24,7 -26,6 +26,8 @@@ import org.apache.cloudstack.api.Parame
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.DomainResponse;
++import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
import com.cloud.user.Account;
@@@ -47,6 -48,9 +50,11 @@@ public class EnableAccountCmd extends B
description="Enables specified account in this domain.")
private Long domainId;
+ @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
+ private Boolean isPropagate;
+
++ @Inject RegionService _regionService;
++
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
index 77f53f9,5840647..6fad48b
--- a/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
@@@ -19,7 -19,8 +19,9 @@@ package org.apache.cloudstack.api.comma
import java.util.Collection;
import java.util.Map;
-import org.apache.log4j.Logger;
++import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
@@@ -27,7 -29,6 +29,8 @@@ import org.apache.cloudstack.api.Parame
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.DomainResponse;
++import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
import com.cloud.user.Account;
@@@ -60,6 -61,9 +63,11 @@@ public class UpdateAccountCmd extends B
@Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "details for account used to store specific parameters")
private Map details;
+ @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
+ private Boolean isPropagate;
+
++ @Inject RegionService _regionService;
++
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java
index 93ff299,39250fd..eae393d
--- a/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java
@@@ -16,16 -16,12 +16,19 @@@
// under the License.
package org.apache.cloudstack.api.command.admin.domain;
-import org.apache.cloudstack.api.*;
-import org.apache.cloudstack.api.response.DomainResponse;
-import org.apache.log4j.Logger;
++import javax.inject.Inject;
+
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
++import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
+
import com.cloud.domain.Domain;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
@@@ -47,7 -43,9 +50,11 @@@ public class DeleteDomainCmd extends Ba
@Parameter(name=ApiConstants.CLEANUP, type=CommandType.BOOLEAN, description="true if all domain resources (child domains, accounts) have to be cleaned up, false otherwise")
private Boolean cleanup;
+ @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
+ private Boolean propagate;
++ @Inject RegionService _regionService;
++
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java
index b5f3321,79e57a6..c217f16
--- a/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java
@@@ -16,17 -16,14 +16,21 @@@
// under the License.
package org.apache.cloudstack.api.command.admin.domain;
-import org.apache.cloudstack.api.*;
-import org.apache.log4j.Logger;
++import javax.inject.Inject;
+
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.DomainResponse;
++import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
+
import com.cloud.domain.Domain;
import com.cloud.user.Account;
+ import com.cloud.user.UserAccount;
import com.cloud.user.UserContext;
@APICommand(name = "updateDomain", description="Updates a domain with a new name", responseObject=DomainResponse.class)
@@@ -48,6 -45,9 +52,11 @@@ public class UpdateDomainCmd extends Ba
@Parameter(name=ApiConstants.NETWORK_DOMAIN, type=CommandType.STRING, description="Network domain for the domain's networks; empty string will update domainName with NULL value")
private String networkDomain;
+ @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
+ private Boolean isPropagate;
+
++ @Inject RegionService _regionService;
++
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java
index 0000000,f9663b7..2036670
mode 000000,100644..100644
--- a/api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java
@@@ -1,0 -1,104 +1,109 @@@
+ // Licensed to the Apache Software Foundation (ASF) under one
+ // or more contributor license agreements. See the NOTICE file
+ // distributed with this work for additional information
+ // regarding copyright ownership. The ASF licenses this file
+ // to you under the Apache License, Version 2.0 (the
+ // "License"); you may not use this file except in compliance
+ // with the License. You may obtain a copy of the License at
+ //
+ // http://www.apache.org/licenses/LICENSE-2.0
+ //
+ // Unless required by applicable law or agreed to in writing,
+ // software distributed under the License is distributed on an
+ // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ // KIND, either express or implied. See the License for the
+ // specific language governing permissions and limitations
+ // under the License.
+ package org.apache.cloudstack.api.command.admin.region;
+
++import javax.inject.Inject;
++
+ import org.apache.cloudstack.api.APICommand;
+ import org.apache.cloudstack.api.ApiConstants;
+ import org.apache.cloudstack.api.ApiErrorCode;
+ import org.apache.cloudstack.api.BaseCmd;
+ import org.apache.cloudstack.api.Parameter;
+ import org.apache.cloudstack.api.ServerApiException;
+ import org.apache.cloudstack.api.response.RegionResponse;
+ import org.apache.cloudstack.region.Region;
++import org.apache.cloudstack.region.RegionService;
+ import org.apache.log4j.Logger;
+
+ import com.cloud.user.Account;
+
+ @APICommand(name = "addRegion", description="Adds a Region", responseObject=RegionResponse.class)
+ public class AddRegionCmd extends BaseCmd {
+ public static final Logger s_logger = Logger.getLogger(AddRegionCmd.class.getName());
+
+ private static final String s_name = "addregionresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+ @Parameter(name=ApiConstants.ID, type=CommandType.INTEGER, required=true, description="Id of the Region")
+ private Integer id;
+
+ @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="Name of the region")
+ private String regionName;
+
+ @Parameter(name=ApiConstants.END_POINT, type=CommandType.STRING, required=true, description="Region service endpoint")
+ private String endPoint;
+
+ @Parameter(name=ApiConstants.API_KEY, type=CommandType.STRING, description="API key of Admin user")
+ private String apiKey;
+
+ @Parameter(name=ApiConstants.SECRET_KEY, type=CommandType.STRING, description="Secret Key of Admin user")
+ private String secretKey;
+
++ @Inject public RegionService _regionService;
++
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Integer getId() {
+ return id;
+ }
+
+ public String getRegionName() {
+ return regionName;
+ }
+
+ public String getEndPoint() {
+ return endPoint;
+ }
+
+ public String getApiKey() {
+ return apiKey;
+ }
+
+ public String getSecretKey() {
+ return secretKey;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ Region region = _regionService.addRegion(getId(), getRegionName(), getEndPoint(), getApiKey(), getSecretKey());
+ if (region != null) {
+ RegionResponse response = _responseGenerator.createRegionResponse(region);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Region");
+ }
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/api/src/org/apache/cloudstack/api/command/admin/region/RemoveRegionCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/region/RemoveRegionCmd.java
index 0000000,bb74c17..79c34d0
mode 000000,100644..100644
--- a/api/src/org/apache/cloudstack/api/command/admin/region/RemoveRegionCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/region/RemoveRegionCmd.java
@@@ -1,0 -1,74 +1,79 @@@
+ // Licensed to the Apache Software Foundation (ASF) under one
+ // or more contributor license agreements. See the NOTICE file
+ // distributed with this work for additional information
+ // regarding copyright ownership. The ASF licenses this file
+ // to you under the Apache License, Version 2.0 (the
+ // "License"); you may not use this file except in compliance
+ // with the License. You may obtain a copy of the License at
+ //
+ // http://www.apache.org/licenses/LICENSE-2.0
+ //
+ // Unless required by applicable law or agreed to in writing,
+ // software distributed under the License is distributed on an
+ // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ // KIND, either express or implied. See the License for the
+ // specific language governing permissions and limitations
+ // under the License.
+ package org.apache.cloudstack.api.command.admin.region;
+
++import javax.inject.Inject;
++
+ import org.apache.cloudstack.api.APICommand;
+ import org.apache.cloudstack.api.ApiConstants;
+ import org.apache.cloudstack.api.ApiErrorCode;
+ import org.apache.cloudstack.api.BaseCmd;
+ import org.apache.cloudstack.api.Parameter;
+ import org.apache.cloudstack.api.ServerApiException;
+ import org.apache.cloudstack.api.response.SuccessResponse;
++import org.apache.cloudstack.region.RegionService;
+ import org.apache.log4j.Logger;
+
+ import com.cloud.user.Account;
+
+ @APICommand(name = "removeRegion", description="Removes specified region", responseObject=SuccessResponse.class)
+ public class RemoveRegionCmd extends BaseCmd {
+ public static final Logger s_logger = Logger.getLogger(RemoveRegionCmd.class.getName());
+ private static final String s_name = "updateregionresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ID, type=CommandType.INTEGER, required=true, description="ID of the region to delete")
+ private Integer id;
+
++ @Inject RegionService _regionService;
++
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Integer getId() {
+ return id;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ boolean result = _regionService.removeRegion(id);
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove region");
+ }
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java
index 0000000,bc6576c..16693b6
mode 000000,100644..100644
--- a/api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java
@@@ -1,0 -1,103 +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.command.admin.region;
+
++import javax.inject.Inject;
++
+ import org.apache.cloudstack.api.APICommand;
+ import org.apache.cloudstack.api.ApiConstants;
+ import org.apache.cloudstack.api.ApiErrorCode;
+ import org.apache.cloudstack.api.BaseCmd;
+ import org.apache.cloudstack.api.Parameter;
+ import org.apache.cloudstack.api.ServerApiException;
+ import org.apache.cloudstack.api.response.RegionResponse;
+ import org.apache.cloudstack.region.Region;
++import org.apache.cloudstack.region.RegionService;
+ import org.apache.log4j.Logger;
+
+ import com.cloud.user.Account;
+
+ @APICommand(name = "updateRegion", description="Updates a region", responseObject=RegionResponse.class)
+ public class UpdateRegionCmd extends BaseCmd {
+ public static final Logger s_logger = Logger.getLogger(UpdateRegionCmd.class.getName());
+ private static final String s_name = "updateregionresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ID, type=CommandType.INTEGER, required=true, description="Id of region to update")
+ private Integer id;
+
+ @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="updates region with this name")
+ private String regionName;
+
+ @Parameter(name=ApiConstants.END_POINT, type=CommandType.STRING, description="updates region with this end point")
+ private String endPoint;
+
+ @Parameter(name=ApiConstants.API_KEY, type=CommandType.STRING, description="new API key for the Region")
+ private String apiKey;
+
+ @Parameter(name=ApiConstants.SECRET_KEY, type=CommandType.STRING, description="new Secret Key for the Region")
+ private String secretKey;
+
++ @Inject RegionService _regionService;
++
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Integer getId() {
+ return id;
+ }
+
+ public String getRegionName() {
+ return regionName;
+ }
+
+ public String getEndPoint() {
+ return endPoint;
+ }
+
+ public String getApiKey() {
+ return apiKey;
+ }
+
+ public String getSecretKey() {
+ return secretKey;
+ }
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ Region region = _regionService.updateRegion(getId(), getRegionName(), getEndPoint(), getApiKey(), getSecretKey());
+ if (region != null) {
+ RegionResponse response = _responseGenerator.createRegionResponse(region);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update Region");
+ }
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java
index 51a61e9,d333f60..e8f671d
--- a/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java
@@@ -16,7 -16,8 +16,9 @@@
// under the License.
package org.apache.cloudstack.api.command.admin.user;
-import org.apache.log4j.Logger;
++import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
@@@ -24,8 -26,6 +26,9 @@@ import org.apache.cloudstack.api.Parame
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.cloudstack.api.response.UserResponse;
++import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
+
import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.user.UserContext;
@@@ -42,6 -42,9 +45,11 @@@ public class DeleteUserCmd extends Base
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserResponse.class, required=true, description="Deletes a user")
private Long id;
+ @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
+ private Boolean isPropagate;
+
++ @Inject RegionService _regionService;
++
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java
index 5860adf,91a9253..95013ec
--- a/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java
@@@ -16,7 -16,8 +16,9 @@@
// under the License.
package org.apache.cloudstack.api.command.admin.user;
-import org.apache.log4j.Logger;
++import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
@@@ -23,8 -25,6 +26,9 @@@ import org.apache.cloudstack.api.APICom
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.UserResponse;
++import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
@@@ -45,6 -45,9 +49,11 @@@ public class DisableUserCmd extends Bas
required=true, description="Disables user by user ID.")
private Long id;
+ @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
+ private Boolean isPropagate;
+
++ @Inject RegionService _regionService;
++
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java
index d2f91e7,082b5ac..c1ba900
--- a/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java
@@@ -16,15 -16,11 +16,18 @@@
// under the License.
package org.apache.cloudstack.api.command.admin.user;
-import org.apache.cloudstack.api.*;
-import org.apache.log4j.Logger;
++import javax.inject.Inject;
+
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.UserResponse;
++import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
+
import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.user.UserAccount;
@@@ -43,7 -39,9 +46,11 @@@ public class EnableUserCmd extends Base
required=true, description="Enables user by user ID.")
private Long id;
+ @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
+ private Boolean isPropagate;
+
++ @Inject RegionService _regionService;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java
index 0b9eb03,b6f23a2..ee59d07
--- a/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java
@@@ -16,15 -16,11 +16,18 @@@
// under the License.
package org.apache.cloudstack.api.command.admin.user;
-import org.apache.cloudstack.api.*;
-import org.apache.log4j.Logger;
++import javax.inject.Inject;
+
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.UserResponse;
++import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
+
import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.user.UserAccount;
@@@ -68,6 -64,9 +71,11 @@@ public class UpdateUserCmd extends Base
@Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, description="Unique username")
private String username;
+ @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
+ private Boolean isPropagate;
+
++ @Inject RegionService _regionService;
++
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/api/src/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java
index 0000000,999eeb0..07f93a4
mode 000000,100644..100644
--- a/api/src/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java
@@@ -1,0 -1,83 +1,88 @@@
+ // Licensed to the Apache Software Foundation (ASF) under one
+ // or more contributor license agreements. See the NOTICE file
+ // distributed with this work for additional information
+ // regarding copyright ownership. The ASF licenses this file
+ // to you under the Apache License, Version 2.0 (the
+ // "License"); you may not use this file except in compliance
+ // with the License. You may obtain a copy of the License at
+ //
+ // http://www.apache.org/licenses/LICENSE-2.0
+ //
+ // Unless required by applicable law or agreed to in writing,
+ // software distributed under the License is distributed on an
+ // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ // KIND, either express or implied. See the License for the
+ // specific language governing permissions and limitations
+ // under the License.
+ package org.apache.cloudstack.api.command.user.region;
+
+ import java.util.ArrayList;
+ import java.util.List;
+
++import javax.inject.Inject;
++
+ import org.apache.cloudstack.api.APICommand;
+ import org.apache.cloudstack.api.ApiConstants;
+ import org.apache.cloudstack.api.BaseListCmd;
+ import org.apache.cloudstack.api.Parameter;
+ import org.apache.cloudstack.api.response.ListResponse;
+ import org.apache.cloudstack.api.response.RegionResponse;
+ import org.apache.cloudstack.region.Region;
++import org.apache.cloudstack.region.RegionService;
+ import org.apache.log4j.Logger;
+
+ @APICommand(name = "listRegions", description="Lists Regions", responseObject=RegionResponse.class)
+ public class ListRegionsCmd extends BaseListCmd {
+ public static final Logger s_logger = Logger.getLogger(ListRegionsCmd.class.getName());
+
+ private static final String s_name = "listregionsresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ID, type=CommandType.INTEGER, description="List Region by region ID.")
+ private Integer id;
+
+ @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="List Region by region name.")
+ private String name;
+
++ @Inject RegionService _regionService;
++
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Integer getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public void execute(){
+ List<? extends Region> result = _regionService.listRegions(this);
+ ListResponse<RegionResponse> response = new ListResponse<RegionResponse>();
+ List<RegionResponse> regionResponses = new ArrayList<RegionResponse>();
+ for (Region region : result) {
+ RegionResponse regionResponse = _responseGenerator.createRegionResponse(region);
+ regionResponse.setObjectName("region");
+ regionResponses.add(regionResponse);
+ }
+
+ response.setResponses(regionResponses);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/api/src/org/apache/cloudstack/api/response/SnapshotResponse.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/response/SnapshotResponse.java
index 9b5f8c1,58b7cf1..5b77fb2
--- a/api/src/org/apache/cloudstack/api/response/SnapshotResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/SnapshotResponse.java
@@@ -16,16 -16,15 +16,25 @@@
// under the License.
package org.apache.cloudstack.api.response;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.EntityReference;
+
+import com.cloud.serializer.Param;
+import com.cloud.storage.Snapshot;
+import com.google.gson.annotations.SerializedName;
+ import com.cloud.serializer.Param;
+ import com.cloud.storage.Snapshot;
+ import com.google.gson.annotations.SerializedName;
+ import org.apache.cloudstack.api.ApiConstants;
+ import org.apache.cloudstack.api.BaseResponse;
+ import org.apache.cloudstack.api.EntityReference;
+
+ import java.util.Date;
+ import java.util.List;
@EntityReference(value=Snapshot.class)
@SuppressWarnings("unused")
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/client/pom.xml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/client/tomcatconf/componentContext.xml.in
----------------------------------------------------------------------
diff --cc client/tomcatconf/componentContext.xml.in
index 48ed9f5,0000000..ca91727
mode 100644,000000..100644
--- a/client/tomcatconf/componentContext.xml.in
+++ b/client/tomcatconf/componentContext.xml.in
@@@ -1,257 -1,0 +1,258 @@@
+<!--
+ 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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:tx="http://www.springframework.org/schema/tx"
+ xmlns:aop="http://www.springframework.org/schema/aop"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/tx
+ http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
+ http://www.springframework.org/schema/aop
+ http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+
+
+ <!--
+ Compose a CloudStack deployment with selected components here
+ -->
+ <bean id="databaseUpgradeChecker" class="com.cloud.upgrade.DatabaseUpgradeChecker" />
+
+ <bean id="management-server" class ="com.cloud.server.ManagementServerExtImpl" />
+ <bean id="configuration-server" class="com.cloud.server.ConfigurationServerImpl" />
+
+ <bean id="clusterManagerImpl" class="com.cloud.cluster.ClusterManagerImpl" />
+ <bean id="clusteredAgentManagerImpl" class="com.cloud.agent.manager.ClusteredAgentManagerImpl" />
+ <bean id="clusteredVirtualMachineManagerImpl" class="com.cloud.vm.ClusteredVirtualMachineManagerImpl" />
+ <bean id="highAvailabilityManagerExtImpl" class="com.cloud.ha.HighAvailabilityManagerExtImpl" />
+ <!-- bean id="bareMetalVmManagerImpl" class="com.cloud.baremetal.BareMetalVmManagerImpl" / -->
+ <bean id="userVmManagerImpl" class="com.cloud.vm.UserVmManagerImpl" />
+ <bean id="consoleProxyManagerImpl" class="com.cloud.consoleproxy.ConsoleProxyManagerImpl" />
+ <bean id="securityGroupManagerImpl2" class="com.cloud.network.security.SecurityGroupManagerImpl2" />
+ <bean id="premiumSecondaryStorageManagerImpl" class="com.cloud.secstorage.PremiumSecondaryStorageManagerImpl" />
+ <bean id="randomlyIncreasingVMInstanceDaoImpl" class="com.cloud.vm.dao.RandomlyIncreasingVMInstanceDaoImpl" />
+ <bean id="ipv6AddressManagerImpl" class="com.cloud.network.Ipv6AddressManagerImpl" />
++ <bean id="RegionManagerImpl" class="org.apache.cloudstack.region.RegionManagerImpl" />
+
+ <!--
+ Network Elements
+ -->
+ <bean id="Ovs" class="com.cloud.network.element.OvsElement">
+ <property name="name" value="Ovs"/>
+ </bean>
+ <bean id="ExternalDhcpServer" class="com.cloud.network.element.ExternalDhcpElement">
+ <property name="name" value="ExternalDhcpServer"/>
+ </bean>
+ <bean id="BareMetal" class="com.cloud.network.element.BareMetalElement">
+ <property name="name" value="BareMetal"/>
+ </bean>
+ <bean id="SecurityGroupProvider" class="com.cloud.network.element.SecurityGroupElement">
+ <property name="name" value="SecurityGroupProvider"/>
+ </bean>
+ <bean id="VirtualRouter" class="com.cloud.network.element.VirtualRouterElement">
+ <property name="name" value="VirtualRouter"/>
+ </bean>
+ <bean id="VpcVirtualRouter" class="com.cloud.network.element.VpcVirtualRouterElement">
+ <property name="name" value="VpcVirtualRouter"/>
+ </bean>
+ <bean id="NiciraNvp" class="com.cloud.network.element.NiciraNvpElement">
+ <property name="name" value="NiciraNvp"/>
+ </bean>
+
+ <!--
+ Adapters
+ -->
+ <bean id="FirstFitRouting" class="com.cloud.agent.manager.allocator.impl.FirstFitRoutingAllocator">
+ <property name="name" value="FirstFitRouting"/>
+ </bean>
+
+ <!--
+ Storage pool allocators
+ -->
+ <bean id="LocalStoragePoolAllocator" class="com.cloud.storage.allocator.LocalStoragePoolAllocator">
+ <property name="name" value="LocalStorage"/>
+ </bean>
+ <bean id="FirstFitStoragePoolAllocator" class="com.cloud.storage.allocator.FirstFitStoragePoolAllocator">
+ <property name="name" value="Storage"/>
+ </bean>
+
+ <bean id="UserConcentratedAllocator" class="com.cloud.agent.manager.allocator.impl.UserConcentratedAllocator">
+ <property name="name" value="User First"/>
+ </bean>
+
+ <bean id="ConsoleProxyAllocator" class="com.cloud.consoleproxy.ConsoleProxyBalanceAllocator">
+ <property name="name" value="Balance"/>
+ </bean>
+
+ <bean id="StaticRoleBasedAPIAccessChecker" class="org.apache.cloudstack.acl.StaticRoleBasedAPIAccessChecker"/>
+
+ <bean id="ApiRateLimitServiceImpl" class="org.apache.cloudstack.ratelimit.ApiRateLimitServiceImpl"/>
+
+ <bean id="ExteralIpAddressAllocator" class="com.cloud.network.ExteralIpAddressAllocator">
+ <property name="name" value="Basic"/>
+ </bean>
+
+ <bean id="hyervisorTemplateAdapter" class="com.cloud.template.HyervisorTemplateAdapter">
+ <property name="name" value="HypervisorAdapter"/>
+ </bean>
+
+ <!--
+ Authenticators
+ -->
+ <bean id="MD5UserAuthenticator" class="com.cloud.server.auth.MD5UserAuthenticator">
+ <property name="name" value="MD5"/>
+ </bean>
+
+ <bean id="LDAPUserAuthenticator" class="com.cloud.server.auth.LDAPUserAuthenticator">
+ <property name="name" value="LDAP"/>
+ </bean>
+
+ <!--
+ Investigators
+ -->
+ <bean id="CheckOnAgentInvestigator" class="com.cloud.ha.CheckOnAgentInvestigator">
+ <property name="name" value="SimpleInvestigator"/>
+ </bean>
+
+ <bean id="XenServerInvestigator" class="com.cloud.ha.XenServerInvestigator">
+ <property name="name" value="XenServerInvestigator"/>
+ </bean>
+
+ <bean id="UserVmDomRInvestigator" class="com.cloud.ha.UserVmDomRInvestigator">
+ <property name="name" value="PingInvestigator"/>
+ </bean>
+
+ <bean id="ManagementIPSystemVMInvestigator" class="com.cloud.ha.ManagementIPSystemVMInvestigator">
+ <property name="name" value="ManagementIPSysVMInvestigator"/>
+ </bean>
+
+ <!--
+ Fencers
+ -->
+ <bean id="XenServerFencer" class="com.cloud.ha.XenServerFencer">
+ <property name="name" value="XenServerFenceBuilder"/>
+ </bean>
+ <bean id="KVMFencer" class="com.cloud.ha.KVMFencer">
+ <property name="name" value="KVMFenceBuilder"/>
+ </bean>
+ <bean id="OvmFencer" class="com.cloud.ovm.hypervisor.OvmFencer">
+ <property name="name" value="OvmFenceBuilder"/>
+ </bean>
+
+ <bean id="XcpServerDiscoverer" class="com.cloud.hypervisor.xen.discoverer.XcpServerDiscoverer">
+ <property name="name" value="XCP Agent"/>
+ </bean>
+
+ <bean id="SecondaryStorageDiscoverer" class="com.cloud.storage.secondary.SecondaryStorageDiscoverer">
+ <property name="name" value="SecondaryStorage"/>
+ </bean>
+
+ <bean id="KvmServerDiscoverer" class="com.cloud.hypervisor.kvm.discoverer.KvmServerDiscoverer">
+ <property name="name" value="KVM Agent"/>
+ </bean>
+
+ <bean id="BareMetalDiscoverer" class="com.cloud.baremetal.BareMetalDiscoverer">
+ <property name="name" value="Bare Metal Agent"/>
+ </bean>
+
+ <bean id="HypervServerDiscoverer" class="com.cloud.hypervisor.hyperv.HypervServerDiscoverer">
+ <property name="name" value="SCVMMServer"/>
+ </bean>
+
+ <bean id="OvmDiscoverer" class="com.cloud.ovm.hypervisor.OvmDiscoverer">
+ <property name="name" value="Ovm Discover"/>
+ </bean>
+
+ <bean id="FirstFitPlanner" class="com.cloud.deploy.FirstFitPlanner">
+ <property name="name" value="First Fit"/>
+ </bean>
+
+ <bean id="UserDispersingPlanner" class="com.cloud.deploy.UserDispersingPlanner">
+ <property name="name" value="UserDispersing"/>
+ </bean>
+
+ <bean id="UserConcentratedPodPlanner" class="com.cloud.deploy.UserConcentratedPodPlanner">
+ <property name="name" value="UserConcentratedPod"/>
+ </bean>
+
+ <bean id="BareMetalPlanner" class="com.cloud.deploy.BareMetalPlanner">
+ <property name="name" value="BareMetal Fit"/>
+ </bean>
+
+
+ <!--
+ Network Gurus
+ -->
+ <bean id="StorageNetworkGuru" class="com.cloud.network.guru.StorageNetworkGuru">
+ <property name="name" value="StorageNetworkGuru"/>
+ </bean>
+ <bean id="ExternalGuestNetworkGuru" class="com.cloud.network.guru.ExternalGuestNetworkGuru">
+ <property name="name" value="ExternalGuestNetworkGuru"/>
+ </bean>
+ <bean id="PublicNetworkGuru" class="com.cloud.network.guru.PublicNetworkGuru">
+ <property name="name" value="PublicNetworkGuru"/>
+ </bean>
+ <bean id="PodBasedNetworkGuru" class="com.cloud.network.guru.PodBasedNetworkGuru">
+ <property name="name" value="PodBasedNetworkGuru"/>
+ </bean>
+ <bean id="ControlNetworkGuru" class="com.cloud.network.guru.ControlNetworkGuru">
+ <property name="name" value="ControlNetworkGuru"/>
+ </bean>
+ <bean id="DirectNetworkGuru" class="com.cloud.network.guru.DirectNetworkGuru">
+ <property name="name" value="DirectNetworkGuru"/>
+ </bean>
+ <bean id="DirectPodBasedNetworkGuru" class="com.cloud.network.guru.DirectPodBasedNetworkGuru">
+ <property name="name" value="DirectPodBasedNetworkGuru"/>
+ </bean>
+ <bean id="OvsGuestNetworkGuru" class="com.cloud.network.guru.OvsGuestNetworkGuru">
+ <property name="name" value="OvsGuestNetworkGuru"/>
+ </bean>
+ <bean id="PrivateNetworkGuru" class="com.cloud.network.guru.PrivateNetworkGuru">
+ <property name="name" value="PrivateNetworkGuru"/>
+ </bean>
+ <bean id="NiciraNvpGuestNetworkGuru" class="com.cloud.network.guru.NiciraNvpGuestNetworkGuru">
+ <property name="name" value="NiciraNvpGuestNetworkGuru"/>
+ </bean>
+
+ <!--
+ Hypervisor Gurus
+ -->
+ <bean id="XenServerGuru" class="com.cloud.hypervisor.XenServerGuru">
+ <property name="name" value="XenServerGuru"/>
+ </bean>
+
+ <bean id="KVMGuru" class="com.cloud.hypervisor.KVMGuru">
+ <property name="name" value="KVMGuru"/>
+ </bean>
+
+ <bean id="BareMetalGuru" class="com.cloud.baremetal.BareMetalGuru">
+ <property name="name" value="BareMetalGuru"/>
+ </bean>
+
+ <bean id="HypervGuru" class="com.cloud.hypervisor.guru.HypervGuru">
+ <property name="name" value="HypervGuru"/>
+ </bean>
+
+ <bean id="OvmGuru" class="com.cloud.ovm.hypervisor.OvmGuru">
+ <property name="name" value="OvmGuru"/>
+ </bean>
+
+</beans>
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/client/tomcatconf/db.properties.in
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/core/src/com/cloud/storage/SnapshotVO.java
----------------------------------------------------------------------
diff --cc core/src/com/cloud/storage/SnapshotVO.java
index 8ed6a5a,c1c5f21..413083e
--- a/core/src/com/cloud/storage/SnapshotVO.java
+++ b/core/src/com/cloud/storage/SnapshotVO.java
@@@ -253,30 -241,30 +243,30 @@@ public class SnapshotVO implements Snap
return removed;
}
- @Override
+ @Override
- public Status getStatus() {
+ public State getState() {
- return status;
- }
+ return status;
+ }
- public void setStatus(Status status) {
+ public void setStatus(State status) {
- this.status = status;
- }
+ this.status = status;
+ }
- public String getBackupSnapshotId(){
- return backupSnapshotId;
- }
+ public String getBackupSnapshotId(){
+ return backupSnapshotId;
+ }
public long getPrevSnapshotId(){
- return prevSnapshotId;
- }
+ return prevSnapshotId;
+ }
- public void setBackupSnapshotId(String backUpSnapshotId){
- this.backupSnapshotId = backUpSnapshotId;
- }
+ public void setBackupSnapshotId(String backUpSnapshotId){
+ this.backupSnapshotId = backUpSnapshotId;
+ }
- public void setPrevSnapshotId(long prevSnapshotId){
- this.prevSnapshotId = prevSnapshotId;
- }
+ public void setPrevSnapshotId(long prevSnapshotId){
+ this.prevSnapshotId = prevSnapshotId;
+ }
public static Type getSnapshotType(String snapshotType) {
for ( Type type : Type.values()) {
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/db/SnapshotVO.java
----------------------------------------------------------------------
diff --cc engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/db/SnapshotVO.java
index b0834be,0000000..b05b803
mode 100644,000000..100644
--- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/db/SnapshotVO.java
+++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/db/SnapshotVO.java
@@@ -1,296 -1,0 +1,296 @@@
+// 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.storage.snapshot.db;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
- import com.cloud.storage.Snapshot.Status;
++import com.cloud.storage.Snapshot.State;
+import com.cloud.storage.Snapshot.Type;
+import com.cloud.utils.db.GenericDao;
+import com.google.gson.annotations.Expose;
+
+@Entity
+@Table(name="snapshots")
+public class SnapshotVO {
+ @Id
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
+ @Column(name="id")
+ private final long id = -1;
+
+ @Column(name="data_center_id")
+ long dataCenterId;
+
+ @Column(name="account_id")
+ long accountId;
+
+ @Column(name="domain_id")
+ long domainId;
+
+ @Column(name="volume_id")
+ Long volumeId;
+
+ @Column(name="disk_offering_id")
+ Long diskOfferingId;
+
+ @Expose
+ @Column(name="path")
+ String path;
+
+ @Expose
+ @Column(name="name")
+ String name;
+
+ @Expose
+ @Column(name="status", updatable = true, nullable=false)
+ @Enumerated(value=EnumType.STRING)
- private Status status;
++ private State status;
+
+ @Column(name="snapshot_type")
+ short snapshotType;
+
+ @Column(name="type_description")
+ String typeDescription;
+
+ @Column(name="size")
+ long size;
+
+ @Column(name=GenericDao.CREATED_COLUMN)
+ Date created;
+
+ @Column(name=GenericDao.REMOVED_COLUMN)
+ Date removed;
+
+ @Column(name="backup_snap_id")
+ String backupSnapshotId;
+
+ @Column(name="swift_id")
+ Long swiftId;
+
+ @Column(name="s3_id")
+ Long s3Id;
+
+ @Column(name="sechost_id")
+ Long secHostId;
+
+ @Column(name="prev_snap_id")
+ long prevSnapshotId;
+
+ @Column(name="hypervisor_type")
+ @Enumerated(value=EnumType.STRING)
+ HypervisorType hypervisorType;
+
+ @Expose
+ @Column(name="version")
+ String version;
+
+ @Column(name="uuid")
+ String uuid;
+
+ public SnapshotVO() {
+ this.uuid = UUID.randomUUID().toString();
+ }
+
+ public SnapshotVO(long dcId, long accountId, long domainId, Long volumeId, Long diskOfferingId, String path, String name, short snapshotType, String typeDescription, long size, HypervisorType hypervisorType ) {
+ this.dataCenterId = dcId;
+ this.accountId = accountId;
+ this.domainId = domainId;
+ this.volumeId = volumeId;
+ this.diskOfferingId = diskOfferingId;
+ this.path = path;
+ this.name = name;
+ this.snapshotType = snapshotType;
+ this.typeDescription = typeDescription;
+ this.size = size;
- this.status = Status.Creating;
++ this.status = State.Creating;
+ this.prevSnapshotId = 0;
+ this.hypervisorType = hypervisorType;
+ this.version = "2.2";
+ this.uuid = UUID.randomUUID().toString();
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public long getDataCenterId() {
+ return dataCenterId;
+ }
+
+
+ public long getAccountId() {
+ return accountId;
+ }
+
+
+ public long getDomainId() {
+ return domainId;
+ }
+
+ public long getVolumeId() {
+ return volumeId;
+ }
+
+ public long getDiskOfferingId() {
+ return diskOfferingId;
+ }
+
+ public void setVolumeId(Long volumeId) {
+ this.volumeId = volumeId;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public short getsnapshotType() {
+ return snapshotType;
+ }
+
+ public Type getType() {
+ if (snapshotType < 0 || snapshotType >= Type.values().length) {
+ return null;
+ }
+ return Type.values()[snapshotType];
+ }
+
+ public Long getSwiftId() {
+ return swiftId;
+ }
+
+ public void setSwiftId(Long swiftId) {
+ this.swiftId = swiftId;
+ }
+
+ public Long getSecHostId() {
+ return secHostId;
+ }
+
+ public void setSecHostId(Long secHostId) {
+ this.secHostId = secHostId;
+ }
+
+ public HypervisorType getHypervisorType() {
+ return hypervisorType;
+ }
+
+ public void setSnapshotType(short snapshotType) {
+ this.snapshotType = snapshotType;
+ }
+
+ public boolean isRecursive(){
+ if ( snapshotType >= Type.HOURLY.ordinal() && snapshotType <= Type.MONTHLY.ordinal() ) {
+ return true;
+ }
+ return false;
+ }
+
+ public long getSize() {
+ return size;
+ }
+
+ public String getTypeDescription() {
+ return typeDescription;
+ }
+ public void setTypeDescription(String typeDescription) {
+ this.typeDescription = typeDescription;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ public Date getRemoved() {
+ return removed;
+ }
+
- public Status getStatus() {
++ public State getStatus() {
+ return status;
+ }
+
- public void setStatus(Status status) {
++ public void setStatus(State status) {
+ this.status = status;
+ }
+
+ public String getBackupSnapshotId(){
+ return backupSnapshotId;
+ }
+
+ public long getPrevSnapshotId(){
+ return prevSnapshotId;
+ }
+
+ public void setBackupSnapshotId(String backUpSnapshotId){
+ this.backupSnapshotId = backUpSnapshotId;
+ }
+
+ public void setPrevSnapshotId(long prevSnapshotId){
+ this.prevSnapshotId = prevSnapshotId;
+ }
+
+ public static Type getSnapshotType(String snapshotType) {
+ for ( Type type : Type.values()) {
+ if ( type.equals(snapshotType)) {
+ return type;
+ }
+ }
+ return null;
+ }
+
+ public String getUuid() {
+ return this.uuid;
+ }
+
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ public Long getS3Id() {
+ return s3Id;
+ }
+
+ public void setS3Id(Long s3Id) {
+ this.s3Id = s3Id;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotEntityImpl.java
----------------------------------------------------------------------
diff --cc engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotEntityImpl.java
index 1363251,0000000..6a7d78a
mode 100644,000000..100644
--- a/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotEntityImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotEntityImpl.java
@@@ -1,192 -1,0 +1,193 @@@
+// 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.storage.snapshot;
+
+import java.lang.reflect.Method;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.cloudstack.engine.cloud.entity.api.SnapshotEntity;
+
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+
+public class SnapshotEntityImpl implements SnapshotEntity {
+
+ @Override
+ public String getUuid() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public long getId() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public String getCurrentState() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getDesiredState() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Date getCreatedTime() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Date getLastUpdatedTime() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getOwner() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List<Method> getApplicableActions() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public long getAccountId() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public long getVolumeId() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public String getPath() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Date getCreated() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Type getType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
- @Override
- public Status getStatus() {
- // TODO Auto-generated method stub
- return null;
- }
+
+ @Override
+ public HypervisorType getHypervisorType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean isRecursive() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public short getsnapshotType() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public long getDomainId() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public String reserveForBackup(int expiration) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void backup(String reservationToken) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void restore(String vm) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void destroy() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Map<String, String> getDetails() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void addDetail(String name, String value) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void delDetail(String name, String value) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateDetail(String name, String value) {
+ // TODO Auto-generated method stub
+
+ }
+
++ @Override
++ public State getState() {
++ // TODO Auto-generated method stub
++ return null;
++ }
++
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/framework/pom.xml
----------------------------------------------------------------------
diff --cc framework/pom.xml
index ca2a4f3,81e0916..9ac1ae0
--- a/framework/pom.xml
+++ b/framework/pom.xml
@@@ -30,7 -30,6 +30,8 @@@
<defaultGoal>install</defaultGoal>
</build>
<modules>
+ <module>ipc</module>
+ <module>rest</module>
+ <module>events</module>
</modules>
</project>