You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ah...@apache.org on 2013/06/18 02:24:50 UTC

[5/9] git commit: updated refs/heads/vmsync to 309f8da

Removed a bunch of useless classes.  Move configuration into utils package


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

Branch: refs/heads/vmsync
Commit: 3a074f31aefe266d9dd7b077b0fc1fae913d9ac6
Parents: aad2bc7
Author: Alex Huang <al...@gmail.com>
Authored: Sat Jun 15 05:52:41 2013 -0700
Committer: Alex Huang <al...@gmail.com>
Committed: Mon Jun 17 17:04:04 2013 -0700

----------------------------------------------------------------------
 .../com/cloud/configuration/Configuration.java  |  33 ----
 .../configuration/ConfigurationService.java     |   1 +
 api/src/com/cloud/dao/EntityManager.java        | 102 ----------
 api/src/com/cloud/event/EventTypes.java         |   3 +-
 api/src/com/cloud/server/ManagementService.java |   2 +-
 api/src/org/apache/cloudstack/api/BaseCmd.java  |   2 +-
 .../cloudstack/api/ResponseGenerator.java       |   2 +-
 .../api/command/admin/config/ListCfgsByCmd.java |   2 +-
 .../api/command/admin/config/UpdateCfgCmd.java  |   2 +-
 .../org/apache/cloudstack/config/ConfigKey.java |  98 ----------
 .../apache/cloudstack/context/CallContext.java  |   2 +-
 .../api/command/test/ListCfgCmdTest.java        |   3 +-
 .../api/command/test/UpdateCfgCmdTest.java      |   3 +-
 .../com/cloud/vm/ReservationContextImpl.java    |   2 +-
 .../apache/cloudstack/config/ConfigDepot.java   |  25 ---
 .../apache/cloudstack/config/ConfigValue.java   |  72 -------
 .../com/cloud/vm/VirtualMachineManagerImpl.java |   2 +-
 .../src/com/cloud/vm/VmWorkJobDispatcher.java   |   2 +-
 .../engine/vm/VMEntityManagerImpl.java          |   2 +-
 .../cloud/vm/VirtualMachineManagerImplTest.java |   2 +-
 .../cloud/configuration/ConfigurationVO.java    |   2 +
 .../com/cloud/vm/VirtualMachineProfileImpl.java |   2 +-
 server/src/com/cloud/api/ApiDispatcher.java     |   2 +-
 server/src/com/cloud/api/ApiResponseHelper.java |   4 +-
 server/src/com/cloud/api/ApiServer.java         |   2 +-
 .../configuration/ConfigurationManagerImpl.java |   6 +-
 .../consoleproxy/ConsoleProxyManagerImpl.java   |   2 +-
 server/src/com/cloud/dao/EntityManagerImpl.java |   1 +
 .../VirtualNetworkApplianceManagerImpl.java     |   2 +-
 .../resourcelimit/ResourceLimitManagerImpl.java |   2 +-
 .../com/cloud/server/ManagementServerImpl.java  |   2 +-
 .../com/cloud/servlet/ConsoleProxyServlet.java  |   2 +-
 .../cloud/servlet/RegisterCompleteServlet.java  |   3 +-
 .../secondary/SecondaryStorageManagerImpl.java  |   2 +-
 .../cloud/async/AsyncJobTestConfiguration.java  |   2 +-
 .../com/cloud/vm/VmWorkTestConfiguration.java   |   2 +-
 .../cloud/vpc/MockConfigurationManagerImpl.java |   2 +-
 utils/src/com/cloud/utils/db/Condition.java     | 100 ----------
 utils/src/com/cloud/utils/db/EntityManager.java |  99 ++++++++++
 utils/src/com/cloud/utils/db/FirstWhere.java    |  29 ---
 .../com/cloud/utils/db/JoinQueryBuilder.java    |  31 ---
 utils/src/com/cloud/utils/db/NextWhere.java     |  27 ---
 utils/src/com/cloud/utils/db/On.java            |  21 --
 utils/src/com/cloud/utils/db/QueryBuilder.java  | 194 -------------------
 utils/src/com/cloud/utils/db/Select.java        |  52 -----
 .../com/cloud/utils/db/SelectQueryBuilder.java  |  28 ---
 .../com/cloud/utils/db/SimpleQueryBuilder.java  |  47 -----
 utils/src/com/cloud/utils/db/Where.java         |  81 --------
 .../apache/cloudstack/config/ConfigDepot.java   |  25 +++
 .../org/apache/cloudstack/config/ConfigKey.java |  98 ++++++++++
 .../apache/cloudstack/config/ConfigValue.java   |  75 +++++++
 .../apache/cloudstack/config/Configuration.java |  33 ++++
 52 files changed, 372 insertions(+), 970 deletions(-)
----------------------------------------------------------------------


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

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/api/src/com/cloud/configuration/ConfigurationService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/configuration/ConfigurationService.java b/api/src/com/cloud/configuration/ConfigurationService.java
index 63ad7fb..881bad0 100644
--- a/api/src/com/cloud/configuration/ConfigurationService.java
+++ b/api/src/com/cloud/configuration/ConfigurationService.java
@@ -45,6 +45,7 @@ import org.apache.cloudstack.api.command.admin.zone.CreateZoneCmd;
 import org.apache.cloudstack.api.command.admin.zone.DeleteZoneCmd;
 import org.apache.cloudstack.api.command.admin.zone.UpdateZoneCmd;
 import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd;
+import org.apache.cloudstack.config.Configuration;
 
 import com.cloud.dc.DataCenter;
 import com.cloud.dc.Pod;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/api/src/com/cloud/dao/EntityManager.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/dao/EntityManager.java b/api/src/com/cloud/dao/EntityManager.java
deleted file mode 100644
index 8e6a438..0000000
--- a/api/src/com/cloud/dao/EntityManager.java
+++ /dev/null
@@ -1,102 +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.dao;
-
-import java.io.Serializable;
-import java.util.List;
-
-import com.cloud.utils.db.GenericSearchBuilder;
-import com.cloud.utils.db.SearchBuilder;
-import com.cloud.utils.db.SearchCriteria;
-
-/**
- * Generic Entity Manager to retrieve database objects.
- *
- */
-public interface EntityManager {
-    /**
-     * Finds an entity by its id.
-     * @param <T> class of the entity you're trying to find.
-     * @param <K> class of the id that the entity uses.
-     * @param entityType Type of the entity.
-     * @param id id value
-     * @return T if found; null if not.
-     */
-    public <T, K extends Serializable> T findById(Class<T> entityType, K id);
-
-    /**
-     * Finds an entity by its id including removed.
-     * @param <T> class of the entity you're trying to find.
-     * @param <K> class of the id that the entity uses.
-     * @param entityType Type of the entity.
-     * @param id id value
-     * @return T if found; null if not.
-     */
-    public <T, K extends Serializable> T findByIdIncludingRemoved(Class<T> entityType, K id);
-    
-    /**
-     * Finds a unique entity by uuid string
-     * @param <T> entity class
-     * @param entityType type of entity you're looking for.
-     * @param uuid the unique id
-     * @return T if found, null if not.
-     */
-    public <T> T findByUuid(Class<T> entityType, String uuid);
-
-    /**
-     * Finds a unique entity by uuid string
-     * @param <T> entity class
-     * @param entityType type of entity you're looking for.
-     * @param uuid the unique id
-     * @return T if found, null if not.
-     */
-    public <T> T findByUuidIncludingRemoved(Class<T> entityType, String uuid);
-
-    /**
-     * Finds an entity by external id which is always String
-     * @param <T> entity class
-     * @param entityType type of entity you're looking for.
-     * @param xid external id
-     * @return T if found, null if not.
-     */
-    public <T> T findByXId(Class<T> entityType, String xid);
-
-    /**
-     * Lists all entities.  Use this method at your own risk.
-     * @param <T> entity class
-     * @param entityType type of entity you're looking for.
-     * @return List<T>
-     */
-    public <T> List<? extends T> list(Class<T> entityType);
-
-    /**
-     * Persists the entity.
-     * @param <T> entity class
-     * @param t entity
-     * @return persisted entity.  Only use this after persisting.
-     */
-    public <T> T persist(T t);
-
-    public <T> SearchBuilder<T> createSearchBuilder(Class<T> entityType);
-
-    public <T, K> GenericSearchBuilder<T, K> createGenericSearchBuilder(Class<T> entityType, Class<K> resultType);
-
-    public <T, K> List<K> search(Class<T> entityType, SearchCriteria<K> sc);
-
-    public <T, K extends Serializable> void remove(Class<T> entityType, K id);
-}
-

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/api/src/com/cloud/event/EventTypes.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/event/EventTypes.java b/api/src/com/cloud/event/EventTypes.java
index ed4ba12..8327a16 100755
--- a/api/src/com/cloud/event/EventTypes.java
+++ b/api/src/com/cloud/event/EventTypes.java
@@ -19,7 +19,8 @@ package com.cloud.event;
 import java.util.HashMap;
 import java.util.Map;
 
-import com.cloud.configuration.Configuration;
+import org.apache.cloudstack.config.Configuration;
+
 import com.cloud.dc.DataCenter;
 import com.cloud.dc.Pod;
 import com.cloud.dc.StorageNetworkIpRange;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/api/src/com/cloud/server/ManagementService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/server/ManagementService.java b/api/src/com/cloud/server/ManagementService.java
index 24d33d5..ca8a689 100755
--- a/api/src/com/cloud/server/ManagementService.java
+++ b/api/src/com/cloud/server/ManagementService.java
@@ -54,10 +54,10 @@ import org.apache.cloudstack.api.command.user.template.UpdateTemplateCmd;
 import org.apache.cloudstack.api.command.user.vm.GetVMPasswordCmd;
 import org.apache.cloudstack.api.command.user.vmgroup.UpdateVMGroupCmd;
 import org.apache.cloudstack.api.command.user.volume.ExtractVolumeCmd;
+import org.apache.cloudstack.config.Configuration;
 
 import com.cloud.alert.Alert;
 import com.cloud.capacity.Capacity;
-import com.cloud.configuration.Configuration;
 import com.cloud.dc.Pod;
 import com.cloud.dc.Vlan;
 import com.cloud.domain.Domain;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/api/src/org/apache/cloudstack/api/BaseCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseCmd.java b/api/src/org/apache/cloudstack/api/BaseCmd.java
index f0e4f8c..4019db0 100644
--- a/api/src/org/apache/cloudstack/api/BaseCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseCmd.java
@@ -36,7 +36,6 @@ import org.apache.cloudstack.query.QueryService;
 import org.apache.cloudstack.usage.UsageService;
 
 import com.cloud.configuration.ConfigurationService;
-import com.cloud.dao.EntityManager;
 import com.cloud.domain.Domain;
 import com.cloud.exception.ConcurrentOperationException;
 import com.cloud.exception.InsufficientCapacityException;
@@ -75,6 +74,7 @@ import com.cloud.user.Account;
 import com.cloud.user.AccountService;
 import com.cloud.user.DomainService;
 import com.cloud.user.ResourceLimitService;
+import com.cloud.utils.db.EntityManager;
 import com.cloud.vm.UserVmService;
 import com.cloud.vm.snapshot.VMSnapshotService;
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/api/src/org/apache/cloudstack/api/ResponseGenerator.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ResponseGenerator.java b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
index 4a0eb02..386b16c 100644
--- a/api/src/org/apache/cloudstack/api/ResponseGenerator.java
+++ b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
@@ -110,6 +110,7 @@ import org.apache.cloudstack.api.response.VpcOfferingResponse;
 import org.apache.cloudstack.api.response.VpcResponse;
 import org.apache.cloudstack.api.response.VpnUsersResponse;
 import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.cloudstack.config.Configuration;
 import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
 import org.apache.cloudstack.region.PortableIp;
 import org.apache.cloudstack.region.PortableIpRange;
@@ -117,7 +118,6 @@ import org.apache.cloudstack.region.Region;
 import org.apache.cloudstack.usage.Usage;
 
 import com.cloud.capacity.Capacity;
-import com.cloud.configuration.Configuration;
 import com.cloud.configuration.ResourceCount;
 import com.cloud.configuration.ResourceLimit;
 import com.cloud.dc.DataCenter;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java
index 5a3d22f..9454419 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java
@@ -31,8 +31,8 @@ import org.apache.cloudstack.api.response.ConfigurationResponse;
 import org.apache.cloudstack.api.response.ListResponse;
 import org.apache.cloudstack.api.response.StoragePoolResponse;
 import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.cloudstack.config.Configuration;
 
-import com.cloud.configuration.Configuration;
 import com.cloud.utils.Pair;
 
 @APICommand(name = "listConfigurations", description = "Lists all configurations.", responseObject = ConfigurationResponse.class)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
index 2aaaa18..1050721 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
@@ -29,8 +29,8 @@ import org.apache.cloudstack.api.response.ClusterResponse;
 import org.apache.cloudstack.api.response.ConfigurationResponse;
 import org.apache.cloudstack.api.response.StoragePoolResponse;
 import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.cloudstack.config.Configuration;
 
-import com.cloud.configuration.Configuration;
 import com.cloud.user.Account;
 
 @APICommand(name = "updateConfiguration", description="Updates a configuration.", responseObject=ConfigurationResponse.class)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/api/src/org/apache/cloudstack/config/ConfigKey.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/config/ConfigKey.java b/api/src/org/apache/cloudstack/config/ConfigKey.java
deleted file mode 100644
index 9e42831..0000000
--- a/api/src/org/apache/cloudstack/config/ConfigKey.java
+++ /dev/null
@@ -1,98 +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;
-
-/**
- * ConfigKey supplants the original Config.java.  It is just a class
- * declaration where others can declare their config variables.
- * 
- * TODO: This class should be moved to a framework project where the gathering
- *       of these configuration keys should be done by a config server.  I
- *       don't have time yet to do this.  Ask me about it if you want to work
- *       in this area.  Right now, we'll just work with the actual names.
- */
-public class ConfigKey<T> {
-    
-    private final String _category;
-
-    public String category() {
-        return _category;
-    }
-
-    public Class<?> component() {
-        return _componentClass;
-    }
-
-    public Class<T> type() {
-        return _type;
-    }
-
-    public String key() {
-        return _name;
-    }
-
-    public String defaultValue() {
-        return _defaultValue;
-    }
-
-    public String description() {
-        return _description;
-    }
-
-    public String range() {
-        return _range;
-    }
-
-    public String scope() {
-        return _scope;
-    }
-
-    public boolean isDynamic() {
-        return _isDynamic;
-    }
-
-    @Override
-    public String toString() {
-        return _name;
-    }
-
-    private final Class<?> _componentClass;
-    private final Class<T> _type;
-    private final String _name;
-    private final String _defaultValue;
-    private final String _description;
-    private final String _range;
-    private final String _scope; // Parameter can be at different levels (Zone/cluster/pool/account), by default every parameter is at global
-    private final boolean _isDynamic;
-
-    public ConfigKey(Class<T> type, String name, String category, Class<?> componentClass, String defaultValue, String description, boolean isDynamic, String range,
-            String scope) {
-        _category = category;
-        _componentClass = componentClass;
-        _type = type;
-        _name = name;
-        _defaultValue = defaultValue;
-        _description = description;
-        _range = range;
-        _scope = scope;
-        _isDynamic = isDynamic;
-    }
-
-    public ConfigKey(Class<T> type, String name, String category, Class<?> componentClass, String defaultValue, String description, boolean isDynamic, String range) {
-        this(type, name, category, componentClass, defaultValue, description, isDynamic, range, null);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/api/src/org/apache/cloudstack/context/CallContext.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/context/CallContext.java b/api/src/org/apache/cloudstack/context/CallContext.java
index c4271f5..303a3a9 100644
--- a/api/src/org/apache/cloudstack/context/CallContext.java
+++ b/api/src/org/apache/cloudstack/context/CallContext.java
@@ -23,11 +23,11 @@ import java.util.UUID;
 import org.apache.log4j.Logger;
 import org.apache.log4j.NDC;
 
-import com.cloud.dao.EntityManager;
 import com.cloud.exception.CloudAuthenticationException;
 import com.cloud.user.Account;
 import com.cloud.user.User;
 import com.cloud.utils.UuidUtils;
+import com.cloud.utils.db.EntityManager;
 import com.cloud.utils.exception.CloudRuntimeException;
 
 /**

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/api/test/org/apache/cloudstack/api/command/test/ListCfgCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/ListCfgCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/ListCfgCmdTest.java
index 7c05eaf..df9d62b 100644
--- a/api/test/org/apache/cloudstack/api/command/test/ListCfgCmdTest.java
+++ b/api/test/org/apache/cloudstack/api/command/test/ListCfgCmdTest.java
@@ -16,7 +16,6 @@
 // under the License.
 package org.apache.cloudstack.api.command.test;
 
-import com.cloud.configuration.Configuration;
 import com.cloud.configuration.ConfigurationService;
 import com.cloud.exception.InvalidParameterValueException;
 import com.cloud.resource.ResourceService;
@@ -29,6 +28,8 @@ import org.apache.cloudstack.api.ServerApiException;
 import org.apache.cloudstack.api.command.admin.config.ListCfgsByCmd;
 import org.apache.cloudstack.api.response.ConfigurationResponse;
 import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.config.Configuration;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/api/test/org/apache/cloudstack/api/command/test/UpdateCfgCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/UpdateCfgCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/UpdateCfgCmdTest.java
index 27000cf..0841abd 100644
--- a/api/test/org/apache/cloudstack/api/command/test/UpdateCfgCmdTest.java
+++ b/api/test/org/apache/cloudstack/api/command/test/UpdateCfgCmdTest.java
@@ -16,7 +16,6 @@
 // under the License.
 package org.apache.cloudstack.api.command.test;
 
-import com.cloud.configuration.Configuration;
 import com.cloud.configuration.ConfigurationService;
 import com.cloud.exception.InvalidParameterValueException;
 import com.cloud.resource.ResourceService;
@@ -26,6 +25,8 @@ import org.apache.cloudstack.api.ResponseGenerator;
 import org.apache.cloudstack.api.ServerApiException;
 import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
 import org.apache.cloudstack.api.response.ConfigurationResponse;
+import org.apache.cloudstack.config.Configuration;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/engine/components-api/src/com/cloud/vm/ReservationContextImpl.java
----------------------------------------------------------------------
diff --git a/engine/components-api/src/com/cloud/vm/ReservationContextImpl.java b/engine/components-api/src/com/cloud/vm/ReservationContextImpl.java
index cab93b4..f988d66 100644
--- a/engine/components-api/src/com/cloud/vm/ReservationContextImpl.java
+++ b/engine/components-api/src/com/cloud/vm/ReservationContextImpl.java
@@ -16,12 +16,12 @@
 // under the License.
 package com.cloud.vm;
 
-import com.cloud.dao.EntityManager;
 import com.cloud.domain.Domain;
 import com.cloud.domain.DomainVO;
 import com.cloud.user.Account;
 import com.cloud.user.User;
 import com.cloud.utils.Journal;
+import com.cloud.utils.db.EntityManager;
 
 public class ReservationContextImpl implements ReservationContext {
     User _caller;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/engine/components-api/src/org/apache/cloudstack/config/ConfigDepot.java
----------------------------------------------------------------------
diff --git a/engine/components-api/src/org/apache/cloudstack/config/ConfigDepot.java b/engine/components-api/src/org/apache/cloudstack/config/ConfigDepot.java
deleted file mode 100644
index 640753c..0000000
--- a/engine/components-api/src/org/apache/cloudstack/config/ConfigDepot.java
+++ /dev/null
@@ -1,25 +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;
-
-/**
- * ConfigRepo is a repository of configurations.
- *
- */
-public interface ConfigDepot {
-    <T> ConfigValue<T> get(ConfigKey<T> key);
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/engine/components-api/src/org/apache/cloudstack/config/ConfigValue.java
----------------------------------------------------------------------
diff --git a/engine/components-api/src/org/apache/cloudstack/config/ConfigValue.java b/engine/components-api/src/org/apache/cloudstack/config/ConfigValue.java
deleted file mode 100644
index 12a3156..0000000
--- a/engine/components-api/src/org/apache/cloudstack/config/ConfigValue.java
+++ /dev/null
@@ -1,72 +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 com.cloud.configuration.ConfigurationVO;
-import com.cloud.configuration.dao.ConfigurationDao;
-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;
-    ConfigurationDao _dao;
-    Number _multiplier;
-
-    public ConfigValue(ConfigurationDao dao, ConfigKey<T> config) {
-        _dao = dao;
-        _config = config;
-        _multiplier = 1;
-    }
-
-    public ConfigKey<T> getConfigKey() {
-        return _config;
-    }
-
-    public ConfigValue<T> setMultiplier(Number multiplier) {  // Convience method
-        _multiplier = multiplier;
-        return this;
-    }
-
-    @SuppressWarnings("unchecked")
-    public T value() {
-        ConfigurationVO vo = _dao.findByName(_config.key());
-        String value = vo != null ? vo.getValue() : _config.defaultValue();
-        
-        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) * _multiplier.intValue()));
-        } else if (type.isAssignableFrom(Long.class)) {
-            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) * _multiplier.floatValue());
-        }
-
-        throw new CloudRuntimeException("Unsupported data type for config values: " + type);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
index f3e2add..4f308fb 100755
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -85,7 +85,6 @@ import com.cloud.agent.api.to.VirtualMachineTO;
 import com.cloud.agent.manager.Commands;
 import com.cloud.agent.manager.allocator.HostAllocator;
 import com.cloud.alert.AlertManager;
-import com.cloud.dao.EntityManager;
 import com.cloud.dc.ClusterDetailsDao;
 import com.cloud.dc.ClusterDetailsVO;
 import com.cloud.dc.ClusterVO;
@@ -150,6 +149,7 @@ import com.cloud.utils.Ternary;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.concurrency.NamedThreadFactory;
 import com.cloud.utils.db.DB;
+import com.cloud.utils.db.EntityManager;
 import com.cloud.utils.db.GlobalLock;
 import com.cloud.utils.db.SearchBuilder;
 import com.cloud.utils.db.SearchCriteria;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java b/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java
index 5207fc5..3de9c16 100644
--- a/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java
+++ b/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java
@@ -32,9 +32,9 @@ import org.apache.cloudstack.framework.jobs.AsyncJobManager;
 import org.apache.cloudstack.jobs.JobInfo;
 
 import com.cloud.api.StringMapTypeAdapter;
-import com.cloud.dao.EntityManager;
 import com.cloud.user.dao.AccountDao;
 import com.cloud.utils.component.AdapterBase;
+import com.cloud.utils.db.EntityManager;
 import com.cloud.vm.dao.VMInstanceDao;
 
 public class VmWorkJobDispatcher extends AdapterBase implements AsyncJobDispatcher {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/engine/orchestration/src/org/apache/cloudstack/engine/vm/VMEntityManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/vm/VMEntityManagerImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/vm/VMEntityManagerImpl.java
index c4e2b4c..77a842e 100755
--- a/engine/orchestration/src/org/apache/cloudstack/engine/vm/VMEntityManagerImpl.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/vm/VMEntityManagerImpl.java
@@ -34,7 +34,6 @@ import org.apache.cloudstack.engine.cloud.entity.dao.VMReservationDao;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 
-import com.cloud.dao.EntityManager;
 import com.cloud.dc.DataCenter;
 import com.cloud.deploy.DataCenterDeployment;
 import com.cloud.deploy.DeployDestination;
@@ -60,6 +59,7 @@ import com.cloud.storage.dao.VMTemplateDao;
 import com.cloud.storage.dao.VolumeDao;
 import com.cloud.user.dao.AccountDao;
 import com.cloud.user.dao.UserDao;
+import com.cloud.utils.db.EntityManager;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.vm.VMInstanceVO;
 import com.cloud.vm.VirtualMachine;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/engine/orchestration/test/com/cloud/vm/VirtualMachineManagerImplTest.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/test/com/cloud/vm/VirtualMachineManagerImplTest.java b/engine/orchestration/test/com/cloud/vm/VirtualMachineManagerImplTest.java
index 3035ba5..607c1e2 100644
--- a/engine/orchestration/test/com/cloud/vm/VirtualMachineManagerImplTest.java
+++ b/engine/orchestration/test/com/cloud/vm/VirtualMachineManagerImplTest.java
@@ -56,7 +56,6 @@ import com.cloud.agent.api.PrepareForMigrationCommand;
 import com.cloud.agent.api.ScaleVmAnswer;
 import com.cloud.agent.api.ScaleVmCommand;
 import com.cloud.configuration.dao.ConfigurationDao;
-import com.cloud.dao.EntityManager;
 import com.cloud.dc.dao.ClusterDao;
 import com.cloud.dc.dao.DataCenterDao;
 import com.cloud.dc.dao.HostPodDao;
@@ -91,6 +90,7 @@ import com.cloud.user.UserVO;
 import com.cloud.user.dao.AccountDao;
 import com.cloud.user.dao.UserDao;
 import com.cloud.utils.Pair;
+import com.cloud.utils.db.EntityManager;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.vm.VirtualMachine.Event;
 import com.cloud.vm.VirtualMachine.PowerState;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/engine/schema/src/com/cloud/configuration/ConfigurationVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/configuration/ConfigurationVO.java b/engine/schema/src/com/cloud/configuration/ConfigurationVO.java
index 6cd87b0..ac499b8 100644
--- a/engine/schema/src/com/cloud/configuration/ConfigurationVO.java
+++ b/engine/schema/src/com/cloud/configuration/ConfigurationVO.java
@@ -21,6 +21,8 @@ import javax.persistence.Entity;
 import javax.persistence.Id;
 import javax.persistence.Table;
 
+import org.apache.cloudstack.config.Configuration;
+
 import com.cloud.utils.crypt.DBEncryptionUtil;
 
 @Entity

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/engine/schema/src/com/cloud/vm/VirtualMachineProfileImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/VirtualMachineProfileImpl.java b/engine/schema/src/com/cloud/vm/VirtualMachineProfileImpl.java
index 5805c03..9e9e342 100644
--- a/engine/schema/src/com/cloud/vm/VirtualMachineProfileImpl.java
+++ b/engine/schema/src/com/cloud/vm/VirtualMachineProfileImpl.java
@@ -22,7 +22,6 @@ import java.util.List;
 import java.util.Map;
 
 import com.cloud.agent.api.to.VolumeTO;
-import com.cloud.dao.EntityManager;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.offering.ServiceOffering;
 import com.cloud.service.ServiceOfferingVO;
@@ -31,6 +30,7 @@ import com.cloud.template.VirtualMachineTemplate;
 import com.cloud.template.VirtualMachineTemplate.BootloaderType;
 import com.cloud.user.Account;
 import com.cloud.user.AccountVO;
+import com.cloud.utils.db.EntityManager;
 
 /**
  * Implementation of VirtualMachineProfile.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/server/src/com/cloud/api/ApiDispatcher.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiDispatcher.java b/server/src/com/cloud/api/ApiDispatcher.java
index ff709d0..c95ee5f 100755
--- a/server/src/com/cloud/api/ApiDispatcher.java
+++ b/server/src/com/cloud/api/ApiDispatcher.java
@@ -58,12 +58,12 @@ import org.apache.cloudstack.context.CallContext;
 import org.apache.cloudstack.framework.jobs.AsyncJob;
 import org.apache.cloudstack.framework.jobs.AsyncJobManager;
 
-import com.cloud.dao.EntityManager;
 import com.cloud.exception.InvalidParameterValueException;
 import com.cloud.user.Account;
 import com.cloud.user.AccountManager;
 import com.cloud.utils.DateUtil;
 import com.cloud.utils.ReflectUtil;
+import com.cloud.utils.db.EntityManager;
 import com.cloud.utils.exception.CSExceptionErrorCode;
 import com.cloud.utils.exception.CloudRuntimeException;
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java
index dee5a7e..f989ddb 100755
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -136,6 +136,7 @@ import org.apache.cloudstack.api.response.VpcOfferingResponse;
 import org.apache.cloudstack.api.response.VpcResponse;
 import org.apache.cloudstack.api.response.VpnUsersResponse;
 import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.cloudstack.config.Configuration;
 import org.apache.cloudstack.context.CallContext;
 import org.apache.cloudstack.framework.jobs.AsyncJob;
 import org.apache.cloudstack.framework.jobs.AsyncJobManager;
@@ -170,12 +171,10 @@ import com.cloud.api.query.vo.VolumeJoinVO;
 import com.cloud.capacity.Capacity;
 import com.cloud.capacity.CapacityVO;
 import com.cloud.capacity.dao.CapacityDaoImpl.SummedCapacity;
-import com.cloud.configuration.Configuration;
 import com.cloud.configuration.Resource.ResourceOwnerType;
 import com.cloud.configuration.Resource.ResourceType;
 import com.cloud.configuration.ResourceCount;
 import com.cloud.configuration.ResourceLimit;
-import com.cloud.dao.EntityManager;
 import com.cloud.dc.ClusterVO;
 import com.cloud.dc.DataCenter;
 import com.cloud.dc.DataCenterVO;
@@ -284,6 +283,7 @@ import com.cloud.user.UserAccount;
 import com.cloud.uservm.UserVm;
 import com.cloud.utils.Pair;
 import com.cloud.utils.StringUtils;
+import com.cloud.utils.db.EntityManager;
 import com.cloud.utils.net.Ip;
 import com.cloud.utils.net.NetUtils;
 import com.cloud.vm.ConsoleProxyVO;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/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 be161c6..6d946a7 100755
--- a/server/src/com/cloud/api/ApiServer.java
+++ b/server/src/com/cloud/api/ApiServer.java
@@ -123,7 +123,6 @@ import com.cloud.api.response.ApiResponseSerializer;
 import com.cloud.configuration.Config;
 import com.cloud.configuration.ConfigurationVO;
 import com.cloud.configuration.dao.ConfigurationDao;
-import com.cloud.dao.EntityManager;
 import com.cloud.domain.Domain;
 import com.cloud.domain.DomainVO;
 import com.cloud.event.ActionEventUtils;
@@ -148,6 +147,7 @@ import com.cloud.utils.component.ComponentContext;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.component.PluggableService;
 import com.cloud.utils.concurrency.NamedThreadFactory;
+import com.cloud.utils.db.EntityManager;
 import com.cloud.utils.db.SearchCriteria;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.exception.CloudRuntimeException;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/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 9401811..c7947c3 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -72,6 +72,7 @@ import org.apache.cloudstack.config.ConfigDepot;
 import org.apache.cloudstack.config.ConfigKey;
 import org.apache.cloudstack.config.ConfigValue;
 import org.apache.cloudstack.config.Configurable;
+import org.apache.cloudstack.config.Configuration;
 import org.apache.cloudstack.context.CallContext;
 import org.apache.cloudstack.region.PortableIp;
 import org.apache.cloudstack.region.PortableIpDao;
@@ -200,6 +201,7 @@ import com.cloud.utils.StringUtils;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.crypt.DBEncryptionUtil;
 import com.cloud.utils.db.DB;
+import com.cloud.utils.db.EntityManager;
 import com.cloud.utils.db.Filter;
 import com.cloud.utils.db.GlobalLock;
 import com.cloud.utils.db.SearchCriteria;
@@ -319,6 +321,8 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
     public ManagementService _mgr;
     @Inject
     DedicatedResourceDao _dedicatedDao;
+    @Inject
+    EntityManager _entityMgr;
 
     @Inject
     List<Configurable> _configurables;
@@ -4636,7 +4640,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
 
     @Override
     public <T> ConfigValue<T> get(ConfigKey<T> config) {
-        return new ConfigValue<T>(_configDao, config);
+        return new ConfigValue<T>(_entityMgr, config);
     }
     
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
index 513a713..8f0c096 100755
--- a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
+++ b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
@@ -53,7 +53,6 @@ import com.cloud.cluster.ClusterManager;
 import com.cloud.configuration.Config;
 import com.cloud.configuration.ZoneConfig;
 import com.cloud.configuration.dao.ConfigurationDao;
-import com.cloud.dao.EntityManager;
 import com.cloud.dc.DataCenter;
 import com.cloud.dc.DataCenter.NetworkType;
 import com.cloud.dc.DataCenterVO;
@@ -116,6 +115,7 @@ import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.GlobalLock;
 import com.cloud.utils.db.SearchCriteria.Op;
+import com.cloud.utils.db.EntityManager;
 import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.db.SearchCriteriaService;
 import com.cloud.utils.db.Transaction;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/server/src/com/cloud/dao/EntityManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/dao/EntityManagerImpl.java b/server/src/com/cloud/dao/EntityManagerImpl.java
index 18302d9..66a494e 100644
--- a/server/src/com/cloud/dao/EntityManagerImpl.java
+++ b/server/src/com/cloud/dao/EntityManagerImpl.java
@@ -28,6 +28,7 @@ import net.sf.ehcache.Cache;
 import org.springframework.stereotype.Component;
 
 import com.cloud.utils.component.ManagerBase;
+import com.cloud.utils.db.EntityManager;
 import com.cloud.utils.db.GenericDao;
 import com.cloud.utils.db.GenericDaoBase;
 import com.cloud.utils.db.GenericSearchBuilder;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index e8090c8..a1bb1ff 100755
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -99,7 +99,6 @@ import com.cloud.configuration.Config;
 import com.cloud.configuration.ConfigurationManager;
 import com.cloud.configuration.ZoneConfig;
 import com.cloud.configuration.dao.ConfigurationDao;
-import com.cloud.dao.EntityManager;
 import com.cloud.dc.ClusterVO;
 import com.cloud.dc.DataCenter;
 import com.cloud.dc.DataCenter.NetworkType;
@@ -219,6 +218,7 @@ import com.cloud.utils.StringUtils;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.concurrency.NamedThreadFactory;
 import com.cloud.utils.db.DB;
+import com.cloud.utils.db.EntityManager;
 import com.cloud.utils.db.Filter;
 import com.cloud.utils.db.GlobalLock;
 import com.cloud.utils.db.JoinBuilder;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java b/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
index edf14fc..d0a4797 100755
--- a/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
+++ b/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
@@ -47,7 +47,6 @@ import com.cloud.configuration.ResourceLimitVO;
 import com.cloud.configuration.dao.ConfigurationDao;
 import com.cloud.configuration.dao.ResourceCountDao;
 import com.cloud.configuration.dao.ResourceLimitDao;
-import com.cloud.dao.EntityManager;
 import com.cloud.dc.VlanVO;
 import com.cloud.dc.dao.VlanDao;
 import com.cloud.domain.Domain;
@@ -83,6 +82,7 @@ import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.concurrency.NamedThreadFactory;
 import com.cloud.utils.db.DB;
+import com.cloud.utils.db.EntityManager;
 import com.cloud.utils.db.Filter;
 import com.cloud.utils.db.GenericSearchBuilder;
 import com.cloud.utils.db.JoinBuilder;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/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 3d0e5c6..52d573d 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -420,6 +420,7 @@ import org.apache.cloudstack.api.command.user.vpn.ResetVpnConnectionCmd;
 import org.apache.cloudstack.api.command.user.vpn.UpdateVpnCustomerGatewayCmd;
 import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd;
 import org.apache.cloudstack.api.response.ExtractResponse;
+import org.apache.cloudstack.config.Configuration;
 import org.apache.cloudstack.context.CallContext;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
 import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
@@ -450,7 +451,6 @@ import com.cloud.capacity.dao.CapacityDao;
 import com.cloud.capacity.dao.CapacityDaoImpl.SummedCapacity;
 import com.cloud.cluster.ClusterManager;
 import com.cloud.configuration.Config;
-import com.cloud.configuration.Configuration;
 import com.cloud.configuration.ConfigurationManager;
 import com.cloud.configuration.ConfigurationVO;
 import com.cloud.configuration.dao.ConfigurationDao;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/server/src/com/cloud/servlet/ConsoleProxyServlet.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/servlet/ConsoleProxyServlet.java b/server/src/com/cloud/servlet/ConsoleProxyServlet.java
index ff16119..ed45698 100644
--- a/server/src/com/cloud/servlet/ConsoleProxyServlet.java
+++ b/server/src/com/cloud/servlet/ConsoleProxyServlet.java
@@ -45,7 +45,6 @@ import com.google.gson.GsonBuilder;
 
 import org.apache.cloudstack.api.IdentityService;
 
-import com.cloud.dao.EntityManager;
 import com.cloud.exception.PermissionDeniedException;
 import com.cloud.host.HostVO;
 import com.cloud.server.ManagementServer;
@@ -56,6 +55,7 @@ import com.cloud.user.User;
 import com.cloud.uservm.UserVm;
 import com.cloud.utils.Pair;
 import com.cloud.utils.Ternary;
+import com.cloud.utils.db.EntityManager;
 import com.cloud.utils.db.Transaction;
 import com.cloud.vm.VMInstanceVO;
 import com.cloud.vm.VirtualMachine;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/server/src/com/cloud/servlet/RegisterCompleteServlet.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/servlet/RegisterCompleteServlet.java b/server/src/com/cloud/servlet/RegisterCompleteServlet.java
index 702b617..04c5ea9 100644
--- a/server/src/com/cloud/servlet/RegisterCompleteServlet.java
+++ b/server/src/com/cloud/servlet/RegisterCompleteServlet.java
@@ -30,7 +30,8 @@ import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 import org.springframework.web.context.support.SpringBeanAutowiringSupport;
 
-import com.cloud.configuration.Configuration;
+import org.apache.cloudstack.config.Configuration;
+
 import com.cloud.configuration.dao.ConfigurationDao;
 import com.cloud.user.Account;
 import com.cloud.user.AccountService;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/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 1324ac7..65e76f6 100755
--- a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
+++ b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
@@ -56,7 +56,6 @@ import com.cloud.configuration.Config;
 import com.cloud.configuration.ZoneConfig;
 import com.cloud.configuration.dao.ConfigurationDao;
 import com.cloud.consoleproxy.ConsoleProxyManager;
-import com.cloud.dao.EntityManager;
 import com.cloud.dc.DataCenter;
 import com.cloud.dc.DataCenter.NetworkType;
 import com.cloud.dc.DataCenterVO;
@@ -111,6 +110,7 @@ import com.cloud.utils.Pair;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.db.GlobalLock;
 import com.cloud.utils.db.SearchCriteria.Op;
+import com.cloud.utils.db.EntityManager;
 import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.db.SearchCriteriaService;
 import com.cloud.utils.events.SubscriptionMgr;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/server/test/com/cloud/async/AsyncJobTestConfiguration.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/async/AsyncJobTestConfiguration.java b/server/test/com/cloud/async/AsyncJobTestConfiguration.java
index d6b8ee0..f1485ca 100644
--- a/server/test/com/cloud/async/AsyncJobTestConfiguration.java
+++ b/server/test/com/cloud/async/AsyncJobTestConfiguration.java
@@ -37,9 +37,9 @@ import com.cloud.api.ApiDispatcher;
 import com.cloud.cluster.ClusterManager;
 import com.cloud.configuration.ConfigurationManager;
 import com.cloud.configuration.dao.ConfigurationDao;
-import com.cloud.dao.EntityManager;
 import com.cloud.user.AccountManager;
 import com.cloud.user.dao.AccountDao;
+import com.cloud.utils.db.EntityManager;
 import com.cloud.vm.VirtualMachineManager;
 
 @Configuration

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/server/test/com/cloud/vm/VmWorkTestConfiguration.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vm/VmWorkTestConfiguration.java b/server/test/com/cloud/vm/VmWorkTestConfiguration.java
index cd0dc2c..db29b21 100644
--- a/server/test/com/cloud/vm/VmWorkTestConfiguration.java
+++ b/server/test/com/cloud/vm/VmWorkTestConfiguration.java
@@ -40,9 +40,9 @@ import com.cloud.api.ApiDispatcher;
 import com.cloud.cluster.ClusterManager;
 import com.cloud.configuration.ConfigurationManager;
 import com.cloud.configuration.dao.ConfigurationDao;
-import com.cloud.dao.EntityManager;
 import com.cloud.user.AccountManager;
 import com.cloud.user.dao.AccountDao;
+import com.cloud.utils.db.EntityManager;
 import com.cloud.vm.dao.VMInstanceDao;
 
 @Configuration

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java b/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
index 734d274..65fe105 100755
--- a/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
+++ b/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
@@ -50,10 +50,10 @@ import org.apache.cloudstack.api.command.admin.zone.CreateZoneCmd;
 import org.apache.cloudstack.api.command.admin.zone.DeleteZoneCmd;
 import org.apache.cloudstack.api.command.admin.zone.UpdateZoneCmd;
 import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd;
+import org.apache.cloudstack.config.Configuration;
 import org.apache.cloudstack.region.PortableIp;
 import org.apache.cloudstack.region.PortableIpRange;
 
-import com.cloud.configuration.Configuration;
 import com.cloud.configuration.ConfigurationManager;
 import com.cloud.configuration.ConfigurationService;
 import com.cloud.dc.ClusterVO;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/utils/src/com/cloud/utils/db/Condition.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/db/Condition.java b/utils/src/com/cloud/utils/db/Condition.java
deleted file mode 100644
index 55b19d8..0000000
--- a/utils/src/com/cloud/utils/db/Condition.java
+++ /dev/null
@@ -1,100 +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
-// 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.db;
-
-import java.util.HashMap;
-
-import com.cloud.utils.db.SearchCriteria.Op;
-
-public class Condition<T, K> {
-    Where<T, K> _where;
-    Attribute _attr;
-    String _as;
-    SearchCriteria.Op _op;
-    String _paramName;
-    
-    protected Condition(Where<T, K> where, Attribute attr, String as) {
-        assert (where != null) : "What am I going to return to the user when Where is null?";
-        assert (attr != null) : "What's the point of giving me a null attribute?";
-        _where = where;
-        _attr = attr;
-        _as = as;
-    }
-    
-    protected NextWhere<T, K> set(Op op, String paramName) {
-        _op = op;
-        _paramName = paramName;
-        Where<T, K> where = _where;
-        _where = null;
-        return where;
-    }
-    
-    public NextWhere<T, K> eq(String paramName) {
-        return set(Op.EQ, paramName);
-    }
-    
-    public NextWhere<T, K> lt(String paramName) {
-        return set(Op.LT, paramName);
-    }
-    
-    public NextWhere<T, K> lteq(String paramName) {
-        return set(Op.LTEQ, paramName);
-    }
-    
-    public NextWhere<T, K> gt(String paramName) {
-        return set(Op.GT, paramName);
-    }
-    
-    public NextWhere<T, K> isNull() {
-        return set(Op.NULL, null);
-    }
-    
-    public NextWhere<T, K> isNotNull() {
-        return set(Op.NNULL, null);
-    }
-    
-    public NextWhere<T, K> in(String paramName) {
-        _op = Op.IN;
-        _paramName = paramName;
-        return _where;
-    }
-    
-    protected String getParamName() {
-        assert (_paramName instanceof String) : "Well, how can we get back a parameter name if it was not assigned one?";
-        return _paramName;
-    }
-    
-    @Override
-    public boolean equals(Object obj) {
-        return _paramName.equals(obj);
-    }
-    
-    @Override
-    public int hashCode() {
-        return _paramName.hashCode();
-    }
-    
-    public void toSql(StringBuilder builder, HashMap<String, Object[]> values) {
-        if (_as != null) {
-            builder.append(_as);
-        } else {
-            builder.append(_attr.table);
-        }
-        builder.append(".").append(_attr.columnName);
-    }
-   
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/utils/src/com/cloud/utils/db/EntityManager.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/db/EntityManager.java b/utils/src/com/cloud/utils/db/EntityManager.java
new file mode 100644
index 0000000..f4e1ca2
--- /dev/null
+++ b/utils/src/com/cloud/utils/db/EntityManager.java
@@ -0,0 +1,99 @@
+// 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.db;
+
+import java.io.Serializable;
+import java.util.List;
+
+
+/**
+ * Generic Entity Manager to retrieve database objects.
+ *
+ */
+public interface EntityManager {
+    /**
+     * Finds an entity by its id.
+     * @param <T> class of the entity you're trying to find.
+     * @param <K> class of the id that the entity uses.
+     * @param entityType Type of the entity.
+     * @param id id value
+     * @return T if found; null if not.
+     */
+    public <T, K extends Serializable> T findById(Class<T> entityType, K id);
+
+    /**
+     * Finds an entity by its id including removed.
+     * @param <T> class of the entity you're trying to find.
+     * @param <K> class of the id that the entity uses.
+     * @param entityType Type of the entity.
+     * @param id id value
+     * @return T if found; null if not.
+     */
+    public <T, K extends Serializable> T findByIdIncludingRemoved(Class<T> entityType, K id);
+    
+    /**
+     * Finds a unique entity by uuid string
+     * @param <T> entity class
+     * @param entityType type of entity you're looking for.
+     * @param uuid the unique id
+     * @return T if found, null if not.
+     */
+    public <T> T findByUuid(Class<T> entityType, String uuid);
+
+    /**
+     * Finds a unique entity by uuid string
+     * @param <T> entity class
+     * @param entityType type of entity you're looking for.
+     * @param uuid the unique id
+     * @return T if found, null if not.
+     */
+    public <T> T findByUuidIncludingRemoved(Class<T> entityType, String uuid);
+
+    /**
+     * Finds an entity by external id which is always String
+     * @param <T> entity class
+     * @param entityType type of entity you're looking for.
+     * @param xid external id
+     * @return T if found, null if not.
+     */
+    public <T> T findByXId(Class<T> entityType, String xid);
+
+    /**
+     * Lists all entities.  Use this method at your own risk.
+     * @param <T> entity class
+     * @param entityType type of entity you're looking for.
+     * @return List<T>
+     */
+    public <T> List<? extends T> list(Class<T> entityType);
+
+    /**
+     * Persists the entity.
+     * @param <T> entity class
+     * @param t entity
+     * @return persisted entity.  Only use this after persisting.
+     */
+    public <T> T persist(T t);
+
+    public <T> SearchBuilder<T> createSearchBuilder(Class<T> entityType);
+
+    public <T, K> GenericSearchBuilder<T, K> createGenericSearchBuilder(Class<T> entityType, Class<K> resultType);
+
+    public <T, K> List<K> search(Class<T> entityType, SearchCriteria<K> sc);
+
+    public <T, K extends Serializable> void remove(Class<T> entityType, K id);
+}
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/utils/src/com/cloud/utils/db/FirstWhere.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/db/FirstWhere.java b/utils/src/com/cloud/utils/db/FirstWhere.java
deleted file mode 100644
index 46551e9..0000000
--- a/utils/src/com/cloud/utils/db/FirstWhere.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
-// 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.db;
-
-public interface FirstWhere<T, K> {
-    Condition<T, K> field(Object field);
-    
-    Condition<T, K> field(Object field, String as);
-    
-    NextWhere<T, K> text(String text, String... paramNames);
-    
-    FirstWhere<T, K> op();
-    
-    void done();
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/utils/src/com/cloud/utils/db/JoinQueryBuilder.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/db/JoinQueryBuilder.java b/utils/src/com/cloud/utils/db/JoinQueryBuilder.java
deleted file mode 100644
index 090a1d1..0000000
--- a/utils/src/com/cloud/utils/db/JoinQueryBuilder.java
+++ /dev/null
@@ -1,31 +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
-// 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.db;
-
-/**
- * JoinQueryBuilder builds queries for joins between multiple tables.
- *
- */
-public interface JoinQueryBuilder<S, T> {
-    Select<S, T> selectField(Object column);
-
-    <J> On<S, J, T> innerJoin(Class<J> entityClazz);
-    
-    <J> J entity(Class<J> entityClazz);
-    
-    FirstWhere<S, T> where();
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/utils/src/com/cloud/utils/db/NextWhere.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/db/NextWhere.java b/utils/src/com/cloud/utils/db/NextWhere.java
deleted file mode 100644
index 0d65ae4..0000000
--- a/utils/src/com/cloud/utils/db/NextWhere.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
-// 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.db;
-
-public interface NextWhere<T, K> extends FirstWhere<T, K> {
-    NextWhere<T, K> and();
-    NextWhere<T, K> or();
-    NextWhere<T, K> not();
-    
-    @Override
-    void done();
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/utils/src/com/cloud/utils/db/On.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/db/On.java b/utils/src/com/cloud/utils/db/On.java
deleted file mode 100644
index 6965f4d..0000000
--- a/utils/src/com/cloud/utils/db/On.java
+++ /dev/null
@@ -1,21 +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
-// 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.db;
-
-public interface On<S, J, T> {
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/utils/src/com/cloud/utils/db/QueryBuilder.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/db/QueryBuilder.java b/utils/src/com/cloud/utils/db/QueryBuilder.java
deleted file mode 100644
index 3303fbd..0000000
--- a/utils/src/com/cloud/utils/db/QueryBuilder.java
+++ /dev/null
@@ -1,194 +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
-// 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.db;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import net.sf.cglib.proxy.Enhancer;
-import net.sf.cglib.proxy.MethodInterceptor;
-import net.sf.cglib.proxy.MethodProxy;
-
-import com.cloud.utils.Pair;
-
-public class QueryBuilder<S, T> implements MethodInterceptor, SimpleQueryBuilder<S>, SelectQueryBuilder<S, T>, JoinQueryBuilder<S, T> {
-    public enum Func {
-        NATIVE("@", 1),
-        MAX("MAX(@)", 1),
-        MIN("MIN(@)", 1),
-        FIRST("FIRST(@)", 1),
-        LAST("LAST(@)", 1),
-        SUM("SUM(@)", 1),
-        COUNT("COUNT(@)", 1),
-        DISTINCT("DISTINCT(@)", 1);
-        
-        private String func;
-        private int count;
-        
-        Func(String func, int params) {
-            this.func = func;
-            this.count = params;
-        }
-        
-        @Override
-        public String toString() {
-            return func;
-        }
-        
-        public int getCount() {
-            return count;
-        }
-    }
-    
-    protected HashMap<Class<?>, Pair<GenericDao<?,?>, Object>> _entities;
-    protected ArrayList<Attribute> _specifiedAttrs = new ArrayList<Attribute>();
-    protected T _resultSetClass;
-    protected ArrayList<Select<S, T>> _selects;
-    
-    public QueryBuilder(Class<T> resultSetClass, Class<?>... clazzes) {
-        _entities = new HashMap<Class<?>, Pair<GenericDao<?,?>, Object>>(clazzes.length);
-        for (Class<?> clazz : clazzes) {
-            GenericDao<?,?> dao = GenericDaoBase.getDao(clazz);
-            Enhancer searchEnhancer = new Enhancer();
-            searchEnhancer.setSuperclass(clazz);
-            searchEnhancer.setCallback(this);
-            Object entity = searchEnhancer.create();
-            
-            _entities.put(clazz, new Pair<GenericDao<?, ?>, Object>(dao, entity));
-        }
-    }
-    
-    protected void clean() {
-        _specifiedAttrs = null;
-        _entities = null;
-    }
-    
-    /**
-     * Constructor for SelectQueryBuilder interface.  Must specify the
-     * table to be performing the query on and the result class to place it in.
-     * @param entityClass entity class to do the query on.
-     * @param resultSetClass result class to put the result set in.
-     */
-    public QueryBuilder(Class<S> entityClass, Class<T> resultSetClass) {
-        _entities = new HashMap<Class<?>, Pair<GenericDao<?,?>, Object>>(1);
-        GenericDao<?,?> dao = GenericDaoBase.getDao(entityClass);
-        Enhancer searchEnhancer = new Enhancer();
-        searchEnhancer.setSuperclass(entityClass);
-        searchEnhancer.setCallback(this);
-        Object entity = searchEnhancer.create();
-        
-        _entities.put(entityClass, new Pair<GenericDao<?, ?>, Object>(dao, entity));
-    }
-    
-    @Override
-    public SimpleQueryBuilder<S> selectFields(Object... fields) {
-        assert _entities != null && _entities.size() == 1 : "Now you've done it....Stop casting interfaces on the QueryBuilder";
-        assert _specifiedAttrs.size() > 0 : "You didn't specify any attributes";
-   
-        if (_selects == null) {
-            _selects = new ArrayList<Select<S, T>>(fields.length);
-        }
-        
-        for (Attribute attr : _specifiedAttrs) {
-            _selects.add(new Select<S, T>(this, null, attr));
-        }
-        
-        _specifiedAttrs.clear();
-        
-        return this;
-    }
-    
-    protected void set(GenericDao<?, ?> dao , String name) {
-        Attribute attr = dao.getAllAttributes().get(name);
-        assert (attr != null) : "Searching for a field that's not there: " + name;
-        _specifiedAttrs.add(attr);
-    }
-    
-    
-    @Override
-    public Object intercept(Object entity, Method method, Object[] args, MethodProxy proxy) throws Throwable {
-        Class<?> entityClass = entity.getClass().getSuperclass();
-        
-        Pair<GenericDao<?,?>, Object> daoInfo = _entities.get(entityClass);
-        assert (daoInfo != null) : "You need to specify " + entityClass + " as one of the entities in the Query";
-        GenericDao<?,?> dao = daoInfo.first();
-        
-        String name = method.getName();
-        if (name.startsWith("get")) {
-            String fieldName = Character.toLowerCase(name.charAt(3)) + name.substring(4);
-            set(dao, fieldName);
-            return null;
-        } else if (name.startsWith("is")) {
-            String fieldName = Character.toLowerCase(name.charAt(2)) + name.substring(3);
-            set(dao, fieldName);
-            return null;
-        } else {
-            assert false : "Perhaps you need to make the method start with get or is?";
-        }
-        return proxy.invokeSuper(entity, args);
-    }
-    
-    @Override
-    @SuppressWarnings("unchecked")
-    public <E> E entity(Class<E> clazz) {
-        return (E)_entities.get(clazz).second();
-    }
-    
-    @Override
-    @SuppressWarnings("unchecked")
-    public S entity() {
-        return (S)_entities.values().iterator().next().second();
-    }
-
-    @Override
-    public FirstWhere<S, T> where() {
-        return new Where<S, T>(this);
-    }
-
-    @Override
-    public SimpleQueryBuilder<S> selectAll() {
-        return this;
-    }
-    
-    public List<Attribute> getSpecifiedAttributes() {
-        return _specifiedAttrs;
-    }
-    
-    public Attribute getSpecifiedAttribute() {
-        assert _specifiedAttrs.size() == 1 : "You can only specify one attribute";
-        return _specifiedAttrs.get(0);
-    }
-
-    @Override
-    public Select<S, T> selectColumn(Object column) {
-        return null;
-    }
-
-    @Override
-    public Select<S, T> selectField(Object column) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public <J> On<S, J, T> innerJoin(Class<J> entityClazz) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/utils/src/com/cloud/utils/db/Select.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/db/Select.java b/utils/src/com/cloud/utils/db/Select.java
deleted file mode 100644
index d82d1fa..0000000
--- a/utils/src/com/cloud/utils/db/Select.java
+++ /dev/null
@@ -1,52 +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
-// 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.db;
-
-import java.lang.reflect.Field;
-
-public class Select<S, T> {
-    QueryBuilder<S,T> _builder;
-    Class<T> _clazz;
-    Attribute _attr;
-    String _as;
-    Field _field;
-    
-    protected Select(QueryBuilder<S, T> builder, Class<T> clazz, Attribute attr) {
-        _builder = builder;
-        _clazz = clazz;
-        _attr = attr;
-    }
-    
-    public QueryBuilder<S, T> into(String fieldName) {
-        if (fieldName != null) {
-            try {
-                _field = _clazz.getDeclaredField(fieldName);
-                _field.setAccessible(true);
-            } catch (SecurityException e) {
-                throw new RuntimeException("Unable to find " + fieldName + " in " + _clazz.getName(), e);
-            } catch (NoSuchFieldException e) {
-                throw new RuntimeException("Unable to find " + fieldName + " in " + _clazz.getName(), e);
-            }
-        }
-        return _builder;
-    }
-    
-    public QueryBuilder<S, T> as(String as) {
-        _as = as;
-        return _builder;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/utils/src/com/cloud/utils/db/SelectQueryBuilder.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/db/SelectQueryBuilder.java b/utils/src/com/cloud/utils/db/SelectQueryBuilder.java
deleted file mode 100644
index 82ba134..0000000
--- a/utils/src/com/cloud/utils/db/SelectQueryBuilder.java
+++ /dev/null
@@ -1,28 +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
-// 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.db;
-
-/**
- * is defined.
- */
-public interface SelectQueryBuilder<T, S> {
-    Select<T, S> selectColumn(Object column);
-
-    T entity();
-    
-    FirstWhere<T, S> where();
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/utils/src/com/cloud/utils/db/SimpleQueryBuilder.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/db/SimpleQueryBuilder.java b/utils/src/com/cloud/utils/db/SimpleQueryBuilder.java
deleted file mode 100644
index 9e446d2..0000000
--- a/utils/src/com/cloud/utils/db/SimpleQueryBuilder.java
+++ /dev/null
@@ -1,47 +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
-// 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.db;
-
-/**
- * SimpleQueryBuilder builds queries against a single table.  The
- *
- */
-public interface SimpleQueryBuilder<S> {
-    /**
-     * Select all of the columns in the entity object.  This is default so
-     * it's not necessary to make this method call at all.
-     */
-    SimpleQueryBuilder<S> selectAll();
-    
-    /**
-     * Select the following columns
-     * @param columns array of columsn to select.
-     */
-    SimpleQueryBuilder<S> selectFields(Object... columns);
-    
-    /**
-     * @return the entity object we're building this query for.  By using this
-     * entity object, you can specify which column to select or form
-     */
-    S entity();
-    
-    /**
-     * Starts the query conditionals.
-     * @return
-     */
-    FirstWhere<S, ?> where();
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/utils/src/com/cloud/utils/db/Where.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/db/Where.java b/utils/src/com/cloud/utils/db/Where.java
deleted file mode 100644
index 6815f24..0000000
--- a/utils/src/com/cloud/utils/db/Where.java
+++ /dev/null
@@ -1,81 +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
-// 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.db;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Where implements any list of search conditions.
- *
- */
-public class Where<T, K> implements FirstWhere<T, K>, NextWhere<T, K> {
-    QueryBuilder<T, K> _builder;
-    List<Object> _conditions = new ArrayList<Object>();
-    
-    protected Where(QueryBuilder<T, K> builder) {
-        _builder = builder;
-    }
-    
-    @Override
-    public Condition<T, K> field(Object useless, String as) {
-        Attribute attr = _builder.getSpecifiedAttribute();
-        Condition<T, K> cond = new Condition<T, K>(this, attr, as);
-        _conditions.add(cond);
-        return cond;
-    }
-    
-    @Override
-    public Where<T, K> and() {
-        _conditions.add(" (");
-        return this;
-    }
-    
-    @Override
-    public Where<T, K> or() {
-        _conditions.add(" OR ");
-        return this;
-    }
-
-    @Override
-    public NextWhere<T, K> not() {
-        _conditions.add(" NOT ");
-        return this;
-    }
-
-    @Override
-    public NextWhere<T, K> text(String text, String... paramNames) {
-        assert ((paramNames.length == 0 && !text.contains("?")) || (text.matches("\\?.*{" + paramNames.length + "}")));
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public Condition<T, K> field(Object useless) {
-        return field(useless, null);
-    }
-
-    @Override
-    public FirstWhere<T, K> op() {
-        _conditions.add("(");
-        return this;
-    }
-
-    @Override
-    public void done() {
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/utils/src/org/apache/cloudstack/config/ConfigDepot.java
----------------------------------------------------------------------
diff --git a/utils/src/org/apache/cloudstack/config/ConfigDepot.java b/utils/src/org/apache/cloudstack/config/ConfigDepot.java
new file mode 100644
index 0000000..f2f0bad
--- /dev/null
+++ b/utils/src/org/apache/cloudstack/config/ConfigDepot.java
@@ -0,0 +1,25 @@
+// 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;
+
+/**
+ * ConfigDepot is a repository of configurations.
+ *
+ */
+public interface ConfigDepot {
+    <T> ConfigValue<T> get(ConfigKey<T> key);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a074f31/utils/src/org/apache/cloudstack/config/ConfigKey.java
----------------------------------------------------------------------
diff --git a/utils/src/org/apache/cloudstack/config/ConfigKey.java b/utils/src/org/apache/cloudstack/config/ConfigKey.java
new file mode 100644
index 0000000..9e42831
--- /dev/null
+++ b/utils/src/org/apache/cloudstack/config/ConfigKey.java
@@ -0,0 +1,98 @@
+// 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;
+
+/**
+ * ConfigKey supplants the original Config.java.  It is just a class
+ * declaration where others can declare their config variables.
+ * 
+ * TODO: This class should be moved to a framework project where the gathering
+ *       of these configuration keys should be done by a config server.  I
+ *       don't have time yet to do this.  Ask me about it if you want to work
+ *       in this area.  Right now, we'll just work with the actual names.
+ */
+public class ConfigKey<T> {
+    
+    private final String _category;
+
+    public String category() {
+        return _category;
+    }
+
+    public Class<?> component() {
+        return _componentClass;
+    }
+
+    public Class<T> type() {
+        return _type;
+    }
+
+    public String key() {
+        return _name;
+    }
+
+    public String defaultValue() {
+        return _defaultValue;
+    }
+
+    public String description() {
+        return _description;
+    }
+
+    public String range() {
+        return _range;
+    }
+
+    public String scope() {
+        return _scope;
+    }
+
+    public boolean isDynamic() {
+        return _isDynamic;
+    }
+
+    @Override
+    public String toString() {
+        return _name;
+    }
+
+    private final Class<?> _componentClass;
+    private final Class<T> _type;
+    private final String _name;
+    private final String _defaultValue;
+    private final String _description;
+    private final String _range;
+    private final String _scope; // Parameter can be at different levels (Zone/cluster/pool/account), by default every parameter is at global
+    private final boolean _isDynamic;
+
+    public ConfigKey(Class<T> type, String name, String category, Class<?> componentClass, String defaultValue, String description, boolean isDynamic, String range,
+            String scope) {
+        _category = category;
+        _componentClass = componentClass;
+        _type = type;
+        _name = name;
+        _defaultValue = defaultValue;
+        _description = description;
+        _range = range;
+        _scope = scope;
+        _isDynamic = isDynamic;
+    }
+
+    public ConfigKey(Class<T> type, String name, String category, Class<?> componentClass, String defaultValue, String description, boolean isDynamic, String range) {
+        this(type, name, category, componentClass, defaultValue, description, isDynamic, range, null);
+    }
+}