de.smartics.properties.api.config.ds
Class DataSourceConfiguration

Package class diagram package DataSourceConfiguration
java.lang.Object
  extended by de.smartics.properties.api.config.ds.DataSourceConfiguration
All Implemented Interfaces:
Serializable

public final class DataSourceConfiguration
     
     
extends Object
implements Serializable

Configuration to access a data source via JNDI.

The following properties are valid:

  1. "de.smartics.properties.ds.jndiName" - the name of the data source in the JNDI.
  2. "de.smartics.properties.ds.dropTable" - flag to drop the configuration table if set to true (usually this should only be used in test environments).
  3. "de.smartics.properties.ds.createTable" - flag to create the configuration table if set to true.

The property CONFIG_SOURCE_ID allows to track the source of the configuration information.

See Also:
Serialized Form

Field Summary
static String CONFIG_SOURCE_ID
          The identifier of the configuration for the data source.
static String CREATE_TABLE
          The key to flag to create the configuration table in the data source.
static String DROP_TABLE
          The key to flag to drop the configuration table in the data source.
static String JNDI_NAME
          The key to the JNDI name of the data source.
 
Constructor Summary
DataSourceConfiguration()
          Convenience constructor to construct the instance first and set properties afterwards.
DataSourceConfiguration(Properties properties)
          Default constructor.
DataSourceConfiguration(String configSourceId, String jndiName, boolean dropTable, boolean createTable)
          Default constructor.
 
Method Summary
 String getConfigSourceId()
          Returns the source of the data source configuration.
 String getJndiName()
          Returns the name of the data source to lookup in a JNDI context.
 boolean isCreateTable()
          Returns the flag to create the configuration table if set to true.
 boolean isDropTable()
          Returns the flag to drop the configuration table if set to true.
 boolean isUnset()
          Checks whether or not the configuration has value.
 void setCreateTable(boolean createTable)
          Sets the flag to create the configuration if set to true.
 void setDropTable(boolean dropTable)
          Sets the flag to drop the configuration table if set to true.
 void setJndiName(String jndiName)
          Sets the name of the data source to lookup in a JNDI context.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONFIG_SOURCE_ID

public static final String CONFIG_SOURCE_ID
The identifier of the configuration for the data source.

Constant Field Value:
"de.smartics.properties.ds.id"

JNDI_NAME

public static final String JNDI_NAME
The key to the JNDI name of the data source.

Constant Field Value:
"de.smartics.properties.ds.jndiName"

DROP_TABLE

public static final String DROP_TABLE
The key to flag to drop the configuration table in the data source.

Constant Field Value:
"de.smartics.properties.ds.dropTable"

CREATE_TABLE

public static final String CREATE_TABLE
The key to flag to create the configuration table in the data source.

Constant Field Value:
"de.smartics.properties.ds.createTable"
Constructor Detail

DataSourceConfiguration

public DataSourceConfiguration(String configSourceId,
                               String jndiName,
                               boolean dropTable,
                               boolean createTable)
Default constructor.

Parameters:
configSourceId - the source of the data source configuration.
jndiName - the jndi name.
dropTable - the boolean whether or not existing tables shall be dropped.
createTable - the boolean whether or the tables shall be created, if they do not exist already

DataSourceConfiguration

public DataSourceConfiguration(Properties properties)
Default constructor.

Parameters:
properties - the properties containing jndiName, dropTable and createTable.

DataSourceConfiguration

public DataSourceConfiguration()
Convenience constructor to construct the instance first and set properties afterwards. The client is responsible to check that all properties are valid before its first use.

Method Detail

getConfigSourceId

public String getConfigSourceId()
Returns the source of the data source configuration.

Returns:
the source of the data source configuration.

getJndiName

public String getJndiName()
Returns the name of the data source to lookup in a JNDI context.

Returns:
the name of the data source to lookup in a JNDI context.

setJndiName

public void setJndiName(String jndiName)
Sets the name of the data source to lookup in a JNDI context.

Parameters:
jndiName - the name of the data source to lookup in a JNDI context.

isDropTable

public boolean isDropTable()
Returns the flag to drop the configuration table if set to true.

Returns:
the flag to drop tables if set to true.

setDropTable

public void setDropTable(boolean dropTable)
Sets the flag to drop the configuration table if set to true.

Parameters:
dropTable - the flag to drop the configuration table if set to true.

isCreateTable

public boolean isCreateTable()
Returns the flag to create the configuration table if set to true.

Returns:
the flag to create tables if set to true.

setCreateTable

public void setCreateTable(boolean createTable)
Sets the flag to create the configuration if set to true.

Parameters:
createTable - the flag to create the configuration if set to true.

isUnset

public boolean isUnset()
Checks whether or not the configuration has value.

Returns:
true if the configuration is unset, false otherwise.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012-2013 Kronseder & Reiner GmbH - smartics. All Rights Reserved.