de.smartics.properties.spi.config.ds
Class DefaultDataSourceManager.Builder

Package class diagram package DefaultDataSourceManager.Builder
java.lang.Object
  extended by de.smartics.properties.spi.config.ds.AbstractDataSourceDescriptor.Builder
      extended by de.smartics.properties.spi.config.ds.DefaultDataSourceManager.Builder
Direct Known Subclasses:
PropertiesStore.Builder
Enclosing class:
DefaultDataSourceManager

public static class DefaultDataSourceManager.Builder
     
     
extends AbstractDataSourceDescriptor.Builder

The builder of manager instances.


Field Summary
protected  DataSourceProxy dataSourceProxy
          The proxy to provide access to a data source.
static String DEFAULT_CREATE_TABLE_TEMPLATE
          The default table template.
 
Constructor Summary
DefaultDataSourceManager.Builder()
           
 
Method Summary
 DefaultDataSourceManager build()
          Creates the instance.
 void setCreateTableSqlStatementTemplate(String createTableSqlStatementTemplate)
          Sets the template to create an SQL statement to create the configuration table.
 void setDataSourceProxy(DataSourceProxy dataSourceProxy)
          Sets the proxy to provide access to a data source.
 void setDropTable(boolean dropTable)
          Sets the value for dropTable.
 void setIgnoreTableCreationProblems(boolean ignoreTableCreationProblems)
          Sets the flag signals that any problems encountered on creating the table should be ignored.
 void setInitialProperties(Map<String,String> initialProperties)
          Sets the properties to fill the database initially.
 
Methods inherited from class de.smartics.properties.spi.config.ds.AbstractDataSourceDescriptor.Builder
setNameColumn, setTable, setValueColumn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CREATE_TABLE_TEMPLATE

public static final String DEFAULT_CREATE_TABLE_TEMPLATE
The default table template.

The value of this constant is "CREATE TABLE IF NOT EXISTS ${table} (${nameColumn} VARCHAR(64) PRIMARY KEY, ${valueColumn} VARCHAR(255))".

Constant Field Value:
"CREATE TABLE IF NOT EXISTS ${table} (${nameColumn} VARCHAR(64) PRIMARY KEY, ${valueColumn} VARCHAR(255))"

dataSourceProxy

protected DataSourceProxy dataSourceProxy
The proxy to provide access to a data source.

Constructor Detail

DefaultDataSourceManager.Builder

public DefaultDataSourceManager.Builder()
Method Detail

setCreateTableSqlStatementTemplate

public final void setCreateTableSqlStatementTemplate(String createTableSqlStatementTemplate)
Sets the template to create an SQL statement to create the configuration table. Use ${table}, ${nameColumn} and ${valueColumn} to reference the name of the configuration table, the column that stores the property names and the column storing the property values.

Per default the default table template is used.

Parameters:
createTableSqlStatementTemplate - the template to create an SQL statement to create the configuration table.
See Also:
DEFAULT_CREATE_TABLE_TEMPLATE

setDataSourceProxy

public final void setDataSourceProxy(DataSourceProxy dataSourceProxy)
                              throws NullPointerException
Sets the proxy to provide access to a data source.

Parameters:
dataSourceProxy - the proxy to provide access to a data source.
Throws:
NullPointerException - of dataSourceProxy is null.

setInitialProperties

public final void setInitialProperties(Map<String,String> initialProperties)
Sets the properties to fill the database initially. May be null.

Parameters:
initialProperties - the properties to fill the database initially.

setDropTable

public final void setDropTable(boolean dropTable)
Sets the value for dropTable.

Signals to drop the properties table before creation.

Parameters:
dropTable - the value for dropTable.

setIgnoreTableCreationProblems

public final void setIgnoreTableCreationProblems(boolean ignoreTableCreationProblems)
Sets the flag signals that any problems encountered on creating the table should be ignored. Useful if there are no means to check is a database table already exists.

Parameters:
ignoreTableCreationProblems - the flag signals that any problems encountered on creating the table should be ignored.

build

public DefaultDataSourceManager build()
                               throws NullPointerException
Creates the instance.

Returns:
the created instance.
Throws:
NullPointerException - if no data source proxy has been provided.


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