tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anat...@apache.org
Subject [8/9] incubator-tamaya-sandbox git commit: TAMAYA-145: Removed unused artifacts. Fixed packages.
Date Sun, 26 Feb 2017 23:05:29 GMT
TAMAYA-145: Removed unused artifacts. Fixed packages.


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

Branch: refs/heads/master
Commit: 52c572e8ff428f0fbeda5db0518c5e14e7c0228a
Parents: 7a67cc3
Author: anatole <anatole@apache.org>
Authored: Thu Feb 23 01:22:36 2017 +0100
Committer: anatole <anatole@apache.org>
Committed: Mon Feb 27 00:05:00 2017 +0100

----------------------------------------------------------------------
 .../tamaya/metamodel/EnabledPropertySource.java |   4 +-
 .../EnabledPropertySourceProvider.java          | 112 ----------
 .../metamodel/FilteredPropertySource.java       | 166 ---------------
 .../apache/tamaya/metamodel/MetaContext.java    |  25 ++-
 .../metamodel/RefreshablePropertySource.java    | 150 -------------
 .../RefreshablePropertySourceProvider.java      | 106 ---------
 .../tamaya/metamodel/dsl/DSLFormatManager.java  | 115 ----------
 .../tamaya/metamodel/dsl/ProfileManager.java    | 213 -------------------
 .../tamaya/metamodel/dsl/package-info.java      |  23 --
 .../ext/EnabledPropertySourceProvider.java      | 113 ++++++++++
 .../metamodel/ext/FilteredPropertySource.java   | 166 +++++++++++++++
 .../ext/RefreshablePropertySource.java          | 151 +++++++++++++
 .../ext/RefreshablePropertySourceProvider.java  | 107 ++++++++++
 .../tamaya/metamodel/ext/package-info.java      |  23 ++
 .../metamodel/internal/ContextReader.java       | 117 +++++++++-
 .../internal/PropertySourceReader.java          |   4 +
 .../internal/resolver/JavaResolver.java         |  75 +++++++
 .../internal/resolver/PropertiesResolver.java   |  82 +++++++
 .../tamaya/metamodel/spi/SimpleResolver.java    |  41 ++++
 ...g.apache.tamaya.metamodel.spi.SimpleResolver |  20 ++
 .../tamaya/metamodel/dsl/IntegrationTest.java   |  57 -----
 .../tamaya/metamodel/ext/IntegrationTest.java   |  57 +++++
 22 files changed, 977 insertions(+), 950 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/52c572e8/metamodel/src/main/java/org/apache/tamaya/metamodel/EnabledPropertySource.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/EnabledPropertySource.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/EnabledPropertySource.java
index e231930..b425464 100644
--- a/metamodel/src/main/java/org/apache/tamaya/metamodel/EnabledPropertySource.java
+++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/EnabledPropertySource.java
@@ -20,6 +20,7 @@ package org.apache.tamaya.metamodel;
 
 import org.apache.tamaya.spi.PropertySource;
 import org.apache.tamaya.spi.PropertyValue;
+import org.apache.tamaya.spisupport.PropertySourceComparator;
 
 import javax.script.ScriptEngine;
 import javax.script.ScriptEngineManager;
@@ -94,9 +95,8 @@ public final class EnabledPropertySource
         this.enabled = enabled;
     }
 
-    @Override
     public int getOrdinal() {
-        return this.wrapped.getOrdinal();
+        return PropertySourceComparator.getOrdinal(this.wrapped);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/52c572e8/metamodel/src/main/java/org/apache/tamaya/metamodel/EnabledPropertySourceProvider.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/EnabledPropertySourceProvider.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/EnabledPropertySourceProvider.java
deleted file mode 100644
index 5dfed10..0000000
--- a/metamodel/src/main/java/org/apache/tamaya/metamodel/EnabledPropertySourceProvider.java
+++ /dev/null
@@ -1,112 +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;
-
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertySourceProvider;
-
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-import javax.script.ScriptException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-import java.util.Objects;
-import java.util.logging.Logger;
-
-/**
- * Wrapped property source provider that allows enabling a property source using an
- * {@code enabled} expression.
- */
-public final class EnabledPropertySourceProvider
-        implements PropertySourceProvider, Enabled {
-
-    private static final Logger LOG = Logger.getLogger(EnabledPropertySourceProvider.class.getName());
-    private String enabledExpression;
-    private PropertySourceProvider wrapped;
-    private boolean enabled;
-
-    public EnabledPropertySourceProvider(PropertySourceProvider wrapped, Map<String,String> context, String expression) {
-        this.enabledExpression = Objects.requireNonNull(expression);
-        this.wrapped = Objects.requireNonNull(wrapped);
-        this.enabled = calculateEnabled(context);
-    }
-
-    protected boolean calculateEnabled(Map<String, String> context) {
-        try {
-            ScriptEngineManager manager = new ScriptEngineManager();
-            ScriptEngine engine = manager.getEngineByName("nashorn");
-            if(engine==null){
-                engine = manager.getEngineByName("rhino");
-            }
-            // init script engine
-            for(Map.Entry<String,String> entry: context.entrySet()) {
-                engine.put(entry.getKey(), entry.getValue());
-            }
-            Object o = engine.eval(enabledExpression);
-            if(!(o instanceof Boolean)){
-                LOG.severe("Enabled expression must evaluate to Boolean: '"
-                        +enabledExpression+"', but was " + o +
-                        ", property source provider will be disabled: " +
-                        wrapped.getClass().getName());
-                return false;
-            }
-            return (Boolean)o;
-        } catch (ScriptException e) {
-            LOG.severe("Invalid Boolean expression: '"
-                    +enabledExpression+"': " + e + ", property source provider will be disabled: " +
-                    wrapped.getClass().getName());
-        }
-        return false;
-    }
-
-    /**
-     * Returns the enabled property.
-     * @return the enabled value.
-     */
-    @Override
-    public boolean isEnabled(){
-        return enabled;
-    }
-
-    /**
-     * Enables/disables this property source.
-     * @param enabled the enabled value.
-     */
-    @Override
-    public void setEnabled(boolean enabled){
-        this.enabled = enabled;
-    }
-
-    @Override
-    public Collection<PropertySource> getPropertySources() {
-        if(!isEnabled()){
-            return Collections.emptySet();
-        }
-        return this.wrapped.getPropertySources();
-    }
-
-    @Override
-    public String toString() {
-        return "DynamicPropertySourceProvider{" +
-                "\n enabled=" + enabledExpression +
-                "\n wrapped=" + wrapped +
-                '}';
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/52c572e8/metamodel/src/main/java/org/apache/tamaya/metamodel/FilteredPropertySource.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/FilteredPropertySource.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/FilteredPropertySource.java
deleted file mode 100644
index b4f95f5..0000000
--- a/metamodel/src/main/java/org/apache/tamaya/metamodel/FilteredPropertySource.java
+++ /dev/null
@@ -1,166 +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;
-
-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 org.apache.tamaya.spisupport.BasePropertySource;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-/**
- * Property source that allows filtering on property source level. This class is thread-safe, accesses using or
- * changing the filter list are synchronized.
- */
-public final class FilteredPropertySource extends BasePropertySource {
-
-    private PropertySource wrapped;
-    private List<PropertyFilter> filters = new ArrayList<>();
-
-    /**
-     * Constructor used privately. Use {@link #of(PropertySource)} for making a {@link PropertySource} filterable.
-     * @param propertySource the property source to be filtered.
-     */
-    private FilteredPropertySource(PropertySource propertySource){
-        this.wrapped = Objects.requireNonNull(propertySource);
-    }
-
-
-    /**
-     * Wraps a given property source.
-     * @param propertySource the property source to be wrapped.
-     * @return a wrapped property source.
-     */
-    public static FilteredPropertySource of(PropertySource propertySource){
-        if(propertySource instanceof FilteredPropertySource){
-            return (FilteredPropertySource)propertySource;
-        }
-        return new FilteredPropertySource(propertySource);
-    }
-
-    @Override
-    public int getOrdinal() {
-        int ordinalSet = super.getOrdinal();
-        if(ordinalSet == 0){
-            return this.wrapped.getOrdinal();
-        }
-        return ordinalSet;
-    }
-
-    @Override
-    public String getName() {
-        return wrapped.getName();
-    }
-
-    @Override
-    public PropertyValue get(String 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() {
-        Map<String, String> wrappedProps = wrapped.getProperties();
-        if(!filters.isEmpty()){
-            Map<String, String> result = new HashMap<>();
-            synchronized (filters) {
-                for (String key : wrappedProps.keySet()) {
-                    PropertyValue value = wrapped.get(key);
-                    FilterContext filterContext = new FilterContext(key, value.getConfigEntries(), true);
-                    String filteredValue = value.getValue();
-                    for (PropertyFilter pf : filters) {
-                        filteredValue = pf.filterProperty(filteredValue, filterContext);
-                    }
-                    if (filteredValue != null) {
-                        result.putAll(value.getConfigEntries());
-                        result.put(key, filteredValue);
-                    }
-
-                }
-            }
-            return result;
-        }
-        return wrappedProps;
-    }
-
-    @Override
-    public boolean isScannable() {
-        return wrapped.isScannable();
-    }
-
-    /**
-     * Adds the given filters to this property source.
-     * @param filter the filters, not null.
-     */
-    public void addPropertyFilter(PropertyFilter... filter){
-        synchronized(filters){
-            this.filters.addAll(Arrays.asList(filter));
-        }
-    }
-
-    /**
-     * Removes the given filter, if present.
-     * @param filter the filter to remove, not null.
-     */
-    public void removePropertyFilter(PropertyFilter filter){
-        synchronized(filters){
-            this.filters.remove(filter);
-        }
-    }
-
-    /**
-     * Access the current filters present.
-     * @return a copy of the current filter list.
-     */
-    public List<PropertyFilter> getPropertyFilter(){
-        synchronized (filters){
-            return new ArrayList<>(filters);
-        }
-    }
-
-    @Override
-    public String toString() {
-        synchronized (filters) {
-            return "FilteredPropertySource{" +
-                    "\n wrapped=" + wrapped +
-                    "\n filters=" + this.filters +
-                    "\n base=" + super.toString() +
-                    "\n}";
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/52c572e8/metamodel/src/main/java/org/apache/tamaya/metamodel/MetaContext.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/MetaContext.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/MetaContext.java
index c4fa25a..1952d8e 100644
--- a/metamodel/src/main/java/org/apache/tamaya/metamodel/MetaContext.java
+++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/MetaContext.java
@@ -41,8 +41,8 @@ import java.util.concurrent.TimeUnit;
  *     <li>providing key/values only valid for a certain time (assigned a TTL), see {@link #setProperty(String, String, int, TimeUnit)},
  *     {@link #setProperties(Map, long, TimeUnit)}</li>
  * </ul>
- * Additionally there is special support for thread related contexts, see {@link #getThreadInstance()}.
- * Finally there is also one special globally shared context instance, see {@link #getCurrentInstance()}.
+ * Additionally there is special support for thread related contexts, see {@link #getThreadInstance(boolean)}.
+ * Finally there is also one special globally shared context instance, see {@link #getCurrentInstance(boolean)}.
  */
 public final class MetaContext {
 
@@ -105,10 +105,15 @@ public final class MetaContext {
     /**
      * Access the thread-based context. If no such context
      * exists a new one will be created.
+     * @param reinit if true, clear's the thread's context.
      * @return the corresponding context, never null.
      */
-    public static MetaContext getThreadInstance(){
-        return THREAD_CONTEXT.get();
+    public static MetaContext getThreadInstance(boolean reinit){
+        MetaContext threadContext =THREAD_CONTEXT.get();
+        if(reinit){
+            threadContext.properties.clear();
+        }
+        return threadContext;
     }
 
     /**
@@ -117,7 +122,17 @@ public final class MetaContext {
      * @return the corresponding context, never null.
      */
     public MetaContext getCurrentInstance(){
-        return this.combineWith(THREAD_CONTEXT.get());
+        return getCurrentInstance(false);
+    }
+
+    /**
+     * Access the current context, which actually is the current context, combined with the thread based
+     * context (overriding).
+     * @param reinit if true, clear's the thread's meta context.
+     * @return the corresponding context, never null.
+     */
+    public MetaContext getCurrentInstance(boolean reinit){
+        return this.combineWith(getThreadInstance(reinit));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/52c572e8/metamodel/src/main/java/org/apache/tamaya/metamodel/RefreshablePropertySource.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/RefreshablePropertySource.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/RefreshablePropertySource.java
deleted file mode 100644
index 23ca932..0000000
--- a/metamodel/src/main/java/org/apache/tamaya/metamodel/RefreshablePropertySource.java
+++ /dev/null
@@ -1,150 +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;
-
-import org.apache.tamaya.metamodel.internal.ComponentConfigurator;
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertyValue;
-
-import java.util.Collections;
-import java.util.Map;
-import java.util.Objects;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-
-/**
- * Wrapped property source that allows refreshing/reloading a property source. Hereby a property source must
- * either
- * <ul>
- *     <li>have a public parameterless constructor, used for reloading a new instance.</li>
- *     <li>implement itself {@link Refreshable}.</li>
- * </ul>
- */
-public final class RefreshablePropertySource
-        implements PropertySource, Refreshable {
-
-    private static final Logger LOG = Logger.getLogger(RefreshablePropertySource.class.getName());
-    private Map<String,String> metaConfig;
-    private PropertySource wrapped;
-    private AtomicLong nextRefresh = new AtomicLong();
-    private AtomicLong refreshPeriod = new AtomicLong();
-
-    private RefreshablePropertySource(Map<String,String> metaConfig, PropertySource wrapped) {
-        this.metaConfig = Objects.requireNonNull(metaConfig);
-        this.wrapped = Objects.requireNonNull(wrapped);
-    }
-
-    /**
-     * Makes a property source refreshable. If the given property source is already an instance of
-     * RefreshablePropertySource, the property source is returned.
-     * @param metaConfig the configuration parameters to be applied when a new PropertySource is created, not null.
-     * @param propertySource the property source, not null.
-     * @return a new instance, not null.
-     */
-    public static RefreshablePropertySource of(Map<String,String> metaConfig, PropertySource propertySource) {
-        if(propertySource instanceof RefreshablePropertySource){
-            return (RefreshablePropertySource)propertySource;
-        }
-        return new RefreshablePropertySource(metaConfig, propertySource);
-    }
-
-    /**
-     * Makes a property source refreshable. If the given property source is already an instance of
-     * RefreshablePropertySource, the property source is returned.
-     * @param propertySource the property source, not null.
-     * @return a new instance, not null.
-     */
-    public static RefreshablePropertySource of(PropertySource propertySource) {
-        return of(Collections.<String, String>emptyMap(), propertySource);
-    }
-
-    /**
-     * Checks if the property source should autorefresh, if so {@link #refresh()} is called.
-     */
-    private void checkRefresh(){
-        long next = nextRefresh.get();
-        if(next > 0 && next<System.currentTimeMillis()){
-            nextRefresh.set(next + refreshPeriod.get());
-            refresh();
-        }
-    }
-
-    /**
-     * Set the refresh period. This will be immedately applied from now. No explicit
-     * refresh will be triggered now.
-     * @param units
-     * @param timeUnit
-     */
-    public void setRefreshPeriod(long units, TimeUnit timeUnit){
-        this.refreshPeriod.set(timeUnit.toMillis(units));
-        this.nextRefresh.set(System.currentTimeMillis() + this.refreshPeriod.get());
-    }
-
-
-    @Override
-    public void refresh() {
-        try {
-            if(this.wrapped instanceof Refreshable){
-                ((Refreshable) this.wrapped).refresh();
-            }else {
-                this.wrapped = this.wrapped.getClass().newInstance();
-                ComponentConfigurator.configure(this.wrapped, metaConfig);
-            }
-        } catch (Exception e) {
-            LOG.log(Level.WARNING, "Failed to reload/refresh PropertySource: " +
-                    wrapped.getClass().getName(), e);
-        }
-    }
-
-    @Override
-    public int getOrdinal() {
-        return this.wrapped.getOrdinal();
-    }
-
-    @Override
-    public String getName() {
-        return this.wrapped.getName();
-    }
-
-    @Override
-    public PropertyValue get(String key) {
-        return this.wrapped.get(key);
-    }
-
-    @Override
-    public Map<String, String> getProperties() {
-        return this.wrapped.getProperties();
-    }
-
-    @Override
-    public boolean isScannable() {
-        return this.wrapped.isScannable();
-    }
-
-    @Override
-    public String toString() {
-        return "RefreshablePropertySource{" +
-                "\n metaConfig=" + metaConfig +
-                "\n wrapped=" + wrapped +
-                '}';
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/52c572e8/metamodel/src/main/java/org/apache/tamaya/metamodel/RefreshablePropertySourceProvider.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/RefreshablePropertySourceProvider.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/RefreshablePropertySourceProvider.java
deleted file mode 100644
index e71ca56..0000000
--- a/metamodel/src/main/java/org/apache/tamaya/metamodel/RefreshablePropertySourceProvider.java
+++ /dev/null
@@ -1,106 +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;
-
-import org.apache.tamaya.metamodel.internal.ComponentConfigurator;
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertySourceProvider;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-import java.util.Objects;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Wrapped property source provider that allows refreshing/reloading a property source provider. Hereby a provider must
- * either
- * <ul>
- *     <li>have a public parameterless constructor, used for reloading a new instance.</li>
- *     <li>implement itself {@link Refreshable}.</li>
- * </ul>
- */
-public final class RefreshablePropertySourceProvider
-        implements PropertySourceProvider, Refreshable {
-
-    private static final Logger LOG = Logger.getLogger(RefreshablePropertySourceProvider.class.getName());
-    private Map<String,String> metaConfig;
-    private PropertySourceProvider wrapped;
-    private Collection<PropertySource> propertSources;
-
-    private RefreshablePropertySourceProvider(Map<String,String> metaConfig, PropertySourceProvider wrapped) {
-        this.metaConfig = Objects.requireNonNull(metaConfig);
-        this.wrapped = Objects.requireNonNull(wrapped);
-        this.propertSources = Objects.requireNonNull(wrapped.getPropertySources());
-    }
-
-    /**
-     * Makes a property source provider refreshable. If the given property source provider is already an instance of
-     * RefreshablePropertySourceProvider, the property source provider is returned unchanged.
-     * @param metaConfig the configuration parameters to be applied when a new PropertySourceProvider is created, not null.
-     * @param provider the property source provider, not null.
-     * @return a new instance, not null.
-     */
-    public static RefreshablePropertySourceProvider of(Map<String,String> metaConfig, PropertySourceProvider provider) {
-        if(provider instanceof RefreshablePropertySourceProvider){
-            return (RefreshablePropertySourceProvider)provider;
-        }
-        return new RefreshablePropertySourceProvider(metaConfig, provider);
-    }
-
-    /**
-     * Makes a property source refreshable. If the given property source is already an instance of
-     * RefreshablePropertySource, the property source is returned.
-     * @param provider the property source provider, not null.
-     * @return a new instance, not null.
-     */
-    public static RefreshablePropertySourceProvider of(PropertySourceProvider provider) {
-        return of(Collections.<String, String>emptyMap(), provider);
-    }
-
-    @Override
-    public Collection<PropertySource> getPropertySources() {
-        return this.propertSources;
-    }
-
-    @Override
-    public void refresh() {
-        try {
-            if(this.wrapped instanceof Refreshable){
-                ((Refreshable) this.wrapped).refresh();
-            }else {
-                this.wrapped = this.wrapped.getClass().newInstance();
-                ComponentConfigurator.configure(this.wrapped, metaConfig);
-            }
-        } catch (Exception e) {
-            LOG.log(Level.WARNING, "Failed to refresh PropertySourceProvider: " +
-                    wrapped.getClass().getName(), e);
-        }
-        this.propertSources = Objects.requireNonNull(wrapped.getPropertySources());
-    }
-
-    @Override
-    public String toString() {
-        return "RefreshablePropertySourceProvider{" +
-                "\n metaConfig=" + metaConfig +
-                "\n wrapped=" + wrapped +
-                '}';
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/52c572e8/metamodel/src/main/java/org/apache/tamaya/metamodel/dsl/DSLFormatManager.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/dsl/DSLFormatManager.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/dsl/DSLFormatManager.java
deleted file mode 100644
index 2d84c48..0000000
--- a/metamodel/src/main/java/org/apache/tamaya/metamodel/dsl/DSLFormatManager.java
+++ /dev/null
@@ -1,115 +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.dsl;
-//
-//import org.apache.tamaya.Configuration;
-//import org.apache.tamaya.format.ConfigurationFormat;
-//import org.apache.tamaya.format.ConfigurationFormats;
-//import org.apache.tamaya.functions.ConfigurationFunctions;
-//
-//import java.util.*;
-//
-///**
-// * Component that manages the current supported formats:
-// * <pre>
-// * TAMAYA:
-// *   FORMAT-DEF:
-// *     - formats: yaml, properties, xml-properties
-// * </pre>
-// * Hereby:
-// * <ul>
-// *     <li><b>profiles</b> defines the available profiles, including implicit default profiles.</li>
-// * </ul>
-// */
-//public final class DSLFormatManager {
-//
-//    private static final DSLFormatManager INSTANCE = new DSLFormatManager();
-//
-//    /** The currently active formats, in order of precedence, the most significant are the last ones. */
-//    private List<ConfigurationFormat> formats = new ArrayList<>();
-//    /** The currently active suffixes, in order of precedence, the most significant are the last ones. */
-//    private List<String> suffixes = new ArrayList<>();
-//
-//
-//    /**
-//     * Get the current instance.
-//     * @return the current profile manager, never null.
-//     */
-//    public static DSLFormatManager getInstance(){
-//        return INSTANCE;
-//    }
-//
-//    private DSLFormatManager(){
-//        Configuration metaConfig = MetaConfiguration.getConfiguration();
-//        Configuration formatsConfig = metaConfig.with(
-//                ConfigurationFunctions.section("TAMAYA.FORMATS"));
-//        String[] formats = formatsConfig.getOrDefault("formats","yamk,properties,ini").split(",");
-//        this.formats.addAll(ConfigurationFormats.getFormats(formats));
-//        String[] suffixes = formatsConfig.getOrDefault("suffixes","yml,properties,ini").split(",");
-//        for(String sfx:suffixes){
-//            sfx = sfx.trim();
-//            if(sfx.isEmpty()){
-//                continue;
-//            }
-//            this.suffixes.add(sfx);
-//        }
-//    }
-//
-//
-//    /**
-//     * Allows to check if a suffix is currently activated.
-//     * @param suffix the suffix name, not null.
-//     * @return true, if the profile is defined.
-//     */
-//    public boolean isSuffixDefined(String suffix){
-//        return this.suffixes.contains(suffix);
-//    }
-//
-//    /**
-//     * Allows to check if a format is selected.
-//     * @param formatName the format name, not null.
-//     * @return true, if the format is a selected.
-//     */
-//    public boolean isFormatSelected(String formatName){
-//        for(ConfigurationFormat format:formats){
-//            if(format.getName().equals(formatName)){
-//                return true;
-//            }
-//        }
-//        return false;
-//    }
-//
-//    /**
-//     * Get the list of currently active suffixes.
-//     * @return the list of currently active suffixes, never null.
-//     */
-//    public List<String> getSuffixes(){
-//        return Collections.unmodifiableList(suffixes);
-//    }
-//
-//    /**
-//     * Get the list of currently active formats.
-//     * @return the list of currently active formats, never null.
-//     */
-//    public List<ConfigurationFormat> getFormats(){
-//        return Collections.unmodifiableList(formats);
-//    }
-//
-//
-//}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/52c572e8/metamodel/src/main/java/org/apache/tamaya/metamodel/dsl/ProfileManager.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/dsl/ProfileManager.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/dsl/ProfileManager.java
deleted file mode 100644
index 0d19d9c..0000000
--- a/metamodel/src/main/java/org/apache/tamaya/metamodel/dsl/ProfileManager.java
+++ /dev/null
@@ -1,213 +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.dsl;
-//
-//import org.apache.tamaya.ConfigException;
-//import org.apache.tamaya.Configuration;
-//import org.apache.tamaya.functions.ConfigurationFunctions;
-//import org.apache.tamaya.resolver.Resolver;
-//import org.apache.tamaya.resolver.spi.ExpressionResolver;
-//import org.apache.tamaya.spi.ServiceContextManager;
-//
-//import java.util.*;
-//import java.util.logging.Level;
-//import java.util.logging.Logger;
-//
-///**
-// * Component that manages the current setup profiles for this environment/runtime. The profile manager
-// * reads the profile meta configuration that looks as follows:
-// * <pre>
-// * TAMAYA:
-// *   PROFILES-DEF:
-// *     - profiles:          DEFAULTS,DEV,TEST,PTA,PROD
-// *     - defaults:          DEFAULTS
-// *     - default-active:    DEV
-// *     - evaluation:        ${sys:ENV}, ${env:ENV}
-// * </pre>
-// * Hereby:
-// * <ul>
-// *     <li><b>profiles</b> defines the available profiles, including implicit default profiles.</li>
-// *     <li><b>defaults</b> defines the profiles that are loaded implicitly first as defaults.</li>
-// *     <li><b>default-active</b> defines the profile(s) activated by default, when no profile setting could be evaluated.
-// *     <li><b>evaluation</b> defines the resolution expressions to be used to evaluate the current profiles active.
-// *       By default {@code ${sys:ENV}, ${env:ENV}} is used, which tries to evaluate {@code ENV} using system and
-// *       environment properties. Refere to the {@code tamaya-resolver} module for further details on resolvers and
-// *       expressions and see {@link Resolver#evaluateExpression(String, boolean)}.
-// * </ul>
-// */
-//public final class ProfileManager {
-//
-//    private static final Logger LOG = Logger.getLogger(ProfileManager.class.getName());
-//    private static final ProfileManager INSTANCE = new ProfileManager();
-//
-//    /** The currently active profiles, in order of precedence, the most significant are the last ones. */
-//    private List<String> activeProfiles = new ArrayList<>();
-//    /** A set of all defined profiles. */
-//    private Set<String> profiles = new HashSet<>();
-//    /** The current used default profiles, loaded initially, before all other profiles are loaded. */
-//    private List<String> defaultProfiles = new ArrayList<>();
-//
-//
-//    /**
-//     * Get the current instance.
-//     * @return the current profile manager, never null.
-//     */
-//    public static ProfileManager getInstance(){
-//        return INSTANCE;
-//    }
-//
-//    private ProfileManager(){
-//        Configuration metaConfig = MetaConfiguration.getConfiguration();
-//        Configuration profileConfig = metaConfig.with(
-//                ConfigurationFunctions.section("TAMAYA.PROFILES-DEF"));
-//        String[] selectables = profileConfig.getOrDefault("profiles","DEFAULT,DEV,TEST,PROD").split(",");
-//        for(String sel:selectables){
-//            sel = sel.trim();
-//            if(sel.isEmpty()){
-//                continue;
-//            }
-//            this.profiles.add(sel);
-//        }
-//        String[] defaults = profileConfig.getOrDefault("defaults","DEFAULT").split(",");
-//        for(String def:defaults){
-//            def = def.trim();
-//            if(def.isEmpty()){
-//                continue;
-//            }
-//            if(!isProfileDefined(def)){
-//                throw new ConfigException("Invalid profile encountered: " +def + ", valid are: " + profiles);
-//            }
-//            this.defaultProfiles.add(def);
-//        }
-//        String[] expressions = profileConfig.getOrDefault("evaluation","${sys:ENV}, ${env:ENV}").split(",");
-//        String currentEnvironment = null;
-//        for(String exp:expressions){
-//            exp = exp.trim();
-//            if(exp.isEmpty()){
-//                continue;
-//            }
-//            currentEnvironment = evaluateExpression(exp);
-//            if(currentEnvironment!=null){
-//                currentEnvironment = currentEnvironment.trim();
-//                if(!currentEnvironment.isEmpty()){
-//                    break;
-//                }
-//            }
-//        }
-//        if(currentEnvironment==null|| currentEnvironment.isEmpty()){
-//            currentEnvironment = profileConfig.getOrDefault("default-active", "DEV");
-//        }
-//        this.activeProfiles.addAll(defaultProfiles);
-//        String[] profilesActive = currentEnvironment.split(",");
-//        for(String prof:profilesActive){
-//            prof = prof.trim();
-//            if(prof.isEmpty()){
-//                continue;
-//            }
-//            if(!isProfileDefined(prof)){
-//                throw new ConfigException("Invalid profile encountered: " +prof + ", valid are: " + profiles);
-//            }
-//            this.activeProfiles.add(prof);
-//        }
-//    }
-//
-//    /**
-//     * Evaluates the expressions to evaluate the current profile.
-//     * Currently the following expressions are supported
-//     * <pre>
-//     * sys-property:xxx
-//     * env-property:xxx
-//     * </pre>
-//     * {@code xxx} is the corresponding key.
-//     * @param currentProfileExpression the profile expression.
-//     * @return the evaluated String, or null.
-//     */
-//    private String evaluateExpression(String currentProfileExpression){
-//        currentProfileExpression = currentProfileExpression.trim();
-//        List<ExpressionResolver> resolvers = new ArrayList<>();
-//        for(ExpressionResolver res: ServiceContextManager.getServiceContext().getServices(ExpressionResolver.class)){
-//            resolvers.add(res);
-//        }
-//        for(ExpressionResolver res:resolvers){
-//            if(currentProfileExpression.startsWith(res.getResolverPrefix())){
-//                try{
-//                    return res.evaluate(currentProfileExpression.substring(res.getResolverPrefix().length()));
-//                }catch(Exception e){
-//                    LOG.log(Level.FINEST, "Error evaluating resolver: " + res, e);
-//                }
-//            }
-//        }
-//        return null;
-//    }
-//
-//    /**
-//     * Allows to check if a profile is currently active.
-//     * @param profileName the profile name, not null.
-//     * @return true, if the profile is active.
-//     */
-//    public boolean isProfileActive(String profileName){
-//        return this.activeProfiles.contains(profileName);
-//    }
-//
-//    /**
-//     * Allows to check if a profile is currently defined.
-//     * @param profileName the profile name, not null.
-//     * @return true, if the profile is defined.
-//     */
-//    public boolean isProfileDefined(String profileName){
-//        return this.profiles.contains(profileName);
-//    }
-//
-//    /**
-//     * Allows to check if a profile is a default profile.
-//     * @param profileName the profile name, not null.
-//     * @return true, if the profile is a default profile.
-//     */
-//    public boolean isProfileDefault(String profileName){
-//        return this.defaultProfiles.contains(profileName);
-//    }
-//
-//    /**
-//     * Get the list of currently active profiles.
-//     * @return the list of currently active profiles, in order of precedence, the most significant
-//     * are the last ones, never null.
-//     */
-//    public List<String> getActiveProfiles(){
-//        return Collections.unmodifiableList(activeProfiles);
-//    }
-//
-//    /**
-//     * Get the list of currently active profiles.
-//     * @return the list of currently active profiles, in order of precedence, the most significant
-//     * are the last ones, never null.
-//     */
-//    public List<String> getDefaultProfiles(){
-//        return Collections.unmodifiableList(defaultProfiles);
-//    }
-//
-//    /**
-//     * Get the list of currently active profiles.
-//     * @return the list of currently active profiles, in order of precedence, the most significant
-//     * are the last ones, never null.
-//     */
-//    public Set<String> getAllProfiles(){
-//        return Collections.unmodifiableSet(profiles);
-//    }
-//
-//}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/52c572e8/metamodel/src/main/java/org/apache/tamaya/metamodel/dsl/package-info.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/dsl/package-info.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/dsl/package-info.java
deleted file mode 100644
index c707302..0000000
--- a/metamodel/src/main/java/org/apache/tamaya/metamodel/dsl/package-info.java
+++ /dev/null
@@ -1,23 +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.
- */
-/**
- * Main package of the DSL module. Normally client code does not need access this package.
- * But extensions also relying on the meta-data configuration mechanism may use it.
- */
-package org.apache.tamaya.metamodel.dsl;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/52c572e8/metamodel/src/main/java/org/apache/tamaya/metamodel/ext/EnabledPropertySourceProvider.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/ext/EnabledPropertySourceProvider.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/ext/EnabledPropertySourceProvider.java
new file mode 100644
index 0000000..88e0c78
--- /dev/null
+++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/ext/EnabledPropertySourceProvider.java
@@ -0,0 +1,113 @@
+/*
+ * 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.ext;
+
+import org.apache.tamaya.metamodel.Enabled;
+import org.apache.tamaya.spi.PropertySource;
+import org.apache.tamaya.spi.PropertySourceProvider;
+
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Objects;
+import java.util.logging.Logger;
+
+/**
+ * Wrapped property source provider that allows enabling a property source using an
+ * {@code enabled} expression.
+ */
+public final class EnabledPropertySourceProvider
+        implements PropertySourceProvider, Enabled {
+
+    private static final Logger LOG = Logger.getLogger(EnabledPropertySourceProvider.class.getName());
+    private String enabledExpression;
+    private PropertySourceProvider wrapped;
+    private boolean enabled;
+
+    public EnabledPropertySourceProvider(PropertySourceProvider wrapped, Map<String,String> context, String expression) {
+        this.enabledExpression = Objects.requireNonNull(expression);
+        this.wrapped = Objects.requireNonNull(wrapped);
+        this.enabled = calculateEnabled(context);
+    }
+
+    protected boolean calculateEnabled(Map<String, String> context) {
+        try {
+            ScriptEngineManager manager = new ScriptEngineManager();
+            ScriptEngine engine = manager.getEngineByName("nashorn");
+            if(engine==null){
+                engine = manager.getEngineByName("rhino");
+            }
+            // init script engine
+            for(Map.Entry<String,String> entry: context.entrySet()) {
+                engine.put(entry.getKey(), entry.getValue());
+            }
+            Object o = engine.eval(enabledExpression);
+            if(!(o instanceof Boolean)){
+                LOG.severe("Enabled expression must evaluate to Boolean: '"
+                        +enabledExpression+"', but was " + o +
+                        ", property source provider will be disabled: " +
+                        wrapped.getClass().getName());
+                return false;
+            }
+            return (Boolean)o;
+        } catch (ScriptException e) {
+            LOG.severe("Invalid Boolean expression: '"
+                    +enabledExpression+"': " + e + ", property source provider will be disabled: " +
+                    wrapped.getClass().getName());
+        }
+        return false;
+    }
+
+    /**
+     * Returns the enabled property.
+     * @return the enabled value.
+     */
+    @Override
+    public boolean isEnabled(){
+        return enabled;
+    }
+
+    /**
+     * Enables/disables this property source.
+     * @param enabled the enabled value.
+     */
+    @Override
+    public void setEnabled(boolean enabled){
+        this.enabled = enabled;
+    }
+
+    @Override
+    public Collection<PropertySource> getPropertySources() {
+        if(!isEnabled()){
+            return Collections.emptySet();
+        }
+        return this.wrapped.getPropertySources();
+    }
+
+    @Override
+    public String toString() {
+        return "DynamicPropertySourceProvider{" +
+                "\n enabled=" + enabledExpression +
+                "\n wrapped=" + wrapped +
+                '}';
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/52c572e8/metamodel/src/main/java/org/apache/tamaya/metamodel/ext/FilteredPropertySource.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/ext/FilteredPropertySource.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/ext/FilteredPropertySource.java
new file mode 100644
index 0000000..0ad7dd2
--- /dev/null
+++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/ext/FilteredPropertySource.java
@@ -0,0 +1,166 @@
+/*
+ * 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.ext;
+
+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 org.apache.tamaya.spisupport.BasePropertySource;
+import org.apache.tamaya.spisupport.PropertySourceComparator;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * Property source that allows filtering on property source level. This class is thread-safe, accesses using or
+ * changing the filter list are synchronized.
+ */
+public final class FilteredPropertySource extends BasePropertySource {
+
+    private PropertySource wrapped;
+    private List<PropertyFilter> filters = new ArrayList<>();
+
+    /**
+     * Constructor used privately. Use {@link #of(PropertySource)} for making a {@link PropertySource} filterable.
+     * @param propertySource the property source to be filtered.
+     */
+    private FilteredPropertySource(PropertySource propertySource){
+        this.wrapped = Objects.requireNonNull(propertySource);
+    }
+
+
+    /**
+     * Wraps a given property source.
+     * @param propertySource the property source to be wrapped.
+     * @return a wrapped property source.
+     */
+    public static FilteredPropertySource of(PropertySource propertySource){
+        if(propertySource instanceof FilteredPropertySource){
+            return (FilteredPropertySource)propertySource;
+        }
+        return new FilteredPropertySource(propertySource);
+    }
+
+    public int getOrdinal() {
+        int ordinalSet = super.getOrdinal();
+        if(ordinalSet == 0){
+            return PropertySourceComparator.getOrdinal(this.wrapped);
+        }
+        return ordinalSet;
+    }
+
+    @Override
+    public String getName() {
+        return wrapped.getName();
+    }
+
+    @Override
+    public PropertyValue get(String 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() {
+        Map<String, String> wrappedProps = wrapped.getProperties();
+        if(!filters.isEmpty()){
+            Map<String, String> result = new HashMap<>();
+            synchronized (filters) {
+                for (String key : wrappedProps.keySet()) {
+                    PropertyValue value = wrapped.get(key);
+                    FilterContext filterContext = new FilterContext(key, value.getConfigEntries(), true);
+                    String filteredValue = value.getValue();
+                    for (PropertyFilter pf : filters) {
+                        filteredValue = pf.filterProperty(filteredValue, filterContext);
+                    }
+                    if (filteredValue != null) {
+                        result.putAll(value.getConfigEntries());
+                        result.put(key, filteredValue);
+                    }
+
+                }
+            }
+            return result;
+        }
+        return wrappedProps;
+    }
+
+    @Override
+    public boolean isScannable() {
+        return wrapped.isScannable();
+    }
+
+    /**
+     * Adds the given filters to this property source.
+     * @param filter the filters, not null.
+     */
+    public void addPropertyFilter(PropertyFilter... filter){
+        synchronized(filters){
+            this.filters.addAll(Arrays.asList(filter));
+        }
+    }
+
+    /**
+     * Removes the given filter, if present.
+     * @param filter the filter to remove, not null.
+     */
+    public void removePropertyFilter(PropertyFilter filter){
+        synchronized(filters){
+            this.filters.remove(filter);
+        }
+    }
+
+    /**
+     * Access the current filters present.
+     * @return a copy of the current filter list.
+     */
+    public List<PropertyFilter> getPropertyFilter(){
+        synchronized (filters){
+            return new ArrayList<>(filters);
+        }
+    }
+
+    @Override
+    public String toString() {
+        synchronized (filters) {
+            return "FilteredPropertySource{" +
+                    "\n wrapped=" + wrapped +
+                    "\n filters=" + this.filters +
+                    "\n base=" + super.toString() +
+                    "\n}";
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/52c572e8/metamodel/src/main/java/org/apache/tamaya/metamodel/ext/RefreshablePropertySource.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/ext/RefreshablePropertySource.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/ext/RefreshablePropertySource.java
new file mode 100644
index 0000000..0ebbf45
--- /dev/null
+++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/ext/RefreshablePropertySource.java
@@ -0,0 +1,151 @@
+/*
+ * 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.ext;
+
+import org.apache.tamaya.metamodel.Refreshable;
+import org.apache.tamaya.metamodel.internal.ComponentConfigurator;
+import org.apache.tamaya.spi.PropertySource;
+import org.apache.tamaya.spi.PropertyValue;
+import org.apache.tamaya.spisupport.PropertySourceComparator;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+
+/**
+ * Wrapped property source that allows refreshing/reloading a property source. Hereby a property source must
+ * either
+ * <ul>
+ *     <li>have a public parameterless constructor, used for reloading a new instance.</li>
+ *     <li>implement itself {@link Refreshable}.</li>
+ * </ul>
+ */
+public final class RefreshablePropertySource
+        implements PropertySource, Refreshable {
+
+    private static final Logger LOG = Logger.getLogger(RefreshablePropertySource.class.getName());
+    private Map<String,String> metaConfig;
+    private PropertySource wrapped;
+    private AtomicLong nextRefresh = new AtomicLong();
+    private AtomicLong refreshPeriod = new AtomicLong();
+
+    private RefreshablePropertySource(Map<String,String> metaConfig, PropertySource wrapped) {
+        this.metaConfig = Objects.requireNonNull(metaConfig);
+        this.wrapped = Objects.requireNonNull(wrapped);
+    }
+
+    /**
+     * Makes a property source refreshable. If the given property source is already an instance of
+     * RefreshablePropertySource, the property source is returned.
+     * @param metaConfig the configuration parameters to be applied when a new PropertySource is created, not null.
+     * @param propertySource the property source, not null.
+     * @return a new instance, not null.
+     */
+    public static RefreshablePropertySource of(Map<String,String> metaConfig, PropertySource propertySource) {
+        if(propertySource instanceof RefreshablePropertySource){
+            return (RefreshablePropertySource)propertySource;
+        }
+        return new RefreshablePropertySource(metaConfig, propertySource);
+    }
+
+    /**
+     * Makes a property source refreshable. If the given property source is already an instance of
+     * RefreshablePropertySource, the property source is returned.
+     * @param propertySource the property source, not null.
+     * @return a new instance, not null.
+     */
+    public static RefreshablePropertySource of(PropertySource propertySource) {
+        return of(Collections.<String, String>emptyMap(), propertySource);
+    }
+
+    /**
+     * Checks if the property source should autorefresh, if so {@link #refresh()} is called.
+     */
+    private void checkRefresh(){
+        long next = nextRefresh.get();
+        if(next > 0 && next<System.currentTimeMillis()){
+            nextRefresh.set(next + refreshPeriod.get());
+            refresh();
+        }
+    }
+
+    /**
+     * Set the refresh period. This will be immedately applied from now. No explicit
+     * refresh will be triggered now.
+     * @param units
+     * @param timeUnit
+     */
+    public void setRefreshPeriod(long units, TimeUnit timeUnit){
+        this.refreshPeriod.set(timeUnit.toMillis(units));
+        this.nextRefresh.set(System.currentTimeMillis() + this.refreshPeriod.get());
+    }
+
+
+    @Override
+    public void refresh() {
+        try {
+            if(this.wrapped instanceof Refreshable){
+                ((Refreshable) this.wrapped).refresh();
+            }else {
+                this.wrapped = this.wrapped.getClass().newInstance();
+                ComponentConfigurator.configure(this.wrapped, metaConfig);
+            }
+        } catch (Exception e) {
+            LOG.log(Level.WARNING, "Failed to reload/refresh PropertySource: " +
+                    wrapped.getClass().getName(), e);
+        }
+    }
+
+    public int getOrdinal() {
+        return PropertySourceComparator.getOrdinal(this.wrapped);
+    }
+
+    @Override
+    public String getName() {
+        return this.wrapped.getName();
+    }
+
+    @Override
+    public PropertyValue get(String key) {
+        return this.wrapped.get(key);
+    }
+
+    @Override
+    public Map<String, String> getProperties() {
+        return this.wrapped.getProperties();
+    }
+
+    @Override
+    public boolean isScannable() {
+        return this.wrapped.isScannable();
+    }
+
+    @Override
+    public String toString() {
+        return "RefreshablePropertySource{" +
+                "\n metaConfig=" + metaConfig +
+                "\n wrapped=" + wrapped +
+                '}';
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/52c572e8/metamodel/src/main/java/org/apache/tamaya/metamodel/ext/RefreshablePropertySourceProvider.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/ext/RefreshablePropertySourceProvider.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/ext/RefreshablePropertySourceProvider.java
new file mode 100644
index 0000000..e4e23cf
--- /dev/null
+++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/ext/RefreshablePropertySourceProvider.java
@@ -0,0 +1,107 @@
+/*
+ * 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.ext;
+
+import org.apache.tamaya.metamodel.Refreshable;
+import org.apache.tamaya.metamodel.internal.ComponentConfigurator;
+import org.apache.tamaya.spi.PropertySource;
+import org.apache.tamaya.spi.PropertySourceProvider;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Objects;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Wrapped property source provider that allows refreshing/reloading a property source provider. Hereby a provider must
+ * either
+ * <ul>
+ *     <li>have a public parameterless constructor, used for reloading a new instance.</li>
+ *     <li>implement itself {@link Refreshable}.</li>
+ * </ul>
+ */
+public final class RefreshablePropertySourceProvider
+        implements PropertySourceProvider, Refreshable {
+
+    private static final Logger LOG = Logger.getLogger(RefreshablePropertySourceProvider.class.getName());
+    private Map<String,String> metaConfig;
+    private PropertySourceProvider wrapped;
+    private Collection<PropertySource> propertSources;
+
+    private RefreshablePropertySourceProvider(Map<String,String> metaConfig, PropertySourceProvider wrapped) {
+        this.metaConfig = Objects.requireNonNull(metaConfig);
+        this.wrapped = Objects.requireNonNull(wrapped);
+        this.propertSources = Objects.requireNonNull(wrapped.getPropertySources());
+    }
+
+    /**
+     * Makes a property source provider refreshable. If the given property source provider is already an instance of
+     * RefreshablePropertySourceProvider, the property source provider is returned unchanged.
+     * @param metaConfig the configuration parameters to be applied when a new PropertySourceProvider is created, not null.
+     * @param provider the property source provider, not null.
+     * @return a new instance, not null.
+     */
+    public static RefreshablePropertySourceProvider of(Map<String,String> metaConfig, PropertySourceProvider provider) {
+        if(provider instanceof RefreshablePropertySourceProvider){
+            return (RefreshablePropertySourceProvider)provider;
+        }
+        return new RefreshablePropertySourceProvider(metaConfig, provider);
+    }
+
+    /**
+     * Makes a property source refreshable. If the given property source is already an instance of
+     * RefreshablePropertySource, the property source is returned.
+     * @param provider the property source provider, not null.
+     * @return a new instance, not null.
+     */
+    public static RefreshablePropertySourceProvider of(PropertySourceProvider provider) {
+        return of(Collections.<String, String>emptyMap(), provider);
+    }
+
+    @Override
+    public Collection<PropertySource> getPropertySources() {
+        return this.propertSources;
+    }
+
+    @Override
+    public void refresh() {
+        try {
+            if(this.wrapped instanceof Refreshable){
+                ((Refreshable) this.wrapped).refresh();
+            }else {
+                this.wrapped = this.wrapped.getClass().newInstance();
+                ComponentConfigurator.configure(this.wrapped, metaConfig);
+            }
+        } catch (Exception e) {
+            LOG.log(Level.WARNING, "Failed to refresh PropertySourceProvider: " +
+                    wrapped.getClass().getName(), e);
+        }
+        this.propertSources = Objects.requireNonNull(wrapped.getPropertySources());
+    }
+
+    @Override
+    public String toString() {
+        return "RefreshablePropertySourceProvider{" +
+                "\n metaConfig=" + metaConfig +
+                "\n wrapped=" + wrapped +
+                '}';
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/52c572e8/metamodel/src/main/java/org/apache/tamaya/metamodel/ext/package-info.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/ext/package-info.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/ext/package-info.java
new file mode 100644
index 0000000..42ab80b
--- /dev/null
+++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/ext/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+/**
+ * Main package containing extended functionality such as decorators and mixin-implementations
+ * provided to users.
+ */
+package org.apache.tamaya.metamodel.ext;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/52c572e8/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/ContextReader.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/ContextReader.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/ContextReader.java
index db72f13..5e74f75 100644
--- a/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/ContextReader.java
+++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/ContextReader.java
@@ -20,14 +20,21 @@ package org.apache.tamaya.metamodel.internal;
 
 import org.apache.tamaya.metamodel.MetaContext;
 import org.apache.tamaya.metamodel.spi.MetaConfigurationReader;
+import org.apache.tamaya.metamodel.spi.SimpleResolver;
 import org.apache.tamaya.spi.ConfigurationContextBuilder;
+import org.apache.tamaya.spi.ServiceContextManager;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
 import javax.annotation.Priority;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.logging.Logger;
 
+
 /**
  * Meta-configuration reader that reads the shared context data.
  */
@@ -36,6 +43,33 @@ public class ContextReader implements MetaConfigurationReader {
 
     private static final Logger LOG = Logger.getLogger(ContextReader.class.getName());
 
+    private Map<String,SimpleResolver> resolvers = new ConcurrentHashMap<>();
+
+    public ContextReader(){
+        for(SimpleResolver resolver: ServiceContextManager.getServiceContext()
+                .getServices(SimpleResolver.class)){
+            this.resolvers.put(resolver.getResolverId(), resolver);
+        }
+    }
+
+    public void addResolver(SimpleResolver resolver){
+        if(!this.resolvers.containsKey(resolver.getResolverId())) {
+            this.resolvers.put(resolver.getResolverId(), resolver);
+        }
+    }
+
+    public void removeResolver(SimpleResolver resolver){
+        this.resolvers.remove(resolver.getResolverId());
+    }
+
+    public Set<String> getResolverIds(){
+        return this.resolvers.keySet();
+    }
+
+    public SimpleResolver getResolver(String resolverKey){
+        return this.resolvers.get(resolverKey);
+    }
+
     @Override
     public void read(Document document, ConfigurationContextBuilder contextBuilder) {
         NodeList nodeList = document.getDocumentElement().getElementsByTagName("context");
@@ -55,7 +89,7 @@ public class ContextReader implements MetaConfigurationReader {
                     if("context-entry".equals(entryNode.getNodeName())){
                         String key = entryNode.getAttributes().getNamedItem("name").getNodeValue();
                         String value = entryNode.getTextContent();
-                        // TODO add support for placeholders here...
+                        resolvePlaceholders(value);
                         LOG.finest("Applying context entry: " + key + '=' + value + " on " + contextName);
                         context.setProperty(key, value);
                     }
@@ -63,4 +97,85 @@ public class ContextReader implements MetaConfigurationReader {
             }
         }
     }
+
+    private String resolvePlaceholders(String value) {
+        StringBuilder result = new StringBuilder();
+        StringBuilder exp = new StringBuilder();
+        final int INVALUE = 0;
+        final int BEFORE_EXP = 1;
+        final int INEXP = 2;
+        int state = INVALUE;
+        StringTokenizer tokenizer = new StringTokenizer(value, "${}", true);
+        while(tokenizer.hasMoreTokens()){
+            String token = tokenizer.nextToken();
+            switch(token){
+                case "$":
+                    switch(state){
+                        case INVALUE:
+                        default:
+                            state = BEFORE_EXP;
+                            break;
+                        case BEFORE_EXP: // escaped
+                            result.append(token);
+                            state = INVALUE;
+                            break;
+                        case INEXP:
+                            exp.append(token);
+                            break;
+                    }
+                    break;
+                case "{":
+                    switch(state){
+                        case BEFORE_EXP:
+                            state = INEXP;
+                            break;
+                        case INVALUE:
+                        case INEXP:
+                        default:
+                            result.append(token);
+                            break;
+                    }
+                case "}":
+                    switch(state){
+                        case INVALUE:
+                            result.append(token);
+                            break;
+                        case INEXP:
+                            result.append(evaluateExpression(exp.toString()));
+                            exp.setLength(0);
+                            state = INVALUE;
+                            break;
+                        case BEFORE_EXP:
+                            result.append("$").append(token);
+                            state = INVALUE;
+                            break;
+                    }
+                    break;
+                default:
+                    result.append(token);
+            }
+        }
+        return result.toString();
+    }
+
+    private String evaluateExpression(String exp) {
+        String[] parts = exp.split(":", 2);
+        if(parts.length<2){
+            return "--{MISSING RESOLVER ID in "+exp+"}";
+        }
+        SimpleResolver resolver = this.resolvers.get(parts[0]);
+        if(resolver==null){
+            return "--{NO RESOLVER FOUND for "+exp+"}";
+        }
+        try{
+            String resolved = resolver.evaluate(parts[1]);
+            if(resolved==null) {
+                return "--{NOT RESOLVABLE:" + exp + "}";
+            }else{
+                return resolved;
+            }
+        }catch(Exception e){
+            return "--{ERROR:"+exp+":"+e+"}";
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/52c572e8/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/PropertySourceReader.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/PropertySourceReader.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/PropertySourceReader.java
index b3f107c..ebcd8e0 100644
--- a/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/PropertySourceReader.java
+++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/PropertySourceReader.java
@@ -19,6 +19,10 @@
 package org.apache.tamaya.metamodel.internal;
 
 import org.apache.tamaya.metamodel.*;
+import org.apache.tamaya.metamodel.ext.EnabledPropertySourceProvider;
+import org.apache.tamaya.metamodel.ext.FilteredPropertySource;
+import org.apache.tamaya.metamodel.ext.RefreshablePropertySource;
+import org.apache.tamaya.metamodel.ext.RefreshablePropertySourceProvider;
 import org.apache.tamaya.metamodel.spi.ItemFactory;
 import org.apache.tamaya.metamodel.spi.ItemFactoryManager;
 import org.apache.tamaya.metamodel.spi.MetaConfigurationReader;

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/52c572e8/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/resolver/JavaResolver.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/resolver/JavaResolver.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/resolver/JavaResolver.java
new file mode 100644
index 0000000..6ad83e1
--- /dev/null
+++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/resolver/JavaResolver.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.tamaya.metamodel.internal.resolver;
+
+import org.apache.tamaya.metamodel.MetaContext;
+import org.apache.tamaya.metamodel.spi.SimpleResolver;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Objects;
+
+/**
+ * Simple resolver for {@link MetaContext} entries that
+ * reads data from system and environment properties.
+ *
+ * Valid inputs are:
+ * <ul>
+ *     <li>{@code ${properties:sys:key?default=abcval} } reading a system property.</li>
+ *     <li>{@code ${properties:env:key?default=abcval} } reading a environment property.</li>
+ *     <li>{@code ${properties:ctx:[ctxName:]key?default=abcval} } reading a <i>default</i> MetaContext entry.</li>
+ * </ul>
+ *
+ * Hereby the _default_ parameter defines the default value to be applied, if no value was found.
+ */
+public final class JavaResolver implements SimpleResolver{
+    @Override
+    public String getResolverId() {
+        return "java";
+    }
+
+    @Override
+    public String evaluate(String expression) {
+        String[] mainParts = expression.split("#");
+        if(mainParts.length<2){
+            return null;
+        }else{
+            try {
+                return evaluate(mainParts[0].trim(), mainParts[1].trim());
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        return null;
+    }
+
+    private String evaluate(String className, String methodName) throws Exception{
+        Objects.requireNonNull(className);
+        Objects.requireNonNull(methodName);
+        Class clazz = Class.forName(className);
+        Method method = clazz.getMethod(methodName);
+        if(Modifier.isStatic(method.getModifiers())){
+            if(!method.isAccessible()){
+                method.setAccessible(true);
+            }
+            return (String)method.invoke(null);
+        }
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/52c572e8/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/resolver/PropertiesResolver.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/resolver/PropertiesResolver.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/resolver/PropertiesResolver.java
new file mode 100644
index 0000000..4edbe3e
--- /dev/null
+++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/resolver/PropertiesResolver.java
@@ -0,0 +1,82 @@
+/*
+ * 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.internal.resolver;
+
+import org.apache.tamaya.metamodel.MetaContext;
+import org.apache.tamaya.metamodel.spi.SimpleResolver;
+
+import java.net.URI;
+
+/**
+ * Simple resolver for {@link org.apache.tamaya.metamodel.MetaContext} entries that
+ * reads data from system and environment properties.
+ *
+ * Valid inputs are:
+ * <ul>
+ *     <li>{@code ${properties:sys:key?default=abcval} } reading a system property.</li>
+ *     <li>{@code ${properties:env:key?default=abcval} } reading a environment property.</li>
+ *     <li>{@code ${properties:ctx:[ctxName:]key?default=abcval} } reading a <i>default</i> MetaContext entry.</li>
+ * </ul>
+ *
+ * Hereby the _default_ parameter defines the default value to be applied, if no value was found.
+ */
+public final class PropertiesResolver implements SimpleResolver{
+    @Override
+    public String getResolverId() {
+        return "properties";
+    }
+
+    @Override
+    public String evaluate(String expression) {
+        String[] mainParts = expression.split("\\?",2);
+        if(mainParts.length==1){
+            return evaluate(expression, null);
+        }else{
+            return evaluate(expression, mainParts[1].trim().substring("default=".length()));
+        }
+
+    }
+
+    private String evaluate(String expression, String defaultValue) {
+        String[] parts = expression.split(":", 2);
+        if(parts.length<2){
+            return null;
+        }
+        switch(parts[0]){
+            case "sys":
+                return System.getProperty(parts[1],defaultValue);
+            case "env":
+                String val = System.getenv(parts[1]);
+                if(val==null){
+                    return defaultValue;
+                }
+                return val;
+            case "ctx":
+                if(parts.length==3){
+                    return MetaContext.getInstance(parts[1])
+                            .getProperty(parts[2], defaultValue);
+                }else{
+                    return MetaContext.getDefaultInstance()
+                            .getProperty(parts[1], defaultValue);
+                }
+            default:
+                return null;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/52c572e8/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/SimpleResolver.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/SimpleResolver.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/SimpleResolver.java
new file mode 100644
index 0000000..9cb3065
--- /dev/null
+++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/SimpleResolver.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;
+
+/**
+ * SPI interface for implementations of simple expression types for use within
+ * {@link org.apache.tamaya.metamodel.MetaContext} meta-configuration entries.
+ */
+public interface SimpleResolver {
+
+    /**
+     * Get the expression id, which is the first part of an placeholder expression
+     * ({@code ${expressionId:expression}}).
+     * @return the expression id, never null.
+     */
+    String getResolverId();
+
+    /**
+     * Evaluate an expression.
+     * @param expression the expression.
+     * @return the result, or null.
+     */
+    String evaluate(String expression);
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/52c572e8/metamodel/src/main/resources/META-INF/services/org.apache.tamaya.metamodel.spi.SimpleResolver
----------------------------------------------------------------------
diff --git a/metamodel/src/main/resources/META-INF/services/org.apache.tamaya.metamodel.spi.SimpleResolver b/metamodel/src/main/resources/META-INF/services/org.apache.tamaya.metamodel.spi.SimpleResolver
new file mode 100644
index 0000000..b770ed9
--- /dev/null
+++ b/metamodel/src/main/resources/META-INF/services/org.apache.tamaya.metamodel.spi.SimpleResolver
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy 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.
+#
+org.apache.tamaya.metamodel.internal.resolver.JavaResolver
+org.apache.tamaya.metamodel.internal.resolver.PropertiesResolver
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/52c572e8/metamodel/src/test/java/org/apache/tamaya/metamodel/dsl/IntegrationTest.java
----------------------------------------------------------------------
diff --git a/metamodel/src/test/java/org/apache/tamaya/metamodel/dsl/IntegrationTest.java b/metamodel/src/test/java/org/apache/tamaya/metamodel/dsl/IntegrationTest.java
deleted file mode 100644
index 00e9f35..0000000
--- a/metamodel/src/test/java/org/apache/tamaya/metamodel/dsl/IntegrationTest.java
+++ /dev/null
@@ -1,57 +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.dsl;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.metamodel.MetaConfiguration;
-import org.junit.Test;
-
-import java.net.URL;
-
-import static junit.framework.TestCase.assertNotNull;
-import static junit.framework.TestCase.assertTrue;
-
-/**
- * Created by atsticks on 06.12.16.
- */
-public class IntegrationTest {
-
-    @Test
-    public void checkSystemLoads(){
-        assertNotNull(ConfigurationProvider.getConfiguration());
-        System.out.println(ConfigurationProvider.getConfiguration());
-    }
-
-    @Test
-    public void testEmptyConfig(){
-        Configuration config = MetaConfiguration.createConfiguration(getConfig("IntegrationTests/empty-config.xml"));
-        assertNotNull(config);
-        assertTrue(config.getProperties().isEmpty());
-        assertTrue(config.getContext().getPropertySources().isEmpty());
-        assertTrue(config.getContext().getPropertyConverters().isEmpty());
-        assertTrue(config.getContext().getPropertyFilters().isEmpty());
-    }
-
-    private URL getConfig(String resource) {
-        return getClass().getClassLoader().getResource(resource);
-    }
-
-}



Mime
View raw message