Interface DAOFactory

All Known Implementing Classes:
BaseDAOFactory, HibernateDAOFactory

public interface DAOFactory
Author:
David Tobey
  • Method Details

    • getJndiDataSource

      DataSource getJndiDataSource() throws 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:
      Exception
    • getDatabaseType

      String getDatabaseType()
    • setDatabaseType

      void setDatabaseType(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

      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(Properties appComponents)
    • 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

      void setAppComponentsDefaults(Properties appComponentsDefaults)
    • 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 the Settings instance, which stores settings drawn from the database.
    • setAppSettings

      void setAppSettings(Properties appSettings)
    • 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

      void setHibernateSettings(Properties hibernateSettings)
    • getInjector

      com.google.inject.Injector getInjector()
      Retrieves the Injector 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's Injector. This factory will pass the Injector to every business object it creates.
      Parameters:
      injector - The current Injector 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 Hibernate SessionFactory.
    • setSessionFactory

      void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
    • initialize

      void initialize() throws Exception
      Initializes this DAOFactory. Called by BaseRequestProcessor.
      Throws:
      Exception
    • createDAO

      Object createDAO(String type) throws 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:
      Exception
    • createDAOFromClassName

      Object createDAOFromClassName(String className) throws 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:
      Exception
    • createDAO

      <T> T createDAO(Class<T> type)
    • 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()