public class DefaultMutableConfiguration extends Object implements MutableConfiguration
MutableConfiguration.| Constructor and Description |
|---|
DefaultMutableConfiguration(org.apache.tamaya.Configuration config) |
| Modifier and Type | Method and Description |
|---|---|
void |
commitTransaction()
Commits the request.
|
String |
get(String key) |
<T> T |
get(String key,
Class<T> type) |
<T> T |
get(String key,
org.apache.tamaya.TypeLiteral<T> type) |
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. |
org.apache.tamaya.spi.ConfigurationContext |
getContext() |
List<MutablePropertySource> |
getMutablePropertySources()
Identifies the configuration backend that are targeted by this instance and which are
also responsible for writing back the changes applied.
|
<T> T |
getOrDefault(String key,
Class<T> type,
T defaultValue) |
String |
getOrDefault(String key,
String defaultValue) |
<T> T |
getOrDefault(String key,
org.apache.tamaya.TypeLiteral<T> type,
T defaultValue) |
Map<String,String> |
getProperties() |
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.
|
<T> T |
query(org.apache.tamaya.ConfigQuery<T> query) |
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.
|
String |
toString() |
org.apache.tamaya.Configuration |
with(org.apache.tamaya.ConfigOperator operator) |
public DefaultMutableConfiguration(org.apache.tamaya.Configuration config)
public void setChangePropagationPolicy(ChangePropagationPolicy changePropagationPolicy)
MutableConfigurationChangePropagationPolicy.setChangePropagationPolicy in interface MutableConfigurationchangePropagationPolicy - the policy, not null.MutableConfiguration.getChangePropagationPolicy()public ChangePropagationPolicy getChangePropagationPolicy()
MutableConfigurationChangePropagationPolicy.This policy controls how configuration changes are written/published
to the known MutablePropertySource instances of a Configuration.getChangePropagationPolicy in interface MutableConfigurationChangePropagationPolicy, never null.public void setAutoCommit(boolean autoCommit)
MutableConfigurationsetAutoCommit in interface MutableConfigurationautoCommit - the new autoCommit policy.public UUID getTransactionId()
MutableConfigurationgetTransactionId in interface MutableConfigurationpublic boolean getAutoCommit()
MutableConfigurationgetAutoCommit in interface MutableConfigurationpublic List<MutablePropertySource> getMutablePropertySources()
MutableConfigurationgetMutablePropertySources in interface MutableConfigurationpublic boolean isWritable(String keyExpression)
MutableConfigurationisWritable in interface MutableConfigurationkeyExpression - 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.*".public List<MutablePropertySource> getPropertySourcesThatCanWrite(String keyExpression)
MutableConfigurationgetPropertySourcesThatCanWrite in interface MutableConfigurationkeyExpression - 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.*".public boolean isRemovable(String keyExpression)
MutableConfigurationisRemovable in interface MutableConfigurationkeyExpression - 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.*".public List<MutablePropertySource> getPropertySourcesThatCanRemove(String keyExpression)
MutableConfigurationgetPropertySourcesThatCanRemove in interface MutableConfigurationkeyExpression - 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.*".public boolean isExisting(String keyExpression)
MutableConfigurationisExisting in interface MutableConfigurationkeyExpression - 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.*".public List<MutablePropertySource> getPropertySourcesThatKnow(String keyExpression)
MutableConfigurationgetPropertySourcesThatKnow in interface MutableConfigurationkeyExpression - 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.*".public MutableConfiguration put(String key, String value)
MutableConfigurationput in interface MutableConfigurationkey - the property's key, not null.value - the property's value, not null.public MutableConfiguration putAll(Map<String,String> properties)
MutableConfigurationConfigException. 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 MutableConfigurationproperties - the properties tobe written, not null.public MutableConfiguration remove(String... keys)
MutableConfigurationConfigException. 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 MutableConfigurationkeys - the property's keys to be removedProperties, not null.public UUID startTransaction()
MutableConfigurationMutablePropertySource get the right transaction id
passed, when writing (committing) any changes applied.startTransaction in interface MutableConfigurationpublic void commitTransaction()
MutableConfigurationConfiguration instance,
since visibility of changes also depends on the ordinals set on the PropertySources
configured.commitTransaction in interface MutableConfigurationpublic void rollbackTransaction()
MutableConfigurationrollbackTransaction in interface MutableConfigurationpublic MutableConfiguration remove(Collection<String> keys)
MutableConfigurationConfigException. 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 MutableConfigurationkeys - the property's keys to be removedProperties, not null.public String getOrDefault(String key, String defaultValue)
getOrDefault in interface org.apache.tamaya.Configurationpublic <T> T getOrDefault(String key, Class<T> type, T defaultValue)
getOrDefault in interface org.apache.tamaya.Configurationpublic <T> T get(String key, Class<T> type)
get in interface org.apache.tamaya.Configurationpublic <T> T get(String key, org.apache.tamaya.TypeLiteral<T> type)
get in interface org.apache.tamaya.Configurationpublic <T> T getOrDefault(String key, org.apache.tamaya.TypeLiteral<T> type, T defaultValue)
getOrDefault in interface org.apache.tamaya.Configurationpublic Map<String,String> getProperties()
getProperties in interface org.apache.tamaya.Configurationpublic org.apache.tamaya.Configuration with(org.apache.tamaya.ConfigOperator operator)
with in interface org.apache.tamaya.Configurationpublic <T> T query(org.apache.tamaya.ConfigQuery<T> query)
query in interface org.apache.tamaya.Configurationpublic org.apache.tamaya.spi.ConfigurationContext getContext()
getContext in interface org.apache.tamaya.ConfigurationCopyright © 2014–2016 Apache Software Foundation. All rights reserved.