Package com.softslate.commerce.daos.core
Interface DAOFactory
- All Known Implementing Classes:
BaseDAOFactory
,HibernateDAOFactory
public interface DAOFactory
- Author:
- David Tobey
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
void
<T> T
Creates and initializes a data access object for use by the application.createDAOFromClassName
(String className) Creates and initializes a data access object for use by the application using the incoming class name.void
Retrieves this factory's component settings.Retrieves this factory's default component settings.Retrieves this factory's application settings; the current application settings for the system.Retrieves this factory's Hibernate settings.com.google.inject.Injector
Retrieves theInjector
previously set for this factory.Used in 1.x with com.softslate.commerce.daos.core.LegacyDAOFactory, which is replaced in 2.x with theHibernateDAOFactory
.org.hibernate.Session
org.hibernate.SessionFactory
Retrieves this factory's HibernateSessionFactory
.Retrieves this factory'sSettings
instance.void
Initializes thisDAOFactory
.void
void
void
setAppComponents
(Properties appComponents) void
setAppComponentsDefaults
(Properties appComponentsDefaults) void
setAppSettings
(Properties appSettings) void
setDatabaseType
(String databaseType) void
setHibernateSettings
(Properties hibernateSettings) void
setInjector
(com.google.inject.Injector injector) Sets this factory'sInjector
.void
setSessionFactory
(org.hibernate.SessionFactory sessionFactory) void
setSettings
(Settings settings) org.hibernate.Session
-
Method Details
-
getJndiDataSource
Used in 1.x with com.softslate.commerce.daos.core.LegacyDAOFactory, which is replaced in 2.x with theHibernateDAOFactory
. Also used in the 1.x to 2.x upgrade process (which is why it is not deprecated).- Throws:
Exception
-
getDatabaseType
String getDatabaseType() -
setDatabaseType
-
getSettings
Settings getSettings()Retrieves this factory'sSettings
instance. The currentSettings
, containing various settings to be used by DAOs created by this factory. This factory will pass theSettings
to every object it creates. -
setSettings
-
getAppComponents
Properties getAppComponents()Retrieves this factory's component settings. The component settings identify which Java class implement the various Interfaces used by the system. -
setAppComponents
-
getAppComponentsDefaults
Properties getAppComponentsDefaults()Retrieves this factory's default component settings. The component settings identify which Java class implement the various Interfaces used by the system. -
setAppComponentsDefaults
-
getAppSettings
Properties getAppSettings()Retrieves this factory's application settings; the current application settings for the system. This factory will pass the application settings to every DAO it creates. The application settings are settings for information unique to a given installation, such as the location of files on the server, as opposed to theSettings
instance, which stores settings drawn from the database. -
setAppSettings
-
getHibernateSettings
Properties getHibernateSettings()Retrieves this factory's Hibernate settings. The Hibernate settings are explicitly set for the HibernateDAOFactory before it is initialized, so that they can be changed after the installer tool is run. -
setHibernateSettings
-
getInjector
com.google.inject.Injector getInjector()Retrieves theInjector
previously set for this factory.- Returns:
- A
Injector
object that can be used to create other objects and inject them with dependencies.
-
setInjector
void setInjector(com.google.inject.Injector injector) Sets this factory'sInjector
. This factory will pass theInjector
to every business object it creates.- Parameters:
injector
- The currentInjector
for the system, which can be used to create other objects and inject them with dependencies.
-
getSessionFactory
org.hibernate.SessionFactory getSessionFactory()Retrieves this factory's HibernateSessionFactory
. -
setSessionFactory
void setSessionFactory(org.hibernate.SessionFactory sessionFactory) -
initialize
Initializes thisDAOFactory
. Called byBaseRequestProcessor
.- Throws:
Exception
-
createDAO
Creates and initializes a data access object for use by the application. Uses theappSettings
property to look up the fully-qualified class name of the requested data access object.Immediately after instantiating the requested DAO, this factory passes its own properties to it so that the newly created object can use them to communicate with the rest of the application.
- Parameters:
type
- AString
associated with the class name of the data access object to be created.- Returns:
- An instantiated and initialized data access object, or
null
if initialization failed. - Throws:
Exception
-
createDAOFromClassName
Creates and initializes a data access object for use by the application using the incoming class name.Immediately after instantiating the requested DAO, this factory passes its own properties to it so that the newly created object can use them to communicate with the rest of the application.
- Parameters:
className
- AString
representing the class name of the data access object to be created.- Returns:
- An instantiated and initialized data access object, or
null
if initialization failed. - Throws:
Exception
-
createDAO
-
startSession
org.hibernate.Session startSession() -
getSession
org.hibernate.Session getSession() -
closeSession
void closeSession() -
beginTransaction
void beginTransaction() -
commitTransaction
void commitTransaction() throws org.hibernate.HibernateException- Throws:
org.hibernate.HibernateException
-
rollbackTransactionKeepingSessionOpen
void rollbackTransactionKeepingSessionOpen() -
rollbackTransaction
void rollbackTransaction() -
evictCache
void evictCache()
-