tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ple...@apache.org
Subject [3/3] incubator-tamaya-sandbox git commit: Simplified the sandbox structure.
Date Tue, 06 Sep 2016 17:45:22 GMT
Simplified the sandbox structure.


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

Branch: refs/heads/master
Commit: 07b101310c9b50ed6def069e092f8556328f3483
Parents: 194a48b
Author: Oliver B. Fischer <plexus@apache.org>
Authored: Tue Sep 6 19:44:58 2016 +0200
Committer: Oliver B. Fischer <plexus@apache.org>
Committed: Tue Sep 6 19:44:58 2016 +0200

----------------------------------------------------------------------
 apache-commons/pom.xml                          |  75 ++++++
 .../commons/CommonsConfigPropertySource.java    |  81 +++++++
 .../commons/IniConfigurationFormat.java         |  75 ++++++
 integration/commons/pom.xml                     |  75 ------
 .../commons/CommonsConfigPropertySource.java    |  81 -------
 .../commons/IniConfigurationFormat.java         |  75 ------
 integration/pom.xml                             |  39 ----
 .../internal/FileProprtyStoreProviderSpi.java   |  85 -------
 ...he.tamaya.store.spi.PropertyStoreProviderSpi |  18 --
 .../HazelcastProprtyStoreProviderSpi.java       |  87 -------
 .../org.apache.tamaya.store.PropertyStore       |  19 --
 metamodel-simple/config/README.txt              |  20 ++
 metamodel-simple/config/test3.properties        |  21 ++
 metamodel-simple/pom.xml                        |  86 +++++++
 .../ConfigDirPropertySourceProvider.java        |  81 +++++++
 .../MetainfConfigPropertySourceProvider.java    |  62 +++++
 ...org.apache.tamaya.spi.PropertySourceProvider |  20 ++
 .../tamaya/metamodel/simple/SimpleTest.java     |  26 +++
 .../resources/META-INF/config/test.properties   |  20 ++
 .../resources/META-INF/config/test2.properties  |  20 ++
 metamodel-staged/pom.xml                        | 114 +++++++++
 .../org/apache/tamaya/dsl/DSLFormatManager.java | 115 +++++++++
 .../apache/tamaya/dsl/MetaConfiguration.java    | 144 ++++++++++++
 .../org/apache/tamaya/dsl/ProfileManager.java   | 213 +++++++++++++++++
 .../apache/tamaya/dsl/TamayaConfigurator.java   | 234 +++++++++++++++++++
 .../tamaya/dsl/WrappedPropertySource.java       | 100 ++++++++
 .../DSLLoadingConfigurationProviderSpi.java     |  82 +++++++
 .../NamedDSLPropertySourceProvider.java         |  53 +++++
 .../ResourceDSLPropertySourceProvider.java      |  82 +++++++
 .../org/apache/tamaya/dsl/package-info.java     |  23 ++
 .../spi/BaseStagedPropertySourceProvider.java   | 121 ++++++++++
 .../staged/spi/DSLPropertySourceProvider.java   |  51 ++++
 .../spi/StagedConfigPropertiesProvider.java     | 137 +++++++++++
 .../apache/tamaya/staged/spi/package-info.java  |  23 ++
 ...g.apache.tamaya.spi.ConfigurationProviderSpi |  19 ++
 ....tamaya.staged.spi.DSLPropertySourceProvider |  20 ++
 .../apache/tamaya/dsl/ProfileManagerTest.java   |  78 +++++++
 .../src/test/resources/GLOBAL.properties        |  19 ++
 .../src/test/resources/TEST.properties          |  19 ++
 .../src/test/resources/tamaya-TEST.yaml         |  27 +++
 .../src/test/resources/tamaya-config.yaml       |  37 +++
 metamodels/pom.xml                              |  40 ----
 metamodels/simple/config/README.txt             |  20 --
 metamodels/simple/config/test3.properties       |  21 --
 metamodels/simple/pom.xml                       |  86 -------
 .../ConfigDirPropertySourceProvider.java        |  81 -------
 .../MetainfConfigPropertySourceProvider.java    |  62 -----
 ...org.apache.tamaya.spi.PropertySourceProvider |  20 --
 .../tamaya/metamodel/simple/SimpleTest.java     |  26 ---
 .../resources/META-INF/config/test.properties   |  20 --
 .../resources/META-INF/config/test2.properties  |  20 --
 metamodels/staged/pom.xml                       | 114 ---------
 .../org/apache/tamaya/dsl/DSLFormatManager.java | 115 ---------
 .../apache/tamaya/dsl/MetaConfiguration.java    | 144 ------------
 .../org/apache/tamaya/dsl/ProfileManager.java   | 213 -----------------
 .../apache/tamaya/dsl/TamayaConfigurator.java   | 234 -------------------
 .../tamaya/dsl/WrappedPropertySource.java       | 100 --------
 .../DSLLoadingConfigurationProviderSpi.java     |  82 -------
 .../NamedDSLPropertySourceProvider.java         |  53 -----
 .../ResourceDSLPropertySourceProvider.java      |  82 -------
 .../org/apache/tamaya/dsl/package-info.java     |  23 --
 .../spi/BaseStagedPropertySourceProvider.java   | 121 ----------
 .../staged/spi/DSLPropertySourceProvider.java   |  51 ----
 .../spi/StagedConfigPropertiesProvider.java     | 137 -----------
 .../apache/tamaya/staged/spi/package-info.java  |  23 --
 ...g.apache.tamaya.spi.ConfigurationProviderSpi |  19 --
 ....tamaya.staged.spi.DSLPropertySourceProvider |  20 --
 .../apache/tamaya/dsl/ProfileManagerTest.java   |  78 -------
 .../staged/src/test/resources/GLOBAL.properties |  19 --
 .../staged/src/test/resources/TEST.properties   |  19 --
 .../staged/src/test/resources/tamaya-TEST.yaml  |  27 ---
 .../src/test/resources/tamaya-config.yaml       |  37 ---
 .../internal/FileProprtyStoreProviderSpi.java   |  85 +++++++
 ...he.tamaya.store.spi.PropertyStoreProviderSpi |  18 ++
 .../HazelcastProprtyStoreProviderSpi.java       |  87 +++++++
 .../org.apache.tamaya.store.PropertyStore       |  19 ++
 76 files changed, 2507 insertions(+), 2586 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/07b10131/apache-commons/pom.xml
----------------------------------------------------------------------
diff --git a/apache-commons/pom.xml b/apache-commons/pom.xml
new file mode 100644
index 0000000..2b5eda0
--- /dev/null
+++ b/apache-commons/pom.xml
@@ -0,0 +1,75 @@
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy current the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.tamaya.ext</groupId>
+        <artifactId>tamaya-integrations</artifactId>
+        <version>0.2-incubating-SNAPSHOT</version>
+        <relativePath>..</relativePath>
+    </parent>
+    <artifactId>tamaya-commons-config</artifactId>
+    <name>Apache Tamaya Commons Integration - Apache Commons</name>
+    <packaging>bundle</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tamaya</groupId>
+            <artifactId>tamaya-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tamaya.ext</groupId>
+            <artifactId>tamaya-formats</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-configuration</groupId>
+            <artifactId>commons-configuration</artifactId>
+            <version>1.10</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Import-Package>
+                            org.apache.tamaya,
+                            org.apache.tamaya.spi,
+                            org.apache.tamaya.format,
+                            org.apache.commons,
+                            javax.annotation,
+                            *
+                        </Import-Package>
+                        <Export-Package>
+                            org.apache.tamaya.integration.commons
+                        </Export-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/07b10131/apache-commons/src/main/java/org/apache/tamaya/integration/commons/CommonsConfigPropertySource.java
----------------------------------------------------------------------
diff --git a/apache-commons/src/main/java/org/apache/tamaya/integration/commons/CommonsConfigPropertySource.java b/apache-commons/src/main/java/org/apache/tamaya/integration/commons/CommonsConfigPropertySource.java
new file mode 100644
index 0000000..b2f2e82
--- /dev/null
+++ b/apache-commons/src/main/java/org/apache/tamaya/integration/commons/CommonsConfigPropertySource.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.integration.commons;
+
+//X TODO Move out into separate commons-config integration module...
+
+import org.apache.commons.configuration.Configuration;
+import org.apache.tamaya.spi.PropertySource;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * PropertySource that wraps {@link org.apache.commons.configuration.Configuration}.
+ */
+public class CommonsConfigPropertySource implements PropertySource {
+
+    private Configuration commonsConfig;
+    private int ordinal;
+    private String name;
+
+    public CommonsConfigPropertySource(int ordinal, String name, Configuration commonsConfig) {
+        this.commonsConfig = Objects.requireNonNull(commonsConfig);
+        this.ordinal = ordinal;
+        this.name = Objects.requireNonNull(name);
+    }
+
+    public CommonsConfigPropertySource(String name, Configuration commonsConfig) {
+        commonsConfig = Objects.requireNonNull(commonsConfig);
+        this.name = Objects.requireNonNull(name);
+        try {
+            this.ordinal = commonsConfig.getInt(PropertySource.TAMAYA_ORDINAL);
+        } catch (Exception e) {
+            this.ordinal = 0;
+        }
+    }
+
+    @Override
+    public int getOrdinal() {
+        return ordinal;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public String get(String key) {
+        return commonsConfig.getString(key);
+    }
+
+    @Override
+    public Map<String, String> getProperties() {
+        Map<String, String> config = new HashMap<>();
+        Iterator<String> keyIter = commonsConfig.getKeys();
+        while (keyIter.hasNext()) {
+            String key = keyIter.next();
+            config.put(key, commonsConfig.getString(key));
+        }
+        return config;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/07b10131/apache-commons/src/main/java/org/apache/tamaya/integration/commons/IniConfigurationFormat.java
----------------------------------------------------------------------
diff --git a/apache-commons/src/main/java/org/apache/tamaya/integration/commons/IniConfigurationFormat.java b/apache-commons/src/main/java/org/apache/tamaya/integration/commons/IniConfigurationFormat.java
new file mode 100644
index 0000000..0e21f4f
--- /dev/null
+++ b/apache-commons/src/main/java/org/apache/tamaya/integration/commons/IniConfigurationFormat.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.integration.commons;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.HierarchicalINIConfiguration;
+import org.apache.commons.configuration.SubnodeConfiguration;
+import org.apache.tamaya.ConfigException;
+import org.apache.tamaya.format.ConfigurationData;
+import org.apache.tamaya.format.ConfigurationDataBuilder;
+import org.apache.tamaya.format.ConfigurationFormat;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * Implements a ini file format based on the APache Commons
+ * {@link org.apache.commons.configuration.HierarchicalINIConfiguration}.
+ */
+public class IniConfigurationFormat implements ConfigurationFormat {
+
+    public ConfigurationData readConfiguration(URL url) {
+        ConfigurationDataBuilder builder = ConfigurationDataBuilder.of(url.toString(), this);
+        try {
+            HierarchicalINIConfiguration commonIniConfiguration = new HierarchicalINIConfiguration(url);
+            for(String section:commonIniConfiguration.getSections()){
+                SubnodeConfiguration sectionConfig = commonIniConfiguration.getSection(section);
+                Map<String, String> properties = new HashMap<>();
+                Iterator<String> keyIter = sectionConfig.getKeys();
+                while(keyIter.hasNext()){
+                    String key = keyIter.next();
+                    properties.put(key, sectionConfig.getString(key));
+                }
+                builder.addProperties(section, properties);
+            }
+        } catch (ConfigurationException e) {
+            throw new ConfigException("Failed to parse ini-file format from " + url, e);
+        }
+        return builder.build();
+    }
+
+    @Override
+    public String getName() {
+        throw new RuntimeException("Not implemented yet!");
+    }
+
+    @Override
+    public boolean accepts(URL url) {
+        throw new RuntimeException("Not implemented yet!");
+    }
+
+    @Override
+    public ConfigurationData readConfiguration(String resource, InputStream inputStream) {
+        throw new RuntimeException("Not implemented yet!");
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/07b10131/integration/commons/pom.xml
----------------------------------------------------------------------
diff --git a/integration/commons/pom.xml b/integration/commons/pom.xml
deleted file mode 100644
index 2b5eda0..0000000
--- a/integration/commons/pom.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<!-- 
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy current the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.apache.tamaya.ext</groupId>
-        <artifactId>tamaya-integrations</artifactId>
-        <version>0.2-incubating-SNAPSHOT</version>
-        <relativePath>..</relativePath>
-    </parent>
-    <artifactId>tamaya-commons-config</artifactId>
-    <name>Apache Tamaya Commons Integration - Apache Commons</name>
-    <packaging>bundle</packaging>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.tamaya</groupId>
-            <artifactId>tamaya-api</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.tamaya.ext</groupId>
-            <artifactId>tamaya-formats</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>commons-configuration</groupId>
-            <artifactId>commons-configuration</artifactId>
-            <version>1.10</version>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <extensions>true</extensions>
-                <configuration>
-                    <instructions>
-                        <Import-Package>
-                            org.apache.tamaya,
-                            org.apache.tamaya.spi,
-                            org.apache.tamaya.format,
-                            org.apache.commons,
-                            javax.annotation,
-                            *
-                        </Import-Package>
-                        <Export-Package>
-                            org.apache.tamaya.integration.commons
-                        </Export-Package>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-</project>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/07b10131/integration/commons/src/main/java/org/apache/tamaya/integration/commons/CommonsConfigPropertySource.java
----------------------------------------------------------------------
diff --git a/integration/commons/src/main/java/org/apache/tamaya/integration/commons/CommonsConfigPropertySource.java b/integration/commons/src/main/java/org/apache/tamaya/integration/commons/CommonsConfigPropertySource.java
deleted file mode 100644
index b2f2e82..0000000
--- a/integration/commons/src/main/java/org/apache/tamaya/integration/commons/CommonsConfigPropertySource.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.integration.commons;
-
-//X TODO Move out into separate commons-config integration module...
-
-import org.apache.commons.configuration.Configuration;
-import org.apache.tamaya.spi.PropertySource;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Objects;
-
-/**
- * PropertySource that wraps {@link org.apache.commons.configuration.Configuration}.
- */
-public class CommonsConfigPropertySource implements PropertySource {
-
-    private Configuration commonsConfig;
-    private int ordinal;
-    private String name;
-
-    public CommonsConfigPropertySource(int ordinal, String name, Configuration commonsConfig) {
-        this.commonsConfig = Objects.requireNonNull(commonsConfig);
-        this.ordinal = ordinal;
-        this.name = Objects.requireNonNull(name);
-    }
-
-    public CommonsConfigPropertySource(String name, Configuration commonsConfig) {
-        commonsConfig = Objects.requireNonNull(commonsConfig);
-        this.name = Objects.requireNonNull(name);
-        try {
-            this.ordinal = commonsConfig.getInt(PropertySource.TAMAYA_ORDINAL);
-        } catch (Exception e) {
-            this.ordinal = 0;
-        }
-    }
-
-    @Override
-    public int getOrdinal() {
-        return ordinal;
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    @Override
-    public String get(String key) {
-        return commonsConfig.getString(key);
-    }
-
-    @Override
-    public Map<String, String> getProperties() {
-        Map<String, String> config = new HashMap<>();
-        Iterator<String> keyIter = commonsConfig.getKeys();
-        while (keyIter.hasNext()) {
-            String key = keyIter.next();
-            config.put(key, commonsConfig.getString(key));
-        }
-        return config;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/07b10131/integration/commons/src/main/java/org/apache/tamaya/integration/commons/IniConfigurationFormat.java
----------------------------------------------------------------------
diff --git a/integration/commons/src/main/java/org/apache/tamaya/integration/commons/IniConfigurationFormat.java b/integration/commons/src/main/java/org/apache/tamaya/integration/commons/IniConfigurationFormat.java
deleted file mode 100644
index 0e21f4f..0000000
--- a/integration/commons/src/main/java/org/apache/tamaya/integration/commons/IniConfigurationFormat.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.integration.commons;
-
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.HierarchicalINIConfiguration;
-import org.apache.commons.configuration.SubnodeConfiguration;
-import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.format.ConfigurationData;
-import org.apache.tamaya.format.ConfigurationDataBuilder;
-import org.apache.tamaya.format.ConfigurationFormat;
-
-import java.io.InputStream;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * Implements a ini file format based on the APache Commons
- * {@link org.apache.commons.configuration.HierarchicalINIConfiguration}.
- */
-public class IniConfigurationFormat implements ConfigurationFormat {
-
-    public ConfigurationData readConfiguration(URL url) {
-        ConfigurationDataBuilder builder = ConfigurationDataBuilder.of(url.toString(), this);
-        try {
-            HierarchicalINIConfiguration commonIniConfiguration = new HierarchicalINIConfiguration(url);
-            for(String section:commonIniConfiguration.getSections()){
-                SubnodeConfiguration sectionConfig = commonIniConfiguration.getSection(section);
-                Map<String, String> properties = new HashMap<>();
-                Iterator<String> keyIter = sectionConfig.getKeys();
-                while(keyIter.hasNext()){
-                    String key = keyIter.next();
-                    properties.put(key, sectionConfig.getString(key));
-                }
-                builder.addProperties(section, properties);
-            }
-        } catch (ConfigurationException e) {
-            throw new ConfigException("Failed to parse ini-file format from " + url, e);
-        }
-        return builder.build();
-    }
-
-    @Override
-    public String getName() {
-        throw new RuntimeException("Not implemented yet!");
-    }
-
-    @Override
-    public boolean accepts(URL url) {
-        throw new RuntimeException("Not implemented yet!");
-    }
-
-    @Override
-    public ConfigurationData readConfiguration(String resource, InputStream inputStream) {
-        throw new RuntimeException("Not implemented yet!");
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/07b10131/integration/pom.xml
----------------------------------------------------------------------
diff --git a/integration/pom.xml b/integration/pom.xml
deleted file mode 100644
index e0d54d6..0000000
--- a/integration/pom.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy current the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
-    <parent>
-        <groupId>org.apache.tamaya.ext</groupId>
-        <artifactId>tamaya-extensions</artifactId>
-        <version>0.3-incubating-SNAPSHOT</version>
-    </parent>
-
-    <packaging>pom</packaging>
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>tamaya-integration-sandbox</artifactId>
-
-    <modules>
-        <module>store</module>
-        <module>commons</module>
-    </modules>
-
-</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/07b10131/integration/store-file/src/main/java/org/apache/tamaya/store/internal/FileProprtyStoreProviderSpi.java
----------------------------------------------------------------------
diff --git a/integration/store-file/src/main/java/org/apache/tamaya/store/internal/FileProprtyStoreProviderSpi.java b/integration/store-file/src/main/java/org/apache/tamaya/store/internal/FileProprtyStoreProviderSpi.java
deleted file mode 100644
index 3ea768a..0000000
--- a/integration/store-file/src/main/java/org/apache/tamaya/store/internal/FileProprtyStoreProviderSpi.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.store.internal;
-
-import com.hazelcast.config.Config;
-import com.hazelcast.config.GroupConfig;
-import com.hazelcast.core.Hazelcast;
-import com.hazelcast.core.HazelcastInstance;
-import org.apache.tamaya.spi.ServiceContextManager;
-import org.apache.tamaya.store.PropertyStore;
-import org.apache.tamaya.store.spi.PropertyStoreProviderSpi;
-
-import java.util.Map;
-import java.util.ServiceLoader;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * SPI implmentation for a providing Hazelcast based PropertyStores.
- */
-public class FileProprtyStoreProviderSpi implements PropertyStoreProviderSpi {
-    private static final String CONFIG_CLASS_SYS_PROP = "tamaya.store.file.configClass";
-    private static final String CONFIG_GROUP_SYS_PROP = "tamaya.store.file.groupName";
-
-    private static final Logger LOG = Logger.getLogger(HazelcastProprtyStoreProviderSpi.class.getName());
-
-    private File file;
-    private Map<String,HazelcastProprtyStore> stores = new ConcurrentHashMap<>();
-
-    public HazelcastProprtyStoreProviderSpi() {
-        String customConfig = System.getProperty(CONFIG_CLASS_SYS_PROP);
-        Config config = null;
-        if(customConfig!=null){
-            try {
-                config = (Config)Class.forName(customConfig).newInstance();
-                LOG.info("Successfully created custom store config for HazelCast store: " + customConfig);
-            } catch (Exception e) {
-                LOG.log(Level.SEVERE, "Failed to instantiate custom store config for HazelCast store: " + customConfig, e);
-            }
-        }
-        if(config==null){
-            config = ServiceContextManager.getServiceContext().getService(Config.class);
-        }
-        if(config==null) {
-            config = new Config();
-            GroupConfig gc = new GroupConfig();
-            String groupName = System.getProperty(CONFIG_GROUP_SYS_PROP, "Tamaya");
-            gc.setName(groupName);
-            config.setGroupConfig(gc);
-        }
-        LOG.info("Starting HazelCast storage with config: " + config);
-        store = Hazelcast.getOrCreateHazelcastInstance(config);
-    }
-
-    @Override
-    public PropertyStore getPropertyStore(String storeId) {
-        HazelcastProprtyStore propertyStore = stores.get(storeId);
-        if(propertyStore==null){
-            LOG.info("Creating new distributed configuration map in HazelCast store for " + storeId + "...");
-            propertyStore = new HazelcastProprtyStore(store, storeId);
-            this.stores.put(storeId, propertyStore);
-        }
-        return propertyStore;
-    }
-
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/07b10131/integration/store-file/src/main/resources/META-INF/services/org.apache.tamaya.store.spi.PropertyStoreProviderSpi
----------------------------------------------------------------------
diff --git a/integration/store-file/src/main/resources/META-INF/services/org.apache.tamaya.store.spi.PropertyStoreProviderSpi b/integration/store-file/src/main/resources/META-INF/services/org.apache.tamaya.store.spi.PropertyStoreProviderSpi
deleted file mode 100644
index f3199f2..0000000
--- a/integration/store-file/src/main/resources/META-INF/services/org.apache.tamaya.store.spi.PropertyStoreProviderSpi
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy current the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/07b10131/integration/store-hazelcast/src/main/java/org/apache/tamaya/store/internal/HazelcastProprtyStoreProviderSpi.java
----------------------------------------------------------------------
diff --git a/integration/store-hazelcast/src/main/java/org/apache/tamaya/store/internal/HazelcastProprtyStoreProviderSpi.java b/integration/store-hazelcast/src/main/java/org/apache/tamaya/store/internal/HazelcastProprtyStoreProviderSpi.java
deleted file mode 100644
index db567ac..0000000
--- a/integration/store-hazelcast/src/main/java/org/apache/tamaya/store/internal/HazelcastProprtyStoreProviderSpi.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.store.internal;
-
-import com.hazelcast.config.Config;
-import com.hazelcast.config.GroupConfig;
-import com.hazelcast.core.Hazelcast;
-import com.hazelcast.core.HazelcastInstance;
-import org.apache.tamaya.spi.ServiceContextManager;
-import org.apache.tamaya.store.PropertyStore;
-import org.apache.tamaya.store.spi.PropertyStoreProviderSpi;
-
-import java.util.Map;
-import java.util.ServiceLoader;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * SPI implmentation for a providing Hazelcast based PropertyStores.
- */
-public class HazelcastProprtyStoreProviderSpi implements PropertyStoreProviderSpi {
-    private static final String CONFIG_CLASS_SYS_PROP = "tamaya.store.hazelcast.configClass";
-    private static final String CONFIG_GROUP_SYS_PROP = "tamaya.store.hazelcast.groupName";
-
-
-
-    private static final Logger LOG = Logger.getLogger(HazelcastProprtyStoreProviderSpi.class.getName());
-
-    private HazelcastInstance store;
-    private Map<String,HazelcastProprtyStore> stores = new ConcurrentHashMap<>();
-
-    public HazelcastProprtyStoreProviderSpi() {
-        String customConfig = System.getProperty(CONFIG_CLASS_SYS_PROP);
-        Config config = null;
-        if(customConfig!=null){
-            try {
-                config = (Config)Class.forName(customConfig).newInstance();
-                LOG.info("Successfully created custom store config for HazelCast store: " + customConfig);
-            } catch (Exception e) {
-                LOG.log(Level.SEVERE, "Failed to instantiate custom store config for HazelCast store: " + customConfig, e);
-            }
-        }
-        if(config==null){
-            config = ServiceContextManager.getServiceContext().getService(Config.class);
-        }
-        if(config==null) {
-            config = new Config();
-            GroupConfig gc = new GroupConfig();
-            String groupName = System.getProperty(CONFIG_GROUP_SYS_PROP, "Tamaya");
-            gc.setName(groupName);
-            config.setGroupConfig(gc);
-        }
-        LOG.info("Starting HazelCast storage with config: " + config);
-        store = Hazelcast.getOrCreateHazelcastInstance(config);
-    }
-
-    @Override
-    public PropertyStore getPropertyStore(String storeId) {
-        HazelcastProprtyStore propertyStore = stores.get(storeId);
-        if(propertyStore==null){
-            LOG.info("Creating new distributed configuration map in HazelCast store for " + storeId + "...");
-            propertyStore = new HazelcastProprtyStore(store, storeId);
-            this.stores.put(storeId, propertyStore);
-        }
-        return propertyStore;
-    }
-
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/07b10131/integration/store-ignite/src/main/resources/META-INF/services/org.apache.tamaya.store.PropertyStore
----------------------------------------------------------------------
diff --git a/integration/store-ignite/src/main/resources/META-INF/services/org.apache.tamaya.store.PropertyStore b/integration/store-ignite/src/main/resources/META-INF/services/org.apache.tamaya.store.PropertyStore
deleted file mode 100644
index 0833eac..0000000
--- a/integration/store-ignite/src/main/resources/META-INF/services/org.apache.tamaya.store.PropertyStore
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy current the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-org.apache.tamaya.store.internal.IgniteProprtyStore
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/07b10131/metamodel-simple/config/README.txt
----------------------------------------------------------------------
diff --git a/metamodel-simple/config/README.txt b/metamodel-simple/config/README.txt
new file mode 100644
index 0000000..3dd71f5
--- /dev/null
+++ b/metamodel-simple/config/README.txt
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy current the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+This folder is for testing only. It contains some config files that are to be included by the
+ConfigDirPropertySourceProvider config provider.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/07b10131/metamodel-simple/config/test3.properties
----------------------------------------------------------------------
diff --git a/metamodel-simple/config/test3.properties b/metamodel-simple/config/test3.properties
new file mode 100644
index 0000000..9ddef76
--- /dev/null
+++ b/metamodel-simple/config/test3.properties
@@ -0,0 +1,21 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy current the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+tamaya.ordinal=100000
+test3=3-overridden
+test5=value5
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/07b10131/metamodel-simple/pom.xml
----------------------------------------------------------------------
diff --git a/metamodel-simple/pom.xml b/metamodel-simple/pom.xml
new file mode 100644
index 0000000..9c96c28
--- /dev/null
+++ b/metamodel-simple/pom.xml
@@ -0,0 +1,86 @@
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.tamaya.ext.metamodels</groupId>
+        <artifactId>tamaya-metamodels</artifactId>
+        <version>0.3-incubating-SNAPSHOT</version>
+        <relativePath>..</relativePath>
+    </parent>
+    <artifactId>tamaya-metamodels-simple</artifactId>
+    <name>Apache Tamaya Modules Metamodels - Simple</name>
+    <description>Simple Tamaya Metamodel, e.g. feasible for SE commandline tools and simple use cases.</description>
+    <packaging>bundle</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tamaya</groupId>
+            <artifactId>tamaya-core</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tamaya</groupId>
+            <artifactId>tamaya-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tamaya.ext</groupId>
+            <artifactId>tamaya-resources</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tamaya.ext</groupId>
+            <artifactId>tamaya-formats</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Import-Package>
+                            org.apache.tamaya,
+                            org.apache.tamaya.spi,
+                            org.apache.tamaya.format,
+                            javax.annotation,
+                            *
+                        </Import-Package>
+                        <Export-Package>
+                            org.apache.tamaya.metamodel.simple
+                        </Export-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/07b10131/metamodel-simple/src/main/java/org/apache/tamaya/metamodel/simple/internal/ConfigDirPropertySourceProvider.java
----------------------------------------------------------------------
diff --git a/metamodel-simple/src/main/java/org/apache/tamaya/metamodel/simple/internal/ConfigDirPropertySourceProvider.java b/metamodel-simple/src/main/java/org/apache/tamaya/metamodel/simple/internal/ConfigDirPropertySourceProvider.java
new file mode 100644
index 0000000..e3c9cbf
--- /dev/null
+++ b/metamodel-simple/src/main/java/org/apache/tamaya/metamodel/simple/internal/ConfigDirPropertySourceProvider.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.metamodel.simple.internal;
+
+
+import org.apache.tamaya.format.ConfigurationData;
+import org.apache.tamaya.format.ConfigurationFormats;
+import org.apache.tamaya.format.FlattenedDefaultPropertySource;
+import org.apache.tamaya.resource.AbstractPathPropertySourceProvider;
+import org.apache.tamaya.spi.PropertySource;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Created by Anatole on 20.03.2015.
+ */
+public class ConfigDirPropertySourceProvider extends AbstractPathPropertySourceProvider {
+
+    public ConfigDirPropertySourceProvider() {
+        super(getConfigLocation());
+    }
+
+    private static String getConfigLocation() {
+        String location = System.getProperty("configdir");
+        if (location == null) {
+            location = "./config";
+        }
+        if (!location.endsWith("/")) {
+            location += "/";
+        }
+        if (!location.startsWith("file:")) {
+            location = "file:" + location;
+        }
+        return location + "**/*.*";
+    }
+
+    @Override
+    protected Collection<PropertySource> getPropertySources(URL url) {
+        try {
+            ConfigurationData config = ConfigurationFormats.readConfigurationData(url);
+            if (config == null) {
+                Logger.getLogger(getClass().getName()).log(Level.INFO,
+                        "Failed to read configuration from " + url);
+                return Collections.emptySet();
+            }
+            return asCollection(new FlattenedDefaultPropertySource(config));
+        } catch (Exception e) {
+            Logger.getLogger(getClass().getName()).log(Level.SEVERE,
+                    "Failed to read configuration from " + url, e);
+            return Collections.emptySet();
+        }
+    }
+
+    private Collection<PropertySource> asCollection(PropertySource propertySource) {
+        List<PropertySource> result = new ArrayList<>(1);
+        result.add(propertySource);
+        return result;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/07b10131/metamodel-simple/src/main/java/org/apache/tamaya/metamodel/simple/internal/MetainfConfigPropertySourceProvider.java
----------------------------------------------------------------------
diff --git a/metamodel-simple/src/main/java/org/apache/tamaya/metamodel/simple/internal/MetainfConfigPropertySourceProvider.java b/metamodel-simple/src/main/java/org/apache/tamaya/metamodel/simple/internal/MetainfConfigPropertySourceProvider.java
new file mode 100644
index 0000000..0edbbc7
--- /dev/null
+++ b/metamodel-simple/src/main/java/org/apache/tamaya/metamodel/simple/internal/MetainfConfigPropertySourceProvider.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.metamodel.simple.internal;
+
+
+import org.apache.tamaya.format.ConfigurationData;
+import org.apache.tamaya.format.ConfigurationFormats;
+import org.apache.tamaya.format.FlattenedDefaultPropertySource;
+import org.apache.tamaya.resource.AbstractPathPropertySourceProvider;
+import org.apache.tamaya.spi.PropertySource;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Created by Anatole on 20.03.2015.
+ */
+public class MetainfConfigPropertySourceProvider extends AbstractPathPropertySourceProvider {
+
+    public MetainfConfigPropertySourceProvider() {
+        super("classpath:META-INF/config/**/*.*");
+    }
+
+    @Override
+    protected Collection<PropertySource> getPropertySources(URL url) {
+        try {
+            ConfigurationData config = ConfigurationFormats.readConfigurationData(url);
+            return asCollection(new FlattenedDefaultPropertySource(config));
+        } catch (Exception e) {
+            Logger.getLogger(getClass().getName()).log(Level.SEVERE,
+                    "Failed to read configuration from " + url, e);
+            return Collections.emptySet();
+        }
+    }
+
+    private Collection<PropertySource> asCollection(PropertySource propertySource) {
+        List<PropertySource> result = new ArrayList<>(1);
+        result.add(propertySource);
+        return result;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/07b10131/metamodel-simple/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
----------------------------------------------------------------------
diff --git a/metamodel-simple/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider b/metamodel-simple/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
new file mode 100644
index 0000000..2e963e2
--- /dev/null
+++ b/metamodel-simple/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy current the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+org.apache.tamaya.metamodel.simple.internal.ConfigDirPropertySourceProvider
+org.apache.tamaya.metamodel.simple.internal.MetainfConfigPropertySourceProvider
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/07b10131/metamodel-simple/src/test/java/org/apache/tamaya/metamodel/simple/SimpleTest.java
----------------------------------------------------------------------
diff --git a/metamodel-simple/src/test/java/org/apache/tamaya/metamodel/simple/SimpleTest.java b/metamodel-simple/src/test/java/org/apache/tamaya/metamodel/simple/SimpleTest.java
new file mode 100644
index 0000000..677d8fc
--- /dev/null
+++ b/metamodel-simple/src/test/java/org/apache/tamaya/metamodel/simple/SimpleTest.java
@@ -0,0 +1,26 @@
+package org.apache.tamaya.metamodel.simple;
+
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.ConfigurationProvider;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Created by Anatole on 26.07.2015.
+ */
+public class SimpleTest {
+
+    @Test
+    public void testClasspathConfig() {
+        Configuration config = ConfigurationProvider.getConfiguration();
+        assertEquals(config.get("test1"), "1");
+        assertEquals(config.get("test2"), "2");
+        // overridden by file config
+        assertEquals(config.get("test3"), "3-overridden");
+        assertEquals(config.get("test4"), "4");
+        // added by file config
+        assertEquals(config.get("test5"), "value5");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/07b10131/metamodel-simple/src/test/resources/META-INF/config/test.properties
----------------------------------------------------------------------
diff --git a/metamodel-simple/src/test/resources/META-INF/config/test.properties b/metamodel-simple/src/test/resources/META-INF/config/test.properties
new file mode 100644
index 0000000..af16b23
--- /dev/null
+++ b/metamodel-simple/src/test/resources/META-INF/config/test.properties
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy current the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+test1=1
+test2=2
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/07b10131/metamodel-simple/src/test/resources/META-INF/config/test2.properties
----------------------------------------------------------------------
diff --git a/metamodel-simple/src/test/resources/META-INF/config/test2.properties b/metamodel-simple/src/test/resources/META-INF/config/test2.properties
new file mode 100644
index 0000000..58524b7
--- /dev/null
+++ b/metamodel-simple/src/test/resources/META-INF/config/test2.properties
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy current the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+test3=3
+test4=4
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/07b10131/metamodel-staged/pom.xml
----------------------------------------------------------------------
diff --git a/metamodel-staged/pom.xml b/metamodel-staged/pom.xml
new file mode 100644
index 0000000..b5c96a2
--- /dev/null
+++ b/metamodel-staged/pom.xml
@@ -0,0 +1,114 @@
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy current the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.tamaya.ext.metamodels</groupId>
+        <artifactId>tamaya-metamodels</artifactId>
+        <version>0.3-incubating-SNAPSHOT</version>
+        <relativePath>..</relativePath>
+    </parent>
+
+    <artifactId>tamaya-metamodel-staged</artifactId>
+    <name>Apache Tamaya Modules - Staged Configuration</name>
+    <packaging>bundle</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tamaya</groupId>
+            <artifactId>tamaya-core</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tamaya</groupId>
+            <artifactId>tamaya-api</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tamaya.ext</groupId>
+            <artifactId>tamaya-functions</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tamaya.ext</groupId>
+            <artifactId>tamaya-resolver</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tamaya.ext</groupId>
+            <artifactId>tamaya-spisupport</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tamaya.ext</groupId>
+            <artifactId>tamaya-resources</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tamaya.ext</groupId>
+            <artifactId>tamaya-formats</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tamaya.ext</groupId>
+            <artifactId>tamaya-yaml</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>java-hamcrest</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Import-Package>
+                            org.apache.tamaya,
+                            org.apache.tamaya.spi,
+                            org.apache.tamaya.resources,
+                            org.apache.tamaya.spisupport,
+                            org.apache.tamaya.functions,
+                            javax.annotation,
+                            *
+                        </Import-Package>
+                        <Export-Package>
+                            org.apache.tamaya.metamodel.simple
+                        </Export-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/07b10131/metamodel-staged/src/main/java/org/apache/tamaya/dsl/DSLFormatManager.java
----------------------------------------------------------------------
diff --git a/metamodel-staged/src/main/java/org/apache/tamaya/dsl/DSLFormatManager.java b/metamodel-staged/src/main/java/org/apache/tamaya/dsl/DSLFormatManager.java
new file mode 100644
index 0000000..916fa49
--- /dev/null
+++ b/metamodel-staged/src/main/java/org/apache/tamaya/dsl/DSLFormatManager.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.dsl;
+
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.format.ConfigurationFormat;
+import org.apache.tamaya.format.ConfigurationFormats;
+import org.apache.tamaya.functions.ConfigurationFunctions;
+
+import java.util.*;
+
+/**
+ * Component that manages the current supported formats:
+ * <pre>
+ * TAMAYA:
+ *   FORMAT-DEF:
+ *     - formats: yaml, properties, xml-properties
+ * </pre>
+ * Hereby:
+ * <ul>
+ *     <li><b>profiles</b> defines the available profiles, including implicit default profiles.</li>
+ * </ul>
+ */
+public final class DSLFormatManager {
+
+    private static final DSLFormatManager INSTANCE = new DSLFormatManager();
+
+    /** The currently active formats, in order of precedence, the most significant are the last ones. */
+    private List<ConfigurationFormat> formats = new ArrayList<>();
+    /** The currently active suffixes, in order of precedence, the most significant are the last ones. */
+    private List<String> suffixes = new ArrayList<>();
+
+
+    /**
+     * Get the current instance.
+     * @return the current profile manager, never null.
+     */
+    public static DSLFormatManager getInstance(){
+        return INSTANCE;
+    }
+
+    private DSLFormatManager(){
+        Configuration metaConfig = MetaConfiguration.getConfiguration();
+        Configuration formatsConfig = metaConfig.with(
+                ConfigurationFunctions.section("TAMAYA.FORMATS"));
+        String[] formats = formatsConfig.getOrDefault("formats","yamk,properties,ini").split(",");
+        this.formats.addAll(ConfigurationFormats.getFormats(formats));
+        String[] suffixes = formatsConfig.getOrDefault("suffixes","yml,properties,ini").split(",");
+        for(String sfx:suffixes){
+            sfx = sfx.trim();
+            if(sfx.isEmpty()){
+                continue;
+            }
+            this.suffixes.add(sfx);
+        }
+    }
+
+
+    /**
+     * Allows to check if a suffix is currently activated.
+     * @param suffix the suffix name, not null.
+     * @return true, if the profile is defined.
+     */
+    public boolean isSuffixDefined(String suffix){
+        return this.suffixes.contains(suffix);
+    }
+
+    /**
+     * Allows to check if a format is selected.
+     * @param formatName the format name, not null.
+     * @return true, if the format is a selected.
+     */
+    public boolean isFormatSelected(String formatName){
+        for(ConfigurationFormat format:formats){
+            if(format.getName().equals(formatName)){
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Get the list of currently active suffixes.
+     * @return the list of currently active suffixes, never null.
+     */
+    public List<String> getSuffixes(){
+        return Collections.unmodifiableList(suffixes);
+    }
+
+    /**
+     * Get the list of currently active formats.
+     * @return the list of currently active formats, never null.
+     */
+    public List<ConfigurationFormat> getFormats(){
+        return Collections.unmodifiableList(formats);
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/07b10131/metamodel-staged/src/main/java/org/apache/tamaya/dsl/MetaConfiguration.java
----------------------------------------------------------------------
diff --git a/metamodel-staged/src/main/java/org/apache/tamaya/dsl/MetaConfiguration.java b/metamodel-staged/src/main/java/org/apache/tamaya/dsl/MetaConfiguration.java
new file mode 100644
index 0000000..a16bfa8
--- /dev/null
+++ b/metamodel-staged/src/main/java/org/apache/tamaya/dsl/MetaConfiguration.java
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.dsl;
+
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.format.ConfigurationData;
+import org.apache.tamaya.format.ConfigurationFormat;
+import org.apache.tamaya.format.ConfigurationFormats;
+import org.apache.tamaya.json.YAMLFormat;
+import org.apache.tamaya.resource.ConfigResources;
+import org.apache.tamaya.spi.ConfigurationContextBuilder;
+import org.apache.tamaya.spisupport.DefaultConfiguration;
+import org.apache.tamaya.spisupport.MapPropertySource;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Meta environment configuration builder and accessor. Normally this class shoulds never be accessed
+ * by client code. But it could be useful for extensions that extend the meta-configuration capabilities
+ * of tamaya having access to the meta-configuration, so they can read their own meta-entries to
+ * setup whatever features they implement.
+ */
+public final class MetaConfiguration {
+
+    private static final Logger LOGGER = Logger.getLogger(MetaConfiguration.class.getName());
+    private static MetaConfiguration INSTANCE = new MetaConfiguration();
+
+    private Configuration config;
+    private String resourceExpression;
+    private String[] formatNames;
+
+    /**
+     * Initializes the metaconfiguration.
+     * @param resourceExpression the resource expression that defines the resources to load.
+     * @param formatNames the format names to be used.
+     */
+    private void init(String resourceExpression, String... formatNames){
+        if(this.config!=null){
+            LOGGER.warning(">>> Reset of Meta-Configuration resource : " + resourceExpression);
+            LOGGER.warning(">>> Reset of Meta-Configuration formats  : " + Arrays.toString(formatNames));
+        }
+        if(resourceExpression==null){
+            resourceExpression = "tamaya-config.*";
+        }
+        LOGGER.info(">>> Meta-Configuration resource : " + resourceExpression);
+        ConfigurationFormat[] formats = loadFormats(formatNames);
+        ConfigurationContextBuilder builder = ConfigurationProvider.getConfigurationContextBuilder();
+        for(URL url:ConfigResources.getResourceResolver().getResources(resourceExpression)) {
+            for(ConfigurationFormat format:formats) {
+                if(format.accepts(url)){
+                    try(InputStream is = url.openStream()){
+                        ConfigurationData data = format.readConfiguration(url.toString(), is);
+                        builder.addPropertySources(new MapPropertySource(
+                                url.toString(), data.getCombinedProperties()));
+                    }catch(Exception e){
+                        LOGGER.log(Level.INFO, "Failed to read " + url + " with format " + format, e);
+                    }
+                }
+            }
+        }
+        this.config = new DefaultConfiguration(builder.build());
+        LOGGER.info("Meta-Configuration read: " + this.config.getProperties().size() + " entries.");
+    }
+
+    private ConfigurationFormat[] loadFormats(String... formatNames) {
+        List<ConfigurationFormat> formats = new ArrayList<>();
+        if(formatNames.length==0) {
+            String metaFormats = System.getProperty("tamaya.meta-formats");
+            if (metaFormats != null) {
+                formatNames = metaFormats.split(",");
+            }
+        }
+        for (String formatName : formatNames) {
+            formats.addAll(ConfigurationFormats.getFormats(formatName));
+        }
+        if(formats.isEmpty()){
+            formats.addAll(ConfigurationFormats.getFormats("yaml"));
+        }
+        if(formats.isEmpty()){
+            formats.add(new YAMLFormat());
+        }
+        LOGGER.info(">>> Meta-Configuration formats  : " + formats);
+        return formats.toArray(new ConfigurationFormat[formats.size()]);
+    }
+
+    /**
+     * Access the system's meta-configuration, initialize if necessary. Normally this class shoulds never be accessed
+     * by client code. But it could be useful for extensions that extend the meta-configuration capabilities
+     * of tamaya having access to the meta-configuration, so they can read their own meta-entries to
+     * setup whatever features they implement.
+     * @return the meta-configuration instance used for setting up the Tamaya's application configuration
+     * model.
+     */
+    public static Configuration getConfiguration(){
+        if(INSTANCE.config==null) {
+            INSTANCE.init(null);
+        }
+        return INSTANCE.config;
+    }
+
+    /**
+     * Access the system's meta-configuration, initialize if necessary. Normally this class shoulds never be accessed
+     * by client code. But it could be useful for extensions that extend the meta-configuration capabilities
+     * of tamaya having access to the meta-configuration, so they can read their own meta-entries to
+     * setup whatever features they implement.
+     *
+     * @param resourceExpression the resource expression that defines where the metaconfiguration
+     *                           files/resources are located.
+     * @param formatNames        the formats supported, if null all formats found are tried for each resource(=URL).
+     * @return the meta-configuration instance used for setting up the Tamaya's application configuration
+     * model.
+     */
+    public static Configuration getConfiguration(String resourceExpression,
+                                                 String... formatNames){
+        if(INSTANCE.config==null) {
+            INSTANCE.init(resourceExpression, formatNames);
+        }
+        return INSTANCE.config;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/07b10131/metamodel-staged/src/main/java/org/apache/tamaya/dsl/ProfileManager.java
----------------------------------------------------------------------
diff --git a/metamodel-staged/src/main/java/org/apache/tamaya/dsl/ProfileManager.java b/metamodel-staged/src/main/java/org/apache/tamaya/dsl/ProfileManager.java
new file mode 100644
index 0000000..70211ca
--- /dev/null
+++ b/metamodel-staged/src/main/java/org/apache/tamaya/dsl/ProfileManager.java
@@ -0,0 +1,213 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.dsl;
+
+import org.apache.tamaya.ConfigException;
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.functions.ConfigurationFunctions;
+import org.apache.tamaya.resolver.Resolver;
+import org.apache.tamaya.resolver.spi.ExpressionResolver;
+import org.apache.tamaya.spi.ServiceContextManager;
+
+import java.util.*;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Component that manages the current setup profiles for this environment/runtime. The profile manager
+ * reads the profile meta configuration that looks as follows:
+ * <pre>
+ * TAMAYA:
+ *   PROFILES-DEF:
+ *     - profiles:          DEFAULTS,DEV,TEST,PTA,PROD
+ *     - defaults:          DEFAULTS
+ *     - default-active:    DEV
+ *     - evaluation:        ${sys:ENV}, ${env:ENV}
+ * </pre>
+ * Hereby:
+ * <ul>
+ *     <li><b>profiles</b> defines the available profiles, including implicit default profiles.</li>
+ *     <li><b>defaults</b> defines the profiles that are loaded implicitly first as defaults.</li>
+ *     <li><b>default-active</b> defines the profile(s) activated by default, when no profile setting could be evaluated.
+ *     <li><b>evaluation</b> defines the resolution expressions to be used to evaluate the current profiles active.
+ *       By default {@code ${sys:ENV}, ${env:ENV}} is used, which tries to evaluate {@code ENV} using system and
+ *       environment properties. Refere to the {@code tamaya-resolver} module for further details on resolvers and
+ *       expressions and see {@link Resolver#evaluateExpression(String, boolean)}.
+ * </ul>
+ */
+public final class ProfileManager {
+
+    private static final Logger LOG = Logger.getLogger(ProfileManager.class.getName());
+    private static final ProfileManager INSTANCE = new ProfileManager();
+
+    /** The currently active profiles, in order of precedence, the most significant are the last ones. */
+    private List<String> activeProfiles = new ArrayList<>();
+    /** A set of all defined profiles. */
+    private Set<String> profiles = new HashSet<>();
+    /** The current used default profiles, loaded initially, before all other profiles are loaded. */
+    private List<String> defaultProfiles = new ArrayList<>();
+
+
+    /**
+     * Get the current instance.
+     * @return the current profile manager, never null.
+     */
+    public static ProfileManager getInstance(){
+        return INSTANCE;
+    }
+
+    private ProfileManager(){
+        Configuration metaConfig = MetaConfiguration.getConfiguration();
+        Configuration profileConfig = metaConfig.with(
+                ConfigurationFunctions.section("TAMAYA.PROFILES-DEF"));
+        String[] selectables = profileConfig.getOrDefault("profiles","DEFAULT,DEV,TEST,PROD").split(",");
+        for(String sel:selectables){
+            sel = sel.trim();
+            if(sel.isEmpty()){
+                continue;
+            }
+            this.profiles.add(sel);
+        }
+        String[] defaults = profileConfig.getOrDefault("defaults","DEFAULT").split(",");
+        for(String def:defaults){
+            def = def.trim();
+            if(def.isEmpty()){
+                continue;
+            }
+            if(!isProfileDefined(def)){
+                throw new ConfigException("Invalid profile encountered: " +def + ", valid are: " + profiles);
+            }
+            this.defaultProfiles.add(def);
+        }
+        String[] expressions = profileConfig.getOrDefault("evaluation","${sys:ENV}, ${env:ENV}").split(",");
+        String currentEnvironment = null;
+        for(String exp:expressions){
+            exp = exp.trim();
+            if(exp.isEmpty()){
+                continue;
+            }
+            currentEnvironment = evaluateExpression(exp);
+            if(currentEnvironment!=null){
+                currentEnvironment = currentEnvironment.trim();
+                if(!currentEnvironment.isEmpty()){
+                    break;
+                }
+            }
+        }
+        if(currentEnvironment==null|| currentEnvironment.isEmpty()){
+            currentEnvironment = profileConfig.getOrDefault("default-active", "DEV");
+        }
+        this.activeProfiles.addAll(defaultProfiles);
+        String[] profilesActive = currentEnvironment.split(",");
+        for(String prof:profilesActive){
+            prof = prof.trim();
+            if(prof.isEmpty()){
+                continue;
+            }
+            if(!isProfileDefined(prof)){
+                throw new ConfigException("Invalid profile encountered: " +prof + ", valid are: " + profiles);
+            }
+            this.activeProfiles.add(prof);
+        }
+    }
+
+    /**
+     * Evaluates the expressions to evaluate the current profile.
+     * Currently the following expressions are supported
+     * <pre>
+     * sys-property:xxx
+     * env-property:xxx
+     * </pre>
+     * {@code xxx} is the corresponding key.
+     * @param currentProfileExpression the profile expression.
+     * @return the evaluated String, or null.
+     */
+    private String evaluateExpression(String currentProfileExpression){
+        currentProfileExpression = currentProfileExpression.trim();
+        List<ExpressionResolver> resolvers = new ArrayList<>();
+        for(ExpressionResolver res: ServiceContextManager.getServiceContext().getServices(ExpressionResolver.class)){
+            resolvers.add(res);
+        }
+        for(ExpressionResolver res:resolvers){
+            if(currentProfileExpression.startsWith(res.getResolverPrefix())){
+                try{
+                    return res.evaluate(currentProfileExpression.substring(res.getResolverPrefix().length()));
+                }catch(Exception e){
+                    LOG.log(Level.FINEST, "Error evaluating resolver: " + res, e);
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Allows to check if a profile is currently active.
+     * @param profileName the profile name, not null.
+     * @return true, if the profile is active.
+     */
+    public boolean isProfileActive(String profileName){
+        return this.activeProfiles.contains(profileName);
+    }
+
+    /**
+     * Allows to check if a profile is currently defined.
+     * @param profileName the profile name, not null.
+     * @return true, if the profile is defined.
+     */
+    public boolean isProfileDefined(String profileName){
+        return this.profiles.contains(profileName);
+    }
+
+    /**
+     * Allows to check if a profile is a default profile.
+     * @param profileName the profile name, not null.
+     * @return true, if the profile is a default profile.
+     */
+    public boolean isProfileDefault(String profileName){
+        return this.defaultProfiles.contains(profileName);
+    }
+
+    /**
+     * Get the list of currently active profiles.
+     * @return the list of currently active profiles, in order of precedence, the most significant
+     * are the last ones, never null.
+     */
+    public List<String> getActiveProfiles(){
+        return Collections.unmodifiableList(activeProfiles);
+    }
+
+    /**
+     * Get the list of currently active profiles.
+     * @return the list of currently active profiles, in order of precedence, the most significant
+     * are the last ones, never null.
+     */
+    public List<String> getDefaultProfiles(){
+        return Collections.unmodifiableList(defaultProfiles);
+    }
+
+    /**
+     * Get the list of currently active profiles.
+     * @return the list of currently active profiles, in order of precedence, the most significant
+     * are the last ones, never null.
+     */
+    public Set<String> getAllProfiles(){
+        return Collections.unmodifiableSet(profiles);
+    }
+
+}


Mime
View raw message