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

Package class diagram package DataSourceConfigurationPropertyProvider
java.lang.Object
  extended by de.smartics.properties.spi.config.ds.DataSourceConfigurationPropertyProvider
All Implemented Interfaces:
PropertyProvider, Serializable

@NotThreadSafe
public final class DataSourceConfigurationPropertyProvider
     
     
extends Object
implements PropertyProvider

Provides an adapter for properties in a data source to match the PropertyProvider interface.

See Also:
Serialized Form

Constructor Summary
DataSourceConfigurationPropertyProvider(ConfigurationKey<?> configurationKey, PropertiesStore manager)
          Default constructor.
 
Method Summary
 boolean containsKey(String name)
          Checks if a given property is provided by the property provider.
 ConfigurationKey<?> getConfigurationKey()
          The key of the configuration this property provider provides properties for.
 PropertyCollection getProperties()
          Returns the collection of all property values known to the system.
 Property getProperty(String name)
          Returns the property with the given name.
 PropertyLocation getSourceId()
          Returns the unique identifier of the property source.
 boolean isLazy()
          Providers that do not have to fetch their property definitions eagerly return true here.
 String toString()
          Returns the string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataSourceConfigurationPropertyProvider

public DataSourceConfigurationPropertyProvider(ConfigurationKey<?> configurationKey,
                                               PropertiesStore manager)
                                        throws NullPointerException
Default constructor.

Parameters:
configurationKey - the identifier of the configuration the provided properties are part of.
manager - the access to the properties of the data source.
Throws:
NullPointerException - if configurationKey or manager is null.
Method Detail

getConfigurationKey

public ConfigurationKey<?> getConfigurationKey()
Description copied from interface: PropertyProvider
The key of the configuration this property provider provides properties for.

Specified by:
getConfigurationKey in interface PropertyProvider
Returns:
the key of the configuration this property provider provides properties for.

getSourceId

public PropertyLocation getSourceId()
Description copied from interface: PropertyProvider
Returns the unique identifier of the property source. This value is used to identify the source when reporting about a property.

Specified by:
getSourceId in interface PropertyProvider
Returns:
the unique identifier of the property source.

isLazy

public boolean isLazy()
Description copied from interface: PropertyProvider
Providers that do not have to fetch their property definitions eagerly return true here. All others return false. Usually providers that fetch properties from a backend store are lazy, while properties on a class path are eager.

Generally: If the provider cannot fetch individual properties easily, then they should fetch them eagerly and hold them in memory. Otherwise they will fetch properties on demand (aka lazily).

Specified by:
isLazy in interface PropertyProvider
Returns:
true if the property provider is lazy, false if it is eager.

getProperty

public Property getProperty(String name)
                     throws NullPointerException,
                            IllegalArgumentException
Description copied from interface: PropertyProvider
Returns the property with the given name.

Specified by:
getProperty in interface PropertyProvider
Parameters:
name - the name of the property to fetch.
Returns:
the value to the property.
Throws:
NullPointerException - if name is null.
IllegalArgumentException - if the property is not known. A property is not known if its key has not been registered. A property that is registered with the null value is known.

getProperties

public PropertyCollection getProperties()
Description copied from interface: PropertyProvider
Returns the collection of all property values known to the system.

Specified by:
getProperties in interface PropertyProvider
Returns:
the collection of all property values known to the system. May be empty, but is never null.

containsKey

public boolean containsKey(String name)
                    throws NullPointerException
Description copied from interface: PropertyProvider
Checks if a given property is provided by the property provider.

Specified by:
containsKey in interface PropertyProvider
Parameters:
name - the property name to check.
Returns:
true if the provider provides a property for the name, false otherwise.
Throws:
NullPointerException - if name is null.

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.