Martin Sivák has uploaded a new change for review.

Change subject: core: Add DaoProviderInterface and implement it in DbFacade
......................................................................

core: Add DaoProviderInterface and implement it in DbFacade

This will allow decoupling of some internal services from the
singleton dependency. The goal is to allow the usage of different
data source (like REST API) when a service is used externally.

Currently this is needed for externalizing Scheduler and its
PolicyUnits for Optaplanner integration.

Change-Id: Ifa7e83fa6f693f8f6c4a036a0694c497a810e25e
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=877209
Signed-off-by: Martin Sivak <[email protected]>
---
A 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/DaoProviderInterface.java
1 file changed, 587 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/99/26199/1

diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/DaoProviderInterface.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/DaoProviderInterface.java
new file mode 100644
index 0000000..e96d264
--- /dev/null
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/DaoProviderInterface.java
@@ -0,0 +1,587 @@
+package org.ovirt.engine.core.dal.dbbroker;
+
+import org.ovirt.engine.core.common.VdcObjectType;
+import org.ovirt.engine.core.common.businessentities.BusinessEntity;
+import org.ovirt.engine.core.compat.Guid;
+import org.ovirt.engine.core.dao.ActionGroupDAO;
+import org.ovirt.engine.core.dao.AsyncTaskDAO;
+import org.ovirt.engine.core.dao.AuditLogDAO;
+import org.ovirt.engine.core.dao.BaseDiskDao;
+import org.ovirt.engine.core.dao.BookmarkDAO;
+import org.ovirt.engine.core.dao.BusinessEntitySnapshotDAO;
+import org.ovirt.engine.core.dao.DbGroupDAO;
+import org.ovirt.engine.core.dao.DbUserDAO;
+import org.ovirt.engine.core.dao.DiskDao;
+import org.ovirt.engine.core.dao.DiskImageDAO;
+import org.ovirt.engine.core.dao.DiskImageDynamicDAO;
+import org.ovirt.engine.core.dao.DiskLunMapDao;
+import org.ovirt.engine.core.dao.EventDAO;
+import org.ovirt.engine.core.dao.GenericDao;
+import org.ovirt.engine.core.dao.ImageDao;
+import org.ovirt.engine.core.dao.ImageStorageDomainMapDao;
+import org.ovirt.engine.core.dao.JobDao;
+import org.ovirt.engine.core.dao.JobSubjectEntityDao;
+import org.ovirt.engine.core.dao.LunDAO;
+import org.ovirt.engine.core.dao.PermissionDAO;
+import org.ovirt.engine.core.dao.QuotaDAO;
+import org.ovirt.engine.core.dao.RepoFileMetaDataDAO;
+import org.ovirt.engine.core.dao.RoleDAO;
+import org.ovirt.engine.core.dao.RoleGroupMapDAO;
+import org.ovirt.engine.core.dao.SnapshotDao;
+import org.ovirt.engine.core.dao.StepDao;
+import org.ovirt.engine.core.dao.StorageDomainDAO;
+import org.ovirt.engine.core.dao.StorageDomainDynamicDAO;
+import org.ovirt.engine.core.dao.StorageDomainStaticDAO;
+import org.ovirt.engine.core.dao.StoragePoolDAO;
+import org.ovirt.engine.core.dao.StoragePoolIsoMapDAO;
+import org.ovirt.engine.core.dao.StorageServerConnectionDAO;
+import org.ovirt.engine.core.dao.StorageServerConnectionLunMapDAO;
+import org.ovirt.engine.core.dao.TagDAO;
+import org.ovirt.engine.core.dao.VdcOptionDAO;
+import org.ovirt.engine.core.dao.VdsDAO;
+import org.ovirt.engine.core.dao.VdsDynamicDAO;
+import org.ovirt.engine.core.dao.VdsGroupDAO;
+import org.ovirt.engine.core.dao.VdsSpmIdMapDAO;
+import org.ovirt.engine.core.dao.VdsStaticDAO;
+import org.ovirt.engine.core.dao.VdsStatisticsDAO;
+import org.ovirt.engine.core.dao.VmAndTemplatesGenerationsDAO;
+import org.ovirt.engine.core.dao.VmDAO;
+import org.ovirt.engine.core.dao.VmDeviceDAO;
+import org.ovirt.engine.core.dao.VmDynamicDAO;
+import org.ovirt.engine.core.dao.VmGuestAgentInterfaceDao;
+import org.ovirt.engine.core.dao.VmPoolDAO;
+import org.ovirt.engine.core.dao.VmStaticDAO;
+import org.ovirt.engine.core.dao.VmStatisticsDAO;
+import org.ovirt.engine.core.dao.VmTemplateDAO;
+import org.ovirt.engine.core.dao.gluster.GlusterBrickDao;
+import org.ovirt.engine.core.dao.gluster.GlusterClusterServiceDao;
+import org.ovirt.engine.core.dao.gluster.GlusterHooksDao;
+import org.ovirt.engine.core.dao.gluster.GlusterOptionDao;
+import org.ovirt.engine.core.dao.gluster.GlusterServerDao;
+import org.ovirt.engine.core.dao.gluster.GlusterServerServiceDao;
+import org.ovirt.engine.core.dao.gluster.GlusterServiceDao;
+import org.ovirt.engine.core.dao.gluster.GlusterVolumeDao;
+import org.ovirt.engine.core.dao.network.InterfaceDao;
+import org.ovirt.engine.core.dao.network.NetworkClusterDao;
+import org.ovirt.engine.core.dao.network.NetworkDao;
+import org.ovirt.engine.core.dao.network.NetworkQoSDao;
+import org.ovirt.engine.core.dao.network.NetworkViewDao;
+import org.ovirt.engine.core.dao.network.VmNetworkInterfaceDao;
+import org.ovirt.engine.core.dao.network.VmNetworkStatisticsDao;
+import org.ovirt.engine.core.dao.network.VmNicDao;
+import org.ovirt.engine.core.dao.network.VnicProfileDao;
+import org.ovirt.engine.core.dao.network.VnicProfileViewDao;
+import org.ovirt.engine.core.dao.provider.ProviderDao;
+import org.ovirt.engine.core.dao.scheduling.AffinityGroupDao;
+import org.ovirt.engine.core.dao.scheduling.ClusterPolicyDao;
+import org.ovirt.engine.core.dao.scheduling.PolicyUnitDao;
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: msivak
+ * Date: 28.03.14
+ * Time: 17:21
+ * To change this template use File | Settings | File Templates.
+ */
+public interface DaoProviderInterface {
+    /**
+     * Return the correct DAO for the given {@link 
org.ovirt.engine.core.common.businessentities.BusinessEntity} class.
+     *
+     * @param <T>
+     *            The Type of DAO which is returned.
+     * @param entityClass
+     *            The class of the entity.
+     * @return The DAO for the entity.
+     */
+    <T extends GenericDao<?, ?>> T getDaoForEntity(Class<? extends 
BusinessEntity<?>> entityClass);
+
+    String getEntityNameByIdAndType(Guid objectId, VdcObjectType 
vdcObjectType);
+
+    /***
+     * CheckDBConnection calls a simple "select 1" SP to verify DB is up & 
running.
+     *
+     * @return True if DB is up & running.
+     */
+    boolean checkDBConnection();
+
+    /**
+     * Returns a singleton instance of {@link 
org.ovirt.engine.core.dao.BookmarkDAO}.
+     *
+     * @return the dao
+     */
+    BookmarkDAO getBookmarkDao();
+
+    /**
+     * Returns the singleton instance of {@link DbuserDAO}.
+     *
+     * @return the dao
+     */
+    DbUserDAO getDbUserDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.VdsDAO}.
+     *
+     * @return the dao
+     */
+    VdsDAO getVdsDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.VmAndTemplatesGenerationsDAO}.
+     *
+     * @return the dao
+     */
+    VmAndTemplatesGenerationsDAO getVmAndTemplatesGenerationsDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.VdsStaticDAO}.
+     *
+     * @return the dao
+     */
+    VdsStaticDAO getVdsStaticDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.VdsDynamicDAO}.
+     *
+     * @return the dao
+     */
+    VdsDynamicDAO getVdsDynamicDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.VdsStatisticsDAO}.
+     *
+     * @return the dao
+     */
+    VdsStatisticsDAO getVdsStatisticsDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.VdsSpmIdMapDAO}.
+     *
+     * @return the dao
+     */
+    VdsSpmIdMapDAO getVdsSpmIdMapDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.VdsGroupDAO}.
+     *
+     * @return the dao
+     */
+    VdsGroupDAO getVdsGroupDao();
+
+    /**
+     * Returns the single instance of {@link 
org.ovirt.engine.core.dao.AuditLogDAO}.
+     *
+     * @return the dao
+     */
+    AuditLogDAO getAuditLogDao();
+
+    /**
+     * Retrieves the singleton instance of {@link 
org.ovirt.engine.core.dao.LunDAO}.
+     *
+     * @return the dao
+     */
+    LunDAO getLunDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.network.InterfaceDao}.
+     *
+     * @return the dao
+     */
+    InterfaceDao getInterfaceDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.network.VmNetworkInterfaceDao}.
+     *
+     * @return the dao
+     */
+    VmNetworkInterfaceDao getVmNetworkInterfaceDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.network.VmNetworkInterfaceDao}.
+     *
+     * @return the dao
+     */
+    VmNetworkStatisticsDao getVmNetworkStatisticsDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.RoleGroupMapDAO}.
+     *
+     * @return the dao
+     */
+    RoleGroupMapDAO getRoleGroupMapDao();
+
+    /**
+     * * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.VmTemplateDAO}.
+     *
+     * @return the dao
+     */
+    VmTemplateDAO getVmTemplateDao();
+
+    /**
+     * * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.VmDAO}.
+     *
+     * @return the dao
+     */
+    VmDAO getVmDao();
+
+    /**
+     * * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.VmDynamicDAO}.
+     *
+     * @return the dao
+     */
+    VmDynamicDAO getVmDynamicDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.TagDAO}.
+     *
+     * @return the dao
+     */
+    TagDAO getTagDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.BaseDiskDao}.
+     *
+     * @return the dao
+     */
+    BaseDiskDao getBaseDiskDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.DiskDao}.
+     *
+     * @return the dao
+     */
+    DiskDao getDiskDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.DiskLunMapDao}.
+     *
+     * @return the dao
+     */
+    DiskLunMapDao getDiskLunMapDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.ImageDao}.
+     *
+     * @return the dao
+     */
+    ImageDao getImageDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.DiskImageDAO}.
+     *
+     * @return the dao
+     */
+    DiskImageDAO getDiskImageDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.DiskImageDynamicDAO}.
+     *
+     * @return the dao
+     */
+    DiskImageDynamicDAO getDiskImageDynamicDao();
+
+    /**
+     * Returns the singleton instance of {@link EventSubscriberDAO}.
+     *
+     * @return the dao
+     */
+    EventDAO getEventDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.ActionGroupDAO}.
+     *
+     * @return the dao
+     */
+    ActionGroupDAO getActionGroupDao();
+
+    /**
+     * Retrieves the singleton instance of {@link 
org.ovirt.engine.core.dao.RoleDAO}.
+     *
+     * @return the dao
+     */
+    RoleDAO getRoleDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.AsyncTaskDAO}.
+     *
+     * @return the dao
+     */
+    AsyncTaskDAO getAsyncTaskDao();
+
+    /**
+     * Retrieves the singleton instance of {@link 
org.ovirt.engine.core.dao.DbGroupDAO}.
+     *
+     * @return the dao
+     */
+    DbGroupDAO getDbGroupDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.provider.ProviderDao}.
+     *
+     * @return the dao
+     */
+    ProviderDao getProviderDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.network.NetworkDao}.
+     *
+     * @return the dao
+     */
+    NetworkDao getNetworkDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.network.NetworkViewDao}.
+     *
+     * @return the dao
+     */
+    NetworkViewDao getNetworkViewDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.network.NetworkClusterDao}.
+     *
+     * @return the dao
+     */
+    NetworkClusterDao getNetworkClusterDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.PermissionDAO}.
+     *
+     * @return the dao
+     */
+    PermissionDAO getPermissionDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.StorageDomainDAO}.
+     *
+     * @return the dao
+     */
+    StorageDomainDAO getStorageDomainDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.StorageDomainDAO}.
+     *
+     * @return the dao
+     */
+    StorageDomainStaticDAO getStorageDomainStaticDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.StorageDomainDAO}.
+     *
+     * @return the dao
+     */
+    StorageDomainDynamicDAO getStorageDomainDynamicDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.RepoFileMetaDataDAO}.
+     *
+     * @return Repository file meta data dao.
+     */
+    RepoFileMetaDataDAO getRepoFileMetaDataDao();
+
+    /**
+     * Retrieves the singleton instance of {@link 
org.ovirt.engine.core.dao.SnapshotDao}.
+     *
+     * @return the dao
+     */
+    SnapshotDao getSnapshotDao();
+
+    /**
+     * Retrieves the singleton instance of {@link 
org.ovirt.engine.core.dao.ImageStorageDomainMapDao}.
+     *
+     * @return the dao
+     */
+    ImageStorageDomainMapDao getImageStorageDomainMapDao();
+
+    /**
+     * Retrieves the singleton instance of {@link 
org.ovirt.engine.core.dao.StoragePoolDAO}.
+     *
+     * @return the dao
+     */
+    StoragePoolDAO getStoragePoolDao();
+
+    /**
+     * Retrieves the singleton instance of {@link 
org.ovirt.engine.core.dao.StoragePoolIsoMapDAO}.
+     *
+     * @return the dao
+     */
+    StoragePoolIsoMapDAO getStoragePoolIsoMapDao();
+
+    /**
+     * Retrieves the singleton instance of {@link 
org.ovirt.engine.core.dao.StorageServerConnectionDAO}.
+     *
+     * @return the dao
+     */
+    StorageServerConnectionDAO getStorageServerConnectionDao();
+
+    /**
+     * Retrieves the singleton instance of {@link 
org.ovirt.engine.core.dao.StorageServerConnectionLunMapDAO}.
+     *
+     * @return the dao
+     */
+    StorageServerConnectionLunMapDAO getStorageServerConnectionLunMapDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.VdcOptionDAO}.
+     *
+     * @return the dao
+     */
+    VdcOptionDAO getVdcOptionDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.BusinessEntitySnapshotDAO}.
+     *
+     * @return
+     */
+    BusinessEntitySnapshotDAO getBusinessEntitySnapshotDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.VmPoolDAO}.
+     *
+     * @return the dao
+     */
+    VmPoolDAO getVmPoolDao();
+
+    VmStaticDAO getVmStaticDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.VmStatisticsDAO}.
+     *
+     * @return the dao
+     */
+    VmStatisticsDAO getVmStatisticsDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.QuotaDAO}.
+     *
+     * @return the dao
+     */
+    QuotaDAO getQuotaDao();
+
+    VmDeviceDAO getVmDeviceDao();
+
+    /**
+     *
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.JobDao}.
+     *
+     * @return the dao
+     */
+    JobDao getJobDao();
+
+    /**
+     * Returns the singleton instance of {@link getJobSubjectEntityDao}.
+     *
+     * @return the dao
+     */
+    JobSubjectEntityDao getJobSubjectEntityDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.StepDao}.
+     *
+     * @return the dao
+     */
+    StepDao getStepDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.gluster.GlusterVolumeDao}.
+     *
+     * @return the dao
+     */
+    GlusterVolumeDao getGlusterVolumeDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.gluster.GlusterBrickDao}.
+     *
+     * @return the dao
+     */
+    GlusterBrickDao getGlusterBrickDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.gluster.GlusterOptionDao}.
+     *
+     * @return the dao
+     */
+    GlusterOptionDao getGlusterOptionDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.gluster.GlusterServiceDao}.
+     *
+     * @return the dao
+     */
+    GlusterServiceDao getGlusterServiceDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.gluster.GlusterServerServiceDao}.
+     *
+     * @return the dao
+     */
+    GlusterServerServiceDao getGlusterServerServiceDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.gluster.GlusterClusterServiceDao}.
+     *
+     * @return the dao
+     */
+    GlusterClusterServiceDao getGlusterClusterServiceDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.gluster.GlusterHooksDao}.
+     *
+     * @return the dao
+     */
+    GlusterHooksDao getGlusterHooksDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.gluster.GlusterServerDao}.
+     *
+     * @return the dao
+     */
+    GlusterServerDao getGlusterServerDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.VmGuestAgentInterfaceDao}.
+     *
+     * @return the dao
+     */
+    VmGuestAgentInterfaceDao getVmGuestAgentInterfaceDao();
+
+    NetworkQoSDao getQosDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.scheduling.PolicyUnitDao}.
+     * @return the dao
+     */
+    PolicyUnitDao getPolicyUnitDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.scheduling.ClusterPolicyDao}.
+     * @return the dao
+     */
+    ClusterPolicyDao getClusterPolicyDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.network.VnicProfileDao}.
+     *
+     * @return the dao
+     */
+    VnicProfileDao getVnicProfileDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.network.VnicProfileViewDao}.
+     *
+     * @return the dao
+     */
+    VnicProfileViewDao getVnicProfileViewDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.network.VmNicDao}.
+     *
+     * @return the dao
+     */
+    VmNicDao getVmNicDao();
+
+    /**
+     * Returns the singleton instance of {@link 
org.ovirt.engine.core.dao.scheduling.AffinityGroupDao}.
+     *
+     * @return the dao instance
+     */
+    AffinityGroupDao getAffinityGroupDao();
+}


-- 
To view, visit http://gerrit.ovirt.org/26199
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifa7e83fa6f693f8f6c4a036a0694c497a810e25e
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Martin Sivák <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to