com.espertech.esper.client
Class ConfigurationDBRef

java.lang.Object
  extended by com.espertech.esper.client.ConfigurationDBRef
All Implemented Interfaces:
java.io.Serializable

public class ConfigurationDBRef
extends java.lang.Object
implements java.io.Serializable

Container for database configuration information, such as options around getting a database connection and options to control the lifecycle of connections and set connection parameters.

See Also:
Serialized Form

Nested Class Summary
static class ConfigurationDBRef.ColumnChangeCaseEnum
          Controls how output column names get reflected in the event type.
static interface ConfigurationDBRef.ConnectionFactoryDesc
          Marker for different connection factory settings.
static class ConfigurationDBRef.ConnectionLifecycleEnum
          Enum controlling connection lifecycle.
static class ConfigurationDBRef.ConnectionSettings
          Supplies connectioon-level settings for a given database name.
static class ConfigurationDBRef.DataSourceConnection
          Connection factory settings for using a DataSource.
static class ConfigurationDBRef.DataSourceFactory
          Connection factory settings for using a Apache DBCP or other provider DataSource factory.
static class ConfigurationDBRef.DriverManagerConnection
          Connection factory settings for using a DriverManager.
static class ConfigurationDBRef.MetadataOriginEnum
          Indicates how the engine retrieves metadata about a statement's output columns.
 
Constructor Summary
ConfigurationDBRef()
          Ctor.
 
Method Summary
 void addSqlTypesBinding(int sqlType, java.lang.Class javaTypeName)
          Adds a mapping of a java.sql.Types type to a Java type.
 void addSqlTypesBinding(int sqlType, java.lang.String javaTypeName)
          Adds a mapping of a java.sql.Types type to a Java type.
 ConfigurationDBRef.ColumnChangeCaseEnum getColumnChangeCase()
          Returns enum value determining how the engine changes case on output column names returned from statement or statement result set metadata.
 ConfigurationDBRef.ConnectionFactoryDesc getConnectionFactoryDesc()
          Returns the descriptor controlling connection creation settings.
 ConfigurationDBRef.ConnectionLifecycleEnum getConnectionLifecycleEnum()
          Returns the setting to control whether a new connection is obtained for each lookup, or connections are retained between lookups.
 ConfigurationDBRef.ConnectionSettings getConnectionSettings()
          Returns the connection settings for this database.
 ConfigurationDataCache getDataCacheDesc()
          Return a query result data cache descriptor.
 ConfigurationDBRef.MetadataOriginEnum getMetadataRetrievalEnum()
          Returns an enumeration indicating how the engine retrieves metadata about the columns that a given SQL query returns.
 java.util.Map<java.lang.Integer,java.lang.String> getSqlTypesMapping()
          Returns the mapping of types that the engine must perform when receiving output columns of that sql types.
 void setColumnChangeCase(ConfigurationDBRef.ColumnChangeCaseEnum columnChangeCaseEnum)
          Sets enum value determining how the engine should change case on output column names returned from statement or statement result set metadata.
 void setConnectionAutoCommit(boolean value)
          Sets the auto-commit connection settings for new connections to this database.
 void setConnectionCatalog(java.lang.String catalog)
          Sets the catalog name for new connections created for this database.
 void setConnectionLifecycleEnum(ConfigurationDBRef.ConnectionLifecycleEnum connectionLifecycleEnum)
          Controls whether a new connection is obtained for each lookup, or connections are retained between lookups.
 void setConnectionReadOnly(boolean isReadOnly)
          Sets the read-only flag on new connections created for this database.
 void setConnectionTransactionIsolation(int value)
          Sets the transaction isolation level on new connections created for this database.
 void setDataSourceConnection(java.lang.String contextLookupName, java.util.Properties environmentProps)
          Sets the connection factory to use DataSource to obtain a connection.
 void setDataSourceFactory(java.util.Properties properties, java.lang.String dataSourceFactoryClassName)
          Set the connection factory to use a factory class that provides an instance of DataSource.
 void setDriverManagerConnection(java.lang.String className, java.lang.String url, java.util.Properties connectionArgs)
          Sets the connection factory to use DriverManager to obtain a connection.
 void setDriverManagerConnection(java.lang.String className, java.lang.String url, java.lang.String username, java.lang.String password)
          Sets the connection factory to use DriverManager to obtain a connection.
 void setDriverManagerConnection(java.lang.String className, java.lang.String url, java.lang.String username, java.lang.String password, java.util.Properties connectionArgs)
          Sets the connection factory to use DriverManager to obtain a connection.
 void setExpiryTimeCache(double maxAgeSeconds, double purgeIntervalSeconds)
          Configures an expiry-time cache of the given maximum age in seconds and purge interval in seconds.
 void setExpiryTimeCache(double maxAgeSeconds, double purgeIntervalSeconds, ConfigurationCacheReferenceType cacheReferenceType)
          Configures an expiry-time cache of the given maximum age in seconds and purge interval in seconds.
 void setLRUCache(int size)
          Configures a LRU cache of the given size for the database.
 void setMetadataOrigin(ConfigurationDBRef.MetadataOriginEnum metadataOrigin)
          Sets and indicator how the engine should retrieve metadata about the columns that a given SQL query returns.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurationDBRef

public ConfigurationDBRef()
Ctor.

Method Detail

setDataSourceFactory

public void setDataSourceFactory(java.util.Properties properties,
                                 java.lang.String dataSourceFactoryClassName)
Set the connection factory to use a factory class that provides an instance of DataSource.

This method is designed for use with Apache Commons DBCP and its BasicDataSourceFactory but can also work for any application-provided factory for DataSource instances.

When using Apache DBCP, specify BasicDataSourceFactory.class.getName() as the class name and populate all properties that Apache DBCP takes for connection pool configuration.

When using an application-provided data source factory, pass the class name of a class that provides a public static method createDataSource(Properties properties) returning DataSource.

Parameters:
dataSourceFactoryClassName - the classname of the data source factory
properties - passed to the createDataSource method of the data source factory class

setDataSourceConnection

public void setDataSourceConnection(java.lang.String contextLookupName,
                                    java.util.Properties environmentProps)
Sets the connection factory to use DataSource to obtain a connection.

Parameters:
contextLookupName - is the object name to look up via InitialContext
environmentProps - are the optional properties to pass to the context

setDriverManagerConnection

public void setDriverManagerConnection(java.lang.String className,
                                       java.lang.String url,
                                       java.util.Properties connectionArgs)
Sets the connection factory to use DriverManager to obtain a connection.

Parameters:
className - is the driver class name to lookup up via Class.forName
url - is the URL
connectionArgs - are optional connection arguments

setDriverManagerConnection

public void setDriverManagerConnection(java.lang.String className,
                                       java.lang.String url,
                                       java.lang.String username,
                                       java.lang.String password)
Sets the connection factory to use DriverManager to obtain a connection.

Parameters:
className - is the driver class name to lookup up via Class.forName
url - is the URL
username - is the username to obtain a connection
password - is the password to obtain a connection

setDriverManagerConnection

public void setDriverManagerConnection(java.lang.String className,
                                       java.lang.String url,
                                       java.lang.String username,
                                       java.lang.String password,
                                       java.util.Properties connectionArgs)
Sets the connection factory to use DriverManager to obtain a connection.

Parameters:
className - is the driver class name to lookup up via Class.forName
url - is the URL
username - is the username to obtain a connection
password - is the password to obtain a connection
connectionArgs - are optional connection arguments

setConnectionAutoCommit

public void setConnectionAutoCommit(boolean value)
Sets the auto-commit connection settings for new connections to this database.

Parameters:
value - is true to set auto-commit to true, or false to set auto-commit to false, or null to accepts the default

setConnectionTransactionIsolation

public void setConnectionTransactionIsolation(int value)
Sets the transaction isolation level on new connections created for this database.

Parameters:
value - is the transaction isolation level

setConnectionReadOnly

public void setConnectionReadOnly(boolean isReadOnly)
Sets the read-only flag on new connections created for this database.

Parameters:
isReadOnly - is the read-only flag

setConnectionCatalog

public void setConnectionCatalog(java.lang.String catalog)
Sets the catalog name for new connections created for this database.

Parameters:
catalog - is the catalog name

getConnectionSettings

public ConfigurationDBRef.ConnectionSettings getConnectionSettings()
Returns the connection settings for this database.

Returns:
connection settings

getConnectionLifecycleEnum

public ConfigurationDBRef.ConnectionLifecycleEnum getConnectionLifecycleEnum()
Returns the setting to control whether a new connection is obtained for each lookup, or connections are retained between lookups.

Returns:
enum controlling connection allocation

setConnectionLifecycleEnum

public void setConnectionLifecycleEnum(ConfigurationDBRef.ConnectionLifecycleEnum connectionLifecycleEnum)
Controls whether a new connection is obtained for each lookup, or connections are retained between lookups.

Parameters:
connectionLifecycleEnum - is an enum controlling connection allocation

getConnectionFactoryDesc

public ConfigurationDBRef.ConnectionFactoryDesc getConnectionFactoryDesc()
Returns the descriptor controlling connection creation settings.

Returns:
connection factory settings

setLRUCache

public void setLRUCache(int size)
Configures a LRU cache of the given size for the database.

Parameters:
size - is the maximum number of entries before query results are evicted

setExpiryTimeCache

public void setExpiryTimeCache(double maxAgeSeconds,
                               double purgeIntervalSeconds)
Configures an expiry-time cache of the given maximum age in seconds and purge interval in seconds.

Specifies the cache reference type to be weak references. Weak reference cache entries become eligible for garbage collection and are removed from cache when the garbage collection requires so.

Parameters:
maxAgeSeconds - is the maximum number of seconds before a query result is considered stale (also known as time-to-live)
purgeIntervalSeconds - is the interval at which the engine purges stale data from the cache

setExpiryTimeCache

public void setExpiryTimeCache(double maxAgeSeconds,
                               double purgeIntervalSeconds,
                               ConfigurationCacheReferenceType cacheReferenceType)
Configures an expiry-time cache of the given maximum age in seconds and purge interval in seconds. Also allows setting the reference type indicating whether garbage collection may remove entries from cache.

Parameters:
maxAgeSeconds - is the maximum number of seconds before a query result is considered stale (also known as time-to-live)
purgeIntervalSeconds - is the interval at which the engine purges stale data from the cache
cacheReferenceType - specifies the reference type to use

getDataCacheDesc

public ConfigurationDataCache getDataCacheDesc()
Return a query result data cache descriptor.

Returns:
cache descriptor

getMetadataRetrievalEnum

public ConfigurationDBRef.MetadataOriginEnum getMetadataRetrievalEnum()
Returns an enumeration indicating how the engine retrieves metadata about the columns that a given SQL query returns.

The engine requires to retrieve result column names and types in order to build a resulting event type and perform expression type checking.

Returns:
indication how to retrieve metadata

setMetadataOrigin

public void setMetadataOrigin(ConfigurationDBRef.MetadataOriginEnum metadataOrigin)
Sets and indicator how the engine should retrieve metadata about the columns that a given SQL query returns.

The engine requires to retrieve result column names and types in order to build a resulting event type and perform expression type checking.

Parameters:
metadataOrigin - indication how to retrieve metadata

getColumnChangeCase

public ConfigurationDBRef.ColumnChangeCaseEnum getColumnChangeCase()
Returns enum value determining how the engine changes case on output column names returned from statement or statement result set metadata.

Returns:
change case enums

setColumnChangeCase

public void setColumnChangeCase(ConfigurationDBRef.ColumnChangeCaseEnum columnChangeCaseEnum)
Sets enum value determining how the engine should change case on output column names returned from statement or statement result set metadata.

Parameters:
columnChangeCaseEnum - change case enums

addSqlTypesBinding

public void addSqlTypesBinding(int sqlType,
                               java.lang.String javaTypeName)
Adds a mapping of a java.sql.Types type to a Java type.

The mapping dictates to the engine how the output column should be represented as a Java Object.

Accepts a Java classname (fully-qualified or simple) or primitive type name for the Java type parameter. See DatabaseTypeEnum for valid values for the java type name.

Parameters:
sqlType - is a java.sql.Types constant, for which output columns are converted to java type
javaTypeName - is a Java class name

addSqlTypesBinding

public void addSqlTypesBinding(int sqlType,
                               java.lang.Class javaTypeName)
Adds a mapping of a java.sql.Types type to a Java type.

The mapping dictates to the engine how the output column should be represented as a Java Object.

Accepts a Java class for the Java type parameter. See DatabaseTypeEnum for valid values.

Parameters:
sqlType - is a java.sql.Types constant, for which output columns are converted to java type
javaTypeName - is a Java class

getSqlTypesMapping

public java.util.Map<java.lang.Integer,java.lang.String> getSqlTypesMapping()
Returns the mapping of types that the engine must perform when receiving output columns of that sql types.

Returns:
map of Types types to Java types

© 2006-2015 EsperTech Inc.
All rights reserved.
Visit us at espertech.com