cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahu...@apache.org
Subject [31/36] git commit: updated refs/heads/master to a05ec6d
Date Fri, 06 Sep 2013 22:39:01 GMT
Compile complete


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

Branch: refs/heads/master
Commit: b8e79c30a82d0a1deb557d1beb0fc81c196ab152
Parents: 6e8ca99
Author: Alex Huang <alex.huang@citrix.com>
Authored: Thu Aug 29 09:48:05 2013 -0700
Committer: Alex Huang <alex.huang@citrix.com>
Committed: Fri Sep 6 15:40:37 2013 -0700

----------------------------------------------------------------------
 api/pom.xml                                     |   5 +
 .../apache/cloudstack/config/Configuration.java |  84 ---------
 .../cloudstack/test/utils/SpringUtils.java      |   1 +
 client/tomcatconf/applicationContext.xml.in     |   6 +-
 .../src/com/cloud/agent/AgentManager.java       |   5 +-
 .../cloud/agent/manager/AgentManagerImpl.java   |   9 +-
 .../manager/ClusteredAgentManagerImpl.java      |  13 ++
 .../storage/allocator/StorageAllocatorTest.java |   2 +-
 .../test/DirectAgentManagerSimpleImpl.java      |  20 +-
 framework/config/pom.xml                        |  12 --
 .../apache/cloudstack/config/Configuration.java |  84 +++++++++
 .../framework/config/ConfigDepotImpl.java       | 148 ---------------
 .../framework/config/ConfigValue.java           |  28 +--
 .../framework/config/ConfigurationVO.java       | 175 ------------------
 .../framework/config/dao/ConfigurationDao.java  |   2 +-
 .../config/dao/ConfigurationDaoImpl.java        | 111 ++++++-----
 .../framework/config/impl/ConfigDepotImpl.java  | 158 ++++++++++++++++
 .../framework/config/impl/ConfigurationVO.java  | 176 ++++++++++++++++++
 .../framework/config/ConfigDepotAdminTest.java  | 131 -------------
 .../config/impl/ConfigDepotAdminTest.java       | 102 ++++++++++
 .../src/com/cloud/utils/db/GenericDaoBase.java  |   1 +
 server/src/com/cloud/api/ApiServer.java         |   2 +-
 .../src/com/cloud/api/doc/ApiXmlDocWriter.java  |  44 +++--
 .../configuration/ConfigurationManagerImpl.java |   2 +-
 .../com/cloud/resource/ResourceManagerImpl.java |  64 +------
 .../com/cloud/server/ConfigurationServer.java   |   2 +-
 .../cloud/server/ConfigurationServerImpl.java   |   2 +-
 .../com/cloud/server/ManagementServerImpl.java  |   2 +-
 server/src/com/cloud/vm/UserVmManagerImpl.java  |   7 +-
 .../com/cloud/alert/AlertControlsUnitTest.java  |   2 +
 .../cloud/vpc/dao/MockConfigurationDaoImpl.java |   2 +-
 .../CreateNetworkOfferingTest.java              |   2 +-
 utils/src/com/cloud/utils/ReflectUtil.java      |  18 +-
 .../com/cloud/utils/component/AdapterBase.java  |  15 +-
 .../cloud/utils/component/ComponentContext.java | 184 +++++++++----------
 .../utils/component/ComponentLifecycleBase.java | 123 +++++++------
 .../com/cloud/utils/component/ManagerBase.java  |   9 +-
 37 files changed, 857 insertions(+), 896 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/api/pom.xml
----------------------------------------------------------------------
diff --git a/api/pom.xml b/api/pom.xml
index 36d6a18..baedf01 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -41,6 +41,11 @@
       <version>${project.version}</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-framework-config</artifactId>
+      <version>${project.version}</version>
+    </dependency>
   </dependencies>
   <build>
     <plugins>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/api/src/org/apache/cloudstack/config/Configuration.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/config/Configuration.java b/api/src/org/apache/cloudstack/config/Configuration.java
deleted file mode 100644
index a8031a5..0000000
--- a/api/src/org/apache/cloudstack/config/Configuration.java
+++ /dev/null
@@ -1,84 +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 org.apache.cloudstack.config;
-
-import java.util.Date;
-
-/**
- * Configuration represents one global configuration parameter for CloudStack.
- * Its scope should indicate whether this parameter can be set at different
- * organization levels in CloudStack.
- *
- */
-public interface Configuration {
-
-    /**
-     * @return Category of the parameter.
-     */
-    String getCategory();
-
-    /**
-     * @return Server instance that uses this parameter.
-     */
-    String getInstance();
-
-    /**
-     * @return Component that introduced this parameter.
-     */
-    String getComponent();
-
-    /**
-     * @return Name of the parameter.
-     */
-    String getName();
-
-    /**
-     * @return Value set by the administrator.  Defaults to the defaultValue.
-     */
-    String getValue();
-
-    /**
-     * @return Description of the value and the range of the value.
-     */
-    String getDescription();
-
-    /**
-     * @return Default value for this parameter.  Null indicates this parameter is optional.
-     */
-    String getDefaultValue();
-
-    /**
-     * @return Scope for the parameter.  Null indicates that this parameter is
-     * always global.  A non-null value indicates that this parameter can be
-     * set at a certain organization level.
-     */
-    String getScope();
-
-    /**
-     * @return can the configuration parameter be changed without restarting the server.
-     */
-    boolean isDynamic();
-
-    /**
-     * @return The date this VO was updated by the components.  Note that this is not
-     * a date for when an administrator updates the value.  This is when the system
-     * updated this value.  By searching on this field gives you all the config
-     * parameters that have changed in an upgrade.  Null value indicates that this
-     * parameter is no longer used and can be deleted.
-     */
-    Date getUpdated();
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/api/test/org/apache/cloudstack/test/utils/SpringUtils.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/test/utils/SpringUtils.java b/api/test/org/apache/cloudstack/test/utils/SpringUtils.java
index 220bd80..0e73a3b 100644
--- a/api/test/org/apache/cloudstack/test/utils/SpringUtils.java
+++ b/api/test/org/apache/cloudstack/test/utils/SpringUtils.java
@@ -109,5 +109,6 @@ public class SpringUtils {
 
             return processor;
         }
+
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/client/tomcatconf/applicationContext.xml.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/applicationContext.xml.in b/client/tomcatconf/applicationContext.xml.in
index e87636c..9b6636a 100644
--- a/client/tomcatconf/applicationContext.xml.in
+++ b/client/tomcatconf/applicationContext.xml.in
@@ -81,7 +81,7 @@
   </bean>
 
   <bean id="messageBus" class = "org.apache.cloudstack.framework.messagebus.MessageBusBase" />
-  <bean id="configDepot" class = "org.apache.cloudstack.framework.config.ConfigDepotImpl" />
+  <bean id="configDepot" class = "org.apache.cloudstack.framework.config.impl.ConfigDepotImpl" />
 
   <!--
     DAO with customized configuration
@@ -718,6 +718,7 @@
   <bean id="storageManagerImpl" class="com.cloud.storage.StorageManagerImpl"/>
   
   <bean id="volumeOrchestrator" class="org.apache.cloudstack.engine.orchestration.VolumeOrchestrator">
+    <property name="PodAllocators" value="#{podAllocators.Adapters}" />
     <property name="StoragePoolAllocators" value="#{storagePoolAllocators.Adapters}" />
   </bean>
 
@@ -726,7 +727,6 @@
   </bean>
 
   <bean id="resourceManagerImpl" class="com.cloud.resource.ResourceManagerImpl" >
-    <property name="PodAllocators" value="#{podAllocators.Adapters}" />
     <property name="Discoverers" value="#{resourceDiscoverers.Adapters}" />
   </bean>
 
@@ -739,7 +739,7 @@
     <property name="HostAllocators" value="#{hostAllocators.Adapters}" />
   </bean>
 
-  <bean id="networkManagerImpl" class="com.cloud.network.NetworkManagerImpl" >
+  <bean id="networkOrchestrator" class="org.apache.cloudstack.engine.orchestration.NetworkOrchestrator" >
     <property name="NetworkGurus" value="#{networkGurus.Adapters}" />
     <property name="NetworkElements" value="#{networkElements.Adapters}" />
     <property name="IpDeployers" value="#{ipDeployers.Adapters}" />

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/engine/components-api/src/com/cloud/agent/AgentManager.java
----------------------------------------------------------------------
diff --git a/engine/components-api/src/com/cloud/agent/AgentManager.java b/engine/components-api/src/com/cloud/agent/AgentManager.java
index a10db29..ec77032 100755
--- a/engine/components-api/src/com/cloud/agent/AgentManager.java
+++ b/engine/components-api/src/com/cloud/agent/AgentManager.java
@@ -122,9 +122,6 @@ public interface AgentManager {
 
     Answer sendTo(Long dcId, HypervisorType type, Command cmd);
 
-    /* working as a lock while agent is being loaded */
-    public boolean tapLoadingAgents(Long hostId, TapAgentsAction action);
-
 //    public AgentAttache handleDirectConnectAgent(HostVO host, StartupCommand[] cmds, ServerResource resource, boolean forRebalance) throws ConnectionException;
 
     public boolean agentStatusTransitTo(HostVO host, Status.Event e, long msId);
@@ -138,4 +135,6 @@ public interface AgentManager {
     public void pullAgentOutMaintenance(long hostId);
 
     boolean reconnect(long hostId);
+
+    void rescan();
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java b/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
index a70f403..d8d31cd 100755
--- a/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
@@ -654,6 +654,9 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
         return resource;
     }
 
+    @Override
+    public void rescan() {
+    }
 
     protected boolean loadDirectlyConnectedHost(HostVO host, boolean forRebalance) {
         boolean initialized = false;
@@ -683,7 +686,10 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
         }
 
         if (forRebalance) {
+            tapLoadingAgents(host.getId(), TapAgentsAction.Add);
             Host h = _resourceMgr.createHostAndAgent(host.getId(), resource, host.getDetails(), false, null, true);
+            tapLoadingAgents(host.getId(), TapAgentsAction.Del);
+
             return (h == null ? false : true);
         } else {
             _executor.execute(new SimulateStartTask(host.getId(), resource, host.getDetails()));
@@ -1054,7 +1060,9 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
                     s_logger.debug("Simulating start for resource " + resource.getName() + " id " + id);
                 }
 
+                tapLoadingAgents(id, TapAgentsAction.Add);
                 _resourceMgr.createHostAndAgent(id, resource, details, false, null, false);
+                tapLoadingAgents(id, TapAgentsAction.Del);
             } catch (Exception e) {
                 s_logger.warn("Unable to simulate start on resource " + id + " name " + resource.getName(), e);
             } finally {
@@ -1302,7 +1310,6 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
     protected AgentManagerImpl() {
     }
 
-    @Override
     public boolean tapLoadingAgents(Long hostId, TapAgentsAction action) {
         synchronized (_loadingAgents) {
             if (action == TapAgentsAction.Add) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java b/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
index 3b24e94..d84505b 100755
--- a/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
@@ -1405,6 +1405,19 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust
     }
     
     @Override
+    public void rescan() {
+        // schedule a scan task immediately
+        if (s_logger.isDebugEnabled()) {
+            s_logger.debug("Scheduling a host scan task");
+        }
+        // schedule host scan task on current MS
+        scheduleHostScanTask();
+        if (s_logger.isDebugEnabled()) {
+            s_logger.debug("Notifying all peer MS to schedule host scan task");
+        }
+    }
+
+    @Override
     public ConfigKey<?>[] getConfigKeys() {
         ConfigKey<?>[] keys = super.getConfigKeys();
         

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java
index 2a57904..44d9876 100644
--- a/engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java
+++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java
@@ -35,8 +35,8 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager;
 import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
-import org.apache.cloudstack.framework.config.ConfigurationVO;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.cloudstack.framework.config.impl.ConfigurationVO;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailVO;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java
index 0d2fee1..62bd077 100644
--- a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java
+++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java
@@ -38,14 +38,11 @@ import com.cloud.agent.StartupCommandProcessor;
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.Command;
 import com.cloud.agent.api.SetupCommand;
-import com.cloud.agent.api.StartupCommand;
-import com.cloud.agent.manager.AgentAttache;
 import com.cloud.agent.manager.Commands;
 import com.cloud.dc.ClusterDetailsDao;
 import com.cloud.dc.ClusterVO;
 import com.cloud.dc.dao.ClusterDao;
 import com.cloud.exception.AgentUnavailableException;
-import com.cloud.exception.ConnectionException;
 import com.cloud.exception.DiscoveryException;
 import com.cloud.exception.OperationTimedoutException;
 import com.cloud.host.HostEnvironment;
@@ -80,6 +77,10 @@ public class DirectAgentManagerSimpleImpl extends ManagerBase implements AgentMa
     }
 
     @Override
+    public void rescan() {
+    }
+
+    @Override
     public boolean start() {
         // TODO Auto-generated method stub
         return false;
@@ -236,19 +237,6 @@ public class DirectAgentManagerSimpleImpl extends ManagerBase implements AgentMa
     }
 
     @Override
-    public boolean tapLoadingAgents(Long hostId, TapAgentsAction action) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public AgentAttache handleDirectConnectAgent(HostVO host, StartupCommand[] cmds, ServerResource resource,
-            boolean forRebalance) throws ConnectionException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
     public boolean agentStatusTransitTo(HostVO host, Event e, long msId) {
         try {
             return _statusStateMachine.transitTo(host, e, host.getId(), _hostDao);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/framework/config/pom.xml
----------------------------------------------------------------------
diff --git a/framework/config/pom.xml b/framework/config/pom.xml
index 0d4344e..7c42201 100644
--- a/framework/config/pom.xml
+++ b/framework/config/pom.xml
@@ -29,17 +29,5 @@
       <artifactId>cloud-framework-db</artifactId>
       <version>${project.version}</version>
     </dependency>
-    <dependency>
-      <groupId>org.apache.cloudstack</groupId>
-      <artifactId>cloud-api</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.cloudstack</groupId>
-      <artifactId>cloud-api</artifactId>
-      <version>${project.version}</version>
-      <type>test-jar</type>
-      <scope>test</scope>
-    </dependency>    
   </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/framework/config/src/org/apache/cloudstack/config/Configuration.java
----------------------------------------------------------------------
diff --git a/framework/config/src/org/apache/cloudstack/config/Configuration.java b/framework/config/src/org/apache/cloudstack/config/Configuration.java
new file mode 100644
index 0000000..a8031a5
--- /dev/null
+++ b/framework/config/src/org/apache/cloudstack/config/Configuration.java
@@ -0,0 +1,84 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.config;
+
+import java.util.Date;
+
+/**
+ * Configuration represents one global configuration parameter for CloudStack.
+ * Its scope should indicate whether this parameter can be set at different
+ * organization levels in CloudStack.
+ *
+ */
+public interface Configuration {
+
+    /**
+     * @return Category of the parameter.
+     */
+    String getCategory();
+
+    /**
+     * @return Server instance that uses this parameter.
+     */
+    String getInstance();
+
+    /**
+     * @return Component that introduced this parameter.
+     */
+    String getComponent();
+
+    /**
+     * @return Name of the parameter.
+     */
+    String getName();
+
+    /**
+     * @return Value set by the administrator.  Defaults to the defaultValue.
+     */
+    String getValue();
+
+    /**
+     * @return Description of the value and the range of the value.
+     */
+    String getDescription();
+
+    /**
+     * @return Default value for this parameter.  Null indicates this parameter is optional.
+     */
+    String getDefaultValue();
+
+    /**
+     * @return Scope for the parameter.  Null indicates that this parameter is
+     * always global.  A non-null value indicates that this parameter can be
+     * set at a certain organization level.
+     */
+    String getScope();
+
+    /**
+     * @return can the configuration parameter be changed without restarting the server.
+     */
+    boolean isDynamic();
+
+    /**
+     * @return The date this VO was updated by the components.  Note that this is not
+     * a date for when an administrator updates the value.  This is when the system
+     * updated this value.  By searching on this field gives you all the config
+     * parameters that have changed in an upgrade.  Null value indicates that this
+     * parameter is no longer used and can be deleted.
+     */
+    Date getUpdated();
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepotImpl.java
----------------------------------------------------------------------
diff --git a/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepotImpl.java b/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepotImpl.java
deleted file mode 100644
index 241dcfe..0000000
--- a/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepotImpl.java
+++ /dev/null
@@ -1,148 +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 org.apache.cloudstack.framework.config;
-
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-
-import javax.inject.Inject;
-
-import org.apache.cloudstack.framework.config.ConfigKey.Scope;
-import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
-
-import com.cloud.utils.component.ConfigInjector;
-import com.cloud.utils.component.SystemIntegrityChecker;
-import com.cloud.utils.db.EntityManager;
-import com.cloud.utils.exception.CloudRuntimeException;
-
-/**
- * ConfigDepotImpl implements the ConfigDepot and ConfigDepotAdmin interface.
- * Its functionalities include:
- *   - Control how dynamic config values are cached and refreshed.
- *   - Control how scoped config values are stored.
- *   - Gather all of the Configurable interfaces and insert their config
- *     variables into the config table.
- *   - Hide the data source where configs are stored and retrieved.
- * 
- * When dealing with this class, we must be very careful on cluster situations.
- *
- * TODO:
- *   - Move the rest of the changes to the config table to here.
- *   - Add the code to mark the rows in configuration table without
- *     the corresponding keys to be null.
- *   - Move all of the configurations to using ConfigDepot
- *   - Completely eliminate Config.java
- *   - Figure out the correct categories.
- *
- */
-class ConfigDepotImpl implements ConfigDepot, ConfigDepotAdmin, SystemIntegrityChecker, ConfigInjector {
-    @Inject
-    EntityManager      _entityMgr;
-    @Inject
-    ConfigurationDao   _configDao;
-    @Inject
-    List<Configurable> _configurables;
-    @Inject
-    List<ScopedConfigStorage> _scopedStorage;
-
-    HashMap<String, ConfigKey<?>> _allKeys = new HashMap<String, ConfigKey<?>>(1007);
-
-    public ConfigDepotImpl() {
-    }
-
-    @Override
-    public <T> ConfigValue<T> get(ConfigKey<T> config) {
-        if (config.scope() == Scope.Global) {
-            return new ConfigValue<T>(_entityMgr, config);
-        } else {
-            for (ScopedConfigStorage storage : _scopedStorage) {
-                if (storage.getScope() == config.scope()) {
-                    return new ConfigValue<T>(_entityMgr, config, storage);
-                }
-            }
-            throw new CloudRuntimeException("Unable to find config storage for this scope: " + config.scope());
-        }
-    }
-
-    @Override
-    public void populateConfigurations() {
-        Date date = new Date();
-        for (Configurable configurable : _configurables) {
-            for (ConfigKey<?> key : configurable.getConfigKeys()) {
-                ConfigurationVO vo = _configDao.findById(key.key());
-                if (vo == null) {
-                    vo = new ConfigurationVO(configurable.getConfigComponentName(), key);
-                    vo.setUpdated(date);
-                    _configDao.persist(vo);
-                } else {
-                    if (vo.isDynamic() != key.isDynamic() ||
-                        !vo.getDescription().equals(key.description()) ||
-                        ((vo.getDefaultValue() != null && key.defaultValue() == null) ||
-                         (vo.getDefaultValue() == null && key.defaultValue() != null) ||
-                        !vo.getDefaultValue().equals(key.defaultValue()))) {
-                        vo.setDynamic(key.isDynamic());
-                        vo.setDescription(key.description());
-                        vo.setDefaultValue(key.defaultValue());
-                        vo.setUpdated(date);
-                        _configDao.persist(vo);
-                    }
-                }
-            }
-        }
-    }
-
-    @Override
-    public List<String> getComponentsInDepot() {
-        return new ArrayList<String>();
-    }
-
-    @Override
-    public void check() {
-        for (Configurable configurable : _configurables) {
-            for (ConfigKey<?> key : configurable.getConfigKeys()) {
-                if (_allKeys.containsKey(key.key())) {
-                    throw new CloudRuntimeException("Configurable " + configurable.getConfigComponentName() + " is adding a key that has been added before: " + key.toString());
-                }
-                _allKeys.put(key.key(), key);
-            }
-        }
-    }
-
-    @Override
-    public void inject(Field field, Object obj, String key) {
-        ConfigKey<?> configKey = _allKeys.get(key);
-        try {
-            field.set(obj, get(configKey));
-        } catch (IllegalArgumentException e) {
-            throw new CloudRuntimeException("Unable to inject configuration due to ", e);
-        } catch (IllegalAccessException e) {
-            throw new CloudRuntimeException("Unable to inject configuration due to ", e);
-        }
-    }
-
-    @Override
-    public ConfigValue<?> get(String name) {
-        ConfigKey<?> configKey = _allKeys.get(name);
-        if (configKey == null) {
-            throw new CloudRuntimeException("Unable to find a registered config key for " + name);
-        }
-        return get(configKey);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/framework/config/src/org/apache/cloudstack/framework/config/ConfigValue.java
----------------------------------------------------------------------
diff --git a/framework/config/src/org/apache/cloudstack/framework/config/ConfigValue.java b/framework/config/src/org/apache/cloudstack/framework/config/ConfigValue.java
index c6b99db..9ba5f86 100644
--- a/framework/config/src/org/apache/cloudstack/framework/config/ConfigValue.java
+++ b/framework/config/src/org/apache/cloudstack/framework/config/ConfigValue.java
@@ -18,30 +18,28 @@ package org.apache.cloudstack.framework.config;
 
 import java.sql.Date;
 
-import org.apache.cloudstack.config.Configuration;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.cloudstack.framework.config.impl.ConfigurationVO;
 
-import com.cloud.utils.db.EntityManager;
 import com.cloud.utils.exception.CloudRuntimeException;
 
 /**
  *  This is a match set to ConfigKey.
  *
- * TODO: When we create a framework project for configuration, this should be
- * moved there.
  */
 public class ConfigValue<T> {
 
     ConfigKey<T> _config;
-    EntityManager _entityMgr;
+    ConfigurationDao _dao;
     T _value;
     ScopedConfigStorage _storage;
 
-    public ConfigValue(EntityManager entityMgr, ConfigKey<T> config) {
-        _entityMgr = entityMgr;
+    public ConfigValue(ConfigurationDao entityMgr, ConfigKey<T> config) {
+        _dao = entityMgr;
         _config = config;
     }
 
-    protected ConfigValue(EntityManager entityMgr, ConfigKey<T> key, ScopedConfigStorage storage) {
+    public ConfigValue(ConfigurationDao entityMgr, ConfigKey<T> key, ScopedConfigStorage storage) {
         this(entityMgr, key);
         _storage = storage;
     }
@@ -52,7 +50,7 @@ public class ConfigValue<T> {
 
     public T value() {
         if (_value == null || _config.isDynamic()) {
-            Configuration vo = _entityMgr.findById(Configuration.class, _config.key());
+            ConfigurationVO vo = _dao.findById(_config.key());
             _value = valueOf(vo != null ? vo.getValue() : _config.defaultValue());
         }
 
@@ -70,21 +68,25 @@ public class ConfigValue<T> {
 
     @SuppressWarnings("unchecked")
     protected T valueOf(String value) {
+        Number multiplier = 1;
+        if (_config.multiplier() != null) {
+            multiplier = (Number)_config.multiplier();
+        }
         Class<T> type = _config.type();
         if (type.isAssignableFrom(Boolean.class)) {
             return (T)Boolean.valueOf(value);
         } else if (type.isAssignableFrom(Integer.class)) {
-            return (T)new Integer((Integer.parseInt(value) * ((Number)_config.multiplier()).intValue()));
+            return (T)new Integer(Integer.parseInt(value) * multiplier.intValue());
         } else if (type.isAssignableFrom(Long.class)) {
-            return (T)new Long(Long.parseLong(value) * ((Number)_config.multiplier()).longValue());
+            return (T)new Long(Long.parseLong(value) * multiplier.longValue());
         } else if (type.isAssignableFrom(Short.class)) {
             return (T)new Short(Short.parseShort(value));
         } else if (type.isAssignableFrom(String.class)) {
             return (T)value;
         } else if (type.isAssignableFrom(Float.class)) {
-            return (T)new Float(Float.parseFloat(value) * ((Number)_config.multiplier()).floatValue());
+            return (T)new Float(Float.parseFloat(value) * multiplier.floatValue());
         } else if (type.isAssignableFrom(Double.class)) {
-            return (T)new Double(Double.parseDouble(value));
+            return (T)new Double(Double.parseDouble(value) * multiplier.doubleValue());
         } else if (type.isAssignableFrom(String.class)) {
             return (T)value;
         } else if (type.isAssignableFrom(Date.class)) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/framework/config/src/org/apache/cloudstack/framework/config/ConfigurationVO.java
----------------------------------------------------------------------
diff --git a/framework/config/src/org/apache/cloudstack/framework/config/ConfigurationVO.java b/framework/config/src/org/apache/cloudstack/framework/config/ConfigurationVO.java
deleted file mode 100644
index 2953fcf..0000000
--- a/framework/config/src/org/apache/cloudstack/framework/config/ConfigurationVO.java
+++ /dev/null
@@ -1,175 +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 org.apache.cloudstack.framework.config;
-
-import java.util.Date;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-
-import org.apache.cloudstack.config.Configuration;
-
-import com.cloud.utils.crypt.DBEncryptionUtil;
-
-@Entity
-@Table(name = "configuration")
-public class ConfigurationVO implements Configuration {
-    @Column(name = "instance")
-    private String instance;
-
-    @Column(name = "component")
-    private String component;
-
-    @Id
-    @Column(name = "name")
-    private String name;
-
-    @Column(name = "value", length = 4095)
-    private String value;
-
-    @Column(name = "default_value", length = 4095)
-    private String defaultValue;
-
-    @Column(name = "description", length = 1024)
-    private String description;
-
-    @Column(name = "category")
-    private String category;
-
-    @Column(name = "is_dynamic")
-    private boolean dynamic;
-
-    @Column(name = "scope")
-    private String scope;
-
-    @Column(name = "updated")
-    @Temporal(value = TemporalType.TIMESTAMP)
-    private Date updated;
-
-    protected ConfigurationVO() {
-    }
-
-    public ConfigurationVO(String category, String instance, String component, String name, String value, String description) {
-        this.category = category;
-        this.instance = instance;
-        this.component = component;
-        this.name = name;
-        this.value = value;
-        this.description = description;
-    }
-
-    public ConfigurationVO(String component, ConfigKey<?> key) {
-        this(key.category(), "DEFAULT", component, key.key(), key.defaultValue(), key.description());
-        defaultValue = key.defaultValue();
-        dynamic = key.isDynamic();
-        scope = key.scope() != null ? key.scope().toString() : null;
-    }
-
-    @Override
-    public String getCategory() {
-        return category;
-    }
-
-    public void setCategory(String category) {
-        this.category = category;
-    }
-
-    @Override
-    public String getInstance() {
-        return instance;
-    }
-
-    public void setInstance(String instance) {
-        this.instance = instance;
-    }
-
-    @Override
-    public String getComponent() {
-        return component;
-    }
-
-    public void setComponent(String component) {
-        this.component = component;
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    @Override
-    public String getValue() {
-        return (("Hidden".equals(getCategory()) || "Secure".equals(getCategory())) ? DBEncryptionUtil.decrypt(value) : value);
-    }
-
-    public void setValue(String value) {
-        this.value = value;
-    }
-
-    @Override
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-    @Override
-    public String getScope() {
-        return scope;
-    }
-
-    @Override
-    public boolean isDynamic() {
-        return dynamic;
-    }
-
-    public void setDynamic(boolean dynamic) {
-        this.dynamic = dynamic;
-    }
-
-    @Override
-    public String getDefaultValue() {
-        return defaultValue;
-    }
-
-    public void setDefaultValue(String defaultValue) {
-        this.defaultValue = defaultValue;
-    }
-
-    public void setScope(String scope) {
-        this.scope = scope;
-    }
-
-    @Override
-    public Date getUpdated() {
-        return updated;
-    }
-
-    public void setUpdated(Date updated) {
-        this.updated = updated;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/framework/config/src/org/apache/cloudstack/framework/config/dao/ConfigurationDao.java
----------------------------------------------------------------------
diff --git a/framework/config/src/org/apache/cloudstack/framework/config/dao/ConfigurationDao.java b/framework/config/src/org/apache/cloudstack/framework/config/dao/ConfigurationDao.java
index 70fdb2e..2f4b6e2 100644
--- a/framework/config/src/org/apache/cloudstack/framework/config/dao/ConfigurationDao.java
+++ b/framework/config/src/org/apache/cloudstack/framework/config/dao/ConfigurationDao.java
@@ -19,7 +19,7 @@ package org.apache.cloudstack.framework.config.dao;
 import java.util.Map;
 import java.util.List;
 
-import org.apache.cloudstack.framework.config.ConfigurationVO;
+import org.apache.cloudstack.framework.config.impl.ConfigurationVO;
 
 import com.cloud.utils.db.GenericDao;
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/framework/config/src/org/apache/cloudstack/framework/config/dao/ConfigurationDaoImpl.java
----------------------------------------------------------------------
diff --git a/framework/config/src/org/apache/cloudstack/framework/config/dao/ConfigurationDaoImpl.java b/framework/config/src/org/apache/cloudstack/framework/config/dao/ConfigurationDaoImpl.java
index c677fa9..26292b7 100644
--- a/framework/config/src/org/apache/cloudstack/framework/config/dao/ConfigurationDaoImpl.java
+++ b/framework/config/src/org/apache/cloudstack/framework/config/dao/ConfigurationDaoImpl.java
@@ -17,19 +17,16 @@
 package org.apache.cloudstack.framework.config.dao;
 
 import java.sql.PreparedStatement;
-import java.sql.ResultSet;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import javax.annotation.PostConstruct;
 import javax.ejb.Local;
 import javax.naming.ConfigurationException;
 
 import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
 
-import org.apache.cloudstack.framework.config.ConfigurationVO;
+import org.apache.cloudstack.framework.config.impl.ConfigurationVO;
 
 import com.cloud.utils.component.ComponentLifecycle;
 import com.cloud.utils.crypt.DBEncryptionUtil;
@@ -40,8 +37,7 @@ import com.cloud.utils.db.SearchCriteria;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.exception.CloudRuntimeException;
 
-@Component
-@Local(value={ConfigurationDao.class})
+@Local(value = {ConfigurationDao.class})
 public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String> implements ConfigurationDao {
     private static final Logger s_logger = Logger.getLogger(ConfigurationDaoImpl.class);
     private Map<String, String> _configs = null;
@@ -49,13 +45,13 @@ public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String
 
     final SearchBuilder<ConfigurationVO> InstanceSearch;
     final SearchBuilder<ConfigurationVO> NameSearch;
-    
+
     public static final String UPDATE_CONFIGURATION_SQL = "UPDATE configuration SET value = ? WHERE name = ?";
 
-    public ConfigurationDaoImpl () {
+    public ConfigurationDaoImpl() {
         InstanceSearch = createSearchBuilder();
         InstanceSearch.and("instance", InstanceSearch.entity().getInstance(), SearchCriteria.Op.EQ);
-        
+
         NameSearch = createSearchBuilder();
         NameSearch.and("name", NameSearch.entity().getName(), SearchCriteria.Op.EQ);
         setRunLevel(ComponentLifecycle.RUN_LEVEL_SYSTEM_BOOTSTRAP);
@@ -65,10 +61,10 @@ public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String
     public boolean isPremium() {
         return _premium;
     }
-    
+
     @Override
     public void invalidateCache() {
-    	_configs = null;
+        _configs = null;
     }
 
     @Override
@@ -82,21 +78,21 @@ public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String
             List<ConfigurationVO> configurations = listIncludingRemovedBy(sc);
 
             for (ConfigurationVO config : configurations) {
-            	if (config.getValue() != null)
-            		_configs.put(config.getName(), config.getValue());
+                if (config.getValue() != null)
+                    _configs.put(config.getName(), config.getValue());
             }
 
-            if(!"DEFAULT".equals(instance)){
-            	//Default instance params are already added, need not add again 
-            	sc = InstanceSearch.create();
-            	sc.setParameters("instance", instance);
+            if (!"DEFAULT".equals(instance)) {
+                //Default instance params are already added, need not add again
+                sc = InstanceSearch.create();
+                sc.setParameters("instance", instance);
 
-            	configurations = listIncludingRemovedBy(sc);
+                configurations = listIncludingRemovedBy(sc);
 
-            	for (ConfigurationVO config : configurations) {
-            		if (config.getValue() != null)
-            			_configs.put(config.getName(), config.getValue());
-            	}
+                for (ConfigurationVO config : configurations) {
+                    if (config.getValue() != null)
+                        _configs.put(config.getName(), config.getValue());
+                }
             }
 
         }
@@ -109,12 +105,12 @@ public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String
     public Map<String, String> getConfiguration(Map<String, ? extends Object> params) {
         return getConfiguration("DEFAULT", params);
     }
-    
+
     @Override
     public Map<String, String> getConfiguration() {
         return getConfiguration("DEFAULT", new HashMap<String, Object>());
     }
-    
+
     protected void mergeConfigs(Map<String, String> dbParams, Map<String, ? extends Object> xmlParams) {
         for (Map.Entry<String, ? extends Object> param : xmlParams.entrySet()) {
             dbParams.put(param.getKey(), (String)param.getValue());
@@ -122,53 +118,54 @@ public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String
     }
 
     @Override
-	public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
-    	super.configure(name, params);
+    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
+        super.configure(name, params);
 
-    	Object premium = params.get("premium");
-        _premium = (premium != null) && ((String) premium).equals("true");
+        Object premium = params.get("premium");
+        _premium = (premium != null) && ((String)premium).equals("true");
 
         return true;
     }
 
     //Use update method with category instead
-    @Override @Deprecated
+    @Override
+    @Deprecated
     public boolean update(String name, String value) {
-    	Transaction txn = Transaction.currentTxn();
-		try {
-			PreparedStatement stmt = txn.prepareStatement(UPDATE_CONFIGURATION_SQL);
-			stmt.setString(1, value);
-			stmt.setString(2, name);
-			stmt.executeUpdate();
-			return true;
-		} catch (Exception e) {
-			s_logger.warn("Unable to update Configuration Value", e);
-		}
-		return false;
+        Transaction txn = Transaction.currentTxn();
+        try {
+            PreparedStatement stmt = txn.prepareStatement(UPDATE_CONFIGURATION_SQL);
+            stmt.setString(1, value);
+            stmt.setString(2, name);
+            stmt.executeUpdate();
+            return true;
+        } catch (Exception e) {
+            s_logger.warn("Unable to update Configuration Value", e);
+        }
+        return false;
     }
 
     @Override
     public boolean update(String name, String category, String value) {
-    	Transaction txn = Transaction.currentTxn();
-		try {
-			value = ("Hidden".equals(category) || "Secure".equals(category)) ? DBEncryptionUtil.encrypt(value) : value;
-			PreparedStatement stmt = txn.prepareStatement(UPDATE_CONFIGURATION_SQL);
-			stmt.setString(1, value);
-			stmt.setString(2, name);
-			stmt.executeUpdate();
-			return true;
-		} catch (Exception e) {
-			s_logger.warn("Unable to update Configuration Value", e);
-		}
-		return false;
+        Transaction txn = Transaction.currentTxn();
+        try {
+            value = ("Hidden".equals(category) || "Secure".equals(category)) ? DBEncryptionUtil.encrypt(value) : value;
+            PreparedStatement stmt = txn.prepareStatement(UPDATE_CONFIGURATION_SQL);
+            stmt.setString(1, value);
+            stmt.setString(2, name);
+            stmt.executeUpdate();
+            return true;
+        } catch (Exception e) {
+            s_logger.warn("Unable to update Configuration Value", e);
+        }
+        return false;
     }
-    
+
     @Override
     public String getValue(String name) {
-    	ConfigurationVO config =  findByName(name);
+        ConfigurationVO config = findByName(name);
         return (config == null) ? null : config.getValue();
     }
-    
+
     @Override
     @DB
     public String getValueAndInitIfNotExist(String name, String category, String initValue) {
@@ -195,12 +192,12 @@ public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String
 
         }
     }
-    
+
     @Override
     public ConfigurationVO findByName(String name) {
         SearchCriteria<ConfigurationVO> sc = NameSearch.create();
         sc.setParameters("name", name);
         return findOneIncludingRemovedBy(sc);
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java
----------------------------------------------------------------------
diff --git a/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java b/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java
new file mode 100644
index 0000000..c2424fc
--- /dev/null
+++ b/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java
@@ -0,0 +1,158 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.framework.config.impl;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.framework.config.ConfigDepot;
+import org.apache.cloudstack.framework.config.ConfigDepotAdmin;
+import org.apache.cloudstack.framework.config.ConfigKey;
+import org.apache.cloudstack.framework.config.ConfigKey.Scope;
+import org.apache.cloudstack.framework.config.ConfigValue;
+import org.apache.cloudstack.framework.config.Configurable;
+import org.apache.cloudstack.framework.config.ScopedConfigStorage;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+
+import com.cloud.utils.Pair;
+import com.cloud.utils.component.ConfigInjector;
+import com.cloud.utils.component.SystemIntegrityChecker;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+/**
+ * ConfigDepotImpl implements the ConfigDepot and ConfigDepotAdmin interface.
+ * Its functionalities include:
+ *   - Control how dynamic config values are cached and refreshed.
+ *   - Control how scoped config values are stored.
+ *   - Gather all of the Configurable interfaces and insert their config
+ *     variables into the config table.
+ *   - Hide the data source where configs are stored and retrieved.
+ * 
+ * When dealing with this class, we must be very careful on cluster situations.
+ *
+ * TODO:
+ *   - Move the rest of the changes to the config table to here.
+ *   - Add the code to mark the rows in configuration table without
+ *     the corresponding keys to be null.
+ *   - Move all of the configurations to using ConfigDepot
+ *   - Completely eliminate Config.java
+ *   - Figure out the correct categories.
+ *
+ */
+public class ConfigDepotImpl implements ConfigDepot, ConfigDepotAdmin, SystemIntegrityChecker, ConfigInjector {
+    private final static Logger s_logger = Logger.getLogger(ConfigDepotImpl.class);
+    @Inject
+    ConfigurationDao   _configDao;
+    @Inject
+    List<Configurable> _configurables;
+    @Inject
+    List<ScopedConfigStorage> _scopedStorage;
+
+    HashMap<String, Pair<String, ConfigKey<?>>> _allKeys = new HashMap<String, Pair<String, ConfigKey<?>>>(1007);
+
+    public ConfigDepotImpl() {
+    }
+
+    @Override
+    public <T> ConfigValue<T> get(ConfigKey<T> config) {
+        if (config.scope() == Scope.Global) {
+            return new ConfigValue<T>(_configDao, config);
+        } else {
+            for (ScopedConfigStorage storage : _scopedStorage) {
+                if (storage.getScope() == config.scope()) {
+                    return new ConfigValue<T>(_configDao, config, storage);
+                }
+            }
+            throw new CloudRuntimeException("Unable to find config storage for this scope: " + config.scope());
+        }
+    }
+
+    @Override
+    public void populateConfigurations() {
+        Date date = new Date();
+        for (Configurable configurable : _configurables) {
+            for (ConfigKey<?> key : configurable.getConfigKeys()) {
+                ConfigurationVO vo = _configDao.findById(key.key());
+                if (vo == null) {
+                    vo = new ConfigurationVO(configurable.getConfigComponentName(), key);
+                    vo.setUpdated(date);
+                    _configDao.persist(vo);
+                } else {
+                    if (vo.isDynamic() != key.isDynamic() ||
+                        !vo.getDescription().equals(key.description()) ||
+                        ((vo.getDefaultValue() != null && key.defaultValue() == null) ||
+                         (vo.getDefaultValue() == null && key.defaultValue() != null) ||
+                        !vo.getDefaultValue().equals(key.defaultValue()))) {
+                        vo.setDynamic(key.isDynamic());
+                        vo.setDescription(key.description());
+                        vo.setDefaultValue(key.defaultValue());
+                        vo.setUpdated(date);
+                        _configDao.persist(vo);
+                    }
+                }
+            }
+        }
+    }
+
+    @Override
+    public List<String> getComponentsInDepot() {
+        return new ArrayList<String>();
+    }
+
+    @Override
+    public void check() {
+        for (Configurable configurable : _configurables) {
+            s_logger.debug("Retrieving keys from " + configurable.getClass().getSimpleName());
+            for (ConfigKey<?> key : configurable.getConfigKeys()) {
+                Pair<String, ConfigKey<?>> previous = _allKeys.get(key.key());
+                if (previous != null && !previous.first().equals(configurable.getConfigComponentName())) {
+                    throw new CloudRuntimeException("Configurable " + configurable.getConfigComponentName() + " is adding a key that has been added before by " + previous.first() +
+                                                    ": " + key.toString());
+                }
+                _allKeys.put(key.key(), new Pair<String, ConfigKey<?>>(configurable.getConfigComponentName(), key));
+            }
+        }
+    }
+
+    @Override
+    public void inject(Field field, Object obj, String key) {
+        Pair<String, ConfigKey<?>> configKey = _allKeys.get(key);
+        try {
+            field.set(obj, get(configKey.second()));
+        } catch (IllegalArgumentException e) {
+            throw new CloudRuntimeException("Unable to inject configuration due to ", e);
+        } catch (IllegalAccessException e) {
+            throw new CloudRuntimeException("Unable to inject configuration due to ", e);
+        }
+    }
+
+    @Override
+    public ConfigValue<?> get(String name) {
+        Pair<String, ConfigKey<?>> configKey = _allKeys.get(name);
+        if (configKey == null) {
+            throw new CloudRuntimeException("Unable to find a registered config key for " + name);
+        }
+        return get(configKey.second());
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigurationVO.java
----------------------------------------------------------------------
diff --git a/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigurationVO.java b/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigurationVO.java
new file mode 100644
index 0000000..d7edfe0
--- /dev/null
+++ b/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigurationVO.java
@@ -0,0 +1,176 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.framework.config.impl;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.apache.cloudstack.config.Configuration;
+import org.apache.cloudstack.framework.config.ConfigKey;
+
+import com.cloud.utils.crypt.DBEncryptionUtil;
+
+@Entity
+@Table(name = "configuration")
+public class ConfigurationVO implements Configuration {
+    @Column(name = "instance")
+    private String instance;
+
+    @Column(name = "component")
+    private String component;
+
+    @Id
+    @Column(name = "name")
+    private String name;
+
+    @Column(name = "value", length = 4095)
+    private String value;
+
+    @Column(name = "default_value", length = 4095)
+    private String defaultValue;
+
+    @Column(name = "description", length = 1024)
+    private String description;
+
+    @Column(name = "category")
+    private String category;
+
+    @Column(name = "is_dynamic")
+    private boolean dynamic;
+
+    @Column(name = "scope")
+    private String scope;
+
+    @Column(name = "updated")
+    @Temporal(value = TemporalType.TIMESTAMP)
+    private Date updated;
+
+    protected ConfigurationVO() {
+    }
+
+    public ConfigurationVO(String category, String instance, String component, String name, String value, String description) {
+        this.category = category;
+        this.instance = instance;
+        this.component = component;
+        this.name = name;
+        this.value = value;
+        this.description = description;
+    }
+
+    public ConfigurationVO(String component, ConfigKey<?> key) {
+        this(key.category(), "DEFAULT", component, key.key(), key.defaultValue(), key.description());
+        defaultValue = key.defaultValue();
+        dynamic = key.isDynamic();
+        scope = key.scope() != null ? key.scope().toString() : null;
+    }
+
+    @Override
+    public String getCategory() {
+        return category;
+    }
+
+    public void setCategory(String category) {
+        this.category = category;
+    }
+
+    @Override
+    public String getInstance() {
+        return instance;
+    }
+
+    public void setInstance(String instance) {
+        this.instance = instance;
+    }
+
+    @Override
+    public String getComponent() {
+        return component;
+    }
+
+    public void setComponent(String component) {
+        this.component = component;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public String getValue() {
+        return (("Hidden".equals(getCategory()) || "Secure".equals(getCategory())) ? DBEncryptionUtil.decrypt(value) : value);
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    @Override
+    public String getScope() {
+        return scope;
+    }
+
+    @Override
+    public boolean isDynamic() {
+        return dynamic;
+    }
+
+    public void setDynamic(boolean dynamic) {
+        this.dynamic = dynamic;
+    }
+
+    @Override
+    public String getDefaultValue() {
+        return defaultValue;
+    }
+
+    public void setDefaultValue(String defaultValue) {
+        this.defaultValue = defaultValue;
+    }
+
+    public void setScope(String scope) {
+        this.scope = scope;
+    }
+
+    @Override
+    public Date getUpdated() {
+        return updated;
+    }
+
+    public void setUpdated(Date updated) {
+        this.updated = updated;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/framework/config/test/org/apache/cloudstack/framework/config/ConfigDepotAdminTest.java
----------------------------------------------------------------------
diff --git a/framework/config/test/org/apache/cloudstack/framework/config/ConfigDepotAdminTest.java b/framework/config/test/org/apache/cloudstack/framework/config/ConfigDepotAdminTest.java
deleted file mode 100644
index 782b3c7..0000000
--- a/framework/config/test/org/apache/cloudstack/framework/config/ConfigDepotAdminTest.java
+++ /dev/null
@@ -1,131 +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 org.apache.cloudstack.framework.config;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.io.IOException;
-
-import javax.inject.Inject;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.ComponentScan.Filter;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.FilterType;
-import org.springframework.core.type.classreading.MetadataReader;
-import org.springframework.core.type.classreading.MetadataReaderFactory;
-import org.springframework.core.type.filter.TypeFilter;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.test.context.support.AnnotationConfigContextLoader;
-
-import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
-import org.apache.cloudstack.test.utils.SpringUtils;
-
-import com.cloud.utils.component.ComponentContext;
-import com.cloud.utils.db.EntityManager;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(loader = AnnotationConfigContextLoader.class)
-public class ConfigDepotAdminTest {
-    private final ConfigKey<Integer> DynamicIntCK = new ConfigKey<Integer>(Integer.class, "dynIntKey", "Advance", "10", "Test Key", true);
-    private final ConfigKey<Integer> StaticIntCK = new ConfigKey<Integer>(Integer.class, "statIntKey", "Advance", "10", "Test Key", false);
-
-    @Inject
-    Configurable configurable;
-
-    @Inject
-    ConfigDepot _configDepot;
-
-    @Inject
-    ConfigDepotAdmin _depotAdmin;
-
-    @Inject
-    EntityManager _entityMgr;
-
-    @Inject
-    ConfigurationDao _configDao;
-
-    /**
-     * @throws java.lang.Exception
-     */
-    @Before
-    public void setUp() throws Exception {
-        ComponentContext.initComponentsLifeCycle();  // NOTE #3
-    }
-
-    @Test
-    public void testAutoPopulation() {
-        ConfigurationVO dynamicIntCV = new ConfigurationVO("UnitTestComponent", DynamicIntCK);
-        dynamicIntCV.setValue("100");
-        ConfigurationVO staticIntCV = new ConfigurationVO("UnitTestComponent", StaticIntCK);
-        dynamicIntCV.setValue("200");
-        
-        when(configurable.getConfigComponentName()).thenReturn("UnitTestComponent");
-        when(configurable.getConfigKeys()).thenReturn(new ConfigKey<?>[] {DynamicIntCK, StaticIntCK});
-        when(_entityMgr.findById(org.apache.cloudstack.config.Configuration.class, DynamicIntCK.key())).thenReturn(dynamicIntCV);
-        when(_entityMgr.findById(org.apache.cloudstack.config.Configuration.class, StaticIntCK.key())).thenReturn(staticIntCV);
-        when(_configDao.findById(StaticIntCK.key())).thenReturn(null);
-        when(_configDao.findById(DynamicIntCK.key())).thenReturn(dynamicIntCV);
-        when(_configDao.persist(any(ConfigurationVO.class))).thenReturn(dynamicIntCV);
-
-        _depotAdmin.populateConfigurations();
-
-        // This is once because DynamicIntCK is returned.
-        verify(_configDao, times(1)).persist(any(ConfigurationVO.class));
-
-        when(_configDao.findById(DynamicIntCK.key())).thenReturn(dynamicIntCV);
-        _depotAdmin.populateConfigurations();
-        // This is two because DynamicIntCK also returns null.
-        verify(_configDao, times(2)).persist(any(ConfigurationVO.class));
-    }
-    
-    @Configuration
-    @ComponentScan(basePackageClasses = {ConfigDepotImpl.class}, includeFilters = {@Filter(value = TestConfiguration.Library.class, type = FilterType.CUSTOM)}, useDefaultFilters = false)
-    static class TestConfiguration extends SpringUtils.CloudStackTestConfiguration {
-        @Bean
-        public Configurable configurable() {
-            return mock(Configurable.class);
-        }
-
-        @Bean
-        public EntityManager entityMgr() {
-            return mock(EntityManager.class);
-        }
-
-        @Bean
-        public ConfigurationDao configurationDao() {
-            return mock(ConfigurationDao.class);
-        }
-
-        public static class Library implements TypeFilter {
-            @Override
-            public boolean match(MetadataReader mdr, MetadataReaderFactory arg1) throws IOException {
-                ComponentScan cs = TestConfiguration.class.getAnnotation(ComponentScan.class);
-                return SpringUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/framework/config/test/org/apache/cloudstack/framework/config/impl/ConfigDepotAdminTest.java
----------------------------------------------------------------------
diff --git a/framework/config/test/org/apache/cloudstack/framework/config/impl/ConfigDepotAdminTest.java b/framework/config/test/org/apache/cloudstack/framework/config/impl/ConfigDepotAdminTest.java
new file mode 100644
index 0000000..9176345
--- /dev/null
+++ b/framework/config/test/org/apache/cloudstack/framework/config/impl/ConfigDepotAdminTest.java
@@ -0,0 +1,102 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.framework.config.impl;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+
+import junit.framework.TestCase;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+import org.apache.cloudstack.framework.config.ConfigDepot;
+import org.apache.cloudstack.framework.config.ConfigKey;
+import org.apache.cloudstack.framework.config.Configurable;
+import org.apache.cloudstack.framework.config.ScopedConfigStorage;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.cloudstack.framework.config.impl.ConfigDepotImpl;
+import org.apache.cloudstack.framework.config.impl.ConfigurationVO;
+
+import com.cloud.utils.db.EntityManager;
+
+public class ConfigDepotAdminTest extends TestCase {
+    private final ConfigKey<Integer> DynamicIntCK = new ConfigKey<Integer>(Integer.class, "dynIntKey", "Advance", "10", "Test Key", true);
+    private final ConfigKey<Integer> StaticIntCK = new ConfigKey<Integer>(Integer.class, "statIntKey", "Advance", "10", "Test Key", false);
+
+    @Mock
+    Configurable _configurable;
+
+    @Mock
+    ConfigDepot _configDepot;
+
+    ConfigDepotImpl _depotAdmin;
+
+    @Mock
+    EntityManager _entityMgr;
+
+    @Mock
+    ConfigurationDao _configDao;
+
+    @Mock
+    ScopedConfigStorage _scopedStorage;
+
+    /**
+     * @throws java.lang.Exception
+     */
+    @Override
+    @Before
+    public void setUp() throws Exception {
+        MockitoAnnotations.initMocks(this);
+        _depotAdmin = new ConfigDepotImpl();
+        _depotAdmin._configDao = _configDao;
+        _depotAdmin._configurables = new ArrayList<Configurable>();
+        _depotAdmin._configurables.add(_configurable);
+        _depotAdmin._scopedStorage = new ArrayList<ScopedConfigStorage>();
+        _depotAdmin._scopedStorage.add(_scopedStorage);
+    }
+
+    @Test
+    public void testAutoPopulation() {
+        ConfigurationVO dynamicIntCV = new ConfigurationVO("UnitTestComponent", DynamicIntCK);
+        dynamicIntCV.setValue("100");
+        ConfigurationVO staticIntCV = new ConfigurationVO("UnitTestComponent", StaticIntCK);
+        dynamicIntCV.setValue("200");
+        
+        when(_configurable.getConfigComponentName()).thenReturn("UnitTestComponent");
+        when(_configurable.getConfigKeys()).thenReturn(new ConfigKey<?>[] {DynamicIntCK, StaticIntCK});
+        when(_configDao.findById(StaticIntCK.key())).thenReturn(null);
+        when(_configDao.findById(DynamicIntCK.key())).thenReturn(dynamicIntCV);
+        when(_configDao.persist(any(ConfigurationVO.class))).thenReturn(dynamicIntCV);
+
+        _depotAdmin.populateConfigurations();
+
+        // This is once because DynamicIntCK is returned.
+        verify(_configDao, times(1)).persist(any(ConfigurationVO.class));
+
+        when(_configDao.findById(DynamicIntCK.key())).thenReturn(dynamicIntCV);
+        _depotAdmin.populateConfigurations();
+        // This is two because DynamicIntCK also returns null.
+        verify(_configDao, times(2)).persist(any(ConfigurationVO.class));
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/GenericDaoBase.java b/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
index 94e5374..a566ec5 100755
--- a/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
+++ b/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
@@ -183,6 +183,7 @@ public abstract class GenericDaoBase<T, ID extends Serializable> extends Compone
     
     @SuppressWarnings("unchecked")
     protected GenericDaoBase() {
+        super();
         Type t = getClass().getGenericSuperclass();
         if (t instanceof ParameterizedType) {
             _entityBeanType = (Class<T>)((ParameterizedType)t).getActualTypeArguments()[0];

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/server/src/com/cloud/api/ApiServer.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiServer.java b/server/src/com/cloud/api/ApiServer.java
index aebb98c..550626f 100755
--- a/server/src/com/cloud/api/ApiServer.java
+++ b/server/src/com/cloud/api/ApiServer.java
@@ -114,8 +114,8 @@ import org.apache.cloudstack.api.response.CreateCmdResponse;
 import org.apache.cloudstack.api.response.ExceptionResponse;
 import org.apache.cloudstack.api.response.ListResponse;
 import org.apache.cloudstack.context.CallContext;
-import org.apache.cloudstack.framework.config.ConfigurationVO;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.cloudstack.framework.config.impl.ConfigurationVO;
 import org.apache.cloudstack.framework.jobs.AsyncJob;
 import org.apache.cloudstack.framework.jobs.AsyncJobManager;
 import org.apache.cloudstack.framework.jobs.impl.AsyncJobVO;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/server/src/com/cloud/api/doc/ApiXmlDocWriter.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/doc/ApiXmlDocWriter.java b/server/src/com/cloud/api/doc/ApiXmlDocWriter.java
index c3c0cab..b7d526d 100644
--- a/server/src/com/cloud/api/doc/ApiXmlDocWriter.java
+++ b/server/src/com/cloud/api/doc/ApiXmlDocWriter.java
@@ -24,17 +24,34 @@ import java.io.FileWriter;
 import java.io.IOException;
 import java.io.ObjectOutputStream;
 import java.lang.reflect.Field;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.TreeMap;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
 
-import com.cloud.utils.IteratorUtil;
-import com.cloud.utils.ReflectUtil;
-import org.apache.cloudstack.api.*;
 import org.apache.log4j.Logger;
 
-import com.cloud.alert.AlertManager;
+import com.google.gson.annotations.SerializedName;
+import com.thoughtworks.xstream.XStream;
+
 import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.response.AsyncJobResponse;
 import org.apache.cloudstack.api.response.HostResponse;
 import org.apache.cloudstack.api.response.IPAddressResponse;
@@ -44,10 +61,11 @@ import org.apache.cloudstack.api.response.StoragePoolResponse;
 import org.apache.cloudstack.api.response.TemplateResponse;
 import org.apache.cloudstack.api.response.UserVmResponse;
 import org.apache.cloudstack.api.response.VolumeResponse;
+
+import com.cloud.alert.AlertManager;
 import com.cloud.serializer.Param;
-import com.google.gson.annotations.SerializedName;
-import com.thoughtworks.xstream.XStream;
-import org.reflections.Reflections;
+import com.cloud.utils.IteratorUtil;
+import com.cloud.utils.ReflectUtil;
 
 public class ApiXmlDocWriter {
     public static final Logger s_logger = Logger.getLogger(ApiXmlDocWriter.class.getName());
@@ -322,7 +340,7 @@ public class ApiXmlDocWriter {
         }
 
         if (impl == null) {
-            throw new IllegalStateException(String.format("An %1$s annotation is required for class %2$s.", 
+            throw new IllegalStateException(String.format("An %1$s annotation is required for class %2$s.",
                     APICommand.class.getCanonicalName(), clas.getCanonicalName()));
         }
 
@@ -588,9 +606,11 @@ public class ApiXmlDocWriter {
         try {
             ObjectOutputStream out = xs.createObjectOutputStream(new FileWriter(dirName + "/alert_types.xml"), "alerts");
             for (Field f : AlertManager.class.getFields()) {
-                String name = f.getName().substring(11);
-                Alert alert = new Alert(name, f.getInt(null));
-                out.writeObject(alert);
+                if (f.getClass().isAssignableFrom(Number.class)) {
+                    String name = f.getName().substring(11);
+                    Alert alert = new Alert(name, f.getInt(null));
+                    out.writeObject(alert);
+                }
             }
             out.close();
         } catch (IOException e) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index 7432aa2..4e6e7c7 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -73,8 +73,8 @@ import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationSe
 import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
 import org.apache.cloudstack.framework.config.ConfigKey;
 import org.apache.cloudstack.framework.config.ConfigValue;
-import org.apache.cloudstack.framework.config.ConfigurationVO;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.cloudstack.framework.config.impl.ConfigurationVO;
 import org.apache.cloudstack.region.PortableIp;
 import org.apache.cloudstack.region.PortableIpDao;
 import org.apache.cloudstack.region.PortableIpRange;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/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 8f4b43c..d7f5a88 100755
--- a/server/src/com/cloud/resource/ResourceManagerImpl.java
+++ b/server/src/com/cloud/resource/ResourceManagerImpl.java
@@ -30,10 +30,11 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
-import com.google.gson.Gson;
-
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
+
+import com.google.gson.Gson;
+
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd;
 import org.apache.cloudstack.api.command.admin.cluster.DeleteClusterCmd;
@@ -53,7 +54,6 @@ import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 import org.apache.cloudstack.utils.identity.ManagementServerNode;
 
 import com.cloud.agent.AgentManager;
-import com.cloud.agent.AgentManager.TapAgentsAction;
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.Command;
 import com.cloud.agent.api.GetHostStatsAnswer;
@@ -65,8 +65,6 @@ import com.cloud.agent.api.StartupCommand;
 import com.cloud.agent.api.StartupRoutingCommand;
 import com.cloud.agent.api.UnsupportedAnswer;
 import com.cloud.agent.api.UpdateHostPasswordCommand;
-import com.cloud.agent.manager.AgentAttache;
-import com.cloud.agent.manager.ClusteredAgentManagerImpl;
 import com.cloud.agent.transport.Request;
 import com.cloud.api.ApiDBUtils;
 import com.cloud.capacity.Capacity;
@@ -1709,7 +1707,6 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
 
     private Host createHostAndAgent(ServerResource resource, Map<String, String> details, boolean old, List<String> hostTags, boolean forRebalance) {
         HostVO host = null;
-        AgentAttache attache = null;
         StartupCommand[] cmds = null;
         boolean hostExists = false;
 
@@ -1753,7 +1750,6 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
 
             host = createHostVO(cmds, resource, details, hostTags, ResourceStateAdapter.Event.CREATE_HOST_VO_FOR_DIRECT_CONNECT);
             if (host != null) {
-                attache = _agentMgr.handleDirectConnectAgent(host, cmds, resource, forRebalance);
                 /* reload myself from database */
                 host = _hostDao.findById(host.getId());
             }
@@ -1764,13 +1760,6 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
                 if (cmds != null) {
                     resource.disconnected();
                 }
-            } else {
-                if (attache == null) {
-                    if (cmds != null) {
-                        resource.disconnected();
-                    }
-                    markHostAsDisconnected(host, cmds);
-                }
             }
         }
 
@@ -1780,7 +1769,6 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
     private Host createHostAndAgentDeferred(ServerResource resource, Map<String, String> details, boolean old, List<String> hostTags,
             boolean forRebalance) {
         HostVO host = null;
-        AgentAttache attache = null;
         StartupCommand[] cmds = null;
         boolean hostExists = false;
         boolean deferAgentCreation = true;
@@ -1826,30 +1814,13 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
             host = null;
             GlobalLock addHostLock = GlobalLock.getInternLock("AddHostLock");
             try {
-                if (addHostLock.lock(ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION)) { // to
-                    // safely
-                    // determine
-                    // first
-                    // host
-                    // in
-                    // cluster
-                    // in
-                    // multi-MS
-                    // scenario
+                if (addHostLock.lock(ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION)) {
+                    // to safely determine first host in cluster in multi-MS scenario
                     try {
                         host = createHostVO(cmds, resource, details, hostTags, ResourceStateAdapter.Event.CREATE_HOST_VO_FOR_DIRECT_CONNECT);
                         if (host != null) {
-                            deferAgentCreation = !isFirstHostInCluster(host); // if
-                            // first
-                            // host
-                            // in
-                            // cluster
-                            // no
-                            // need
-                            // to
-                            // defer
-                            // agent
-                            // creation
+                            // if first host in cluster no need to defer agent creation
+                            deferAgentCreation = !isFirstHostInCluster(host);
                         }
                     } finally {
                         addHostLock.unlock();
@@ -1861,9 +1832,6 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
 
             if (host != null) {
                 if (!deferAgentCreation) { // if first host in cluster then
-                    // create agent otherwise defer it to
-                    // scan task
-                    attache = _agentMgr.handleDirectConnectAgent(host, cmds, resource, forRebalance);
                     host = _hostDao.findById(host.getId()); // reload
                 } else {
                     host = _hostDao.findById(host.getId()); // reload
@@ -1875,20 +1843,6 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
                     host.setLastPinged(0); // so that scan task can pick it up
                     _hostDao.update(host.getId(), host);
 
-                    // schedule a scan task immediately
-                    if (_agentMgr instanceof ClusteredAgentManagerImpl) {
-                        ClusteredAgentManagerImpl clusteredAgentMgr = (ClusteredAgentManagerImpl) _agentMgr;
-                        if (s_logger.isDebugEnabled()) {
-                            s_logger.debug("Scheduling a host scan task");
-                        }
-                        // schedule host scan task on current MS
-                        clusteredAgentMgr.scheduleHostScanTask();
-                        if (s_logger.isDebugEnabled()) {
-                            s_logger.debug("Notifying all peer MS to schedule host scan task");
-                        }
-                        // notify peers to schedule a host scan task as well
-                        clusteredAgentMgr.notifyNodesInClusterToScheduleHostScanTask();
-                    }
                 }
             }
         } catch (Exception e) {
@@ -1899,7 +1853,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
                     resource.disconnected();
                 }
             } else {
-                if (!deferAgentCreation && attache == null) {
+                if (!deferAgentCreation) {
                     if (cmds != null) {
                         resource.disconnected();
                     }
@@ -1914,9 +1868,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
     @Override
     public Host createHostAndAgent(Long hostId, ServerResource resource, Map<String, String> details, boolean old, List<String> hostTags,
             boolean forRebalance) {
-        _agentMgr.tapLoadingAgents(hostId, TapAgentsAction.Add);
         Host host = createHostAndAgent(resource, details, old, hostTags, forRebalance);
-        _agentMgr.tapLoadingAgents(hostId, TapAgentsAction.Del);
         return host;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/server/src/com/cloud/server/ConfigurationServer.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ConfigurationServer.java b/server/src/com/cloud/server/ConfigurationServer.java
index 1d99973..475dde6 100644
--- a/server/src/com/cloud/server/ConfigurationServer.java
+++ b/server/src/com/cloud/server/ConfigurationServer.java
@@ -18,7 +18,7 @@ package com.cloud.server;
 
 import java.util.List;
 
-import org.apache.cloudstack.framework.config.ConfigurationVO;
+import org.apache.cloudstack.framework.config.impl.ConfigurationVO;
 
 import com.cloud.exception.InternalErrorException;
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/server/src/com/cloud/server/ConfigurationServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java b/server/src/com/cloud/server/ConfigurationServerImpl.java
index aed6019..dc56fc6 100755
--- a/server/src/com/cloud/server/ConfigurationServerImpl.java
+++ b/server/src/com/cloud/server/ConfigurationServerImpl.java
@@ -48,8 +48,8 @@ import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.framework.config.ConfigDepot;
 import org.apache.cloudstack.framework.config.ConfigDepotAdmin;
-import org.apache.cloudstack.framework.config.ConfigurationVO;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.cloudstack.framework.config.impl.ConfigurationVO;
 
 import com.cloud.configuration.Config;
 import com.cloud.configuration.ConfigurationManager;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/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 a10f0a0b..f00795b 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -431,8 +431,8 @@ 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.ConfigurationVO;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.cloudstack.framework.config.impl.ConfigurationVO;
 import org.apache.cloudstack.storage.datastore.db.ImageStoreDao;
 import org.apache.cloudstack.storage.datastore.db.ImageStoreVO;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8e79c30/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 2d6557c..c764805 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -4887,14 +4887,11 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
 
     @Override
     public String getConfigComponentName() {
-        // TODO Auto-generated method stub
-        return null;
+        return UserVmManager.class.getSimpleName();
     }
 
     @Override
     public ConfigKey<?>[] getConfigKeys() {
-        // TODO Auto-generated method stub
-        return null;
+        return new ConfigKey<?>[] {EnableDynamicallyScaleVm};
     }
-
 }


Mime
View raw message