cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject [02/31] git commit: updated refs/heads/ui-restyle to ef74127
Date Mon, 30 Sep 2013 21:52:01 GMT
Unified both the SearchBuilder and SearchCriteriaService


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

Branch: refs/heads/ui-restyle
Commit: af8832f6bdab38101ffb14149e6da8a0f9c969ca
Parents: 58f287c
Author: Alex Huang <alex.huang@citrix.com>
Authored: Fri Sep 27 14:09:53 2013 -0700
Committer: Alex Huang <alex.huang@citrix.com>
Committed: Sat Sep 28 07:53:24 2013 -0700

----------------------------------------------------------------------
 .../cloud/agent/manager/AgentManagerImpl.java   |   6 +-
 .../manager/ClusteredAgentManagerImpl.java      |   6 +-
 .../ClusterBasedAgentLoadBalancerPlanner.java   |   4 +-
 .../dc/dao/StorageNetworkIpRangeDaoImpl.java    |   8 +-
 .../com/cloud/user/AccountDetailsDaoImpl.java   |   6 +-
 .../datastore/db/PrimaryDataStoreDaoImpl.java   |   6 +-
 .../cache/manager/StorageCacheManagerImpl.java  |   4 +-
 .../StorageCacheReplacementAlgorithmLRU.java    |   8 +-
 .../storage/snapshot/SnapshotObject.java        |   4 +-
 .../endpoint/DefaultEndPointSelector.java       |   6 +-
 .../db/TemplatePrimaryDataStoreDaoImpl.java     |   6 +-
 .../db/src/com/cloud/utils/db/GenericDao.java   |   4 -
 .../src/com/cloud/utils/db/GenericDaoBase.java  |  41 ++---
 .../cloud/utils/db/GenericSearchBuilder.java    | 173 +-----------------
 .../src/com/cloud/utils/db/SearchBuilder.java   |   5 +-
 .../src/com/cloud/utils/db/SearchCriteria.java  |   4 +-
 .../src/com/cloud/utils/db/SearchCriteria2.java | 177 ++++++-------------
 .../cloud/utils/db/SearchCriteriaService.java   |  29 ---
 .../BareMetalPingServiceImpl.java               |   4 +-
 .../networkservice/BaremetalDhcpElement.java    |   4 +-
 .../BaremetalDhcpManagerImpl.java               |   4 +-
 .../BaremetalKickStartServiceImpl.java          |   4 +-
 .../networkservice/BaremetalPxeElement.java     |   4 +-
 .../networkservice/BaremetalPxeManagerImpl.java |   4 +-
 .../com/cloud/ucs/manager/UcsManagerImpl.java   |  14 +-
 .../xen/discoverer/XcpServerDiscoverer.java     |   4 +-
 .../element/InternalLoadBalancerElement.java    |   4 +-
 .../consoleproxy/ConsoleProxyManagerImpl.java   |   4 +-
 .../com/cloud/ha/AbstractInvestigatorImpl.java  |   4 +-
 .../network/StorageNetworkManagerImpl.java      |   4 +-
 .../network/element/VirtualRouterElement.java   |   4 +-
 .../com/cloud/resource/ResourceManagerImpl.java |  26 +--
 .../src/com/cloud/storage/OCFS2ManagerImpl.java |   4 +-
 .../secondary/SecondaryStorageManagerImpl.java  |   6 +-
 34 files changed, 157 insertions(+), 438 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/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 6c88f6e..0b04d74 100755
--- a/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
@@ -99,7 +99,7 @@ import com.cloud.utils.db.DB;
 import com.cloud.utils.db.EntityManager;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.exception.HypervisorVersionChangedException;
@@ -1448,7 +1448,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
             try {
                 List<Long> behindAgents = findAgentsBehindOnPing();
                 for (Long agentId : behindAgents) {
-                    SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
+                    SearchCriteria2<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
                     sc.addAnd(sc.getEntity().getId(), Op.EQ, agentId);
                     HostVO h = sc.find();
                     if (h != null) {
@@ -1470,7 +1470,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
                     }
                 }
 
-                SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
+                SearchCriteria2<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
                 sc.addAnd(sc.getEntity().getResourceState(), Op.IN, ResourceState.PrepareForMaintenance, ResourceState.ErrorInMaintenance);
                 List<HostVO> hosts = sc.list();
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/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 61066ec..3d64473 100755
--- a/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
@@ -89,7 +89,7 @@ import com.cloud.utils.Profiler;
 import com.cloud.utils.concurrency.NamedThreadFactory;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.nio.Link;
@@ -783,7 +783,7 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust
     public void startRebalanceAgents() {
         s_logger.debug("Management server " + _nodeId + " is asking other peers to rebalance their agents");
         List<ManagementServerHostVO> allMS = _mshostDao.listBy(ManagementServerHost.State.Up);
-        SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
+        SearchCriteria2<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
         sc.addAnd(sc.getEntity().getManagementServerId(), Op.NNULL);
         sc.addAnd(sc.getEntity().getType(), Op.EQ, Host.Type.Routing);
         List<HostVO> allManagedAgents = sc.list();
@@ -1369,7 +1369,7 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust
         profilerAgentLB.start();
         //initiate agent lb task will be scheduled and executed only once, and only when number of agents loaded exceeds _connectedAgentsThreshold
         if (EnableLB.value() && !_agentLbHappened) {
-            SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
+            SearchCriteria2<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
             sc.addAnd(sc.getEntity().getManagementServerId(), Op.NNULL);
             sc.addAnd(sc.getEntity().getType(), Op.EQ, Host.Type.Routing);
             List<HostVO> allManagedRoutingAgents = sc.list();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/engine/orchestration/src/com/cloud/cluster/agentlb/ClusterBasedAgentLoadBalancerPlanner.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/cluster/agentlb/ClusterBasedAgentLoadBalancerPlanner.java b/engine/orchestration/src/com/cloud/cluster/agentlb/ClusterBasedAgentLoadBalancerPlanner.java
index 535ba07..47e2b97 100755
--- a/engine/orchestration/src/com/cloud/cluster/agentlb/ClusterBasedAgentLoadBalancerPlanner.java
+++ b/engine/orchestration/src/com/cloud/cluster/agentlb/ClusterBasedAgentLoadBalancerPlanner.java
@@ -38,7 +38,7 @@ import com.cloud.host.dao.HostDao;
 import com.cloud.utils.component.AdapterBase;
 import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.db.SearchCriteria.Op;
-import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria2;
 
 @Component
 @Local(value=AgentLoadBalancerPlanner.class)
@@ -49,7 +49,7 @@ public class ClusterBasedAgentLoadBalancerPlanner extends AdapterBase implements
     
     @Override
     public List<HostVO> getHostsToRebalance(long msId, int avLoad) {
-    	SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
+    	SearchCriteria2<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
     	sc.addAnd(sc.getEntity().getType(), Op.EQ, Host.Type.Routing);
     	sc.addAnd(sc.getEntity().getManagementServerId(), Op.EQ, msId);
         List<HostVO> allHosts = sc.list();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/engine/schema/src/com/cloud/dc/dao/StorageNetworkIpRangeDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/StorageNetworkIpRangeDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/StorageNetworkIpRangeDaoImpl.java
index d732e6f..db85c06 100755
--- a/engine/schema/src/com/cloud/dc/dao/StorageNetworkIpRangeDaoImpl.java
+++ b/engine/schema/src/com/cloud/dc/dao/StorageNetworkIpRangeDaoImpl.java
@@ -32,7 +32,7 @@ import com.cloud.utils.db.GenericSearchBuilder;
 import com.cloud.utils.db.SearchBuilder;
 import com.cloud.utils.db.SearchCriteria;
 import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.db.SearchCriteria.Func;
 import com.cloud.utils.db.SearchCriteria.Op;
 
@@ -50,21 +50,21 @@ public class StorageNetworkIpRangeDaoImpl extends GenericDaoBase<StorageNetworkI
 	
 	@Override
     public List<StorageNetworkIpRangeVO> listByPodId(long podId) {
-		SearchCriteriaService<StorageNetworkIpRangeVO, StorageNetworkIpRangeVO> sc = SearchCriteria2.create(StorageNetworkIpRangeVO.class);
+		SearchCriteria2<StorageNetworkIpRangeVO, StorageNetworkIpRangeVO> sc = SearchCriteria2.create(StorageNetworkIpRangeVO.class);
 	    sc.addAnd(sc.getEntity().getPodId(), Op.EQ, podId);
 		return sc.list();
     }
 
 	@Override
     public List<StorageNetworkIpRangeVO> listByRangeId(long rangeId) {
-		SearchCriteriaService<StorageNetworkIpRangeVO, StorageNetworkIpRangeVO> sc = SearchCriteria2.create(StorageNetworkIpRangeVO.class);
+		SearchCriteria2<StorageNetworkIpRangeVO, StorageNetworkIpRangeVO> sc = SearchCriteria2.create(StorageNetworkIpRangeVO.class);
 	    sc.addAnd(sc.getEntity().getId(), Op.EQ, rangeId);
 		return sc.list();
     }
 
 	@Override
     public List<StorageNetworkIpRangeVO> listByDataCenterId(long dcId) {
-		SearchCriteriaService<StorageNetworkIpRangeVO, StorageNetworkIpRangeVO> sc = SearchCriteria2.create(StorageNetworkIpRangeVO.class);
+		SearchCriteria2<StorageNetworkIpRangeVO, StorageNetworkIpRangeVO> sc = SearchCriteria2.create(StorageNetworkIpRangeVO.class);
 	    sc.addAnd(sc.getEntity().getDataCenterId(), Op.EQ, dcId);
 		return sc.list();
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/engine/schema/src/com/cloud/user/AccountDetailsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/user/AccountDetailsDaoImpl.java b/engine/schema/src/com/cloud/user/AccountDetailsDaoImpl.java
index 36fd5b4..6a0b248 100755
--- a/engine/schema/src/com/cloud/user/AccountDetailsDaoImpl.java
+++ b/engine/schema/src/com/cloud/user/AccountDetailsDaoImpl.java
@@ -31,7 +31,7 @@ import com.cloud.utils.db.SearchBuilder;
 import com.cloud.utils.db.SearchCriteria;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.db.Transaction;
 
 @Local(value = {AccountDetailsDao.class})
@@ -46,7 +46,7 @@ public class AccountDetailsDaoImpl extends GenericDaoBase<AccountDetailVO, Long>
 
     @Override
     public Map<String, String> findDetails(long accountId) {
-        SearchCriteriaService<AccountDetailVO, AccountDetailVO> sc = SearchCriteria2.create(AccountDetailVO.class);
+        SearchCriteria2<AccountDetailVO, AccountDetailVO> sc = SearchCriteria2.create(AccountDetailVO.class);
         sc.addAnd(sc.getEntity().getAccountId(), Op.EQ, accountId);
         List<AccountDetailVO> results = sc.list();
         Map<String, String> details = new HashMap<String, String>(results.size());
@@ -72,7 +72,7 @@ public class AccountDetailsDaoImpl extends GenericDaoBase<AccountDetailVO, Long>
 
     @Override
     public AccountDetailVO findDetail(long accountId, String name) {
-        SearchCriteriaService<AccountDetailVO, AccountDetailVO> sc = SearchCriteria2.create(AccountDetailVO.class);
+        SearchCriteria2<AccountDetailVO, AccountDetailVO> sc = SearchCriteria2.create(AccountDetailVO.class);
         sc.addAnd(sc.getEntity().getAccountId(), Op.EQ, accountId);
         sc.addAnd(sc.getEntity().getName(), Op.EQ, name);
         return sc.find();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/engine/schema/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java b/engine/schema/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
index b39f844..074a156 100644
--- a/engine/schema/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
+++ b/engine/schema/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
@@ -40,7 +40,7 @@ import com.cloud.utils.db.SearchCriteria;
 import com.cloud.utils.db.SearchCriteria.Func;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.exception.CloudRuntimeException;
 
@@ -316,7 +316,7 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase<StoragePoolVO, Long>
     public List<StoragePoolVO> findZoneWideStoragePoolsByTags(long dcId, String[] tags) {
         List<StoragePoolVO> storagePools = null;
         if (tags == null || tags.length == 0) {
-            SearchCriteriaService<StoragePoolVO, StoragePoolVO> sc = SearchCriteria2.create(StoragePoolVO.class);
+            SearchCriteria2<StoragePoolVO, StoragePoolVO> sc = SearchCriteria2.create(StoragePoolVO.class);
             sc.addAnd(sc.getEntity().getDataCenterId(), Op.EQ, dcId);
             sc.addAnd(sc.getEntity().getStatus(), Op.EQ, Status.Up);
             sc.addAnd(sc.getEntity().getScope(), Op.EQ, ScopeType.ZONE);
@@ -421,7 +421,7 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase<StoragePoolVO, Long>
 
     @Override
     public List<StoragePoolVO> findZoneWideStoragePoolsByHypervisor(long dataCenterId, HypervisorType hypervisorType) {
-        SearchCriteriaService<StoragePoolVO, StoragePoolVO> sc =  SearchCriteria2.create(StoragePoolVO.class);
+        SearchCriteria2<StoragePoolVO, StoragePoolVO> sc =  SearchCriteria2.create(StoragePoolVO.class);
         sc.addAnd(sc.getEntity().getDataCenterId(), Op.EQ, dataCenterId);
         sc.addAnd(sc.getEntity().getStatus(), Op.EQ, Status.Up);
         sc.addAnd(sc.getEntity().getScope(), Op.EQ, ScopeType.ZONE);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/engine/storage/cache/src/org/apache/cloudstack/storage/cache/manager/StorageCacheManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/cache/src/org/apache/cloudstack/storage/cache/manager/StorageCacheManagerImpl.java b/engine/storage/cache/src/org/apache/cloudstack/storage/cache/manager/StorageCacheManagerImpl.java
index 083b7c1..f14985d 100644
--- a/engine/storage/cache/src/org/apache/cloudstack/storage/cache/manager/StorageCacheManagerImpl.java
+++ b/engine/storage/cache/src/org/apache/cloudstack/storage/cache/manager/StorageCacheManagerImpl.java
@@ -26,7 +26,7 @@ import com.cloud.utils.concurrency.NamedThreadFactory;
 import com.cloud.utils.db.GlobalLock;
 import com.cloud.utils.db.SearchCriteria;
 import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.exception.CloudRuntimeException;
 
 import org.apache.cloudstack.engine.subsystem.api.storage.*;
@@ -79,7 +79,7 @@ public class StorageCacheManagerImpl implements StorageCacheManager, Manager {
     }
 
     protected List<DataStore> getCacheStores() {
-        SearchCriteriaService<ImageStoreVO, ImageStoreVO> sc = SearchCriteria2.create(ImageStoreVO.class);
+        SearchCriteria2<ImageStoreVO, ImageStoreVO> sc = SearchCriteria2.create(ImageStoreVO.class);
         sc.addAnd(sc.getEntity().getRole(), SearchCriteria.Op.EQ, DataStoreRole.ImageCache);
         List<ImageStoreVO> imageStoreVOs = sc.list();
         List<DataStore> stores = new ArrayList<DataStore>();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/engine/storage/cache/src/org/apache/cloudstack/storage/cache/manager/StorageCacheReplacementAlgorithmLRU.java
----------------------------------------------------------------------
diff --git a/engine/storage/cache/src/org/apache/cloudstack/storage/cache/manager/StorageCacheReplacementAlgorithmLRU.java b/engine/storage/cache/src/org/apache/cloudstack/storage/cache/manager/StorageCacheReplacementAlgorithmLRU.java
index 424a8fb..9cd5995 100644
--- a/engine/storage/cache/src/org/apache/cloudstack/storage/cache/manager/StorageCacheReplacementAlgorithmLRU.java
+++ b/engine/storage/cache/src/org/apache/cloudstack/storage/cache/manager/StorageCacheReplacementAlgorithmLRU.java
@@ -22,7 +22,7 @@ import com.cloud.utils.DateUtil;
 import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.db.SearchCriteria;
 import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria2;
 
 import org.apache.cloudstack.engine.subsystem.api.storage.*;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
@@ -72,7 +72,7 @@ public class StorageCacheReplacementAlgorithmLRU implements StorageCacheReplacem
         cal.add(Calendar.DAY_OF_MONTH, -unusedTimeInterval.intValue());
         Date bef = cal.getTime();
 
-        SearchCriteriaService<TemplateDataStoreVO, TemplateDataStoreVO> sc = SearchCriteria2.create(TemplateDataStoreVO.class);
+        SearchCriteria2<TemplateDataStoreVO, TemplateDataStoreVO> sc = SearchCriteria2.create(TemplateDataStoreVO.class);
         sc.addAnd(sc.getEntity().getLastUpdated(), SearchCriteria.Op.LT, bef);
         sc.addAnd(sc.getEntity().getState(), SearchCriteria.Op.EQ, ObjectInDataStoreStateMachine.State.Ready);
         sc.addAnd(sc.getEntity().getDataStoreId(), SearchCriteria.Op.EQ, store.getId());
@@ -83,7 +83,7 @@ public class StorageCacheReplacementAlgorithmLRU implements StorageCacheReplacem
             return templateFactory.getTemplate(template.getTemplateId(), store);
         }
 
-        SearchCriteriaService<VolumeDataStoreVO, VolumeDataStoreVO> volSc = SearchCriteria2.create(VolumeDataStoreVO.class);
+        SearchCriteria2<VolumeDataStoreVO, VolumeDataStoreVO> volSc = SearchCriteria2.create(VolumeDataStoreVO.class);
         volSc.addAnd(volSc.getEntity().getLastUpdated(), SearchCriteria.Op.LT, bef);
         volSc.addAnd(volSc.getEntity().getState(), SearchCriteria.Op.EQ, ObjectInDataStoreStateMachine.State.Ready);
         volSc.addAnd(volSc.getEntity().getDataStoreId(), SearchCriteria.Op.EQ, store.getId());
@@ -93,7 +93,7 @@ public class StorageCacheReplacementAlgorithmLRU implements StorageCacheReplacem
             return volumeFactory.getVolume(volume.getVolumeId(), store);
         }
 
-        SearchCriteriaService<SnapshotDataStoreVO, SnapshotDataStoreVO> snapshotSc = SearchCriteria2.create(SnapshotDataStoreVO.class);
+        SearchCriteria2<SnapshotDataStoreVO, SnapshotDataStoreVO> snapshotSc = SearchCriteria2.create(SnapshotDataStoreVO.class);
         snapshotSc.addAnd(snapshotSc.getEntity().getLastUpdated(), SearchCriteria.Op.LT, bef);
         snapshotSc.addAnd(snapshotSc.getEntity().getState(), SearchCriteria.Op.EQ, ObjectInDataStoreStateMachine.State.Ready);
         snapshotSc.addAnd(snapshotSc.getEntity().getDataStoreId(), SearchCriteria.Op.EQ, store.getId());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java
----------------------------------------------------------------------
diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java
index 7d823a3..730cec4 100644
--- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java
+++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java
@@ -44,7 +44,7 @@ import com.cloud.storage.dao.VolumeDao;
 import com.cloud.utils.component.ComponentContext;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.fsm.NoTransitionException;
 
@@ -104,7 +104,7 @@ public class SnapshotObject implements SnapshotInfo {
 
     @Override
     public SnapshotInfo getChild() {
-        SearchCriteriaService<SnapshotDataStoreVO, SnapshotDataStoreVO> sc = SearchCriteria2
+        SearchCriteria2<SnapshotDataStoreVO, SnapshotDataStoreVO> sc = SearchCriteria2
                 .create(SnapshotDataStoreVO.class);
         sc.addAnd(sc.getEntity().getDataStoreId(), Op.EQ, this.store.getId());
         sc.addAnd(sc.getEntity().getRole(), Op.EQ, this.store.getRole());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/engine/storage/src/org/apache/cloudstack/storage/endpoint/DefaultEndPointSelector.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/endpoint/DefaultEndPointSelector.java b/engine/storage/src/org/apache/cloudstack/storage/endpoint/DefaultEndPointSelector.java
index 98c6a3f..65524e0 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/endpoint/DefaultEndPointSelector.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/endpoint/DefaultEndPointSelector.java
@@ -45,7 +45,7 @@ import com.cloud.storage.DataStoreRole;
 import com.cloud.storage.ScopeType;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.exception.CloudRuntimeException;
@@ -220,7 +220,7 @@ public class DefaultEndPointSelector implements EndPointSelector {
     }
 
     private List<HostVO> listUpAndConnectingSecondaryStorageVmHost(Long dcId) {
-        SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
+        SearchCriteria2<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
         if (dcId != null) {
             sc.addAnd(sc.getEntity().getDataCenterId(), Op.EQ, dcId);
         }
@@ -258,7 +258,7 @@ public class DefaultEndPointSelector implements EndPointSelector {
             endPoints.add(RemoteHostEndPoint.getHypervisorHostEndPoint(host.getId(), host.getPrivateIpAddress(),
                     host.getPublicIpAddress()));
         } else if (store.getScope().getScopeType() == ScopeType.CLUSTER) {
-            SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
+            SearchCriteria2<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
             sc.addAnd(sc.getEntity().getClusterId(), Op.EQ, store.getScope().getScopeId());
             sc.addAnd(sc.getEntity().getStatus(), Op.EQ, Status.Up);
             List<HostVO> hosts = sc.find();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/engine/storage/src/org/apache/cloudstack/storage/volume/db/TemplatePrimaryDataStoreDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/db/TemplatePrimaryDataStoreDaoImpl.java b/engine/storage/src/org/apache/cloudstack/storage/volume/db/TemplatePrimaryDataStoreDaoImpl.java
index 7c98640..8c43138 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/db/TemplatePrimaryDataStoreDaoImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/volume/db/TemplatePrimaryDataStoreDaoImpl.java
@@ -31,7 +31,7 @@ import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.SearchBuilder;
 import com.cloud.utils.db.SearchCriteria;
 import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.db.UpdateBuilder;
 
 @Component
@@ -50,7 +50,7 @@ public class TemplatePrimaryDataStoreDaoImpl extends GenericDaoBase<TemplatePrim
 
     @Override
     public TemplatePrimaryDataStoreVO findByTemplateIdAndPoolId(long templateId, long poolId) {
-        SearchCriteriaService<TemplatePrimaryDataStoreVO, TemplatePrimaryDataStoreVO> sc = SearchCriteria2
+        SearchCriteria2<TemplatePrimaryDataStoreVO, TemplatePrimaryDataStoreVO> sc = SearchCriteria2
                 .create(TemplatePrimaryDataStoreVO.class);
         sc.addAnd(sc.getEntity().getTemplateId(), Op.EQ, templateId);
         sc.addAnd(sc.getEntity().getPoolId(), Op.EQ, poolId);
@@ -59,7 +59,7 @@ public class TemplatePrimaryDataStoreDaoImpl extends GenericDaoBase<TemplatePrim
 
     @Override
     public TemplatePrimaryDataStoreVO findByTemplateIdAndPoolIdAndReady(long templateId, long poolId) {
-        SearchCriteriaService<TemplatePrimaryDataStoreVO, TemplatePrimaryDataStoreVO> sc = SearchCriteria2
+        SearchCriteria2<TemplatePrimaryDataStoreVO, TemplatePrimaryDataStoreVO> sc = SearchCriteria2
                 .create(TemplatePrimaryDataStoreVO.class);
         sc.addAnd(sc.getEntity().getTemplateId(), Op.EQ, templateId);
         sc.addAnd(sc.getEntity().getPoolId(), Op.EQ, poolId);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/framework/db/src/com/cloud/utils/db/GenericDao.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/GenericDao.java b/framework/db/src/com/cloud/utils/db/GenericDao.java
index f32880f..6c7e928 100755
--- a/framework/db/src/com/cloud/utils/db/GenericDao.java
+++ b/framework/db/src/com/cloud/utils/db/GenericDao.java
@@ -258,10 +258,6 @@ public interface GenericDao<T, ID extends Serializable> {
 
     public <K> K getRandomlyIncreasingNextInSequence(Class<K> clazz, String name);
 
-    <K> SearchCriteria2 createSearchCriteria2(Class<K> resultType);
-
-    SearchCriteria2 createSearchCriteria2();
-
     public T findOneBy(final SearchCriteria<T> sc);
 
     /**

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/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 a566ec5..fd56171 100755
--- a/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
+++ b/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
@@ -59,6 +59,7 @@ import net.sf.cglib.proxy.Callback;
 import net.sf.cglib.proxy.CallbackFilter;
 import net.sf.cglib.proxy.Enhancer;
 import net.sf.cglib.proxy.Factory;
+import net.sf.cglib.proxy.MethodInterceptor;
 import net.sf.cglib.proxy.NoOp;
 import net.sf.ehcache.Cache;
 import net.sf.ehcache.CacheManager;
@@ -169,11 +170,7 @@ public abstract class GenericDaoBase<T, ID extends Serializable> extends Compone
     @Override
     @SuppressWarnings("unchecked") @DB(txn=false)
     public <J> GenericSearchBuilder<T, J> createSearchBuilder(Class<J> resultType) {
-        final T entity = (T)_searchEnhancer.create();
-        final Factory factory = (Factory)entity;
-        GenericSearchBuilder<T, J> builder = new GenericSearchBuilder<T, J>(entity, resultType, _allAttributes);
-        factory.setCallback(0, builder);
-        return builder;
+        return new GenericSearchBuilder<T, J>(_entityBeanType, resultType);
     }
 
     @Override
@@ -181,6 +178,15 @@ public abstract class GenericDaoBase<T, ID extends Serializable> extends Compone
         return _allAttributes;
     }
     
+
+    @SuppressWarnings("unchecked")
+    public T createSearchEntity(MethodInterceptor interceptor) {
+        T entity = (T)_searchEnhancer.create();
+        final Factory factory = (Factory)entity;
+        factory.setCallback(0, interceptor);
+        return entity;
+    }
+
     @SuppressWarnings("unchecked")
     protected GenericDaoBase() {
         super();
@@ -1781,14 +1787,9 @@ public abstract class GenericDaoBase<T, ID extends Serializable> extends Compone
         return (UpdateBuilder)factory.getCallback(1);
     }
 
-    @SuppressWarnings("unchecked")
     @Override @DB(txn=false)
     public SearchBuilder<T> createSearchBuilder() {
-        final T entity = (T)_searchEnhancer.create();
-        final Factory factory = (Factory)entity;
-        SearchBuilder<T> builder = new SearchBuilder<T>(entity, _allAttributes);
-        factory.setCallback(0, builder);
-        return builder;
+        return new SearchBuilder<T>(_entityBeanType);
     }
 
     @Override @DB(txn=false)
@@ -1797,24 +1798,6 @@ public abstract class GenericDaoBase<T, ID extends Serializable> extends Compone
         return builder.create();
     }
 
-    @Override @DB(txn=false)
-    public <K> SearchCriteria2 createSearchCriteria2(Class<K> resultType) {
-        final T entity = (T)_searchEnhancer.create();
-        final Factory factory = (Factory)entity;
-        SearchCriteria2 sc = new SearchCriteria2(entity, resultType, _allAttributes, this);
-        factory.setCallback(0, sc);
-        return sc;
-    }
-
-    @Override @DB(txn=false)
-    public SearchCriteria2 createSearchCriteria2() {
-        final T entity = (T)_searchEnhancer.create();
-        final Factory factory = (Factory)entity;
-        SearchCriteria2 sc = new SearchCriteria2(entity, entity.getClass(), _allAttributes, this);
-        factory.setCallback(0, sc);
-        return sc;
-    }
-
     @Override
     public int getRegionId(){
     	return Transaction.s_region_id;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/framework/db/src/com/cloud/utils/db/GenericSearchBuilder.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/GenericSearchBuilder.java b/framework/db/src/com/cloud/utils/db/GenericSearchBuilder.java
index bf28144..732527a 100755
--- a/framework/db/src/com/cloud/utils/db/GenericSearchBuilder.java
+++ b/framework/db/src/com/cloud/utils/db/GenericSearchBuilder.java
@@ -17,19 +17,12 @@
 package com.cloud.utils.db;
 
 import java.lang.reflect.Field;
-import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 import java.util.UUID;
 
-import javax.persistence.Column;
-import javax.persistence.Transient;
-
 import net.sf.cglib.proxy.Factory;
-import net.sf.cglib.proxy.MethodInterceptor;
-import net.sf.cglib.proxy.MethodProxy;
 
 import com.cloud.utils.db.SearchCriteria.Func;
 import com.cloud.utils.db.SearchCriteria.Op;
@@ -43,30 +36,10 @@ import com.cloud.utils.db.SearchCriteria.SelectType;
  * @param <T> VO object this Search is build for.
  * @param <K> Result object that should contain the results.
  */
-public class GenericSearchBuilder<T, K> implements MethodInterceptor {
-    final protected Map<String, Attribute> _attrs;
-    
-    protected ArrayList<Condition> _conditions;
-    protected HashMap<String, JoinBuilder<GenericSearchBuilder<?, ?>>> _joins;
-    protected ArrayList<Select> _selects;
-    protected GroupBy<T, K> _groupBy = null;
-    protected Class<T> _entityBeanType;
-    protected Class<K> _resultType;
-    protected SelectType _selectType;
-    
-    protected T _entity;
-    protected ArrayList<Attribute> _specifiedAttrs;
-    
+public class GenericSearchBuilder<T, K> extends SearchBase<T, K> {
     @SuppressWarnings("unchecked")
-    protected GenericSearchBuilder(T entity, Class<K> clazz, Map<String, Attribute> attrs) {
-        _entityBeanType = (Class<T>)entity.getClass();
-        _resultType = clazz;
-        
-        _attrs = attrs;
-        _entity = entity;
-        _conditions = new ArrayList<Condition>();
-        _joins = null;
-        _specifiedAttrs = new ArrayList<Attribute>();
+    protected GenericSearchBuilder(Class<T> entityType, Class<K> resultType) {
+        super(entityType, resultType);
     }
     
     public T entity() {
@@ -108,11 +81,6 @@ public class GenericSearchBuilder<T, K> implements MethodInterceptor {
         return this;
     }
     
-//    public GenericSearchBuilder<T, K> selectField(String joinName, Object... entityFields) {
-//        JoinBuilder<GenericSearchBuilder<?, ?>> jb = _joins.get(joinName);
-//
-//    }
-    
     /**
      * Specifies the field to select.
      * 
@@ -163,34 +131,6 @@ public class GenericSearchBuilder<T, K> implements MethodInterceptor {
     }
     
     @Override
-    public Object intercept(Object object, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
-        String name = method.getName();
-		if (method.getAnnotation(Transient.class) == null) {
-			if (name.startsWith("get")) {
-				String fieldName = Character.toLowerCase(name.charAt(3)) + name.substring(4);
-				set(fieldName);
-				return null;
-			} else if (name.startsWith("is")) {
-				String fieldName = Character.toLowerCase(name.charAt(2)) + name.substring(3);
-				set(fieldName);
-				return null;
-			} else {
-			    Column ann = method.getAnnotation(Column.class);
-			    if (ann != null) {
-			        String colName = ann.name();
-			        for (Map.Entry<String, Attribute> attr : _attrs.entrySet()) {
-			            if (colName.equals(attr.getValue().columnName)) {
-			                set(attr.getKey());
-			                return null;
-			            }
-			        }
-			    }
-                throw new RuntimeException("Perhaps you need to make the method start with get or is: " + method);
-			}
-		}
-        return methodProxy.invokeSuper(object, args);
-    }
-    
     protected void set(String name) {
         Attribute attr = _attrs.get(name);
         assert (attr != null) : "Searching for a field that's not there: " + name;
@@ -421,113 +361,6 @@ public class GenericSearchBuilder<T, K> implements MethodInterceptor {
         _selectType = SelectType.Fields;
     }
     
-    protected static class Condition {
-        protected final String name;
-        protected final String cond;
-        protected final Op op;
-        protected final Attribute attr;
-        protected Object[] presets;
-        
-        protected Condition(String name) {
-            this(name, null, null, null);
-        }
-        
-        public Condition(String name, String cond, Attribute attr, Op op) {
-            this.name = name;
-            this.attr = attr;
-            this.cond = cond;
-            this.op = op;
-            this.presets = null;
-        }
-        
-        public boolean isPreset() {
-            return presets != null;
-        }
-
-        public void setPresets(Object... presets) {
-            this.presets = presets;
-        }
-
-        public Object[] getPresets() {
-            return presets;
-        }
-
-        public void toSql(StringBuilder sql, Object[] params, int count) {
-            if (count > 0) {
-                sql.append(cond);
-            }
-            
-            if (op == null) {
-                return;
-            }
-            
-            if (op == Op.SC) {
-                sql.append(" (").append(((SearchCriteria<?>)params[0]).getWhereClause()).append(") ");
-                return;
-            }
-            
-            if (attr == null) {
-                return;
-            }
-            
-            sql.append(attr.table).append(".").append(attr.columnName).append(op.toString());
-            if (op == Op.IN && params.length == 1) {
-                sql.delete(sql.length() - op.toString().length(), sql.length());
-                sql.append("=?");
-            } else if (op == Op.NIN && params.length == 1) {
-                sql.delete(sql.length() - op.toString().length(), sql.length());
-                sql.append("!=?");
-            } else if (op.getParams() == -1) {
-                for (int i = 0; i < params.length; i++) {
-                    sql.insert(sql.length() - 2, "?,");
-                }
-                sql.delete(sql.length() - 3, sql.length() - 2); // remove the last ,
-            } else if (op  == Op.EQ && (params == null || params.length == 0 || params[0] == null)) {
-                sql.delete(sql.length() - 4, sql.length());
-                sql.append(" IS NULL ");
-            } else if (op == Op.NEQ && (params == null || params.length == 0 || params[0] == null)) {
-                sql.delete(sql.length() - 5, sql.length());
-                sql.append(" IS NOT NULL ");
-            } else {
-                if ((op.getParams() != 0 || params != null) && (params.length != op.getParams())) {
-                    throw new RuntimeException("Problem with condition: " + name);
-                }
-            }
-        }
-        
-        @Override
-        public int hashCode() {
-            return name.hashCode();
-        }
-        
-        @Override
-        public boolean equals(Object obj) {
-            if (!(obj instanceof Condition)) {
-                return false;
-            }
-            
-            Condition condition = (Condition)obj;
-            return name.equals(condition.name);
-        }
-    }
-    
-    protected static class Select {
-        public Func func;
-        public Attribute attr;
-        public Object[] params;
-        public Field field;
-        
-        protected Select() {
-        }
-        
-        public Select(Func func, Attribute attr, Field field, Object[] params) {
-            this.func = func;
-            this.attr = attr;
-            this.params = params;
-            this.field = field;
-        }
-    }
-    
     public class Preset {
         GenericSearchBuilder<T, K> builder;
         Condition condition;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/framework/db/src/com/cloud/utils/db/SearchBuilder.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/SearchBuilder.java b/framework/db/src/com/cloud/utils/db/SearchBuilder.java
index c177e20..8410b01 100755
--- a/framework/db/src/com/cloud/utils/db/SearchBuilder.java
+++ b/framework/db/src/com/cloud/utils/db/SearchBuilder.java
@@ -16,7 +16,6 @@
 // under the License.
 package com.cloud.utils.db;
 
-import java.util.Map;
 
 /**
  * SearchBuilder is meant as a static query construct.  Often times in DAO code,
@@ -58,7 +57,7 @@ import java.util.Map;
 public class SearchBuilder<T> extends GenericSearchBuilder<T, T> {
     
     @SuppressWarnings("unchecked")
-    public SearchBuilder(T entity, Map<String, Attribute> attrs) {
-        super(entity, (Class<T>)entity.getClass(), attrs);
+    public SearchBuilder(Class<T> entityType) {
+        super(entityType, entityType);
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/framework/db/src/com/cloud/utils/db/SearchCriteria.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/SearchCriteria.java b/framework/db/src/com/cloud/utils/db/SearchCriteria.java
index 22bccd3..ba4a0fd 100755
--- a/framework/db/src/com/cloud/utils/db/SearchCriteria.java
+++ b/framework/db/src/com/cloud/utils/db/SearchCriteria.java
@@ -24,8 +24,8 @@ import java.util.List;
 import java.util.Map;
 
 import com.cloud.utils.Pair;
-import com.cloud.utils.db.GenericSearchBuilder.Condition;
-import com.cloud.utils.db.GenericSearchBuilder.Select;
+import com.cloud.utils.db.SearchBase.Condition;
+import com.cloud.utils.db.SearchBase.Select;
 
 /**
  * big joins or high performance searches, it is much better to

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/framework/db/src/com/cloud/utils/db/SearchCriteria2.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/SearchCriteria2.java b/framework/db/src/com/cloud/utils/db/SearchCriteria2.java
index 67e95b0..cccd220 100755
--- a/framework/db/src/com/cloud/utils/db/SearchCriteria2.java
+++ b/framework/db/src/com/cloud/utils/db/SearchCriteria2.java
@@ -18,70 +18,43 @@ package com.cloud.utils.db;
 
 import java.io.Serializable;
 import java.lang.reflect.Field;
-import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 import java.util.UUID;
 
-import javax.persistence.Transient;
-
 import net.sf.cglib.proxy.Factory;
-import net.sf.cglib.proxy.MethodInterceptor;
-import net.sf.cglib.proxy.MethodProxy;
 
-import com.cloud.utils.db.GenericSearchBuilder.Condition;
-import com.cloud.utils.db.GenericSearchBuilder.Select;
 import com.cloud.utils.db.SearchCriteria.Func;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.SearchCriteria.SelectType;
 
-public class SearchCriteria2<T, K> implements SearchCriteriaService<T, K>, MethodInterceptor{
-	GenericDao<? extends Serializable, ? extends Serializable> _dao;
-	final protected Map<String, Attribute> _attrs;
-	protected ArrayList<Attribute> _specifiedAttrs;
-	protected T _entity;
-	protected ArrayList<GenericSearchBuilder.Condition> _conditions;
-	protected ArrayList<Select> _selects;
-	private final HashMap<String, Object[]> _params = new HashMap<String, Object[]>();
-	protected Class<K> _resultType;
-    protected SelectType _selectType;
-    protected Class<T> _entityBeanType;
-	
-    protected SearchCriteria2(T entity, Class<K> resultType, final Map<String, Attribute> attrs, GenericDao<? extends Serializable, ? extends Serializable> dao) {
-		_entityBeanType = (Class<T>)entity.getClass();
-		_dao = dao;
-		_resultType = resultType;
-		_attrs = attrs;
-		_entity = entity;
-		_conditions = new ArrayList<Condition>();
-		_specifiedAttrs = new ArrayList<Attribute>();
+public class SearchCriteria2<T, K> extends SearchBase<T, K> {
+    final HashMap<String, Object[]> _params = new HashMap<String, Object[]>();
+
+    protected SearchCriteria2(Class<T> entityType, Class<K> resultType) {
+        super(entityType, resultType);
+    }
+
+    @SuppressWarnings("unchecked")
+    static public <T, K> SearchCriteria2<T, K> create(Class<T> entityType, Class<K> resultType) {
+        GenericDao<T, ? extends Serializable> dao = (GenericDao<T, ? extends Serializable>)GenericDaoBase.getDao(entityType);
+        assert dao != null : "Can not find DAO for " + entityType.getName();
+        return new SearchCriteria2<T, K>(entityType, resultType);
     }
-	
-	static public <T, K> SearchCriteria2<T, K> create(Class<T> entityType, Class<K> resultType) {
-		GenericDao<? extends Serializable, ? extends Serializable> dao = (GenericDao<? extends Serializable, ? extends Serializable>)GenericDaoBase.getDao(entityType);
-		assert dao != null : "Can not find DAO for " + entityType.getName();
-		SearchCriteria2<T, K> sc = dao.createSearchCriteria2(resultType);
-		return sc;
-	}
-	
-	static public <T, K> SearchCriteria2<T, K> create(Class<T> entityType) {
-		GenericDao<? extends Serializable, ? extends Serializable> dao = (GenericDao<? extends Serializable, ? extends Serializable>)GenericDaoBase.getDao(entityType);
-		assert dao != null : "Can not find DAO for " + entityType.getName();
-		SearchCriteria2<T, K> sc = dao.createSearchCriteria2();
-		return sc;
-	}
-	
-	@Override
-	public void selectField(Object... useless) {
+
+    static public <T> SearchCriteria2<T, T> create(Class<T> entityType) {
+        return create(entityType, entityType);
+    }
+
+    public void selectField(Object... useless) {
         assert _entity != null : "SearchBuilder cannot be modified once it has been setup";
         assert _specifiedAttrs.size() > 0 : "You didn't specify any attributes";
-   
+
         if (_selects == null) {
             _selects = new ArrayList<Select>();
         }
-        
+
         for (Attribute attr : _specifiedAttrs) {
             Field field = null;
             try {
@@ -92,75 +65,66 @@ public class SearchCriteria2<T, K> implements SearchCriteriaService<T, K>, Metho
             }
             _selects.add(new Select(Func.NATIVE, attr, field, null));
         }
-        
+
         _specifiedAttrs.clear();
     }
-	
+
     private void constructCondition(String conditionName, String cond, Attribute attr, Op op) {
         assert _entity != null : "SearchBuilder cannot be modified once it has been setup";
         assert op == null || _specifiedAttrs.size() == 1 : "You didn't select the attribute.";
         assert op != Op.SC : "Call join";
-        
+
         GenericSearchBuilder.Condition condition = new GenericSearchBuilder.Condition(conditionName, cond, attr, op);
         _conditions.add(condition);
         _specifiedAttrs.clear();
     }
-    
+
     private void setParameters(String conditionName, Object... params) {
         assert _conditions.contains(new Condition(conditionName)) : "Couldn't find " + conditionName;
         _params.put(conditionName, params);
     }
-    
-	@Override
-	public void addAnd(Object useless, Op op, Object...values) {
-		String uuid = UUID.randomUUID().toString();
-		constructCondition(uuid, " AND ", _specifiedAttrs.get(0), op);
-		setParameters(uuid, values);
-	}
-	
-	@Override
-	public List<K> list() {
-		done();
-		SearchCriteria sc1 = createSearchCriteria();
-		if (isSelectAll()) {
-			return (List<K>)_dao.search(sc1, null);
-		} else {
-			return _dao.customSearch(sc1, null);
-		}
-	}
-	
-	private boolean isSelectAll() {
+
+    public void addAnd(Object useless, Op op, Object... values) {
+        String uuid = UUID.randomUUID().toString();
+        constructCondition(uuid, " AND ", _specifiedAttrs.get(0), op);
+        setParameters(uuid, values);
+    }
+
+    public List<K> list() {
+        done();
+        SearchCriteria sc1 = createSearchCriteria();
+        if (isSelectAll()) {
+            return (List<K>)_dao.search(sc1, null);
+        } else {
+            return _dao.customSearch(sc1, null);
+        }
+    }
+
+    private boolean isSelectAll() {
         return _selects == null || _selects.size() == 0;
     }
-	
-	@Override
-	public T getEntity() {
-		return _entity;
-	}
-
-	private SearchCriteria<K> createSearchCriteria() {
-		return new SearchCriteria<K>(_attrs, _conditions, _selects, _selectType, _resultType, _params);
-	}
-	
-    private void set(String name) {
-        Attribute attr = _attrs.get(name);
-        assert (attr != null) : "Searching for a field that's not there: " + name;
-        _specifiedAttrs.add(attr);
+
+    public T getEntity() {
+        return _entity;
     }
-    
+
+    private SearchCriteria<K> createSearchCriteria() {
+        return new SearchCriteria<K>(_attrs, _conditions, _selects, _selectType, _resultType, _params);
+    }
+
     private void done() {
         if (_entity != null) {
             Factory factory = (Factory)_entity;
             factory.setCallback(0, null);
             _entity = null;
         }
-                
+
         if (_selects == null || _selects.size() == 0) {
             _selectType = SelectType.Entity;
             assert _entityBeanType.equals(_resultType) : "Expecting " + _entityBeanType + " because you didn't specify any selects but instead got " + _resultType;
             return;
         }
-        
+
         for (Select select : _selects) {
             if (select.field == null) {
                 assert (_selects.size() == 1) : "You didn't specify any fields to put the result in but you're specifying more than one select so where should I put the selects?";
@@ -172,42 +136,15 @@ public class SearchCriteria2<T, K> implements SearchCriteriaService<T, K>, Metho
                 return;
             }
         }
-        
+
         _selectType = SelectType.Fields;
     }
-    
-	@Override
-	public Object intercept(Object object, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
-		String name = method.getName();
-		if (method.getAnnotation(Transient.class) == null) {
-			if (name.startsWith("get")) {
-				String fieldName = Character.toLowerCase(name.charAt(3)) + name.substring(4);
-				set(fieldName);
-				return null;
-			} else if (name.startsWith("is")) {
-				String fieldName = Character.toLowerCase(name.charAt(2)) + name.substring(3);
-				set(fieldName);
-				return null;
-			} else {
-				name = name.toLowerCase();
-				for (String fieldName : _attrs.keySet()) {
-					if (name.endsWith(fieldName.toLowerCase())) {
-						set(fieldName);
-						return null;
-					}
-				}
-				assert false : "Perhaps you need to make the method start with get or is?";
-			}
-		}
-        return methodProxy.invokeSuper(object, args);
-    }
 
-	@Override
     public <K> K find() {
-		assert isSelectAll() : "find doesn't support select search";
-		done();
-		SearchCriteria sc1 = createSearchCriteria();
-		return (K)_dao.findOneBy(sc1);
+        assert isSelectAll() : "find doesn't support select search";
+        done();
+        SearchCriteria sc1 = createSearchCriteria();
+        return (K)_dao.findOneBy(sc1);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/framework/db/src/com/cloud/utils/db/SearchCriteriaService.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/SearchCriteriaService.java b/framework/db/src/com/cloud/utils/db/SearchCriteriaService.java
deleted file mode 100755
index 2947255..0000000
--- a/framework/db/src/com/cloud/utils/db/SearchCriteriaService.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;
-
-import java.util.List;
-
-import com.cloud.utils.db.SearchCriteria.Op;
-
-public interface SearchCriteriaService<T, K> {
-	public void selectField(Object... useless);
-	public void addAnd(Object useless, Op op, Object...values);
-	public List<K> list();
-	public T getEntity();
-	public <K> K find();
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalPingServiceImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalPingServiceImpl.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalPingServiceImpl.java
index 5cb5a14..4376d40 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalPingServiceImpl.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalPingServiceImpl.java
@@ -64,7 +64,7 @@ import com.cloud.uservm.UserVm;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.vm.NicProfile;
@@ -84,7 +84,7 @@ public class BareMetalPingServiceImpl extends BareMetalPxeServiceBase implements
 	
 	@Override
     public boolean prepare(VirtualMachineProfile profile, NicProfile pxeNic, DeployDestination dest, ReservationContext context) {
-	    SearchCriteriaService<BaremetalPxeVO, BaremetalPxeVO> sc = SearchCriteria2.create(BaremetalPxeVO.class);
+	    SearchCriteria2<BaremetalPxeVO, BaremetalPxeVO> sc = SearchCriteria2.create(BaremetalPxeVO.class);
         sc.addAnd(sc.getEntity().getDeviceType(), Op.EQ, BaremetalPxeType.PING.toString());
         sc.addAnd(sc.getEntity().getPodId(), Op.EQ, dest.getPod().getId());
         BaremetalPxeVO pxeVo = sc.find();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpElement.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpElement.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpElement.java
index 6ab5f6d..afc3062 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpElement.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpElement.java
@@ -41,7 +41,7 @@ import com.cloud.utils.component.AdapterBase;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.db.Transaction;
 import com.cloud.vm.*;
 import com.cloud.vm.VirtualMachine.Type;
@@ -84,7 +84,7 @@ public class BaremetalDhcpElement extends AdapterBase implements DhcpServiceProv
     private boolean canHandle(DeployDestination dest, TrafficType trafficType, GuestType networkType) {
         Pod pod = dest.getPod();
         if (pod != null && dest.getDataCenter().getNetworkType() == NetworkType.Basic && trafficType == TrafficType.Guest) {
-            SearchCriteriaService<BaremetalDhcpVO, BaremetalDhcpVO> sc = SearchCriteria2.create(BaremetalDhcpVO.class);
+            SearchCriteria2<BaremetalDhcpVO, BaremetalDhcpVO> sc = SearchCriteria2.create(BaremetalDhcpVO.class);
             sc.addAnd(sc.getEntity().getPodId(), Op.EQ, pod.getId());
             return sc.find() != null;
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java
index 775673a..739fafe 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java
@@ -69,7 +69,7 @@ import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.vm.NicProfile;
@@ -311,7 +311,7 @@ public class BaremetalDhcpManagerImpl extends ManagerBase implements BaremetalDh
             return responses;
         }
 
-        SearchCriteriaService<BaremetalDhcpVO, BaremetalDhcpVO> sc = SearchCriteria2.create(BaremetalDhcpVO.class);
+        SearchCriteria2<BaremetalDhcpVO, BaremetalDhcpVO> sc = SearchCriteria2.create(BaremetalDhcpVO.class);
         if (cmd.getDeviceType() != null) {
         	sc.addAnd(sc.getEntity().getDeviceType(), Op.EQ, cmd.getDeviceType());
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java
index 80a72fb..090b993 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java
@@ -59,7 +59,7 @@ import com.cloud.uservm.UserVm;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.vm.NicProfile;
@@ -87,7 +87,7 @@ public class BaremetalKickStartServiceImpl extends BareMetalPxeServiceBase imple
     @Override
     public boolean prepare(VirtualMachineProfile profile, NicProfile nic, DeployDestination dest, ReservationContext context) {
         NetworkVO nwVO = _nwDao.findById(nic.getNetworkId());
-        SearchCriteriaService<BaremetalPxeVO, BaremetalPxeVO> sc = SearchCriteria2.create(BaremetalPxeVO.class);
+        SearchCriteria2<BaremetalPxeVO, BaremetalPxeVO> sc = SearchCriteria2.create(BaremetalPxeVO.class);
         sc.addAnd(sc.getEntity().getDeviceType(), Op.EQ, BaremetalPxeType.KICK_START.toString());
         sc.addAnd(sc.getEntity().getPhysicalNetworkId(), Op.EQ, nwVO.getPhysicalNetworkId());
         BaremetalPxeVO pxeVo = sc.find();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeElement.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeElement.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeElement.java
index 82094d8..29c0adc 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeElement.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeElement.java
@@ -48,7 +48,7 @@ import com.cloud.utils.component.AdapterBase;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.vm.NicProfile;
@@ -91,7 +91,7 @@ public class BaremetalPxeElement extends AdapterBase implements NetworkElement {
     private boolean canHandle(DeployDestination dest, TrafficType trafficType, GuestType networkType) {
         Pod pod = dest.getPod();
         if (pod != null && dest.getDataCenter().getNetworkType() == NetworkType.Basic && trafficType == TrafficType.Guest) {
-            SearchCriteriaService<BaremetalPxeVO, BaremetalPxeVO> sc = SearchCriteria2.create(BaremetalPxeVO.class);
+            SearchCriteria2<BaremetalPxeVO, BaremetalPxeVO> sc = SearchCriteria2.create(BaremetalPxeVO.class);
             sc.addAnd(sc.getEntity().getPodId(), Op.EQ, pod.getId());
             return sc.find() != null;
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java
index 4ce4934..5332b63 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java
@@ -64,7 +64,7 @@ import com.cloud.utils.StringUtils;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.vm.NicProfile;
 import com.cloud.vm.NicVO;
@@ -220,7 +220,7 @@ public class BaremetalPxeManagerImpl extends ManagerBase implements BaremetalPxe
         }
         PhysicalNetworkVO phy = phys.get(0);
         
-        SearchCriteriaService<BaremetalPxeVO, BaremetalPxeVO> sc = SearchCriteria2.create(BaremetalPxeVO.class);
+        SearchCriteria2<BaremetalPxeVO, BaremetalPxeVO> sc = SearchCriteria2.create(BaremetalPxeVO.class);
         //TODO: handle both kickstart and PING
         //sc.addAnd(sc.getEntity().getPodId(), Op.EQ, vm.getPodIdToDeployIn());
         sc.addAnd(sc.getEntity().getPhysicalNetworkId(), Op.EQ, phy.getId());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java
index 9c8bc4e..fce903f 100755
--- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java
@@ -62,7 +62,7 @@ import com.cloud.utils.concurrency.NamedThreadFactory;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.xmlobject.XmlObject;
@@ -132,7 +132,7 @@ public class UcsManagerImpl implements UcsManager {
 		}
 
     	private void syncBlades(UcsManagerVO mgr) {
-    		SearchCriteriaService<UcsBladeVO, UcsBladeVO> q = SearchCriteria2.create(UcsBladeVO.class);
+    		SearchCriteria2<UcsBladeVO, UcsBladeVO> q = SearchCriteria2.create(UcsBladeVO.class);
     		q.addAnd(q.getEntity().getUcsManagerId(), Op.EQ, mgr.getId());
     		List<UcsBladeVO> pblades = q.list();
     		if (pblades.isEmpty()) {
@@ -210,7 +210,7 @@ public class UcsManagerImpl implements UcsManager {
     @Override
     @DB
     public UcsManagerResponse addUcsManager(AddUcsManagerCmd cmd) {
-        SearchCriteriaService<UcsManagerVO, UcsManagerVO> q = SearchCriteria2.create(UcsManagerVO.class);
+        SearchCriteria2<UcsManagerVO, UcsManagerVO> q = SearchCriteria2.create(UcsManagerVO.class);
         q.addAnd(q.getEntity().getUrl(), Op.EQ, cmd.getUrl());
         UcsManagerVO mgrvo = q.find();
         if (mgrvo != null) {
@@ -342,7 +342,7 @@ public class UcsManagerImpl implements UcsManager {
 
     @Override
     public UcsBladeResponse associateProfileToBlade(AssociateUcsProfileToBladeCmd cmd) {
-        SearchCriteriaService<UcsBladeVO, UcsBladeVO> q = SearchCriteria2.create(UcsBladeVO.class);
+        SearchCriteria2<UcsBladeVO, UcsBladeVO> q = SearchCriteria2.create(UcsBladeVO.class);
         q.addAnd(q.getEntity().getUcsManagerId(), Op.EQ, cmd.getUcsManagerId());
         q.addAnd(q.getEntity().getId(), Op.EQ, cmd.getBladeId());
         UcsBladeVO bvo = q.find();
@@ -424,7 +424,7 @@ public class UcsManagerImpl implements UcsManager {
             return response;
     	}
     	
-        SearchCriteriaService<UcsManagerVO, UcsManagerVO> serv = SearchCriteria2.create(UcsManagerVO.class);
+        SearchCriteria2<UcsManagerVO, UcsManagerVO> serv = SearchCriteria2.create(UcsManagerVO.class);
         serv.addAnd(serv.getEntity().getZoneId(), Op.EQ, cmd.getZoneId());
         List<UcsManagerVO> vos = serv.list();
 
@@ -454,7 +454,7 @@ public class UcsManagerImpl implements UcsManager {
     
     @Override
     public ListResponse<UcsBladeResponse> listUcsBlades(ListUcsBladeCmd cmd) {
-        SearchCriteriaService<UcsBladeVO, UcsBladeVO> serv = SearchCriteria2.create(UcsBladeVO.class);
+        SearchCriteria2<UcsBladeVO, UcsBladeVO> serv = SearchCriteria2.create(UcsBladeVO.class);
         serv.addAnd(serv.getEntity().getUcsManagerId(), Op.EQ, cmd.getUcsManagerId());
         List<UcsBladeVO> vos = serv.list();
         
@@ -509,7 +509,7 @@ public class UcsManagerImpl implements UcsManager {
 
 	@Override
 	public void deleteUcsManager(Long id) {
-        SearchCriteriaService<UcsBladeVO, UcsBladeVO> serv = SearchCriteria2.create(UcsBladeVO.class);
+        SearchCriteria2<UcsBladeVO, UcsBladeVO> serv = SearchCriteria2.create(UcsBladeVO.class);
         serv.addAnd(serv.getEntity().getUcsManagerId(), Op.EQ, id);
         List<UcsBladeVO> vos = serv.list();
         for (UcsBladeVO vo : vos) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
index 87a5014..2242e0a 100755
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
@@ -71,7 +71,7 @@ import com.cloud.user.Account;
 import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.exception.HypervisorVersionChangedException;
 import com.xensource.xenapi.Connection;
@@ -126,7 +126,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
         try {
             _clusterDao.update(cluster.getId(), cluster);
         } catch (EntityExistsException e) {
-            SearchCriteriaService<ClusterVO, ClusterVO> sc = SearchCriteria2.create(ClusterVO.class);
+            SearchCriteria2<ClusterVO, ClusterVO> sc = SearchCriteria2.create(ClusterVO.class);
             sc.addAnd(sc.getEntity().getGuid(), Op.EQ, guid);
             List<ClusterVO> clusters = sc.list();
             ClusterVO clu = clusters.get(0);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/element/InternalLoadBalancerElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/element/InternalLoadBalancerElement.java b/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/element/InternalLoadBalancerElement.java
index 0b9a1b4..25736fa 100644
--- a/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/element/InternalLoadBalancerElement.java
+++ b/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/element/InternalLoadBalancerElement.java
@@ -75,7 +75,7 @@ import com.cloud.utils.component.AdapterBase;
 import com.cloud.utils.db.EntityManager;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.net.Ip;
 import com.cloud.vm.DomainRouterVO;
@@ -509,7 +509,7 @@ public class InternalLoadBalancerElement extends AdapterBase implements LoadBala
     @Override
     public List<? extends VirtualRouterProvider> searchForInternalLoadBalancerElements(Long id, Long ntwkSvsProviderId, Boolean enabled) {
 
-        SearchCriteriaService<VirtualRouterProviderVO, VirtualRouterProviderVO> sc = SearchCriteria2.create(VirtualRouterProviderVO.class);
+        SearchCriteria2<VirtualRouterProviderVO, VirtualRouterProviderVO> sc = SearchCriteria2.create(VirtualRouterProviderVO.class);
         if (id != null) {
             sc.addAnd(sc.getEntity().getId(), Op.EQ, id);
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/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 90273f7..9d0476a 100755
--- a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
+++ b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
@@ -119,7 +119,7 @@ import com.cloud.utils.db.DB;
 import com.cloud.utils.db.GlobalLock;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.events.SubscriptionMgr;
 import com.cloud.utils.exception.CloudRuntimeException;
@@ -1693,7 +1693,7 @@ VirtualMachineGuru, SystemVmLoadScanHandler<Long>, ResourceStateAdapter {
     }
 
     protected HostVO findConsoleProxyHostByName(String name) {
-        SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
+        SearchCriteria2<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
         sc.addAnd(sc.getEntity().getType(), Op.EQ, Host.Type.ConsoleProxy);
         sc.addAnd(sc.getEntity().getName(), Op.EQ, name);
         return sc.find();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/server/src/com/cloud/ha/AbstractInvestigatorImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/ha/AbstractInvestigatorImpl.java b/server/src/com/cloud/ha/AbstractInvestigatorImpl.java
index 73fab300..a0a8c5a 100755
--- a/server/src/com/cloud/ha/AbstractInvestigatorImpl.java
+++ b/server/src/com/cloud/ha/AbstractInvestigatorImpl.java
@@ -40,7 +40,7 @@ import com.cloud.resource.ResourceManager;
 import com.cloud.utils.component.AdapterBase;
 import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.db.SearchCriteria.Op;
-import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria2;
 
 public abstract class AbstractInvestigatorImpl extends AdapterBase implements Investigator {
     private static final Logger s_logger = Logger.getLogger(AbstractInvestigatorImpl.class);
@@ -68,7 +68,7 @@ public abstract class AbstractInvestigatorImpl extends AdapterBase implements In
     
     // Host.status is up and Host.type is routing
     protected List<Long> findHostByPod(long podId, Long excludeHostId) {
-    	SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
+    	SearchCriteria2<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
         sc.addAnd(sc.getEntity().getType(), Op.EQ, Type.Routing);
         sc.addAnd(sc.getEntity().getPodId(), Op.EQ, podId);
         sc.addAnd(sc.getEntity().getStatus(), Op.EQ, Status.Up);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/server/src/com/cloud/network/StorageNetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/StorageNetworkManagerImpl.java b/server/src/com/cloud/network/StorageNetworkManagerImpl.java
index 901e204..c5944fd 100755
--- a/server/src/com/cloud/network/StorageNetworkManagerImpl.java
+++ b/server/src/com/cloud/network/StorageNetworkManagerImpl.java
@@ -48,7 +48,7 @@ import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.net.NetUtils;
@@ -339,7 +339,7 @@ public class StorageNetworkManagerImpl extends ManagerBase implements StorageNet
 
     @Override
     public boolean isStorageIpRangeAvailable(long zoneId) {
-        SearchCriteriaService<StorageNetworkIpRangeVO, StorageNetworkIpRangeVO> sc = SearchCriteria2.create(StorageNetworkIpRangeVO.class);
+        SearchCriteria2<StorageNetworkIpRangeVO, StorageNetworkIpRangeVO> sc = SearchCriteria2.create(StorageNetworkIpRangeVO.class);
         sc.addAnd(sc.getEntity().getDataCenterId(), Op.EQ, zoneId);
         List<StorageNetworkIpRangeVO> entries = sc.list();
         return entries.size() > 0;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/server/src/com/cloud/network/element/VirtualRouterElement.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/element/VirtualRouterElement.java b/server/src/com/cloud/network/element/VirtualRouterElement.java
index 3607284..bfa34bf 100755
--- a/server/src/com/cloud/network/element/VirtualRouterElement.java
+++ b/server/src/com/cloud/network/element/VirtualRouterElement.java
@@ -82,7 +82,7 @@ import com.cloud.utils.Pair;
 import com.cloud.utils.component.AdapterBase;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.vm.DomainRouterVO;
 import com.cloud.vm.NicProfile;
@@ -969,7 +969,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
         Long nspId = cmd.getNspId();
         Boolean enabled = cmd.getEnabled();
 
-        SearchCriteriaService<VirtualRouterProviderVO, VirtualRouterProviderVO> sc = SearchCriteria2.create(VirtualRouterProviderVO.class);
+        SearchCriteria2<VirtualRouterProviderVO, VirtualRouterProviderVO> sc = SearchCriteria2.create(VirtualRouterProviderVO.class);
         if (id != null) {
             sc.addAnd(sc.getEntity().getId(), Op.EQ, id);
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/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 76d7cf9..ea3c71a 100755
--- a/server/src/com/cloud/resource/ResourceManagerImpl.java
+++ b/server/src/com/cloud/resource/ResourceManagerImpl.java
@@ -145,7 +145,7 @@ import com.cloud.utils.db.SearchCriteria;
 import com.cloud.utils.db.SearchCriteria.Func;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.fsm.NoTransitionException;
@@ -2256,7 +2256,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
     @Override
     public List<HostVO> findDirectlyConnectedHosts() {
         /* The resource column is not null for direct connected resource */
-        SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
+        SearchCriteria2<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
         sc.addAnd(sc.getEntity().getResource(), Op.NNULL);
         sc.addAnd(sc.getEntity().getResourceState(), Op.NIN, ResourceState.Disabled);
         return sc.list();
@@ -2264,7 +2264,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
 
     @Override
     public List<HostVO> listAllUpAndEnabledHosts(Type type, Long clusterId, Long podId, long dcId) {
-        SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
+        SearchCriteria2<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
         if (type != null) {
             sc.addAnd(sc.getEntity().getType(), Op.EQ, type);
         }
@@ -2288,7 +2288,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
 
     @Override
     public List<HostVO> findHostByGuid(long dcId, String guid) {
-        SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
+        SearchCriteria2<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
         sc.addAnd(sc.getEntity().getDataCenterId(), Op.EQ, dcId);
         sc.addAnd(sc.getEntity().getGuid(), Op.EQ, guid);
         return sc.list();
@@ -2296,14 +2296,14 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
 
     @Override
     public List<HostVO> listAllHostsInCluster(long clusterId) {
-        SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
+        SearchCriteria2<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
         sc.addAnd(sc.getEntity().getClusterId(), Op.EQ, clusterId);
         return sc.list();
     }
 
     @Override
     public List<HostVO> listHostsInClusterByStatus(long clusterId, Status status) {
-        SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
+        SearchCriteria2<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
         sc.addAnd(sc.getEntity().getClusterId(), Op.EQ, clusterId);
         sc.addAnd(sc.getEntity().getStatus(), Op.EQ, status);
         return sc.list();
@@ -2311,7 +2311,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
 
     @Override
     public List<HostVO> listAllUpAndEnabledHostsInOneZoneByType(Type type, long dcId) {
-        SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
+        SearchCriteria2<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
         sc.addAnd(sc.getEntity().getType(), Op.EQ, type);
         sc.addAnd(sc.getEntity().getDataCenterId(), Op.EQ, dcId);
         sc.addAnd(sc.getEntity().getStatus(), Op.EQ, Status.Up);
@@ -2321,7 +2321,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
 
     @Override
     public List<HostVO> listAllNotInMaintenanceHostsInOneZone(Type type, Long dcId) {
-        SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
+        SearchCriteria2<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
         if (dcId != null) {
             sc.addAnd(sc.getEntity().getDataCenterId(), Op.EQ, dcId);
         }
@@ -2332,7 +2332,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
 
     @Override
     public List<HostVO> listAllHostsInOneZoneByType(Type type, long dcId) {
-        SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
+        SearchCriteria2<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
         sc.addAnd(sc.getEntity().getType(), Op.EQ, type);
         sc.addAnd(sc.getEntity().getDataCenterId(), Op.EQ, dcId);
         return sc.list();
@@ -2340,7 +2340,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
 
     @Override
     public List<HostVO> listAllHostsInAllZonesByType(Type type) {
-        SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
+        SearchCriteria2<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
         sc.addAnd(sc.getEntity().getType(), Op.EQ, type);
         return sc.list();
     }
@@ -2370,14 +2370,14 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
 
     @Override
     public HostVO findHostByGuid(String guid) {
-        SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
+        SearchCriteria2<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
         sc.addAnd(sc.getEntity().getGuid(), Op.EQ, guid);
         return sc.find();
     }
 
     @Override
     public HostVO findHostByName(String name) {
-        SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
+        SearchCriteria2<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
         sc.addAnd(sc.getEntity().getName(), Op.EQ, name);
         return sc.find();
     }
@@ -2449,7 +2449,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
 
     @Override
     public List<HostVO> listAllUpAndEnabledHostsInOneZoneByHypervisor(HypervisorType type, long dcId) {
-        SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
+        SearchCriteria2<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
         sc.addAnd(sc.getEntity().getHypervisorType(), Op.EQ, type);
         sc.addAnd(sc.getEntity().getDataCenterId(), Op.EQ, dcId);
         sc.addAnd(sc.getEntity().getStatus(), Op.EQ, Status.Up);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/server/src/com/cloud/storage/OCFS2ManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/OCFS2ManagerImpl.java b/server/src/com/cloud/storage/OCFS2ManagerImpl.java
index 5eb9a4a..50c0f76 100755
--- a/server/src/com/cloud/storage/OCFS2ManagerImpl.java
+++ b/server/src/com/cloud/storage/OCFS2ManagerImpl.java
@@ -49,7 +49,7 @@ import com.cloud.utils.Ternary;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.exception.CloudRuntimeException;
 
 @Component
@@ -141,7 +141,7 @@ public class OCFS2ManagerImpl extends ManagerBase implements OCFS2Manager, Resou
             throw new CloudRuntimeException("Cannot find cluster for ID " + clusterId);
         }
 
-        SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
+        SearchCriteria2<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
         sc.addAnd(sc.getEntity().getClusterId(), Op.EQ, clusterId);
         sc.addAnd(sc.getEntity().getPodId(), Op.EQ, cluster.getPodId());
         sc.addAnd(sc.getEntity().getDataCenterId(), Op.EQ, cluster.getDataCenterId());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af8832f6/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 d4463d9..6a88071 100755
--- a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
+++ b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
@@ -116,7 +116,7 @@ import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.db.GlobalLock;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.events.SubscriptionMgr;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.net.NetUtils;
@@ -420,7 +420,7 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
         SecStorageFirewallCfgCommand thiscpc = new SecStorageFirewallCfgCommand(true);
         thiscpc.addPortConfig(thisSecStorageVm.getPublicIpAddress(), copyPort, true, TemplateConstants.DEFAULT_TMPLT_COPY_INTF);
 
-        SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
+        SearchCriteria2<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
         sc.addAnd(sc.getEntity().getType(), Op.EQ, Host.Type.SecondaryStorageVM);
         sc.addAnd(sc.getEntity().getStatus(), Op.IN, com.cloud.host.Status.Up, com.cloud.host.Status.Connecting);
         List<HostVO> ssvms = sc.list();
@@ -1345,7 +1345,7 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
 
     @Override
     public List<HostVO> listUpAndConnectingSecondaryStorageVmHost(Long dcId) {
-        SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
+        SearchCriteria2<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
         if (dcId != null) {
             sc.addAnd(sc.getEntity().getDataCenterId(), Op.EQ, dcId);
         }


Mime
View raw message