de.smartics.properties.spi.config.domain
Class ConfigurationPropertiesManagementProxy

Package class diagram package ConfigurationPropertiesManagementProxy
java.lang.Object
  extended by de.smartics.properties.spi.config.domain.ConfigurationPropertiesProxy
      extended by de.smartics.properties.spi.config.domain.ConfigurationPropertiesManagementProxy
All Implemented Interfaces:
ConfigurationProperties, ConfigurationPropertiesManagement, SerializableConfigurationProperties, SerializableConfigurationPropertiesManagement, Serializable

public final class ConfigurationPropertiesManagementProxy
     
     
extends ConfigurationPropertiesProxy
implements SerializableConfigurationPropertiesManagement

A serialization proxy that allows non serializable configuration properties instances to be serialized using their factories cache and ability to recreate that instances.

See Also:
Serialized Form

Constructor Summary
ConfigurationPropertiesManagementProxy(ConfigurationKey<?> key, ConfigurationPropertiesFactory factory)
          Default constructor.
 
Method Summary
 ConfigurationPropertiesManagement addDefinitions(PropertyProvider properties)
          Adds the given definitions to this configuration.
 void addDescriptors(Class<?> propertySetType)
          Adds all property descriptors declared in the given type.
 void flush()
          Signal to flush properties changed in memory to be written to a secondary storage.
 PropertyDescriptor getDescriptor(PropertyKey key)
          Returns the descriptor for the given key.
 PropertyDescriptor getDescriptor(String key)
          Returns the descriptor for the given key.
 List<PropertyDescriptor> getMandatoryPropertyDescriptors()
          Returns the list of mandatory properties.
 PropertyStoreAccessor getPropertyStoreAccessor()
          Provides direct access to the properties in the underlying store.
 PropertyValueSecurity getPropertyValueSecurity()
          Returns the property value security helper to en- and decrypt property values.
 PropertyDescriptorRegistry getRegistry()
          Returns the registry to resolve property descriptors.
 boolean isInAdminMode()
          Checks whether or not this configuration is in administration mode.
 Property setProperty(PropertyKey key, String value)
          Sets the property value for the given key.
 void setToAdminMode(boolean newMode)
          Sets the administration mode for this configuration.
 ConfigurationPropertiesManagement toRepresentative()
          Creates an representative of this configuration.
 SerializableConfigurationPropertiesManagement toSerializable()
          Creates a serializable variant of this implementation.
 Property unsetProperty(PropertyKey key)
          Unsets the property value for the given key.
 
Methods inherited from class de.smartics.properties.spi.config.domain.ConfigurationPropertiesProxy
addPropertyChangeListener, addPropertyChangeListener, getContext, getContext, getFactory, getKey, getProperties, getProperty, getProperty, getProperty, getProperty, getProperty, getPropertyAsType, getPropertyValue, getPropertyValue, getPropertyValue, getPropertyValue, getPropertyValue, getPropertyValueAsString, getPropertyValueAsString, getPropertyValueAsString, getPropertyValueAsString, getValidatedProperty, getValidatedProperty, getValidatedProperty, removePropertyChangeListener, removePropertyChangeListener, validate, validate, validate, validate, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
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, removePropertyChangeListener, removePropertyChangeListener, validate, validate, validate, validate, validate
 

Constructor Detail

ConfigurationPropertiesManagementProxy

public ConfigurationPropertiesManagementProxy(ConfigurationKey<?> key,
                                              ConfigurationPropertiesFactory factory)
Default constructor.

Parameters:
key - the key of the configuration properties instance is to be associated with
factory - the factory to create instances of the configuration properties.
Method Detail

getRegistry

public PropertyDescriptorRegistry getRegistry()
Description copied from interface: ConfigurationPropertiesManagement
Returns the registry to resolve property descriptors.

Specified by:
getRegistry in interface ConfigurationPropertiesManagement
Returns:
the registry to resolve property descriptors.

getPropertyValueSecurity

public PropertyValueSecurity getPropertyValueSecurity()
Description copied from interface: ConfigurationPropertiesManagement
Returns the property value security helper to en- and decrypt property values.

Specified by:
getPropertyValueSecurity in interface ConfigurationPropertiesManagement
Returns:
the property value security helper to en- and decrypt property values.

getPropertyStoreAccessor

public 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.

isInAdminMode

public boolean isInAdminMode()
Description copied from interface: ConfigurationProperties
Checks whether or not this configuration is in administration mode. In this mode the configuration is less strict with certain validations. Especially it allows to edit otherwise read-only properties.

Specified by:
isInAdminMode in interface ConfigurationProperties
Overrides:
isInAdminMode in class ConfigurationPropertiesProxy
Returns:
true if the configuration is in administration mode, false otherwise.

setToAdminMode

public void setToAdminMode(boolean newMode)
Description copied from interface: ConfigurationPropertiesManagement
Sets the administration mode for this configuration.

Specified by:
setToAdminMode in interface ConfigurationPropertiesManagement
Parameters:
newMode - the new value of the mode true if the configuration is to be set in administration mode, false if not.
See Also:
ConfigurationProperties.isInAdminMode()

addDescriptors

public void addDescriptors(Class<?> propertySetType)
                    throws DuplicatePropertyDeclarationsException
Description copied from interface: ConfigurationPropertiesManagement
Adds all property descriptors declared in the given type.

Specified by:
addDescriptors in interface ConfigurationPropertiesManagement
Parameters:
propertySetType - the type that declares the descriptors.
Throws:
DuplicatePropertyDeclarationsException - if any of the descriptors declare the same property.

getDescriptor

public PropertyDescriptor getDescriptor(String key)
                                 throws UnknownPropertyException
Description copied from interface: ConfigurationPropertiesManagement
Returns the descriptor for the given key.

Specified by:
getDescriptor in interface ConfigurationPropertiesManagement
Parameters:
key - the of the requested descriptor.
Returns:
the descriptor whose key matches the given key.
Throws:
UnknownPropertyException - if the property is not known.

getDescriptor

public PropertyDescriptor getDescriptor(PropertyKey key)
                                 throws UnknownPropertyException
Description copied from interface: ConfigurationPropertiesManagement
Returns the descriptor for the given key.

Specified by:
getDescriptor in interface ConfigurationPropertiesManagement
Parameters:
key - the of the requested descriptor.
Returns:
the descriptor whose key matches the given key.
Throws:
UnknownPropertyException - if the property is not known.

getMandatoryPropertyDescriptors

public List<PropertyDescriptor> getMandatoryPropertyDescriptors()
Description copied from interface: ConfigurationPropertiesManagement
Returns the list of mandatory properties.

Returns a copy that can be edited.

Specified by:
getMandatoryPropertyDescriptors in interface ConfigurationPropertiesManagement
Returns:
the list of mandatory properties.

addDefinitions

public ConfigurationPropertiesManagement addDefinitions(PropertyProvider properties)
                                                 throws NullPointerException
Description copied from interface: ConfigurationPropertiesManagement
Adds the given definitions to this configuration.

Specified by:
addDefinitions in interface ConfigurationPropertiesManagement
Parameters:
properties - the property definitions to add.
Returns:
a reference to this configuration for chaining.
Throws:
NullPointerException - if properties is null.

setProperty

public Property setProperty(PropertyKey key,
                            String value)
                     throws NullPointerException,
                            PropertyValidationException,
                            ReadOnlyPropertyException
Description copied from interface: ConfigurationPropertiesManagement
Sets the property value for the given key.

Specified by:
setProperty in interface ConfigurationPropertiesManagement
Parameters:
key - the key to the property.
value - the value to the property.
Returns:
the old value to the property. A value of null is returned if the property had no value prior to this call.
Throws:
NullPointerException - if key is null.
PropertyValidationException - if the property value is invalid according to its constraints.
ReadOnlyPropertyException - if the property to update is read-only.

unsetProperty

public Property unsetProperty(PropertyKey key)
                       throws NullPointerException,
                              ReadOnlyPropertyException
Description copied from interface: ConfigurationPropertiesManagement
Unsets the property value for the given key.

Specified by:
unsetProperty in interface ConfigurationPropertiesManagement
Parameters:
key - the key to the property.
Returns:
the old value to the property. A value of null is returned if the property had no value prior to this call.
Throws:
NullPointerException - if key is null.
ReadOnlyPropertyException - if the property to update is read-only.

flush

public void flush()
Description copied from interface: ConfigurationPropertiesManagement
Signal to flush properties changed in memory to be written to a secondary storage.

Implementations are not required to only write on a flush. They have to make sure that after the flush is called, all data is transfered to the secondary storage.

Specified by:
flush in interface ConfigurationPropertiesManagement

toRepresentative

public ConfigurationPropertiesManagement toRepresentative()
Description copied from interface: ConfigurationProperties
Creates an representative of this configuration. If the configuration serves for a specific configuration key, this instance will be returned. If the configuration servers for multiple configuration keys, the representative is returned. The representative is usually the configuration that is associated with the full key.

Specified by:
toRepresentative in interface ConfigurationProperties
Specified by:
toRepresentative in interface ConfigurationPropertiesManagement
Overrides:
toRepresentative in class ConfigurationPropertiesProxy
Returns:
the representative (may be this).

toSerializable

public SerializableConfigurationPropertiesManagement toSerializable()
Description copied from interface: ConfigurationProperties
Creates a serializable variant of this implementation.

Specified by:
toSerializable in interface ConfigurationProperties
Specified by:
toSerializable in interface ConfigurationPropertiesManagement
Overrides:
toSerializable in class ConfigurationPropertiesProxy
Returns:
a serializable variant of this implementation.
See Also:
ConfigurationPropertiesProxy, ConfigurationPropertiesManagementProxy


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