Class SimpleDataSourceFactory

java.lang.Object
com.avoka.core.service.initialization.SimpleDataSourceFactory
All Implemented Interfaces:
org.apache.cayenne.configuration.server.DataSourceFactory

public class SimpleDataSourceFactory extends Object implements org.apache.cayenne.configuration.server.DataSourceFactory
Provides a simple JDBC DataSource factory class to be used by the database version management service.
  • Field Details

    • DB_VENDOR

      public static final String DB_VENDOR
      The connection parameter containing the DB vendor
      See Also:
    • DB_CONNECTION_URL

      public static final String DB_CONNECTION_URL
      The connection parameter containing the connection URL
      See Also:
    • DB_USERNAME

      public static final String DB_USERNAME
      The connection parameter containing the DB user name
      See Also:
    • DB_PASSWORD

      public static final String DB_PASSWORD
      The connection parameter containing the DB password
      See Also:
    • DB_VENDOR_MYSQL

      public static final String DB_VENDOR_MYSQL
      The DB vendor string for MySQL databases
      See Also:
    • DB_VENDOR_SQLSERVER

      public static final String DB_VENDOR_SQLSERVER
      The DB vendor string for MS SQL Server databases
      See Also:
    • DB_VENDOR_ORACLE

      public static final String DB_VENDOR_ORACLE
      The DB vendor string for Oracle databases
      See Also:
    • DB_VENDOR_H2

      public static final String DB_VENDOR_H2
      The DB vendor string for H2 databases
      See Also:
  • Constructor Details

    • SimpleDataSourceFactory

      public SimpleDataSourceFactory()
  • Method Details

    • initialize

      public void initialize(Map<String,String> connectionParameters)
      Initialize using the given connection parameters
      Parameters:
      connectionParameters - the map of connection parameters
    • initialize

      public void initialize(File appserverDirectory, String jndiName)
      Initialize using the JNDI configuration stored in an app server.
      Parameters:
      appserverDirectory - the TM app server directory (required)
      jndiName - the JDNI name to read the configuration from (required)
    • getDataSource

      public DataSource getDataSource(org.apache.cayenne.configuration.DataNodeDescriptor nodeDescriptor) throws Exception
      Returns DataSource object based on the configuration provided in the "nodeDescriptor". Note: This particular implementation does not use the node descriptor. Instead, the current connection parameters are used.
      Specified by:
      getDataSource in interface org.apache.cayenne.configuration.server.DataSourceFactory
      Parameters:
      nodeDescriptor - the node descriptor
      Returns:
      a data source instance
      Throws:
      Exception - if an error occurs
    • getDbVendor

      public String getDbVendor()
      Return the currently configured DB vendor string
      Returns:
      the DB vendor string