deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject svn commit: r1492554 - /deltaspike/site/trunk/content/core.mdtext
Date Thu, 13 Jun 2013 07:31:52 GMT
Author: struberg
Date: Thu Jun 13 07:31:52 2013
New Revision: 1492554

removing ConfigSource chapter from core as it is covered in configuration.mdtext


Modified: deltaspike/site/trunk/content/core.mdtext
--- deltaspike/site/trunk/content/core.mdtext (original)
+++ deltaspike/site/trunk/content/core.mdtext Thu Jun 13 07:31:52 2013
@@ -185,68 +185,6 @@ E.g.:
-## Low-level configurations
-### ConfigResolver
-In some cases low-level configs are needed e.g. during the bootstrapping process of the CDI
container. (Currently it's e.g. used for configuring the value of the current project-stage,
configured values which can be used in the expressions for `@Exclude`,...) Usually it isn't
used by users directly, but DeltaSpike needs such a low-level approach for several features.
Therefore it's possible to use a so called `ConfigResolver` which resolves and caches `ConfigSource`s
per application.
-The method `ConfigResolver#getPropertyValue` allows to provide a string based key and returns
the configured value as `String` or `null` if no value has been found (`#getAllPropertyValues`
has a similar contract but it returns a list which might be empty if there are no configured
values for the given key). Optionally it's possible to provide a default value which gets
retured instead of `null`.
-Simple lookup in the low-level config:
-    :::java
-    ConfigResolver.getPropertyValue("myKey");
-### PropertyFileConfig
-### ConfigSource
-A `ConfigResolver` uses all configured implementations of `ConfigSource` to lookup the property
in question.
-Per default there are implementations for the following config sources (listed in the lookup
-  - System properties
-  - Environment properties
-  - JNDI values
-  - Properties file values (
-**It's possible to change this order and to add custom config sources.**
-**Note:** Important Hints esp. for custom implementations:
-  - The config-source with the highest ordinal gets used first.
-  - If a custom implementation should be invoked *before* the default implementations, use
an ordinal-value > 400
-  - If a custom implementation should be invoked *after* the default implementations, use
an ordinal-value < 100
-### Reordering of the default order of Config-Sources
-To change the lookup order, you have to configure the ordinal in the corresponding config
source (e.g. to change the config ordinal of the config source for system properties, you
have to set the system property with the ordinal key 'deltaspike_ordinal' and the new value).
-Example with `/META-INF/`: 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`.
-In case of **property files** which are supported by default (`/META-INF/`)
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).
-### Custom Config-Sources
-To add a custom config-source, you have to implement the interface `ConfigSourceProvider`
(and `ConfigSource`) and activate the implementation of `ConfigSourceProvider` with the std.
SPI mechanism provided by Java via the `ServiceLoader` (that means you have to create `/META-INF/services/org.apache.deltaspike.core.spi.config.ConfigSourceProvider`
which contains the fully qualified class name of the custom implementation/s).
-If you have a simple standalone `ConfigSource` you can also register it directly by creating
a file `/META-INF/services/org.apache.deltaspike.core.spi.config.ConfigSource` which contains
the fully qualified class name of your `ConfigSource`.
-Please note that a single `ConfigSource` should be either registered directly or via a `ConfigSourceProvider`,
but never both ways. 
-**Important Hint:**
-Have a look at the abstract base-implementation of `ConfigSource` DeltaSpike is using internally,
if a custom implementation should load the ordinal value from the config-source like the default
implementations provided by DeltaSpike do.
-## Type-safe config
-### @ConfigProperty
 ## @Exclude

View raw message