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

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

public final class PropertiesStore
     
     
extends DefaultDataSourceManager
implements PropertiesDataSourceAccessor

Provides access to properties in a data source.

See Also:
Serialized Form

Nested Class Summary
static class PropertiesStore.Builder
          The builder of manager instances.
 
Field Summary
 
Fields inherited from class de.smartics.properties.spi.config.ds.DefaultDataSourceManager
dropTable, ignoreTableCreationProblems
 
Constructor Summary
protected PropertiesStore(PropertiesStore.Builder builder)
          Default constructor.
 
Method Summary
 boolean containsKey(String config, String name)
          Checks if a property with the given name is stored.
 void deleteProperties()
          Deletes all properties.
 void deleteProperty(String config, String name)
          Deletes the property from the store.
 PropertyCollection getCollection(String config)
          The collection of all properties stored.
 Property getProperty(String config, String name)
          Reads the property with the given name from the data source.
 void setProperties(PropertyProvider provider)
          Stores all properties provided by the given provider.
 void setProperty(String config, String name, String value)
          Sets the property to the given name and value.
 
Methods inherited from class de.smartics.properties.spi.config.ds.DefaultDataSourceManager
createConfigTable, dropConfigTable, getConfigurationKeys, getDataSourceId, getDataSourceProxy, getInsertOrUpdateSqlStatementTemplate, print, toString
 
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
 

Constructor Detail

PropertiesStore

protected PropertiesStore(PropertiesStore.Builder builder)
Default constructor.

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

getProperty

public Property getProperty(String config,
                            String name)
                     throws NullPointerException,
                            IllegalArgumentException,
                            DataSourceException
Description copied from interface: PropertiesDataSourceAccessor
Reads the property with the given name from the data source.

Specified by:
getProperty in interface PropertiesDataSourceAccessor
Parameters:
config - the name of the configuration the property is part of.
name - the name of the property to fetch.
Returns:
the property or null, if no such property is stored in the data source.
Throws:
NullPointerException - if config or name is null.
IllegalArgumentException - if config or name is blank.
DataSourceException - on any problem accessing the data source.

setProperty

public void setProperty(String config,
                        String name,
                        String value)
                 throws IllegalArgumentException,
                        DataSourceException
Description copied from interface: PropertiesDataSourceAccessor
Sets the property to the given name and value.

Specified by:
setProperty in interface PropertiesDataSourceAccessor
Parameters:
config - the name of the configuration the property is part of.
name - the name of the property to set.
value - the value of the property.
Throws:
IllegalArgumentException - if config or name is blank.
DataSourceException - on any problem accessing the data source.

setProperties

public void setProperties(PropertyProvider provider)
                   throws NullPointerException,
                          DataSourceException
Description copied from interface: PropertiesDataSourceAccessor
Stores all properties provided by the given provider.

Specified by:
setProperties in interface PropertiesDataSourceAccessor
Parameters:
provider - the provider of properties to store.
Throws:
NullPointerException - if provider is null.
DataSourceException - on any problem accessing the data source.

deleteProperty

public void deleteProperty(String config,
                           String name)
                    throws IllegalArgumentException,
                           DataSourceException
Description copied from interface: PropertiesDataSourceAccessor
Deletes the property from the store.

Specified by:
deleteProperty in interface PropertiesDataSourceAccessor
Parameters:
config - the name of the configuration the property is part of.
name - the name of the property to delete.
Throws:
IllegalArgumentException - if config or name is blank.
DataSourceException - on any problem accessing the data source.

getCollection

public PropertyCollection getCollection(String config)
                                 throws DataSourceException
The collection of all properties stored.

Parameters:
config - the name of the configuration the property is part of.
Returns:
the collection of all properties stored.
Throws:
DataSourceException - on any database problem.

containsKey

public boolean containsKey(String config,
                           String name)
                    throws IllegalArgumentException
Checks if a property with the given name is stored.

Parameters:
config - the name of the configuration the property is part of.
name - the name of the property to check if it is stored.
Returns:
true if there is a property with that name and a non- null value, false otherwise.
Throws:
IllegalArgumentException - if config or name is blank.

deleteProperties

public void deleteProperties()
                      throws DataSourceException
Deletes all properties.

Throws:
DataSourceException - on any database problem.


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