public interface MutableConfiguration
extends org.apache.tamaya.Configuration
Configuration
must be thread-safe. Methods handling configuration changes are expected to be used in a single threaded environment
only. For multi-threaded us create a new instance of MutableConfiguration
for each thread.Modifier and Type | Method and Description |
---|---|
void |
commitTransaction()
Commits the request.
|
boolean |
getAutoCommit()
Get the current autoCommit policy.
|
ChangePropagationPolicy |
getChangePropagationPolicy()
Access the active
ChangePropagationPolicy .This policy controls how configuration changes are written/published
to the known MutablePropertySource instances of a Configuration . |
List<MutablePropertySource> |
getMutablePropertySources()
Identifies the configuration backend that are targeted by this instance and which are
also responsible for writing back the changes applied.
|
List<MutablePropertySource> |
getPropertySourcesThatCanRemove(String keyExpression)
Identifies the configuration backend that know the given key(s) and support removing it/them.
|
List<MutablePropertySource> |
getPropertySourcesThatCanWrite(String keyExpression)
Identifies the configuration backends that supports writing the given key(s).
|
List<MutablePropertySource> |
getPropertySourcesThatKnow(String keyExpression)
Identifies the configuration backend that know the given key(s).
|
UUID |
getTransactionId()
Get the current transaction id.
|
boolean |
isExisting(String keyExpression)
Checks if any keys of the given type already exist in the write backend.
|
boolean |
isRemovable(String keyExpression)
Checks if a configuration key is removable.
|
boolean |
isWritable(String keyExpression)
Checks if a configuration key is writable (or it can be added).
|
MutableConfiguration |
put(String key,
String value)
Sets a property.
|
MutableConfiguration |
putAll(Map<String,String> properties)
Puts all given configuration entries.
|
MutableConfiguration |
remove(Collection<String> keys)
Removes all given configuration entries.
|
MutableConfiguration |
remove(String... keys)
Removes all given configuration entries.
|
void |
rollbackTransaction()
Rollback any changes leaving everything unchanged.
|
void |
setAutoCommit(boolean autoCommit)
Set the autoCommit policy to be used for this configuration instance.
|
void |
setChangePropagationPolicy(ChangePropagationPolicy changePropagationPolicy)
Set the
ChangePropagationPolicy . |
UUID |
startTransaction()
Starts a new transaction, if necessary, and returns the transaction id.
|
UUID startTransaction()
MutablePropertySource
get the right transaction id
passed, when writing (committing) any changes applied.void commitTransaction()
Configuration
instance,
since visibility of changes also depends on the ordinals set on the PropertySource
s
configured.org.apache.tamaya.ConfigException
- if the request already has been committed or cancelled, or the commit fails.void rollbackTransaction()
UUID getTransactionId()
boolean getAutoCommit()
void setChangePropagationPolicy(ChangePropagationPolicy changePropagationPolicy)
ChangePropagationPolicy
.changePropagationPolicy
- the policy, not null.getChangePropagationPolicy()
ChangePropagationPolicy getChangePropagationPolicy()
ChangePropagationPolicy
.This policy controls how configuration changes are written/published
to the known MutablePropertySource
instances of a Configuration
.ChangePropagationPolicy
, never null.void setAutoCommit(boolean autoCommit)
autoCommit
- the new autoCommit policy.IllegalStateException
- when there are uncommitted changes.List<MutablePropertySource> getMutablePropertySources()
boolean isWritable(String keyExpression)
keyExpression
- the key to be checked for write access (including creation), not null. Here this could also
be a regular expression, such "as a.b.c.*".List<MutablePropertySource> getPropertySourcesThatCanWrite(String keyExpression)
keyExpression
- the key to be checked for write access (including creation), not null. Here this could also
be a regular expression, such "as a.b.c.*".boolean isRemovable(String keyExpression)
keyExpression
- the keyExpression the key to be checked for write access (including creation), not null.
Here this could also
be a regular expression, such "as a.b.c.*".List<MutablePropertySource> getPropertySourcesThatCanRemove(String keyExpression)
keyExpression
- the key to be checked for write access (including creation), not null. Here this could also
be a regular expression, such "as a.b.c.*".boolean isExisting(String keyExpression)
keyExpression
- the key to be checked for write access (including creation), not null. Here this could
also be a regular expression, such "as a.b.c.*".List<MutablePropertySource> getPropertySourcesThatKnow(String keyExpression)
keyExpression
- the key to be checked for write access (including creation), not null. Here this could also
be a regular expression, such "as a.b.c.*".MutableConfiguration put(String key, String value)
key
- the property's key, not null.value
- the property's value, not null.org.apache.tamaya.ConfigException
- if the key/value cannot be added, or the request is read-only.MutableConfiguration putAll(Map<String,String> properties)
ConfigException
. If errors occur afterwards, when the properties are effectively
written back to the backends, the errors should be collected and returned as part of the ConfigException
payload. Nevertheless the operation should in that case remove all entries as far as possible and abort the
writing operation.properties
- the properties tobe written, not null.org.apache.tamaya.ConfigException
- if any of the given properties could not be written, or the request
is read-only.MutableConfiguration remove(Collection<String> keys)
ConfigException
. If errors
occur afterwards, when the properties are effectively written back to the backends, the errors should be
collected and returned as part of the ConfigException payload. Nevertheless the operation should in that case
remove all entries as far as possible and abort the writing operation.keys
- the property's keys to be removedProperties, not null.org.apache.tamaya.ConfigException
- if any of the given keys could not be removedProperties, or the
request is read-only.MutableConfiguration remove(String... keys)
ConfigException
. If errors
occur afterwards, when the properties are effectively written back to the backends, the errors should be
collected and returned as part of the ConfigException payload. Nevertheless the operation should in that case
remove all entries as far as possible and abort the writing operation.keys
- the property's keys to be removedProperties, not null.org.apache.tamaya.ConfigException
- if any of the given keys could not be removedProperties, or the request is read-only.Copyright © 2014–2016 Apache Software Foundation. All rights reserved.