thanks for catching this! In fact we just used more or less random default values for the default ordinal.
The principle is easy: the higher the ordinal, the more important the value in this config. Each ConfigSource has as default ordinal which takes precedence if the 'deltaspike_ordinal=820' (820 is a sample ordinal) is not present in the current ConfigSource (e.g. a META-INF/apache-deltaspike.properties) Please note that each property file is treated as a distinct ConfigSource and can define it's own ordinal! The default ordinals should provide a 'natural order'. But we need to define this order first. From less important to most important 1.) property files 2.) environment property (via System.getenv()) 3.) system property (via System.getProperty()) 4.) JNDI Wdyt? I'm not really sure about 2. and 3. Of course, as noted above any user can chagne the default ordinal in his configuration anyway. But it should not necessary - convention over configuration rules! LieGrue, strub >________________________________ > From: "[email protected]" <[email protected]> >To: [email protected] >Sent: Saturday, January 14, 2012 6:00 AM >Subject: git commit: DELTASPIKE-50 javadoc for ConfigSource#getOrdinal > >Updated Branches: > refs/heads/master f6b229b0a -> 06b5c444e > > >DELTASPIKE-50 javadoc for ConfigSource#getOrdinal > >(including important hints needed >for to the changed approach) > > >Project: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/repo >Commit: >http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/commit/06b5c444 >Tree: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/tree/06b5c444 >Diff: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/diff/06b5c444 > >Branch: refs/heads/master >Commit: 06b5c444eb8eec02f94cfc536762f5aa13313166 >Parents: f6b229b >Author: gpetracek <[email protected]> >Authored: Sat Jan 14 05:47:05 2012 +0100 >Committer: gpetracek <[email protected]> >Committed: Sat Jan 14 05:47:05 2012 +0100 > >---------------------------------------------------------------------- >.../deltaspike/core/spi/config/ConfigSource.java | 32 ++++++++++++++- >1 files changed, 31 insertions(+), 1 deletions(-) >---------------------------------------------------------------------- > > >http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/06b5c444/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/config/ConfigSource.java >---------------------------------------------------------------------- >diff --git >a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/config/ConfigSource.java > >b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/config/ConfigSource.java >index c77cd33..fec7720 100644 >--- >a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/config/ConfigSource.java >+++ >b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/config/ConfigSource.java >@@ -35,9 +35,39 @@ public interface ConfigSource > * Any ConfigSource might use it's own though or even return a hardcoded > * in {@link #getOrdinal()}. > */ >- static final String DELTASPIKE_ORDINAL = "deltaspike_ordinal"; >+ static String DELTASPIKE_ORDINAL = "deltaspike_ordinal"; > > /** >+ * Lookup order: >+ * >+ * <ol> >+ * <li>System properties (ordinal 400)</li> >+ * <li>Environment properties (ordinal 300)</li> >+ * <li>JNDI values (ordinal 200)</li> >+ * <li>Properties file values >(/META-INF/apache-deltaspike.properties) (ordinal 100)</li> >+ * </ol> >+ * <p/> >+ * <p><b>Important Hints for custom implementations</b>:</p> >+ * <p> >+ * If a custom implementation should be invoked <b>before</b> the default >implementations, use a value > 400 >+ * </p> >+ * <p> >+ * If a custom implementation should be invoked <b>after</b> the default >implementations, use a value < 100 >+ * </p> >+ * <p> >+ * >+ * <b>IMPORTANT: </b> Have a look at the abstract base-implementation >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. >+ * >+ * </p> >+ * <p/> >+ * <p>Reordering of the default order of the config-sources:</p> >+ * <p>Example: If the properties file/s should be used <b>before</b> 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.</p> >+ * > * @return the 'importance' aka ordinal of the configured values. The >higher, the more important. > */ > int getOrdinal(); > > > >
