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 Summary
Modifier and TypeFieldDescriptionstatic final String
The connection parameter containing the connection URLstatic final String
The connection parameter containing the DB passwordstatic final String
The connection parameter containing the DB user namestatic final String
The connection parameter containing the DB vendorstatic final String
The DB vendor string for H2 databasesstatic final String
The DB vendor string for MySQL databasesstatic final String
The DB vendor string for Oracle databasesstatic final String
The DB vendor string for MS SQL Server databases -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetDataSource
(org.apache.cayenne.configuration.DataNodeDescriptor nodeDescriptor) Returns DataSource object based on the configuration provided in the "nodeDescriptor".Return the currently configured DB vendor stringvoid
initialize
(File appserverDirectory, String jndiName) Initialize using the JNDI configuration stored in an app server.void
initialize
(Map<String, String> connectionParameters) Initialize using the given connection parameters
-
Field Details
-
DB_VENDOR
The connection parameter containing the DB vendor- See Also:
-
DB_CONNECTION_URL
The connection parameter containing the connection URL- See Also:
-
DB_USERNAME
The connection parameter containing the DB user name- See Also:
-
DB_PASSWORD
The connection parameter containing the DB password- See Also:
-
DB_VENDOR_MYSQL
The DB vendor string for MySQL databases- See Also:
-
DB_VENDOR_SQLSERVER
The DB vendor string for MS SQL Server databases- See Also:
-
DB_VENDOR_ORACLE
The DB vendor string for Oracle databases- See Also:
-
DB_VENDOR_H2
The DB vendor string for H2 databases- See Also:
-
-
Constructor Details
-
SimpleDataSourceFactory
public SimpleDataSourceFactory()
-
-
Method Details
-
initialize
Initialize using the given connection parameters- Parameters:
connectionParameters
- the map of connection parameters
-
initialize
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 interfaceorg.apache.cayenne.configuration.server.DataSourceFactory
- Parameters:
nodeDescriptor
- the node descriptor- Returns:
- a data source instance
- Throws:
Exception
- if an error occurs
-
getDbVendor
Return the currently configured DB vendor string- Returns:
- the DB vendor string
-