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/01 20:38:11 UTC

[30/50] [abbrv] git commit: refs/heads/javelin - - Separated RegionServiceImpl and RegionManagerImpl - Added comments - Changed package name to org.apache.cloudstack.region

- Separated RegionServiceImpl and RegionManagerImpl
- Added comments
- Changed package name to org.apache.cloudstack.region


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

Branch: refs/heads/javelin
Commit: 8b1a5b1de2ef4e69e2bde234c56dff120cb666f0
Parents: e848a93
Author: Kishan Kavala <ki...@cloud.com>
Authored: Thu Jan 31 18:08:20 2013 +0530
Committer: Kishan Kavala <ki...@cloud.com>
Committed: Thu Jan 31 18:08:20 2013 +0530

----------------------------------------------------------------------
 api/src/com/cloud/region/Region.java               |   35 -
 api/src/com/cloud/region/RegionService.java        |   49 -
 api/src/com/cloud/region/RegionSync.java           |   33 -
 api/src/com/cloud/user/AccountService.java         |   93 --
 api/src/com/cloud/user/DomainService.java          |   11 -
 api/src/org/apache/cloudstack/api/BaseCmd.java     |    2 +-
 .../apache/cloudstack/api/ResponseGenerator.java   |    2 +-
 .../command/admin/account/DeleteAccountCmd.java    |    9 +-
 .../command/admin/account/DisableAccountCmd.java   |   19 +-
 .../command/admin/account/EnableAccountCmd.java    |    8 +-
 .../command/admin/account/UpdateAccountCmd.java    |    8 +-
 .../api/command/admin/domain/DeleteDomainCmd.java  |    7 +-
 .../api/command/admin/domain/UpdateDomainCmd.java  |    8 +-
 .../api/command/admin/region/AddRegionCmd.java     |   10 +-
 .../api/command/admin/region/UpdateRegionCmd.java  |    8 +-
 .../api/command/admin/user/DeleteUserCmd.java      |    8 +-
 .../api/command/admin/user/DisableUserCmd.java     |    8 +-
 .../api/command/admin/user/EnableUserCmd.java      |    8 +-
 .../api/command/admin/user/UpdateUserCmd.java      |    8 +-
 .../api/command/user/region/ListRegionsCmd.java    |    9 +-
 .../cloudstack/api/response/RegionResponse.java    |    3 +
 api/src/org/apache/cloudstack/region/Region.java   |   35 +
 .../apache/cloudstack/region/RegionService.java    |  157 +++
 .../org/apache/cloudstack/region/RegionSync.java   |   33 +
 client/tomcatconf/components.xml.in                |    2 +-
 server/src/com/cloud/api/ApiResponseHelper.java    |    3 +-
 server/src/com/cloud/api/ApiServer.java            |    2 +-
 .../configuration/DefaultComponentLibrary.java     |    7 +-
 server/src/com/cloud/domain/dao/DomainDaoImpl.java |    1 -
 server/src/com/cloud/region/RegionAccount.java     |  287 -----
 server/src/com/cloud/region/RegionDomain.java      |   61 -
 server/src/com/cloud/region/RegionManager.java     |   30 -
 server/src/com/cloud/region/RegionManagerImpl.java |  791 -------------
 server/src/com/cloud/region/RegionSyncVO.java      |   93 --
 server/src/com/cloud/region/RegionUser.java        |   76 --
 server/src/com/cloud/region/RegionVO.java          |   93 --
 server/src/com/cloud/region/RegionsApiUtil.java    |  256 -----
 server/src/com/cloud/region/dao/RegionDao.java     |   23 -
 server/src/com/cloud/region/dao/RegionDaoImpl.java |   33 -
 server/src/com/cloud/region/dao/RegionSyncDao.java |   23 -
 .../com/cloud/region/dao/RegionSyncDaoImpl.java    |   33 -
 .../com/cloud/server/ConfigurationServerImpl.java  |    5 +-
 server/src/com/cloud/user/AccountManager.java      |   95 ++-
 server/src/com/cloud/user/AccountManagerImpl.java  |   15 +-
 server/src/com/cloud/user/DomainManager.java       |   14 +-
 server/src/com/cloud/user/DomainManagerImpl.java   |    5 +-
 server/src/com/cloud/user/dao/UserDaoImpl.java     |    3 -
 .../apache/cloudstack/region/RegionAccount.java    |  287 +++++
 .../org/apache/cloudstack/region/RegionDomain.java |   61 +
 .../apache/cloudstack/region/RegionManager.java    |  216 ++++
 .../cloudstack/region/RegionManagerImpl.java       |  861 +++++++++++++++
 .../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    |   30 +
 .../cloudstack/region/dao/RegionDaoImpl.java       |   62 +
 .../cloudstack/region/dao/RegionSyncDao.java       |   24 +
 .../cloudstack/region/dao/RegionSyncDaoImpl.java   |   33 +
 setup/db/create-schema.sql                         |    2 +-
 61 files changed, 2829 insertions(+), 2136 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/api/src/com/cloud/region/Region.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/region/Region.java b/api/src/com/cloud/region/Region.java
deleted file mode 100644
index 96d7dff..0000000
--- a/api/src/com/cloud/region/Region.java
+++ /dev/null
@@ -1,35 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.region;
-
-/**
- *
- */
-public interface Region  {
-    
-    public int getId();
-
-	public String getName();
-
-	public void setName(String name);
-
-	public String getEndPoint();
-	
-	public String getApiKey();
-	
-	public String getSecretKey();
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/api/src/com/cloud/region/RegionService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/region/RegionService.java b/api/src/com/cloud/region/RegionService.java
deleted file mode 100644
index ef4b5cb..0000000
--- a/api/src/com/cloud/region/RegionService.java
+++ /dev/null
@@ -1,49 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.region;
-
-import java.util.List;
-
-import org.apache.cloudstack.api.command.admin.account.UpdateAccountCmd;
-import org.apache.cloudstack.api.command.admin.domain.UpdateDomainCmd;
-import org.apache.cloudstack.api.command.admin.user.DeleteUserCmd;
-import org.apache.cloudstack.api.command.admin.user.UpdateUserCmd;
-import org.apache.cloudstack.api.command.user.region.ListRegionsCmd;
-
-import com.cloud.domain.Domain;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.user.Account;
-import com.cloud.user.UserAccount;
-
-
-public interface RegionService {
-	public Region addRegion(int id, String name, String endPoint, String apiKey, String secretKey);
-	public Region updateRegion(int id, String name, String endPoint, String apiKey, String secretKey);
-	public boolean removeRegion(int id);
-	public List<? extends Region> listRegions(ListRegionsCmd cmd);
-	boolean deleteUserAccount(long accountId);
-	Account updateAccount(UpdateAccountCmd cmd);
-	public Account disableAccount(String accountName, Long domainId, Long id, Boolean lockRequested) throws ConcurrentOperationException, ResourceUnavailableException;
-	public Account enableAccount(String accountName, Long domainId, Long id);
-	public boolean deleteUser(DeleteUserCmd deleteUserCmd);
-	public boolean deleteDomain(Long id, Boolean cleanup);
-	public UserAccount updateUser(UpdateUserCmd updateUserCmd);
-	public Domain updateDomain(UpdateDomainCmd updateDomainCmd);
-	public UserAccount disableUser(Long id);
-	public UserAccount enableUser(Long id);
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/api/src/com/cloud/region/RegionSync.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/region/RegionSync.java b/api/src/com/cloud/region/RegionSync.java
deleted file mode 100644
index ed485df..0000000
--- a/api/src/com/cloud/region/RegionSync.java
+++ /dev/null
@@ -1,33 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.region;
-
-import java.util.Date;
-
-/**
- *
- */
-public interface RegionSync  {
-    
-    public long getId();
-    
-    public int getRegionId();
-    
-	public String getApi();
-
-	Date getCreateDate();
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/api/src/com/cloud/user/AccountService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/user/AccountService.java b/api/src/com/cloud/user/AccountService.java
index 553c84a..0c1fc77 100755
--- a/api/src/com/cloud/user/AccountService.java
+++ b/api/src/com/cloud/user/AccountService.java
@@ -23,15 +23,10 @@ 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.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.account.UpdateAccountCmd;
 
 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 {
@@ -66,34 +61,6 @@ public interface AccountService {
             Map<String, String> details, String accountUUID, String userUUID, Integer regionId);
 
     /**
-     * Deletes a user by userId
-     *
-     * @param accountId
-     *            - id of the account do delete
-     *
-     * @return true if delete was successful, false otherwise
-     */
-    boolean deleteUserAccount(long accountId);
-
-    /**
-     * Disables a user by userId
-     *
-     * @param userId
-     *            - the userId
-     * @return UserAccount object
-     */
-    UserAccount disableUser(long userId);
-
-    /**
-     * Enables a user
-     *
-     * @param userId
-     *            - the userId
-     * @return UserAccount object
-     */
-    UserAccount enableUser(long userId);
-
-    /**
      * Locks a user by userId. A locked user cannot access the API, but will still have running VMs/IP addresses
      * allocated/etc.
      *
@@ -102,72 +69,12 @@ public interface AccountService {
      */
     UserAccount lockUser(long userId);
 
-    /**
-     * Update a user by userId
-     *
-     * @param userId
-     * @return UserAccount object
-     */
-    UserAccount updateUser(UpdateUserCmd cmd);
-
-    /**
-     * Disables an account by accountName and domainId
-     *
-     * @param accountName
-     *            TODO
-     * @param domainId
-     *            TODO
-     * @param accountId
-     * @param disabled
-     *            account if success
-     * @return true if disable was successful, false otherwise
-     */
-    Account disableAccount(String accountName, Long domainId, Long accountId) throws ConcurrentOperationException, ResourceUnavailableException;
-
-    /**
-     * Enables an account by accountId
-     *
-     * @param accountName
-     *            - the enableAccount command defining the accountId to be deleted.
-     * @param domainId
-     *            TODO
-     * @param accountId
-     * @return account object
-     */
-    Account enableAccount(String accountName, Long domainId, Long accountId);
-
-    /**
-     * Locks an account by accountId. A locked account cannot access the API, but will still have running VMs/IP
-     * addresses
-     * allocated/etc.
-     *
-     * @param accountName
-     *            - the LockAccount command defining the accountId to be locked.
-     * @param domainId
-     *            TODO
-     * @param accountId
-     * @return account object
-     */
-    Account lockAccount(String accountName, Long domainId, Long accountId);
-
-    /**
-     * Updates an account name
-     *
-     * @param cmd
-     *            - the parameter containing accountId
-     * @return updated account object
-     */
-
-    Account updateAccount(UpdateAccountCmd cmd);
-
     Account getSystemAccount();
 
     User getSystemUser();
 
     User createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId, String userUUID, Integer regionId);
 
-    boolean deleteUser(DeleteUserCmd deleteUserCmd);
-
     boolean isAdmin(short accountType);
 
     Account finalizeOwner(Account caller, String accountName, Long domainId, Long projectId);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/api/src/com/cloud/user/DomainService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/user/DomainService.java b/api/src/com/cloud/user/DomainService.java
index 9fca09d..1a96354 100644
--- a/api/src/com/cloud/user/DomainService.java
+++ b/api/src/com/cloud/user/DomainService.java
@@ -20,7 +20,6 @@ import java.util.List;
 
 import org.apache.cloudstack.api.command.admin.domain.ListDomainChildrenCmd;
 import org.apache.cloudstack.api.command.admin.domain.ListDomainsCmd;
-import org.apache.cloudstack.api.command.admin.domain.UpdateDomainCmd;
 
 import com.cloud.domain.Domain;
 import com.cloud.exception.PermissionDeniedException;
@@ -42,21 +41,11 @@ public interface DomainService {
      */
     boolean isChildDomain(Long parentId, Long childId);
 
-    boolean deleteDomain(long domainId, Boolean cleanup);
-
     Pair<List<? extends Domain>, Integer> searchForDomains(ListDomainsCmd cmd)
             throws PermissionDeniedException;
 
     Pair<List<? extends Domain>, Integer> searchForDomainChildren(ListDomainChildrenCmd cmd)
             throws PermissionDeniedException;
-    /**
-     * update an existing domain
-     * 
-     * @param cmd
-     *            - the command containing domainId and new domainName
-     * @return Domain object if the command succeeded
-     */
-    Domain updateDomain(UpdateDomainCmd cmd);
 
     /**
      * find the domain by its path

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/api/src/org/apache/cloudstack/api/BaseCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseCmd.java b/api/src/org/apache/cloudstack/api/BaseCmd.java
index c0d465f..e2c3e03 100644
--- a/api/src/org/apache/cloudstack/api/BaseCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseCmd.java
@@ -26,6 +26,7 @@ import java.util.Map;
 import java.util.regex.Pattern;
 
 import org.apache.cloudstack.query.QueryService;
+import org.apache.cloudstack.region.RegionService;
 import org.apache.log4j.Logger;
 
 import com.cloud.configuration.ConfigurationService;
@@ -53,7 +54,6 @@ import com.cloud.network.vpn.RemoteAccessVpnService;
 import com.cloud.network.vpn.Site2SiteVpnService;
 import com.cloud.projects.Project;
 import com.cloud.projects.ProjectService;
-import com.cloud.region.RegionService;
 import com.cloud.resource.ResourceService;
 import com.cloud.server.ManagementService;
 import com.cloud.server.TaggedResourceService;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/api/src/org/apache/cloudstack/api/ResponseGenerator.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ResponseGenerator.java b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
index d6780fd..0b9eb50 100644
--- a/api/src/org/apache/cloudstack/api/ResponseGenerator.java
+++ b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
@@ -93,6 +93,7 @@ import org.apache.cloudstack.api.response.VpcOfferingResponse;
 import org.apache.cloudstack.api.response.VpcResponse;
 import org.apache.cloudstack.api.response.VpnUsersResponse;
 import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.cloudstack.region.Region;
 
 import com.cloud.async.AsyncJob;
 import com.cloud.capacity.Capacity;
@@ -143,7 +144,6 @@ import com.cloud.org.Cluster;
 import com.cloud.projects.Project;
 import com.cloud.projects.ProjectAccount;
 import com.cloud.projects.ProjectInvitation;
-import com.cloud.region.Region;
 import com.cloud.server.ResourceTag;
 import com.cloud.storage.GuestOS;
 import com.cloud.storage.S3;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
index c918655..22cab8a 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
@@ -94,13 +94,8 @@ public class DeleteAccountCmd extends BaseAsyncCmd {
     @Override
     public void execute(){
         UserContext.current().setEventDetails("Account Id: "+getId());
-        boolean isPopagate = (getIsPropagate() != null ) ? getIsPropagate() : false; 
-        boolean result = false;
-        if(isPopagate){
-        	result = _accountService.deleteUserAccount(getId());
-        } else {
-        	result = _regionService.deleteUserAccount(getId());
-        }
+ 
+        boolean	result = _regionService.deleteUserAccount(this);
         if (result) {
             SuccessResponse response = new SuccessResponse(getCommandName());
             this.setResponseObject(response);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
index 32bc9d4..e78a09c 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
@@ -74,12 +74,16 @@ public class DisableAccountCmd extends BaseAsyncCmd {
 	public Boolean getIsPropagate() {
 		return isPropagate;
 	}
-    
+
+    public Boolean getLockRequested() {
+		return lockRequested;
+	}
+	
     /////////////////////////////////////////////////////
     /////////////// API Implementation///////////////////
     /////////////////////////////////////////////////////
 
-    @Override
+	@Override
     public String getCommandName() {
         return s_name;
     }
@@ -112,16 +116,7 @@ public class DisableAccountCmd extends BaseAsyncCmd {
     @Override
     public void execute() throws ConcurrentOperationException, ResourceUnavailableException{
         UserContext.current().setEventDetails("Account Name: "+getAccountName()+", Domain Id:"+getDomainId());
-    	Account result = null;
-    	boolean isPopagate = (getIsPropagate() != null ) ? getIsPropagate() : false;
-    	if(isPopagate){
-    		if(lockRequested)
-    			result = _accountService.lockAccount(getAccountName(), getDomainId(), getId());
-    		else
-    			result = _accountService.disableAccount(getAccountName(), getDomainId(), getId());
-    	} else {
-    		result = _regionService.disableAccount(getAccountName(), getDomainId(), getId(), lockRequested);
-    	}
+    	Account result = _regionService.disableAccount(this);
         if (result != null){
             AccountResponse response = _responseGenerator.createAccountResponse(result);
             response.setResponseName(getCommandName());

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
index 08fe4c5..09aafea 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
@@ -97,13 +97,7 @@ public class EnableAccountCmd extends BaseCmd {
 
     @Override
     public void execute(){
-    	boolean isPopagate = (getIsPropagate() != null ) ? getIsPropagate() : false;
-    	Account result = null;
-    	if(isPopagate){
-    		result = _accountService.enableAccount(getAccountName(), getDomainId(), getId());
-    	} else {
-    		result = _regionService.enableAccount(getAccountName(), getDomainId(), getId());
-    	}
+    	Account result = _regionService.enableAccount(this);
         if (result != null){
             AccountResponse response = _responseGenerator.createAccountResponse(result);
             response.setResponseName(getCommandName());

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
index ea46ba9..5840647 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
@@ -127,13 +127,7 @@ public class UpdateAccountCmd extends BaseCmd{
 
     @Override
     public void execute(){
-    	boolean isPopagate = (getIsPropagate() != null ) ? getIsPropagate() : false;
-    	Account result = null;
-    	if(isPopagate){
-    		result = _accountService.updateAccount(this);
-        } else {
-        	result = _regionService.updateAccount(this);
-        }
+    	Account result = _regionService.updateAccount(this);
         if (result != null){
             AccountResponse response = _responseGenerator.createAccountResponse(result);
             response.setResponseName(getCommandName());

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java
index 7c33c79..b013391 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java
@@ -95,12 +95,7 @@ public class DeleteDomainCmd extends BaseAsyncCmd {
     public void execute(){
         UserContext.current().setEventDetails("Domain Id: "+getId());
         boolean isPopagate = (getIsPropagate() != null ) ? getIsPropagate() : false; 
-        boolean result = false;
-        if(isPopagate){
-        	result = _domainService.deleteDomain(id, cleanup);
-        } else {
-        	result = _regionService.deleteDomain(id, cleanup);
-        }
+        boolean result = _regionService.deleteDomain(this);
         if (result) {
             SuccessResponse response = new SuccessResponse(getCommandName());
             this.setResponseObject(response);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java
index 8de92be..79e57a6 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java
@@ -85,13 +85,7 @@ public class UpdateDomainCmd extends BaseCmd {
     @Override
     public void execute(){
         UserContext.current().setEventDetails("Domain Id: "+getId());
-        boolean isPopagate = (getIsPropagate() != null ) ? getIsPropagate() : false;
-        Domain domain = null;
-    	if(isPopagate){
-    		domain = _domainService.updateDomain(this);
-        } else {
-        	domain = _regionService.updateDomain(this);
-        }
+        Domain domain =  _regionService.updateDomain(this);
         
         if (domain != null) {
             DomainResponse response = _responseGenerator.createDomainResponse(domain);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java b/api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java
index 73453a6..f9663b7 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
@@ -23,9 +23,9 @@ 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.log4j.Logger;
 
-import com.cloud.region.Region;
 import com.cloud.user.Account;
 
 @APICommand(name = "addRegion", description="Adds a Region", responseObject=RegionResponse.class)
@@ -40,16 +40,16 @@ public class AddRegionCmd extends BaseCmd {
     @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="adds Region with this name")
+    @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="end_point of the Region")
+    @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")
+    @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")
+    @Parameter(name=ApiConstants.SECRET_KEY, type=CommandType.STRING, description="Secret Key of Admin user")
     private String secretKey;
     
     /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java b/api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java
index 626fb33..bc6576c 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
@@ -23,9 +23,9 @@ 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.log4j.Logger;
 
-import com.cloud.region.Region;
 import com.cloud.user.Account;
 
 @APICommand(name = "updateRegion", description="Updates a region", responseObject=RegionResponse.class)
@@ -37,7 +37,7 @@ public class UpdateRegionCmd extends BaseCmd {
     //////////////// API parameters /////////////////////
     /////////////////////////////////////////////////////
 
-    @Parameter(name=ApiConstants.ID, type=CommandType.INTEGER, required=true, description="ID of region to update")
+    @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")
@@ -46,10 +46,10 @@ public class UpdateRegionCmd extends BaseCmd {
     @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="API key")
+    @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="Secret Key")
+    @Parameter(name=ApiConstants.SECRET_KEY, type=CommandType.STRING, description="new Secret Key for the Region")
     private String secretKey;
     
     /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java
index 329bd9a..d333f60 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java
@@ -79,13 +79,7 @@ public class DeleteUserCmd extends BaseCmd {
     @Override
     public void execute(){
         UserContext.current().setEventDetails("UserId: "+getId());
-        boolean isPopagate = (getIsPropagate() != null ) ? getIsPropagate() : false;
-        boolean result = false;
-        if(isPopagate){
-        	result = _accountService.deleteUser(this);
-        } else {
-        	result = _regionService.deleteUser(this);
-        }
+        boolean result = _regionService.deleteUser(this);
         if (result) {
             SuccessResponse response = new SuccessResponse(getCommandName());
             this.setResponseObject(response);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java
index f3a3b2b..91a9253 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java
@@ -93,13 +93,7 @@ public class DisableUserCmd extends BaseAsyncCmd {
     @Override
     public void execute(){
         UserContext.current().setEventDetails("UserId: "+getId());
-        boolean isPopagate = (getIsPropagate() != null ) ? getIsPropagate() : false;
-        UserAccount user = null;
-    	if(isPopagate){
-    		user = _accountService.disableUser(getId());
-        } else {
-        	user = _regionService.disableUser(getId());
-        }
+        UserAccount user = _regionService.disableUser(this);
         
         if (user != null){
             UserResponse response = _responseGenerator.createUserResponse(user);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java
index d6577fb..082b5ac 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java
@@ -76,13 +76,7 @@ public class EnableUserCmd extends BaseCmd {
     @Override
     public void execute(){
         UserContext.current().setEventDetails("UserId: "+getId());
-        boolean isPopagate = (getIsPropagate() != null ) ? getIsPropagate() : false;
-        UserAccount user = null;
-    	if(isPopagate){
-    		user = _accountService.enableUser(getId());
-        } else {
-        	user = _regionService.enableUser(getId());
-        }
+        UserAccount user = _regionService.enableUser(this);
         
         if (user != null){
             UserResponse response = _responseGenerator.createUserResponse(user);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java
index 7369933..b6f23a2 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java
@@ -133,13 +133,7 @@ public class UpdateUserCmd extends BaseCmd {
     @Override
     public void execute(){
         UserContext.current().setEventDetails("UserId: "+getId());
-        boolean isPopagate = (getIsPropagate() != null ) ? getIsPropagate() : false;
-        UserAccount user = null;
-    	if(isPopagate){
-    		user = _accountService.updateUser(this);
-        } else {
-        	user = _regionService.updateUser(this);
-        }
+        UserAccount user = _regionService.updateUser(this);
         
         if (user != null){
             UserResponse response = _responseGenerator.createUserResponse(user);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/api/src/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java
index beddc3f..4599a19 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
@@ -25,10 +25,9 @@ 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.log4j.Logger;
 
-import com.cloud.region.Region;
-
 @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());
@@ -43,7 +42,7 @@ public class ListRegionsCmd extends BaseListCmd {
     private Integer id;
 
     @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="List Region by region name.")
-    private String domainName;
+    private String name;
     
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
@@ -53,8 +52,8 @@ public class ListRegionsCmd extends BaseListCmd {
         return id;
     }
 
-    public String getRegionName() {
-        return domainName;
+    public String getName() {
+        return name;
     }
     
     /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/api/src/org/apache/cloudstack/api/response/RegionResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/RegionResponse.java b/api/src/org/apache/cloudstack/api/response/RegionResponse.java
index cbd14b6..f8bfe53 100644
--- a/api/src/org/apache/cloudstack/api/response/RegionResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/RegionResponse.java
@@ -18,10 +18,13 @@ package org.apache.cloudstack.api.response;
 
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.EntityReference;
+import org.apache.cloudstack.region.Region;
 
 import com.cloud.serializer.Param;
 import com.google.gson.annotations.SerializedName;
 
+@EntityReference(value = Region.class)
 public class RegionResponse extends BaseResponse {
     @SerializedName(ApiConstants.ID) @Param(description="the ID of the region")
     private Integer id;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/api/src/org/apache/cloudstack/region/Region.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/region/Region.java b/api/src/org/apache/cloudstack/region/Region.java
new file mode 100644
index 0000000..7f0aeea
--- /dev/null
+++ b/api/src/org/apache/cloudstack/region/Region.java
@@ -0,0 +1,35 @@
+// 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.region;
+
+/**
+ *
+ */
+public interface Region  {
+    
+    public int getId();
+
+	public String getName();
+
+	public void setName(String name);
+
+	public String getEndPoint();
+	
+	public String getApiKey();
+	
+	public String getSecretKey();
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/api/src/org/apache/cloudstack/region/RegionService.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/region/RegionService.java b/api/src/org/apache/cloudstack/region/RegionService.java
new file mode 100644
index 0000000..8679ca9
--- /dev/null
+++ b/api/src/org/apache/cloudstack/region/RegionService.java
@@ -0,0 +1,157 @@
+// 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.region;
+
+import java.util.List;
+
+import org.apache.cloudstack.api.command.admin.account.DeleteAccountCmd;
+import org.apache.cloudstack.api.command.admin.account.DisableAccountCmd;
+import org.apache.cloudstack.api.command.admin.account.EnableAccountCmd;
+import org.apache.cloudstack.api.command.admin.account.UpdateAccountCmd;
+import org.apache.cloudstack.api.command.admin.domain.DeleteDomainCmd;
+import org.apache.cloudstack.api.command.admin.domain.UpdateDomainCmd;
+import org.apache.cloudstack.api.command.admin.user.DeleteUserCmd;
+import org.apache.cloudstack.api.command.admin.user.DisableUserCmd;
+import org.apache.cloudstack.api.command.admin.user.EnableUserCmd;
+import org.apache.cloudstack.api.command.admin.user.UpdateUserCmd;
+import org.apache.cloudstack.api.command.user.region.ListRegionsCmd;
+
+import com.cloud.domain.Domain;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+import com.cloud.user.UserAccount;
+
+
+public interface RegionService {
+	/**
+	 * Adds a Region to the local Region
+	 * @param id
+	 * @param name
+	 * @param endPoint
+	 * @param apiKey
+	 * @param secretKey
+	 * @return Return added Region object
+	 */
+	public Region addRegion(int id, String name, String endPoint, String apiKey, String secretKey);
+	
+	/**
+	 * Update details of the Region with specified Id
+	 * @param id
+	 * @param name
+	 * @param endPoint
+	 * @param apiKey
+	 * @param secretKey
+	 * @return Return updated Region object
+	 */
+	public Region updateRegion(int id, String name, String endPoint, String apiKey, String secretKey);
+	
+	/**
+	 * @param id
+	 * @return True if region is successfully removed
+	 */
+	public boolean removeRegion(int id);
+	
+	/** List all Regions or by Id/Name
+	 * @param id
+	 * @param name
+	 * @return List of Regions
+	 */
+	public List<? extends Region> listRegions(ListRegionsCmd cmd);
+	
+    /**
+     * Deletes a user by userId
+     * isPopagate flag is set to true if sent from peer Region
+     * @param cmd
+     *
+     * @return true if delete was successful, false otherwise
+     */
+	boolean deleteUserAccount(DeleteAccountCmd cmd);
+	
+    /**
+     * Updates an account
+     * isPopagate falg is set to true if sent from peer Region 
+     *
+     * @param cmd
+     *            - the parameter containing accountId or account nameand domainId
+     * @return updated account object
+     */
+    Account updateAccount(UpdateAccountCmd cmd);
+	
+	/**
+	 * Disables an account by accountName and domainId or accountId
+	 * @param cmd
+	 * @return
+	 * @throws ResourceUnavailableException 
+	 * @throws ConcurrentOperationException 
+	 */
+	Account disableAccount(DisableAccountCmd cmd) throws ConcurrentOperationException, ResourceUnavailableException;
+	
+	/**
+	 * Enables an account by accountId
+	 * @param cmd
+	 * @return
+	 */
+	Account enableAccount(EnableAccountCmd cmd);
+
+    /**
+     * Deletes user by Id
+     * @param deleteUserCmd
+     * @return true if delete was successful, false otherwise
+     */
+    boolean deleteUser(DeleteUserCmd deleteUserCmd); 	
+    
+    /**
+     * update an existing domain
+     * 
+     * @param cmd
+     *            - the command containing domainId and new domainName
+     * @return Domain object if the command succeeded
+     */
+	public Domain updateDomain(UpdateDomainCmd updateDomainCmd);    
+    
+	/**
+	 * Deletes domain
+	 * @param cmd
+	 * @return true if delete was successful, false otherwise
+	 */
+	public boolean deleteDomain(DeleteDomainCmd cmd);
+	
+    /**
+     * Update a user by userId
+     *
+     * @param userId
+     * @return UserAccount object
+     */
+	public UserAccount updateUser(UpdateUserCmd updateUserCmd);
+	
+    /**
+     * Disables a user by userId
+     *
+     * @param cmd
+     * @return UserAccount object
+     */
+	public UserAccount disableUser(DisableUserCmd cmd);
+	
+    /**
+     * Enables a user
+     *
+     * @param cmd
+     * @return UserAccount object
+     */
+	public UserAccount enableUser(EnableUserCmd cmd);
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/api/src/org/apache/cloudstack/region/RegionSync.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/region/RegionSync.java b/api/src/org/apache/cloudstack/region/RegionSync.java
new file mode 100644
index 0000000..5a1f5a6
--- /dev/null
+++ b/api/src/org/apache/cloudstack/region/RegionSync.java
@@ -0,0 +1,33 @@
+// 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.region;
+
+import java.util.Date;
+
+/**
+ *
+ */
+public interface RegionSync  {
+    
+    public long getId();
+    
+    public int getRegionId();
+    
+	public String getApi();
+
+	Date getCreateDate();
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/client/tomcatconf/components.xml.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/components.xml.in b/client/tomcatconf/components.xml.in
index 99b8430..c45d14e 100755
--- a/client/tomcatconf/components.xml.in
+++ b/client/tomcatconf/components.xml.in
@@ -271,7 +271,7 @@ under the License.
         <dao name="Site2SiteCustomerGatewayDao" class="com.cloud.network.dao.Site2SiteCustomerGatewayDaoImpl" singleton="false"/>
         <dao name="Site2SiteVpnGatewayDao" class="com.cloud.network.dao.Site2SiteVpnGatewayDaoImpl" singleton="false"/>
         <dao name="Site2SiteVpnConnectionDao" class="com.cloud.network.dao.Site2SiteVpnConnectionDaoImpl" singleton="false"/>
-        <dao name="RegionDao" class="com.cloud.region.dao.RegionDaoImpl" singleton="false"/>
+        <dao name="RegionDao" class="org.apache.cloudstack.region.dao.RegionDaoImpl" singleton="false"/>
     </configuration-server>
     
     <awsapi-ec2server class="com.cloud.bridge.service.EC2MainServlet">

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java
index 86f0ea3..8c5ed27 100755
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -136,6 +136,8 @@ import org.apache.cloudstack.api.response.VpnUsersResponse;
 import org.apache.cloudstack.api.response.ZoneResponse;
 
 import org.apache.cloudstack.api.response.S3Response;
+import org.apache.cloudstack.region.Region;
+
 import com.cloud.async.AsyncJob;
 import com.cloud.capacity.Capacity;
 import com.cloud.capacity.CapacityVO;
@@ -205,7 +207,6 @@ import com.cloud.org.Cluster;
 import com.cloud.projects.Project;
 import com.cloud.projects.ProjectAccount;
 import com.cloud.projects.ProjectInvitation;
-import com.cloud.region.Region;
 import com.cloud.server.Criteria;
 import com.cloud.server.ResourceTag;
 import com.cloud.server.ResourceTag.TaggedResourceType;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/server/src/com/cloud/api/ApiServer.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiServer.java b/server/src/com/cloud/api/ApiServer.java
index d2d0712..cb2f414 100755
--- a/server/src/com/cloud/api/ApiServer.java
+++ b/server/src/com/cloud/api/ApiServer.java
@@ -105,6 +105,7 @@ import org.apache.cloudstack.api.command.user.tag.ListTagsCmd;
 import com.cloud.api.response.ApiResponseSerializer;
 import org.apache.cloudstack.api.response.ExceptionResponse;
 import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.region.RegionManager;
 
 import com.cloud.async.AsyncCommandQueued;
 import com.cloud.async.AsyncJob;
@@ -122,7 +123,6 @@ import com.cloud.exception.CloudAuthenticationException;
 import com.cloud.exception.InsufficientCapacityException;
 import com.cloud.exception.InvalidParameterValueException;
 import com.cloud.exception.PermissionDeniedException;
-import com.cloud.region.RegionManager;
 import com.cloud.exception.RequestLimitException;
 import com.cloud.exception.ResourceAllocationException;
 import com.cloud.exception.ResourceUnavailableException;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/server/src/com/cloud/configuration/DefaultComponentLibrary.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/DefaultComponentLibrary.java b/server/src/com/cloud/configuration/DefaultComponentLibrary.java
index 9fcfb81..61e79a6 100755
--- a/server/src/com/cloud/configuration/DefaultComponentLibrary.java
+++ b/server/src/com/cloud/configuration/DefaultComponentLibrary.java
@@ -21,6 +21,10 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.cloudstack.region.RegionManagerImpl;
+import org.apache.cloudstack.region.dao.RegionDaoImpl;
+import org.apache.cloudstack.region.dao.RegionSyncDaoImpl;
+
 import com.cloud.agent.manager.ClusteredAgentManagerImpl;
 import com.cloud.alert.AlertManagerImpl;
 import com.cloud.alert.dao.AlertDaoImpl;
@@ -158,9 +162,6 @@ import com.cloud.projects.ProjectManagerImpl;
 import com.cloud.projects.dao.ProjectAccountDaoImpl;
 import com.cloud.projects.dao.ProjectDaoImpl;
 import com.cloud.projects.dao.ProjectInvitationDaoImpl;
-import com.cloud.region.RegionManagerImpl;
-import com.cloud.region.dao.RegionDaoImpl;
-import com.cloud.region.dao.RegionSyncDaoImpl;
 import com.cloud.resource.ResourceManagerImpl;
 import com.cloud.resourcelimit.ResourceLimitManagerImpl;
 import com.cloud.service.dao.ServiceOfferingDaoImpl;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/server/src/com/cloud/domain/dao/DomainDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/domain/dao/DomainDaoImpl.java b/server/src/com/cloud/domain/dao/DomainDaoImpl.java
index ecf8325..b3a1706 100644
--- a/server/src/com/cloud/domain/dao/DomainDaoImpl.java
+++ b/server/src/com/cloud/domain/dao/DomainDaoImpl.java
@@ -29,7 +29,6 @@ import org.apache.log4j.Logger;
 
 import com.cloud.domain.Domain;
 import com.cloud.domain.DomainVO;
-import com.cloud.region.RegionManager;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.GenericDaoBase;
 import com.cloud.utils.db.SearchBuilder;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/server/src/com/cloud/region/RegionAccount.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/region/RegionAccount.java b/server/src/com/cloud/region/RegionAccount.java
deleted file mode 100644
index cb94210..0000000
--- a/server/src/com/cloud/region/RegionAccount.java
+++ /dev/null
@@ -1,287 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.region;
-
-import com.cloud.user.AccountVO;
-
-public class RegionAccount extends AccountVO {
-    String accountUuid;
-    String domainUuid;
-	String domain;
-	String receivedbytes;
-	String sentbytes;
-	String vmlimit;
-	String vmtotal;
-	String vmavailable;
-	String iplimit;
-	String iptotal;
-	String ipavailable;
-	String volumelimit;
-	String volumetotal;
-	String volumeavailable;
-	String snapshotlimit;
-	String snapshottotal;
-	String snapshotavailable;
-	String templatelimit;
-	String templatetotal;
-	String templateavailable;
-	String vmstopped;
-	String vmrunning;
-	String projectlimit;
-	String projecttotal;
-	String projectavailable;
-	String networklimit;
-	String networktotal;
-	String networkavailable;
-	RegionUser user;
-
-	public RegionAccount() {
-    }
-    
-    public String getAccountuuid() {
-		return accountUuid;
-	}
-
-	public void setAccountuuid(String accountUuid) {
-		this.accountUuid = accountUuid;
-	}
-
-	public String getDomainUuid() {
-		return domainUuid;
-	}
-
-	public void setDomainUuid(String domainUuid) {
-		this.domainUuid = domainUuid;
-	}
-
-	public String getDomain() {
-		return domain;
-	}
-
-	public void setDomain(String domain) {
-		this.domain = domain;
-	}
-
-	public String getReceivedbytes() {
-		return receivedbytes;
-	}
-
-	public void setReceivedbytes(String receivedbytes) {
-		this.receivedbytes = receivedbytes;
-	}
-
-	public String getSentbytes() {
-		return sentbytes;
-	}
-
-	public void setSentbytes(String sentbytes) {
-		this.sentbytes = sentbytes;
-	}
-
-	public String getVmlimit() {
-		return vmlimit;
-	}
-
-	public void setVmlimit(String vmlimit) {
-		this.vmlimit = vmlimit;
-	}
-
-	public String getVmtotal() {
-		return vmtotal;
-	}
-
-	public void setVmtotal(String vmtotal) {
-		this.vmtotal = vmtotal;
-	}
-
-	public String getVmavailable() {
-		return vmavailable;
-	}
-
-	public void setVmavailable(String vmavailable) {
-		this.vmavailable = vmavailable;
-	}
-
-	public String getIplimit() {
-		return iplimit;
-	}
-
-	public void setIplimit(String iplimit) {
-		this.iplimit = iplimit;
-	}
-
-	public String getIptotal() {
-		return iptotal;
-	}
-
-	public void setIptotal(String iptotal) {
-		this.iptotal = iptotal;
-	}
-
-	public String getIpavailable() {
-		return ipavailable;
-	}
-
-	public void setIpavailable(String ipavailable) {
-		this.ipavailable = ipavailable;
-	}
-
-	public String getVolumelimit() {
-		return volumelimit;
-	}
-
-	public void setVolumelimit(String volumelimit) {
-		this.volumelimit = volumelimit;
-	}
-
-	public String getVolumetotal() {
-		return volumetotal;
-	}
-
-	public void setVolumetotal(String volumetotal) {
-		this.volumetotal = volumetotal;
-	}
-
-	public String getVolumeavailable() {
-		return volumeavailable;
-	}
-
-	public void setVolumeavailable(String volumeavailable) {
-		this.volumeavailable = volumeavailable;
-	}
-
-	public String getSnapshotlimit() {
-		return snapshotlimit;
-	}
-
-	public void setSnapshotlimit(String snapshotlimit) {
-		this.snapshotlimit = snapshotlimit;
-	}
-
-	public String getSnapshottotal() {
-		return snapshottotal;
-	}
-
-	public void setSnapshottotal(String snapshottotal) {
-		this.snapshottotal = snapshottotal;
-	}
-
-	public String getSnapshotavailable() {
-		return snapshotavailable;
-	}
-
-	public void setSnapshotavailable(String snapshotavailable) {
-		this.snapshotavailable = snapshotavailable;
-	}
-
-	public String getTemplatelimit() {
-		return templatelimit;
-	}
-
-	public void setTemplatelimit(String templatelimit) {
-		this.templatelimit = templatelimit;
-	}
-
-	public String getTemplatetotal() {
-		return templatetotal;
-	}
-
-	public void setTemplatetotal(String templatetotal) {
-		this.templatetotal = templatetotal;
-	}
-
-	public String getTemplateavailable() {
-		return templateavailable;
-	}
-
-	public void setTemplateavailable(String templateavailable) {
-		this.templateavailable = templateavailable;
-	}
-
-	public String getVmstopped() {
-		return vmstopped;
-	}
-
-	public void setVmstopped(String vmstopped) {
-		this.vmstopped = vmstopped;
-	}
-
-	public String getVmrunning() {
-		return vmrunning;
-	}
-
-	public void setVmrunning(String vmrunning) {
-		this.vmrunning = vmrunning;
-	}
-
-	public String getProjectlimit() {
-		return projectlimit;
-	}
-
-	public void setProjectlimit(String projectlimit) {
-		this.projectlimit = projectlimit;
-	}
-
-	public String getProjecttotal() {
-		return projecttotal;
-	}
-
-	public void setProjecttotal(String projecttotal) {
-		this.projecttotal = projecttotal;
-	}
-
-	public String getProjectavailable() {
-		return projectavailable;
-	}
-
-	public void setProjectavailable(String projectavailable) {
-		this.projectavailable = projectavailable;
-	}
-
-	public String getNetworklimit() {
-		return networklimit;
-	}
-
-	public void setNetworklimit(String networklimit) {
-		this.networklimit = networklimit;
-	}
-
-	public String getNetworktotal() {
-		return networktotal;
-	}
-
-	public void setNetworktotal(String networktotal) {
-		this.networktotal = networktotal;
-	}
-
-	public String getNetworkavailable() {
-		return networkavailable;
-	}
-
-	public void setNetworkavailable(String networkavailable) {
-		this.networkavailable = networkavailable;
-	}
-
-	public RegionUser getUser() {
-		return user;
-	}
-
-	public void setUser(RegionUser user) {
-		this.user = user;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/server/src/com/cloud/region/RegionDomain.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/region/RegionDomain.java b/server/src/com/cloud/region/RegionDomain.java
deleted file mode 100644
index de82654..0000000
--- a/server/src/com/cloud/region/RegionDomain.java
+++ /dev/null
@@ -1,61 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.region;
-
-import com.cloud.domain.DomainVO;
-
-public class RegionDomain extends DomainVO {
-    String accountUuid;
-    String parentUuid;
-    String parentdomainname;
-    Boolean haschild;
-
-	public RegionDomain() {
-    }
-    
-    public String getAccountuuid() {
-		return accountUuid;
-	}
-
-	public void setAccountuuid(String accountUuid) {
-		this.accountUuid = accountUuid;
-	}
-
-	public String getParentUuid() {
-		return parentUuid;
-	}
-
-	public void setParentUuid(String parentUuid) {
-		this.parentUuid = parentUuid;
-	}
-
-	public String getParentdomainname() {
-		return parentdomainname;
-	}
-
-	public void setParentdomainname(String parentdomainname) {
-		this.parentdomainname = parentdomainname;
-	}
-
-	public Boolean getHaschild() {
-		return haschild;
-	}
-
-	public void setHaschild(Boolean haschild) {
-		this.haschild = haschild;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/server/src/com/cloud/region/RegionManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/region/RegionManager.java b/server/src/com/cloud/region/RegionManager.java
deleted file mode 100644
index 437e02d..0000000
--- a/server/src/com/cloud/region/RegionManager.java
+++ /dev/null
@@ -1,30 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.region;
-
-import java.util.Map;
-
-public interface RegionManager {
-	public boolean propogateAddAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType, Long domainId, String networkDomain,
-            Map<String, String> details, String accountUUID, String userUUID);
-	public int getId();
-	public void setId(int id);
-	public void propogateAddUser(String userName, String password,
-			String firstName, String lastName, String email, String timeZone,
-			String accountName, String domainUUId, String userUUID);
-	public void propogateAddDomain(String name, Long parentId, String networkDomain, String uuid);
-}