public abstract class AbstractMutablePropertySource extends org.apache.tamaya.spisupport.BasePropertySource implements MutablePropertySource
MutablePropertySource
.Modifier and Type | Field and Description |
---|---|
protected Map<UUID,ConfigChangeContext> |
transactions
Map with the curren transactions, identified by transactionId.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractMutablePropertySource()
Constructor udsing zero' as default ordinal.
|
protected |
AbstractMutablePropertySource(int defaultOrdinal)
Constructor allow to pass the default ordinal to be used.
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
commitInternal(ConfigChangeContext context)
Commit of the changes to the current property source.
|
void |
commitTransaction(UUID transactionId)
Commits the request.
|
protected Map<String,String> |
getAddedProperties(UUID transactionId)
Get a list with property keys added within the given transaction.
|
protected Set<String> |
getRemovedProperties(UUID transactionId)
Get a list with property keys removed within the given transaction.
|
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).
|
MutablePropertySource |
put(UUID transactionId,
String key,
String value)
Sets a property.
|
MutablePropertySource |
putAll(UUID transactionId,
Map<String,String> properties)
Puts all given configuration entries.
|
MutablePropertySource |
remove(UUID transactionId,
Collection<String> keys)
Removes all given configuration entries.
|
MutablePropertySource |
remove(UUID transactionId,
String... keys)
Removes all given configuration entries.
|
void |
rollbackTransaction(UUID transactionId)
Rollback any changes leaving everything unchanged.
|
void |
startTransaction(UUID transactionId)
Start a new transaction context with the given isolation policy.
|
get, getDefaultOrdinal, getOrdinal, isScannable
protected final Map<UUID,ConfigChangeContext> transactions
protected AbstractMutablePropertySource()
protected AbstractMutablePropertySource(int defaultOrdinal)
defaultOrdinal
- the default ordinal.protected final Set<String> getRemovedProperties(UUID transactionId)
transactionId
- the transaction id, not null.protected final Map<String,String> getAddedProperties(UUID transactionId)
transactionId
- the transaction id, not null.public boolean isWritable(String keyExpression)
MutablePropertySource
isWritable
in interface MutablePropertySource
keyExpression
- the key to be checked for write access (including creation), not null.public boolean isRemovable(String keyExpression)
MutablePropertySource
isRemovable
in interface MutablePropertySource
keyExpression
- the key to be checked for removal, not null.public final MutablePropertySource put(UUID transactionId, String key, String value)
MutablePropertySource
put
in interface MutablePropertySource
transactionId
- the transactionId used to isolate the change, not null.key
- the property's key, not null.value
- the property's value, not null.public final MutablePropertySource putAll(UUID transactionId, Map<String,String> properties)
MutablePropertySource
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.putAll
in interface MutablePropertySource
transactionId
- the transactionId used to isolate the change, not null.properties
- the properties tobe written, not null.public final MutablePropertySource remove(UUID transactionId, String... keys)
MutablePropertySource
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.remove
in interface MutablePropertySource
transactionId
- the transactionId used to isolate the change, not null.keys
- the property's keys to be removedProperties, not null.public final MutablePropertySource remove(UUID transactionId, Collection<String> keys)
MutablePropertySource
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.remove
in interface MutablePropertySource
transactionId
- the transactionId used to isolate the change, not null.keys
- the property's keys to be removedProperties, not null.public final void startTransaction(UUID transactionId)
MutablePropertySource
startTransaction
in interface MutablePropertySource
transactionId
- the transaction id, not null.public final void commitTransaction(UUID transactionId)
MutablePropertySource
Configuration
instance,
since visibility of changes also depends on the ordinals set on the PropertySource
s
configured.commitTransaction
in interface MutablePropertySource
transactionId
- the transaction id, not null.protected abstract void commitInternal(ConfigChangeContext context)
context
- The configuration change to be committed/applied.public final void rollbackTransaction(UUID transactionId)
MutablePropertySource
rollbackTransaction
in interface MutablePropertySource
transactionId
- the transaction id, not null.Copyright © 2014–2016 Apache Software Foundation. All rights reserved.