cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject [07/50] [abbrv] git commit: updated refs/heads/object_store_migration to 5ec2a44
Date Tue, 29 Oct 2013 03:52:57 GMT
Renamed ResourceDetailDaoImpl to ResourceDetailDaoBase


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

Branch: refs/heads/object_store_migration
Commit: 300f626d42fbb0c944517b2e548c135f7e0873c9
Parents: ad51b8e
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Fri Oct 25 14:20:58 2013 -0700
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Fri Oct 25 14:21:20 2013 -0700

----------------------------------------------------------------------
 .../cloud/dc/dao/DataCenterDetailsDaoImpl.java  |   2 +-
 .../com/cloud/dc/dao/ResourceDetailDaoBase.java | 113 +++++++++++++++++++
 .../com/cloud/dc/dao/ResourceDetailDaoImpl.java | 110 ------------------
 .../network/dao/NetworkDetailsDaoImpl.java      |   4 +-
 .../dao/ServiceOfferingDetailsDaoImpl.java      |   4 +-
 .../storage/dao/VMTemplateDetailsDaoImpl.java   |   4 +-
 .../cloud/storage/dao/VolumeDetailsDaoImpl.java |   4 +-
 .../src/com/cloud/vm/dao/NicDetailDaoImpl.java  |   4 +-
 .../com/cloud/vm/dao/UserVmDetailsDaoImpl.java  |   4 +-
 server/src/com/cloud/api/ApiDBUtils.java        |   2 +-
 10 files changed, 127 insertions(+), 124 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/300f626d/engine/schema/src/com/cloud/dc/dao/DataCenterDetailsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/DataCenterDetailsDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/DataCenterDetailsDaoImpl.java
index b6949f5..eb9176d 100644
--- a/engine/schema/src/com/cloud/dc/dao/DataCenterDetailsDaoImpl.java
+++ b/engine/schema/src/com/cloud/dc/dao/DataCenterDetailsDaoImpl.java
@@ -26,7 +26,7 @@ import org.apache.cloudstack.framework.config.ScopedConfigStorage;
 import com.cloud.dc.DataCenterDetailVO;
 
 @Local(value=DataCenterDetailsDao.class)
-public class DataCenterDetailsDaoImpl extends ResourceDetailDaoImpl<DataCenterDetailVO>
implements DataCenterDetailsDao, ScopedConfigStorage {
+public class DataCenterDetailsDaoImpl extends ResourceDetailDaoBase<DataCenterDetailVO>
implements DataCenterDetailsDao, ScopedConfigStorage {
     
     public DataCenterDetailsDaoImpl() {
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/300f626d/engine/schema/src/com/cloud/dc/dao/ResourceDetailDaoBase.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/ResourceDetailDaoBase.java b/engine/schema/src/com/cloud/dc/dao/ResourceDetailDaoBase.java
new file mode 100644
index 0000000..ea8f85a
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/ResourceDetailDaoBase.java
@@ -0,0 +1,113 @@
+// 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.dc.dao;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.cloudstack.api.ResourceDetail;
+
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.TransactionLegacy;
+
+
+public abstract class ResourceDetailDaoBase<R extends ResourceDetail> extends GenericDaoBase<R,
Long>{
+    private SearchBuilder<R> AllFieldsSearch;
+    
+    public ResourceDetailDaoBase() {
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("resourceId", AllFieldsSearch.entity().getResourceId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("name", AllFieldsSearch.entity().getName(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.done();
+    }
+
+    public R findDetail(long resourceId, String name) {
+        SearchCriteria<R> sc = AllFieldsSearch.create();
+        sc.setParameters("resourceId", resourceId);
+        sc.setParameters("name", name);
+        
+        return findOneBy(sc);
+    }
+
+
+    public Map<String, String> findDetails(long resourceId) {
+        SearchCriteria<R> sc = AllFieldsSearch.create();
+        sc.setParameters("resourceId", resourceId);
+        
+        List<R> results = search(sc, null);
+        Map<String, String> details = new HashMap<String, String>(results.size());
+        for (R result : results) {
+            details.put(result.getName(), result.getValue());
+        }
+        return details;
+    }
+
+    public List<R> findDetailsList(long resourceId) {
+        SearchCriteria<R> sc = AllFieldsSearch.create();
+        sc.setParameters("resourceId", resourceId);
+
+        List<R> results = search(sc, null);
+        return results;
+    }
+
+
+    public void removeDetails(long resourceId) {
+        SearchCriteria<R> sc = AllFieldsSearch.create();
+        sc.setParameters("resourceId", resourceId);
+        remove(sc);
+    }
+
+    
+    public void removeDetail(long resourceId, String key) {
+        if (key != null){
+            SearchCriteria<R> sc = AllFieldsSearch.create();
+            sc.setParameters("name", key);
+            remove(sc);
+        }
+    }
+
+
+    public void addDetails(List<R> details) {
+        if (details.isEmpty()) {
+            return;
+        }
+        TransactionLegacy txn = TransactionLegacy.currentTxn();
+        txn.start();
+        SearchCriteria<R> sc = AllFieldsSearch.create();
+        sc.setParameters("resourceId", details.get(0).getResourceId());
+        expunge(sc);
+        
+        for (R detail : details) {
+            persist(detail);
+        }
+        
+        txn.commit();
+    }
+    
+
+    public void addDetail(R detail) {
+        R existingDetail = findDetail(detail.getResourceId(), detail.getName());
+        if (existingDetail != null) {
+            remove(existingDetail.getId());
+        }
+        persist(detail);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/300f626d/engine/schema/src/com/cloud/dc/dao/ResourceDetailDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/ResourceDetailDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/ResourceDetailDaoImpl.java
deleted file mode 100644
index 8819e4b..0000000
--- a/engine/schema/src/com/cloud/dc/dao/ResourceDetailDaoImpl.java
+++ /dev/null
@@ -1,110 +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.dc.dao;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cloudstack.api.ResourceDetail;
-
-import com.cloud.utils.db.GenericDaoBase;
-import com.cloud.utils.db.SearchBuilder;
-import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.db.TransactionLegacy;
-
-
-public abstract class ResourceDetailDaoImpl<R extends ResourceDetail> extends GenericDaoBase<R,
Long>{
-    private SearchBuilder<R> AllFieldsSearch;
-    
-    public ResourceDetailDaoImpl() {
-        AllFieldsSearch = createSearchBuilder();
-        AllFieldsSearch.and("resourceId", AllFieldsSearch.entity().getResourceId(), SearchCriteria.Op.EQ);
-        AllFieldsSearch.and("name", AllFieldsSearch.entity().getName(), SearchCriteria.Op.EQ);
-        AllFieldsSearch.done();
-    }
-
-    public R findDetail(long resourceId, String name) {
-        SearchCriteria<R> sc = AllFieldsSearch.create();
-        sc.setParameters("resourceId", resourceId);
-        sc.setParameters("name", name);
-        
-        return findOneBy(sc);
-    }
-
-
-    public Map<String, String> findDetails(long resourceId) {
-        SearchCriteria<R> sc = AllFieldsSearch.create();
-        sc.setParameters("resourceId", resourceId);
-        
-        List<R> results = search(sc, null);
-        Map<String, String> details = new HashMap<String, String>(results.size());
-        for (R result : results) {
-            details.put(result.getName(), result.getValue());
-        }
-        return details;
-    }
-
-    public List<R> findDetailsList(long resourceId) {
-        SearchCriteria<R> sc = AllFieldsSearch.create();
-        sc.setParameters("resourceId", resourceId);
-
-        List<R> results = search(sc, null);
-        return results;
-    }
-
-
-    public void removeDetails(long resourceId) {
-        SearchCriteria<R> sc = AllFieldsSearch.create();
-        sc.setParameters("resourceId", resourceId);
-        remove(sc);
-    }
-
-    
-    public void removeDetail(long resourceId, String key) {
-        if (key != null){
-            SearchCriteria<R> sc = AllFieldsSearch.create();
-            sc.setParameters("name", key);
-            remove(sc);
-        }
-    }
-
-
-    public void addDetails(List<R> details) {
-        TransactionLegacy txn = TransactionLegacy.currentTxn();
-        txn.start();
-        SearchCriteria<R> sc = AllFieldsSearch.create();
-        sc.setParameters("resourceId", details.get(0).getResourceId());
-        expunge(sc);
-        
-        for (R detail : details) {
-            persist(detail);
-        }
-        
-        txn.commit();
-    }
-    
-
-    public void addDetail(R detail) {
-        R existingDetail = findDetail(detail.getResourceId(), detail.getName());
-        if (existingDetail != null) {
-            remove(existingDetail.getId());
-        }
-        persist(detail);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/300f626d/engine/schema/src/com/cloud/network/dao/NetworkDetailsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkDetailsDaoImpl.java b/engine/schema/src/com/cloud/network/dao/NetworkDetailsDaoImpl.java
index 76dc24a..915e184 100644
--- a/engine/schema/src/com/cloud/network/dao/NetworkDetailsDaoImpl.java
+++ b/engine/schema/src/com/cloud/network/dao/NetworkDetailsDaoImpl.java
@@ -20,10 +20,10 @@ import javax.ejb.Local;
 
 import org.springframework.stereotype.Component;
 
-import com.cloud.dc.dao.ResourceDetailDaoImpl;
+import com.cloud.dc.dao.ResourceDetailDaoBase;
 
 @Component
 @Local(value=NetworkDetailsDao.class)
-public class NetworkDetailsDaoImpl extends ResourceDetailDaoImpl<NetworkDetailVO> implements
NetworkDetailsDao {
+public class NetworkDetailsDaoImpl extends ResourceDetailDaoBase<NetworkDetailVO> implements
NetworkDetailsDao {
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/300f626d/engine/schema/src/com/cloud/service/dao/ServiceOfferingDetailsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/service/dao/ServiceOfferingDetailsDaoImpl.java b/engine/schema/src/com/cloud/service/dao/ServiceOfferingDetailsDaoImpl.java
index bf3cdcc..eed8a13 100644
--- a/engine/schema/src/com/cloud/service/dao/ServiceOfferingDetailsDaoImpl.java
+++ b/engine/schema/src/com/cloud/service/dao/ServiceOfferingDetailsDaoImpl.java
@@ -20,12 +20,12 @@ import javax.ejb.Local;
 
 import org.springframework.stereotype.Component;
 
-import com.cloud.dc.dao.ResourceDetailDaoImpl;
+import com.cloud.dc.dao.ResourceDetailDaoBase;
 import com.cloud.service.ServiceOfferingDetailsVO;
 
 @Component
 @Local(value=ServiceOfferingDetailsDao.class)
-public class ServiceOfferingDetailsDaoImpl extends ResourceDetailDaoImpl<ServiceOfferingDetailsVO>
+public class ServiceOfferingDetailsDaoImpl extends ResourceDetailDaoBase<ServiceOfferingDetailsVO>
         implements ServiceOfferingDetailsDao {
     
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/300f626d/engine/schema/src/com/cloud/storage/dao/VMTemplateDetailsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/VMTemplateDetailsDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/VMTemplateDetailsDaoImpl.java
index 007f9ca..4b9bfb5 100644
--- a/engine/schema/src/com/cloud/storage/dao/VMTemplateDetailsDaoImpl.java
+++ b/engine/schema/src/com/cloud/storage/dao/VMTemplateDetailsDaoImpl.java
@@ -20,10 +20,10 @@ import javax.ejb.Local;
 
 import org.springframework.stereotype.Component;
 
-import com.cloud.dc.dao.ResourceDetailDaoImpl;
+import com.cloud.dc.dao.ResourceDetailDaoBase;
 import com.cloud.storage.VMTemplateDetailVO;
 
 @Component
 @Local(value = VMTemplateDetailsDao.class)
-public class VMTemplateDetailsDaoImpl extends ResourceDetailDaoImpl<VMTemplateDetailVO>
implements VMTemplateDetailsDao {
+public class VMTemplateDetailsDaoImpl extends ResourceDetailDaoBase<VMTemplateDetailVO>
implements VMTemplateDetailsDao {
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/300f626d/engine/schema/src/com/cloud/storage/dao/VolumeDetailsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/VolumeDetailsDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/VolumeDetailsDaoImpl.java
index d264394..9df6ee1 100644
--- a/engine/schema/src/com/cloud/storage/dao/VolumeDetailsDaoImpl.java
+++ b/engine/schema/src/com/cloud/storage/dao/VolumeDetailsDaoImpl.java
@@ -20,11 +20,11 @@ import javax.ejb.Local;
 
 import org.springframework.stereotype.Component;
 
-import com.cloud.dc.dao.ResourceDetailDaoImpl;
+import com.cloud.dc.dao.ResourceDetailDaoBase;
 import com.cloud.storage.VolumeDetailVO;
 
 @Component
 @Local(value=VolumeDetailsDao.class)
-public class VolumeDetailsDaoImpl extends ResourceDetailDaoImpl<VolumeDetailVO> implements
VolumeDetailsDao {
+public class VolumeDetailsDaoImpl extends ResourceDetailDaoBase<VolumeDetailVO> implements
VolumeDetailsDao {
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/300f626d/engine/schema/src/com/cloud/vm/dao/NicDetailDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/dao/NicDetailDaoImpl.java b/engine/schema/src/com/cloud/vm/dao/NicDetailDaoImpl.java
index 65a327f..6263cae 100644
--- a/engine/schema/src/com/cloud/vm/dao/NicDetailDaoImpl.java
+++ b/engine/schema/src/com/cloud/vm/dao/NicDetailDaoImpl.java
@@ -20,11 +20,11 @@ import javax.ejb.Local;
 
 import org.springframework.stereotype.Component;
 
-import com.cloud.dc.dao.ResourceDetailDaoImpl;
+import com.cloud.dc.dao.ResourceDetailDaoBase;
 import com.cloud.vm.NicDetailVO;
 
 @Component
 @Local (value={NicDetailDao.class})
-public class NicDetailDaoImpl extends ResourceDetailDaoImpl<NicDetailVO> implements
NicDetailDao {
+public class NicDetailDaoImpl extends ResourceDetailDaoBase<NicDetailVO> implements
NicDetailDao {
     
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/300f626d/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDaoImpl.java b/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDaoImpl.java
index 38b691d..b435381 100644
--- a/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDaoImpl.java
+++ b/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDaoImpl.java
@@ -20,11 +20,11 @@ import javax.ejb.Local;
 
 import org.springframework.stereotype.Component;
 
-import com.cloud.dc.dao.ResourceDetailDaoImpl;
+import com.cloud.dc.dao.ResourceDetailDaoBase;
 import com.cloud.vm.UserVmDetailVO;
 
 @Component
 @Local(value=UserVmDetailsDao.class)
-public class UserVmDetailsDaoImpl extends ResourceDetailDaoImpl<UserVmDetailVO> implements
UserVmDetailsDao {
+public class UserVmDetailsDaoImpl extends ResourceDetailDaoBase<UserVmDetailVO> implements
UserVmDetailsDao {
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/300f626d/server/src/com/cloud/api/ApiDBUtils.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiDBUtils.java b/server/src/com/cloud/api/ApiDBUtils.java
index 36fddf4..37b9e9c 100755
--- a/server/src/com/cloud/api/ApiDBUtils.java
+++ b/server/src/com/cloud/api/ApiDBUtils.java
@@ -126,7 +126,7 @@ import com.cloud.dc.dao.ClusterDao;
 import com.cloud.dc.dao.DataCenterDao;
 import com.cloud.dc.dao.DataCenterDetailsDao;
 import com.cloud.dc.dao.HostPodDao;
-import com.cloud.dc.dao.ResourceDetailDaoImpl;
+import com.cloud.dc.dao.ResourceDetailDaoBase;
 import com.cloud.dc.dao.VlanDao;
 import com.cloud.domain.DomainVO;
 import com.cloud.domain.dao.DomainDao;


Mime
View raw message