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
Fields Modifier and Type Field Description static String
DB_CONNECTION_URL
The connection parameter containing the connection URLstatic String
DB_PASSWORD
The connection parameter containing the DB passwordstatic String
DB_USERNAME
The connection parameter containing the DB user namestatic String
DB_VENDOR
The connection parameter containing the DB vendorstatic String
DB_VENDOR_H2
The DB vendor string for H2 databasesstatic String
DB_VENDOR_MYSQL
The DB vendor string for MySQL databasesstatic String
DB_VENDOR_ORACLE
The DB vendor string for Oracle databasesstatic String
DB_VENDOR_SQLSERVER
The DB vendor string for MS SQL Server databases
-
Constructor Summary
Constructors Constructor Description SimpleDataSourceFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DataSource
getDataSource(org.apache.cayenne.configuration.DataNodeDescriptor nodeDescriptor)
Returns DataSource object based on the configuration provided in the "nodeDescriptor".String
getDbVendor()
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 Detail
-
DB_VENDOR
public static final String DB_VENDOR
The connection parameter containing the DB vendor- See Also:
- Constant Field Values
-
DB_CONNECTION_URL
public static final String DB_CONNECTION_URL
The connection parameter containing the connection URL- See Also:
- Constant Field Values
-
DB_USERNAME
public static final String DB_USERNAME
The connection parameter containing the DB user name- See Also:
- Constant Field Values
-
DB_PASSWORD
public static final String DB_PASSWORD
The connection parameter containing the DB password- See Also:
- Constant Field Values
-
DB_VENDOR_MYSQL
public static final String DB_VENDOR_MYSQL
The DB vendor string for MySQL databases- See Also:
- Constant Field Values
-
DB_VENDOR_SQLSERVER
public static final String DB_VENDOR_SQLSERVER
The DB vendor string for MS SQL Server databases- See Also:
- Constant Field Values
-
DB_VENDOR_ORACLE
public static final String DB_VENDOR_ORACLE
The DB vendor string for Oracle databases- See Also:
- Constant Field Values
-
DB_VENDOR_H2
public static final String DB_VENDOR_H2
The DB vendor string for H2 databases- See Also:
- Constant Field Values
-
-
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 interfaceorg.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
-
-