tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anat...@apache.org
Subject incubator-tamaya git commit: TAMAYA-29: Removed stage. TAMAYA-19: Simplified environment model.
Date Tue, 16 Dec 2014 21:42:39 GMT
Repository: incubator-tamaya
Updated Branches:
  refs/heads/master 9fd50c6e0 -> 0b3b96393


TAMAYA-29: Removed stage.
TAMAYA-19: Simplified environment model.


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

Branch: refs/heads/master
Commit: 0b3b9639370538f64930bc4aa97bd47d31309400
Parents: 9fd50c6
Author: anatole <anatole@apache.org>
Authored: Tue Dec 16 22:42:29 2014 +0100
Committer: anatole <anatole@apache.org>
Committed: Tue Dec 16 22:42:29 2014 +0100

----------------------------------------------------------------------
 .../java/org/apache/tamaya/Environment.java     |  88 +----
 .../org/apache/tamaya/EnvironmentManager.java   |  65 +---
 .../java/org/apache/tamaya/MetaInfoBuilder.java |   6 -
 api/src/main/java/org/apache/tamaya/Stage.java  |  59 ---
 .../java/org/apache/tamaya/StageSupplier.java   |  33 --
 .../spi/EnvironmentManagerSingletonSpi.java     |  76 +---
 .../tamaya/TestEnvironmentManagerSingleton.java |  17 +-
 .../core/config/ConfigurationBuilder.java       | 388 +++++++++++++++++++
 .../tamaya/core/env/BuildableEnvironment.java   |  73 +---
 .../tamaya/core/env/EnvironmentBuilder.java     |  25 +-
 ...DependentApplicationEnvironmentProvider.java |  46 +--
 ...ssLoaderDependentEarEnvironmentProvider.java |  50 +--
 .../env/InitialEnvironmentProvider.java         |  53 +--
 .../internal/env/SingleEnvironmentManager.java  |  54 +--
 .../SystemClassLoaderEnvironmentProvider.java   |  49 +--
 .../core/properties/PropertySourceBuilder.java  |  56 +--
 .../tamaya/core/spi/EnvironmentProvider.java    |  26 +-
 ...tionManagerSingletonSpiSingletonSpiTest.java |   2 +-
 .../core/config/EnvironmentManagerTest.java     |   2 +-
 .../tamaya/core/env/EnvironmentManagerTest.java |  52 +--
 .../internal/TestEnvironmentProvider.java       |  48 +++
 ...g.apache.tamaya.core.spi.EnvironmentProvider |  19 +
 docs/pom.xml                                    |   5 +-
 23 files changed, 614 insertions(+), 678 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0b3b9639/api/src/main/java/org/apache/tamaya/Environment.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/Environment.java b/api/src/main/java/org/apache/tamaya/Environment.java
index ddaff91..c52b21e 100644
--- a/api/src/main/java/org/apache/tamaya/Environment.java
+++ b/api/src/main/java/org/apache/tamaya/Environment.java
@@ -18,7 +18,6 @@
  */
 package org.apache.tamaya;
 
-import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
@@ -35,23 +34,7 @@ import java.util.Set;
  * <li>serializable
  * </ul>
  */
-public interface Environment extends StageSupplier, Iterable<Environment>{
-
-    /**
-     * Get a unique type (within this VM) for this environment.
-     * Types represent the environment level within the hierarchy
-     * current possible environments, e.g. {@code system, ear, webapp, tenant}.
-     */
-    String getEnvironmentType();
-
-    /**
-     * Get a unique name (in combination with the environment type within this VM)
-     * for this environment instance.
-     * Where a human readable name is available this would be preferable
-     * over a technical key/UUID.
-     * @return a unique id for this environment, when comined with the environment type.
-     */
-    String getEnvironmentId();
+public interface Environment{
 
     /**
      * Access a property.
@@ -68,27 +51,12 @@ public interface Environment extends StageSupplier, Iterable<Environment>{
     boolean containsKey(String key);
 
     /**
-     * Access a property.
-     * @param key the property's key, not null.
-     * @return the property's value.
-     */
-    default String getOrDefault(String key, String defaultValue){
-        return get(key).orElse(defaultValue);
-    }
-
-    /**
      * Access the set current property keys, defined by this provider.
      * @return the key set, never null.
      */
     Set<String> keySet();
 
     /**
-     * Get the parent context.
-     * @return the parent context, or null.
-     */
-    Environment getParentEnvironment();
-
-    /**
      * Access the environment as Map.
      * @return the Map instance containing the environments properties, never null.
      */
@@ -100,60 +68,16 @@ public interface Environment extends StageSupplier, Iterable<Environment>{
      * @return the current Environment, never null.
      */
     public static Environment current(){
-        return EnvironmentManager.getEnvironment();
+        return EnvironmentManager.getCurrentEnvironment();
     }
 
     /**
-     * Get the current root (startup/machine/VM) {@link org.apache.tamaya.Environment}.
-     * @return the current root Environment, never null.
+     * Get the current {@link org.apache.tamaya.Environment}. The environment is used to determine the current runtime state, which
+     * is important for returning the correct configuration.
+     * @return the current Environment, never null.
      */
-    public static Environment getRootEnvironment(){
+    public static Environment root(){
         return EnvironmentManager.getRootEnvironment();
     }
 
-    /**
-     * Evaluate the overall chain current possible environments.
-     * @return the hierarchy chain current possible Environments.
-     */
-    public static List<String> getEnvironmentTypeOrder(){
-        return EnvironmentManager.getEnvironmentTypeOrder();
-    }
-
-    /**
-     * Evaluate the current type chain current environments.
-     * @return the current type chain current Environments.
-     */
-    public static List<String> getEnvironmentHierarchy(){
-        return EnvironmentManager.getEnvironmentHierarchy();
-    }
-
-    /**
-     * Get a environment current the given environment type and context.
-     * @param environmentType the target type, not null.
-     * @param contextId the target context, not null.
-     * @return the corresponding environment, if available.
-     */
-    public static Optional<Environment> getInstance(String environmentType, String contextId){
-        return EnvironmentManager.getEnvironment(environmentType, contextId);
-    }
-
-    /**
-     * Get the currently known environment contexts current a given environment type.
-     * @param environmentType the target environment type.
-     * @return the corresponding environment contexts known, never null.
-     */
-    public static Set<String> getEnvironmentContexts(String environmentType){
-        return EnvironmentManager.getEnvironmentContexts(environmentType);
-    }
-
-    /**
-     * Allows to check, if the czurrent environment type is one current the current active environment types.
-     * @param environmentType the environment type to be queried.
-     * @return true, if the czurrent environment type is one current the current active environment types.
-     */
-    public static boolean isEnvironmentActive(String environmentType){
-        return EnvironmentManager.isEnvironmentActive(environmentType);
-    }
-
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0b3b9639/api/src/main/java/org/apache/tamaya/EnvironmentManager.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/EnvironmentManager.java b/api/src/main/java/org/apache/tamaya/EnvironmentManager.java
index 164e456..d71abdb 100644
--- a/api/src/main/java/org/apache/tamaya/EnvironmentManager.java
+++ b/api/src/main/java/org/apache/tamaya/EnvironmentManager.java
@@ -21,7 +21,7 @@ package org.apache.tamaya;
 import org.apache.tamaya.spi.ServiceContext;
 import org.apache.tamaya.spi.EnvironmentManagerSingletonSpi;
 
-import java.util.List;
+import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
 
@@ -41,70 +41,17 @@ final class EnvironmentManager{
      * is important for returning the correct configuration.
      * @return the current Environment, never null.
      */
-    public static Environment getEnvironment(){
-        return ServiceContext.getInstance().getSingleton(EnvironmentManagerSingletonSpi.class).getEnvironment();
+    public static Environment getCurrentEnvironment(){
+        return ServiceContext.getInstance().getSingleton(EnvironmentManagerSingletonSpi.class).getCurrentEnvironment();
     }
 
     /**
-     * Get the current root (startup/machine/VM) {@link Environment}.
-     * @return the current root Environment, never null.
+     * Get the root {@link Environment}. The environment is used to determine the current runtime state, which
+     * is important for returning the correct configuration.
+     * @return the root  Environment, never null.
      */
     public static Environment getRootEnvironment(){
         return ServiceContext.getInstance().getSingleton(EnvironmentManagerSingletonSpi.class).getRootEnvironment();
     }
 
-    /**
-     * Evaluate the overall chain current possible environments.
-     * @return the hierarchy chain current possible Environments.
-     */
-    public static List<String> getEnvironmentTypeOrder(){
-        return ServiceContext.getInstance().getSingleton(EnvironmentManagerSingletonSpi.class).getEnvironmentTypeOrder();
-    }
-
-    /**
-     * Evaluate the current type chain current environments.
-     * @return the current type chain current Environments.
-     */
-    public static List<String> getEnvironmentHierarchy(){
-        return ServiceContext.getInstance().getSingleton(EnvironmentManagerSingletonSpi.class).getEnvironmentHierarchy();
-    }
-
-    /**
-     * Get the current environment current the given environment type.
-     * @param environmentType the target type.
-     * @return the corresponding environment
-     * @throws IllegalArgumentException if not such type is present or active.
-     */
-    public static Optional<Environment> getEnvironment(String environmentType){
-        return ServiceContext.getInstance().getSingleton(EnvironmentManagerSingletonSpi.class).getEnvironment(environmentType);
-    }
-
-    /**
-     * Get a environment current the given environment type and context.
-     * @param environmentType the target type, not null.
-     * @param contextId the target context, not null.
-     * @return the corresponding environment, if available.
-     */
-    public static Optional<Environment> getEnvironment(String environmentType, String contextId){
-        return ServiceContext.getInstance().getSingleton(EnvironmentManagerSingletonSpi.class).getEnvironment(environmentType, contextId);
-    }
-
-    /**
-     * Get the currently known environment contexts current a given environment type.
-     * @param environmentType the target environment type.
-     * @return the corresponding environment contexts known, never null.
-     */
-    public static Set<String> getEnvironmentContexts(String environmentType){
-        return ServiceContext.getInstance().getSingleton(EnvironmentManagerSingletonSpi.class).getEnvironmentContexts(environmentType);
-    }
-
-    /**
-     * Allows to check, if the czurrent environment type is one current the current active environment types.
-     * @param environmentType the environment type to be queried.
-     * @return true, if the czurrent environment type is one current the current active environment types.
-     */
-    public static boolean isEnvironmentActive(String environmentType){
-        return ServiceContext.getInstance().getSingleton(EnvironmentManagerSingletonSpi.class).isEnvironmentActive(environmentType);
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0b3b9639/api/src/main/java/org/apache/tamaya/MetaInfoBuilder.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/MetaInfoBuilder.java b/api/src/main/java/org/apache/tamaya/MetaInfoBuilder.java
index 407b783..277f34d 100644
--- a/api/src/main/java/org/apache/tamaya/MetaInfoBuilder.java
+++ b/api/src/main/java/org/apache/tamaya/MetaInfoBuilder.java
@@ -132,12 +132,6 @@ public final class MetaInfoBuilder{
         return this;
     }
 
-    public MetaInfoBuilder setEnvironment(Environment configurationContext){
-        Objects.requireNonNull(configurationContext);
-        map.put(ENVIRONMENT, configurationContext.getEnvironmentType()+'['+configurationContext.getEnvironmentId()+']');
-        return this;
-    }
-
     public MetaInfoBuilder set(String key, String value){
         Objects.requireNonNull(key);
         Objects.requireNonNull(value);

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0b3b9639/api/src/main/java/org/apache/tamaya/Stage.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/Stage.java b/api/src/main/java/org/apache/tamaya/Stage.java
deleted file mode 100644
index 125bb81..0000000
--- a/api/src/main/java/org/apache/tamaya/Stage.java
+++ /dev/null
@@ -1,59 +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;
-
-
-/**
- * Stage which should be supported by all layers, users may still add sub stages by adding additional properties
- * to the current environment.
- */
-public enum Stage {
-
-    /**
-     * Get the default stage for develpment.
-     * @return the default stage, never null.
-     */
-    DEVELOPMENT,
-
-    /**
-     * Get the default stage for (component) testing.
-     * @return the default stage, never null.
-     */
-    TEST,
-
-    /**
-     * Get the default stage for integration (testing).
-     * @return the default stage, never null.
-     */
-    INTEGRATION,
-
-    /**
-     * Get the default stage for staging.
-     * @return the default stage, never null.
-     */
-    STAGING,
-
-    /**
-     * Get the default stage for production.
-     * @return the default stage, never null.
-     */
-    PRODUCTION
-}
-
-

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0b3b9639/api/src/main/java/org/apache/tamaya/StageSupplier.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/StageSupplier.java b/api/src/main/java/org/apache/tamaya/StageSupplier.java
deleted file mode 100644
index 120a2bd..0000000
--- a/api/src/main/java/org/apache/tamaya/StageSupplier.java
+++ /dev/null
@@ -1,33 +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;
-
-/**
- * Small functional interface for components that provide a stage.
- */
-@FunctionalInterface
-public interface StageSupplier{
-
-    /**
-     * Get the environment's stage.
-     * @return the current stage, never null.
-     */
-    public Stage getStage();
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0b3b9639/api/src/main/java/org/apache/tamaya/spi/EnvironmentManagerSingletonSpi.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/spi/EnvironmentManagerSingletonSpi.java b/api/src/main/java/org/apache/tamaya/spi/EnvironmentManagerSingletonSpi.java
index 1cbd0fb..9be5653 100644
--- a/api/src/main/java/org/apache/tamaya/spi/EnvironmentManagerSingletonSpi.java
+++ b/api/src/main/java/org/apache/tamaya/spi/EnvironmentManagerSingletonSpi.java
@@ -21,10 +21,7 @@ package org.apache.tamaya.spi;
 
 import org.apache.tamaya.Environment;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-import java.util.Set;
+import java.util.*;
 
 /**
  * Service for accessing {@link org.apache.tamaya.Environment}. Environments are used to
@@ -38,76 +35,17 @@ import java.util.Set;
 public interface EnvironmentManagerSingletonSpi{
 
     /**
-     * Get the current environment.
-     *
-     * @return the current environment, never null.
-     */
-    Environment getEnvironment();
-
-    /**
-     * Get the initial root environment, that typically contains any startup and initial parameters current an VM instance,
-     * machine.
-     *
-     * @return the initial environment, never null.
-     */
-    Environment getRootEnvironment();
-
-    /**
-     * Get a environment current the given environment type and context.
-     * @param environmentType the target type, not null.
-     * @param contextId the target context, not null.
-     * @return the corresponding environment, if available.
-     */
-    public Optional<Environment> getEnvironment(String environmentType, String contextId);
-
-    /**
-     * Get the currently known environment contexts current a given environment type.
-     * @param environmentType the target environment type.
-     * @return the corresponding environment contexts known, never null.
-     */
-    public Set<String> getEnvironmentContexts(String environmentType);
-
-    /**
-     * Access the chain current environment types that may produce an environment. Hereby it is possible
-     * that chain elements can be ommitted in the final environment hierarchy, since the regarding
-     * environment level is not defined or accessible.
-     * @return the ordered list current environment type ids.
-     */
-    List<String> getEnvironmentTypeOrder();
-
-    /**
-     * Evaluate the current type chain current environments.
-     * @return the current type chain current Environments.
+     * Get the current environment current the given environment type.
+     * @return the corresponding environment, never null.
+     * @throws IllegalArgumentException if not such type is present or active.
      */
-    default List<String> getEnvironmentHierarchy(){
-        List<String> result = new ArrayList<>();
-        for(Environment env:getEnvironment()){
-            result.add(env.getEnvironmentId()+'('+env.getEnvironmentType()+')');
-        }
-        return result;
-    }
+    Environment getCurrentEnvironment();
 
     /**
      * Get the current environment current the given environment type.
-     * @param environmentType the target type.
-     * @return the corresponding environment
+     * @return the corresponding environment, never null.
      * @throws IllegalArgumentException if not such type is present or active.
      */
-    default Optional<Environment> getEnvironment(String environmentType){
-        for(Environment env:getEnvironment()){
-            if(env.getEnvironmentType().equals(environmentType)){
-                return Optional.of(env);
-            }
-        }
-        return Optional.empty();
-    }
+    Environment getRootEnvironment();
 
-    /**
-     * Allows to check, if the czurrent environment type is one current the current active environment types.
-     * @param environmentType the environment type to be queried.
-     * @return true, if the czurrent environment type is one current the current active environment types.
-     */
-    default boolean isEnvironmentActive(String environmentType){
-        return getEnvironmentHierarchy().contains(environmentType);
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0b3b9639/api/src/test/java/org/apache/tamaya/TestEnvironmentManagerSingleton.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/tamaya/TestEnvironmentManagerSingleton.java b/api/src/test/java/org/apache/tamaya/TestEnvironmentManagerSingleton.java
index 6f4ee6d..98a7114 100644
--- a/api/src/test/java/org/apache/tamaya/TestEnvironmentManagerSingleton.java
+++ b/api/src/test/java/org/apache/tamaya/TestEnvironmentManagerSingleton.java
@@ -20,6 +20,7 @@ package org.apache.tamaya;
 
 import org.apache.tamaya.spi.EnvironmentManagerSingletonSpi;
 
+import javax.swing.text.html.Option;
 import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
@@ -30,7 +31,7 @@ import java.util.Set;
  */
 public class TestEnvironmentManagerSingleton implements EnvironmentManagerSingletonSpi{
     @Override
-    public Environment getEnvironment(){
+    public Environment getCurrentEnvironment(){
         return null;
     }
 
@@ -39,18 +40,4 @@ public class TestEnvironmentManagerSingleton implements EnvironmentManagerSingle
         return null;
     }
 
-    @Override
-    public Optional<Environment> getEnvironment(String environmentType, String contextId) {
-        return null;
-    }
-
-    @Override
-    public Set<String> getEnvironmentContexts(String environmentType) {
-        return Collections.emptySet();
-    }
-
-    @Override
-    public List<String> getEnvironmentTypeOrder() {
-        return Collections.emptyList();
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0b3b9639/core/src/main/java/org/apache/tamaya/core/config/ConfigurationBuilder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/config/ConfigurationBuilder.java b/core/src/main/java/org/apache/tamaya/core/config/ConfigurationBuilder.java
new file mode 100644
index 0000000..9cbdee9
--- /dev/null
+++ b/core/src/main/java/org/apache/tamaya/core/config/ConfigurationBuilder.java
@@ -0,0 +1,388 @@
+/*
+* 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.core.config;
+
+import org.apache.tamaya.*;
+import org.apache.tamaya.core.properties.PropertySourceBuilder;
+
+import java.net.URL;
+import java.util.*;
+import java.util.function.Predicate;
+import java.util.function.Supplier;
+import java.util.logging.Logger;
+
+/**
+* Builder for assembling non trivial property providers.
+*/
+public final class ConfigurationBuilder {
+
+    /**
+     * THe logger used.
+     */
+    private static final Logger LOG = Logger.getLogger(ConfigurationBuilder.class.getName());
+
+    /**
+     * The final meta info to be used, or null, if a default should be generated.
+     */
+    private PropertySourceBuilder builderDelegate;
+
+    /**
+     * Private singleton constructor.
+     */
+    private ConfigurationBuilder(MetaInfo metaInfo) {
+        this.builderDelegate = PropertySourceBuilder.of(metaInfo);
+    }
+
+    /**
+     * Private singleton constructor.
+     */
+    private ConfigurationBuilder(String name) {
+        this.builderDelegate = PropertySourceBuilder.of(name);
+    }
+
+    /**
+     * Private singleton constructor.
+     */
+    private ConfigurationBuilder(PropertySource provider) {
+        this.builderDelegate = PropertySourceBuilder.of(provider);
+    }
+
+
+    /**
+     * Creates a new builder instance.
+     *
+     * @param provider the base provider to be used, not null.
+     * @return a new builder instance, never null.
+     */
+    public static ConfigurationBuilder of(PropertySource provider) {
+        return new ConfigurationBuilder(provider);
+    }
+
+    /**
+     * Creates a new builder instance.
+     *
+     * @param metaInfo the meta information, not null.
+     * @return a new builder instance, never null.
+     */
+    public static ConfigurationBuilder of(MetaInfo metaInfo) {
+        return new ConfigurationBuilder(metaInfo);
+    }
+
+    /**
+     * Creates a new builder instance.
+     *
+     * @param name the provider name, not null.
+     * @return a new builder instance, never null.
+     */
+    public static ConfigurationBuilder of(String name) {
+        return new ConfigurationBuilder(Objects.requireNonNull(name));
+    }
+
+    /**
+     * Creates a new builder instance.
+     *
+     * @return a new builder instance, never null.
+     */
+    public static ConfigurationBuilder of() {
+        return new ConfigurationBuilder("<noname>");
+    }
+
+
+
+
+    /**
+     * Sets the aggregation policy to be used, when adding additional property sets. The policy will
+     * be active a slong as the builder is used or it is reset to another value.
+     *
+     * @param aggregationPolicy the aggregation policy, not null.
+     * @return the builder for chaining.
+     */
+    public ConfigurationBuilder withAggregationPolicy(AggregationPolicy aggregationPolicy) {
+        this.builderDelegate.withAggregationPolicy(aggregationPolicy);
+        return this;
+    }
+
+    /**
+     * Sets the meta info to be used for the next operation.
+     *
+     * @param metaInfo the meta info, not null.
+     * @return the builder for chaining.
+     */
+    public ConfigurationBuilder withMetaInfo(MetaInfo metaInfo) {
+        this.builderDelegate.withMetaInfo(metaInfo);
+        return this;
+    }
+
+    /**
+     * Adds the given providers with the current active {@link org.apache.tamaya.AggregationPolicy}. By
+     * default {@link org.apache.tamaya.AggregationPolicy#OVERRIDE} is used.
+     * @see #withAggregationPolicy(org.apache.tamaya.AggregationPolicy)
+     * @param providers providers to be added, not null.
+     * @return the builder for chaining.
+     */
+    public ConfigurationBuilder addProviders(PropertySource... providers) {
+        this.builderDelegate.addProviders(providers);
+        return this;
+    }
+
+    /**
+     * Adds the given providers with the current active {@link org.apache.tamaya.AggregationPolicy}. By
+     * default {@link org.apache.tamaya.AggregationPolicy#OVERRIDE} is used.
+     * @see #withAggregationPolicy(org.apache.tamaya.AggregationPolicy)
+     * @param providers providers to be added, not null.
+     * @return the builder for chaining.
+     */
+    public ConfigurationBuilder addProviders(List<PropertySource> providers) {
+        this.builderDelegate.addProviders(providers);
+        return this;
+    }
+
+
+    /**
+     * Creates a new {@link org.apache.tamaya.PropertySource} using the given command line arguments and adds it
+     * using the current aggregation policy in place.
+     *
+     * @param args the command line arguments, not null.
+     * @return the builder for chaining.
+     */
+    public ConfigurationBuilder addArgs(String... args) {
+        this.builderDelegate.addArgs(args);
+        return this;
+    }
+
+    /**
+     * Creates a new read-only {@link org.apache.tamaya.PropertySource} by reading the according path resources. The effective resources read
+     * hereby are determined by the {@code PathResolverService} configured into the {@code Bootstrap} SPI.
+     * Properties read are aggregated using the current aggregation policy active.
+     *
+     * @param paths the paths to be resolved by the {@code PathResolverService} , not null.
+     * @return the builder for chaining.
+     */
+    public ConfigurationBuilder addPaths(String... paths) {
+        this.builderDelegate.addPaths(paths);
+        return this;
+    }
+
+
+    /**
+     * Creates a new read-only {@link org.apache.tamaya.PropertySource} by reading the according path resources. The effective resources read
+     * hereby are determined by the {@code PathResolverService} configured into the {@code Bootstrap} SPI.
+     * Properties read are aggregated using the current aggregation policy active.
+     *
+     * @param paths the paths to be resolved by the {@code PathResolverService} , not null.
+     * @return the builder for chaining.
+     */
+    public ConfigurationBuilder addPaths(List<String> paths) {
+        this.builderDelegate.addPaths(paths);
+        return this;
+    }
+
+    /**
+     * Creates a new read-only {@link org.apache.tamaya.PropertySource} by reading the according URL resources.
+     * Properties read are aggregated using the current aggregation policy active.
+     *
+     * @param urls the urls to be read, not null.
+     * @return the builder for chaining.
+     */
+    public ConfigurationBuilder addURLs(URL... urls) {
+        this.builderDelegate.addURLs(urls);
+        return this;
+    }
+
+    /**
+     * Creates a new read-only {@link org.apache.tamaya.PropertySource} by reading the according URL resources.
+     * Properties read are aggregated using the current aggregation policy active.
+     *
+     * @param urls the urls to be read, not null.
+     * @return the builder for chaining.
+     */
+    public ConfigurationBuilder addURLs(List<URL> urls) {
+        this.builderDelegate.addURLs(urls);
+        return this;
+    }
+
+
+    /**
+     * Creates a new read-only {@link org.apache.tamaya.PropertySource} based on the given map.
+     * Properties read are aggregated using the current aggregation policy active.
+     *
+     * @param map the map to be added, not null.
+     * @return the builder for chaining.
+     */
+    public ConfigurationBuilder addMap(Map<String, String> map) {
+        this.builderDelegate.addMap(map);
+        return this;
+    }
+
+
+    /**
+     * Add the current environment properties. Aggregation is based on the current {@link org.apache.tamaya.AggregationPolicy} acvtive.
+     *
+     * @return the builder for chaining.
+     */
+    public ConfigurationBuilder addEnvironmentProperties() {
+        this.builderDelegate.addEnvironmentProperties();
+        return this;
+    }
+
+    /**
+     * Add the current system properties. Aggregation is based on the current {@link org.apache.tamaya.AggregationPolicy} acvtive.
+     *
+     * @return the builder for chaining.
+     */
+    public ConfigurationBuilder addSystemProperties() {
+        this.builderDelegate.addSystemProperties();
+        return this;
+    }
+
+    /**
+     * Adds the given {@link org.apache.tamaya.PropertySource} instances using the current {@link org.apache.tamaya.AggregationPolicy}
+     * active.
+     *
+     * @param providers the maps to be included, not null.
+     * @return the builder for chaining.
+     */
+    public ConfigurationBuilder aggregate(PropertySource... providers) {
+        this.builderDelegate.aggregate(providers);
+        return this;
+    }
+
+
+    /**
+     * Adds the given {@link org.apache.tamaya.PropertySource} instances using the current {@link org.apache.tamaya.AggregationPolicy}
+     * active.
+     *
+     * @param providers the maps to be included, not null.
+     * @return the builder for chaining.
+     */
+    public ConfigurationBuilder aggregate(List<PropertySource> providers) {
+        this.builderDelegate.aggregate(providers);
+        return this;
+    }
+
+
+    /**
+     * Intersetcs the current properties with the given {@link org.apache.tamaya.PropertySource} instance.
+     *
+     * @param providers the maps to be intersected, not null.
+     * @return the builder for chaining.
+     */
+    public ConfigurationBuilder intersect(PropertySource... providers) {
+        this.builderDelegate.intersect(providers);
+        return this;
+    }
+
+
+    /**
+     * Subtracts with the given {@link org.apache.tamaya.PropertySource} instance from the current properties.
+     *
+     * @param providers the maps to be subtracted, not null.
+     * @return the builder for chaining.
+     */
+    public ConfigurationBuilder subtract(PropertySource... providers) {
+        this.builderDelegate.subtract(providers);
+        return this;
+    }
+
+
+    /**
+     * Filters the current properties based on the given predicate..
+     *
+     * @param filter the filter to be applied, not null.
+     * @return the new filtering instance.
+     */
+    public ConfigurationBuilder filter(Predicate<String> filter) {
+        this.builderDelegate.filter(filter);
+        return this;
+    }
+
+    /**
+     * Creates a new contextual {@link org.apache.tamaya.PropertySource}. Contextual maps delegate to different instances current PropertyMap depending
+     * on the keys returned fromMap the isolationP
+     *
+     * @param mapSupplier          the supplier creating new provider instances
+     * @param isolationKeySupplier the supplier providing contextual keys based on the current environment.
+     */
+    public ConfigurationBuilder addContextual(Supplier<PropertySource> mapSupplier,
+                                                 Supplier<String> isolationKeySupplier) {
+        this.builderDelegate.addContextual(mapSupplier, isolationKeySupplier);
+        return this;
+    }
+
+    /**
+     * Replaces all keys in the current provider by the given map.
+     *
+     * @param replacementMap the map instance, that will replace all corresponding entries in {@code mainMap}, not null.
+     * @return the new delegating instance.
+     */
+    public ConfigurationBuilder replace(Map<String, String> replacementMap) {
+        this.builderDelegate.replace(replacementMap);
+        return this;
+    }
+
+    /**
+     * Sets an additional key on the final {@link org.apache.tamaya.MetaInfo} of the provider
+     * created.
+     *
+     * @param key the key to be added, not null.
+     * @param value the value to be added, not null.
+     * @return this builder for chaining
+     */
+    public ConfigurationBuilder setMeta(String key, String value){
+        this.builderDelegate.setMeta(key, value);
+        return this;
+    }
+
+    /**
+     * Build a new property provider based on the input.
+     * @return a new property provider, or null.
+     */
+    public PropertySource buildPropertySource(){
+        return this.builderDelegate.build();
+    }
+
+    /**
+     * Build a new property provider based on the input.
+     * @return a new property provider, or null.
+     */
+    public Configuration build(){
+        return this.buildPropertySource().toConfiguration();
+    }
+
+    /**
+     * Creates a {@link org.apache.tamaya.PropertySource} instance that is serializable and immutable,
+     * so it can be sent over a network connection.
+     *
+     * @return the freezed instance, never null.
+     */
+    public PropertySource buildFreezedPropertySource() {
+        return this.builderDelegate.buildFreezed();
+    }
+
+    /**
+     * Creates a {@link org.apache.tamaya.PropertySource} instance that is serializable and immutable,
+     * so it can be sent over a network connection.
+     *
+     * @return the freezed instance, never null.
+     */
+    public Configuration buildFreezed() {
+        return FreezedConfiguration.of(this.buildFreezedPropertySource().toConfiguration());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0b3b9639/core/src/main/java/org/apache/tamaya/core/env/BuildableEnvironment.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/env/BuildableEnvironment.java b/core/src/main/java/org/apache/tamaya/core/env/BuildableEnvironment.java
index f75c1e7..0308853 100644
--- a/core/src/main/java/org/apache/tamaya/core/env/BuildableEnvironment.java
+++ b/core/src/main/java/org/apache/tamaya/core/env/BuildableEnvironment.java
@@ -19,7 +19,6 @@
 package org.apache.tamaya.core.env;
 
 import org.apache.tamaya.Environment;
-import org.apache.tamaya.Stage;
 
 import java.util.*;
 
@@ -28,37 +27,10 @@ class BuildableEnvironment implements Environment {
 
     private static final long serialVersionUID = 707575538680740130L;
     private Map<String,String> context = new TreeMap<>();
-    private Environment parent;
-    private String id;
-    private String type;
-    private Stage stage;
 
     BuildableEnvironment(EnvironmentBuilder builder){
         Objects.requireNonNull(builder);
         context.putAll(builder.contextData);
-        this.id = builder.id;
-        this.type = builder.type;
-        this.stage = builder.stage;
-        this.parent = builder.parent;
-    }
-
-    @Override
-    public String getEnvironmentType() {
-        return type;
-    }
-
-    @Override
-    public String getEnvironmentId() {
-        return id;
-    }
-
-    public String getFullId() {
-        return getEnvironmentId()+'('+getEnvironmentType()+')';
-    }
-
-    @Override
-    public Environment getParentEnvironment(){
-        return parent;
     }
 
     @Override
@@ -67,17 +39,8 @@ class BuildableEnvironment implements Environment {
     }
 
     @Override
-    public Stage getStage(){
-        return stage;
-    }
-
-    @Override
     public Optional<String> get(String key){
-        String value =  context.get(key);
-        if(value==null && parent!=null){
-            return parent.get(key);
-        }
-        return Optional.ofNullable(value);
+        return Optional.ofNullable(context.get(key));
     }
 
     @Override
@@ -91,29 +54,27 @@ class BuildableEnvironment implements Environment {
     }
 
     @Override
-    public Iterator<Environment> iterator() {
-        List<Environment> envList = new ArrayList<>();
-        Environment env = this;
-        while(env.getParentEnvironment()!=null){
-            envList.add(env);
-            env = env.getParentEnvironment();
-        }
-        envList.add(env);
-        return envList.iterator();
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        BuildableEnvironment that = (BuildableEnvironment) o;
+        return context.equals(that.context);
+    }
+
+    @Override
+    public int hashCode() {
+        return context.hashCode();
     }
 
     /*
-     * (non-Javadoc)
-	 *
-	 * @see java.lang.Object#toString()
-	 */
+         * (non-Javadoc)
+         *
+         * @see java.lang.Object#toString()
+         */
     @Override
     public String toString(){
-        if(parent==null) {
-            return "Environment " + getFullId() + '\n' + getData();
-        }
-        return "Environment " + getFullId() +
-                ",\n"  + getData() + ",\n  parent: " + parent.toString();
+        return "Environment: " + getData();
     }
 
     private String getData() {

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0b3b9639/core/src/main/java/org/apache/tamaya/core/env/EnvironmentBuilder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/env/EnvironmentBuilder.java b/core/src/main/java/org/apache/tamaya/core/env/EnvironmentBuilder.java
index 8f66c53..b5e189d 100644
--- a/core/src/main/java/org/apache/tamaya/core/env/EnvironmentBuilder.java
+++ b/core/src/main/java/org/apache/tamaya/core/env/EnvironmentBuilder.java
@@ -19,7 +19,6 @@
 package org.apache.tamaya.core.env;
 
 import org.apache.tamaya.Environment;
-import org.apache.tamaya.Stage;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -30,25 +29,14 @@ import java.util.Objects;
 */
 public final class EnvironmentBuilder{
 
+    public static final String STAGE_PROP = "stage";
     Map<String,String> contextData = new HashMap<>();
-    Environment parent;
-    String id;
-    String type;
-    Stage stage = Stage.DEVELOPMENT;
 
-    private EnvironmentBuilder(String id, String type) {
-        Objects.requireNonNull(id);
-        this.id = id;
-        this.type = type;
+    private EnvironmentBuilder() {
     }
 
-    public static final EnvironmentBuilder of(String id, String type) {
-        return new EnvironmentBuilder(id, type);
-    }
-
-    public EnvironmentBuilder setParent(Environment parent){
-        this.parent = parent;
-        return this;
+    public static final EnvironmentBuilder of() {
+        return new EnvironmentBuilder();
     }
 
     public EnvironmentBuilder set(String key, String value){
@@ -61,9 +49,8 @@ public final class EnvironmentBuilder{
         return this;
     }
 
-    public EnvironmentBuilder setStage(Stage stage){
-        Objects.requireNonNull(stage);
-        this.stage = stage;
+    public EnvironmentBuilder setStage(String stage){
+        this.contextData.put(STAGE_PROP, Objects.requireNonNull(stage));
         return this;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0b3b9639/core/src/main/java/org/apache/tamaya/core/internal/env/ClassLoaderDependentApplicationEnvironmentProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/internal/env/ClassLoaderDependentApplicationEnvironmentProvider.java b/core/src/main/java/org/apache/tamaya/core/internal/env/ClassLoaderDependentApplicationEnvironmentProvider.java
index b16ed8d..dc404b5 100644
--- a/core/src/main/java/org/apache/tamaya/core/internal/env/ClassLoaderDependentApplicationEnvironmentProvider.java
+++ b/core/src/main/java/org/apache/tamaya/core/internal/env/ClassLoaderDependentApplicationEnvironmentProvider.java
@@ -46,17 +46,11 @@ public class ClassLoaderDependentApplicationEnvironmentProvider implements Envir
 
     private static final String WARID_PROP = "environment.applicationId";
 
-    private Map<ClassLoader, Environment> environments = new ConcurrentHashMap<>();
+    private Map<ClassLoader, Map<String,String>> environments = new ConcurrentHashMap<>();
     private Map<ClassLoader, Boolean> environmentAvailable = new ConcurrentHashMap<>();
-    private Map<String, Environment> environmentsByAppId = new ConcurrentHashMap<>();
 
     @Override
-    public String getEnvironmentType() {
-        return "application";
-    }
-
-    @Override
-    public boolean isEnvironmentActive() {
+    public boolean isActive() {
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
         if(cl==null){
             return false;
@@ -73,48 +67,36 @@ public class ClassLoaderDependentApplicationEnvironmentProvider implements Envir
     }
 
     @Override
-    public Environment getEnvironment(Environment parentEnvironment) {
+    public Map<String,String> getEnvironmentData() {
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
         if(cl==null){
             return null;
         }
-        Environment environment = this.environments.get(cl);
-        if(environment!=null){
-            return environment;
+        Map<String,String> data = this.environments.get(cl);
+        if(data!=null){
+            return data;
         }
         List<Resource> propertyUris = ServiceContext.getInstance().getSingleton(ResourceLoader.class).getResources(cl,
                 "classpath:META-INF/env/application.properties", "classpath:META-INF/env/application.xml", "classpath:META-INF/env/application.ini");
-        Map<String,String> data = new HashMap<>();
+        data = new HashMap();
 
         for(Resource resource:propertyUris){
             try{
                 ConfigurationFormat format = ConfigurationFormats.getFormat(resource);
-                Map<String,String> read = format.readConfiguration(resource);
-                data.putAll(read);
+                data.putAll(format.readConfiguration(resource));
             }
             catch(Exception e){
                 LOG.log(Level.SEVERE, e, () -> "Error reading application environment data fromMap " + resource);
             }
         }
         String applicationId = data.getOrDefault(WARID_PROP, cl.toString());
-        EnvironmentBuilder builder = EnvironmentBuilder.of(applicationId, getEnvironmentType());
-        builder.setParent(parentEnvironment);
-        builder.set("classloader.type", cl.getClass().getName());
-        builder.set("classloader.info", cl.toString());
+        data.put("classloader.type", cl.getClass().getName());
+        data.put("classloader.info", cl.toString());
         Set<Resource> uris = new HashSet<>();
         uris.addAll(propertyUris);
-        builder.set("environment.sources", uris.toString());
-        builder.setAll(data);
-        environment = builder.build();
-        this.environments.put(cl, environment);
-        if(applicationId!=null) {
-            this.environmentsByAppId.put(applicationId, environment);
-        }
-        return environment;
-    }
-
-    @Override
-    public Set<String> getEnvironmentContexts() {
-        return environmentsByAppId.keySet();
+        data.put("environment.sources", uris.toString());
+        data = Collections.unmodifiableMap(data);
+        this.environments.put(cl, data);
+        return data;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0b3b9639/core/src/main/java/org/apache/tamaya/core/internal/env/ClassLoaderDependentEarEnvironmentProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/internal/env/ClassLoaderDependentEarEnvironmentProvider.java b/core/src/main/java/org/apache/tamaya/core/internal/env/ClassLoaderDependentEarEnvironmentProvider.java
index e389156..69ad04a 100644
--- a/core/src/main/java/org/apache/tamaya/core/internal/env/ClassLoaderDependentEarEnvironmentProvider.java
+++ b/core/src/main/java/org/apache/tamaya/core/internal/env/ClassLoaderDependentEarEnvironmentProvider.java
@@ -18,8 +18,6 @@
  */
 package org.apache.tamaya.core.internal.env;
 
-import org.apache.tamaya.Environment;
-import org.apache.tamaya.Stage;
 import org.apache.tamaya.core.config.ConfigurationFormats;
 import org.apache.tamaya.core.env.EnvironmentBuilder;
 import org.apache.tamaya.core.resource.Resource;
@@ -49,17 +47,11 @@ public class ClassLoaderDependentEarEnvironmentProvider implements EnvironmentPr
 
     private static final String EARID_PROP = "environment.earId";
 
-    private Map<ClassLoader, Environment> environments = new ConcurrentHashMap<>();
+    private Map<ClassLoader, Map<String,String>> environments = new ConcurrentHashMap<>();
     private Map<ClassLoader, Boolean> environmentAvailable = new ConcurrentHashMap<>();
-    private Map<String, Environment> environmentsByEarId = new ConcurrentHashMap<>();
 
     @Override
-    public String getEnvironmentType() {
-        return "ear";
-    }
-
-    @Override
-    public boolean isEnvironmentActive() {
+    public boolean isActive() {
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
         if(cl==null){
             return false;
@@ -76,19 +68,18 @@ public class ClassLoaderDependentEarEnvironmentProvider implements EnvironmentPr
     }
 
     @Override
-    public Environment getEnvironment(Environment parentEnvironment) {
+    public Map<String,String> getEnvironmentData() {
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
         if(cl==null){
             return null;
         }
-        Environment environment = this.environments.get(cl);
-        if(environment!=null){
-            return environment;
+        Map<String,String> data = this.environments.get(cl);
+        if(data!=null){
+            return data;
         }
         List<Resource> resources = ServiceContext.getInstance().getSingleton(ResourceLoader.class).getResources(cl,
                 "classpath:META-INF/env/ear.properties", "classpath:META-INF/env/ear.xml", "classpath:META-INF/env/ear.ini");
-        Map<String,String> data = new HashMap<>();
-
+        data = new HashMap<>();
         for(Resource resource:resources){
             try{
                 ConfigurationFormat format = ConfigurationFormats.getFormat(resource);
@@ -100,29 +91,18 @@ public class ClassLoaderDependentEarEnvironmentProvider implements EnvironmentPr
             }
         }
         String earId = data.getOrDefault(EARID_PROP, cl.toString());
-        EnvironmentBuilder builder = EnvironmentBuilder.of(earId, getEnvironmentType());
-        builder.setParent(parentEnvironment);
-        String stageValue =  data.get(InitialEnvironmentProvider.STAGE_PROP);
+        String stageValue =  data.get(EnvironmentBuilder.STAGE_PROP);
         if (stageValue != null) {
-            Stage stage = Stage.valueOf(stageValue);
-            builder.setStage(stage);
+            data.put(EnvironmentBuilder.STAGE_PROP,stageValue);
         }
-        builder.set("classloader.type", cl.getClass().getName());
-        builder.set("classloader.info", cl.toString());
+        data.put("classloader.type", cl.getClass().getName());
+        data.put("classloader.info", cl.toString());
         Set<Resource> resourceSet = new HashSet<>();
         resourceSet.addAll(resources);
-        builder.set("environment.sources", resourceSet.toString());
-        builder.setAll(data);
-        environment = builder.build();
-        this.environments.put(cl, environment);
-        if(earId!=null) {
-            this.environmentsByEarId.put(earId, environment);
-        }
-        return environment;
+        data.put("environment.sources", resourceSet.toString());
+        data = Collections.unmodifiableMap(data);
+        this.environments.put(cl, data);
+        return data;
     }
 
-    @Override
-    public Set<String> getEnvironmentContexts() {
-        return environmentsByEarId.keySet();
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0b3b9639/core/src/main/java/org/apache/tamaya/core/internal/env/InitialEnvironmentProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/internal/env/InitialEnvironmentProvider.java b/core/src/main/java/org/apache/tamaya/core/internal/env/InitialEnvironmentProvider.java
index c96abba..76dac95 100644
--- a/core/src/main/java/org/apache/tamaya/core/internal/env/InitialEnvironmentProvider.java
+++ b/core/src/main/java/org/apache/tamaya/core/internal/env/InitialEnvironmentProvider.java
@@ -24,9 +24,10 @@ import org.apache.tamaya.core.env.EnvironmentBuilder;
 import java.net.InetAddress;
 import java.util.*;
 import java.util.Map.Entry;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import org.apache.tamaya.Environment;
-import org.apache.tamaya.Stage;
 import org.apache.tamaya.core.spi.EnvironmentProvider;
 
 /**
@@ -34,59 +35,37 @@ import org.apache.tamaya.core.spi.EnvironmentProvider;
  */
 public final class InitialEnvironmentProvider implements EnvironmentProvider{
 
-	public static final String STAGE_PROP = "org.apache.tamaya.stage";
-    public static final Stage DEFAULT_STAGE = Stage.DEVELOPMENT;
-    private Map<String,Environment> environments = new HashMap<>();
+	private Map<String,String> environmentData = new HashMap<>();
 
 	public InitialEnvironmentProvider() {
-        EnvironmentBuilder builder = EnvironmentBuilder.of(getEnvironmentType(), getEnvironmentType());
         Properties props = System.getProperties();
         if(props instanceof ConfiguredSystemProperties){
             props = ((ConfiguredSystemProperties)props).getInitialProperties();
         }
-        String stageValue =  props.getProperty(STAGE_PROP);
-        Stage stage = DEFAULT_STAGE;
-        if (stageValue != null) {
-            stage = Stage.valueOf(stageValue);
-        }
-        builder.setStage(stage);
-        // Copy system properties....
-        // TODO filter properties
-        for (Entry<Object, Object> en : props.entrySet()) {
-            builder.set(en.getKey().toString(), en.getValue().toString());
-        }
-        builder.set("timezone", TimeZone.getDefault().getID());
-        builder.set("locale", Locale.getDefault().toString());
+        String stageValue =  props.getProperty(EnvironmentBuilder.STAGE_PROP);
+        environmentData.put(EnvironmentBuilder.STAGE_PROP, stageValue);
+        environmentData.put("timezone", TimeZone.getDefault().getID());
+        environmentData.put("locale", Locale.getDefault().toString());
         try {
-            builder.set("host", InetAddress.getLocalHost().toString());
+            environmentData.put("host", InetAddress.getLocalHost().toString());
         } catch (Exception e) {
-// log warning
+            Logger.getLogger(getClass().getName()).log(Level.WARNING, e, () -> "Failed to evaluate hostname.");
         }
         // Copy env properties....
         for (Entry<String, String> en : System.getenv().entrySet()) {
-            builder.set(en.getKey(), en.getValue());
+            environmentData.put(en.getKey(), en.getValue());
         }
-        environments.put("root", builder.build());
-	}
-
-    @Override
-	public Environment getEnvironment(Environment env) {
-        return environments.get("root");
+        environmentData = Collections.unmodifiableMap(environmentData);
 	}
 
     @Override
-    public Set<String> getEnvironmentContexts() {
-        return new HashSet<>(environments.keySet());
-    }
-
-    @Override
-    public String getEnvironmentType() {
-        return "root";
+    public boolean isActive(){
+        return true;
     }
 
     @Override
-    public boolean isEnvironmentActive() {
-        return true;
-    }
+	public Map<String,String> getEnvironmentData() {
+        return environmentData;
+	}
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0b3b9639/core/src/main/java/org/apache/tamaya/core/internal/env/SingleEnvironmentManager.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/internal/env/SingleEnvironmentManager.java b/core/src/main/java/org/apache/tamaya/core/internal/env/SingleEnvironmentManager.java
index 6d75ac2..76ea0c8 100644
--- a/core/src/main/java/org/apache/tamaya/core/internal/env/SingleEnvironmentManager.java
+++ b/core/src/main/java/org/apache/tamaya/core/internal/env/SingleEnvironmentManager.java
@@ -20,13 +20,12 @@ package org.apache.tamaya.core.internal.env;
 
 import org.apache.tamaya.Environment;
 
-import org.apache.tamaya.core.internal.MetaConfig;
+import org.apache.tamaya.core.env.EnvironmentBuilder;
 import org.apache.tamaya.spi.ServiceContext;
 import org.apache.tamaya.spi.EnvironmentManagerSingletonSpi;
 import org.apache.tamaya.core.spi.EnvironmentProvider;
 
 import java.util.*;
-import java.util.stream.Collectors;
 
 /**
  * Service for accessing {@link org.apache.tamaya.Environment}. Environments are used to
@@ -39,63 +38,34 @@ import java.util.stream.Collectors;
  */
 public class SingleEnvironmentManager implements EnvironmentManagerSingletonSpi{
 
-    private static final String ENVIRONMENT_ORDER_KEY = "org.apache.tamaya.environmentOrder";
-    private static final String DEFAULT_ENVIRONMENT_ORDER = "root,system,ear,application";
-
-    private final Map<String,EnvironmentProvider> providerMap = new HashMap<>();
     private final List<EnvironmentProvider> environmentProviders = loadEnvironmentProviders();
+    private Environment rootEnvironment = getCurrentEnvironment();
 
     private List<EnvironmentProvider> loadEnvironmentProviders() {
-        for(EnvironmentProvider prov: ServiceContext.getInstance().getServices(EnvironmentProvider.class)){
-            providerMap.put(prov.getEnvironmentType(), prov);
-        }
-        String providerOrdering = MetaConfig.getOrDefault(ENVIRONMENT_ORDER_KEY, DEFAULT_ENVIRONMENT_ORDER);
-        String[] ids = providerOrdering.split(",");
         List<EnvironmentProvider> providerList = new ArrayList<>();
-        for(String id: ids) {
-            providerList.add(Optional.of(providerMap.get(id.trim())).get());
+        for(EnvironmentProvider prov: ServiceContext.getInstance().getServices(EnvironmentProvider.class)){
+            providerList.add(prov);
         }
         return providerList;
     }
 
     @Override
-    public Environment getEnvironment(){
+    public Environment getCurrentEnvironment(){
         Environment env = null;
+        EnvironmentBuilder b = EnvironmentBuilder.of();
         for(EnvironmentProvider prov: environmentProviders){
-            if(prov.isEnvironmentActive()){
-                env = prov.getEnvironment(env);
+            if(prov.isActive()){
+                if(prov.isActive()){
+                    b.setAll(prov.getEnvironmentData());
+                }
             }
         }
-        if(env==null){
-            throw new IllegalStateException("No current environment present.");
-        }
-        return env;
+        return b.build();
     }
 
     @Override
     public Environment getRootEnvironment(){
-        for(EnvironmentProvider prov: environmentProviders){
-            if(prov.isEnvironmentActive()){
-                return prov.getEnvironment(null);
-            }
-        }
-        throw new IllegalStateException("No root environment present.");
+        return rootEnvironment;
     }
 
-    @Override
-    public Optional<Environment> getEnvironment(String environmentType, String contextId) {
-        return null;
-    }
-
-    @Override
-    public Set<String> getEnvironmentContexts(String environmentType) {
-        return Optional.ofNullable(providerMap.get(environmentType))
-                .orElseThrow(() -> new IllegalArgumentException("No such environment type: " + environmentType))
-                .getEnvironmentContexts();
-    }
-
-    @Override
-    public List<String> getEnvironmentTypeOrder() {
-        return environmentProviders.stream().map(EnvironmentProvider::getEnvironmentType).collect(Collectors.toList());
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0b3b9639/core/src/main/java/org/apache/tamaya/core/internal/env/SystemClassLoaderEnvironmentProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/internal/env/SystemClassLoaderEnvironmentProvider.java b/core/src/main/java/org/apache/tamaya/core/internal/env/SystemClassLoaderEnvironmentProvider.java
index d455bce..b939017 100644
--- a/core/src/main/java/org/apache/tamaya/core/internal/env/SystemClassLoaderEnvironmentProvider.java
+++ b/core/src/main/java/org/apache/tamaya/core/internal/env/SystemClassLoaderEnvironmentProvider.java
@@ -18,10 +18,7 @@
  */
 package org.apache.tamaya.core.internal.env;
 
-import org.apache.tamaya.Environment;
-import org.apache.tamaya.Stage;
 import org.apache.tamaya.core.config.ConfigurationFormats;
-import org.apache.tamaya.core.env.EnvironmentBuilder;
 import org.apache.tamaya.core.resource.Resource;
 import org.apache.tamaya.spi.ServiceContext;
 import org.apache.tamaya.core.spi.ConfigurationFormat;
@@ -41,57 +38,37 @@ public class SystemClassLoaderEnvironmentProvider implements EnvironmentProvider
 
     private static  final Logger LOG = Logger.getLogger(SystemClassLoaderEnvironmentProvider.class.getName());
 
-    private Map<String,Environment> environments = new HashMap<>();
+    private Map<String,String> data = new HashMap<>();
 
-    @Override
-    public String getEnvironmentType() {
-        return "system";
-    }
-
-    @Override
-    public boolean isEnvironmentActive() {
-        return true;
-    }
 
-    @Override
-    public Environment getEnvironment(Environment parentEnvironment) {
-        Environment env = this.environments.get("system");
-        if(env!=null){
-            return env;
-        }
+    public SystemClassLoaderEnvironmentProvider(){
         List<Resource> propertyResources = ServiceContext.getInstance().getSingleton(ResourceLoader.class).getResources(ClassLoader.getSystemClassLoader(),
                 "classpath:META-INF/env/system.properties", "classpath:META-INF/env/system.xml", "classpath:META-INF/env/system.ini");
-        EnvironmentBuilder builder = EnvironmentBuilder.of("system", getEnvironmentType());
         for(Resource resource:propertyResources){
             try{
                 ConfigurationFormat format = ConfigurationFormats.getFormat(resource);
                 Map<String,String> data = format.readConfiguration(resource);
-                builder.setAll(data);
+                data.putAll(data);
             }
             catch(Exception e){
                 LOG.log(Level.INFO, e, () -> "Could not read environment data from " + resource);
             }
         }
-        builder.setParent(parentEnvironment);
-        String stageValue =  builder.getProperty(InitialEnvironmentProvider.STAGE_PROP);
-        Stage stage = InitialEnvironmentProvider.DEFAULT_STAGE;
-        if (stageValue != null) {
-            stage = Stage.valueOf(stageValue);
-        }
-        builder.setStage(stage);
-        builder.set("classloader.type", ClassLoader.getSystemClassLoader().getClass().getName());
-        builder.set("classloader.info", ClassLoader.getSystemClassLoader().toString());
+        data.put("classloader.type", ClassLoader.getSystemClassLoader().getClass().getName());
+        data.put("classloader.info", ClassLoader.getSystemClassLoader().toString());
         Set<Resource> resourceSet = new HashSet<>();
         resourceSet.addAll(propertyResources);
-        builder.set("environment.sources", resourceSet.toString());
-        env = builder.build();
-        this.environments.put("system", env);
-        return env;
+        data.put("environment.system.sources", resourceSet.toString());
+        this.data = Collections.unmodifiableMap(data);
+    }
+    @Override
+    public boolean isActive() {
+        return true;
     }
 
     @Override
-    public Set<String> getEnvironmentContexts() {
-        return this.environments.keySet();
+    public Map<String,String> getEnvironmentData() {
+        return data;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0b3b9639/core/src/main/java/org/apache/tamaya/core/properties/PropertySourceBuilder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/properties/PropertySourceBuilder.java b/core/src/main/java/org/apache/tamaya/core/properties/PropertySourceBuilder.java
index 3c96e84..392b298 100644
--- a/core/src/main/java/org/apache/tamaya/core/properties/PropertySourceBuilder.java
+++ b/core/src/main/java/org/apache/tamaya/core/properties/PropertySourceBuilder.java
@@ -180,7 +180,7 @@ public final class PropertySourceBuilder {
         String source = b.toString();
         MetaInfo mi = this.metaInfo;
         if (mi == null) {
-            mi = MetaInfoBuilder.of("aggregate").setEnvironment(Environment.current())
+            mi = MetaInfoBuilder.of("aggregate")
                     .set(MetaInfoBuilder.SOURCE,source).build();
         }
         this.current = PropertySourceFactory.aggregate(mi, this.aggregationPolicy, allProviders);
@@ -215,7 +215,7 @@ public final class PropertySourceBuilder {
         }
         MetaInfo mi = this.metaInfo;
         if (mi == null) {
-            mi = MetaInfoBuilder.of("args").setEnvironment(Environment.current()).build();
+            mi = MetaInfoBuilder.of("args").build();
         }
         PropertySource argProvider = PropertySourceFactory.fromArgs(mi, args);
         return addProviders(argProvider);
@@ -251,9 +251,9 @@ public final class PropertySourceBuilder {
         }
         MetaInfo mi = this.metaInfo;
         if (mi == null) {
-            mi = MetaInfoBuilder.of("aggregate").set("paths", paths.toString()).setEnvironment(Environment.current()).build();
+            mi = MetaInfoBuilder.of("aggregate").set("paths", paths.toString()).build();
         } else {
-            mi = MetaInfoBuilder.of(metaInfo).setEnvironment(Environment.current()).set("paths", paths.toString()).build();
+            mi = MetaInfoBuilder.of(metaInfo).set("paths", paths.toString()).build();
         }
         return addProviders(PropertySourceFactory.fromPaths(mi, aggregationPolicy, paths));
     }
@@ -285,9 +285,9 @@ public final class PropertySourceBuilder {
         }
         MetaInfo mi = this.metaInfo;
         if (mi == null) {
-            mi = MetaInfoBuilder.of("aggregate").set("urls", urls.toString()).setEnvironment(Environment.current()).build();
+            mi = MetaInfoBuilder.of("aggregate").set("urls", urls.toString()).build();
         } else {
-            mi = MetaInfoBuilder.of(metaInfo).setEnvironment(Environment.current()).set("urls", urls.toString()).build();
+            mi = MetaInfoBuilder.of(metaInfo).set("urls", urls.toString()).build();
         }
 
         return addProviders(PropertySourceFactory.fromURLs(mi, this.aggregationPolicy, urls));
@@ -307,9 +307,9 @@ public final class PropertySourceBuilder {
         }
         MetaInfo mi = this.metaInfo;
         if (mi == null) {
-            mi = MetaInfoBuilder.of("map").setEnvironment(Environment.current()).build();
+            mi = MetaInfoBuilder.of("map").build();
         } else {
-            mi = MetaInfoBuilder.of(metaInfo).setEnvironment(Environment.current()).build();
+            mi = MetaInfoBuilder.of(metaInfo).build();
         }
         return addProviders(PropertySourceFactory.fromMap(mi, map));
     }
@@ -323,9 +323,9 @@ public final class PropertySourceBuilder {
     public PropertySourceBuilder addEnvironmentProperties() {
         MetaInfo mi = this.metaInfo;
         if (mi == null) {
-            mi = MetaInfoBuilder.of("environment.properties").setEnvironment(Environment.current()).build();
+            mi = MetaInfoBuilder.of("environment.properties").build();
         } else {
-            mi = MetaInfoBuilder.of(metaInfo).setEnvironment(Environment.current()).build();
+            mi = MetaInfoBuilder.of(metaInfo).build();
         }
 
         return addProviders(PropertySourceFactory.fromEnvironmentProperties());
@@ -339,9 +339,9 @@ public final class PropertySourceBuilder {
     public PropertySourceBuilder addSystemProperties() {
         MetaInfo mi = this.metaInfo;
         if (mi == null) {
-            mi = MetaInfoBuilder.of("system.properties").setEnvironment(Environment.current()).build();
+            mi = MetaInfoBuilder.of("system.properties").build();
         } else {
-            mi = MetaInfoBuilder.of(metaInfo).setEnvironment(Environment.current()).build();
+            mi = MetaInfoBuilder.of(metaInfo).build();
         }
 
         return addProviders(PropertySourceFactory.fromSystemProperties());
@@ -360,9 +360,9 @@ public final class PropertySourceBuilder {
         }
         MetaInfo mi = this.metaInfo;
         if (mi == null) {
-            mi = MetaInfoBuilder.of("aggregate").setEnvironment(Environment.current()).build();
+            mi = MetaInfoBuilder.of("aggregate").build();
         } else {
-            mi = MetaInfoBuilder.of(metaInfo).setEnvironment(Environment.current()).build();
+            mi = MetaInfoBuilder.of(metaInfo).build();
         }
 
         return addProviders(PropertySourceFactory.aggregate(mi, aggregationPolicy, Arrays.asList(providers)));
@@ -382,9 +382,9 @@ public final class PropertySourceBuilder {
         }
         MetaInfo mi = this.metaInfo;
         if (mi == null) {
-            mi = MetaInfoBuilder.of("aggregate").setEnvironment(Environment.current()).build();
+            mi = MetaInfoBuilder.of("aggregate").build();
         } else {
-            mi = MetaInfoBuilder.of(metaInfo).setEnvironment(Environment.current()).build();
+            mi = MetaInfoBuilder.of(metaInfo).build();
         }
 
         return addProviders(PropertySourceFactory.aggregate(mi, aggregationPolicy, providers));
@@ -415,9 +415,9 @@ public final class PropertySourceBuilder {
         }
         MetaInfo mi = this.metaInfo;
         if (mi == null) {
-            mi = MetaInfoBuilder.of("intersect").setEnvironment(Environment.current()).build();
+            mi = MetaInfoBuilder.of("intersect").build();
         } else {
-            mi = MetaInfoBuilder.of(metaInfo).setEnvironment(Environment.current()).build();
+            mi = MetaInfoBuilder.of(metaInfo).build();
         }
 
         return addProviders(PropertySourceFactory.intersected(mi, aggregationPolicy, Arrays.asList(providers)));
@@ -436,9 +436,9 @@ public final class PropertySourceBuilder {
         }
         MetaInfo mi = this.metaInfo;
         if (mi == null) {
-            mi = MetaInfoBuilder.of("subtract").setEnvironment(Environment.current()).build();
+            mi = MetaInfoBuilder.of("subtract").build();
         } else {
-            mi = MetaInfoBuilder.of(metaInfo).setEnvironment(Environment.current()).build();
+            mi = MetaInfoBuilder.of(metaInfo).build();
         }
         current = PropertySourceFactory.subtracted(mi, current, Arrays.asList(providers));
         return this;
@@ -454,9 +454,9 @@ public final class PropertySourceBuilder {
     public PropertySourceBuilder filter(Predicate<String> filter) {
         MetaInfo mi = this.metaInfo;
         if (mi == null) {
-            mi = MetaInfoBuilder.of("filtered").setEnvironment(Environment.current()).set("filter", filter.toString()).build();
+            mi = MetaInfoBuilder.of("filtered").set("filter", filter.toString()).build();
         } else {
-            mi = MetaInfoBuilder.of(metaInfo).set("filter", filter.toString()).setEnvironment(Environment.current()).build();
+            mi = MetaInfoBuilder.of(metaInfo).set("filter", filter.toString()).build();
         }
         current = PropertySourceFactory.filtered(mi, filter, current);
         addProviderChainInfo("filter->" + filter.toString());
@@ -475,9 +475,9 @@ public final class PropertySourceBuilder {
                                                  Supplier<String> isolationKeySupplier) {
         MetaInfo mi = this.metaInfo;
         if (mi == null) {
-            mi = MetaInfoBuilder.of("contextual").setEnvironment(Environment.current()).set("mapSupplier", mapSupplier.toString()).set("isolationKeySupplier", isolationKeySupplier.toString()).build();
+            mi = MetaInfoBuilder.of("contextual").set("mapSupplier", mapSupplier.toString()).set("isolationKeySupplier", isolationKeySupplier.toString()).build();
         } else {
-            mi = MetaInfoBuilder.of(metaInfo).set("mapSupplier", mapSupplier.toString()).set("isolationKeySupplier", isolationKeySupplier.toString()).setEnvironment(Environment.current()).build();
+            mi = MetaInfoBuilder.of(metaInfo).set("mapSupplier", mapSupplier.toString()).set("isolationKeySupplier", isolationKeySupplier.toString()).build();
         }
 
         return addProviders(PropertySourceFactory.contextual(mi, mapSupplier, isolationKeySupplier));
@@ -492,9 +492,9 @@ public final class PropertySourceBuilder {
     public PropertySourceBuilder replace(Map<String, String> replacementMap) {
         MetaInfo mi = this.metaInfo;
         if (mi == null) {
-            mi = MetaInfoBuilder.of("replace").setEnvironment(Environment.current()).build();
+            mi = MetaInfoBuilder.of("replace").build();
         } else {
-            mi = MetaInfoBuilder.of(metaInfo).setEnvironment(Environment.current()).build();
+            mi = MetaInfoBuilder.of(metaInfo).build();
         }
         current = PropertySourceFactory.replacing(mi, current, replacementMap);
         this.metaInfo = null;
@@ -536,9 +536,9 @@ public final class PropertySourceBuilder {
     public PropertySource buildFreezed() {
         MetaInfo mi = this.metaInfo;
         if (mi == null) {
-            mi = MetaInfoBuilder.of("freezed").set("freezed", "true").setEnvironment(Environment.current()).build();
+            mi = MetaInfoBuilder.of("freezed").set("freezed", "true").build();
         } else {
-            mi = MetaInfoBuilder.of(metaInfo).set("freezed", "true").setEnvironment(Environment.current()).build();
+            mi = MetaInfoBuilder.of(metaInfo).set("freezed", "true").build();
         }
 
         PropertySource prov = PropertySourceFactory.freezed(mi, current);

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0b3b9639/core/src/main/java/org/apache/tamaya/core/spi/EnvironmentProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/spi/EnvironmentProvider.java b/core/src/main/java/org/apache/tamaya/core/spi/EnvironmentProvider.java
index 0d42b8b..15b9f5b 100644
--- a/core/src/main/java/org/apache/tamaya/core/spi/EnvironmentProvider.java
+++ b/core/src/main/java/org/apache/tamaya/core/spi/EnvironmentProvider.java
@@ -20,6 +20,7 @@ package org.apache.tamaya.core.spi;
 
 import org.apache.tamaya.Environment;
 
+import java.util.Map;
 import java.util.Set;
 
 /**
@@ -31,31 +32,16 @@ import java.util.Set;
 public interface EnvironmentProvider {
 
     /**
-     * Get the environment type this provider is responsible for.
-     * @return the environment.
-     */
-    String getEnvironmentType();
-
-    /**
      * Evaluates if an environment is currently active.
      * @return
      */
-    boolean isEnvironmentActive();
+    boolean isActive();
 
     /**
-     * Access (or of) a new environment for the given context.
-     * @param parentEnvironment the parent environment to b e set
-     * @return the environment, or null.
+     * Returns the properties to be added to the environment.
+     * @return the properties, or an empty map if no properties are to be added (or the provider is not active for the
+     * current runtime state).
      */
-    Environment getEnvironment(Environment parentEnvironment);
+    Map<String,String> getEnvironmentData();
 
-    /**
-     * Get all currently known environment contexts for this environment type.
-     * @return all currently known environment contexts, never null. Environment
-     * config may prevent abritrary access to environment fromMap outside current the
-     * regarding runtime context by just not including the context information
-     * in this call's result.
-     * @return all currently known environment contexts, never null.
-     */
-    Set<String> getEnvironmentContexts();
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0b3b9639/core/src/test/java/org/apache/tamaya/DefaultConfigurationManagerSingletonSpiSingletonSpiTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/DefaultConfigurationManagerSingletonSpiSingletonSpiTest.java b/core/src/test/java/org/apache/tamaya/DefaultConfigurationManagerSingletonSpiSingletonSpiTest.java
index f8d4294..7596a1f 100644
--- a/core/src/test/java/org/apache/tamaya/DefaultConfigurationManagerSingletonSpiSingletonSpiTest.java
+++ b/core/src/test/java/org/apache/tamaya/DefaultConfigurationManagerSingletonSpiSingletonSpiTest.java
@@ -78,7 +78,7 @@ public class DefaultConfigurationManagerSingletonSpiSingletonSpiTest {
     @Test
     public void testGetRootEnvironment() {
         DefaultConfigurationManagerSingletonSpi s = new DefaultConfigurationManagerSingletonSpi();
-        Environment env = Environment.getRootEnvironment();
+        Environment env = Environment.root();
         assertNotNull(env);
         assertEquals(System.getProperty("java.version"),
                 env.get("java.version").get());

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0b3b9639/core/src/test/java/org/apache/tamaya/core/config/EnvironmentManagerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/core/config/EnvironmentManagerTest.java b/core/src/test/java/org/apache/tamaya/core/config/EnvironmentManagerTest.java
index 5dfebc2..d7ae7a4 100644
--- a/core/src/test/java/org/apache/tamaya/core/config/EnvironmentManagerTest.java
+++ b/core/src/test/java/org/apache/tamaya/core/config/EnvironmentManagerTest.java
@@ -34,7 +34,7 @@ public class EnvironmentManagerTest{
 
     @Test
     public void testRootEnvironmentNotNull(){
-        Assert.assertNotNull(Environment.getRootEnvironment());
+        Assert.assertNotNull(Environment.root());
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0b3b9639/core/src/test/java/org/apache/tamaya/core/env/EnvironmentManagerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/core/env/EnvironmentManagerTest.java b/core/src/test/java/org/apache/tamaya/core/env/EnvironmentManagerTest.java
index 7f5004a..3a6b033 100644
--- a/core/src/test/java/org/apache/tamaya/core/env/EnvironmentManagerTest.java
+++ b/core/src/test/java/org/apache/tamaya/core/env/EnvironmentManagerTest.java
@@ -21,7 +21,6 @@ package org.apache.tamaya.core.env;
 import org.apache.tamaya.Environment;
 import org.junit.Test;
 
-import java.util.List;
 
 import static org.junit.Assert.*;
 
@@ -37,68 +36,31 @@ public class EnvironmentManagerTest {
         assertNotNull(env);
         Environment env2 = Environment.current();
         assertNotNull(env2);
-        assertTrue("Current Environments requested in same context are not the same!", env==env2);
+        assertFalse("Current Environments requested in same context are not the same!", env==env2);
     }
 
     @Test
     public void testGetRootEnvironment(){
-        Environment env = Environment.getRootEnvironment();
+        Environment env = Environment.root();
         assertNotNull(env);
-        Environment env2 = Environment.getRootEnvironment();
+        Environment env2 = Environment.root();
         assertNotNull(env2);
         assertTrue("Root Environments requested in same context are not the same!", env==env2);
     }
 
     @Test
     public void testRootIsNotCurrentEnvironment(){
-        Environment env1 = Environment.getRootEnvironment();
+        Environment env1 = Environment.root();
         Environment env2 = Environment.current();
         assertNotNull(env1);
         assertNotNull(env2);
-        assertNotSame(env1, env2);
-    }
-
-    @Test
-    public void testEnvironmentTypeOrder(){
-        List<String> envOrder = Environment.getEnvironmentTypeOrder();
-        assertNotNull(envOrder);
-        assertTrue(envOrder.size()>0);
-        assertTrue(envOrder.contains("root"));
-        assertTrue(envOrder.contains("system"));
-        assertTrue(envOrder.contains("ear"));
-        assertTrue(envOrder.contains("application"));
-        assertTrue(envOrder.get(0).equals("root"));
-    }
-
-    @Test
-    public void testEnvironmentHierarchy(){
-        List<String> envOrder = Environment.getEnvironmentHierarchy();
-        assertNotNull(envOrder);
-        assertTrue(envOrder.size()>0);
-        assertTrue(envOrder.contains("root(root)"));
-        assertTrue(envOrder.contains("system(system)"));
-        assertTrue(envOrder.get(1).contains("(ear)"));
-        assertTrue(envOrder.get(0).contains("(application)"));
-        assertTrue(envOrder.get(2).equals("system(system)"));
-        assertTrue(envOrder.get(3).equals("root(root)"));
-    }
-
-    @Test
-    public void testEnvironmentId(){
-        String envId = Environment.current().getEnvironmentId();
-        assertNotNull(envId);
-        assertEquals(envId, "MyApp1");
-        envId = Environment.current().getParentEnvironment().getEnvironmentId();
-        assertEquals(envId, "myEar1");
-        envId = Environment.current().getParentEnvironment().getParentEnvironment().getEnvironmentId();
-        assertEquals(envId, "system");
-        envId = Environment.getRootEnvironment().getEnvironmentId();
-        assertEquals(envId, "root");
+        // within this test environment these are always the same
+        assertEquals(env1, env2);
     }
 
     @Test
     public void testEnvironmentOverride(){
-        assertEquals(Environment.getRootEnvironment().get("user.country").get(),System.getProperty("user.country"));
+        assertEquals(Environment.root().get("user.country").get(),System.getProperty("user.country"));
         assertEquals(Environment.current().get("user.country").get(), System.getProperty("user.country"));
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0b3b9639/core/src/test/java/org/apache/tamaya/internal/TestEnvironmentProvider.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/internal/TestEnvironmentProvider.java b/core/src/test/java/org/apache/tamaya/internal/TestEnvironmentProvider.java
new file mode 100644
index 0000000..d1a6c3d
--- /dev/null
+++ b/core/src/test/java/org/apache/tamaya/internal/TestEnvironmentProvider.java
@@ -0,0 +1,48 @@
+/*
+ * 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.internal;
+
+import org.apache.tamaya.core.spi.EnvironmentProvider;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Environment provider used by some tests.
+ */
+public class TestEnvironmentProvider implements EnvironmentProvider {
+    private Map<String, String> data = new HashMap<>();
+
+    public TestEnvironmentProvider(){
+        data.put("user.country", System.getProperty("user.country"));
+        data.put("java.version", System.getProperty("java.version"));
+        data = Collections.unmodifiableMap(data);
+    }
+
+    @Override
+    public boolean isActive() {
+        return true;
+    }
+
+    @Override
+    public Map<String, String> getEnvironmentData() {
+        return data;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0b3b9639/core/src/test/resources/META-INF/services/org.apache.tamaya.core.spi.EnvironmentProvider
----------------------------------------------------------------------
diff --git a/core/src/test/resources/META-INF/services/org.apache.tamaya.core.spi.EnvironmentProvider b/core/src/test/resources/META-INF/services/org.apache.tamaya.core.spi.EnvironmentProvider
new file mode 100644
index 0000000..d35127f
--- /dev/null
+++ b/core/src/test/resources/META-INF/services/org.apache.tamaya.core.spi.EnvironmentProvider
@@ -0,0 +1,19 @@
+#
+# 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.internal.TestEnvironmentProvider
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0b3b9639/docs/pom.xml
----------------------------------------------------------------------
diff --git a/docs/pom.xml b/docs/pom.xml
index b4f80b8..965ff76 100644
--- a/docs/pom.xml
+++ b/docs/pom.xml
@@ -29,9 +29,8 @@ under the License.
 
     <artifactId>tamaya-docs</artifactId>
     <name>Apache Tamaya - Documentation</name>
-    <description>The API defines a complete SE based API for reading, creating an dmanaging of configuration and
-        environment data. This module contains the umrella documentations like
-        design and user guides.
+    <description>The Documentation projects keeps together the documentation files in asciidic and other formats
+        for the Apache Tamaya project.
     </description>
     <packaging>jar</packaging>
 


Mime
View raw message