org.dbunit.database
Class DatabaseConfig

java.lang.Object
  extended by org.dbunit.database.DatabaseConfig

public class DatabaseConfig
extends Object

Configuration used by the DatabaseConnection.

Since:
2.0
Version:
$Revision: 1193 $ $Date: 2010-06-29 16:01:46 -0500 (Tue, 29 Jun 2010) $
Author:
manuel.laflamme, gommma (gommma AT users.sourceforge.net), Last changed by: $Author: gommma $

Nested Class Summary
static class DatabaseConfig.ConfigProperty
           
protected static class DatabaseConfig.Configurator
          Sets parameters stored in the DatabaseConfig on specific java objects like Statement.
 
Field Summary
static String[] ALL_FEATURES
          Deprecated. since 2.4.7 Use the ALL_PROPERTIES where features are listed now as well
static DatabaseConfig.ConfigProperty[] ALL_PROPERTIES
          A list of all properties as DatabaseConfig.ConfigProperty objects.
static String FEATURE_BATCHED_STATEMENTS
           
static String FEATURE_CASE_SENSITIVE_TABLE_NAMES
           
static String FEATURE_DATATYPE_WARNING
           
static String FEATURE_QUALIFIED_TABLE_NAMES
           
static String FEATURE_SKIP_ORACLE_RECYCLEBIN_TABLES
           
static String PROPERTY_BATCH_SIZE
           
static String PROPERTY_DATATYPE_FACTORY
           
static String PROPERTY_ESCAPE_PATTERN
           
static String PROPERTY_FETCH_SIZE
           
static String PROPERTY_METADATA_HANDLER
           
static String PROPERTY_PRIMARY_KEY_FILTER
           
static String PROPERTY_RESULTSET_TABLE_FACTORY
           
static String PROPERTY_STATEMENT_FACTORY
           
static String PROPERTY_TABLE_TYPE
           
 
Constructor Summary
DatabaseConfig()
           
 
Method Summary
protected  void checkObjectAllowed(String property, Object value)
          Checks whether the given value has the correct java type for the given property.
static DatabaseConfig.ConfigProperty findByName(String property)
          Searches the DatabaseConfig.ConfigProperty object for the property with the given name
static DatabaseConfig.ConfigProperty findByShortName(String propShortName)
          Searches the DatabaseConfig.ConfigProperty object for the property with the given name
protected  DatabaseConfig.Configurator getConfigurator()
           
 boolean getFeature(String name)
          Deprecated. since 2.4.7 Use the getProperty(String) where features are listed now as well
 Object getProperty(String name)
          Look up the value of a property.
 void setFeature(String name, boolean value)
          Deprecated. since 2.4.7 Use the setProperty(String, Object) also for features
 void setPropertiesByString(Properties stringProperties)
          Sets the given properties on the DatabaseConfig instance using the given String values.
 void setProperty(String name, Object value)
          Set the value of a property.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROPERTY_STATEMENT_FACTORY

public static final String PROPERTY_STATEMENT_FACTORY
See Also:
Constant Field Values

PROPERTY_RESULTSET_TABLE_FACTORY

public static final String PROPERTY_RESULTSET_TABLE_FACTORY
See Also:
Constant Field Values

PROPERTY_DATATYPE_FACTORY

public static final String PROPERTY_DATATYPE_FACTORY
See Also:
Constant Field Values

PROPERTY_ESCAPE_PATTERN

public static final String PROPERTY_ESCAPE_PATTERN
See Also:
Constant Field Values

PROPERTY_TABLE_TYPE

public static final String PROPERTY_TABLE_TYPE
See Also:
Constant Field Values

PROPERTY_PRIMARY_KEY_FILTER

public static final String PROPERTY_PRIMARY_KEY_FILTER
See Also:
Constant Field Values

PROPERTY_BATCH_SIZE

public static final String PROPERTY_BATCH_SIZE
See Also:
Constant Field Values

PROPERTY_FETCH_SIZE

public static final String PROPERTY_FETCH_SIZE
See Also:
Constant Field Values

PROPERTY_METADATA_HANDLER

public static final String PROPERTY_METADATA_HANDLER
See Also:
Constant Field Values

FEATURE_CASE_SENSITIVE_TABLE_NAMES

public static final String FEATURE_CASE_SENSITIVE_TABLE_NAMES
See Also:
Constant Field Values

FEATURE_QUALIFIED_TABLE_NAMES

public static final String FEATURE_QUALIFIED_TABLE_NAMES
See Also:
Constant Field Values

FEATURE_BATCHED_STATEMENTS

public static final String FEATURE_BATCHED_STATEMENTS
See Also:
Constant Field Values

FEATURE_DATATYPE_WARNING

public static final String FEATURE_DATATYPE_WARNING
See Also:
Constant Field Values

FEATURE_SKIP_ORACLE_RECYCLEBIN_TABLES

public static final String FEATURE_SKIP_ORACLE_RECYCLEBIN_TABLES
See Also:
Constant Field Values

ALL_PROPERTIES

public static final DatabaseConfig.ConfigProperty[] ALL_PROPERTIES
A list of all properties as DatabaseConfig.ConfigProperty objects. The objects contain the allowed java type and whether or not a property is nullable.


ALL_FEATURES

public static final String[] ALL_FEATURES
Deprecated. since 2.4.7 Use the ALL_PROPERTIES where features are listed now as well
A list of all features as strings

Constructor Detail

DatabaseConfig

public DatabaseConfig()
Method Detail

getConfigurator

protected DatabaseConfig.Configurator getConfigurator()
Returns:
The configurator of this database config

setFeature

public void setFeature(String name,
                       boolean value)
Deprecated. since 2.4.7 Use the setProperty(String, Object) also for features

Set the value of a feature flag.

Parameters:
name - the feature id
value - the feature status

getFeature

public boolean getFeature(String name)
Deprecated. since 2.4.7 Use the getProperty(String) where features are listed now as well

Look up the value of a feature flag.

Parameters:
name - the feature id
Returns:
the feature status

setProperty

public void setProperty(String name,
                        Object value)
Set the value of a property.

Parameters:
name - the property id
value - the property value

getProperty

public Object getProperty(String name)
Look up the value of a property.

Parameters:
name - the property id
Returns:
the property value

checkObjectAllowed

protected void checkObjectAllowed(String property,
                                  Object value)
Checks whether the given value has the correct java type for the given property. If the value is not allowed for the given property an IllegalArgumentException is thrown.

Parameters:
property - The property to be set
value - The value to which the property should be set

setPropertiesByString

public void setPropertiesByString(Properties stringProperties)
                           throws DatabaseUnitException
Sets the given properties on the DatabaseConfig instance using the given String values. This is useful to set properties configured as strings by a build tool like ant or maven. If the required property type is an object it uses reflection to create an instance of the class specified as string.

Parameters:
stringProperties - The properties as strings. The key of the properties can be either the long or the short name.
Throws:
DatabaseUnitException

findByName

public static final DatabaseConfig.ConfigProperty findByName(String property)
Searches the DatabaseConfig.ConfigProperty object for the property with the given name

Parameters:
property - The property for which the enumerated object should be resolved
Returns:
The property object or null if it was not found.

findByShortName

public static final DatabaseConfig.ConfigProperty findByShortName(String propShortName)
Searches the DatabaseConfig.ConfigProperty object for the property with the given name

Parameters:
propShortName - The property short name for which the enumerated object should be resolved. Example: the short name of "/properties/fetchSize" is fetchSize which is the last part of the fully qualified URL.
Returns:
The property object or null if it was not found.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2002-2012. All Rights Reserved.