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

Package class diagram package DefaultDataSourceManager
java.lang.Object
  extended by de.smartics.properties.spi.config.ds.AbstractDataSourceDescriptor
      extended by de.smartics.properties.spi.config.ds.DefaultDataSourceManager
All Implemented Interfaces:
PropertiesDataSourceDescriptor, PropertiesDataSourceManager, Serializable
Direct Known Subclasses:
PropertiesStore

public class DefaultDataSourceManager
     
     
extends AbstractDataSourceDescriptor
implements PropertiesDataSourceManager

Helper to create database configurations with a data source.

See Also:
Serialized Form

Nested Class Summary
static class DefaultDataSourceManager.Builder
          The builder of manager instances.
 
Field Summary
protected  boolean dropTable
          Signals to drop the properties table before creation.
protected  boolean ignoreTableCreationProblems
          The flag signals that any problems encountered on creating the table should be ignored.
 
Constructor Summary
protected DefaultDataSourceManager(DefaultDataSourceManager.Builder builder)
          Default constructor.
 
Method Summary
 void createConfigTable()
          Creates the configuration on the referenced data source.
 void dropConfigTable()
          Drops the configuration table from the referenced data source.
 List<String> getConfigurationKeys()
          Returns the list of distinct data source keys.
 String getDataSourceId()
          Returns the identifier of the data source.
 DataSourceProxy getDataSourceProxy()
          Returns a reference to the data source proxy used to connect to the data source.
 String getInsertOrUpdateSqlStatementTemplate()
          Returns the SQL statement to insert or update a value in the table, dependent on if the value is already in the database or not.
 void print(PrintStream out)
          Prints the contents of the data source to the given stream.
 String toString()
          Returns the string representation of the object.
 
Methods inherited from class de.smartics.properties.spi.config.ds.AbstractDataSourceDescriptor
getConfigColumn, getNameColumn, getTable, getValueColumn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.smartics.properties.spi.config.ds.PropertiesDataSourceDescriptor
getConfigColumn, getNameColumn, getTable, getValueColumn
 

Field Detail

dropTable

protected final boolean dropTable
Signals to drop the properties table before creation.


ignoreTableCreationProblems

protected final boolean ignoreTableCreationProblems
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.

Constructor Detail

DefaultDataSourceManager

protected DefaultDataSourceManager(DefaultDataSourceManager.Builder builder)
Default constructor.

Parameters:
builder - the builder of manager instance.
Method Detail

getDataSourceId

public final String getDataSourceId()
Description copied from interface: PropertiesDataSourceDescriptor
Returns the identifier of the data source.

Specified by:
getDataSourceId in interface PropertiesDataSourceDescriptor
Returns:
the identifier of the data source.

getDataSourceProxy

public final DataSourceProxy getDataSourceProxy()
Description copied from interface: PropertiesDataSourceManager
Returns a reference to the data source proxy used to connect to the data source.

Specified by:
getDataSourceProxy in interface PropertiesDataSourceManager
Returns:
a reference to the data source proxy used to connect to the data source.

getInsertOrUpdateSqlStatementTemplate

public String getInsertOrUpdateSqlStatementTemplate()
Returns the SQL statement to insert or update a value in the table, dependent on if the value is already in the database or not.

Specified by:
getInsertOrUpdateSqlStatementTemplate in interface PropertiesDataSourceManager
Returns:
the SQL statement to insert or update a value in the table, dependent on if the value is already in the database or not.

createConfigTable

public final void createConfigTable()
                             throws DataSourceException
Description copied from interface: PropertiesDataSourceManager
Creates the configuration on the referenced data source.

Specified by:
createConfigTable in interface PropertiesDataSourceManager
Throws:
DataSourceException - on any problem accessing the data source.

dropConfigTable

public final void dropConfigTable()
                           throws DataSourceException
Description copied from interface: PropertiesDataSourceManager
Drops the configuration table from the referenced data source.

Specified by:
dropConfigTable in interface PropertiesDataSourceManager
Throws:
DataSourceException - on any problem accessing the data source.

print

public final void print(PrintStream out)
                 throws DataSourceException
Description copied from interface: PropertiesDataSourceManager
Prints the contents of the data source to the given stream. Useful for debugging.

Specified by:
print in interface PropertiesDataSourceManager
Parameters:
out - the stream to write to.
Throws:
DataSourceException - on any problem accessing the data source.

getConfigurationKeys

public final List<String> getConfigurationKeys()
                                        throws DataSourceException
Description copied from interface: PropertiesDataSourceManager
Returns the list of distinct data source keys.

Specified by:
getConfigurationKeys in interface PropertiesDataSourceManager
Returns:
the list of distinct data source keys.
Throws:
DataSourceException - on any problem fetching the keys.

toString

public String toString()
Returns the string representation of the object.

Overrides:
toString in class Object
Returns:
the string representation of the object.


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