de.smartics.properties.spi.config.support
Class AbstractInMemoryConfigurationProperties

Package class diagram package AbstractInMemoryConfigurationProperties
java.lang.Object
  extended by de.smartics.properties.spi.config.support.AbstractConfigurationProperties
      extended by de.smartics.properties.spi.config.support.AbstractAdminModeConfigurationProperties
          extended by de.smartics.properties.spi.config.support.AbstractConfigurationPropertiesManagement
              extended by de.smartics.properties.spi.config.support.AbstractInMemoryConfigurationProperties
All Implemented Interfaces:
ConfigurationProperties, ConfigurationPropertiesManagement, SerializableConfigurationProperties, SerializableConfigurationPropertiesManagement, ConfigurationPropertiesManagementSpi, ConfigurationPropertiesSpi, Serializable
Direct Known Subclasses:
BootConfigurationProperties, ClasspathConfigurationProperties, PropertiesConfigurationProperties

@ThreadSafe
public abstract class AbstractInMemoryConfigurationProperties
     
     
extends AbstractConfigurationPropertiesManagement
implements SerializableConfigurationPropertiesManagement

An implementation that stores all properties in-memory.

See Also:
Serialized Form

Constructor Summary
AbstractInMemoryConfigurationProperties(ConfigurationKey<?> key, PropertyDescriptorRegistry registry, boolean requiresDefaultOnClassPath, PropertyValueSecurity decrypter)
          Default constructor requiring that a properties file with the same name as the properties set class exists on the class path.
AbstractInMemoryConfigurationProperties(ConfigurationKey<?> key, PropertyDescriptorRegistry registry, PropertyValueSecurity decrypter)
          Convenience constructor requiring that a properties file with the same name as the properties set class exists on the class path.
 
Method Summary
 AbstractInMemoryConfigurationProperties addClassPathProperties(Class<?> propertiesInterface)
          Loads the properties for the given properties interface from the class path.
protected  void addDefinitionsToStore(PropertyProvider properties)
          Implementations decide whether or not registered definitions should be written to the store.
 PropertyStoreAccessor getPropertyStoreAccessor()
          Provides direct access to the properties in the underlying store.
protected  void setPropertiesToStore(PropertyProvider provider)
          Allows to store all properties efficiently by subclasses.
 String toString()
          Returns the string representation of the object.
 
Methods inherited from class de.smartics.properties.spi.config.support.AbstractConfigurationPropertiesManagement
addDefinitions, addDescriptors, deletePropertyInStore, flush, getDescriptor, getDescriptor, getMandatoryPropertyDescriptors, getProperty, getProperty, getPropertyAsType, getPropertyCollectionFromStore, getPropertyFromStore, getValidatedProperty, setProperty, setPropertyToStore, unsetProperty, validate, validate, validate
 
Methods inherited from class de.smartics.properties.spi.config.support.AbstractAdminModeConfigurationProperties
isInAdminMode, setToAdminMode, toRepresentative
 
Methods inherited from class de.smartics.properties.spi.config.support.AbstractConfigurationProperties
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, getContext, getContext, getKey, getProperties, getProperties, getProperty, getProperty, getProperty, getPropertyDescriptor, getPropertyValue, getPropertyValue, getPropertyValue, getPropertyValue, getPropertyValue, getPropertyValueAsString, getPropertyValueAsString, getPropertyValueAsString, getPropertyValueAsString, getPropertyValueSecurity, getRegistry, getValidatedProperty, getValidatedProperty, removePropertyChangeListener, removePropertyChangeListener, resolveAndConvert, resolveAndConvertAndValidate, validate, validate, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.smartics.properties.api.config.domain.ConfigurationPropertiesManagement
addDefinitions, addDescriptors, flush, getDescriptor, getDescriptor, getMandatoryPropertyDescriptors, getPropertyValueSecurity, getRegistry, setProperty, setToAdminMode, toRepresentative, toSerializable, unsetProperty
 
Methods inherited from interface de.smartics.properties.api.config.domain.ConfigurationProperties
addPropertyChangeListener, addPropertyChangeListener, getContext, getContext, getKey, getProperties, getProperty, getProperty, getProperty, getProperty, getProperty, getPropertyAsType, getPropertyValue, getPropertyValue, getPropertyValue, getPropertyValue, getPropertyValue, getPropertyValueAsString, getPropertyValueAsString, getPropertyValueAsString, getPropertyValueAsString, getValidatedProperty, getValidatedProperty, getValidatedProperty, isInAdminMode, removePropertyChangeListener, removePropertyChangeListener, validate, validate, validate, validate, validate
 
Methods inherited from interface de.smartics.properties.spi.config.support.ConfigurationPropertiesSpi
getProperties
 

Constructor Detail

AbstractInMemoryConfigurationProperties

public AbstractInMemoryConfigurationProperties(ConfigurationKey<?> key,
                                               PropertyDescriptorRegistry registry,
                                               PropertyValueSecurity decrypter)
                                        throws de.smartics.util.lang.NullArgumentException
Convenience constructor requiring that a properties file with the same name as the properties set class exists on the class path.

Parameters:
key - the key that identifies the configuration.
registry - the registry to resolve property descriptors.
decrypter - the helper to decrypt secured property values.
Throws:
de.smartics.util.lang.NullArgumentException - if key, registry or decrypter is null.

AbstractInMemoryConfigurationProperties

public AbstractInMemoryConfigurationProperties(ConfigurationKey<?> key,
                                               PropertyDescriptorRegistry registry,
                                               boolean requiresDefaultOnClassPath,
                                               PropertyValueSecurity decrypter)
                                        throws de.smartics.util.lang.NullArgumentException
Default constructor requiring that a properties file with the same name as the properties set class exists on the class path.

Parameters:
key - the key that identifies the configuration.
registry - the registry to resolve property descriptors.
requiresDefaultOnClassPath - the flag controls the behavior on not finding default properties on the classpath.
decrypter - the helper to decrypt secured property values.
Throws:
de.smartics.util.lang.NullArgumentException - if key, registry or decrypter is null.
Method Detail

getPropertyStoreAccessor

public final PropertyStoreAccessor getPropertyStoreAccessor()
Description copied from interface: ConfigurationPropertiesManagement
Provides direct access to the properties in the underlying store.

Specified by:
getPropertyStoreAccessor in interface ConfigurationPropertiesManagement
Returns:
direct access to the properties in the underlying store.

addDefinitionsToStore

protected final void addDefinitionsToStore(PropertyProvider properties)
Description copied from class: AbstractConfigurationPropertiesManagement
Implementations decide whether or not registered definitions should be written to the store. This is the default and subclasses may override to implement another strategy.

Usually configurations that are backed up by an external (e.g. persistent) store do not want to store definitions here. So they override this method with a no-op.

Specified by:
addDefinitionsToStore in class AbstractConfigurationPropertiesManagement
Parameters:
properties - the properties that are to be registered as definitions.

setPropertiesToStore

protected final void setPropertiesToStore(PropertyProvider provider)
Allows to store all properties efficiently by subclasses. The default implementation simply iterates.

Specified by:
setPropertiesToStore in class AbstractConfigurationPropertiesManagement
Parameters:
provider - the provider with the properties to be stored.

addClassPathProperties

public final AbstractInMemoryConfigurationProperties addClassPathProperties(Class<?> propertiesInterface)
                                                                     throws de.smartics.util.lang.NullArgumentException,
                                                                            ConfigurationLoadingException
Loads the properties for the given properties interface from the class path.

The properties file is expected to be at the same location with a name identical to the interface plus the file extension .properties .

Parameters:
propertiesInterface - the properties defining interface whose properties are loaded.
Returns:
a reference to this configuration for chaining.
Throws:
de.smartics.util.lang.NullArgumentException - if propertiesInterface is null.
ConfigurationLoadingException - if the properties file cannot be loaded.

toString

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

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


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