tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From otavioj...@apache.org
Subject incubator-tamaya git commit: split FallbackSimpleConfigProvider to another file
Date Sat, 20 Dec 2014 16:59:36 GMT
Repository: incubator-tamaya
Updated Branches:
  refs/heads/master 0072535ab -> cf42a29b7


split FallbackSimpleConfigProvider to another file


Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/cf42a29b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/cf42a29b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/cf42a29b

Branch: refs/heads/master
Commit: cf42a29b7601ce78706fa14f778ffeef5b9d8ddb
Parents: 0072535
Author: otaviojava <otaviojava@people.apache.org>
Authored: Sat Dec 20 14:59:24 2014 -0200
Committer: otaviojava <otaviojava@people.apache.org>
Committed: Sat Dec 20 14:59:24 2014 -0200

----------------------------------------------------------------------
 ...DefaultConfigurationManagerSingletonSpi.java | 51 -----------------
 .../config/FallbackSimpleConfigProvider.java    | 60 ++++++++++++++++++++
 2 files changed, 60 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf42a29b/core/src/main/java/org/apache/tamaya/core/internal/config/DefaultConfigurationManagerSingletonSpi.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/internal/config/DefaultConfigurationManagerSingletonSpi.java
b/core/src/main/java/org/apache/tamaya/core/internal/config/DefaultConfigurationManagerSingletonSpi.java
index dfb1cfa..cb096e8 100644
--- a/core/src/main/java/org/apache/tamaya/core/internal/config/DefaultConfigurationManagerSingletonSpi.java
+++ b/core/src/main/java/org/apache/tamaya/core/internal/config/DefaultConfigurationManagerSingletonSpi.java
@@ -28,7 +28,6 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.function.Consumer;
 import java.util.function.Predicate;
 
-import org.apache.tamaya.AggregationPolicy;
 import org.apache.tamaya.ConfigChangeSet;
 import org.apache.tamaya.ConfigException;
 import org.apache.tamaya.Configuration;
@@ -36,7 +35,6 @@ import org.apache.tamaya.PropertySource;
 import org.apache.tamaya.core.internal.el.DefaultExpressionEvaluator;
 import org.apache.tamaya.core.internal.inject.ConfigTemplateInvocationHandler;
 import org.apache.tamaya.core.internal.inject.ConfigurationInjector;
-import org.apache.tamaya.core.properties.PropertySourceBuilder;
 import org.apache.tamaya.core.spi.ConfigurationProviderSpi;
 import org.apache.tamaya.core.spi.ExpressionEvaluator;
 import org.apache.tamaya.spi.ConfigurationManagerSingletonSpi;
@@ -152,55 +150,6 @@ public class DefaultConfigurationManagerSingletonSpi implements ConfigurationMan
         return config;
     }
 
-    /**
-     * Implementation of a default config provider used as fallback, if no {@link org.apache.tamaya.core.spi.ConfigurationProviderSpi}
-     * instance is registered for providing the {@code default} {@link org.apache.tamaya.Configuration}.
The providers loads the follwing
-     * config resources:
-     * <ul>
-     *     <li>Classpath: META-INF/cfg/default/&#42;&#42;/&#42;.xml, META-INF/cfg/default/&#42;&#42;/&#42;.properties,
META-INF/cfg/default/&#42;&#42;/&#42;.ini</li>
-     *     <li>Classpath: META-INF/cfg/config/#42;#42;/#42;.xml, META-INF/cfg/config/#42;#42;/#42;.properties,
META-INF/cfg/config/#42;#42;/#42;.ini</li>
-     *     <li>Files: defined by the system property -Dconfig.dir</li>
-     *     <li>system properties</li>
-     * </ul>
-     */
-    private static final class FallbackSimpleConfigProvider implements ConfigurationProviderSpi
{
-        /**
-         * The loaded configuration instance.
-         */
-        private volatile Configuration configuration;
-
-        @Override
-        public String getConfigName() {
-            return DEFAULT_CONFIG_NAME;
-        }
 
-        @Override
-        public Configuration getConfiguration() {
-            Configuration cfg = configuration;
-            if (cfg == null) {
-                reload();
-                cfg = configuration;
-            }
-            return cfg;
-        }
-
-
-        @Override
-        public void reload() {
-            this.configuration =
-                    PropertySourceBuilder.of(DEFAULT_CONFIG_NAME)
-                            .addProviders(PropertySourceBuilder.of("CL default")
-                                    .withAggregationPolicy(AggregationPolicy.LOG_ERROR)
-                                    .addPaths("META-INF/cfg/default/**/*.xml", "META-INF/cfg/default/**/*.properties",
"META-INF/cfg/default/**/*.ini")
-                                    .build())
-                            .addProviders(PropertySourceBuilder.of("CL default")
-                                    .withAggregationPolicy(AggregationPolicy.LOG_ERROR)
-                                    .addPaths("META-INF/cfg/config/**/*.xml", "META-INF/cfg/config/**/*.properties",
"META-INF/cfg/config/**/*.ini")
-                                    .build())
-                            .addSystemProperties()
-                            .addEnvironmentProperties()
-                            .build().toConfiguration();
-        }
-    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf42a29b/core/src/main/java/org/apache/tamaya/core/internal/config/FallbackSimpleConfigProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/internal/config/FallbackSimpleConfigProvider.java
b/core/src/main/java/org/apache/tamaya/core/internal/config/FallbackSimpleConfigProvider.java
new file mode 100644
index 0000000..42140c7
--- /dev/null
+++ b/core/src/main/java/org/apache/tamaya/core/internal/config/FallbackSimpleConfigProvider.java
@@ -0,0 +1,60 @@
+package org.apache.tamaya.core.internal.config;
+
+import org.apache.tamaya.AggregationPolicy;
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.core.properties.PropertySourceBuilder;
+import org.apache.tamaya.core.spi.ConfigurationProviderSpi;
+
+/**
+ * Implementation of a default config provider used as fallback, if no {@link org.apache.tamaya.core.spi.ConfigurationProviderSpi}
+ * instance is registered for providing the {@code default} {@link org.apache.tamaya.Configuration}.
The providers loads the follwing
+ * config resources:
+ * <ul>
+ *     <li>Classpath: META-INF/cfg/default/&#42;&#42;/&#42;.xml, META-INF/cfg/default/&#42;&#42;/&#42;.properties,
META-INF/cfg/default/&#42;&#42;/&#42;.ini</li>
+ *     <li>Classpath: META-INF/cfg/config/#42;#42;/#42;.xml, META-INF/cfg/config/#42;#42;/#42;.properties,
META-INF/cfg/config/#42;#42;/#42;.ini</li>
+ *     <li>Files: defined by the system property -Dconfig.dir</li>
+ *     <li>system properties</li>
+ * </ul>
+ */
+public class FallbackSimpleConfigProvider implements ConfigurationProviderSpi {
+
+    private static final String DEFAULT_CONFIG_NAME = "default";
+
+    /**
+     * The loaded configuration instance.
+     */
+    private volatile Configuration configuration;
+
+    @Override
+    public String getConfigName() {
+        return DEFAULT_CONFIG_NAME;
+    }
+
+    @Override
+    public Configuration getConfiguration() {
+        Configuration cfg = configuration;
+        if (cfg == null) {
+            reload();
+            cfg = configuration;
+        }
+        return cfg;
+    }
+
+
+    @Override
+    public void reload() {
+        this.configuration =
+                PropertySourceBuilder.of(DEFAULT_CONFIG_NAME)
+                        .addProviders(PropertySourceBuilder.of("CL default")
+                                .withAggregationPolicy(AggregationPolicy.LOG_ERROR)
+                                .addPaths("META-INF/cfg/default/**/*.xml", "META-INF/cfg/default/**/*.properties",
"META-INF/cfg/default/**/*.ini")
+                                .build())
+                        .addProviders(PropertySourceBuilder.of("CL default")
+                                .withAggregationPolicy(AggregationPolicy.LOG_ERROR)
+                                .addPaths("META-INF/cfg/config/**/*.xml", "META-INF/cfg/config/**/*.properties",
"META-INF/cfg/config/**/*.ini")
+                                .build())
+                        .addSystemProperties()
+                        .addEnvironmentProperties()
+                        .build().toConfiguration();
+    }
+}
\ No newline at end of file


Mime
View raw message