cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahu...@apache.org
Subject [32/36] Made changes to configuration. Eliminated ConfigValue and only use ConfigKey
Date Fri, 06 Sep 2013 22:39:02 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/server/src/com/cloud/network/vpc/VpcManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/VpcManagerImpl.java b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
index 597a7b0..6cace7e 100644
--- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java
+++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
@@ -39,7 +39,6 @@ import org.apache.cloudstack.api.command.user.vpc.ListStaticRoutesCmd;
 import org.apache.cloudstack.context.CallContext;
 import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
 import org.apache.cloudstack.framework.config.ConfigDepot;
-import org.apache.cloudstack.framework.config.ConfigValue;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 
 import com.cloud.configuration.Config;
@@ -198,8 +197,6 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager,
VpcProvis
     private final List<Service> nonSupportedServices = Arrays.asList(Service.SecurityGroup,
Service.Firewall);
     private final List<Provider> supportedProviders = Arrays.asList(Provider.VPCVirtualRouter,
Provider.NiciraNvp, Provider.InternalLbVm, Provider.Netscaler);
  
-    ConfigValue<String> _networkDomain;
-
     int _cleanupInterval;
     int _maxNetworks;
     SearchBuilder<IPAddressVO> IpAddressSearch;
@@ -260,8 +257,6 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager,
VpcProvis
         String maxNtwks = configs.get(Config.VpcMaxNetworks.key());
         _maxNetworks = NumbersUtil.parseInt(maxNtwks, 3); // max=3 is default
 
-        _networkDomain = _configDepot.get(NetworkOrchestrationService.GuestDomainSuffix);
-        
         IpAddressSearch = _ipAddressDao.createSearchBuilder();
         IpAddressSearch.and("accountId", IpAddressSearch.entity().getAllocatedToAccountId(),
Op.EQ);
         IpAddressSearch.and("dataCenterId", IpAddressSearch.entity().getDataCenterId(), Op.EQ);
@@ -620,7 +615,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager,
VpcProvis
 
             // 2) If null, generate networkDomain using domain suffix from the global config
variables
             if (networkDomain == null) {
-                networkDomain = "cs" + Long.toHexString(owner.getId()) + _networkDomain.valueIn(zoneId);
+                networkDomain = "cs" + Long.toHexString(owner.getId()) + NetworkOrchestrationService.GuestDomainSuffix.valueIn(zoneId);
             }
         }
         
@@ -1772,7 +1767,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager,
VpcProvis
     }
 
     protected boolean isCidrBlacklisted(String cidr, long zoneId) {
-        String routesStr = _networkDomain.valueIn(zoneId);
+        String routesStr = NetworkOrchestrationService.GuestDomainSuffix.valueIn(zoneId);
         if (routesStr != null && !routesStr.isEmpty()) {
             String[] cidrBlackList = routesStr.split(",");
             

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
index 022493d..6cd164d 100755
--- a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
+++ b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
@@ -31,7 +31,6 @@ import org.apache.cloudstack.api.command.user.vpn.ListRemoteAccessVpnsCmd;
 import org.apache.cloudstack.api.command.user.vpn.ListVpnUsersCmd;
 import org.apache.cloudstack.context.CallContext;
 import org.apache.cloudstack.framework.config.ConfigKey;
-import org.apache.cloudstack.framework.config.ConfigValue;
 import org.apache.cloudstack.framework.config.Configurable;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 
@@ -75,7 +74,6 @@ import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.Pair;
 import com.cloud.utils.PasswordGenerator;
 import com.cloud.utils.Ternary;
-import com.cloud.utils.component.InjectConfig;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.Filter;
@@ -93,9 +91,6 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase implements RemoteAcc
     static final ConfigKey<String> RemoteAccessVpnClientIpRange = new ConfigKey<String>("Network",
String.class, RemoteAccessVpnClientIpRangeCK, "10.1.2.1-10.1.2.8",
         "The range of ips to be allocated to remote access vpn clients. The first ip in the
range is used by the VPN server", false, ConfigKey.Scope.Account);
 
-    @InjectConfig(key = RemoteAccessVpnClientIpRangeCK)
-    ConfigValue<String> _remoteAccessVpnClientIpRange;
-
     @Inject AccountDao _accountDao;
     @Inject VpnUserDao _vpnUsersDao;
     @Inject RemoteAccessVpnDao _remoteAccessVpnDao;
@@ -166,7 +161,7 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase implements
RemoteAcc
         }
 
         if (ipRange == null) {
-            ipRange = _remoteAccessVpnClientIpRange.valueIn(ipAddr.getAccountId());
+            ipRange = RemoteAccessVpnClientIpRange.valueIn(ipAddr.getAccountId());
         }
         String[] range = ipRange.split("-");
         if (range.length != 2) {
@@ -208,7 +203,7 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase implements
RemoteAcc
     }
 
     private void validateRemoteAccessVpnConfiguration() throws ConfigurationException {
-        String ipRange = _remoteAccessVpnClientIpRange.value();
+        String ipRange = RemoteAccessVpnClientIpRange.value();
         if (ipRange == null) {
             s_logger.warn("Remote Access VPN global configuration missing client ip range
-- ignoring");
             return;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/server/src/com/cloud/resource/ResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java
index d7f5a88..d1b029d 100755
--- a/server/src/com/cloud/resource/ResourceManagerImpl.java
+++ b/server/src/com/cloud/resource/ResourceManagerImpl.java
@@ -46,7 +46,6 @@ import org.apache.cloudstack.api.command.admin.host.ReconnectHostCmd;
 import org.apache.cloudstack.api.command.admin.host.UpdateHostCmd;
 import org.apache.cloudstack.api.command.admin.host.UpdateHostPasswordCmd;
 import org.apache.cloudstack.context.CallContext;
-import org.apache.cloudstack.framework.config.ConfigValue;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 import org.apache.cloudstack.region.dao.RegionDao;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
@@ -136,7 +135,6 @@ import com.cloud.user.AccountManager;
 import com.cloud.user.User;
 import com.cloud.utils.StringUtils;
 import com.cloud.utils.UriUtils;
-import com.cloud.utils.component.InjectConfig;
 import com.cloud.utils.component.Manager;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.db.DB;
@@ -167,11 +165,6 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
 
     Gson _gson;
 
-    @InjectConfig(key = CapacityManager.CpuOverprovisioningFactorCK)
-    ConfigValue<Float> _cpuOverprovisioningFactor;
-    @InjectConfig(key = CapacityManager.MemOverprovisioningFactorCK)
-    ConfigValue<Float> _memOverprovisioningFactor;
-
     @Inject
     AccountManager _accountMgr;
     @Inject
@@ -478,8 +471,8 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
 
         if (clusterType == Cluster.ClusterType.CloudManaged) {
             Map<String, String> details = new HashMap<String, String>();
-            details.put("cpuOvercommitRatio", _cpuOverprovisioningFactor.value().toString());
-            details.put("memoryOvercommitRatio", _memOverprovisioningFactor.value().toString());
+            details.put("cpuOvercommitRatio", CapacityManager.CpuOverprovisioningFactor.value().toString());
+            details.put("memoryOvercommitRatio", CapacityManager.MemOverprovisioningFactor.value().toString());
             _clusterDetailsDao.persist(cluster.getId(), details);
             return result;
         }
@@ -489,8 +482,8 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
         details.put("url", url);
         details.put("username", username);
         details.put("password", password);
-        details.put("cpuOvercommitRatio", _cpuOverprovisioningFactor.value().toString());
-        details.put("memoryOvercommitRatio", _memOverprovisioningFactor.value().toString());
+        details.put("cpuOvercommitRatio", CapacityManager.CpuOverprovisioningFactor.value().toString());
+        details.put("memoryOvercommitRatio", CapacityManager.MemOverprovisioningFactor.value().toString());
         _clusterDetailsDao.persist(cluster.getId(), details);
 
         boolean success = false;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index f00795b..a3efd21 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -430,7 +430,6 @@ import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
 import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory;
 import org.apache.cloudstack.framework.config.ConfigKey;
-import org.apache.cloudstack.framework.config.ConfigValue;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 import org.apache.cloudstack.framework.config.impl.ConfigurationVO;
 import org.apache.cloudstack.storage.datastore.db.ImageStoreDao;
@@ -558,7 +557,6 @@ import com.cloud.utils.Pair;
 import com.cloud.utils.PasswordGenerator;
 import com.cloud.utils.Ternary;
 import com.cloud.utils.component.ComponentLifecycle;
-import com.cloud.utils.component.InjectConfig;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.concurrency.NamedThreadFactory;
 import com.cloud.utils.crypt.DBEncryptionUtil;
@@ -3238,9 +3236,6 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
 
         return cloudParams;
     }
-    
-    @InjectConfig(key = TemplateManager.AllowPublicUserTemplatesCK)
-    ConfigValue<Boolean> _allowPublicUserTemplates;
 
     @Override
     public Map<String, Object> listCapabilities(ListCapabilitiesCmd cmd) {
@@ -3265,7 +3260,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
 
         long diskOffMaxSize = Long.valueOf(_configDao.getValue(Config.CustomDiskOfferingMaxSize.key()));
 
-        boolean userPublicTemplateEnabled = _allowPublicUserTemplates.valueIn(caller.getId());
+        boolean userPublicTemplateEnabled = TemplateManager.AllowPublicUserTemplates.valueIn(caller.getId());
 
         // add some parameters UI needs to handle API throttling
         boolean apiLimitEnabled = Boolean.parseBoolean(_configDao.getValue(Config.ApiLimitEnabled.key()));

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/server/src/com/cloud/storage/StorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java
index cf06b4e..b380692 100755
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -73,7 +73,6 @@ import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService.VolumeApiResult;
 import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
 import org.apache.cloudstack.framework.async.AsyncCallFuture;
-import org.apache.cloudstack.framework.config.ConfigValue;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 import org.apache.cloudstack.storage.datastore.db.ImageStoreDao;
 import org.apache.cloudstack.storage.datastore.db.ImageStoreDetailsDao;
@@ -153,7 +152,6 @@ import com.cloud.utils.Pair;
 import com.cloud.utils.StringUtils;
 import com.cloud.utils.UriUtils;
 import com.cloud.utils.component.ComponentContext;
-import com.cloud.utils.component.InjectConfig;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.concurrency.NamedThreadFactory;
 import com.cloud.utils.db.DB;
@@ -858,12 +856,9 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager,
C
         listener.hostConnect(hostId, pool.getId());
     }
 
-    @InjectConfig(key = CapacityManager.StorageOverprovisioningFactorCK)
-    ConfigValue<Double> _storageOverprovisioningFactor;
-
     @Override
     public BigDecimal getStorageOverProvisioningFactor(Long dcId) {
-        return new BigDecimal(_storageOverprovisioningFactor.valueIn(dcId));
+        return new BigDecimal(CapacityManager.StorageOverprovisioningFactor.valueIn(dcId));
     }
 
     @Override
@@ -1462,12 +1457,9 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager,
C
         }
     }
 
-    @InjectConfig(key = CapacityManager.StorageCapacityDisableThresholdCK)
-    ConfigValue<Float> _storageCapacityDisableThreshold;
-
     private boolean checkUsagedSpace(StoragePool pool) {
         StatsCollector sc = StatsCollector.getInstance();
-        double storageUsedThreshold = _storageCapacityDisableThreshold.valueIn(pool.getDataCenterId());
+        double storageUsedThreshold = CapacityManager.StorageCapacityDisableThreshold.valueIn(pool.getDataCenterId());
         if (sc != null) {
             long totalSize = pool.getCapacityBytes();
             StorageStats stats = sc.getStoragePoolStats(pool.getId());
@@ -1537,9 +1529,6 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager,
C
         return futureIops <= pool.getCapacityIops();
     }
 
-    @InjectConfig(key = CapacityManager.StorageAllocatedCapacityDisableThresholdCK)
-    ConfigValue<Double> _storageAllocatedCapacityDisableThreshold;
-
     @Override
     public boolean storagePoolHasEnoughSpace(List<Volume> volumes,
             StoragePool pool) {
@@ -1575,7 +1564,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager,
C
             totalOverProvCapacity = pool.getCapacityBytes();
         }
 
-        double storageAllocatedThreshold = _storageAllocatedCapacityDisableThreshold.valueIn(pool.getDataCenterId());
+        double storageAllocatedThreshold = CapacityManager.StorageAllocatedCapacityDisableThreshold.valueIn(pool.getDataCenterId());
         if (s_logger.isDebugEnabled()) {
             s_logger.debug("Checking pool: " + pool.getId() + " for volume allocation " +
volumes.toString() + ", maxSize : " + totalOverProvCapacity
                     + ", totalAllocatedSize : " + allocatedSizeWithtemplate + ", askingSize
: " + totalAskingSize + ", allocated disable threshold: "

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
index 5ff9c92..7052599 100755
--- a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
+++ b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
@@ -763,7 +763,7 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements
Secondar
 
     private synchronized Map<Long, ZoneHostInfo> getZoneHostInfo() {
         Date cutTime = DateUtil.currentGMTTime();
-        List<RunningHostCountInfo> l = _hostDao.getRunningHostCounts(new Date(cutTime.getTime()
- _clusterMgr.getHeartbeatThreshold()));
+        List<RunningHostCountInfo> l = _hostDao.getRunningHostCounts(new Date(cutTime.getTime()
- ClusterManager.HeartbeatThreshold.value()));
 
         RunningHostInfoAgregator aggregator = new RunningHostInfoAgregator();
         if (l.size() > 0) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/server/src/com/cloud/template/TemplateAdapterBase.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/template/TemplateAdapterBase.java b/server/src/com/cloud/template/TemplateAdapterBase.java
index 073bc2d..a0d4c77 100755
--- a/server/src/com/cloud/template/TemplateAdapterBase.java
+++ b/server/src/com/cloud/template/TemplateAdapterBase.java
@@ -30,7 +30,6 @@ import org.apache.cloudstack.api.command.user.template.DeleteTemplateCmd;
 import org.apache.cloudstack.api.command.user.template.ExtractTemplateCmd;
 import org.apache.cloudstack.api.command.user.template.RegisterTemplateCmd;
 import org.apache.cloudstack.context.CallContext;
-import org.apache.cloudstack.framework.config.ConfigValue;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 import org.apache.cloudstack.storage.datastore.db.ImageStoreDao;
 import org.apache.cloudstack.storage.datastore.db.ImageStoreVO;
@@ -66,7 +65,6 @@ import com.cloud.user.dao.AccountDao;
 import com.cloud.user.dao.UserDao;
 import com.cloud.utils.EnumUtils;
 import com.cloud.utils.component.AdapterBase;
-import com.cloud.utils.component.InjectConfig;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.vm.UserVmVO;
 import com.cloud.vm.dao.UserVmDao;
@@ -92,10 +90,6 @@ public abstract class TemplateAdapterBase extends AdapterBase implements
Templat
     @Inject ConfigurationServer _configServer;
     @Inject ProjectManager _projectMgr;
 
-    @InjectConfig(key = TemplateManager.AllowPublicUserTemplatesCK)
-    ConfigValue<Boolean> _allowPublicUserTemplates;
-
-
     @Override
     public boolean stop() {
         return true;
@@ -175,7 +169,7 @@ public abstract class TemplateAdapterBase extends AdapterBase implements
Templat
         }
 
         // check whether owner can create public templates
-        boolean allowPublicUserTemplates = _allowPublicUserTemplates.valueIn(templateOwner.getId());
+        boolean allowPublicUserTemplates = TemplateManager.AllowPublicUserTemplates.valueIn(templateOwner.getId());
         if (!isAdmin && !allowPublicUserTemplates && isPublic) {
             throw new InvalidParameterValueException("Only private templates/ISO can be created.");
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/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 3e6e71c..e11ac0d 100755
--- a/server/src/com/cloud/template/TemplateManagerImpl.java
+++ b/server/src/com/cloud/template/TemplateManagerImpl.java
@@ -70,7 +70,6 @@ import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
 import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
 import org.apache.cloudstack.framework.async.AsyncCallFuture;
 import org.apache.cloudstack.framework.config.ConfigKey;
-import org.apache.cloudstack.framework.config.ConfigValue;
 import org.apache.cloudstack.framework.config.Configurable;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 import org.apache.cloudstack.framework.jobs.AsyncJobManager;
@@ -173,7 +172,6 @@ import com.cloud.utils.EnumUtils;
 import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.Pair;
 import com.cloud.utils.component.AdapterBase;
-import com.cloud.utils.component.InjectConfig;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.concurrency.NamedThreadFactory;
 import com.cloud.utils.db.DB;
@@ -189,8 +187,6 @@ import com.cloud.vm.dao.VMInstanceDao;
 @Local(value = { TemplateManager.class, TemplateApiService.class })
 public class TemplateManagerImpl extends ManagerBase implements TemplateManager, TemplateApiService,
Configurable {
     private final static Logger s_logger = Logger.getLogger(TemplateManagerImpl.class);
-    @InjectConfig(key = TemplateManager.AllowPublicUserTemplatesCK)
-    ConfigValue<Boolean> _allowPublicUserTemplates;
 
     @Inject
     VMTemplateDao _tmpltDao;
@@ -1220,7 +1216,7 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
         boolean isAdmin = _accountMgr.isAdmin(caller.getType());
         // check configuration parameter(allow.public.user.templates) value for
         // the template owner
-        boolean allowPublicUserTemplates = _allowPublicUserTemplates.valueIn(template.getAccountId());
+        boolean allowPublicUserTemplates = AllowPublicUserTemplates.valueIn(template.getAccountId());
         if (!isAdmin && !allowPublicUserTemplates && isPublic != null &&
isPublic) {
             throw new InvalidParameterValueException("Only private " + mediaType + "s can
be created.");
         }
@@ -1482,7 +1478,7 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
         }
         boolean  isDynamicScalingEnabled = cmd.isDynamicallyScalable();
         // check whether template owner can create public templates
-        boolean allowPublicUserTemplates = _allowPublicUserTemplates.valueIn(templateOwner.getId());
+        boolean allowPublicUserTemplates = AllowPublicUserTemplates.valueIn(templateOwner.getId());
         if (!isAdmin && !allowPublicUserTemplates && isPublic) {
             throw new PermissionDeniedException("Failed to create template " + name + ",
only private templates can be created.");
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/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 c764805..a556360 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -69,7 +69,6 @@ import org.apache.cloudstack.engine.service.api.OrchestrationService;
 import org.apache.cloudstack.engine.subsystem.api.storage.TemplateDataFactory;
 import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
 import org.apache.cloudstack.framework.config.ConfigKey;
-import org.apache.cloudstack.framework.config.ConfigValue;
 import org.apache.cloudstack.framework.config.Configurable;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 import org.apache.cloudstack.framework.jobs.AsyncJobManager;
@@ -272,9 +271,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Vir
         linked
     }
 
-    @InjectConfig(key = EnableDynamicallyScaleVmCK)
-    ConfigValue<Boolean> _enableDynamicallyScaleVm;
-
     @Inject
     EntityManager _entityMgr;
     @Inject
@@ -1270,7 +1266,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Vir
         if (vmInstance.getState().equals(State.Running)) {
             int retry = _scaleRetry;
             ExcludeList excludes = new ExcludeList();
-            boolean enableDynamicallyScaleVm = _enableDynamicallyScaleVm.valueIn(vmInstance.getDataCenterId());
+            boolean enableDynamicallyScaleVm = EnableDynamicallyScaleVm.valueIn(vmInstance.getDataCenterId());
             if(!enableDynamicallyScaleVm){
                throw new PermissionDeniedException("Dynamically scaling virtual machines
is disabled for this zone, please contact your admin");
             }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/utils/src/com/cloud/utils/component/ComponentLifecycleBase.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/component/ComponentLifecycleBase.java b/utils/src/com/cloud/utils/component/ComponentLifecycleBase.java
index 2a4325f..5351123 100644
--- a/utils/src/com/cloud/utils/component/ComponentLifecycleBase.java
+++ b/utils/src/com/cloud/utils/component/ComponentLifecycleBase.java
@@ -16,42 +16,25 @@
 // under the License.
 package com.cloud.utils.component;
 
-import java.lang.reflect.Field;
 import java.util.HashMap;
 import java.util.Map;
 
-import javax.annotation.PostConstruct;
-import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
-import com.cloud.utils.ReflectUtil;
+import org.apache.log4j.Logger;
 
 public class ComponentLifecycleBase implements ComponentLifecycle {
+    private static final Logger s_logger = Logger.getLogger(ComponentLifecycleBase.class);
 
     protected String _name;
     protected int _runLevel;
     protected Map<String, Object> _configParams = new HashMap<String, Object>();
-    @Inject
-    protected ConfigInjector _configInjector;
 
     public ComponentLifecycleBase() {
         _name = this.getClass().getSimpleName();
         _runLevel = RUN_LEVEL_COMPONENT;
     }
 
-    @PostConstruct
-    protected void injectConfigs() {
-        if (_configInjector != null) {
-            for (Field field : ReflectUtil.getAllFieldsForClass(this.getClass(), Object.class))
{
-                InjectConfig config = field.getAnnotation(InjectConfig.class);
-                if (config != null) {
-                    field.setAccessible(true);
-                    _configInjector.inject(field, this, config.key());
-                }
-            }
-        }
-    }
-
     @Override
     public String getName() {
         return _name;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/utils/src/com/cloud/utils/component/ConfigInjector.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/component/ConfigInjector.java b/utils/src/com/cloud/utils/component/ConfigInjector.java
deleted file mode 100644
index b1c6531..0000000
--- a/utils/src/com/cloud/utils/component/ConfigInjector.java
+++ /dev/null
@@ -1,27 +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.utils.component;
-
-import java.lang.reflect.Field;
-
-/**
- * This interface can be implemented by someone who knows how to inject configurations.
- *
- */
-public interface ConfigInjector {
-    void inject(Field field, Object obj, String key);
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/utils/src/com/cloud/utils/component/InjectConfig.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/component/InjectConfig.java b/utils/src/com/cloud/utils/component/InjectConfig.java
deleted file mode 100644
index b4afd7a..0000000
--- a/utils/src/com/cloud/utils/component/InjectConfig.java
+++ /dev/null
@@ -1,29 +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.utils.component;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-@Target({FIELD})
-@Retention(RUNTIME)
-public @interface InjectConfig {
-    String key();
-}


Mime
View raw message