com.softslate.commerce.daos.core
Interface DAOFactory

All Known Implementing Classes:
BaseDAOFactory, HibernateDAOFactory

public interface DAOFactory

Author:
David Tobey

Method Summary
 void beginTransaction()
           
 void closeSession()
           
 void commitTransaction()
           
 java.lang.Object createDAO(java.lang.String type)
          Creates and initializes a data access object for use by the application.
 java.lang.Object createDAOFromClassName(java.lang.String className)
          Creates and initializes a data access object for use by the application using the incoming class name.
 void evictCache()
           
 java.util.Properties getAppComponents()
          Retrieves this factory's component settings.
 java.util.Properties getAppComponentsDefaults()
          Retrieves this factory's default component settings.
 java.util.Properties getAppSettings()
          Retrieves this factory's application settings; the current application settings for the system.
 java.lang.String getDatabaseType()
           
 java.util.Properties getHibernateSettings()
          Retrieves this factory's Hibernate settings.
 javax.sql.DataSource getJndiDataSource()
          Used in 1.x with com.softslate.commerce.daos.core.LegacyDAOFactory, which is replaced in 2.x with the HibernateDAOFactory.
 org.hibernate.Session getSession()
           
 org.hibernate.SessionFactory getSessionFactory()
          Retrieves this factory's Hibernate SessionFactory.
 Settings getSettings()
          Retrieves this factory's Settings instance.
 void initialize()
          Initializes this DAOFactory.
 void rollbackTransaction()
           
 void setAppComponents(java.util.Properties appComponents)
           
 void setAppComponentsDefaults(java.util.Properties appComponentsDefaults)
           
 void setAppSettings(java.util.Properties appSettings)
           
 void setDatabaseType(java.lang.String databaseType)
           
 void setHibernateSettings(java.util.Properties hibernateSettings)
           
 void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
           
 void setSettings(Settings settings)
           
 org.hibernate.Session startSession()
           
 

Method Detail

getJndiDataSource

javax.sql.DataSource getJndiDataSource()
                                       throws java.lang.Exception
Used in 1.x with com.softslate.commerce.daos.core.LegacyDAOFactory, which is replaced in 2.x with the HibernateDAOFactory. Also used in the 1.x to 2.x upgrade process (which is why it is not deprecated).

Throws:
java.lang.Exception

getDatabaseType

java.lang.String getDatabaseType()

setDatabaseType

void setDatabaseType(java.lang.String databaseType)

getSettings

Settings getSettings()
Retrieves this factory's Settings instance. The current Settings, containing various settings to be used by DAOs created by this factory. This factory will pass the Settings to every object it creates.


setSettings

void setSettings(Settings settings)

getAppComponents

java.util.Properties getAppComponents()
Retrieves this factory's component settings. The component settings identify which Java class implement the various Interfaces used by the system.


setAppComponents

void setAppComponents(java.util.Properties appComponents)

getAppComponentsDefaults

java.util.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

void setAppComponentsDefaults(java.util.Properties appComponentsDefaults)

getAppSettings

java.util.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 the Settings instance, which stores settings drawn from the database.


setAppSettings

void setAppSettings(java.util.Properties appSettings)

getHibernateSettings

java.util.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

void setHibernateSettings(java.util.Properties hibernateSettings)

getSessionFactory

org.hibernate.SessionFactory getSessionFactory()
Retrieves this factory's Hibernate SessionFactory.


setSessionFactory

void setSessionFactory(org.hibernate.SessionFactory sessionFactory)

initialize

void initialize()
                throws java.lang.Exception
Initializes this DAOFactory. Called by BaseRequestProcessor.

Throws:
java.lang.Exception

createDAO

java.lang.Object createDAO(java.lang.String type)
                           throws java.lang.Exception
Creates and initializes a data access object for use by the application. Uses the appSettings 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 - A String 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:
java.lang.Exception

createDAOFromClassName

java.lang.Object createDAOFromClassName(java.lang.String className)
                                        throws java.lang.Exception
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 - A String 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:
java.lang.Exception

startSession

org.hibernate.Session startSession()

getSession

org.hibernate.Session getSession()

closeSession

void closeSession()

beginTransaction

void beginTransaction()

commitTransaction

void commitTransaction()

rollbackTransaction

void rollbackTransaction()

evictCache

void evictCache()


Copyright © SoftSlate, LLC 2003–2005