incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kis...@apache.org
Subject [33/40] - Separated RegionServiceImpl and RegionManagerImpl - Added comments - Changed package name to org.apache.cloudstack.region
Date Fri, 01 Feb 2013 06:32:03 GMT
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/server/src/com/cloud/region/RegionManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/region/RegionManagerImpl.java b/server/src/com/cloud/region/RegionManagerImpl.java
deleted file mode 100755
index 988231e..0000000
--- a/server/src/com/cloud/region/RegionManagerImpl.java
+++ /dev/null
@@ -1,791 +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.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import javax.ejb.Local;
-import javax.naming.ConfigurationException;
-
-import org.apache.cloudstack.api.ApiConstants;
-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 org.apache.commons.httpclient.NameValuePair;
-import org.apache.log4j.Logger;
-
-import com.cloud.domain.Domain;
-import com.cloud.domain.DomainVO;
-import com.cloud.domain.dao.DomainDao;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.region.dao.RegionDao;
-import com.cloud.region.dao.RegionSyncDao;
-import com.cloud.user.Account;
-import com.cloud.user.AccountManager;
-import com.cloud.user.AccountVO;
-import com.cloud.user.DomainManager;
-import com.cloud.user.UserAccount;
-import com.cloud.user.UserVO;
-import com.cloud.user.dao.AccountDao;
-import com.cloud.user.dao.UserAccountDao;
-import com.cloud.user.dao.UserDao;
-import com.cloud.utils.component.Inject;
-import com.cloud.utils.component.Manager;
-import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.uuididentity.dao.IdentityDao;
-
-@Local(value = { RegionManager.class, RegionService.class })
-public class RegionManagerImpl implements RegionManager, RegionService, Manager{
-    public static final Logger s_logger = Logger.getLogger(RegionManagerImpl.class);
-    
-    @Inject
-    private RegionDao _regionDao;
-    @Inject
-    private AccountDao _accountDao;
-    @Inject
-    private AccountManager _accountMgr;
-    @Inject
-    private UserDao _userDao;
-    @Inject
-    private DomainDao _domainDao;
-    @Inject
-    private DomainManager _domainMgr;
-    @Inject
-    private UserAccountDao _userAccountDao;    
-    @Inject
-    private IdentityDao _identityDao;
-    @Inject
-    private RegionSyncDao _regionSyncDao;
-    
-    private String _name;
-    private int _id; 
-    
-    @Override
-    public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
-        _name = name;
-        _id = _regionDao.getRegionId();
-        return true;
-    }
-    
-    @Override
-    public boolean start() {
-        return true;
-    }
-
-    @Override
-    public boolean stop() {
-        return true;
-    }
-
-    @Override
-    public String getName() {
-        return _name;
-    }
-
-	@Override
-	public Region addRegion(int id, String name, String endPoint, String apiKey, String secretKey) {
-		if( _regionDao.findById(id) == null ){
-			RegionVO region = new RegionVO(id, name, endPoint, apiKey, secretKey);
-			return _regionDao.persist(region);
-		} else {
-			throw new InvalidParameterValueException("Region with id: "+id+" already exists");
-		}
-	}
-
-	@Override
-	public Region updateRegion(int id, String name, String endPoint, String apiKey, String secretKey) {
-		RegionVO region = _regionDao.findById(id);
-		
-		if(region == null){
-			throw new InvalidParameterValueException("Region with id: "+id+" does not exist");
-		}
-		
-		if(name != null){
-			region.setName(name);
-		}
-		
-		if(endPoint != null){
-			region.setEndPoint(endPoint);
-		}
-		
-		if(apiKey != null){
-			region.setApiKey(apiKey);
-		}
-		
-		if(secretKey != null){
-			region.setSecretKey(secretKey);
-		}
-		
-		_regionDao.update(id, region);
-		return _regionDao.findById(id);
-	}
-
-	@Override
-	public boolean removeRegion(int id) {
-		RegionVO region = _regionDao.findById(id);
-		if(region != null){
-			return _regionDao.remove(id);
-		} else {
-			throw new InvalidParameterValueException("Failed to delete Region: " + id + ", Region not found");
-		}
-	}
-
-	@Override
-	public List<RegionVO> listRegions(ListRegionsCmd cmd) {
-		if(cmd.getId() != null){
-			List<RegionVO> regions = new ArrayList<RegionVO>();
-			regions.add(_regionDao.findById(cmd.getId()));
-			return regions;
-		}
-		return _regionDao.listAll();
-	}
-    
-	public int getId() {
-		return _id;
-	}
-
-	public void setId(int _id) {
-		this._id = _id;
-	}
-	
-	@Override
-	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) {
-		String command = "createAccount";
-		List<NameValuePair> params = new ArrayList<NameValuePair>();
-		params.add(new NameValuePair(ApiConstants.USERNAME, userName));
-		params.add(new NameValuePair(ApiConstants.PASSWORD, password));
-		params.add(new NameValuePair(ApiConstants.FIRSTNAME, firstName));
-		params.add(new NameValuePair(ApiConstants.LASTNAME, lastName));
-		params.add(new NameValuePair(ApiConstants.EMAIL, email));
-		params.add(new NameValuePair(ApiConstants.TIMEZONE, timezone));
-		params.add(new NameValuePair(ApiConstants.ACCOUNT, accountName));
-		params.add(new NameValuePair(ApiConstants.ACCOUNT_TYPE, ""+accountType));
-		//use domain UUID
-		params.add(new NameValuePair(ApiConstants.DOMAIN_ID, ((domainId != null) ? domainId.toString() : "")));
-		params.add(new NameValuePair(ApiConstants.NETWORK_DOMAIN, networkDomain));
-		params.add(new NameValuePair(ApiConstants.ACCOUNT_DETAILS, (details != null) ? details.toString() : ""));
-		params.add(new NameValuePair(ApiConstants.ACCOUNT_ID, accountUUID));
-		params.add(new NameValuePair(ApiConstants.USER_ID, userUUID));
-		params.add(new NameValuePair(ApiConstants.REGION_ID, ""+getId()));
-
-		List<RegionVO> regions =  _regionDao.listAll();
-		for (Region region : regions){
-			if(region.getId() == getId()){
-				continue;
-			}
-			s_logger.debug("Adding account :"+accountName+" to Region: "+region.getId());
-			if (RegionsApiUtil.makeAPICall(region, command, params)) {
-				s_logger.debug("Successfully added account :"+accountName+" to Region: "+region.getId());
-			} else {
-				addRegionSyncItem(region.getId(), command, params);
-				s_logger.error("Error while Adding account :"+accountName+" to Region: "+region.getId());
-			}
-		}
-		return true;
-	}
-
-	@Override
-	public boolean deleteUserAccount(long accountId) {
-		AccountVO account = _accountDao.findById(accountId);
-		if(account == null){
-			return false;
-		}
-		String accountUUID = account.getUuid();
-		int regionId = account.getRegionId();
-		
-		String command = "deleteAccount";
-		List<NameValuePair> params = new ArrayList<NameValuePair>();
-		params.add(new NameValuePair(ApiConstants.ID, accountUUID));
-
-		if(getId() == regionId){
-			if(_accountMgr.deleteUserAccount(accountId)){
-				List<RegionVO> regions =  _regionDao.listAll();
-				for (Region region : regions){
-					if(region.getId() == getId()){
-						continue;
-					}
-					params.add(new NameValuePair(ApiConstants.IS_PROPAGATE, "true"));
-					if (RegionsApiUtil.makeAPICall(region, command, params)) {
-						s_logger.debug("Successfully deleted account :"+accountUUID+" in Region: "+region.getId());
-					} else {
-						s_logger.error("Error while deleting account :"+accountUUID+" in Region: "+region.getId());
-					}
-				}
-				return true;
-			} else {
-				return false;
-			}
-		} else {
-			//First delete in the Region where account is created
-			Region region = _regionDao.findById(regionId);
-			if (RegionsApiUtil.makeAPICall(region, command, params)) {
-				s_logger.debug("Successfully deleted account :"+accountUUID+" in Region: "+region.getId());
-				return true;
-			} else {
-				s_logger.error("Error while deleting account :"+accountUUID+" in Region: "+region.getId());
-				return false;
-			}
-		}
-	}
-	
-	@Override
-	public Account updateAccount(UpdateAccountCmd cmd) {
-        Long accountId = cmd.getId();
-        Long domainId = cmd.getDomainId();
-        DomainVO domain = _domainDao.findById(domainId);
-        String accountName = cmd.getAccountName();
-        String newAccountName = cmd.getNewName();
-        String networkDomain = cmd.getNetworkDomain();
-        //ToDo send details
-        Map<String, String> details = cmd.getDetails();
-        
-        Account account = null;
-        if (accountId != null) {
-            account = _accountDao.findById(accountId);
-        } else {
-            account = _accountDao.findEnabledAccount(accountName, domainId);
-        }
-
-        // Check if account exists
-        if (account == null || account.getType() == Account.ACCOUNT_TYPE_PROJECT) {
-            s_logger.error("Unable to find account by accountId: " + accountId + " OR by name: " + accountName + " in domain " + domainId);
-            throw new InvalidParameterValueException("Unable to find account by accountId: " + accountId + " OR by name: " + accountName + " in domain " + domainId);
-        }
-        
-        String command = "updateAccount";
-		List<NameValuePair> params = new ArrayList<NameValuePair>();
-		params.add(new NameValuePair(ApiConstants.NEW_NAME, newAccountName));
-		params.add(new NameValuePair(ApiConstants.ID, account.getUuid()));
-		params.add(new NameValuePair(ApiConstants.ACCOUNT, accountName));
-		params.add(new NameValuePair(ApiConstants.DOMAIN_ID, domain.getUuid()));
-		params.add(new NameValuePair(ApiConstants.NETWORK_DOMAIN, networkDomain));
-		params.add(new NameValuePair(ApiConstants.NEW_NAME, newAccountName));
-		if(details != null){
-			params.add(new NameValuePair(ApiConstants.ACCOUNT_DETAILS, details.toString()));
-		}
-		int regionId = account.getRegionId();
-		if(getId() == regionId){
-			Account updatedAccount = _accountMgr.updateAccount(cmd);
-			if(updatedAccount != null){
-				List<RegionVO> regions =  _regionDao.listAll();
-				for (Region region : regions){
-					if(region.getId() == getId()){
-						continue;
-					}
-					params.add(new NameValuePair(ApiConstants.IS_PROPAGATE, "true"));
-					if (RegionsApiUtil.makeAPICall(region, command, params)) {
-						s_logger.debug("Successfully updated account :"+account.getUuid()+" in Region: "+region.getId());
-					} else {
-						s_logger.error("Error while updating account :"+account.getUuid()+" in Region: "+region.getId());
-					}
-				}
-			}
-			return updatedAccount;
-		} else {
-			//First update in the Region where account is created
-			Region region = _regionDao.findById(regionId);
-			RegionAccount updatedAccount = RegionsApiUtil.makeAccountAPICall(region, command, params);
-			if (updatedAccount != null) {
-				Long id = _identityDao.getIdentityId("account", updatedAccount.getUuid());
-				updatedAccount.setId(id);
-				Long domainID = _identityDao.getIdentityId("domain", updatedAccount.getDomainUuid());
-				updatedAccount.setDomainId(domainID);
-				s_logger.debug("Successfully updated account :"+account.getUuid()+" in source Region: "+region.getId());
-				return updatedAccount;
-			} else {
-				throw new CloudRuntimeException("Error while updating account :"+account.getUuid()+" in source Region: "+region.getId());
-			}
-		}
-	}
-
-	@Override
-	public Account disableAccount(String accountName, Long domainId, Long accountId, Boolean lockRequested) throws ConcurrentOperationException, ResourceUnavailableException {
-		Account account = null;
-        if (accountId != null) {
-            account = _accountDao.findById(accountId);
-        } else {
-            account = _accountDao.findActiveAccount(accountName, domainId);
-        }
-
-        if (account == null || account.getType() == Account.ACCOUNT_TYPE_PROJECT) {
-            throw new InvalidParameterValueException("Unable to find active account by accountId: " + accountId + " OR by name: " + accountName + " in domain " + domainId);
-        }
-		String accountUUID = account.getUuid();
-		
-		String command = "disableAccount";
-		List<NameValuePair> params = new ArrayList<NameValuePair>();
-		params.add(new NameValuePair(ApiConstants.LOCK, lockRequested.toString()));
-		params.add(new NameValuePair(ApiConstants.ID, accountUUID));
-		DomainVO domain = _domainDao.findById(domainId);
-		if(domain != null){		
-			params.add(new NameValuePair(ApiConstants.DOMAIN_ID, domain.getUuid()));
-		}
-		
-		int regionId = account.getRegionId();
-		if(getId() == regionId){
-			Account retAccount = null;
-			if(lockRequested){
-				retAccount = _accountMgr.lockAccount(accountName, domainId, accountId);
-			} else {
-				retAccount = _accountMgr.disableAccount(accountName, domainId, accountId);
-			}
-			if(retAccount != null){
-				List<RegionVO> regions =  _regionDao.listAll();
-				for (Region region : regions){
-					if(region.getId() == getId()){
-						continue;
-					}
-					params.add(new NameValuePair(ApiConstants.IS_PROPAGATE, "true"));
-					if (RegionsApiUtil.makeAPICall(region, command, params)) {
-						s_logger.debug("Successfully disabled account :"+accountUUID+" in Region: "+region.getId());
-					} else {
-						s_logger.error("Error while disabling account :"+accountUUID+" in Region: "+region.getId());
-					}
-				}
-			}
-			return retAccount;
-		} else {
-			//First disable account in the Region where account is created
-			Region region = _regionDao.findById(regionId);
-			Account retAccount = RegionsApiUtil.makeAccountAPICall(region, command, params);
-			if (retAccount != null) {
-				s_logger.debug("Successfully disabled account :"+accountUUID+" in source Region: "+region.getId());
-				return retAccount;
-			} else {
-				throw new CloudRuntimeException("Error while disabling account :"+accountUUID+" in source Region: "+region.getId());
-			}
-		}
-	}
-
-	@Override
-	public Account enableAccount(String accountName, Long domainId, Long accountId) {
-        // Check if account exists
-        Account account = null;
-        if (accountId != null) {
-            account = _accountDao.findById(accountId);
-        } else {
-            account = _accountDao.findActiveAccount(accountName, domainId);
-        }
-
-        if (account == null || account.getType() == Account.ACCOUNT_TYPE_PROJECT) {
-            throw new InvalidParameterValueException("Unable to find account by accountId: " + accountId + " OR by name: " + accountName + " in domain " + domainId);
-        }
-        String accountUUID = account.getUuid();
-        
-        String command = "enableAccount";
-		List<NameValuePair> params = new ArrayList<NameValuePair>();
-		params.add(new NameValuePair(ApiConstants.ID, accountUUID));
-		params.add(new NameValuePair(ApiConstants.ACCOUNT, accountName));
-        DomainVO domain = _domainDao.findById(domainId);
-		if(domain != null){
-			params.add(new NameValuePair(ApiConstants.DOMAIN_ID, domain.getUuid()));
-		}
-		
-		int regionId = account.getRegionId();
-		if(getId() == regionId){
-			Account retAccount = _accountMgr.enableAccount(accountName, domainId, accountId);
-			if(retAccount != null){
-				List<RegionVO> regions =  _regionDao.listAll();
-
-				for (Region region : regions){
-					if(region.getId() == getId()){
-						continue;
-					}
-					params.add(new NameValuePair(ApiConstants.IS_PROPAGATE, "true"));
-					if (RegionsApiUtil.makeAPICall(region, command, params)) {
-						s_logger.debug("Successfully enabled account :"+accountUUID+" in Region: "+region.getId());
-					} else {
-						s_logger.error("Error while enabling account :"+accountUUID+" in Region: "+region.getId());
-					}
-				}
-			}
-			return retAccount;
-		} else {
-			//First disable account in the Region where account is created
-			Region region = _regionDao.findById(regionId);
-			Account retAccount = RegionsApiUtil.makeAccountAPICall(region, command, params);
-			if (retAccount != null) {
-				s_logger.debug("Successfully enabled account :"+accountUUID+" in source Region: "+region.getId());
-				return retAccount;
-			} else {
-				throw new CloudRuntimeException("Error while enabling account :"+accountUUID+" in source Region: "+region.getId());
-			}
-		}
-	}
-
-	@Override
-	public boolean deleteUser(DeleteUserCmd cmd) {
-        long id = cmd.getId();
-
-        UserVO user = _userDao.findById(id);
-
-        if (user == null) {
-            throw new InvalidParameterValueException("The specified user doesn't exist in the system");
-        }
-		
-		String userUUID = user.getUuid();
-		int regionId = user.getRegionId();
-		
-		String command = "deleteUser";
-		List<NameValuePair> params = new ArrayList<NameValuePair>();
-		params.add(new NameValuePair(ApiConstants.ID, userUUID));
-		
-		if(getId() == regionId){
-			if(_accountMgr.deleteUser(cmd)){
-				List<RegionVO> regions =  _regionDao.listAll();
-				for (Region region : regions){
-					if(region.getId() == getId()){
-						continue;
-					}
-					params.add(new NameValuePair(ApiConstants.IS_PROPAGATE, "true"));
-					if (RegionsApiUtil.makeAPICall(region, command, params)) {
-						s_logger.debug("Successfully deleted user :"+userUUID+" in Region: "+region.getId());
-					} else {
-						s_logger.error("Error while deleting account :"+userUUID+" in Region: "+region.getId());
-					}
-				}
-				return true;
-			} else {
-				return false;
-			}
-		} else {
-			//First delete in the Region where account is created
-			Region region = _regionDao.findById(regionId);
-			if (RegionsApiUtil.makeAPICall(region, command, params)) {
-				s_logger.debug("Successfully deleted user :"+userUUID+" in source Region: "+region.getId());
-				return true;
-			} else {
-				s_logger.error("Error while deleting user :"+userUUID+" in source Region: "+region.getId());
-				return false;
-			}
-		}
-	}
-
-	@Override
-	public boolean deleteDomain(Long id, Boolean cleanup) {
-
-		DomainVO domain = _domainDao.findById(id);
-		if(domain == null){
-			throw new InvalidParameterValueException("The specified domain doesn't exist in the system");
-		}
-		String domainUUID = domain.getUuid();
-		
-		String command = "deleteDomain";
-		List<NameValuePair> params = new ArrayList<NameValuePair>();
-		params.add(new NameValuePair(ApiConstants.ID, domainUUID));
-		params.add(new NameValuePair(ApiConstants.CLEANUP, cleanup.toString()));
-		
-        int regionId = domain.getRegionId();
-		if(getId() == regionId){
-			if(_domainMgr.deleteDomain(id, cleanup)){
-				List<RegionVO> regions =  _regionDao.listAll();
-				for (Region region : regions){
-					if(region.getId() == getId()){
-						continue;
-					}
-					params.add(new NameValuePair(ApiConstants.IS_PROPAGATE, "true"));
-					if (RegionsApiUtil.makeAPICall(region, command, params)) {
-						s_logger.debug("Successfully deleted domain :"+domainUUID+" in Region: "+region.getId());
-					} else {
-						s_logger.error("Error while deleting domain :"+domainUUID+" in Region: "+region.getId());
-					}
-				}
-				return true;
-			} else {
-				return false;
-			}
-		} else {
-			//First delete in the Region where domain is created
-			Region region = _regionDao.findById(regionId);
-			if (RegionsApiUtil.makeAPICall(region, command, params)) {
-				s_logger.debug("Successfully deleted domain :"+domainUUID+" in Region: "+region.getId());
-				return true;
-			} else {
-				s_logger.error("Error while deleting domain :"+domainUUID+" in Region: "+region.getId());
-				return false;
-			}
-		}
-	}
-
-	@Override
-	public UserAccount updateUser(UpdateUserCmd cmd){
-        long id = cmd.getId();
-
-        UserVO user = _userDao.findById(id);
-
-        if (user == null) {
-            throw new InvalidParameterValueException("The specified user doesn't exist in the system");
-        }
-		String userUUID = user.getUuid();
-		
-		String command = "updateUser";
-		List<NameValuePair> params = new ArrayList<NameValuePair>();
-		params.add(new NameValuePair(ApiConstants.ID, userUUID));
-		params.add(new NameValuePair(ApiConstants.API_KEY, cmd.getApiKey()));
-		params.add(new NameValuePair(ApiConstants.EMAIL, cmd.getEmail()));
-		params.add(new NameValuePair(ApiConstants.FIRSTNAME, cmd.getFirstname()));
-		params.add(new NameValuePair(ApiConstants.LASTNAME, cmd.getLastname()));
-		params.add(new NameValuePair(ApiConstants.PASSWORD, cmd.getPassword()));
-		params.add(new NameValuePair(ApiConstants.SECRET_KEY, cmd.getSecretKey()));
-		params.add(new NameValuePair(ApiConstants.TIMEZONE, cmd.getTimezone()));
-		params.add(new NameValuePair(ApiConstants.USERNAME, cmd.getUsername()));
-		
-		int regionId = user.getRegionId();
-		if(getId() == regionId){
-			UserAccount updateUser = _accountMgr.updateUser(cmd);
-			if(updateUser != null){
-				List<RegionVO> regions =  _regionDao.listAll();
-				for (Region region : regions){
-					if(region.getId() == getId()){
-						continue;
-					}
-					params.add(new NameValuePair(ApiConstants.IS_PROPAGATE, "true"));
-					if (RegionsApiUtil.makeAPICall(region, command, params)) {
-						s_logger.debug("Successfully updated user :"+userUUID+" in Region: "+region.getId());
-					} else {
-						s_logger.error("Error while updating user :"+userUUID+" in Region: "+region.getId());
-					}
-				}
-			}
-			return updateUser;
-		} else {
-			//First update in the Region where user was created
-			Region region = _regionDao.findById(regionId);
-			UserAccount updateUser = RegionsApiUtil.makeUserAccountAPICall(region, command, params);
-			if (updateUser != null) {
-				s_logger.debug("Successfully updated user :"+userUUID+" in source Region: "+region.getId());
-				return updateUser;
-			} else {
-				throw new CloudRuntimeException("Error while updating user :"+userUUID+" in source Region: "+region.getId());
-			}
-		}
-	}
-
-	@Override
-	public Domain updateDomain(UpdateDomainCmd cmd) {
-		long id = cmd.getId();
-		DomainVO domain = _domainDao.findById(id);
-		if(domain == null){
-			throw new InvalidParameterValueException("The specified domain doesn't exist in the system");
-		}
-		String domainUUID = domain.getUuid();
-		
-		String command = "updateDomain";
-		List<NameValuePair> params = new ArrayList<NameValuePair>();
-		params.add(new NameValuePair(ApiConstants.ID, domainUUID));
-		params.add(new NameValuePair(ApiConstants.NAME, cmd.getDomainName()));
-		params.add(new NameValuePair(ApiConstants.NETWORK_DOMAIN, cmd.getNetworkDomain()));
-		
-		int regionId = domain.getRegionId();
-		if(getId() == regionId){
-			Domain updatedDomain = _domainMgr.updateDomain(cmd);
-			if(updatedDomain != null){
-				List<RegionVO> regions =  _regionDao.listAll();
-				for (Region region : regions){
-					if(region.getId() == getId()){
-						continue;
-					}
-					params.add(new NameValuePair(ApiConstants.IS_PROPAGATE, "true"));
-					if (RegionsApiUtil.makeAPICall(region, command, params)) {
-						s_logger.debug("Successfully updated updatedDomain :"+domainUUID+" in Region: "+region.getId());
-					} else {
-						s_logger.error("Error while updating updatedDomain :"+domainUUID+" in Region: "+region.getId());
-					}
-				}
-			}
-			return updatedDomain;
-		} else {
-			//First update in the Region where domain was created
-			Region region = _regionDao.findById(regionId);
-			RegionDomain updatedDomain = RegionsApiUtil.makeDomainAPICall(region, command, params);
-			if (updatedDomain != null) {
-				Long parentId = _identityDao.getIdentityId("domain", updatedDomain.getParentUuid());
-				updatedDomain.setParent(parentId);
-				s_logger.debug("Successfully updated user :"+domainUUID+" in source Region: "+region.getId());
-				return (DomainVO)updatedDomain;
-			} else {
-				throw new CloudRuntimeException("Error while updating user :"+domainUUID+" in source Region: "+region.getId());
-			}
-		}
-	}
-
-	@Override
-	public UserAccount disableUser(Long userId) {
-        UserVO user = _userDao.findById(userId);
-        if (user == null || user.getRemoved() != null) {
-            throw new InvalidParameterValueException("Unable to find active user by id " + userId);
-        }
-        int regionId = user.getRegionId();
-        
-        String command = "disableUser";
-		List<NameValuePair> params = new ArrayList<NameValuePair>();
-		params.add(new NameValuePair(ApiConstants.ID, user.getUuid()));
-        
-		if(getId() == regionId){
-			UserAccount disabledUser = _accountMgr.disableUser(userId);
-			if(disabledUser != null){
-				List<RegionVO> regions =  _regionDao.listAll();
-				for (Region region : regions){
-					if(region.getId() == getId()){
-						continue;
-					}
-					params.add(new NameValuePair(ApiConstants.IS_PROPAGATE, "true"));
-					if (RegionsApiUtil.makeAPICall(region, command, params)) {
-						s_logger.debug("Successfully disabled user :"+user.getUuid()+" in Region: "+region.getId());
-					} else {
-						s_logger.error("Error while disabling user :"+user.getUuid()+" in Region: "+region.getId());
-					}
-				}
-			}
-			return disabledUser;
-		} else {
-			//First disable in the Region where user was created
-			Region region = _regionDao.findById(regionId);
-			UserAccount disabledUser = RegionsApiUtil.makeUserAccountAPICall(region, command, params);
-			if (disabledUser != null) {
-				s_logger.debug("Successfully disabled user :"+user.getUuid()+" in source Region: "+region.getId());
-				return disabledUser;
-			} else {
-				throw new CloudRuntimeException("Error while disabling user :"+user.getUuid()+" in source Region: "+region.getId());
-			}
-		}
-	}
-
-	@Override
-	public UserAccount enableUser(Long userId) {
-        UserVO user = _userDao.findById(userId);
-        if (user == null || user.getRemoved() != null) {
-            throw new InvalidParameterValueException("Unable to find active user by id " + userId);
-        }
-        int regionId = user.getRegionId();
-        
-        String command = "enableUser";
-		List<NameValuePair> params = new ArrayList<NameValuePair>();
-		params.add(new NameValuePair(ApiConstants.ID, user.getUuid()));
-        
-		if(getId() == regionId){
-			UserAccount enabledUser = _accountMgr.enableUser(userId);
-			if(enabledUser != null){
-				List<RegionVO> regions =  _regionDao.listAll();
-				for (Region region : regions){
-					if(region.getId() == getId()){
-						continue;
-					}
-					params.add(new NameValuePair(ApiConstants.IS_PROPAGATE, "true"));
-					if (RegionsApiUtil.makeAPICall(region, command, params)) {
-						s_logger.debug("Successfully enabled user :"+user.getUuid()+" in Region: "+region.getId());
-					} else {
-						s_logger.error("Error while disabling user :"+user.getUuid()+" in Region: "+region.getId());
-					}
-				}
-			}
-			return enabledUser;
-		} else {
-			//First enable in the Region where user was created
-			Region region = _regionDao.findById(regionId);
-			UserAccount enabledUser = RegionsApiUtil.makeUserAccountAPICall(region, command, params);
-			if (enabledUser != null) {
-				s_logger.debug("Successfully enabled user :"+user.getUuid()+" in source Region: "+region.getId());
-				return enabledUser;
-			} else {
-				throw new CloudRuntimeException("Error while enabling user :"+user.getUuid()+" in source Region: "+region.getId());
-			}
-		}
-	}
-
-	@Override
-	public void propogateAddUser(String userName, String password,
-			String firstName, String lastName, String email, String timezone,
-			String accountName, String domainUUId, String userUUID) {
-		
-        String command = "createUser";
-		List<NameValuePair> params = new ArrayList<NameValuePair>();
-		params.add(new NameValuePair(ApiConstants.USERNAME, userName));
-		params.add(new NameValuePair(ApiConstants.PASSWORD, password));
-		params.add(new NameValuePair(ApiConstants.FIRSTNAME, firstName));
-		params.add(new NameValuePair(ApiConstants.LASTNAME, lastName));
-		params.add(new NameValuePair(ApiConstants.EMAIL, email));
-		params.add(new NameValuePair(ApiConstants.TIMEZONE, timezone));
-		params.add(new NameValuePair(ApiConstants.ACCOUNT, accountName));		
-		params.add(new NameValuePair(ApiConstants.DOMAIN_ID, domainUUId));
-		params.add(new NameValuePair(ApiConstants.USER_ID, userUUID));
-		params.add(new NameValuePair(ApiConstants.REGION_ID, ""+getId()));
-		
-		List<RegionVO> regions =  _regionDao.listAll();
-		for (Region region : regions){
-			if(region.getId() == getId()){
-				continue;
-			}
-			s_logger.debug("Adding account :"+accountName+" to Region: "+region.getId());
-			if (RegionsApiUtil.makeAPICall(region, command, params)) {
-				s_logger.debug("Successfully added user :"+userName+" to Region: "+region.getId());
-			} else {
-				addRegionSyncItem(region.getId(), command, params);
-				s_logger.error("Error while Adding user :"+userName+" to Region: "+region.getId());
-			}
-		}
-		return;		
-	}
-	
-	@Override
-	public void propogateAddDomain(String name, Long parentId, String networkDomain, String uuid) {
-		
-        String command = "createDomain";
-		List<NameValuePair> params = new ArrayList<NameValuePair>();
-		params.add(new NameValuePair(ApiConstants.NAME, name));
-		if(parentId != null){
-			DomainVO domain = _domainDao.findById(parentId);
-			if(domain != null){
-				params.add(new NameValuePair(ApiConstants.PARENT_DOMAIN_ID, domain.getUuid()));
-			}
-		}
-		params.add(new NameValuePair(ApiConstants.NETWORK_DOMAIN, networkDomain));
-		params.add(new NameValuePair(ApiConstants.DOMAIN_ID, uuid));
-		params.add(new NameValuePair(ApiConstants.REGION_ID, ""+getId()));
-		
-		List<RegionVO> regions =  _regionDao.listAll();
-		for (Region region : regions){
-			if(region.getId() == getId()){
-				continue;
-			}
-			s_logger.debug("Adding domain :"+name+" to Region: "+region.getId());
-			if (RegionsApiUtil.makeAPICall(region, command, params)) {
-				s_logger.debug("Successfully added domain :"+name+" to Region: "+region.getId());
-			} else {
-				addRegionSyncItem(region.getId(), command, params);
-				s_logger.error("Error while Adding domain :"+name+" to Region: "+region.getId());
-			}
-		}
-		return;		
-	}
-	
-	private void addRegionSyncItem(int regionId, String command, List<NameValuePair> params){
-		String api = RegionsApiUtil.buildParams(command, params);
-		RegionSyncVO sync = new RegionSyncVO(regionId, api);
-		if(_regionSyncDao.persist(sync) == null){
-			s_logger.error("Failed to add Region Sync Item. RegionId: "+regionId + "API command: "+api);
-		}
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/server/src/com/cloud/region/RegionSyncVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/region/RegionSyncVO.java b/server/src/com/cloud/region/RegionSyncVO.java
deleted file mode 100644
index fc3f423..0000000
--- a/server/src/com/cloud/region/RegionSyncVO.java
+++ /dev/null
@@ -1,93 +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;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import com.cloud.utils.db.GenericDao;
-
-
-@Entity
-@Table(name="region_sync")
-public class RegionSyncVO implements RegionSync {
-
-	@Id
-	@Column(name="id")
-	private long id;
-
-	@Column(name="region_id")
-	private int regionId;
-
-	@Column(name="api")
-	private String api;
-
-	@Column(name=GenericDao.CREATED_COLUMN)
-	private Date createDate;
-
-	@Column(name="processed")
-	boolean processed;
-
-	public RegionSyncVO() {
-	}
-
-	public RegionSyncVO(int regionId, String api) {
-		this.regionId = regionId;
-		this.api = api;
-	}
-
-	public int getRegionId() {
-		return regionId;
-	}
-
-	public void setRegionId(int regionId) {
-		this.regionId = regionId;
-	}
-
-	public String getApi() {
-		return api;
-	}
-
-	public void setApi(String api) {
-		this.api = api;
-	}
-
-	public Date getCreateDate() {
-		return createDate;
-	}
-
-	public void setCreateDate(Date createDate) {
-		this.createDate = createDate;
-	}
-
-	public boolean isProcessed() {
-		return processed;
-	}
-
-	public void setProcessed(boolean processed) {
-		this.processed = processed;
-	}
-
-	public long getId() {
-		return id;
-	}
-		
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/server/src/com/cloud/region/RegionUser.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/region/RegionUser.java b/server/src/com/cloud/region/RegionUser.java
deleted file mode 100644
index 8786558..0000000
--- a/server/src/com/cloud/region/RegionUser.java
+++ /dev/null
@@ -1,76 +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.UserVO;
-
-public class RegionUser extends UserVO {
-    String accountUuid;
-    String created;
-    String account;
-    String accounttype;
-    String domainid;
-    String domain;
-
-	public RegionUser() {
-    }
-    
-    public String getAccountuuid() {
-		return accountUuid;
-	}
-
-	public void setAccountuuid(String accountUuid) {
-		this.accountUuid = accountUuid;
-	}
-
-	public void setCreated(String created) {
-		this.created = created;
-	}
-
-	public String getAccount() {
-		return account;
-	}
-
-	public void setAccount(String account) {
-		this.account = account;
-	}
-
-	public String getAccounttype() {
-		return accounttype;
-	}
-
-	public void setAccounttype(String accounttype) {
-		this.accounttype = accounttype;
-	}
-
-	public String getDomainid() {
-		return domainid;
-	}
-
-	public void setDomainid(String domainid) {
-		this.domainid = domainid;
-	}
-
-	public String getDomain() {
-		return domain;
-	}
-
-	public void setDomain(String domain) {
-		this.domain = domain;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/server/src/com/cloud/region/RegionVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/region/RegionVO.java b/server/src/com/cloud/region/RegionVO.java
deleted file mode 100644
index a168f39..0000000
--- a/server/src/com/cloud/region/RegionVO.java
+++ /dev/null
@@ -1,93 +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 javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-
-@Entity
-@Table(name="region")
-public class RegionVO implements Region{
-
-    @Id
-    @Column(name="id")
-    private int id;
-    
-    @Column(name="name")
-    private String name;
-
-    @Column(name="end_point")
-    private String endPoint;
-    
-    @Column(name="api_key")
-    private String apiKey;
-    
-    @Column(name="secret_key")
-    private String secretKey;
-    
-    public RegionVO() {
-    }
-    
-    public RegionVO(int id, String name, String endPoint, String apiKey, String secretKey) {
-    	this.id = id;
-    	this.name = name;
-    	this.endPoint = endPoint;
-    	this.apiKey = apiKey;
-    	this.secretKey = secretKey;
-    }
-
-	public int getId() {
-		return id;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public String getEndPoint() {
-		return endPoint;
-	}
-
-	public void setEndPoint(String endPoint) {
-		this.endPoint = endPoint;
-	}
-
-	public String getApiKey() {
-		return apiKey;
-	}
-
-	public void setApiKey(String apiKey) {
-		this.apiKey = apiKey;
-	}
-
-	public String getSecretKey() {
-		return secretKey;
-	}
-
-	public void setSecretKey(String secretKey) {
-		this.secretKey = secretKey;
-	}
-
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/server/src/com/cloud/region/RegionsApiUtil.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/region/RegionsApiUtil.java b/server/src/com/cloud/region/RegionsApiUtil.java
deleted file mode 100644
index a7c7137..0000000
--- a/server/src/com/cloud/region/RegionsApiUtil.java
+++ /dev/null
@@ -1,256 +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.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import javax.crypto.Mac;
-import javax.crypto.spec.SecretKeySpec;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpException;
-import org.apache.commons.httpclient.HttpMethod;
-import org.apache.commons.httpclient.NameValuePair;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.apache.log4j.Logger;
-
-import com.cloud.domain.DomainVO;
-import com.cloud.user.UserAccount;
-import com.cloud.user.UserAccountVO;
-import com.thoughtworks.xstream.XStream;
-import com.thoughtworks.xstream.io.xml.DomDriver;
-
-public class RegionsApiUtil {
-	public static final Logger s_logger = Logger.getLogger(RegionsApiUtil.class);
-
-	protected static boolean makeAPICall(Region region, String command, List<NameValuePair> params){
-		try {
-			String apiParams = buildParams(command, params);
-			String url = buildUrl(apiParams, region);
-			HttpClient client = new HttpClient();
-			HttpMethod method = new GetMethod(url);
-			if( client.executeMethod(method) == 200){
-				return true;
-			} else {
-				return false;
-			}
-		} catch (HttpException e) {
-			s_logger.error(e.getMessage());
-			return false;
-		} catch (IOException e) {
-			s_logger.error(e.getMessage());
-			return false;
-		} 		
-	}
-
-	protected static RegionAccount makeAccountAPICall(Region region, String command, List<NameValuePair> params){
-		try {
-			String url = buildUrl(buildParams(command, params), region);
-			HttpClient client = new HttpClient();
-			HttpMethod method = new GetMethod(url);
-			if( client.executeMethod(method) == 200){
-				InputStream is = method.getResponseBodyAsStream();
-				XStream xstream = new XStream(new DomDriver());
-				xstream.alias("account", RegionAccount.class);
-				xstream.alias("user", RegionUser.class);
-				xstream.aliasField("id", RegionAccount.class, "uuid");
-				xstream.aliasField("name", RegionAccount.class, "accountName");
-				xstream.aliasField("accounttype", RegionAccount.class, "type");
-				xstream.aliasField("domainid", RegionAccount.class, "domainUuid");
-				xstream.aliasField("networkdomain", RegionAccount.class, "networkDomain");
-				xstream.aliasField("id", RegionUser.class, "uuid");
-				xstream.aliasField("accountId", RegionUser.class, "accountUuid");
-				ObjectInputStream in = xstream.createObjectInputStream(is);
-				return (RegionAccount)in.readObject();
-			} else {
-				return null;
-			}
-		} catch (HttpException e) {
-			s_logger.error(e.getMessage());
-			return null;
-		} catch (IOException e) {
-			s_logger.error(e.getMessage());
-			return null;
-		} catch (ClassNotFoundException e) {
-			s_logger.error(e.getMessage());
-			return null;
-		} 	
-	}
-
-	protected static RegionDomain makeDomainAPICall(Region region, String command, List<NameValuePair> params){
-		try {
-			String url = buildUrl(buildParams(command, params), region);
-			HttpClient client = new HttpClient();
-			HttpMethod method = new GetMethod(url);
-			if( client.executeMethod(method) == 200){
-				InputStream is = method.getResponseBodyAsStream();
-				XStream xstream = new XStream(new DomDriver());
-				xstream.alias("domain", RegionDomain.class);
-				xstream.aliasField("id", RegionDomain.class, "uuid");
-				xstream.aliasField("parentdomainid", RegionDomain.class, "parentUuid");
-				xstream.aliasField("networkdomain", DomainVO.class, "networkDomain");
-				ObjectInputStream in = xstream.createObjectInputStream(is);
-				return (RegionDomain)in.readObject();
-			} else {
-				return null;
-			}
-		} catch (HttpException e) {
-			s_logger.error(e.getMessage());
-			return null;
-		} catch (IOException e) {
-			s_logger.error(e.getMessage());
-			return null;
-		} catch (ClassNotFoundException e) {
-			s_logger.error(e.getMessage());
-			return null;
-		} 	
-	}
-
-	protected static UserAccount makeUserAccountAPICall(Region region, String command, List<NameValuePair> params){
-		try {
-			String url = buildUrl(buildParams(command, params), region);
-			HttpClient client = new HttpClient();
-			HttpMethod method = new GetMethod(url);
-			if( client.executeMethod(method) == 200){
-				InputStream is = method.getResponseBodyAsStream();
-				XStream xstream = new XStream(new DomDriver());
-				xstream.alias("useraccount", UserAccountVO.class);
-				xstream.aliasField("id", UserAccountVO.class, "uuid");
-				ObjectInputStream in = xstream.createObjectInputStream(is);
-				return (UserAccountVO)in.readObject();
-			} else {
-				return null;
-			}
-		} catch (HttpException e) {
-			s_logger.error(e.getMessage());
-			return null;
-		} catch (IOException e) {
-			s_logger.error(e.getMessage());
-			return null;
-		} catch (ClassNotFoundException e) {
-			s_logger.error(e.getMessage());
-			return null;
-		} 	
-	}
-
-	protected static String buildParams(String command, List<NameValuePair> params) {
-		StringBuffer paramString = new StringBuffer("command="+command);
-		Iterator<NameValuePair> iter = params.iterator();
-		try {
-			while(iter.hasNext()){
-				NameValuePair param = iter.next();
-				if(param.getValue() != null && !(param.getValue().isEmpty())){
-					paramString.append("&"+param.getName()+"="+URLEncoder.encode(param.getValue(), "UTF-8"));
-				}
-			}
-		}
-		catch (UnsupportedEncodingException e) {
-			s_logger.error(e.getMessage());
-			return null;
-		}
-		return paramString.toString();
-	}
-	
-	private static String buildUrl(String apiParams, Region region) {
-
-		String apiKey = region.getApiKey();
-		String secretKey = region.getSecretKey();
-
-
-		if (apiKey == null || secretKey == null) {
-			return region.getEndPoint() +"?"+ apiParams;
-		}
-
-		String encodedApiKey;
-		try {
-			encodedApiKey = URLEncoder.encode(apiKey, "UTF-8");
-
-			List<String> sortedParams = new ArrayList<String>();
-			sortedParams.add("apikey=" + encodedApiKey.toLowerCase());
-			StringTokenizer st = new StringTokenizer(apiParams, "&");
-			String url = null;
-			boolean first = true;
-			while (st.hasMoreTokens()) {
-				String paramValue = st.nextToken();
-				String param = paramValue.substring(0, paramValue.indexOf("="));
-				String value = paramValue.substring(paramValue.indexOf("=") + 1, paramValue.length());
-				if (first) {
-					url = param + "=" + value;
-					first = false;
-				} else {
-					url = url + "&" + param + "=" + value;
-				}
-				sortedParams.add(param.toLowerCase() + "=" + value.toLowerCase());
-			}
-			Collections.sort(sortedParams);
-
-
-			//Construct the sorted URL and sign and URL encode the sorted URL with your secret key
-			String sortedUrl = null;
-			first = true;
-			for (String param : sortedParams) {
-				if (first) {
-					sortedUrl = param;
-					first = false;
-				} else {
-					sortedUrl = sortedUrl + "&" + param;
-				}
-			}
-			String encodedSignature = signRequest(sortedUrl, secretKey);
-
-			String finalUrl = region.getEndPoint() +"?"+apiParams+ "&apiKey=" + apiKey + "&signature=" + encodedSignature;
-			
-			return finalUrl;
-
-		} catch (UnsupportedEncodingException e) {
-			s_logger.error(e.getMessage());
-			return null;
-		}
-	}
-
-	/**
-	 * 1. Signs a string with a secret key using SHA-1 2. Base64 encode the result 3. URL encode the final result
-	 * 
-	 * @param request
-	 * @param key
-	 * @return
-	 */
-	private static String signRequest(String request, String key) {
-		try {
-			Mac mac = Mac.getInstance("HmacSHA1");
-			SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(), "HmacSHA1");
-			mac.init(keySpec);
-			mac.update(request.getBytes());
-			byte[] encryptedBytes = mac.doFinal();
-			return URLEncoder.encode(Base64.encodeBase64String(encryptedBytes), "UTF-8");
-		} catch (Exception ex) {
-			s_logger.error(ex.getMessage());
-			return null;
-		}
-	}
-	
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/server/src/com/cloud/region/dao/RegionDao.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/region/dao/RegionDao.java b/server/src/com/cloud/region/dao/RegionDao.java
deleted file mode 100644
index e334ef8..0000000
--- a/server/src/com/cloud/region/dao/RegionDao.java
+++ /dev/null
@@ -1,23 +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.dao;
-
-import com.cloud.region.RegionVO;
-import com.cloud.utils.db.GenericDao;
-
-public interface RegionDao extends GenericDao<RegionVO, Integer> {
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/server/src/com/cloud/region/dao/RegionDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/region/dao/RegionDaoImpl.java b/server/src/com/cloud/region/dao/RegionDaoImpl.java
deleted file mode 100644
index 0d8a69d..0000000
--- a/server/src/com/cloud/region/dao/RegionDaoImpl.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.dao;
-
-import javax.ejb.Local;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.region.RegionVO;
-import com.cloud.utils.db.GenericDaoBase;
-
-@Local(value={RegionDao.class})
-public class RegionDaoImpl extends GenericDaoBase<RegionVO, Integer> implements RegionDao {
-    private static final Logger s_logger = Logger.getLogger(RegionDaoImpl.class);
-    
-    public RegionDaoImpl(){
-    	
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/server/src/com/cloud/region/dao/RegionSyncDao.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/region/dao/RegionSyncDao.java b/server/src/com/cloud/region/dao/RegionSyncDao.java
deleted file mode 100644
index 5387d2e..0000000
--- a/server/src/com/cloud/region/dao/RegionSyncDao.java
+++ /dev/null
@@ -1,23 +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.dao;
-
-import com.cloud.region.RegionSyncVO;
-import com.cloud.utils.db.GenericDao;
-
-public interface RegionSyncDao extends GenericDao<RegionSyncVO, Integer> {
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/server/src/com/cloud/region/dao/RegionSyncDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/region/dao/RegionSyncDaoImpl.java b/server/src/com/cloud/region/dao/RegionSyncDaoImpl.java
deleted file mode 100644
index 766286e..0000000
--- a/server/src/com/cloud/region/dao/RegionSyncDaoImpl.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.dao;
-
-import javax.ejb.Local;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.region.RegionSyncVO;
-import com.cloud.utils.db.GenericDaoBase;
-
-@Local(value={RegionSyncDao.class})
-public class RegionSyncDaoImpl extends GenericDaoBase<RegionSyncVO, Integer> implements RegionSyncDao {
-    private static final Logger s_logger = Logger.getLogger(RegionSyncDaoImpl.class);
-    
-    public RegionSyncDaoImpl(){
-    	
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/server/src/com/cloud/server/ConfigurationServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java b/server/src/com/cloud/server/ConfigurationServerImpl.java
index a63ad19..2ae0843 100755
--- a/server/src/com/cloud/server/ConfigurationServerImpl.java
+++ b/server/src/com/cloud/server/ConfigurationServerImpl.java
@@ -52,8 +52,6 @@ import com.cloud.offerings.NetworkOfferingServiceMapVO;
 import com.cloud.offerings.NetworkOfferingVO;
 import com.cloud.offerings.dao.NetworkOfferingDao;
 import com.cloud.offerings.dao.NetworkOfferingServiceMapDao;
-import com.cloud.region.RegionVO;
-import com.cloud.region.dao.RegionDao;
 import com.cloud.service.ServiceOfferingVO;
 import com.cloud.service.dao.ServiceOfferingDao;
 import com.cloud.storage.DiskOfferingVO;
@@ -74,6 +72,8 @@ import com.cloud.utils.net.NetUtils;
 import com.cloud.utils.script.Script;
 import com.cloud.uuididentity.dao.IdentityDao;
 
+import org.apache.cloudstack.region.RegionVO;
+import org.apache.cloudstack.region.dao.RegionDao;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.log4j.Logger;
 
@@ -1252,7 +1252,6 @@ public class ConfigurationServerImpl implements ConfigurationServer {
     private void createDefaultRegion(){
     	//Get Region name and URL from db.properties    	
     	_regionDao.persist(new RegionVO(_regionDao.getRegionId(), "Local", "http://localhost:8080/client/api", "", ""));
-    	//Default account, user and domain should share same uuid
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/server/src/com/cloud/user/AccountManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/user/AccountManager.java b/server/src/com/cloud/user/AccountManager.java
index a262308..4b3a601 100755
--- a/server/src/com/cloud/user/AccountManager.java
+++ b/server/src/com/cloud/user/AccountManager.java
@@ -20,6 +20,10 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.cloudstack.acl.ControlledEntity;
+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.UpdateUserCmd;
+
 import com.cloud.api.query.vo.ControlledViewEntity;
 import com.cloud.exception.ConcurrentOperationException;
 import com.cloud.exception.ResourceUnavailableException;
@@ -102,5 +106,94 @@ public interface AccountManager extends AccountService {
 
 	void buildACLSearchParameters(Account caller, Long id,
 			String accountName, Long projectId, List<Long> permittedAccounts, Ternary<Long, Boolean, ListProjectResourcesCriteria> domainIdRecursiveListProject, boolean listAll, boolean forProjectInvitation);
-   
+	
+    /**
+     * 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);
+    
+    /**
+     * Updates an account
+     *
+     * @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
+     *
+     * @param accountName
+     * @param domainId
+     * @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); 
+    
+    /**
+     * Deletes user by Id
+     * @param deleteUserCmd
+     * @return
+     */
+    boolean deleteUser(DeleteUserCmd deleteUserCmd);
+    
+    /**
+     * Update a user by userId
+     *
+     * @param userId
+     * @return UserAccount object
+     */
+    UserAccount updateUser(UpdateUserCmd cmd);   
+    
+    /**
+     * 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 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);    
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/server/src/com/cloud/user/AccountManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/user/AccountManagerImpl.java b/server/src/com/cloud/user/AccountManagerImpl.java
index c5c53e8..919b7c6 100755
--- a/server/src/com/cloud/user/AccountManagerImpl.java
+++ b/server/src/com/cloud/user/AccountManagerImpl.java
@@ -52,11 +52,12 @@ import com.cloud.api.query.vo.ControlledViewEntity;
 
 import org.apache.cloudstack.api.command.admin.user.DeleteUserCmd;
 import org.apache.cloudstack.api.command.admin.user.UpdateUserCmd;
+import org.apache.cloudstack.region.RegionManager;
+
 import com.cloud.configuration.Config;
 import com.cloud.configuration.ConfigurationManager;
 import com.cloud.configuration.ResourceLimit;
 import com.cloud.configuration.dao.ConfigurationDao;
-import com.cloud.configuration.dao.ConfigurationDaoImpl;
 import com.cloud.configuration.dao.ResourceCountDao;
 import com.cloud.dc.DataCenterVO;
 import com.cloud.dc.dao.DataCenterDao;
@@ -97,7 +98,6 @@ import com.cloud.projects.ProjectManager;
 import com.cloud.projects.ProjectVO;
 import com.cloud.projects.dao.ProjectAccountDao;
 import com.cloud.projects.dao.ProjectDao;
-import com.cloud.region.RegionManager;
 import com.cloud.server.auth.UserAuthenticator;
 import com.cloud.storage.StorageManager;
 import com.cloud.storage.VMTemplateVO;
@@ -830,13 +830,13 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
         		user.setRegistrationToken(registrationToken);
         	}
         	txn.commit();
-        	//Propogate Add account to other Regions
-        	_regionMgr.propogateAddAccount(userName, password, firstName, lastName, email, timezone, accountName, accountType, domainId, 
+        	//Propagate Add account to other Regions
+        	_regionMgr.propagateAddAccount(userName, password, firstName, lastName, email, timezone, accountName, accountType, domainId, 
         			networkDomain, details, account.getUuid(), user.getUuid());
         	//check success
             return _userAccountDao.findById(user.getId());
         } else {
-        	// Account is propogated from another Region
+        	// Account is propagated from another Region
 
         	Transaction txn = Transaction.currentTxn();
             txn.start();
@@ -891,8 +891,8 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
         UserVO user = null;
         if(regionId == null){
         	user = createUser(account.getId(), userName, password, firstName, lastName, email, timeZone);
-        	//Propogate Add user to other Regions
-        	_regionMgr.propogateAddUser(userName, password, firstName, lastName, email, timeZone, accountName, domain.getUuid(), user.getUuid());
+        	//Propagate Add user to peer Regions
+        	_regionMgr.propagateAddUser(userName, password, firstName, lastName, email, timeZone, accountName, domain.getUuid(), user.getUuid());
         } else {
         	user = createUser(account.getId(), userName, password, firstName, lastName, email, timeZone, userUUID, regionId);
         }
@@ -1744,7 +1744,6 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
 
         // Create default security group
         _networkGroupMgr.createDefaultSecurityGroup(accountId);
-        //_regionMgr.propogateAddResource();
         txn.commit();
 
         return account;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/server/src/com/cloud/user/DomainManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/user/DomainManager.java b/server/src/com/cloud/user/DomainManager.java
index aea653e..af102e2 100644
--- a/server/src/com/cloud/user/DomainManager.java
+++ b/server/src/com/cloud/user/DomainManager.java
@@ -19,6 +19,8 @@ package com.cloud.user;
 import java.util.List;
 import java.util.Set;
 
+import org.apache.cloudstack.api.command.admin.domain.UpdateDomainCmd;
+
 import com.cloud.domain.Domain;
 import com.cloud.domain.DomainVO;
 
@@ -34,5 +36,15 @@ public interface DomainManager extends DomainService {
     List<? extends Domain> findInactiveDomains();
 
     boolean deleteDomain(DomainVO domain, Boolean cleanup);
-
+    
+    boolean deleteDomain(long domainId, Boolean cleanup);
+    
+    /**
+     * update an existing domain
+     * 
+     * @param cmd
+     *            - the command containing domainId and new domainName
+     * @return Domain object if the command succeeded
+     */
+    Domain updateDomain(UpdateDomainCmd cmd);    
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/server/src/com/cloud/user/DomainManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/user/DomainManagerImpl.java b/server/src/com/cloud/user/DomainManagerImpl.java
index 92277e8..2fde0e1 100644
--- a/server/src/com/cloud/user/DomainManagerImpl.java
+++ b/server/src/com/cloud/user/DomainManagerImpl.java
@@ -27,6 +27,7 @@ import javax.naming.ConfigurationException;
 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 org.apache.cloudstack.region.RegionManager;
 import org.apache.log4j.Logger;
 
 import com.cloud.configuration.ResourceLimit;
@@ -43,7 +44,6 @@ import com.cloud.exception.ResourceUnavailableException;
 import com.cloud.projects.ProjectManager;
 import com.cloud.projects.ProjectVO;
 import com.cloud.projects.dao.ProjectDao;
-import com.cloud.region.RegionManager;
 import com.cloud.service.ServiceOfferingVO;
 import com.cloud.service.dao.ServiceOfferingDao;
 import com.cloud.storage.DiskOfferingVO;
@@ -187,8 +187,9 @@ public class DomainManagerImpl implements DomainManager, DomainService, Manager
 
         	DomainVO domain = _domainDao.create(new DomainVO(name, ownerId, parentId, networkDomain, _regionMgr.getId()));
         	_resourceCountDao.createResourceCounts(domain.getId(), ResourceLimit.ResourceOwnerType.Domain);
-        	_regionMgr.propogateAddDomain(name, parentId, networkDomain, domain.getUuid());
         	txn.commit();
+        	//Propagate domain creation to peer Regions
+        	_regionMgr.propagateAddDomain(name, parentId, networkDomain, domain.getUuid());        	
         	return domain;
         } else {
         	Transaction txn = Transaction.currentTxn();

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/server/src/com/cloud/user/dao/UserDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/user/dao/UserDaoImpl.java b/server/src/com/cloud/user/dao/UserDaoImpl.java
index 19ef691..e1f4a2e 100644
--- a/server/src/com/cloud/user/dao/UserDaoImpl.java
+++ b/server/src/com/cloud/user/dao/UserDaoImpl.java
@@ -20,10 +20,7 @@ import java.util.List;
 
 import javax.ejb.Local;
 
-import com.cloud.region.RegionManager;
 import com.cloud.user.UserVO;
-import com.cloud.utils.component.Inject;
-import com.cloud.utils.db.DB;
 import com.cloud.utils.db.GenericDaoBase;
 import com.cloud.utils.db.SearchBuilder;
 import com.cloud.utils.db.SearchCriteria;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8b1a5b1d/server/src/org/apache/cloudstack/region/RegionAccount.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/region/RegionAccount.java b/server/src/org/apache/cloudstack/region/RegionAccount.java
new file mode 100644
index 0000000..dba3101
--- /dev/null
+++ b/server/src/org/apache/cloudstack/region/RegionAccount.java
@@ -0,0 +1,287 @@
+// 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 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/org/apache/cloudstack/region/RegionDomain.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/region/RegionDomain.java b/server/src/org/apache/cloudstack/region/RegionDomain.java
new file mode 100644
index 0000000..df46198
--- /dev/null
+++ b/server/src/org/apache/cloudstack/region/RegionDomain.java
@@ -0,0 +1,61 @@
+// 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 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/org/apache/cloudstack/region/RegionManager.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/region/RegionManager.java b/server/src/org/apache/cloudstack/region/RegionManager.java
new file mode 100644
index 0000000..56bdb9b
--- /dev/null
+++ b/server/src/org/apache/cloudstack/region/RegionManager.java
@@ -0,0 +1,216 @@
+// 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 java.util.Map;
+
+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 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 RegionManager {
+	
+	/**
+	 * Propagates Account details to peer Regions
+	 * @param userName
+	 * @param password
+	 * @param firstName
+	 * @param lastName
+	 * @param email
+	 * @param timezone
+	 * @param accountName
+	 * @param accountType
+	 * @param domainId
+	 * @param networkDomain
+	 * @param details
+	 * @param accountUUID
+	 * @param userUUID
+	 * @return
+	 */
+	public boolean propagateAddAccount(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);
+	
+	/**
+	 * Returns the Id of local Region
+	 * @return
+	 */
+	public int getId();
+	
+	/**
+	 * Propagates User details to peer Regions
+	 * @param userName
+	 * @param password
+	 * @param firstName
+	 * @param lastName
+	 * @param email
+	 * @param timeZone
+	 * @param accountName
+	 * @param domainUUId
+	 * @param userUUID
+	 */
+	public void propagateAddUser(String userName, String password,
+			String firstName, String lastName, String email, String timeZone,
+			String accountName, String domainUUId, String userUUID);
+	
+	/**
+	 * Propagates Domain details to peer Regions
+	 * @param name
+	 * @param parentId
+	 * @param networkDomain
+	 * @param uuid
+	 */
+	public void propagateAddDomain(String name, Long parentId, String networkDomain, String uuid);
+	
+	
+	/**
+	 * Adds a peer Region to the local Region
+	 * @param id
+	 * @param name 
+	 * @param endPoint
+	 * @param apiKey
+	 * @param secretKey
+	 * @return Returns added Region object
+	 */
+	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 Returns update Region object
+	 */
+	Region updateRegion(int id, String name, String endPoint, String apiKey, String secretKey);
+	
+	/**
+	 * @param id
+	 * @return True if region is successfully removed
+	 */
+	boolean removeRegion(int id);
+	
+	/** List all Regions or by Id/Name
+	 * @param id
+	 * @param name
+	 * @return List of Regions
+	 */
+	List<RegionVO> listRegions(Integer id, String name);
+	
+    /**
+     * Deletes a user by userId and propagates the change to peer Regions
+     *
+     * @param accountId
+     *            - id of the account do delete
+     *
+     * @return true if delete was successful, false otherwise
+     */
+	boolean deleteUserAccount(long accountId);
+	
+    /**
+     * 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 accountName
+	 * @param domainId
+	 * @param id
+	 * @param lockRequested
+	 * @return
+	 * @throws ConcurrentOperationException
+	 * @throws ResourceUnavailableException
+	 */
+	Account disableAccount(String accountName, Long domainId, Long id, Boolean lockRequested) 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); 	
+    
+    /**
+     * Deletes user by Id
+     * @param deleteUserCmd
+     * @return
+     */
+    boolean deleteUser(DeleteUserCmd deleteUserCmd);
+    
+    /**
+     * update an existing domain
+     * 
+     * @param cmd
+     *            - the command containing domainId and new domainName
+     * @return Domain object if the command succeeded
+     */
+	Domain updateDomain(UpdateDomainCmd updateDomainCmd);    
+    
+	/**
+	 * Deletes domain by Id
+	 * @param id
+	 * @param cleanup
+	 * @return true if delete was successful, false otherwise
+	 */
+	boolean deleteDomain(Long id, Boolean cleanup);
+	
+    /**
+     * Update a user by userId
+     *
+     * @param userId
+     * @return UserAccount object
+     */
+	UserAccount updateUser(UpdateUserCmd updateUserCmd);
+	
+    /**
+     * Disables a user by userId
+     *
+     * @param userId
+     *            - the userId
+     * @return UserAccount object
+     */	
+	UserAccount disableUser(Long id);
+	
+    /**
+     * Enables a user
+     *
+     * @param userId
+     *            - the userId
+     * @return UserAccount object
+     */
+    UserAccount enableUser(long userId);
+}


Mime
View raw message