Class ExoDatasource

java.lang.Object
org.exoplatform.services.database.ExoDatasource

public class ExoDatasource extends Object
Created by The eXo Platform SAS Author : Tuan Nguyen tuan08@users.sourceforge.net Apr 4, 2006 This class is a wrapper class for the java.sql.Datasource class. In additional to the java.sql.Datasourcemethod such getConnection(). The ExoDatasource provides 2 other methods: DBTableManager getDBTableManager and IDGenerator getIDGenerator()
  • Field Details

  • Constructor Details

    • ExoDatasource

      public ExoDatasource(DataSource ds) throws Exception
      The constructor should: 1. Keep track of the datasource object 2. Create the DBTableManager object base on the datasource information such database type, version 3. Create an IDGenerator for the datasource
      Parameters:
      ds -
      Throws:
      Exception
  • Method Details

    • getDatasource

      public DataSource getDatasource()
      This method should return the real Datasource object
      Returns:
    • getConnection

      public Connection getConnection() throws Exception
      This method should call the datasource getConnection method and return the Connection object. The developer can add some debug code or broadcast an event here.
      Returns:
      Throws:
      Exception
    • closeConnection

      public void closeConnection(Connection conn) throws Exception
      This method should delegate to the method close of the Connection object. The developer can add debug or broadcast an event here.
      Parameters:
      conn -
      Throws:
      Exception
    • commit

      public void commit(Connection conn) throws Exception
      This method should delegate to the commit() method of the Connection object. The developer can add the debug code here
      Parameters:
      conn -
      Throws:
      Exception
    • getDBTableManager

      public DBTableManager getDBTableManager()
      This method should return the DBTableManager object. The DBTableManager object should be initialized in the constructor according to the database type and version
      Returns:
    • getIDGenerator

      public IDGenerator getIDGenerator()
      This method should return the IDGenerator object, the developer can use the id generator to generate an unique long id for an db object
      Returns:
    • getDatabaseType

      public int getDatabaseType()
    • getDatabaseName

      public String getDatabaseName()
    • getDatabaseVersion

      public String getDatabaseVersion()
    • getQueryBuilder

      public QueryBuilder getQueryBuilder()