Class 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.
    • Constructor Detail

      • SimpleDataSourceFactory

        public SimpleDataSourceFactory()
    • Method Detail

      • 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