cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahu...@apache.org
Subject [08/48] All Checkstyle problems corrected
Date Thu, 12 Dec 2013 21:01:08 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
index 78e78b6..3159059 100644
--- a/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
+++ b/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
@@ -93,13 +93,13 @@ public class SnapshotSchedulerImpl extends ManagerBase implements SnapshotSchedu
     private TestClock _testTimerTask;
 
     public AsyncJobDispatcher getAsyncJobDispatcher() {
-    	return _asyncDispatcher;
+        return _asyncDispatcher;
     }
-    
+
     public void setAsyncJobDispatcher(AsyncJobDispatcher dispatcher) {
-    	_asyncDispatcher = dispatcher;
+        _asyncDispatcher = dispatcher;
     }
-    
+
     private Date getNextScheduledTime(long policyId, Date currentTimestamp) {
         SnapshotPolicyVO policy = _snapshotPolicyDao.findById(policyId);
         Date nextTimestamp = null;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/server/src/com/cloud/storage/upload/UploadListener.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/upload/UploadListener.java b/server/src/com/cloud/storage/upload/UploadListener.java
index 1fa8946..f6ad815 100755
--- a/server/src/com/cloud/storage/upload/UploadListener.java
+++ b/server/src/com/cloud/storage/upload/UploadListener.java
@@ -166,7 +166,7 @@ public class UploadListener implements Listener {
     private final Map<String, UploadState> stateMap = new HashMap<String, UploadState>();
     private Long uploadId;
 
-    public UploadListener(DataStore host, Timer _timer, UploadDao uploadDao, UploadVO uploadObj, UploadMonitorImpl uploadMonitor, UploadCommand cmd, Long accountId,
+    public UploadListener(DataStore host, Timer timerInput, UploadDao uploadDao, UploadVO uploadObj, UploadMonitorImpl uploadMonitor, UploadCommand cmd, Long accountId,
             String typeName, Type type, long eventId, long asyncJobId, AsyncJobManager asyncMgr) {
         sserver = host;
         this.uploadDao = uploadDao;
@@ -178,7 +178,7 @@ public class UploadListener implements Listener {
         this.type = type;
         initStateMachine();
         currState = getState(Status.NOT_UPLOADED.toString());
-        timer = _timer;
+        timer = timerInput;
         timeoutTask = new TimeoutTask(this);
         timer.schedule(timeoutTask, 3 * STATUS_POLL_INTERVAL);
         this.eventId = eventId;
@@ -215,12 +215,12 @@ public class UploadListener implements Listener {
         return false;
     }
 
-    public void setCommand(UploadCommand _cmd) {
-        cmd = _cmd;
+    public void setCommand(UploadCommand cmd) {
+        this.cmd = cmd;
     }
 
-    public void setJobId(String _jobId) {
-        jobId = _jobId;
+    public void setJobId(String jobId) {
+        this.jobId = jobId;
     }
 
     public String getJobId() {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/server/src/com/cloud/tags/TaggedResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/tags/TaggedResourceManagerImpl.java b/server/src/com/cloud/tags/TaggedResourceManagerImpl.java
index 84b7a67..28f94f0 100644
--- a/server/src/com/cloud/tags/TaggedResourceManagerImpl.java
+++ b/server/src/com/cloud/tags/TaggedResourceManagerImpl.java
@@ -42,8 +42,6 @@ import com.cloud.network.dao.IPAddressDao;
 import com.cloud.network.dao.LoadBalancerDao;
 import com.cloud.network.dao.NetworkDao;
 import com.cloud.network.dao.RemoteAccessVpnDao;
-import com.cloud.network.dao.Site2SiteCustomerGatewayDao;
-import com.cloud.network.dao.Site2SiteVpnGatewayDao;
 import com.cloud.network.rules.dao.PortForwardingRulesDao;
 import com.cloud.network.security.dao.SecurityGroupDao;
 import com.cloud.network.vpc.NetworkACLItemDao;
@@ -84,7 +82,7 @@ import com.cloud.vm.snapshot.dao.VMSnapshotDao;
 public class TaggedResourceManagerImpl extends ManagerBase implements TaggedResourceService {
     public static final Logger s_logger = Logger.getLogger(TaggedResourceManagerImpl.class);
 
-    private static Map<ResourceObjectType, GenericDao<?, Long>> _daoMap = new HashMap<ResourceObjectType, GenericDao<?, Long>>();
+    private static Map<ResourceObjectType, GenericDao<?, Long>> s_daoMap = new HashMap<ResourceObjectType, GenericDao<?, Long>>();
 
     @Inject
     AccountManager _accountMgr;
@@ -140,38 +138,32 @@ public class TaggedResourceManagerImpl extends ManagerBase implements TaggedReso
     VpcGatewayDao _vpcGatewayDao;
     @Inject
     NetworkACLDao _networkACLListDao;
-    @Inject
-    Site2SiteVpnGatewayDao _vpnGatewayDao;
-    @Inject
-    Site2SiteCustomerGatewayDao _customerGatewayDao;
 
     @Override
     public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
-        _daoMap.put(ResourceObjectType.UserVm, _userVmDao);
-        _daoMap.put(ResourceObjectType.Volume, _volumeDao);
-        _daoMap.put(ResourceObjectType.Template, _templateDao);
-        _daoMap.put(ResourceObjectType.ISO, _templateDao);
-        _daoMap.put(ResourceObjectType.Snapshot, _snapshotDao);
-        _daoMap.put(ResourceObjectType.Network, _networkDao);
-        _daoMap.put(ResourceObjectType.LoadBalancer, _lbDao);
-        _daoMap.put(ResourceObjectType.PortForwardingRule, _pfDao);
-        _daoMap.put(ResourceObjectType.FirewallRule, _firewallDao);
-        _daoMap.put(ResourceObjectType.SecurityGroup, _securityGroupDao);
-        _daoMap.put(ResourceObjectType.PublicIpAddress, _publicIpDao);
-        _daoMap.put(ResourceObjectType.Project, _projectDao);
-        _daoMap.put(ResourceObjectType.Vpc, _vpcDao);
-        _daoMap.put(ResourceObjectType.Nic, _nicDao);
-        _daoMap.put(ResourceObjectType.NetworkACL, _networkACLItemDao);
-        _daoMap.put(ResourceObjectType.StaticRoute, _staticRouteDao);
-        _daoMap.put(ResourceObjectType.VMSnapshot, _vmSnapshotDao);
-        _daoMap.put(ResourceObjectType.RemoteAccessVpn, _vpnDao);
-        _daoMap.put(ResourceObjectType.Zone, _dataCenterDao);
-        _daoMap.put(ResourceObjectType.ServiceOffering, _serviceOffDao);
-        _daoMap.put(ResourceObjectType.Storage, _storagePoolDao);
-        _daoMap.put(ResourceObjectType.PrivateGateway, _vpcGatewayDao);
-        _daoMap.put(ResourceObjectType.NetworkACLList, _networkACLListDao);
-        _daoMap.put(ResourceObjectType.VpnGateway, _vpnGatewayDao);
-        _daoMap.put(ResourceObjectType.CustomerGateway, _customerGatewayDao);
+        s_daoMap.put(ResourceObjectType.UserVm, _userVmDao);
+        s_daoMap.put(ResourceObjectType.Volume, _volumeDao);
+        s_daoMap.put(ResourceObjectType.Template, _templateDao);
+        s_daoMap.put(ResourceObjectType.ISO, _templateDao);
+        s_daoMap.put(ResourceObjectType.Snapshot, _snapshotDao);
+        s_daoMap.put(ResourceObjectType.Network, _networkDao);
+        s_daoMap.put(ResourceObjectType.LoadBalancer, _lbDao);
+        s_daoMap.put(ResourceObjectType.PortForwardingRule, _pfDao);
+        s_daoMap.put(ResourceObjectType.FirewallRule, _firewallDao);
+        s_daoMap.put(ResourceObjectType.SecurityGroup, _securityGroupDao);
+        s_daoMap.put(ResourceObjectType.PublicIpAddress, _publicIpDao);
+        s_daoMap.put(ResourceObjectType.Project, _projectDao);
+        s_daoMap.put(ResourceObjectType.Vpc, _vpcDao);
+        s_daoMap.put(ResourceObjectType.Nic, _nicDao);
+        s_daoMap.put(ResourceObjectType.NetworkACL, _networkACLItemDao);
+        s_daoMap.put(ResourceObjectType.StaticRoute, _staticRouteDao);
+        s_daoMap.put(ResourceObjectType.VMSnapshot, _vmSnapshotDao);
+        s_daoMap.put(ResourceObjectType.RemoteAccessVpn, _vpnDao);
+        s_daoMap.put(ResourceObjectType.Zone, _dataCenterDao);
+        s_daoMap.put(ResourceObjectType.ServiceOffering, _serviceOffDao);
+        s_daoMap.put(ResourceObjectType.Storage, _storagePoolDao);
+        s_daoMap.put(ResourceObjectType.PrivateGateway, _vpcGatewayDao);
+        s_daoMap.put(ResourceObjectType.NetworkACLList, _networkACLListDao);
 
         return true;
     }
@@ -188,7 +180,7 @@ public class TaggedResourceManagerImpl extends ManagerBase implements TaggedReso
 
     @Override
     public long getResourceId(String resourceId, ResourceObjectType resourceType) {
-        GenericDao<?, Long> dao = _daoMap.get(resourceType);
+        GenericDao<?, Long> dao = s_daoMap.get(resourceType);
         if (dao == null) {
             throw new CloudRuntimeException("Dao is not loaded for the resource type " + resourceType);
         }
@@ -221,7 +213,7 @@ public class TaggedResourceManagerImpl extends ManagerBase implements TaggedReso
     private Pair<Long, Long> getAccountDomain(long resourceId, ResourceObjectType resourceType) {
 
         Pair<Long, Long> pair = null;
-        GenericDao<?, Long> dao = _daoMap.get(resourceType);
+        GenericDao<?, Long> dao = s_daoMap.get(resourceType);
         Class<?> claz = DbUtil.getEntityBeanType(dao);
         while (claz != null && claz != Object.class) {
             try {
@@ -316,7 +308,7 @@ public class TaggedResourceManagerImpl extends ManagerBase implements TaggedReso
 
     @Override
     public String getUuid(String resourceId, ResourceObjectType resourceType) {
-        GenericDao<?, Long> dao = _daoMap.get(resourceType);
+        GenericDao<?, Long> dao = s_daoMap.get(resourceType);
         Class<?> claz = DbUtil.getEntityBeanType(dao);
 
         String identiyUUId = null;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/server/src/com/cloud/template/HypervisorTemplateAdapter.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/template/HypervisorTemplateAdapter.java b/server/src/com/cloud/template/HypervisorTemplateAdapter.java
index 542e675..74d1ac8 100755
--- a/server/src/com/cloud/template/HypervisorTemplateAdapter.java
+++ b/server/src/com/cloud/template/HypervisorTemplateAdapter.java
@@ -157,8 +157,9 @@ public class HypervisorTemplateAdapter extends TemplateAdapterBase {
 
         if ((format.equalsIgnoreCase("vhd") && (!url.toLowerCase().endsWith("vhd") && !url.toLowerCase().endsWith("vhd.zip") && !url.toLowerCase().endsWith("vhd.bz2") && !url.toLowerCase()
             .endsWith("vhd.gz"))) ||
-            (format.equalsIgnoreCase("vhdx") && (!url.toLowerCase().endsWith("vhdx") && !url.toLowerCase().endsWith("vhdx.zip") && !url.toLowerCase().endsWith("vhdx.bz2") && !url.toLowerCase()
-            .endsWith("vhdx.gz"))) ||
+            (format.equalsIgnoreCase("vhdx") && (!url.toLowerCase().endsWith("vhdx") && !url.toLowerCase().endsWith("vhdx.zip") &&
+                !url.toLowerCase().endsWith("vhdx.bz2") && !url.toLowerCase()
+                .endsWith("vhdx.gz"))) ||
             (format.equalsIgnoreCase("qcow2") && (!url.toLowerCase().endsWith("qcow2") && !url.toLowerCase().endsWith("qcow2.zip") &&
                 !url.toLowerCase().endsWith("qcow2.bz2") && !url.toLowerCase().endsWith("qcow2.gz"))) ||
             (format.equalsIgnoreCase("ova") && (!url.toLowerCase().endsWith("ova") && !url.toLowerCase().endsWith("ova.zip") && !url.toLowerCase().endsWith("ova.bz2") && !url.toLowerCase()

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/server/src/com/cloud/template/TemplateManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/template/TemplateManagerImpl.java b/server/src/com/cloud/template/TemplateManagerImpl.java
index ce178cd..accb181 100755
--- a/server/src/com/cloud/template/TemplateManagerImpl.java
+++ b/server/src/com/cloud/template/TemplateManagerImpl.java
@@ -1267,12 +1267,12 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
             updatedTemplate.setFeatured(isFeatured.booleanValue());
         }
 
-        if(isExtractable != null){
+        if (isExtractable != null) {
             // Only Root admins allowed to change it for templates
-            if(!template.getFormat().equals(ImageFormat.ISO) && caller.getType() != Account.ACCOUNT_TYPE_ADMIN){
+            if (!template.getFormat().equals(ImageFormat.ISO) && caller.getType() != Account.ACCOUNT_TYPE_ADMIN) {
                 throw new InvalidParameterValueException("Only ROOT admins are allowed to modify this attribute.");
-            }else{
-            // For Isos normal user can change it, as their are no derivatives.
+            } else {
+                // For Isos normal user can change it, as their are no derivatives.
                 updatedTemplate.setExtractable(isExtractable.booleanValue());
             }
         }
@@ -1628,20 +1628,20 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
         // Increment the number of templates
         if (template != null) {
             Map<String, String> details = new HashMap<String, String>();
-            if ( volume != null ) {
+            if (volume != null) {
                 Long vmId = volume.getInstanceId();
-                if ( vmId != null ) {
-	            UserVmVO userVm = _userVmDao.findById(vmId);
+                if (vmId != null) {
+                    UserVmVO userVm = _userVmDao.findById(vmId);
                     if (userVm != null) {
                         _userVmDao.loadDetails(userVm);
                         details.putAll(userVm.getDetails());
                     }
                 }
             }
-            if(cmd.getDetails() != null) {
+            if (cmd.getDetails() != null) {
                 details.putAll(cmd.getDetails());
             }
-            if( !details.isEmpty()) {
+            if (!details.isEmpty()) {
                 privateTemplate.setDetails(details);
                 _tmpltDao.saveDetails(privateTemplate);
             }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/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 fa441ae..8504ee1 100755
--- a/server/src/com/cloud/user/AccountManagerImpl.java
+++ b/server/src/com/cloud/user/AccountManagerImpl.java
@@ -39,6 +39,7 @@ import javax.naming.ConfigurationException;
 
 import org.apache.commons.codec.binary.Base64;
 import org.apache.log4j.Logger;
+
 import org.apache.cloudstack.acl.ControlledEntity;
 import org.apache.cloudstack.acl.RoleType;
 import org.apache.cloudstack.acl.SecurityChecker;
@@ -54,8 +55,6 @@ import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationSe
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 import org.apache.cloudstack.managed.context.ManagedContextRunnable;
 import org.apache.cloudstack.region.gslb.GlobalLoadBalancerRuleDao;
-import org.apache.commons.codec.binary.Base64;
-import org.apache.log4j.Logger;
 
 import com.cloud.api.ApiDBUtils;
 import com.cloud.api.query.vo.ControlledViewEntity;
@@ -156,7 +155,7 @@ import com.cloud.vm.dao.InstanceGroupDao;
 import com.cloud.vm.dao.UserVmDao;
 import com.cloud.vm.dao.VMInstanceDao;
 
-@Local(value = { AccountManager.class, AccountService.class })
+@Local(value = {AccountManager.class, AccountService.class})
 public class AccountManagerImpl extends ManagerBase implements AccountManager, Manager {
     public static final Logger s_logger = Logger.getLogger(AccountManagerImpl.class);
 
@@ -345,7 +344,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
     @Override
     public boolean isAdmin(short accountType) {
         return ((accountType == Account.ACCOUNT_TYPE_ADMIN) || (accountType == Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN) ||
-                (accountType == Account.ACCOUNT_TYPE_DOMAIN_ADMIN) || (accountType == Account.ACCOUNT_TYPE_READ_ONLY_ADMIN));
+            (accountType == Account.ACCOUNT_TYPE_DOMAIN_ADMIN) || (accountType == Account.ACCOUNT_TYPE_READ_ONLY_ADMIN));
     }
 
     @Override
@@ -381,7 +380,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
 
     @Override
     public void checkAccess(Account caller, AccessType accessType, boolean sameOwner, ControlledEntity... entities) {
-        
+
         //check for the same owner
         Long ownerId = null;
         ControlledEntity prevEntity = null;
@@ -395,7 +394,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
                     }
                     prevEntity = entity;
                 }
-            } 
+            }
         }
 
         if (caller.getId() == Account.ACCOUNT_ID_SYSTEM || isRootAdmin(caller.getType())) {
@@ -416,7 +415,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
                 domainId = account != null ? account.getDomainId() : -1;
             }
             if (entity.getAccountId() != -1 && domainId != -1 && !(entity instanceof VirtualMachineTemplate) &&
-                    !(accessType != null && accessType == AccessType.UseNetwork) && !(entity instanceof AffinityGroup)) {
+                !(accessType != null && accessType == AccessType.UseNetwork) && !(entity instanceof AffinityGroup)) {
                 List<ControlledEntity> toBeChecked = domains.get(entity.getDomainId());
                 // for templates, we don't have to do cross domains check
                 if (toBeChecked == null) {
@@ -864,12 +863,13 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
     @Override
     @DB
     @ActionEvents({
-            @ActionEvent(eventType = EventTypes.EVENT_ACCOUNT_CREATE, eventDescription = "creating Account"),
-            @ActionEvent(eventType = EventTypes.EVENT_USER_CREATE, eventDescription = "creating User")
+        @ActionEvent(eventType = EventTypes.EVENT_ACCOUNT_CREATE, eventDescription = "creating Account"),
+        @ActionEvent(eventType = EventTypes.EVENT_USER_CREATE, eventDescription = "creating User")
     })
-    public UserAccount createUserAccount(final String userName, final String password, final String firstName, final String lastName, final String email, final String timezone, String accountName,
-            final short accountType,
-            Long domainId, final String networkDomain, final Map<String, String> details, String accountUUID, final String userUUID) {
+    public UserAccount createUserAccount(final String userName, final String password, final String firstName, final String lastName, final String email,
+        final String timezone, String accountName,
+        final short accountType,
+        Long domainId, final String networkDomain, final Map<String, String> details, String accountUUID, final String userUUID) {
 
         if (accountName == null) {
             accountName = userName;
@@ -906,8 +906,8 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
         if (networkDomain != null) {
             if (!NetUtils.verifyDomainName(networkDomain)) {
                 throw new InvalidParameterValueException(
-                        "Invalid network domain. Total length shouldn't exceed 190 chars. Each domain label must be between 1 and 63 characters long, can contain ASCII letters 'a' through 'z', the digits '0' through '9', "
-                                + "and the hyphen ('-'); can't start or end with \"-\"");
+                    "Invalid network domain. Total length shouldn't exceed 190 chars. Each domain label must be between 1 and 63 characters long, can contain ASCII letters 'a' through 'z', the digits '0' through '9', "
+                        + "and the hyphen ('-'); can't start or end with \"-\"");
             }
         }
 
@@ -950,7 +950,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
     @Override
     @ActionEvent(eventType = EventTypes.EVENT_USER_CREATE, eventDescription = "creating User")
     public UserVO createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId,
-            String userUUID) {
+        String userUUID) {
 
         // default domain to ROOT if not specified
         if (domainId == null) {
@@ -1265,7 +1265,8 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
     @Override
     @ActionEvent(eventType = EventTypes.EVENT_ACCOUNT_DELETE, eventDescription = "deleting account", async = true)
     // This method deletes the account
-    public boolean deleteUserAccount(long accountId) {
+        public
+        boolean deleteUserAccount(long accountId) {
 
         CallContext ctx = CallContext.current();
         long callerUserId = ctx.getCallingUserId();
@@ -1356,7 +1357,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
 
         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);
+                domainId);
         }
 
         if (account.getId() == Account.ACCOUNT_ID_SYSTEM) {
@@ -1445,14 +1446,14 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
                                                                                         // update
                                                                                         // itself
             throw new InvalidParameterValueException("There already exists an account with the name:" + newAccountName + " in the domain:" + domainId +
-                    " with existing account id:" + duplicateAcccount.getId());
+                " with existing account id:" + duplicateAcccount.getId());
         }
 
         if (networkDomain != null && !networkDomain.isEmpty()) {
             if (!NetUtils.verifyDomainName(networkDomain)) {
                 throw new InvalidParameterValueException(
-                        "Invalid network domain. Total length shouldn't exceed 190 chars. Each domain label must be between 1 and 63 characters long, can contain ASCII letters 'a' through 'z', the digits '0' through '9', "
-                                + "and the hyphen ('-'); can't start or end with \"-\"");
+                    "Invalid network domain. Total length shouldn't exceed 190 chars. Each domain label must be between 1 and 63 characters long, can contain ASCII letters 'a' through 'z', the digits '0' through '9', "
+                        + "and the hyphen ('-'); can't start or end with \"-\"");
             }
         }
 
@@ -1690,18 +1691,18 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
 
         // Account type to role type translation
         switch (accountType) {
-        case Account.ACCOUNT_TYPE_ADMIN:
-            roleType = RoleType.Admin;
-            break;
-        case Account.ACCOUNT_TYPE_DOMAIN_ADMIN:
-            roleType = RoleType.DomainAdmin;
-            break;
-        case Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN:
-            roleType = RoleType.ResourceAdmin;
-            break;
-        case Account.ACCOUNT_TYPE_NORMAL:
-            roleType = RoleType.User;
-            break;
+            case Account.ACCOUNT_TYPE_ADMIN:
+                roleType = RoleType.Admin;
+                break;
+            case Account.ACCOUNT_TYPE_DOMAIN_ADMIN:
+                roleType = RoleType.DomainAdmin;
+                break;
+            case Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN:
+                roleType = RoleType.ResourceAdmin;
+                break;
+            case Account.ACCOUNT_TYPE_NORMAL:
+                roleType = RoleType.User;
+                break;
         }
         return roleType;
     }
@@ -1731,7 +1732,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
     @Override
     @DB
     public AccountVO createAccount(final String accountName, final short accountType, final Long domainId, final String networkDomain, final Map<String, String> details,
-            final String uuid) {
+        final String uuid) {
         // Validate domain
         Domain domain = _domainMgr.getDomain(domainId);
         if (domain == null) {
@@ -1754,8 +1755,8 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
         if (networkDomain != null) {
             if (!NetUtils.verifyDomainName(networkDomain)) {
                 throw new InvalidParameterValueException(
-                        "Invalid network domain. Total length shouldn't exceed 190 chars. Each domain label must be between 1 and 63 characters long, can contain ASCII letters 'a' through 'z', the digits '0' through '9', "
-                                + "and the hyphen ('-'); can't start or end with \"-\"");
+                    "Invalid network domain. Total length shouldn't exceed 190 chars. Each domain label must be between 1 and 63 characters long, can contain ASCII letters 'a' through 'z', the digits '0' through '9', "
+                        + "and the hyphen ('-'); can't start or end with \"-\"");
             }
         }
 
@@ -1860,7 +1861,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
             List<String> parameterNames = new ArrayList<String>();
 
             for (Object paramNameObj : requestParameters.keySet()) {
-                parameterNames.add((String) paramNameObj); // put the name in a list that we'll sort later
+                parameterNames.add((String)paramNameObj); // put the name in a list that we'll sort later
             }
 
             Collections.sort(parameterNames);
@@ -1868,7 +1869,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
             try {
                 for (String paramName : parameterNames) {
                     // parameters come as name/value pairs in the form String/String[]
-                    String paramValue = ((String[]) requestParameters.get(paramName))[0];
+                    String paramValue = ((String[])requestParameters.get(paramName))[0];
 
                     if ("signature".equalsIgnoreCase(paramName)) {
                         signature = paramValue;
@@ -1941,10 +1942,10 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
             }
             if (NetUtils.isValidIp(loginIpAddress)) {
                 ActionEventUtils.onActionEvent(user.getId(), user.getAccountId(), user.getDomainId(), EventTypes.EVENT_USER_LOGIN, "user has logged in from IP Address " +
-                        loginIpAddress);
+                    loginIpAddress);
             } else {
                 ActionEventUtils.onActionEvent(user.getId(), user.getAccountId(), user.getDomainId(), EventTypes.EVENT_USER_LOGIN,
-                        "user has logged in. The IP Address cannot be determined");
+                    "user has logged in. The IP Address cannot be determined");
             }
             return user;
         } else {
@@ -1982,7 +1983,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
             }
 
             if (!userAccount.getState().equalsIgnoreCase(Account.State.enabled.toString()) ||
-                    !userAccount.getAccountState().equalsIgnoreCase(Account.State.enabled.toString())) {
+                !userAccount.getAccountState().equalsIgnoreCase(Account.State.enabled.toString())) {
                 if (s_logger.isInfoEnabled()) {
                     s_logger.info("User " + username + " in domain " + domainName + " is disabled/locked (or account is disabled/locked)");
                 }
@@ -2114,14 +2115,14 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
 
     @Override
     public void buildACLSearchBuilder(SearchBuilder<? extends ControlledEntity> sb, Long domainId, boolean isRecursive, List<Long> permittedAccounts,
-            ListProjectResourcesCriteria listProjectResourcesCriteria) {
+        ListProjectResourcesCriteria listProjectResourcesCriteria) {
 
         if (sb.entity() instanceof IPAddressVO) {
-            sb.and("accountIdIN", ((IPAddressVO) sb.entity()).getAllocatedToAccountId(), SearchCriteria.Op.IN);
-            sb.and("domainId", ((IPAddressVO) sb.entity()).getAllocatedInDomainId(), SearchCriteria.Op.EQ);
+            sb.and("accountIdIN", ((IPAddressVO)sb.entity()).getAllocatedToAccountId(), SearchCriteria.Op.IN);
+            sb.and("domainId", ((IPAddressVO)sb.entity()).getAllocatedInDomainId(), SearchCriteria.Op.EQ);
         } else if (sb.entity() instanceof ProjectInvitationVO) {
-            sb.and("accountIdIN", ((ProjectInvitationVO) sb.entity()).getForAccountId(), SearchCriteria.Op.IN);
-            sb.and("domainId", ((ProjectInvitationVO) sb.entity()).getInDomainId(), SearchCriteria.Op.EQ);
+            sb.and("accountIdIN", ((ProjectInvitationVO)sb.entity()).getForAccountId(), SearchCriteria.Op.IN);
+            sb.and("domainId", ((ProjectInvitationVO)sb.entity()).getInDomainId(), SearchCriteria.Op.EQ);
         } else {
             sb.and("accountIdIN", sb.entity().getAccountId(), SearchCriteria.Op.IN);
             sb.and("domainId", sb.entity().getDomainId(), SearchCriteria.Op.EQ);
@@ -2133,9 +2134,9 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
             domainSearch.and("path", domainSearch.entity().getPath(), SearchCriteria.Op.LIKE);
 
             if (sb.entity() instanceof IPAddressVO) {
-                sb.join("domainSearch", domainSearch, ((IPAddressVO) sb.entity()).getAllocatedInDomainId(), domainSearch.entity().getId(), JoinBuilder.JoinType.INNER);
+                sb.join("domainSearch", domainSearch, ((IPAddressVO)sb.entity()).getAllocatedInDomainId(), domainSearch.entity().getId(), JoinBuilder.JoinType.INNER);
             } else if (sb.entity() instanceof ProjectInvitationVO) {
-                sb.join("domainSearch", domainSearch, ((ProjectInvitationVO) sb.entity()).getInDomainId(), domainSearch.entity().getId(), JoinBuilder.JoinType.INNER);
+                sb.join("domainSearch", domainSearch, ((ProjectInvitationVO)sb.entity()).getInDomainId(), domainSearch.entity().getId(), JoinBuilder.JoinType.INNER);
             } else {
                 sb.join("domainSearch", domainSearch, sb.entity().getDomainId(), domainSearch.entity().getId(), JoinBuilder.JoinType.INNER);
             }
@@ -2150,9 +2151,9 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
             }
 
             if (sb.entity() instanceof IPAddressVO) {
-                sb.join("accountSearch", accountSearch, ((IPAddressVO) sb.entity()).getAllocatedToAccountId(), accountSearch.entity().getId(), JoinBuilder.JoinType.INNER);
+                sb.join("accountSearch", accountSearch, ((IPAddressVO)sb.entity()).getAllocatedToAccountId(), accountSearch.entity().getId(), JoinBuilder.JoinType.INNER);
             } else if (sb.entity() instanceof ProjectInvitationVO) {
-                sb.join("accountSearch", accountSearch, ((ProjectInvitationVO) sb.entity()).getForAccountId(), accountSearch.entity().getId(), JoinBuilder.JoinType.INNER);
+                sb.join("accountSearch", accountSearch, ((ProjectInvitationVO)sb.entity()).getForAccountId(), accountSearch.entity().getId(), JoinBuilder.JoinType.INNER);
             } else {
                 sb.join("accountSearch", accountSearch, sb.entity().getAccountId(), accountSearch.entity().getId(), JoinBuilder.JoinType.INNER);
             }
@@ -2161,7 +2162,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
 
     @Override
     public void buildACLSearchCriteria(SearchCriteria<? extends ControlledEntity> sc, Long domainId, boolean isRecursive, List<Long> permittedAccounts,
-            ListProjectResourcesCriteria listProjectResourcesCriteria) {
+        ListProjectResourcesCriteria listProjectResourcesCriteria) {
 
         if (listProjectResourcesCriteria != null) {
             sc.setJoinParameters("accountSearch", "type", Account.ACCOUNT_TYPE_PROJECT);
@@ -2181,8 +2182,8 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
 
     @Override
     public void buildACLSearchParameters(Account caller, Long id, String accountName, Long projectId, List<Long>
-            permittedAccounts, Ternary<Long, Boolean, ListProjectResourcesCriteria> domainIdRecursiveListProject,
-            boolean listAll, boolean forProjectInvitation) {
+        permittedAccounts, Ternary<Long, Boolean, ListProjectResourcesCriteria> domainIdRecursiveListProject,
+        boolean listAll, boolean forProjectInvitation) {
         Long domainId = domainIdRecursiveListProject.first();
         if (domainId != null) {
             Domain domain = _domainDao.findById(domainId);
@@ -2268,7 +2269,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
 
     @Override
     public void buildACLViewSearchBuilder(SearchBuilder<? extends ControlledViewEntity> sb, Long domainId, boolean isRecursive, List<Long> permittedAccounts,
-            ListProjectResourcesCriteria listProjectResourcesCriteria) {
+        ListProjectResourcesCriteria listProjectResourcesCriteria) {
 
         sb.and("accountIdIN", sb.entity().getAccountId(), SearchCriteria.Op.IN);
         sb.and("domainId", sb.entity().getDomainId(), SearchCriteria.Op.EQ);
@@ -2291,7 +2292,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
 
     @Override
     public void buildACLViewSearchCriteria(SearchCriteria<? extends ControlledViewEntity> sc, Long domainId, boolean isRecursive, List<Long> permittedAccounts,
-            ListProjectResourcesCriteria listProjectResourcesCriteria) {
+        ListProjectResourcesCriteria listProjectResourcesCriteria) {
 
         if (listProjectResourcesCriteria != null) {
             sc.setParameters("accountType", Account.ACCOUNT_TYPE_PROJECT);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/server/src/com/cloud/uuididentity/UUIDManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/uuididentity/UUIDManager.java b/server/src/com/cloud/uuididentity/UUIDManager.java
index 6bef87a..ecf238c 100644
--- a/server/src/com/cloud/uuididentity/UUIDManager.java
+++ b/server/src/com/cloud/uuididentity/UUIDManager.java
@@ -16,7 +16,6 @@
 // under the License.
 package com.cloud.uuididentity;
 
-import org.apache.cloudstack.api.Identity;
 
 public interface UUIDManager {
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/server/src/com/cloud/uuididentity/UUIDManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/uuididentity/UUIDManagerImpl.java b/server/src/com/cloud/uuididentity/UUIDManagerImpl.java
index 852b2dc..09ba3d1 100644
--- a/server/src/com/cloud/uuididentity/UUIDManagerImpl.java
+++ b/server/src/com/cloud/uuididentity/UUIDManagerImpl.java
@@ -16,84 +16,82 @@
 // under the License.
 package com.cloud.uuididentity;
 
+import java.util.UUID;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+
+import org.apache.cloudstack.context.CallContext;
+
 import com.cloud.exception.InvalidParameterValueException;
 import com.cloud.exception.PermissionDeniedException;
-import com.cloud.storage.Volume;
 import com.cloud.user.Account;
 import com.cloud.user.AccountManager;
 import com.cloud.utils.db.EntityManager;
 import com.cloud.utils.exception.CloudRuntimeException;
-import org.apache.cloudstack.acl.ControlledEntity;
-import org.apache.cloudstack.api.Identity;
-import org.apache.cloudstack.context.CallContext;
 
-import javax.ejb.Local;
-import javax.inject.Inject;
-import java.util.UUID;
-
-@Local(value = { UUIDManager.class })
+@Local(value = {UUIDManager.class})
 public class UUIDManagerImpl implements UUIDManager {
 
-
     @Inject
     EntityManager _entityMgr;
     @Inject
     AccountManager _accountMgr;
     //TODO - Make this configurable.
-    private final int UUID_RETRY = 3;
-
+    private static final int UUID_RETRY = 3;
 
     @Override
-    public  <T> void checkUuid(String uuid, Class<T> entityType){
+    public <T> void checkUuid(String uuid, Class<T> entityType) {
 
-        if(uuid == null) return;
+        if (uuid == null)
+            return;
 
         Account caller = CallContext.current().getCallingAccount();
 
         // Only admin and system allowed to do this
-        if ( !(caller.getId() == Account.ACCOUNT_ID_SYSTEM || _accountMgr.isRootAdmin(caller.getType())) ) {
+        if (!(caller.getId() == Account.ACCOUNT_ID_SYSTEM || _accountMgr.isRootAdmin(caller.getType()))) {
             throw new PermissionDeniedException("Please check your permissions, you are not allowed to create/update custom id");
         }
 
         // check format
-        if(!IsUuidFormat(uuid))
+        if (!IsUuidFormat(uuid))
             throw new InvalidParameterValueException("UUID: " + uuid + " doesn't follow the UUID format");
 
         // check unique
-        if(!IsUuidUnique(entityType, uuid))
+        if (!IsUuidUnique(entityType, uuid))
             throw new InvalidParameterValueException("UUID: " + uuid + " already exists so can't create/update with custom id");
 
     }
 
-    public boolean IsUuidFormat(String uuid){
+    public boolean IsUuidFormat(String uuid) {
 
         // Match against UUID regex to check if input is uuid string
         boolean isUuid = uuid.matches("^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$");
         return isUuid;
     }
 
-    public <T> boolean IsUuidUnique(Class<T> entityType, String uuid){
+    public <T> boolean IsUuidUnique(Class<T> entityType, String uuid) {
 
         T obj = _entityMgr.findByUuid(entityType, uuid);
-        if(obj != null)
+        if (obj != null)
             return false;
         else
             return true;
     }
 
     @Override
-    public <T> String generateUuid(Class<T> entityType, String customId){
+    public <T> String generateUuid(Class<T> entityType, String customId) {
 
-        if(customId == null){ // if no customid is passed then generate it.
+        if (customId == null) { // if no customid is passed then generate it.
             int retry = UUID_RETRY;
             while (retry-- != 0) {  // there might be collision so retry
                 String uuid = UUID.randomUUID().toString();
-                if(IsUuidUnique(entityType, uuid))
+                if (IsUuidUnique(entityType, uuid))
                     return uuid;
             }
 
             throw new CloudRuntimeException("Unable to generate a unique uuid, please try again");
-        }else {
+        } else {
             checkUuid(customId, entityType);
             return customId;
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/server/src/com/cloud/uuididentity/dao/IdentityDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/uuididentity/dao/IdentityDaoImpl.java b/server/src/com/cloud/uuididentity/dao/IdentityDaoImpl.java
index c5d2c43..3475104 100644
--- a/server/src/com/cloud/uuididentity/dao/IdentityDaoImpl.java
+++ b/server/src/com/cloud/uuididentity/dao/IdentityDaoImpl.java
@@ -61,9 +61,9 @@ public class IdentityDaoImpl extends GenericDaoBase<IdentityVO, Long> implements
 
                 pstmt = txn.prepareAutoCloseStatement(String.format("SELECT id FROM `%s` WHERE id=? OR uuid=?", tableName)
 
-                // TODO : after graceful period, use following line turn on more secure check
-                // String.format("SELECT id FROM %s WHERE (id=? AND uuid IS NULL) OR uuid=?", mapper.entityTableName())
-                );
+                    // TODO : after graceful period, use following line turn on more secure check
+                    // String.format("SELECT id FROM %s WHERE (id=? AND uuid IS NULL) OR uuid=?", mapper.entityTableName())
+                    );
 
                 long id = 0;
                 try {
@@ -150,8 +150,8 @@ public class IdentityDaoImpl extends GenericDaoBase<IdentityVO, Long> implements
         try {
             try {
                 pstmt = txn.prepareAutoCloseStatement(String.format("SELECT uuid FROM `%s` WHERE id=? OR uuid=?", tableName)
-                // String.format("SELECT uuid FROM %s WHERE (id=? AND uuid IS NULL) OR uuid=?", tableName)
-                );
+                    // String.format("SELECT uuid FROM %s WHERE (id=? AND uuid IS NULL) OR uuid=?", tableName)
+                    );
 
                 long id = 0;
                 try {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/server/src/com/cloud/vm/SystemVmLoadScanner.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/SystemVmLoadScanner.java b/server/src/com/cloud/vm/SystemVmLoadScanner.java
index 28c900d..97f9dcd 100644
--- a/server/src/com/cloud/vm/SystemVmLoadScanner.java
+++ b/server/src/com/cloud/vm/SystemVmLoadScanner.java
@@ -44,7 +44,7 @@ public class SystemVmLoadScanner<T> {
     private final SystemVmLoadScanHandler<T> _scanHandler;
     private final ScheduledExecutorService _capacityScanScheduler;
     private final GlobalLock _capacityScanLock;
-    
+
     public SystemVmLoadScanner(SystemVmLoadScanHandler<T> scanHandler) {
         _scanHandler = scanHandler;
         _capacityScanScheduler = Executors.newScheduledThreadPool(1, new NamedThreadFactory(scanHandler.getScanHandlerName()));
@@ -71,15 +71,15 @@ public class SystemVmLoadScanner<T> {
 
             @Override
             protected void runInContext() {
-            	try {
-                	CallContext callContext = CallContext.current();
-                	assert(callContext != null);
-                	
-                	AsyncJobExecutionContext.registerPseudoExecutionContext(
-                		callContext.getCallingAccountId(), callContext.getCallingUserId());
-            		
+                try {
+                    CallContext callContext = CallContext.current();
+                    assert (callContext != null);
+
+                    AsyncJobExecutionContext.registerPseudoExecutionContext(
+                        callContext.getCallingAccountId(), callContext.getCallingUserId());
+
                     reallyRun();
-                    
+
                     AsyncJobExecutionContext.unregister();
                 } catch (Throwable e) {
                     s_logger.warn("Unexpected exception " + e.getMessage(), e);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/server/src/com/cloud/vm/UserVmManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManager.java b/server/src/com/cloud/vm/UserVmManager.java
index da60f33..6043491 100755
--- a/server/src/com/cloud/vm/UserVmManager.java
+++ b/server/src/com/cloud/vm/UserVmManager.java
@@ -110,7 +110,8 @@ public interface UserVmManager extends UserVmService {
     Pair<UserVmVO, Map<VirtualMachineProfile.Param, Object>> startVirtualMachine(long vmId, Long hostId, Map<VirtualMachineProfile.Param, Object> additionalParams)
         throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
 
-    boolean upgradeVirtualMachine(Long id, Long serviceOfferingId, Map<String, String> customParameters) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException,
+    boolean upgradeVirtualMachine(Long id, Long serviceOfferingId, Map<String, String> customParameters) throws ResourceUnavailableException,
+        ConcurrentOperationException, ManagementServerException,
         VirtualMachineMigrationException;
 
     boolean setupVmForPvlan(boolean add, Long hostId, NicProfile nic);
@@ -118,7 +119,7 @@ public interface UserVmManager extends UserVmService {
     void collectVmDiskStatistics(UserVmVO userVm);
 
     UserVm updateVirtualMachine(long id, String displayName, String group, Boolean ha, Boolean isDisplayVmEnabled, Long osTypeId, String userData,
-                                Boolean isDynamicallyScalable, HTTPMethod httpMethod, String customId) throws ResourceUnavailableException, InsufficientCapacityException;
+        Boolean isDynamicallyScalable, HTTPMethod httpMethod, String customId) throws ResourceUnavailableException, InsufficientCapacityException;
 
     //the validateCustomParameters, save and remove CustomOfferingDetils functions can be removed from the interface once we can
     //find a common place for all the scaling and upgrading code of both user and systemvms.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index fa45cc8..3ad49d8 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -34,10 +34,6 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
-import com.cloud.event.UsageEventVO;
-import com.cloud.uuididentity.UUIDManager;
-import com.cloud.capacity.Capacity;
-import com.cloud.exception.InsufficientServerCapacityException;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.log4j.Logger;
 
@@ -86,8 +82,6 @@ import org.apache.cloudstack.managed.context.ManagedContextRunnable;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 import org.apache.cloudstack.storage.to.TemplateObjectTO;
-import org.apache.commons.codec.binary.Base64;
-import org.apache.log4j.Logger;
 
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.api.Answer;
@@ -107,6 +101,7 @@ import com.cloud.alert.AlertManager;
 import com.cloud.api.ApiDBUtils;
 import com.cloud.api.query.dao.UserVmJoinDao;
 import com.cloud.api.query.vo.UserVmJoinVO;
+import com.cloud.capacity.Capacity;
 import com.cloud.capacity.CapacityManager;
 import com.cloud.configuration.Config;
 import com.cloud.configuration.ConfigurationManager;
@@ -130,6 +125,7 @@ import com.cloud.domain.dao.DomainDao;
 import com.cloud.event.ActionEvent;
 import com.cloud.event.EventTypes;
 import com.cloud.event.UsageEventUtils;
+import com.cloud.event.UsageEventVO;
 import com.cloud.event.dao.UsageEventDao;
 import com.cloud.exception.AgentUnavailableException;
 import com.cloud.exception.CloudException;
@@ -261,6 +257,7 @@ import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.exception.ExecutionException;
 import com.cloud.utils.fsm.NoTransitionException;
 import com.cloud.utils.net.NetUtils;
+import com.cloud.uuididentity.UUIDManager;
 import com.cloud.vm.VirtualMachine.State;
 import com.cloud.vm.dao.InstanceGroupDao;
 import com.cloud.vm.dao.InstanceGroupVMMapDao;
@@ -468,9 +465,9 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
 
     @Inject
     ConfigurationDao _configDao;
-    private final int MAX_VM_NAME_LEN = 80;
-    private final int MAX_HTTP_GET_LENGTH = 2 * MAX_USER_DATA_LENGTH_BYTES;
-    private final int MAX_HTTP_POST_LENGTH = 16 * MAX_USER_DATA_LENGTH_BYTES;
+    private static final int MAX_VM_NAME_LEN = 80;
+    private static final int MAX_HTTP_GET_LENGTH = 2 * MAX_USER_DATA_LENGTH_BYTES;
+    private static final int MAX_HTTP_POST_LENGTH = 16 * MAX_USER_DATA_LENGTH_BYTES;
 
     @Inject
     protected OrchestrationService _orchSrvc;
@@ -659,7 +656,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
         return userVm;
     }
 
-    private boolean resetVMSSHKeyInternal(Long vmId, String SSHPublicKey, String password) throws ResourceUnavailableException, InsufficientCapacityException {
+    private boolean resetVMSSHKeyInternal(Long vmId, String sshPublicKey, String password) throws ResourceUnavailableException, InsufficientCapacityException {
         Long userId = CallContext.current().getCallingUserId();
         VMInstanceVO vmInstance = _vmDao.findById(vmId);
 
@@ -685,7 +682,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
         if (element == null) {
             throw new CloudRuntimeException("Can't find network element for " + Service.UserData.getName() + " provider needed for SSH Key reset");
         }
-        boolean result = element.saveSSHKey(defaultNetwork, defaultNicProfile, vmProfile, SSHPublicKey);
+        boolean result = element.saveSSHKey(defaultNetwork, defaultNicProfile, vmProfile, sshPublicKey);
 
         // Need to reboot the virtual machine so that the password gets redownloaded from the DomR, and reset on the VM
         if (!result) {
@@ -773,15 +770,15 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
         VMInstanceVO vmInstance = _vmInstanceDao.findById(vmId);
         if (vmInstance == null) {
             throw new InvalidParameterValueException("unable to find a virtual machine with id " + vmId);
-        }else if (!(vmInstance.getState().equals(State.Stopped))) {
+        } else if (!(vmInstance.getState().equals(State.Stopped))) {
             throw new InvalidParameterValueException("Unable to upgrade virtual machine " + vmInstance.toString() + " " + " in state " + vmInstance.getState() +
-                    "; make sure the virtual machine is stopped");
+                "; make sure the virtual machine is stopped");
         }
 
         _accountMgr.checkAccess(caller, null, true, vmInstance);
 
         // Check resource limits for CPU and Memory.
-        Map<String,String> customParameters = cmd.getCustomParameters();
+        Map<String, String> customParameters = cmd.getCustomParameters();
         ServiceOfferingVO newServiceOffering = _offeringDao.findById(svcOffId);
         if (newServiceOffering.isDynamic()) {
             newServiceOffering.setDynamicFlag(true);
@@ -824,7 +821,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
             saveCustomOfferingDetails(vmId, newServiceOffering);
         }
         if (currentServiceOffering.isDynamic() && !newServiceOffering.isDynamic()) {
-           removeCustomOfferingDetails(vmId);
+            removeCustomOfferingDetails(vmId);
         }
 
         // Increment or decrement CPU and Memory count accordingly.
@@ -846,23 +843,25 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
 
     @Override
     public void validateCustomParameters(ServiceOfferingVO serviceOffering, Map<String, String> customParameters) {
-        if (customParameters.size() !=0 ) {
+        if (customParameters.size() != 0) {
             if (serviceOffering.getCpu() == null) {
                 String cpuNumber = customParameters.get(UsageEventVO.DynamicParameters.cpuNumber.name());
                 if ((cpuNumber == null) || (NumbersUtil.parseInt(cpuNumber, -1) <= 0 || NumbersUtil.parseInt(cpuNumber, -1) > 2147483647)) {
                     throw new InvalidParameterValueException("Invalid cpu cores value, specify a value between 1 and 2147483647");
                 }
             } else if (customParameters.containsKey(UsageEventVO.DynamicParameters.cpuNumber.name())) {
-                throw new InvalidParameterValueException("The cpu cores of this offering id:"+serviceOffering.getId()+" is not customizable. This is predefined in the template.");
+                throw new InvalidParameterValueException("The cpu cores of this offering id:" + serviceOffering.getId() +
+                    " is not customizable. This is predefined in the template.");
             }
 
             if (serviceOffering.getSpeed() == null) {
                 String cpuSpeed = customParameters.get(UsageEventVO.DynamicParameters.cpuSpeed.name());
-                if ((cpuSpeed == null) || (NumbersUtil.parseInt(cpuSpeed, -1) <= 0 || NumbersUtil.parseInt(cpuSpeed, -1) > 2147483647 )) {
+                if ((cpuSpeed == null) || (NumbersUtil.parseInt(cpuSpeed, -1) <= 0 || NumbersUtil.parseInt(cpuSpeed, -1) > 2147483647)) {
                     throw new InvalidParameterValueException("Invalid cpu speed value, specify a value between 1 and 2147483647");
                 }
             } else if (customParameters.containsKey(UsageEventVO.DynamicParameters.cpuSpeed.name())) {
-                throw new InvalidParameterValueException("The cpu speed of this offering id:"+serviceOffering.getId()+" is not customizable. This is predefined in the template.");
+                throw new InvalidParameterValueException("The cpu speed of this offering id:" + serviceOffering.getId() +
+                    " is not customizable. This is predefined in the template.");
             }
 
             if (serviceOffering.getRamSize() == null) {
@@ -870,8 +869,9 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
                 if (memory == null || (NumbersUtil.parseInt(memory, -1) < 32 || NumbersUtil.parseInt(memory, -1) > 2147483647)) {
                     throw new InvalidParameterValueException("Invalid memory value, specify a value between 32 and 2147483647 MB");
                 }
-            } else if (customParameters.containsKey(UsageEventVO.DynamicParameters.memory.name())){
-                throw new InvalidParameterValueException("The memory of this offering id:"+serviceOffering.getId()+" is not customizable. This is predefined in the template.");
+            } else if (customParameters.containsKey(UsageEventVO.DynamicParameters.memory.name())) {
+                throw new InvalidParameterValueException("The memory of this offering id:" + serviceOffering.getId() +
+                    " is not customizable. This is predefined in the template.");
             }
         } else {
             throw new InvalidParameterValueException("Need to specify custom parameter values cpu, cpu speed and memory when using custom offering");
@@ -1213,8 +1213,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
         Long newServiceOfferingId = cmd.getServiceOfferingId();
         CallContext.current().setEventDetails("Vm Id: " + vmId);
 
-        boolean  result = upgradeVirtualMachine(vmId, newServiceOfferingId,cmd.getCustomParameters());
-        if(result){
+        boolean result = upgradeVirtualMachine(vmId, newServiceOfferingId, cmd.getCustomParameters());
+        if (result) {
             UserVmVO vmInstance = _vmDao.findById(vmId);
             if (vmInstance.getState().equals(State.Stopped)) {
                 // Generate usage event for VM upgrade
@@ -1222,7 +1222,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
             }
             if (vmInstance.getState().equals(State.Running)) {
                 // Generate usage event for Dynamic scaling of VM
-                generateUsageEvent(_serviceOfferingDao.findById(newServiceOfferingId),cmd.getCustomParameters(), vmInstance, EventTypes.EVENT_VM_UPGRADE);
+                generateUsageEvent(_serviceOfferingDao.findById(newServiceOfferingId), cmd.getCustomParameters(), vmInstance, EventTypes.EVENT_VM_UPGRADE);
             }
             return vmInstance;
         } else {
@@ -1267,7 +1267,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
     }
 
     @Override
-    public boolean upgradeVirtualMachine(Long vmId, Long newServiceOfferingId, Map<String, String> customParameters) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException{
+    public boolean upgradeVirtualMachine(Long vmId, Long newServiceOfferingId, Map<String, String> customParameters) throws ResourceUnavailableException,
+        ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException {
 
         // Verify input parameters
         VMInstanceVO vmInstance = _vmInstanceDao.findById(vmId);
@@ -1276,13 +1277,14 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
             upgradeStoppedVirtualMachine(vmId, newServiceOfferingId, customParameters);
             return true;
         }
-        if(vmInstance.getState().equals(State.Running)){
+        if (vmInstance.getState().equals(State.Running)) {
             return upgradeRunningVirtualMachine(vmId, newServiceOfferingId, customParameters);
         }
         return false;
     }
 
-    private boolean upgradeRunningVirtualMachine(Long vmId, Long newServiceOfferingId, Map<String, String> customParameters) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException{
+    private boolean upgradeRunningVirtualMachine(Long vmId, Long newServiceOfferingId, Map<String, String> customParameters) throws ResourceUnavailableException,
+        ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException {
 
         Account caller = CallContext.current().getCallingAccount();
         VMInstanceVO vmInstance = _vmInstanceDao.findById(vmId);
@@ -1293,7 +1295,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
         _accountMgr.checkAccess(caller, null, true, vmInstance);
 
         //Check if its a scale "up"
-        ServiceOfferingVO newServiceOffering = (ServiceOfferingVO) _offeringDao.findById(newServiceOfferingId);
+        ServiceOfferingVO newServiceOffering = _offeringDao.findById(newServiceOfferingId);
         if (newServiceOffering.isDynamic()) {
             newServiceOffering.setDynamicFlag(true);
             validateCustomParameters(newServiceOffering, customParameters);
@@ -1311,7 +1313,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
         int currentMemory = currentServiceOffering.getRamSize();
         int currentSpeed = currentServiceOffering.getSpeed();
         int memoryDiff = newMemory - currentMemory;
-        int cpuDiff =  newCpu*newSpeed - currentCpu*currentSpeed;
+        int cpuDiff = newCpu * newSpeed - currentCpu * currentSpeed;
 
         // Don't allow to scale when (Any of the new values less than current values) OR (All current and new values are same)
         if ((newSpeed < currentSpeed || newMemory < currentMemory || newCpu < currentCpu) ||
@@ -1348,7 +1350,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
 
             // Check disable threshold for cluster is not crossed
             HostVO host = _hostDao.findById(vmInstance.getHostId());
-            if(_capacityMgr.checkIfClusterCrossesThreshold(host.getClusterId(), cpuDiff, memoryDiff)){
+            if (_capacityMgr.checkIfClusterCrossesThreshold(host.getClusterId(), cpuDiff, memoryDiff)) {
                 throw new CloudRuntimeException("Unable to scale vm: " + vmInstance.getUuid() + " due to insufficient resources");
             }
 
@@ -1362,13 +1364,13 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
                     }
 
                     if (memoryDiff > 0) {
-                        _resourceLimitMgr.incrementResourceCount(caller.getAccountId(), ResourceType.memory, new Long (memoryDiff));
+                        _resourceLimitMgr.incrementResourceCount(caller.getAccountId(), ResourceType.memory, new Long(memoryDiff));
                     }
 
                     // #1 Check existing host has capacity
-                    if( !excludes.shouldAvoid(ApiDBUtils.findHostById(vmInstance.getHostId())) ){
+                    if (!excludes.shouldAvoid(ApiDBUtils.findHostById(vmInstance.getHostId()))) {
                         existingHostHasCapacity = _capacityMgr.checkIfHostHasCpuCapability(vmInstance.getHostId(), newCpu, newSpeed)
-                                && _capacityMgr.checkIfHostHasCapacity(vmInstance.getHostId(), cpuDiff,
+                            && _capacityMgr.checkIfHostHasCapacity(vmInstance.getHostId(), cpuDiff,
                                 (memoryDiff) * 1024L * 1024L, false, _capacityMgr.getClusterOverProvisioningFactor(host.getClusterId(), Capacity.CAPACITY_TYPE_CPU),
                                 _capacityMgr.getClusterOverProvisioningFactor(host.getClusterId(), Capacity.CAPACITY_TYPE_MEMORY), false);
                         excludes.addHost(vmInstance.getHostId());
@@ -1404,7 +1406,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
                     if (!success) {
                         _itMgr.upgradeVmDb(vmId, currentServiceOffering.getId()); // rollback
                         if (newServiceOffering.isDynamic()) {
-                           removeCustomOfferingDetails(vmId);
+                            removeCustomOfferingDetails(vmId);
                         }
                         // Decrement CPU and Memory count accordingly.
                         if (newCpu > currentCpu) {
@@ -1412,7 +1414,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
                         }
 
                         if (memoryDiff > 0) {
-                            _resourceLimitMgr.decrementResourceCount(caller.getAccountId(), ResourceType.memory, new Long (memoryDiff));
+                            _resourceLimitMgr.decrementResourceCount(caller.getAccountId(), ResourceType.memory, new Long(memoryDiff));
                         }
                     }
                 }
@@ -1428,7 +1430,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
         details.put(UsageEventVO.DynamicParameters.cpuNumber.name(), serviceOffering.getCpu().toString());
         details.put(UsageEventVO.DynamicParameters.cpuSpeed.name(), serviceOffering.getSpeed().toString());
         details.put(UsageEventVO.DynamicParameters.memory.name(), serviceOffering.getRamSize().toString());
-        List <UserVmDetailVO> detailList = new ArrayList<UserVmDetailVO>();
+        List<UserVmDetailVO> detailList = new ArrayList<UserVmDetailVO>();
         for (String key : details.keySet()) {
             UserVmDetailVO detailVO = new UserVmDetailVO(vmId, key, details.get(key));
             detailList.add(detailVO);
@@ -1437,12 +1439,12 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
     }
 
     @Override
-    public void removeCustomOfferingDetails(long vmId){
+    public void removeCustomOfferingDetails(long vmId) {
         Map<String, String> details = _uservmDetailsDao.listDetailsKeyPairs(vmId);
         details.remove(UsageEventVO.DynamicParameters.cpuNumber.name());
         details.remove(UsageEventVO.DynamicParameters.cpuSpeed.name());
         details.remove(UsageEventVO.DynamicParameters.memory.name());
-        List <UserVmDetailVO> detailList = new ArrayList<UserVmDetailVO>();
+        List<UserVmDetailVO> detailList = new ArrayList<UserVmDetailVO>();
         for (String key : details.keySet()) {
             UserVmDetailVO detailVO = new UserVmDetailVO(vmId, key, details.get(key));
             detailList.add(detailVO);
@@ -2204,9 +2206,9 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
     @Override
     @ActionEvent(eventType = EventTypes.EVENT_VM_CREATE, eventDescription = "deploying Vm", create = true)
     public UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template,
-                                                         List<Long> securityGroupIdList, Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
-                                                         HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard,
-                                                         List<Long> affinityGroupIdList, Map<String, String> customParametes, String customId) throws InsufficientCapacityException,
+        List<Long> securityGroupIdList, Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
+        HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard,
+        List<Long> affinityGroupIdList, Map<String, String> customParametes, String customId) throws InsufficientCapacityException,
         ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException {
 
         Account caller = CallContext.current().getCallingAccount();
@@ -2258,9 +2260,9 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
     @Override
     @ActionEvent(eventType = EventTypes.EVENT_VM_CREATE, eventDescription = "deploying Vm", create = true)
     public UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList,
-                                                            List<Long> securityGroupIdList, Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
-                                                            HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard,
-                                                            List<Long> affinityGroupIdList, Map<String, String> customParameters, String customId) throws InsufficientCapacityException,
+        List<Long> securityGroupIdList, Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
+        HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard,
+        List<Long> affinityGroupIdList, Map<String, String> customParameters, String customId) throws InsufficientCapacityException,
         ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException {
 
         Account caller = CallContext.current().getCallingAccount();
@@ -2365,9 +2367,9 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
     @Override
     @ActionEvent(eventType = EventTypes.EVENT_VM_CREATE, eventDescription = "deploying Vm", create = true)
     public UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList,
-                                               Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod,
-                                               String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayvm, String keyboard,
-                                               List<Long> affinityGroupIdList, Map<String, String> customParametrs, String customId) throws InsufficientCapacityException,
+        Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod,
+        String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayvm, String keyboard,
+        List<Long> affinityGroupIdList, Map<String, String> customParametrs, String customId) throws InsufficientCapacityException,
         ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException {
 
         Account caller = CallContext.current().getCallingAccount();
@@ -2468,9 +2470,9 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
 
     @DB
     protected UserVm createVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate tmplt, String hostName, String displayName,
-                                          Account owner, Long diskOfferingId, Long diskSize, List<NetworkVO> networkList, List<Long> securityGroupIdList, String group, HTTPMethod httpmethod,
-                                          String userData, String sshKeyPair, HypervisorType hypervisor, Account caller, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps,
-                                          Boolean isDisplayVmEnabled, String keyboard, List<Long> affinityGroupIdList, Map<String, String> customParameters, String customId)
+        Account owner, Long diskOfferingId, Long diskSize, List<NetworkVO> networkList, List<Long> securityGroupIdList, String group, HTTPMethod httpmethod,
+        String userData, String sshKeyPair, HypervisorType hypervisor, Account caller, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps,
+        Boolean isDisplayVmEnabled, String keyboard, List<Long> affinityGroupIdList, Map<String, String> customParameters, String customId)
         throws InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException, StorageUnavailableException, ResourceAllocationException {
 
         _accountMgr.checkAccess(caller, null, true, owner);
@@ -2689,7 +2691,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
 
         long id = _vmDao.getNextInSequence(Long.class, "id");
 
-
         if (hostName != null) {
             // Check is hostName is RFC compliant
             checkNameForRFCCompliance(hostName);
@@ -2812,7 +2813,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
                 }
                 Long rootDiskSize = null;
                 if (customParameters.containsKey("rootdisksize")) {
-                    if (NumbersUtil.parseLong(customParameters.get("rootdisksize"), -1) <=0) {
+                    if (NumbersUtil.parseLong(customParameters.get("rootdisksize"), -1) <= 0) {
                         throw new InvalidParameterValueException("rootdisk size should be a non zero number.");
                     }
                     rootDiskSize = Long.parseLong(customParameters.get("rootDisksize"));
@@ -2895,8 +2896,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
 
                 if (!offering.isDynamic()) {
                     UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VM_CREATE, accountId, zone.getId(), vm.getId(),
-                            vm.getHostName(), offering.getId(), template.getId(), hypervisorType.toString(),
-                            VirtualMachine.class.getName(), vm.getUuid());
+                        vm.getHostName(), offering.getId(), template.getId(), hypervisorType.toString(),
+                        VirtualMachine.class.getName(), vm.getUuid());
                 }
                 else {
                     UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VM_CREATE, accountId, zone.getId(), vm.getId(), vm.getHostName(), offering.getId(),
@@ -2910,16 +2911,16 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
         });
     }
 
-    private void generateUsageEvent(ServiceOfferingVO serviceOffering, Map<String, String> customParameters, UserVmVO vm,  String eventType){
+    private void generateUsageEvent(ServiceOfferingVO serviceOffering, Map<String, String> customParameters, UserVmVO vm, String eventType) {
         if (!serviceOffering.isDynamic()) {
             UsageEventUtils.publishUsageEvent(eventType, vm.getAccountId(), vm.getDataCenterId(), vm.getId(),
-                    vm.getHostName(), serviceOffering.getId(), vm.getTemplateId(), vm.getHypervisorType().toString(),
-                    VirtualMachine.class.getName(), vm.getUuid());
+                vm.getHostName(), serviceOffering.getId(), vm.getTemplateId(), vm.getHypervisorType().toString(),
+                VirtualMachine.class.getName(), vm.getUuid());
         }
         else {
             UsageEventUtils.publishUsageEvent(eventType, vm.getAccountId(), vm.getDataCenterId(), vm.getId(),
-                    vm.getHostName(), serviceOffering.getId(), vm.getTemplateId(), vm.getHypervisorType().toString(),
-                    VirtualMachine.class.getName(), vm.getUuid(), customParameters);
+                vm.getHostName(), serviceOffering.getId(), vm.getTemplateId(), vm.getHypervisorType().toString(),
+                VirtualMachine.class.getName(), vm.getUuid(), customParameters);
         }
     }
 
@@ -3364,12 +3365,11 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
     }
 
     @Override
-
     public UserVm destroyVm(long vmId) throws ResourceUnavailableException,
-    ConcurrentOperationException {
-		// Account caller = CallContext.current().getCallingAccount();
-		// Long userId = CallContext.current().getCallingUserId();
-		Long userId = 2L;
+        ConcurrentOperationException {
+        // Account caller = CallContext.current().getCallingAccount();
+        // Long userId = CallContext.current().getCallingUserId();
+        Long userId = 2L;
 
         // Verify input parameters
         UserVmVO vm = _vmDao.findById(vmId);
@@ -3383,8 +3383,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
             return vm;
         }
 
-
-		// _accountMgr.checkAccess(caller, null, true, vm);
+        // _accountMgr.checkAccess(caller, null, true, vm);
         User userCaller = _userDao.findById(userId);
 
         boolean status;
@@ -3874,17 +3873,17 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
             throw ex;
         }
         if (!vm.getHypervisorType().equals(HypervisorType.XenServer)
-                && !vm.getHypervisorType().equals(HypervisorType.VMware)
-                && !vm.getHypervisorType().equals(HypervisorType.KVM)
-                && !vm.getHypervisorType().equals(HypervisorType.Ovm)
-                && !vm.getHypervisorType().equals(HypervisorType.Hyperv)
-                && !vm.getHypervisorType().equals(HypervisorType.Simulator)) {
+            && !vm.getHypervisorType().equals(HypervisorType.VMware)
+            && !vm.getHypervisorType().equals(HypervisorType.KVM)
+            && !vm.getHypervisorType().equals(HypervisorType.Ovm)
+            && !vm.getHypervisorType().equals(HypervisorType.Hyperv)
+            && !vm.getHypervisorType().equals(HypervisorType.Simulator)) {
             if (s_logger.isDebugEnabled()) {
                 s_logger.debug(vm
-                        + " is not XenServer/VMware/KVM/Ovm/Hyperv, cannot migrate this VM.");
+                    + " is not XenServer/VMware/KVM/Ovm/Hyperv, cannot migrate this VM.");
             }
             throw new InvalidParameterValueException(
-                    "Unsupported Hypervisor Type for VM migration, we support XenServer/VMware/KVM/Ovm/Hyperv only");
+                "Unsupported Hypervisor Type for VM migration, we support XenServer/VMware/KVM/Ovm/Hyperv only");
         }
 
         if (isVMUsingLocalStorage(vm)) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/server/src/com/cloud/vm/UserVmStateListener.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmStateListener.java b/server/src/com/cloud/vm/UserVmStateListener.java
index 9f5f51d..a51b5ef 100644
--- a/server/src/com/cloud/vm/UserVmStateListener.java
+++ b/server/src/com/cloud/vm/UserVmStateListener.java
@@ -35,7 +35,6 @@ import com.cloud.event.UsageEventUtils;
 import com.cloud.event.dao.UsageEventDao;
 import com.cloud.network.dao.NetworkDao;
 import com.cloud.network.dao.NetworkVO;
-import com.cloud.server.ManagementServer;
 import com.cloud.server.ManagementService;
 import com.cloud.utils.component.ComponentContext;
 import com.cloud.utils.fsm.StateListener;
@@ -53,12 +52,12 @@ public class UserVmStateListener implements StateListener<State, VirtualMachine.
     protected NicDao _nicDao;
     private static final Logger s_logger = Logger.getLogger(UserVmStateListener.class);
 
-    protected static EventBus _eventBus = null;
+    protected static EventBus s_eventBus = null;
 
     public UserVmStateListener(UsageEventDao usageEventDao, NetworkDao networkDao, NicDao nicDao) {
-        this._usageEventDao = usageEventDao;
-        this._networkDao = networkDao;
-        this._nicDao = nicDao;
+        _usageEventDao = usageEventDao;
+        _networkDao = networkDao;
+        _nicDao = nicDao;
     }
 
     @Override
@@ -104,7 +103,7 @@ public class UserVmStateListener implements StateListener<State, VirtualMachine.
     private void pubishOnEventBus(String event, String status, VirtualMachine vo, VirtualMachine.State oldState, VirtualMachine.State newState) {
 
         try {
-            _eventBus = ComponentContext.getComponent(EventBus.class);
+            s_eventBus = ComponentContext.getComponent(EventBus.class);
         } catch (NoSuchBeanDefinitionException nbe) {
             return; // no provider is configured to provide events bus, so just return
         }
@@ -124,7 +123,7 @@ public class UserVmStateListener implements StateListener<State, VirtualMachine.
 
         eventMsg.setDescription(eventDescription);
         try {
-            _eventBus.publish(eventMsg);
+            s_eventBus.publish(eventMsg);
         } catch (org.apache.cloudstack.framework.events.EventBusException e) {
             s_logger.warn("Failed to publish state change event on the the event bus.");
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java b/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java
index d1346f0..ece75be 100644
--- a/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java
+++ b/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java
@@ -182,8 +182,8 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana
 
         if (state == null) {
             VMSnapshot.State[] status =
-                {VMSnapshot.State.Ready, VMSnapshot.State.Creating, VMSnapshot.State.Allocated, VMSnapshot.State.Error, VMSnapshot.State.Expunging,
-                    VMSnapshot.State.Reverting};
+            {VMSnapshot.State.Ready, VMSnapshot.State.Creating, VMSnapshot.State.Allocated, VMSnapshot.State.Error, VMSnapshot.State.Expunging,
+                VMSnapshot.State.Reverting};
             sc.setParameters("status", (Object[])status);
         } else {
             sc.setParameters("state", state);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/server/src/org/apache/cloudstack/network/lb/CertServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/network/lb/CertServiceImpl.java b/server/src/org/apache/cloudstack/network/lb/CertServiceImpl.java
index ae3d179..dd536fe 100644
--- a/server/src/org/apache/cloudstack/network/lb/CertServiceImpl.java
+++ b/server/src/org/apache/cloudstack/network/lb/CertServiceImpl.java
@@ -238,27 +238,27 @@ public class CertServiceImpl implements CertService {
         return certResponseList;
     }
 
-    private void validate(String _cert, String _key, String _password, String _chain) {
+    private void validate(String certInput, String keyInput, String password, String chainInput) {
         Certificate cert;
         PrivateKey key;
         List<Certificate> chain = null;
 
         try {
-            cert = parseCertificate(_cert);
-            key = parsePrivateKey(_key, _password);
+            cert = parseCertificate(certInput);
+            key = parsePrivateKey(keyInput, password);
 
-            if (_chain != null) {
-                chain = parseChain(_chain);
+            if (chainInput != null) {
+                chain = parseChain(chainInput);
             }
 
         } catch (IOException e) {
             throw new IllegalArgumentException("Parsing certificate/key failed: " + e.getMessage(), e);
         }
 
-        validateCert(cert, _chain != null ? true : false);
+        validateCert(cert, chainInput != null ? true : false);
         validateKeys(cert.getPublicKey(), key);
 
-        if (_chain != null)
+        if (chainInput != null)
             validateChain(chain, cert);
     }
 
@@ -289,7 +289,7 @@ public class CertServiceImpl implements CertService {
         return response;
     }
 
-    private void validateCert(Certificate cert, boolean chain_present) {
+    private void validateCert(Certificate cert, boolean chainPresent) {
 
         if (!(cert instanceof X509Certificate))
             throw new IllegalArgumentException("Invalid certificate format. Expected X509 certificate");
@@ -300,7 +300,7 @@ public class CertServiceImpl implements CertService {
             throw new IllegalArgumentException("Certificate expired or not valid", e);
         }
 
-        if (!chain_present) {
+        if (!chainPresent) {
             PublicKey pubKey = cert.getPublicKey();
             try {
                 cert.verify(pubKey);
@@ -482,7 +482,7 @@ public class CertServiceImpl implements CertService {
 
     public static class KeyPassword implements PasswordFinder {
 
-        boolean password_requested = false;
+        boolean passwordRequested = false;
         char[] password;
 
         KeyPassword(char[] word) {
@@ -491,12 +491,12 @@ public class CertServiceImpl implements CertService {
 
         @Override
         public char[] getPassword() {
-            password_requested = true;
+            passwordRequested = true;
             return password;
         }
 
         public boolean getPasswordRequested() {
-            return password_requested;
+            return passwordRequested;
         }
     }
 }
\ No newline at end of file


Mime
View raw message