|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.smartics.properties.api.config.domain.AbstractAdminModeSupportedPropertiesManagement de.smartics.properties.impl.config.cache.AbstractCacheConfigurationPropertiesManagement
@ThreadSafe public abstract class AbstractCacheConfigurationPropertiesManagement
A delegate that provides a cache.
Constructor Summary | |
---|---|
|
AbstractCacheConfigurationPropertiesManagement(ConfigurationKey<?> configurationKey) Default constructor. |
protected |
AbstractCacheConfigurationPropertiesManagement(de.smartics.properties.impl.config.cache.DependencyTrackingCache cache) Default constructor that allows to specify a cache to be used. |
Method Summary | ||
---|---|---|
ConfigurationPropertiesManagement |
addDefinitions(PropertyProvider provider) Adds the given definitions to this configuration. |
|
void |
addDescriptors(Class<?> propertySetType) Adds all property descriptors declared in the given type. |
|
void |
addPropertyChangeListener(PropertyChangeListener listener) Adds the given listener to track any property changes. |
|
void |
addPropertyChangeListener(de.smartics.properties.api.core.domain.PropertyKey name, PropertyChangeListener listener) Adds the given listener as a listener to the given property. |
|
void |
flush() Signal to flush properties changed in memory to be written to a secondary storage. |
|
protected de.smartics.properties.impl.config.cache.DependencyTrackingCache |
getCache() Provides access to the cache. |
|
de.smartics.properties.api.core.domain.PropertiesContext |
getContext(Class<?> declaringType) Returns the properties context for the declaring type. |
|
de.smartics.properties.api.core.domain.PropertyContext |
getContext(de.smartics.properties.api.core.domain.PropertyDescriptor descriptor) Returns the properties context the property described by the given descriptor is part of. |
|
protected abstract ConfigurationPropertiesManagementSpi |
getDelegate() Returns a reference to the delegate. |
|
de.smartics.properties.api.core.domain.PropertyDescriptor |
getDescriptor(de.smartics.properties.api.core.domain.PropertyKey key) Returns the descriptor for the given key. |
|
de.smartics.properties.api.core.domain.PropertyDescriptor |
getDescriptor(String key) Returns the descriptor for the given key. |
|
ConfigurationKey<?> |
getKey() Returns the key of the configuration. |
|
List<de.smartics.properties.api.core.domain.PropertyDescriptor> |
getMandatoryPropertyDescriptors() Returns the list of mandatory properties. |
|
|
getProperties(Class<T> propertiesInterface) Returns a implementation of the given interface that has access to the property keys, the property descriptors and the properties itself, when they are declared in the given interface. |
|
DescribedProperty |
getProperty(de.smartics.properties.api.core.domain.PropertyDescriptor descriptor) Returns the property for the given descriptor. |
|
DescribedProperty |
getProperty(de.smartics.properties.api.core.domain.PropertyDescriptor descriptor, Object defaultValue) Returns the property for the given descriptor, allowing to transparently provide a default value to be returned in case the property has not been set. |
|
DescribedProperty |
getProperty(de.smartics.properties.api.core.domain.PropertyKey key) Returns the property for the given key. |
|
DescribedProperty |
getProperty(String key) Returns the property for the given key. |
|
DescribedProperty |
getProperty(String key, Object defaultValue) Returns the property for the given key, allowing to transparently provide a default value to be returned in case the property has not been set. |
|
Object |
getPropertyAsType(de.smartics.properties.api.core.domain.PropertyDescriptor descriptor) Returns the yet not validated property for the given descriptor's key. |
|
Object |
getPropertyValue(de.smartics.properties.api.core.domain.PropertyDescriptor descriptor) Returns the property value for the given descriptor. |
|
Object |
getPropertyValue(de.smartics.properties.api.core.domain.PropertyDescriptor descriptor, Object defaultValue) Returns the property value for the given descriptor, allowing to transparently provide a default value to be returned in case the property has not been set. |
|
Object |
getPropertyValue(de.smartics.properties.api.core.domain.PropertyKey key) Returns the property value for the given key. |
|
Object |
getPropertyValue(String key) Returns the property value for the given key. |
|
Object |
getPropertyValue(String key, Object defaultValue) Returns the property value for the given key, allowing to transparently provide a default value to be returned in case the property has not been set. |
|
String |
getPropertyValueAsString(de.smartics.properties.api.core.domain.PropertyDescriptor descriptor) Returns the property string value for the given descriptor. |
|
String |
getPropertyValueAsString(de.smartics.properties.api.core.domain.PropertyDescriptor descriptor, Object defaultValue) Returns the property string value for the given descriptor. |
|
String |
getPropertyValueAsString(String key) Returns the property string value for the given key. |
|
String |
getPropertyValueAsString(String key, Object defaultValue) Returns the property string value for the given key. |
|
de.smartics.properties.api.core.security.PropertyValueSecurity |
getPropertyValueSecurity() Returns the property value security helper to en- and decrypt property values. |
|
de.smartics.properties.api.core.domain.PropertyDescriptorRegistry |
getRegistry() Returns the registry to resolve property descriptors. |
|
ValidatedProperty |
getValidatedProperty(de.smartics.properties.api.core.domain.PropertyDescriptor descriptor, Object defaultValue) Returns the validated property for the given descriptor's key, allowing to transparently provide a default value to be returned in case the property has not been set. |
|
ValidatedProperty |
getValidatedProperty(de.smartics.properties.api.core.domain.PropertyKey key, Object defaultValue) Returns the validated property for the given key, allowing to transparently provide a default value to be returned in case the property has not been set. |
|
ValidatedProperty |
getValidatedProperty(String key, Object defaultValue) Returns the validated property for the given key, allowing to transparently provide a default value to be returned in case the property has not been set. |
|
void |
removePropertyChangeListener(PropertyChangeListener listener) Removes the given listener to stop tracking property changes. |
|
void |
removePropertyChangeListener(de.smartics.properties.api.core.domain.PropertyKey name, PropertyChangeListener listener) Removes the given listener as a listener to the given property. |
|
Property |
setProperty(de.smartics.properties.api.core.domain.PropertyKey key, String value) Sets the property value for the given key. |
|
Property |
unsetProperty(de.smartics.properties.api.core.domain.PropertyKey key) Unsets the property value for the given key. |
|
void |
validate() Validates all properties in the given configuration in a non-lenient fashion. |
|
void |
validate(boolean lenient, Class<?>... groups) Validates all properties in the given configuration. |
|
void |
validate(Class<?>... groups) Validates all properties in the given configuration and groups in a non-lenient fashion. |
|
void |
validate(de.smartics.properties.api.core.domain.PropertyDescriptor descriptor, Class<?>... ifInOneOfTheseGroups) Validates the given property in the given configuration. |
|
void |
validate(de.smartics.properties.api.core.domain.PropertyDescriptor descriptor, String value, Class<?>... ifInOneOfTheseGroups) Validates the given property in the given configuration. |
Methods inherited from class de.smartics.properties.api.config.domain.AbstractAdminModeSupportedPropertiesManagement |
---|
isInAdminMode, setToAdminMode, toRepresentative |
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.ConfigurationPropertiesManagement |
---|
getPropertyStoreAccessor, toSerializable |
Constructor Detail |
---|
public AbstractCacheConfigurationPropertiesManagement(ConfigurationKey<?> configurationKey)
configurationKey
- the key to the configuration this cache implementation works for.
protected AbstractCacheConfigurationPropertiesManagement(de.smartics.properties.impl.config.cache.DependencyTrackingCache cache) throws NullPointerException
cache
- the synchronized cache.
NullPointerException
- if
cache
is
null
.
Method Detail |
---|
protected abstract ConfigurationPropertiesManagementSpi getDelegate()
null
.
protected final de.smartics.properties.impl.config.cache.DependencyTrackingCache getCache()
public Object getPropertyAsType(de.smartics.properties.api.core.domain.PropertyDescriptor descriptor) throws IllegalArgumentException, UnknownPropertyException, de.smartics.properties.api.core.domain.PropertyValueConversionException, de.smartics.properties.api.core.security.SecurityException, de.smartics.properties.api.core.app.PropertyRootException
ConfigurationProperties
descriptor
- descriptor key to the property.
null
if the property's value is actually unset.
IllegalArgumentException
- if
descriptor
is blank.
UnknownPropertyException
- if
descriptor
is not known.
de.smartics.properties.api.core.domain.PropertyValueConversionException
- if the property cannot be converted to its value.
de.smartics.properties.api.core.security.SecurityException
- on any problem decrypting an encrypted value.
de.smartics.properties.api.core.app.PropertyRootException
- on any problem.
public final ValidatedProperty getValidatedProperty(de.smartics.properties.api.core.domain.PropertyDescriptor descriptor, Object defaultValue) throws IllegalArgumentException, UnknownPropertyException, de.smartics.properties.api.core.domain.PropertyValidationException
ConfigurationProperties
descriptor
- descriptor key to the property.
defaultValue
- the default value to use in case no value has been specified.
null
, although the value / validated value of the returned property may be
null
.
IllegalArgumentException
- if
descriptor
is blank.
UnknownPropertyException
- if
descriptor
is not known.
de.smartics.properties.api.core.domain.PropertyValidationException
- if the property is invalid according to its constraints.
public final DescribedProperty getProperty(de.smartics.properties.api.core.domain.PropertyDescriptor descriptor, Object defaultValue) throws IllegalArgumentException, UnknownPropertyException
ConfigurationProperties
descriptor
- the descriptor containing the unique key of the property.
defaultValue
- the default value to use in case no value has been specified.
UnknownPropertyException
- if the key of the
descriptor
is not known.
IllegalArgumentException
public final DescribedProperty getProperty(String key) throws IllegalArgumentException, UnknownPropertyException
ConfigurationProperties
key
- the unique key of the property.
IllegalArgumentException
- if
key
is blank.
UnknownPropertyException
- if
key
is not known.
public final DescribedProperty getProperty(String key, Object defaultValue) throws IllegalArgumentException, UnknownPropertyException
ConfigurationProperties
key
- the unique key of the property.
defaultValue
- the default value to use in case no value has been specified.
IllegalArgumentException
- if
key
is blank.
UnknownPropertyException
- if
key
is not known.
public final Object getPropertyValue(de.smartics.properties.api.core.domain.PropertyDescriptor descriptor, Object defaultValue) throws IllegalArgumentException, UnknownPropertyException, de.smartics.properties.api.core.domain.PropertyValidationException
ConfigurationProperties
descriptor
- the key to the property.
defaultValue
- the default value to use in case no value has been specified.
null
is returned in cause of an optional property being not set.
UnknownPropertyException
- if the requested property is not known to the system.
de.smartics.properties.api.core.domain.PropertyValidationException
- if the property is invalid according to its constraints.
IllegalArgumentException
public final <T> T getProperties(Class<T> propertiesInterface)
ConfigurationProperties
PropertySet
annotation.
T
- type variable to enable a type save return value.
propertiesInterface
- a
PropertySet
annotated interface for which a implementation to access the property keys, descriptors and values is requested.
public final Property setProperty(de.smartics.properties.api.core.domain.PropertyKey key, String value) throws NullPointerException, de.smartics.properties.api.core.domain.PropertyValidationException, de.smartics.properties.api.core.domain.ReadOnlyPropertyException
ConfigurationPropertiesManagement
key
- the key to the property.
value
- the value to the property.
null
is returned if the property had no value prior to this call.
NullPointerException
- if
key
is
null
.
de.smartics.properties.api.core.domain.PropertyValidationException
- if the property value is invalid according to its constraints.
de.smartics.properties.api.core.domain.ReadOnlyPropertyException
- if the property to update is read-only.
public final Property unsetProperty(de.smartics.properties.api.core.domain.PropertyKey key) throws NullPointerException, de.smartics.properties.api.core.domain.ReadOnlyPropertyException
ConfigurationPropertiesManagement
key
- the key to the property.
null
is returned if the property had no value prior to this call.
NullPointerException
- if
key
is
null
.
de.smartics.properties.api.core.domain.ReadOnlyPropertyException
- if the property to update is read-only.
public final ConfigurationPropertiesManagement addDefinitions(PropertyProvider provider) throws NullPointerException
ConfigurationPropertiesManagement
provider
- the property definitions to add.
NullPointerException
- if
properties
is
null
.
public final void flush()
ConfigurationPropertiesManagement
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.
public final de.smartics.properties.api.core.domain.PropertyDescriptorRegistry getRegistry()
ConfigurationPropertiesManagement
public de.smartics.properties.api.core.security.PropertyValueSecurity getPropertyValueSecurity()
ConfigurationPropertiesManagement
public final Object getPropertyValue(de.smartics.properties.api.core.domain.PropertyDescriptor descriptor) throws NullPointerException, de.smartics.properties.api.core.domain.PropertyValidationException
ConfigurationProperties
descriptor
- the key to the property.
null
is returned in cause of an optional property being not set.
NullPointerException
- if
descriptor
is
null
.
de.smartics.properties.api.core.domain.PropertyValidationException
- if the property is invalid according to its constraints.
public final Object getPropertyValue(de.smartics.properties.api.core.domain.PropertyKey key) throws IllegalArgumentException, UnknownPropertyException, de.smartics.properties.api.core.domain.PropertyValidationException
ConfigurationProperties
key
- the key to the property.
null
is returned in cause of an optional property being not set.
IllegalArgumentException
- if
key
is blank.
UnknownPropertyException
- if
key
is not known.
de.smartics.properties.api.core.domain.PropertyValidationException
- if the property is invalid according to its constraints.
public final Object getPropertyValue(String key, Object defaultValue) throws NullPointerException, de.smartics.properties.api.core.domain.PropertyValueConversionException, de.smartics.properties.api.core.domain.PropertyValidationException, UnknownPropertyException
ConfigurationProperties
key
- the key to the property.
defaultValue
- the default value to use in case no value has been specified.
null
is returned in cause of an optional property being not set.
de.smartics.properties.api.core.domain.PropertyValidationException
- if the property is invalid according to its constraints.
UnknownPropertyException
- if
key
is not known.
NullPointerException
de.smartics.properties.api.core.domain.PropertyValueConversionException
public final Object getPropertyValue(String key) throws IllegalArgumentException, UnknownPropertyException, de.smartics.properties.api.core.domain.PropertyValidationException
ConfigurationProperties
key
- the key to the property.
null
is returned in cause of an optional property being not set.
IllegalArgumentException
- if
key
is blank.
UnknownPropertyException
- if
key
is not known.
de.smartics.properties.api.core.domain.PropertyValidationException
- if the property is invalid according to its constraints.
public final String getPropertyValueAsString(de.smartics.properties.api.core.domain.PropertyDescriptor descriptor) throws NullPointerException, de.smartics.properties.api.core.domain.PropertyValidationException
ConfigurationProperties
String
, the
Object.toString()
method is called to create the string representation of the value.
null
is always returned as
null
(not as the String "null").
descriptor
- the key to the property.
null
is returned in cause of an optional property being not set.
NullPointerException
- if
descriptor
is
null
.
de.smartics.properties.api.core.domain.PropertyValidationException
- if the property is invalid according to its constraints.
public final String getPropertyValueAsString(String key) throws IllegalArgumentException, UnknownPropertyException, de.smartics.properties.api.core.domain.PropertyValidationException
ConfigurationProperties
String
, the
Object.toString()
method is called to create the string representation of the value.
null
is always returned as
null
(not as the String "null").
key
- the key to the property.
null
is returned in cause of an optional property being not set.
IllegalArgumentException
- if
key
is blank.
UnknownPropertyException
- if
key
is not known.
de.smartics.properties.api.core.domain.PropertyValidationException
- if the property is invalid according to its constraints.
public final String getPropertyValueAsString(de.smartics.properties.api.core.domain.PropertyDescriptor descriptor, Object defaultValue) throws NullPointerException, de.smartics.properties.api.core.domain.PropertyValidationException
ConfigurationProperties
String
, the
Object.toString()
method is called to create the string representation of the value.
null
is always returned as
null
(not as the String "null").
descriptor
- the key to the property.
defaultValue
- the default value to use in case no value has been specified.
null
is returned in cause of an optional property being not set.
NullPointerException
- if
descriptor
is
null
.
de.smartics.properties.api.core.domain.PropertyValidationException
- if the property is invalid according to its constraints.
public final String getPropertyValueAsString(String key, Object defaultValue) throws IllegalArgumentException, UnknownPropertyException, de.smartics.properties.api.core.domain.PropertyValidationException
ConfigurationProperties
String
, the
Object.toString()
method is called to create the string representation of the value.
null
is always returned as
null
(not as the String "null").
key
- the key to the property.
defaultValue
- the default value to use in case no value has been specified.
null
is returned in cause of an optional property being not set.
IllegalArgumentException
- if
key
is blank.
UnknownPropertyException
- if
key
is not known.
de.smartics.properties.api.core.domain.PropertyValidationException
- if the property is invalid according to its constraints.
public final DescribedProperty getProperty(de.smartics.properties.api.core.domain.PropertyKey key) throws IllegalArgumentException, UnknownPropertyException
ConfigurationProperties
key
- the unique key of the property.
IllegalArgumentException
- if
key
is blank.
UnknownPropertyException
- if
key
is not known.
public final DescribedProperty getProperty(de.smartics.properties.api.core.domain.PropertyDescriptor descriptor) throws IllegalArgumentException, UnknownPropertyException
ConfigurationProperties
descriptor
- the descriptor containing the unique key of the property.
UnknownPropertyException
- if the key of the
descriptor
is not known.
IllegalArgumentException
public final ValidatedProperty getValidatedProperty(String key, Object defaultValue) throws IllegalArgumentException, UnknownPropertyException, de.smartics.properties.api.core.domain.PropertyValidationException
ConfigurationProperties
key
- the key to the property.
defaultValue
- the default value to use in case no value has been specified.
null
, although the value / validated value of the returned property may be
null
.
IllegalArgumentException
- if
key
is blank.
UnknownPropertyException
- if
key
is not known.
de.smartics.properties.api.core.domain.PropertyValidationException
- if the property is invalid according to its constraints.
public final ValidatedProperty getValidatedProperty(de.smartics.properties.api.core.domain.PropertyKey key, Object defaultValue) throws IllegalArgumentException, UnknownPropertyException, de.smartics.properties.api.core.domain.PropertyValidationException
ConfigurationProperties
key
- the key to the property.
defaultValue
- the default value to use in case no value has been specified.
null
, although the value / validated value of the returned property may be
null
.
IllegalArgumentException
- if
key
is blank.
UnknownPropertyException
- if
key
is not known.
de.smartics.properties.api.core.domain.PropertyValidationException
- if the property is invalid according to its constraints.
public final void addDescriptors(Class<?> propertySetType) throws de.smartics.properties.api.core.domain.DuplicatePropertyDeclarationsException
ConfigurationPropertiesManagement
propertySetType
- the type that declares the descriptors.
de.smartics.properties.api.core.domain.DuplicatePropertyDeclarationsException
- if any of the descriptors declare the same property.
public final ConfigurationKey<?> getKey()
ConfigurationProperties
null
.
public final de.smartics.properties.api.core.domain.PropertyDescriptor getDescriptor(String key) throws UnknownPropertyException
ConfigurationPropertiesManagement
key
- the of the requested descriptor.
key
.
UnknownPropertyException
- if the property is not known.
public final de.smartics.properties.api.core.domain.PropertiesContext getContext(Class<?> declaringType) throws NullPointerException
ConfigurationProperties
PropertySet
annotation. The context provides information about the properties of that set.
declaringType
- the type that declares the properties whose context is requested.
NullPointerException
- if
declaringType
is
null
.
public final de.smartics.properties.api.core.domain.PropertyDescriptor getDescriptor(de.smartics.properties.api.core.domain.PropertyKey key) throws UnknownPropertyException
ConfigurationPropertiesManagement
key
- the of the requested descriptor.
key
.
UnknownPropertyException
- if the property is not known.
public final List<de.smartics.properties.api.core.domain.PropertyDescriptor> getMandatoryPropertyDescriptors()
ConfigurationPropertiesManagement
Returns a copy that can be edited.
public final de.smartics.properties.api.core.domain.PropertyContext getContext(de.smartics.properties.api.core.domain.PropertyDescriptor descriptor) throws NullPointerException
ConfigurationProperties
descriptor
- the descriptor of the property whose context is requested.
NullPointerException
- if
descriptor
is
null
.
public final void validate() throws ConfigurationValidationException
ConfigurationProperties
ConfigurationValidationException
- if the configuration contains properties that do not meet the required constraints.
public final void validate(Class<?>... groups) throws ConfigurationValidationException
ConfigurationProperties
groups
- the validation groups to consider in the validation process. The groups will be validated in the given order. As soon as a validation group fails, the validation process is aborted without checking the not yet processed groups.
ConfigurationValidationException
- if the configuration contains properties that do not meet the required constraints.
public final void validate(boolean lenient, Class<?>... groups) throws ConfigurationValidationException
ConfigurationProperties
lenient
- the lenient flag that tells the validation process to handle unknown properties gracefully if set to
true
. If the value is
false
unknown properties are reported as validation failures.
groups
- the validation groups to consider in the validation process. The groups will be validated in the given order. As soon as a validation group fails, the validation process is aborted without checking the not yet processed groups.
ConfigurationValidationException
- if the configuration contains properties that do not meet the required constraints.
public final void validate(de.smartics.properties.api.core.domain.PropertyDescriptor descriptor, Class<?>... ifInOneOfTheseGroups) throws ConfigurationValidationException
ConfigurationProperties
descriptor
- the descriptor whose value is to be validated.
ifInOneOfTheseGroups
- the validation only takes place if this constraint is part of any of the specified groups or the argument is empty or
null
.
ConfigurationValidationException
- if property does not meet the required constraints.
public final void validate(de.smartics.properties.api.core.domain.PropertyDescriptor descriptor, String value, Class<?>... ifInOneOfTheseGroups) throws ConfigurationValidationException
ConfigurationProperties
descriptor
- the descriptor whose value is to be validated.
value
- the property value to be validated.
ifInOneOfTheseGroups
- the validation only takes place if this constraint is part of any of the specified groups or the argument is empty or
null
.
ConfigurationValidationException
- if property does not meet the required constraints.
public final void addPropertyChangeListener(de.smartics.properties.api.core.domain.PropertyKey name, PropertyChangeListener listener) throws NullPointerException
ConfigurationProperties
name
- the name of the property to track changes.
listener
- the listener to add.
NullPointerException
- if
name
or
listener
is
null
.
public final void removePropertyChangeListener(de.smartics.properties.api.core.domain.PropertyKey name, PropertyChangeListener listener) throws NullPointerException
ConfigurationProperties
name
- the name of the property to stop tracking changes.
listener
- the listener to remove.
NullPointerException
- if
name
or
listener
is
null
.
public final void addPropertyChangeListener(PropertyChangeListener listener) throws NullPointerException
ConfigurationProperties
listener
- the listener to add.
NullPointerException
- if
listener
is
null
.
public final void removePropertyChangeListener(PropertyChangeListener listener) throws NullPointerException
ConfigurationProperties
listener
- the listener to remove.
NullPointerException
- if
listener
is
null
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |