Package com.softslate.commerce.daos.core
Interface DAOFactory
- All Known Implementing Classes:
BaseDAOFactory,HibernateDAOFactory
public interface DAOFactory
- Author:
- David Tobey
-
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoid<T> TCreates 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.voidRetrieves 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.InjectorRetrieves theInjectorpreviously 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.Sessionorg.hibernate.SessionFactoryRetrieves this factory's HibernateSessionFactory.Retrieves this factory'sSettingsinstance.voidInitializes thisDAOFactory.voidvoidvoidsetAppComponents(Properties appComponents) voidsetAppComponentsDefaults(Properties appComponentsDefaults) voidsetAppSettings(Properties appSettings) voidsetDatabaseType(String databaseType) voidsetHibernateSettings(Properties hibernateSettings) voidsetInjector(com.google.inject.Injector injector) Sets this factory'sInjector.voidsetSessionFactory(org.hibernate.SessionFactory sessionFactory) voidsetSettings(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'sSettingsinstance. The currentSettings, containing various settings to be used by DAOs created by this factory. This factory will pass theSettingsto 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 theSettingsinstance, 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 theInjectorpreviously set for this factory.- Returns:
- A
Injectorobject 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 theInjectorto every business object it creates.- Parameters:
injector- The currentInjectorfor 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 theappSettingsproperty 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- AStringassociated with the class name of the data access object to be created.- Returns:
- An instantiated and initialized data access object, or
nullif 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- AStringrepresenting the class name of the data access object to be created.- Returns:
- An instantiated and initialized data access object, or
nullif 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()
-