You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by an...@apache.org on 2016/11/13 22:28:11 UTC

[5/6] incubator-tamaya-sandbox git commit: TAMAYA-145: Further progress and preparation work. Factored out unrelated concerns into separate modules.

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/9f71f2d8/metamodel/src/main/java/org/apache/tamaya/metamodel/dsl/WrappedPropertySource.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/dsl/WrappedPropertySource.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/dsl/WrappedPropertySource.java
index 7aed843..000406b 100644
--- a/metamodel/src/main/java/org/apache/tamaya/metamodel/dsl/WrappedPropertySource.java
+++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/dsl/WrappedPropertySource.java
@@ -18,9 +18,12 @@
  */
 package org.apache.tamaya.metamodel.dsl;
 
+import org.apache.tamaya.spi.FilterContext;
+import org.apache.tamaya.spi.PropertyFilter;
 import org.apache.tamaya.spi.PropertySource;
 import org.apache.tamaya.spi.PropertyValue;
 
+import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 
@@ -33,6 +36,7 @@ final class WrappedPropertySource implements PropertySource {
 
     private Integer ordinalAssigned;
     private PropertySource wrapped;
+    private List<PropertyFilter> filters;
 
     private WrappedPropertySource(PropertySource wrapped){
         this.wrapped = Objects.requireNonNull(wrapped);
@@ -77,12 +81,35 @@ final class WrappedPropertySource implements PropertySource {
 
     @Override
     public PropertyValue get(String key) {
-        return wrapped.get(key);
+        PropertyValue value = wrapped.get(key);
+        if(value != null && value.getValue()!=null){
+            if(filters!=null){
+                String filteredValue = value.getValue();
+                for(PropertyFilter pf:filters){
+                    filteredValue = pf.filterProperty(filteredValue, new FilterContext(key, value.getConfigEntries(), true));
+                }
+                if(filteredValue!=null){
+                    return PropertyValue.builder(key, filteredValue, getName())
+                            .setContextData(value.getConfigEntries()).build();
+                }
+            }
+        }
+        return value;
     }
 
     @Override
     public Map<String, String> getProperties() {
-        return wrapped.getProperties();
+        Map<String, String> props = wrapped.getProperties();
+        if(filters!=null){
+            String filteredValue = value.getValue();
+            for(PropertyFilter pf:filters){
+                filteredValue = pf.filterProperty(filteredValue, new FilterContext(key, value.getConfigEntries(), true));
+            }
+            if(filteredValue!=null){
+                return PropertyValue.builder(key, filteredValue, getName())
+                        .setContextData(value.getConfigEntries()).build();
+            }
+        }
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/9f71f2d8/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/FactoryManager.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/FactoryManager.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/FactoryManager.java
index dbf8d1f..a8129f6 100644
--- a/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/FactoryManager.java
+++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/FactoryManager.java
@@ -101,7 +101,7 @@ final class FactoryManager {
         }
 
         @Override
-        public PropertySource create(String config, Map<String, String> extendedConfig) {
+        public PropertySource create(Map<String, String> config) {
             try {
                 return this.type.newInstance();
             } catch (Exception e) {
@@ -124,7 +124,7 @@ final class FactoryManager {
         }
 
         @Override
-        public PropertySourceProvider create(String config, Map<String, String> extendedConfig) {
+        public PropertySourceProvider create(Map<String, String> config) {
             try {
                 return this.type.newInstance();
             } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/9f71f2d8/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/BaseStagedPropertySourceProvider.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/BaseStagedPropertySourceProvider.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/BaseStagedPropertySourceProvider.java
deleted file mode 100644
index bba2ec4..0000000
--- a/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/BaseStagedPropertySourceProvider.java
+++ /dev/null
@@ -1,121 +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.metamodel.spi;
-//
-//
-//import org.apache.tamaya.ConfigException;
-//import org.apache.tamaya.spi.PropertySource;
-//import org.apache.tamaya.spi.PropertySourceProvider;
-//
-//import java.util.ArrayList;
-//import java.util.Arrays;
-//import java.util.Collection;
-//import java.util.List;
-//import java.util.logging.Logger;
-//
-///**
-// * Implements a base property source provider that defines a multilayered
-// * stage setup.
-// */
-//public abstract class BaseStagedPropertySourceProvider implements PropertySourceProvider {
-//
-//    /** The logger used. */
-//    private static final Logger LOGGER = Logger.getLogger(BaseStagedPropertySourceProvider.class.getName());
-//
-//    /** the current environment stages in order of precedence (weakest first). */
-//    private List<String> contextIds = new ArrayList<>();
-//
-//    /** Optional root context of the environment in the config tree. All entries loaded will be mapped into
-//     * this root conztext.
-//     */
-//    private String rootContext;
-//
-//    /** List of PropertySources evaluated and returned to the current ConfigurationContext on load. */
-//    private List<PropertySource> propertySources = new ArrayList<>();
-//
-//
-//    /**
-//     * Creates a new Environment provider, hereby using 10 for basePriority and priorityIncrease.
-//     * @param rootContext the environment target root context, e.g. ENV. or null
-//     *                               for not remapping the environment properties.
-//     * @param contextIds the context ids, that build up the environment.
-//     */
-//    public BaseStagedPropertySourceProvider(String rootContext,
-//                                            String... contextIds) {
-//        this(rootContext, 10,10, contextIds);
-//    }
-//        /**
-//         * Creates a new Environment provider.
-//         * @param rootContext the environment target root context, e.g. ENV. or null
-//         *                               for not remapping the environment properties.
-//         * @param basePriority the base priority used for the weakest environment properties set.
-//         * @param priorityIncrease the value the property source's priority should be increased with each
-//         *                         environment context level added.
-//         * @param contextIds the context ids, that build up the environment.
-//         */
-//    public BaseStagedPropertySourceProvider(String rootContext, int basePriority, int priorityIncrease,
-//                                            String... contextIds) {
-//        if (contextIds.length == 0) {
-//            throw new ConfigException("At least one environment context id must be defined.");
-//        }
-//        if (rootContext == null) {
-//            LOGGER.finest("No environment mapping is applied.");
-//        }
-//        this.rootContext = rootContext;
-//        this.contextIds.addAll(Arrays.asList(contextIds));
-//        int priority = basePriority;
-//        for (String contextId : contextIds) {
-//            propertySources.addAll(loadStageProperties(rootContext, contextId, priority));
-//            priority += priorityIncrease;
-//        }
-//    }
-//
-//    /**
-//     * Method that loads the environment properties for the given contextId.
-//     * @param rootContext the root context, where entries read should be mapped to.
-//     * @param contextId the contextId.
-//     * @param priority  the target priority the created PropertySource should have. This priority is
-//     *                  important, since it reflects the order as defined
-//     *                  when configuring this class. Therefore it should not be overridden normally.
-//     * @return the corresponding PrioritySources to be added, never null.
-//     */
-//    protected abstract Collection<PropertySource> loadStageProperties(
-//            String rootContext, String contextId, int priority);
-//
-//    /**
-//     * Get the environment context ids that define how this environment configuration
-//     * is setup, in order of their increasing priority.
-//     * @return the ordered list of context ids.
-//     */
-//    public List<String> getContextIds() {
-//        return contextIds;
-//    }
-//
-//    @Override
-//    public String toString() {
-//        return "EnvironmentPropertySourceProvider{" +
-//                "contextIds=" + contextIds +
-//                ", rootContext='" + rootContext + '\'' +
-//                '}';
-//    }
-//
-//    @Override
-//    public Collection<PropertySource> getPropertySources() {
-//        return propertySources;
-//    }
-//
-//}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/9f71f2d8/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/DSLPropertySourceProvider.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/DSLPropertySourceProvider.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/DSLPropertySourceProvider.java
deleted file mode 100644
index ea4e653..0000000
--- a/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/DSLPropertySourceProvider.java
+++ /dev/null
@@ -1,51 +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.metamodel.spi;
-
-import org.apache.tamaya.spi.PropertySource;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Resolver to resolve/map DSL related source expressions into PropertySources
- * loadable by a ConfigurationContext. Hereby the ordering of loaded property sources must be
- * honored if possible by implicitly adapting/Overriding the default ordinal for the sources
- * added.
- */
-public interface DSLPropertySourceProvider {
-
-    /**
-     * Resolve the given expression (without the key part).
-     * @param sourceExpression the source expression, not null.
-     * @param defaultPropertySources the default property sources that can be used as defined by the functionality by
-     *                               a resolver.
-     * @return the list of loaded Property sources, never null.
-     */
-    List<PropertySource> resolve(String sourceExpression,
-                                 Map<String, PropertySource> defaultPropertySources);
-
-    /**
-     * Get the resolver key, which identifiesan expression to be resolved by a resolver instance.
-     * As an example {@code "named:"} is the key for an expression {@code "named:sys-properties"}.
-     * The method {@link #resolve(String, Map)} will onyl receive the secoind part of the expression.
-     * @return identifying key.
-     */
-    String getKey();
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/9f71f2d8/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/MetaConfigurationReader.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/MetaConfigurationReader.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/MetaConfigurationReader.java
new file mode 100644
index 0000000..c9718a9
--- /dev/null
+++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/MetaConfigurationReader.java
@@ -0,0 +1,41 @@
+/*
+ * 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.spi;
+
+import org.apache.tamaya.metamodel.Context;
+import org.apache.tamaya.spi.ConfigurationContextBuilder;
+import org.w3c.dom.Document;
+
+import java.net.URL;
+
+/**
+ * Created by atsticks on 03.11.16.
+ */
+public interface MetaConfigurationReader {
+
+    /**
+     * Reads meta-configuration from the given document and configures the current
+     * context builder. The priority of readers is determined by the priorization policy
+     * implemented by the {@link org.apache.tamaya.spi.ServiceContext},
+     * @param document the meta-configuration document
+     * @param contextBuilder the context builder to use.
+     */
+    void read(Document document, Context context, ConfigurationContextBuilder contextBuilder);
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/9f71f2d8/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/PropertySourceFactory.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/PropertySourceFactory.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/PropertySourceFactory.java
index 49f72f2..7da2e58 100644
--- a/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/PropertySourceFactory.java
+++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/PropertySourceFactory.java
@@ -33,12 +33,11 @@ public interface PropertySourceFactory {
 
     /**
      * Resolve the given expression (without the key part).
-     * @param config the source configuration text, or null.
-     * @param extendedConfig any further extended configuration, not null, but may be
+     * @param config any further extended configuration, not null, but may be
      *                       empty.
      * @return the property source, or null.
      */
-    PropertySource create(String config, Map<String, String> extendedConfig);
+    PropertySource create(Map<String, String> config);
 
     /**
      * Get the property source type. The type is used to identify the correct factory instance

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/9f71f2d8/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/PropertySourceProviderFactory.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/PropertySourceProviderFactory.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/PropertySourceProviderFactory.java
index 717f075..41ea3a5 100644
--- a/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/PropertySourceProviderFactory.java
+++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/PropertySourceProviderFactory.java
@@ -34,12 +34,11 @@ public interface PropertySourceProviderFactory {
 
     /**
      * Resolve the given expression (without the key part).
-     * @param config the source configuration text, or null.
-     * @param extendedConfig any further extended configuration, not null, but may be
+     * @param config any further extended configuration, not null, but may be
      *                       empty.
      * @return the property source, or null.
      */
-    PropertySourceProvider create(String config, Map<String, String> extendedConfig);
+    PropertySourceProvider create(Map<String, String> config);
 
     /**
      * Get the property source type. The type is used to identify the correct factory instance

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/9f71f2d8/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/StagedConfigPropertiesProvider.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/StagedConfigPropertiesProvider.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/StagedConfigPropertiesProvider.java
deleted file mode 100644
index 39c27d3..0000000
--- a/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/StagedConfigPropertiesProvider.java
+++ /dev/null
@@ -1,137 +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.metamodel.spi;
-//
-//
-//import org.apache.tamaya.spisupport.MapPropertySource;
-//import org.apache.tamaya.spisupport.PropertiesResourcePropertySource;
-//import org.apache.tamaya.resource.ConfigResources;
-//import org.apache.tamaya.spi.PropertySource;
-//
-//import java.net.URL;
-//import java.util.ArrayList;
-//import java.util.Collection;
-//import java.util.List;
-//import java.util.logging.Logger;
-//
-///**
-// * Configuration provider that resolves to a location in the classpath.
-// * Hereby the following system properties can be set to configure the provider
-// * (all entries are optional):
-// * <pre>
-// *     env.STAGE   :   ordered list of configs to be loaded, e.g. sys-env,GLOBAL,TEST,DEV
-// * </pre>
-// * Adding {@code sys-env} as stage maps the current environment properties using
-// * the priority to be aliged with the context ordering, defined by {@code env.STAGE}.
-// * Similarly the same thing can be done by passing {@code sys-props} as context id for
-// * adding the current System properties to the configuration tree.
-// *
-// * The rootContext can be used to remap the whole property space to an alternate subtree in
-// * the configuration tree overall. This is very handy, if multiple instances of this class
-// * are registered into the same configuration, but with different location setups. Remapping
-// * configuration allows to separate these entries clearly.<br/>
-// * Finally the resource location can be adapted by overriding {@link #getBaseResourcePath()}.
-// * Different formats and loading mechanisms can be implemented by overriding
-// * {@link #loadProperties(String, String, int, List)}.
-// */
-//public class StagedConfigPropertiesProvider extends BaseStagedPropertySourceProvider {
-//
-//    /** The system property to define the stages used. */
-//    private static final String STAGE_PROP = "env.STAGE";
-//    /** The logger used. */
-//
-//    private static final Logger LOGGER = Logger.getLogger(StagedConfigPropertiesProvider.class.getName());
-//
-//    /** The context id for adding the system's environment properties. */
-//    private static final String DEFAULT_ENV = "sys-env";
-//
-//    /** The context id for adding the system's properties. */
-//    private static final String DEFAULT_SYSPROPS = "sys-props";
-//
-//    /**
-//     * Creates a new instance.
-//     * @param rootContext the (optional) root context, can be null.
-//     * @param stages the comma separated list of stages.
-//     */
-//    public StagedConfigPropertiesProvider(String rootContext, String... stages){
-//        super(rootContext, evaluateStages(stages));
-//    }
-//
-//    /**
-//     * Creates a default instance. the stages are read from the {@code env.STAGE} system�propertx
-//     * or a default is applied.
-//     */
-//    public StagedConfigPropertiesProvider(){
-//        super(null, evaluateStages(null));
-//    }
-//
-//    /**
-//     * Evaluates the stages or returns the default STAGE entry.
-//     * @return the stages to be used, never null.
-//     */
-//    private static String[] evaluateStages(String[] stages) {
-//        if(stages!=null && stages.length>0){
-//            return stages.clone();
-//        }
-//        String value = System.getProperty(STAGE_PROP);
-//        if(value==null) {
-//            value = System.getenv(STAGE_PROP);
-//        }
-//        if(value==null){
-//            value = "sys-env,GLOBAL,DEVELOPMENT,sys-props";
-//        }
-//        return value.split(",");
-//    }
-//
-//    @Override
-//    protected Collection<PropertySource> loadStageProperties(
-//            String rootContext, String contextId, int priority) {
-//        List<PropertySource> result = new ArrayList<>();
-//        if (DEFAULT_ENV.equals(contextId)){
-//            result.add(new MapPropertySource(DEFAULT_ENV, System.getenv(),
-//                    rootContext, priority));
-//        }else if (DEFAULT_SYSPROPS.equals(contextId)){
-//            result.add(new MapPropertySource(DEFAULT_SYSPROPS, System.getProperties(),
-//                    rootContext, priority));
-//        }
-//        else{
-//            loadProperties(rootContext, contextId, priority, result);
-//        }
-//        return result;
-//    }
-//
-//    private void loadProperties(String rootContext, String contextId, int priority,
-//                                List<PropertySource> result) {
-//        String cpExp = getBaseResourcePath()+'/' +contextId+".properties";
-//        if(cpExp.startsWith("/")){
-//            cpExp = cpExp.substring(1);
-//        }
-//        for(URL url: ConfigResources.getResourceResolver().getResources(cpExp)){
-//            result.add(new PropertiesResourcePropertySource(rootContext, url, priority));
-//        }
-//    }
-//
-//    /**
-//     * Get the basic resource path used for lookup of properties files.
-//     * @return the basic resource path, never null.
-//     */
-//    protected String getBaseResourcePath() {
-//        return "";
-//    }
-//
-//
-//}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/9f71f2d8/metamodel/src/test/resources/tamaya-TEST.yaml
----------------------------------------------------------------------
diff --git a/metamodel/src/test/resources/tamaya-TEST.yaml b/metamodel/src/test/resources/tamaya-TEST.yaml
deleted file mode 100644
index 3e56656..0000000
--- a/metamodel/src/test/resources/tamaya-TEST.yaml
+++ /dev/null
@@ -1,27 +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.
-#
-tamaya-configuration:
-  includes:
-    tamaya-DEFAULT.yaml
-
-  property-sources:
-    - class: org.apache.tamaya.resources.ResourceProvider
-        resource: classpath:META-INF/config/test/**/*.*"
-    - class: org.apache.tamaya.resources.ResourceProvider
-        resource: classpath://META-INF/config/test/**/*.*"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/9f71f2d8/metamodel/src/test/resources/tamaya-config.json
----------------------------------------------------------------------
diff --git a/metamodel/src/test/resources/tamaya-config.json b/metamodel/src/test/resources/tamaya-config.json
deleted file mode 100644
index b926c25..0000000
--- a/metamodel/src/test/resources/tamaya-config.json
+++ /dev/null
@@ -1,39 +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.
-//
-{
-  "context": {
-    "stage":      "DEV"
-  },
-  "config-sources":{
-    "env-properties": {
-      "enabled":  "${stage=TEST || stage=PTA || stage=PROD}",
-      "ordinal":  200
-    },
-    "sys-properties": {},
-    "file":       "./config.json",
-    "resource": {
-      "path":     "/META-INF/application-config.yml",
-      "multiple": true
-    },
-    "include":{
-      "path":     "TEST.properties",
-      "enabled":  "${context.cstage==TEST}"
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/9f71f2d8/metamodel/src/test/resources/tamaya-config.xml
----------------------------------------------------------------------
diff --git a/metamodel/src/test/resources/tamaya-config.xml b/metamodel/src/test/resources/tamaya-config.xml
index ee36e0e..1d25beb 100644
--- a/metamodel/src/test/resources/tamaya-config.xml
+++ b/metamodel/src/test/resources/tamaya-config.xml
@@ -17,46 +17,59 @@
 // under the License.
 // -->
 <configuration>
-    <formats>
-        <format name="yaml"/>
-        <format name="json"/>
-    </formats>
-    <!--<converters>-->
-    <!--<converter type="AllInOneConverter"/>-->
-    <!--</converters>-->
-    <filters>
-        <filter type="UsageTrackerFilter"/>
-    </filters>
-
+    <!-- Context is evaluated first. -->
     <context>
         <context-entry name="stage">${properties:system:STAGE?default=DEV}</context-entry>
         <context-entry name="app">${properties:system.APP?default=NONE}</context-entry>
         <context-entry name="context">${java:org.apache.tamaya.context.Context#id()}</context-entry>
         <context-entry name="company">Trivadis</context-entry>
+        <context-entry name="default-formats">yaml,json</context-entry>
     </context>
 
-    <sources>
+    <!-- Configuration definition. -->
+
+    <config-sources>
        <source enabled="${stage=TEST || stage=PTA || stage=PROD}"
            uri="properties:environment">
-           <decorator name="maped-to">ENV.</decorator>
-           <decorator name="secured">
+           <filter type="mapping">ENV.</filter>
+           <filter type="access-control">
                <param name="roles">admin,power-user</param>
                <param name="policy">mask</param>
-           </decorator>
+           </filter>
        </source>
        <source uri="properties:system"/>
-       <source name="FILE:config.json" observe="true" observe-period="20000"
-               uri="file:/./config.json" />
-       <source name="CP:config.yml" uri="classpath*://META-INF/application-config.yml"/>
-       <source name="MINE" uri="propertysource:ch.mypack.MyClassSource">
+       <source name="FILE:config.json" refresh-period="5000"
+               uri="file:/./config.json" >
+           <param name="observe-period">20000</param>
+           <param name="formats">json</param>
+       </source>
+       <source-provider name="classpath:application-config.yml" uri="classpath*://META-INF/application-config.yml">
+           <param name="formats">yaml</param>
+       </source-provider>
+       <source name="MINE" uri="class:ch.mypack.MyClassSource">
            <param name="locale">de</param>
         </source>
-       <include enabled="${context.cstage==TEST}">TEST-config.xml</include>
-       <source name="CONFIG-DIR" uri="dir:/${CONFIG-DIR}/**/*.json"/>
-        <source name="SERVER" uri="https://www.confdrive.com/cfg/customerId=${}">
-            <param name="locale">de</param>
-        </source>
-    </sources>
+       <include enabled="${stage==TEST}">TEST-config.xml</include>
+       <source-provider name="CONFIG-DIR" uri="resource:/${CONFIG-DIR}/**/*.json"/>
+       <source name="SERVER" uri="https://www.confdrive.com/cfg/customerId=${}">
+           <param name="locale">de</param>
+       </source>
+    </config-sources>
+    <config-filters>
+        <filter type="UsageTrackerFilter"/>
+        <filter type="access-control">
+            <param name="roles">admin,power-user</param>
+            <param name="policy">hide</param>
+            <param name="expression">*.secret</param>
+        </filter>
+        <filter type="Cache">
+            <param name="ttl">30000</param>
+            <param name="expression">cached.*</param>
+        </filter>
+    </config-filters>
+    <!--<converters>-->
+    <!--<converter type="AllInOneConverter"/>-->
+    <!--</converters>-->
 
 </configuration>
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/9f71f2d8/metamodel/src/test/resources/tamaya-config.yaml
----------------------------------------------------------------------
diff --git a/metamodel/src/test/resources/tamaya-config.yaml b/metamodel/src/test/resources/tamaya-config.yaml
deleted file mode 100644
index 4851c97..0000000
--- a/metamodel/src/test/resources/tamaya-config.yaml
+++ /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 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.
-#
-<!--
-// 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.
-// -->
-------
-configuration:
-  formats:
-    - format: yaml
-    - format: json
-  converters:
-    - converter: AllInOneConverter
-  filters:
-    - filter: UsageTrackerFilter
-
-  context:
-    - stage: ${properties:system:STAGE?default=DEV}
-    - app: ${properties:system.APP?default=NONE}
-    - context: ${java:org.apache.tamaya.context.Context#id()}
-    - company: Trivadis
-
-  sources:
-    - ENVIRONMENT:
-        uri: properties:environment
-        enabled: ${stage=TEST || stage=PTA || stage=PROD}
-        decorator:
-          - maped-to: ENV.
-          - secured:
-              roles: admin,power-user
-              policy: mask
-    - SYSPROPS:
-        uri: properties:system
-    - FILE:config.json:
-        uri: file:/./config.json
-        name: FILE:config.json
-        observe: true
-        observe-period: 20000
-    - CP:config.yml:
-        uri: classpath*://META-INF/application-config.yml
-    - MINE:
-        uri: propertysource:ch.mypack.MyClassSource
-        locale=de
-    - <include>:
-        resource: TEST-config.xml
-        enabled: ${context.cstage==TEST}
-    - CONFIG-DIR:
-        uri: dir:/${CONFIG-DIR}/**/*.json
-    - SERVER:
-        uri: https://www.confdrive.com/cfg/customerId=${}
-        params:
-          - locale: de
-
-
-
-
-