public interface PropertySource
A PropertySourceProvider will get picked up via the
ServiceLoader mechanism and can be registered via
META-INF/services/org.apache.tamaya.spi.PropertySource
If you like to register multiple PropertySources at the same time
you can use the PropertySourceProvider
interface.
| Modifier and Type | Field and Description |
|---|---|
static String |
TAMAYA_ORDINAL
property name to override default tamaya ordinals
|
| Modifier and Type | Method and Description |
|---|---|
default String |
get(String key)
Access a property.
|
default int |
getDefaultOrdinal()
Returns the default ordinal used, when no ordinal is set, or the ordinal was not parseable to an int value.
|
String |
getName()
Get the name of the property source.
|
default int |
getOrdinal()
Lookup order:
TODO rethink whole default PropertySources and ordering:
TODO introduce default values or constants for ordinals
System properties (ordinal 400)
Environment properties (ordinal 300)
JNDI values (ordinal 200)
Properties file values (/META-INF/applicationConfiguration.properties) (ordinal 100)
Important Hints for custom implementations:
If a custom implementation should be invoked before the default implementations, use a value > 400
If a custom implementation should be invoked after the default implementations, use a value < 100
Reordering of the default order of the config-sources:
Example: If the properties file/s should be used before the other implementations,
you have to configure an ordinal > 400.
|
Map<String,String> |
getProperties()
Access the current properties as Map.
|
default boolean |
isScannable()
Determines if this config source could be scanned for its list of properties.
|
static final String TAMAYA_ORDINAL
default int getOrdinal()
Important Hints for custom implementations:
If a custom implementation should be invoked before the default implementations, use a value > 400
If a custom implementation should be invoked after the default implementations, use a value < 100
Reordering of the default order of the config-sources:
Example: If the properties file/s should be used before the other implementations, you have to configure an ordinal > 400. That means, you have to add e.g. deltaspike_ordinal=401 to /META-INF/apache-deltaspike.properties . Hint: In case of property files every file is handled as independent config-source, but all of them have ordinal 400 by default (and can be reordered in a fine-grained manner.
default int getDefaultOrdinal()
String getName()
ConfigurationContext
the name of a PropertySource is unique.default String get(String key)
//X TODO discuss if the key can be null
key - the property's key, not null.null. An empty String will kind of 'erase' previous values.Map<String,String> getProperties()
default boolean isScannable()
PropertySources which are not scannable might not be able to find all the
configured values to provide via getProperties(). This can e.g. happen
if the underlying storage doesn't support listing.
true if this PropertySource could be scanned for its list of properties,
false if it should not be scanned.Copyright © 2014–2015 Apache Software Foundation. All rights reserved.