tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ple...@apache.org
Subject [01/18] incubator-tamaya-extensions git commit: [TAMAYA-175] Moved the content of the extension to the directory filter after extracting it from the Tamaya main repository.
Date Wed, 28 Sep 2016 22:16:01 GMT
Repository: incubator-tamaya-extensions
Updated Branches:
  refs/heads/master 36011cf4f -> d5633d0e0


[TAMAYA-175] Moved the content of the extension to the directory filter after extracting it from the Tamaya main repository.


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

Branch: refs/heads/master
Commit: d5633d0e01dddb63d6978a2a5a67e7c7273c8e21
Parents: 898df8c
Author: Oliver B. Fischer <plexus@apache.org>
Authored: Thu Sep 29 00:06:54 2016 +0200
Committer: Oliver B. Fischer <plexus@apache.org>
Committed: Thu Sep 29 00:15:51 2016 +0200

----------------------------------------------------------------------
 filter/pom.xml                                  |  81 +++++++++++
 .../tamaya/filter/ConfigurationFilter.java      | 121 ++++++++++++++++
 .../tamaya/filter/ProgrammableFilter.java       | 118 ++++++++++++++++
 .../tamaya/filter/RegexPropertyFilter.java      |  56 ++++++++
 .../filter/internal/DefaultMetadataFilter.java  |  43 ++++++
 .../org.apache.tamaya.spi.PropertyFilter        |  19 +++
 .../tamaya/filter/ConfigurationFilterTest.java  | 122 ++++++++++++++++
 .../tamaya/filter/ProgrammableFilterTest.java   | 141 +++++++++++++++++++
 .../tamaya/filter/RegexPropertyFilterTest.java  |  55 ++++++++
 pom.xml                                         |  81 -----------
 .../tamaya/filter/ConfigurationFilter.java      | 121 ----------------
 .../tamaya/filter/ProgrammableFilter.java       | 118 ----------------
 .../tamaya/filter/RegexPropertyFilter.java      |  56 --------
 .../filter/internal/DefaultMetadataFilter.java  |  43 ------
 .../org.apache.tamaya.spi.PropertyFilter        |  19 ---
 .../tamaya/filter/ConfigurationFilterTest.java  | 122 ----------------
 .../tamaya/filter/ProgrammableFilterTest.java   | 141 -------------------
 .../tamaya/filter/RegexPropertyFilterTest.java  |  55 --------
 18 files changed, 756 insertions(+), 756 deletions(-)
----------------------------------------------------------------------


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

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/d5633d0e/filter/src/main/java/org/apache/tamaya/filter/ConfigurationFilter.java
----------------------------------------------------------------------
diff --git a/filter/src/main/java/org/apache/tamaya/filter/ConfigurationFilter.java b/filter/src/main/java/org/apache/tamaya/filter/ConfigurationFilter.java
new file mode 100644
index 0000000..c2739a1
--- /dev/null
+++ b/filter/src/main/java/org/apache/tamaya/filter/ConfigurationFilter.java
@@ -0,0 +1,121 @@
+/*
+ * 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.filter;
+
+import org.apache.tamaya.spi.FilterContext;
+import org.apache.tamaya.spi.PropertyFilter;
+
+
+/**
+ * Hereby
+ * <ul>
+ *     <li><b>Single</b> filters are applied only when values are explicitly accessed. This is useful, e.g. for
+ *     filtering passwords into clear text variants. Nevertheless metadata keys hidden on map level must be
+ *     accessible (=not filtered) when accessed as single values.</li>
+ *     <li><b>Map</b> filters are applied when values are filtered as part of a full properties access.
+ *     Often filtering in these cases is more commonly applied, e.g. you dont want to show up all kind of metadata.
+ *     </li>
+ * </ul>
+ *     For both variants individual filter rules can be applied here. All filters configured are managed on a
+ *     thread-local level, so this class is typically used to temporarely filter out some values. Do not forget to
+ *     restore its state, when not using a thread anymore (especially important in multi-threaded environments), not
+ *     doing so will create nasty side effects of configuration not being visisble depending on the thread
+ *     active.
+ */
+public final class ConfigurationFilter implements PropertyFilter{
+
+    static final ThreadLocal<Boolean> THREADED_METADATA_FILTERED = new ThreadLocal<Boolean>(){
+        @Override
+        protected Boolean initialValue() {
+            return Boolean.TRUE;
+        }
+    };
+
+    private static final ThreadLocal<ProgrammableFilter> THREADED_MAP_FILTERS = new ThreadLocal<ProgrammableFilter>(){
+        @Override
+        protected ProgrammableFilter initialValue() {
+            return new ProgrammableFilter();
+        }
+    };
+
+    private static final ThreadLocal<ProgrammableFilter> THREADED_SINGLE_FILTERS = new ThreadLocal<ProgrammableFilter>(){
+        @Override
+        protected ProgrammableFilter initialValue() {
+            return new ProgrammableFilter();
+        }
+    };
+
+    /**
+     * Flag if metadata entries (starting with an '_') are filtered out on when accessing multiple properties, default
+     * is {@code true}.
+     * @return true, if metadata entries (starting with an '_') are to be filtered.
+     */
+    public static boolean isMetadataFiltered(){
+        return THREADED_METADATA_FILTERED.get();
+    }
+
+    /**
+     * Seactivates metadata filtering also on global map access for this thread.
+     * @see #clearFilters()
+     * @param filtered true,to enable metadata filtering (default).
+     */
+    public static void setMetadataFiltered(boolean filtered){
+        THREADED_METADATA_FILTERED.set(filtered);
+    }
+
+    /**
+     * Access the filtering configuration that is used for filtering single property values accessed.
+     * @return the filtering config, never null.
+     */
+    public static ProgrammableFilter getSingleFilters(){
+        return THREADED_SINGLE_FILTERS.get();
+    }
+
+    /**
+     * Access the filtering configuration that is used for filtering configuration properties accessed as full
+     * map.
+     * @return the filtering config, never null.
+     */
+    public static ProgrammableFilter getMapFilters(){
+        return THREADED_MAP_FILTERS.get();
+    }
+
+    /**
+     * Removes all programmable filters active on the current thread.
+     */
+    public static void clearFilters(){
+        THREADED_MAP_FILTERS.get().clearFilters();
+        THREADED_SINGLE_FILTERS.get().clearFilters();
+        THREADED_METADATA_FILTERED.set(true);
+    }
+
+    @Override
+    public String filterProperty(String valueToBeFiltered, FilterContext context) {
+        if(context.isSinglePropertyScoped()){
+            for(PropertyFilter pred: THREADED_SINGLE_FILTERS.get().getFilters()){
+                valueToBeFiltered = pred.filterProperty(valueToBeFiltered, context);
+            }
+        }else{
+            for(PropertyFilter pred: THREADED_MAP_FILTERS.get().getFilters()){
+                valueToBeFiltered = pred.filterProperty(valueToBeFiltered, context);
+            }
+        }
+        return valueToBeFiltered;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/d5633d0e/filter/src/main/java/org/apache/tamaya/filter/ProgrammableFilter.java
----------------------------------------------------------------------
diff --git a/filter/src/main/java/org/apache/tamaya/filter/ProgrammableFilter.java b/filter/src/main/java/org/apache/tamaya/filter/ProgrammableFilter.java
new file mode 100644
index 0000000..ec6040c
--- /dev/null
+++ b/filter/src/main/java/org/apache/tamaya/filter/ProgrammableFilter.java
@@ -0,0 +1,118 @@
+/*
+ * 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.filter;
+
+import org.apache.tamaya.spi.FilterContext;
+import org.apache.tamaya.spi.PropertyFilter;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * A set of property filter and accessor methods.
+ */
+public final class ProgrammableFilter implements PropertyFilter{
+    /** The filters. */
+    private List<PropertyFilter> filters = new ArrayList<>();
+
+    /**
+     * Add a filter.
+     * @param filter the filter.
+     */
+    public void addFilter(PropertyFilter filter){
+        filters.add(filter);
+    }
+
+    /**
+     * Adds a filter at given position.
+     * @param pos the position.
+     * @param filter the filter.
+     */
+    public void addFilter(int pos, PropertyFilter filter){
+        filters.add(pos, filter);
+    }
+
+    /**
+     * Removes a filter at a given position.
+     * @param pos the position.
+     * @return the filter removed, or null.
+     */
+    public PropertyFilter removeFilter(int pos){
+        return filters.remove(pos);
+    }
+
+    /**
+     * Removes a filter.
+     * @param filter the filter to be removed, not null.
+     */
+    public void removeFilter(PropertyFilter filter) {
+        filters.remove(filter);
+    }
+
+    /**
+     * Clears all filters.
+     */
+    public void clearFilters(){
+        filters.clear();
+    }
+
+    /**
+     * Set the filters.
+     * @param filters the filters to be applied.
+     */
+    public void setFilters(PropertyFilter... filters){
+        setFilters(Arrays.asList(filters));
+    }
+
+    /**
+     * Set the filters.
+     * @param filters the filters to be applied.
+     */
+    public void setFilters(Collection<PropertyFilter> filters) {
+        this.filters.clear();
+        this.filters.addAll(filters);
+    }
+
+    /**
+     * Get all filters.
+     * @return all filters.
+     */
+    public List<PropertyFilter> getFilters(){
+        return Collections.unmodifiableList(filters);
+    }
+
+    @Override
+    public String filterProperty(String valueToBeFiltered, FilterContext context) {
+        for(PropertyFilter filter:filters){
+            valueToBeFiltered = filter.filterProperty(valueToBeFiltered, context);
+        }
+        return valueToBeFiltered;
+    }
+
+    @Override
+    public String toString() {
+        return "ProgrammableFilter{" +
+                "filters=" + filters +
+                '}';
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/d5633d0e/filter/src/main/java/org/apache/tamaya/filter/RegexPropertyFilter.java
----------------------------------------------------------------------
diff --git a/filter/src/main/java/org/apache/tamaya/filter/RegexPropertyFilter.java b/filter/src/main/java/org/apache/tamaya/filter/RegexPropertyFilter.java
new file mode 100644
index 0000000..1ed43ba
--- /dev/null
+++ b/filter/src/main/java/org/apache/tamaya/filter/RegexPropertyFilter.java
@@ -0,0 +1,56 @@
+/*
+ * 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.filter;
+
+import org.apache.tamaya.spi.FilterContext;
+import org.apache.tamaya.spi.PropertyFilter;
+
+import java.util.Objects;
+
+/**
+ * Predicate filtering using a regex expression operating on the key.
+ */
+public final class RegexPropertyFilter implements PropertyFilter{
+    /** The expression used to filter. */
+    private String expression;
+
+    /**
+     * Creates a new regex filter expression.
+     * @param expression the reged expression, not null.
+     */
+    public RegexPropertyFilter(String expression){
+        this.expression = Objects.requireNonNull(expression);
+    }
+
+    @Override
+    public String filterProperty(String valueToBeFiltered, FilterContext context) {
+        if(context.getKey().matches(expression)){
+            return null;
+        }
+        return valueToBeFiltered;
+    }
+
+    @Override
+    public String toString() {
+        return "RegexPropertyFilter{" +
+                "expression='" + expression + '\'' +
+                '}';
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/d5633d0e/filter/src/main/java/org/apache/tamaya/filter/internal/DefaultMetadataFilter.java
----------------------------------------------------------------------
diff --git a/filter/src/main/java/org/apache/tamaya/filter/internal/DefaultMetadataFilter.java b/filter/src/main/java/org/apache/tamaya/filter/internal/DefaultMetadataFilter.java
new file mode 100644
index 0000000..95e9d25
--- /dev/null
+++ b/filter/src/main/java/org/apache/tamaya/filter/internal/DefaultMetadataFilter.java
@@ -0,0 +1,43 @@
+/*
+ * 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.filter.internal;
+
+import org.apache.tamaya.filter.ConfigurationFilter;
+import org.apache.tamaya.spi.FilterContext;
+import org.apache.tamaya.spi.PropertyFilter;
+
+/**
+ * Default property filter that hides metadta entries starting with an '_', similar ti {@code etcd}.
+ */
+public final class DefaultMetadataFilter implements PropertyFilter{
+    @Override
+    public String filterProperty(String valueToBeFiltered, FilterContext context) {
+        if(context.isSinglePropertyScoped()){
+            // When accessing keys explicitly, do not hide anything.
+            return valueToBeFiltered;
+        }
+        if(ConfigurationFilter.isMetadataFiltered()) {
+            if (context.getKey().startsWith("_")) {
+                // Hide metadata entries.
+                return null;
+            }
+        }
+        return valueToBeFiltered;
+    }
+}

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

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/d5633d0e/filter/src/test/java/org/apache/tamaya/filter/ConfigurationFilterTest.java
----------------------------------------------------------------------
diff --git a/filter/src/test/java/org/apache/tamaya/filter/ConfigurationFilterTest.java b/filter/src/test/java/org/apache/tamaya/filter/ConfigurationFilterTest.java
new file mode 100644
index 0000000..9d0da1f
--- /dev/null
+++ b/filter/src/test/java/org/apache/tamaya/filter/ConfigurationFilterTest.java
@@ -0,0 +1,122 @@
+/*
+ * 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.filter;
+
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.spi.FilterContext;
+import org.apache.tamaya.spi.PropertyFilter;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Tests for {@link ConfigurationFilter}. Created by atsticks on 11.02.16.
+ */
+public class ConfigurationFilterTest {
+
+    @Test
+    public void testMetadataFiltered() throws Exception {
+        ConfigurationFilter.setMetadataFiltered(true);
+        assertTrue(ConfigurationFilter.isMetadataFiltered());
+        ConfigurationFilter.setMetadataFiltered(false);
+        assertFalse(ConfigurationFilter.isMetadataFiltered());
+    }
+
+    @Test
+    public void testGetSingleFilters() throws Exception {
+        Configuration config = ConfigurationProvider.getConfiguration();
+        assertNotNull(ConfigurationFilter.getSingleFilters());
+        PropertyFilter testFilter = new PropertyFilter() {
+            @Override
+            public String filterProperty(String value, FilterContext context) {
+                return context.getKey() + ":testGetSingleFilters";
+            }
+        };
+        ConfigurationFilter.getSingleFilters().addFilter(testFilter);
+        assertEquals("user.home:testGetSingleFilters", config.get("user.home"));
+        ConfigurationFilter.getSingleFilters().removeFilter(testFilter);
+        assertNotSame("user.home:testGetSingleFilters", config.get("user.home"));
+    }
+
+    @Test
+    public void testRemoveSingleFiltersAt0() throws Exception {
+        Configuration config = ConfigurationProvider.getConfiguration();
+        assertNotNull(ConfigurationFilter.getSingleFilters());
+        PropertyFilter testFilter = new PropertyFilter() {
+            @Override
+            public String filterProperty(String value, FilterContext context) {
+                return context.getKey() + ":testGetSingleFilters";
+            }
+        };
+        ConfigurationFilter.getSingleFilters().addFilter(testFilter);
+        assertEquals("user.home:testGetSingleFilters", config.get("user.home"));
+        ConfigurationFilter.getSingleFilters().removeFilter(0);
+        assertNotSame("user.home:testGetSingleFilters", config.get("user.home"));
+    }
+
+    @Test
+    public void testGetMapFilters() throws Exception {
+        Configuration config = ConfigurationProvider.getConfiguration();
+        assertNotNull(ConfigurationFilter.getMapFilters());
+        PropertyFilter testFilter = new PropertyFilter() {
+            @Override
+            public String filterProperty(String value, FilterContext context) {
+                return context.getKey() + ":testGetMapFilters";
+            }
+        };
+        ConfigurationFilter.getMapFilters().addFilter(testFilter);
+        assertEquals("user.home:testGetMapFilters", config.getProperties().get("user.home"));
+        ConfigurationFilter.getSingleFilters().removeFilter(testFilter);
+        assertNotSame("user.home:testGetSingleFilters", config.getProperties().get("user.home"));
+    }
+
+    @Test
+    public void testRemoveMapFilterAt0() throws Exception {
+        Configuration config = ConfigurationProvider.getConfiguration();
+        assertNotNull(ConfigurationFilter.getMapFilters());
+        PropertyFilter testFilter = new PropertyFilter() {
+            @Override
+            public String filterProperty(String value, FilterContext context) {
+                return context.getKey() + ":testGetMapFilters";
+            }
+        };
+        ConfigurationFilter.getMapFilters().addFilter(testFilter);
+        assertEquals("user.home:testGetMapFilters", config.getProperties().get("user.home"));
+        ConfigurationFilter.getMapFilters().removeFilter(0);
+        assertNotSame("user.home:testGetSingleFilters", config.getProperties().get("user.home"));
+    }
+
+    @Test
+    public void testClearFilters() throws Exception {
+        Configuration config = ConfigurationProvider.getConfiguration();
+        assertNotNull(ConfigurationFilter.getSingleFilters());
+        PropertyFilter testFilter = new PropertyFilter() {
+            @Override
+            public String filterProperty(String value, FilterContext context) {
+                return context.getKey() + ":testGetSingleFilters";
+            }
+        };
+        ConfigurationFilter.getSingleFilters().addFilter(testFilter);
+        assertEquals("user.home:testGetSingleFilters", config.get("user.home"));
+        ConfigurationFilter.clearFilters();
+        assertNotSame("user.home:testGetSingleFilters", config.get("user.home"));
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/d5633d0e/filter/src/test/java/org/apache/tamaya/filter/ProgrammableFilterTest.java
----------------------------------------------------------------------
diff --git a/filter/src/test/java/org/apache/tamaya/filter/ProgrammableFilterTest.java b/filter/src/test/java/org/apache/tamaya/filter/ProgrammableFilterTest.java
new file mode 100644
index 0000000..73db677
--- /dev/null
+++ b/filter/src/test/java/org/apache/tamaya/filter/ProgrammableFilterTest.java
@@ -0,0 +1,141 @@
+/*
+ * 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.filter;
+
+import org.apache.tamaya.spi.FilterContext;
+import org.apache.tamaya.spi.PropertyFilter;
+import org.junit.Test;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.Assert.*;
+
+/**
+ * Tests for {@link ProgrammableFilter}. Created by atsticks on 11.02.16.
+ */
+public class ProgrammableFilterTest {
+
+    @Test
+    public void testAddRemoveFilter() throws Exception {
+        ProgrammableFilter filter = new ProgrammableFilter();
+        RegexPropertyFilter regexFilter = new RegexPropertyFilter("test\\..*");
+        Map<String,String> map = new HashMap<>();
+        map.put("test1", "test1");
+        map.put("test2", "test2");
+        map.put("test.test3", "test.test3");
+        assertEquals(filter.filterProperty("test1", new FilterContext("test1", map, true)), "test1");
+        assertEquals(filter.filterProperty("test2", new FilterContext("test2", map, true)), "test2");
+        assertEquals(filter.filterProperty("test.test3", new FilterContext("test.test3", map, true)), "test.test3");
+        filter.addFilter(regexFilter);
+        assertEquals(filter.filterProperty("test1", new FilterContext("test1", map, true)), "test1");
+        assertEquals(filter.filterProperty("test2", new FilterContext("test2", map, true)), "test2");
+        assertNull(filter.filterProperty("test.test3", new FilterContext("test.test3", map, true)));
+        filter.removeFilter(0);
+        assertEquals(filter.filterProperty("test1", new FilterContext("test1", map, true)), "test1");
+        assertEquals(filter.filterProperty("test2", new FilterContext("test2", map, true)), "test2");
+        assertEquals(filter.filterProperty("test.test3", new FilterContext("test.test3", map, true)), "test.test3");
+        filter.addFilter(0, regexFilter);
+        assertEquals(filter.filterProperty("test1", new FilterContext("test1", map, true)), "test1");
+        assertEquals(filter.filterProperty("test2", new FilterContext("test2", map, true)), "test2");
+        assertNull(filter.filterProperty("test.test3", new FilterContext("test.test3", map, true)));
+    }
+
+    @Test
+    public void testClearFilters() throws Exception {
+        ProgrammableFilter filter = new ProgrammableFilter();
+        RegexPropertyFilter regexFilter = new RegexPropertyFilter("test\\..*");
+        Map<String,String> map = new HashMap<>();
+        map.put("test1", "test1");
+        map.put("test2", "test2");
+        map.put("test.test3", "test.test3");
+        assertEquals(filter.filterProperty("test1", new FilterContext("test1", map, true)), "test1");
+        assertEquals(filter.filterProperty("test2", new FilterContext("test2", map, true)), "test2");
+        assertEquals(filter.filterProperty("test.test3", new FilterContext("test.test3", map, true)), "test.test3");
+        filter.addFilter(regexFilter);
+        assertEquals(filter.filterProperty("test1", new FilterContext("test1", map, true)), "test1");
+        assertEquals(filter.filterProperty("test2", new FilterContext("test2", map, true)), "test2");
+        assertNull(filter.filterProperty("test.test3", new FilterContext("test.test3", map, true)));
+        filter.clearFilters();
+        assertEquals(filter.filterProperty("test1", new FilterContext("test1", map, true)), "test1");
+        assertEquals(filter.filterProperty("test2", new FilterContext("test2", map, true)), "test2");
+        assertEquals(filter.filterProperty("test.test3", new FilterContext("test.test3", map, true)), "test.test3");
+    }
+
+    @Test
+    public void testSetFilters() throws Exception {
+        ProgrammableFilter filter = new ProgrammableFilter();
+        RegexPropertyFilter regexFilter = new RegexPropertyFilter("test\\..*");
+        Map<String,String> map = new HashMap<>();
+        map.put("test1", "test1");
+        map.put("test2", "test2");
+        map.put("test.test3", "test.test3");
+        assertEquals(filter.filterProperty("test1", new FilterContext("test1", map, true)), "test1");
+        assertEquals(filter.filterProperty("test2", new FilterContext("test2", map, true)), "test2");
+        assertEquals(filter.filterProperty("test.test3", new FilterContext("test.test3", map, true)), "test.test3");
+        filter.setFilters(regexFilter);
+        assertEquals(filter.filterProperty("test1", new FilterContext("test1", map, true)), "test1");
+        assertEquals(filter.filterProperty("test2", new FilterContext("test2", map, true)), "test2");
+        assertNull(filter.filterProperty("test.test3", new FilterContext("test.test3", map, true)));
+    }
+
+    @Test
+    public void testSetFilters1() throws Exception {
+        ProgrammableFilter filter = new ProgrammableFilter();
+        RegexPropertyFilter regexFilter = new RegexPropertyFilter("test\\..*");
+        Map<String,String> map = new HashMap<>();
+        map.put("test1", "test1");
+        map.put("test2", "test2");
+        map.put("test.test3", "test.test3");
+        assertEquals(filter.filterProperty("test1", new FilterContext("test1", map, true)), "test1");
+        assertEquals(filter.filterProperty("test2", new FilterContext("test2", map, true)), "test2");
+        assertEquals(filter.filterProperty("test.test3", new FilterContext("test.test3", map, true)), "test.test3");
+        filter.setFilters(Arrays.asList(new PropertyFilter[]{regexFilter}));
+        assertEquals(filter.filterProperty("test1", new FilterContext("test1", map, true)), "test1");
+        assertEquals(filter.filterProperty("test2", new FilterContext("test2", map, true)), "test2");
+        assertNull(filter.filterProperty("test.test3", new FilterContext("test.test3", map, true)));
+    }
+
+    @Test
+    public void testGetFilters() throws Exception {
+        ProgrammableFilter filter = new ProgrammableFilter();
+        assertNotNull(filter.getFilters());
+        assertTrue(filter.getFilters().isEmpty());
+        RegexPropertyFilter regexFilter = new RegexPropertyFilter("test\\..*");
+        filter.addFilter(regexFilter);
+        assertNotNull(filter.getFilters());
+        assertFalse(filter.getFilters().isEmpty());
+        assertEquals(1, filter.getFilters().size());
+        assertEquals(regexFilter, filter.getFilters().get(0));
+    }
+
+    @Test
+    public void testToString() throws Exception {
+        ProgrammableFilter filter = new ProgrammableFilter();
+        assertFalse(filter.toString().contains("test\\..*"));
+        assertTrue(filter.toString().contains("ProgrammableFilter"));
+        assertFalse(filter.toString().contains("RegexPropertyFilter"));
+        RegexPropertyFilter regexFilter = new RegexPropertyFilter("test\\..*");
+        filter.addFilter(regexFilter);
+        assertTrue(filter.toString().contains("test\\..*"));
+        assertTrue(filter.toString().contains("ProgrammableFilter"));
+        assertTrue(filter.toString().contains("RegexPropertyFilter"));
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/d5633d0e/filter/src/test/java/org/apache/tamaya/filter/RegexPropertyFilterTest.java
----------------------------------------------------------------------
diff --git a/filter/src/test/java/org/apache/tamaya/filter/RegexPropertyFilterTest.java b/filter/src/test/java/org/apache/tamaya/filter/RegexPropertyFilterTest.java
new file mode 100644
index 0000000..a560b04
--- /dev/null
+++ b/filter/src/test/java/org/apache/tamaya/filter/RegexPropertyFilterTest.java
@@ -0,0 +1,55 @@
+/*
+ * 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.filter;
+
+import org.apache.tamaya.spi.FilterContext;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.Assert.*;
+
+/**
+ * Tests for {@link RegexPropertyFilter}. Created by anatole on 11.02.16.
+ */
+public class RegexPropertyFilterTest {
+
+    @org.junit.Test
+    public void testFilterProperty() throws Exception {
+        RegexPropertyFilter filter = new RegexPropertyFilter("test\\..*");
+        Map<String,String> map = new HashMap<>();
+        map.put("test1", "test1");
+        map.put("test2", "test2");
+        map.put("test.test3", "test.test3");
+        assertEquals(filter.filterProperty("test1", new FilterContext("test1", map, true)), "test1");
+        assertEquals(filter.filterProperty("test2", new FilterContext("test2", map, true)), "test2");
+        assertNull(filter.filterProperty("test.test3", new FilterContext("test.test3", map, true)));
+        filter = new RegexPropertyFilter(".*");
+        assertNull(filter.filterProperty("test1", new FilterContext("test1", map, true)));
+        assertNull(filter.filterProperty("test2", new FilterContext("test2", map, true)));
+        assertNull(filter.filterProperty("test.test3", new FilterContext("test.test3", map, true)));
+    }
+
+    @org.junit.Test
+    public void testToString() throws Exception {
+        RegexPropertyFilter filter = new RegexPropertyFilter("test\\..*");
+        assertTrue(filter.toString().contains("test\\..*"));
+        assertTrue(filter.toString().contains("RegexPropertyFilter"));
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/d5633d0e/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index d9d4854..0000000
--- a/pom.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy current the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.apache.tamaya.ext</groupId>
-        <artifactId>tamaya-extensions</artifactId>
-        <version>0.3-incubating-SNAPSHOT</version>
-    </parent>
-
-    <artifactId>tamaya-filter</artifactId>
-    <name>Apache Tamaya Modules - Adaptive Configuration Filtering</name>
-    <packaging>bundle</packaging>
-
-    <properties>
-        <jdkVersion>1.7</jdkVersion>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.tamaya</groupId>
-            <artifactId>tamaya-api</artifactId>
-            <version>${project.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.tamaya</groupId>
-            <artifactId>tamaya-core</artifactId>
-            <version>${project.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.hamcrest</groupId>
-            <artifactId>java-hamcrest</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <extensions>true</extensions>
-                <configuration>
-                    <instructions>
-                        <Export-Package>
-                            org.apache.tamaya.filter,
-                        </Export-Package>
-                        <!--<Private-Package>-->
-                            <!--org.apache.tamaya.events.internal-->
-                        <!--</Private-Package>-->
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-    
-</project>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/d5633d0e/src/main/java/org/apache/tamaya/filter/ConfigurationFilter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tamaya/filter/ConfigurationFilter.java b/src/main/java/org/apache/tamaya/filter/ConfigurationFilter.java
deleted file mode 100644
index c2739a1..0000000
--- a/src/main/java/org/apache/tamaya/filter/ConfigurationFilter.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.filter;
-
-import org.apache.tamaya.spi.FilterContext;
-import org.apache.tamaya.spi.PropertyFilter;
-
-
-/**
- * Hereby
- * <ul>
- *     <li><b>Single</b> filters are applied only when values are explicitly accessed. This is useful, e.g. for
- *     filtering passwords into clear text variants. Nevertheless metadata keys hidden on map level must be
- *     accessible (=not filtered) when accessed as single values.</li>
- *     <li><b>Map</b> filters are applied when values are filtered as part of a full properties access.
- *     Often filtering in these cases is more commonly applied, e.g. you dont want to show up all kind of metadata.
- *     </li>
- * </ul>
- *     For both variants individual filter rules can be applied here. All filters configured are managed on a
- *     thread-local level, so this class is typically used to temporarely filter out some values. Do not forget to
- *     restore its state, when not using a thread anymore (especially important in multi-threaded environments), not
- *     doing so will create nasty side effects of configuration not being visisble depending on the thread
- *     active.
- */
-public final class ConfigurationFilter implements PropertyFilter{
-
-    static final ThreadLocal<Boolean> THREADED_METADATA_FILTERED = new ThreadLocal<Boolean>(){
-        @Override
-        protected Boolean initialValue() {
-            return Boolean.TRUE;
-        }
-    };
-
-    private static final ThreadLocal<ProgrammableFilter> THREADED_MAP_FILTERS = new ThreadLocal<ProgrammableFilter>(){
-        @Override
-        protected ProgrammableFilter initialValue() {
-            return new ProgrammableFilter();
-        }
-    };
-
-    private static final ThreadLocal<ProgrammableFilter> THREADED_SINGLE_FILTERS = new ThreadLocal<ProgrammableFilter>(){
-        @Override
-        protected ProgrammableFilter initialValue() {
-            return new ProgrammableFilter();
-        }
-    };
-
-    /**
-     * Flag if metadata entries (starting with an '_') are filtered out on when accessing multiple properties, default
-     * is {@code true}.
-     * @return true, if metadata entries (starting with an '_') are to be filtered.
-     */
-    public static boolean isMetadataFiltered(){
-        return THREADED_METADATA_FILTERED.get();
-    }
-
-    /**
-     * Seactivates metadata filtering also on global map access for this thread.
-     * @see #clearFilters()
-     * @param filtered true,to enable metadata filtering (default).
-     */
-    public static void setMetadataFiltered(boolean filtered){
-        THREADED_METADATA_FILTERED.set(filtered);
-    }
-
-    /**
-     * Access the filtering configuration that is used for filtering single property values accessed.
-     * @return the filtering config, never null.
-     */
-    public static ProgrammableFilter getSingleFilters(){
-        return THREADED_SINGLE_FILTERS.get();
-    }
-
-    /**
-     * Access the filtering configuration that is used for filtering configuration properties accessed as full
-     * map.
-     * @return the filtering config, never null.
-     */
-    public static ProgrammableFilter getMapFilters(){
-        return THREADED_MAP_FILTERS.get();
-    }
-
-    /**
-     * Removes all programmable filters active on the current thread.
-     */
-    public static void clearFilters(){
-        THREADED_MAP_FILTERS.get().clearFilters();
-        THREADED_SINGLE_FILTERS.get().clearFilters();
-        THREADED_METADATA_FILTERED.set(true);
-    }
-
-    @Override
-    public String filterProperty(String valueToBeFiltered, FilterContext context) {
-        if(context.isSinglePropertyScoped()){
-            for(PropertyFilter pred: THREADED_SINGLE_FILTERS.get().getFilters()){
-                valueToBeFiltered = pred.filterProperty(valueToBeFiltered, context);
-            }
-        }else{
-            for(PropertyFilter pred: THREADED_MAP_FILTERS.get().getFilters()){
-                valueToBeFiltered = pred.filterProperty(valueToBeFiltered, context);
-            }
-        }
-        return valueToBeFiltered;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/d5633d0e/src/main/java/org/apache/tamaya/filter/ProgrammableFilter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tamaya/filter/ProgrammableFilter.java b/src/main/java/org/apache/tamaya/filter/ProgrammableFilter.java
deleted file mode 100644
index ec6040c..0000000
--- a/src/main/java/org/apache/tamaya/filter/ProgrammableFilter.java
+++ /dev/null
@@ -1,118 +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.filter;
-
-import org.apache.tamaya.spi.FilterContext;
-import org.apache.tamaya.spi.PropertyFilter;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * A set of property filter and accessor methods.
- */
-public final class ProgrammableFilter implements PropertyFilter{
-    /** The filters. */
-    private List<PropertyFilter> filters = new ArrayList<>();
-
-    /**
-     * Add a filter.
-     * @param filter the filter.
-     */
-    public void addFilter(PropertyFilter filter){
-        filters.add(filter);
-    }
-
-    /**
-     * Adds a filter at given position.
-     * @param pos the position.
-     * @param filter the filter.
-     */
-    public void addFilter(int pos, PropertyFilter filter){
-        filters.add(pos, filter);
-    }
-
-    /**
-     * Removes a filter at a given position.
-     * @param pos the position.
-     * @return the filter removed, or null.
-     */
-    public PropertyFilter removeFilter(int pos){
-        return filters.remove(pos);
-    }
-
-    /**
-     * Removes a filter.
-     * @param filter the filter to be removed, not null.
-     */
-    public void removeFilter(PropertyFilter filter) {
-        filters.remove(filter);
-    }
-
-    /**
-     * Clears all filters.
-     */
-    public void clearFilters(){
-        filters.clear();
-    }
-
-    /**
-     * Set the filters.
-     * @param filters the filters to be applied.
-     */
-    public void setFilters(PropertyFilter... filters){
-        setFilters(Arrays.asList(filters));
-    }
-
-    /**
-     * Set the filters.
-     * @param filters the filters to be applied.
-     */
-    public void setFilters(Collection<PropertyFilter> filters) {
-        this.filters.clear();
-        this.filters.addAll(filters);
-    }
-
-    /**
-     * Get all filters.
-     * @return all filters.
-     */
-    public List<PropertyFilter> getFilters(){
-        return Collections.unmodifiableList(filters);
-    }
-
-    @Override
-    public String filterProperty(String valueToBeFiltered, FilterContext context) {
-        for(PropertyFilter filter:filters){
-            valueToBeFiltered = filter.filterProperty(valueToBeFiltered, context);
-        }
-        return valueToBeFiltered;
-    }
-
-    @Override
-    public String toString() {
-        return "ProgrammableFilter{" +
-                "filters=" + filters +
-                '}';
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/d5633d0e/src/main/java/org/apache/tamaya/filter/RegexPropertyFilter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tamaya/filter/RegexPropertyFilter.java b/src/main/java/org/apache/tamaya/filter/RegexPropertyFilter.java
deleted file mode 100644
index 1ed43ba..0000000
--- a/src/main/java/org/apache/tamaya/filter/RegexPropertyFilter.java
+++ /dev/null
@@ -1,56 +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.filter;
-
-import org.apache.tamaya.spi.FilterContext;
-import org.apache.tamaya.spi.PropertyFilter;
-
-import java.util.Objects;
-
-/**
- * Predicate filtering using a regex expression operating on the key.
- */
-public final class RegexPropertyFilter implements PropertyFilter{
-    /** The expression used to filter. */
-    private String expression;
-
-    /**
-     * Creates a new regex filter expression.
-     * @param expression the reged expression, not null.
-     */
-    public RegexPropertyFilter(String expression){
-        this.expression = Objects.requireNonNull(expression);
-    }
-
-    @Override
-    public String filterProperty(String valueToBeFiltered, FilterContext context) {
-        if(context.getKey().matches(expression)){
-            return null;
-        }
-        return valueToBeFiltered;
-    }
-
-    @Override
-    public String toString() {
-        return "RegexPropertyFilter{" +
-                "expression='" + expression + '\'' +
-                '}';
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/d5633d0e/src/main/java/org/apache/tamaya/filter/internal/DefaultMetadataFilter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tamaya/filter/internal/DefaultMetadataFilter.java b/src/main/java/org/apache/tamaya/filter/internal/DefaultMetadataFilter.java
deleted file mode 100644
index 95e9d25..0000000
--- a/src/main/java/org/apache/tamaya/filter/internal/DefaultMetadataFilter.java
+++ /dev/null
@@ -1,43 +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.filter.internal;
-
-import org.apache.tamaya.filter.ConfigurationFilter;
-import org.apache.tamaya.spi.FilterContext;
-import org.apache.tamaya.spi.PropertyFilter;
-
-/**
- * Default property filter that hides metadta entries starting with an '_', similar ti {@code etcd}.
- */
-public final class DefaultMetadataFilter implements PropertyFilter{
-    @Override
-    public String filterProperty(String valueToBeFiltered, FilterContext context) {
-        if(context.isSinglePropertyScoped()){
-            // When accessing keys explicitly, do not hide anything.
-            return valueToBeFiltered;
-        }
-        if(ConfigurationFilter.isMetadataFiltered()) {
-            if (context.getKey().startsWith("_")) {
-                // Hide metadata entries.
-                return null;
-            }
-        }
-        return valueToBeFiltered;
-    }
-}

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

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/d5633d0e/src/test/java/org/apache/tamaya/filter/ConfigurationFilterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/tamaya/filter/ConfigurationFilterTest.java b/src/test/java/org/apache/tamaya/filter/ConfigurationFilterTest.java
deleted file mode 100644
index 9d0da1f..0000000
--- a/src/test/java/org/apache/tamaya/filter/ConfigurationFilterTest.java
+++ /dev/null
@@ -1,122 +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.filter;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.spi.FilterContext;
-import org.apache.tamaya.spi.PropertyFilter;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests for {@link ConfigurationFilter}. Created by atsticks on 11.02.16.
- */
-public class ConfigurationFilterTest {
-
-    @Test
-    public void testMetadataFiltered() throws Exception {
-        ConfigurationFilter.setMetadataFiltered(true);
-        assertTrue(ConfigurationFilter.isMetadataFiltered());
-        ConfigurationFilter.setMetadataFiltered(false);
-        assertFalse(ConfigurationFilter.isMetadataFiltered());
-    }
-
-    @Test
-    public void testGetSingleFilters() throws Exception {
-        Configuration config = ConfigurationProvider.getConfiguration();
-        assertNotNull(ConfigurationFilter.getSingleFilters());
-        PropertyFilter testFilter = new PropertyFilter() {
-            @Override
-            public String filterProperty(String value, FilterContext context) {
-                return context.getKey() + ":testGetSingleFilters";
-            }
-        };
-        ConfigurationFilter.getSingleFilters().addFilter(testFilter);
-        assertEquals("user.home:testGetSingleFilters", config.get("user.home"));
-        ConfigurationFilter.getSingleFilters().removeFilter(testFilter);
-        assertNotSame("user.home:testGetSingleFilters", config.get("user.home"));
-    }
-
-    @Test
-    public void testRemoveSingleFiltersAt0() throws Exception {
-        Configuration config = ConfigurationProvider.getConfiguration();
-        assertNotNull(ConfigurationFilter.getSingleFilters());
-        PropertyFilter testFilter = new PropertyFilter() {
-            @Override
-            public String filterProperty(String value, FilterContext context) {
-                return context.getKey() + ":testGetSingleFilters";
-            }
-        };
-        ConfigurationFilter.getSingleFilters().addFilter(testFilter);
-        assertEquals("user.home:testGetSingleFilters", config.get("user.home"));
-        ConfigurationFilter.getSingleFilters().removeFilter(0);
-        assertNotSame("user.home:testGetSingleFilters", config.get("user.home"));
-    }
-
-    @Test
-    public void testGetMapFilters() throws Exception {
-        Configuration config = ConfigurationProvider.getConfiguration();
-        assertNotNull(ConfigurationFilter.getMapFilters());
-        PropertyFilter testFilter = new PropertyFilter() {
-            @Override
-            public String filterProperty(String value, FilterContext context) {
-                return context.getKey() + ":testGetMapFilters";
-            }
-        };
-        ConfigurationFilter.getMapFilters().addFilter(testFilter);
-        assertEquals("user.home:testGetMapFilters", config.getProperties().get("user.home"));
-        ConfigurationFilter.getSingleFilters().removeFilter(testFilter);
-        assertNotSame("user.home:testGetSingleFilters", config.getProperties().get("user.home"));
-    }
-
-    @Test
-    public void testRemoveMapFilterAt0() throws Exception {
-        Configuration config = ConfigurationProvider.getConfiguration();
-        assertNotNull(ConfigurationFilter.getMapFilters());
-        PropertyFilter testFilter = new PropertyFilter() {
-            @Override
-            public String filterProperty(String value, FilterContext context) {
-                return context.getKey() + ":testGetMapFilters";
-            }
-        };
-        ConfigurationFilter.getMapFilters().addFilter(testFilter);
-        assertEquals("user.home:testGetMapFilters", config.getProperties().get("user.home"));
-        ConfigurationFilter.getMapFilters().removeFilter(0);
-        assertNotSame("user.home:testGetSingleFilters", config.getProperties().get("user.home"));
-    }
-
-    @Test
-    public void testClearFilters() throws Exception {
-        Configuration config = ConfigurationProvider.getConfiguration();
-        assertNotNull(ConfigurationFilter.getSingleFilters());
-        PropertyFilter testFilter = new PropertyFilter() {
-            @Override
-            public String filterProperty(String value, FilterContext context) {
-                return context.getKey() + ":testGetSingleFilters";
-            }
-        };
-        ConfigurationFilter.getSingleFilters().addFilter(testFilter);
-        assertEquals("user.home:testGetSingleFilters", config.get("user.home"));
-        ConfigurationFilter.clearFilters();
-        assertNotSame("user.home:testGetSingleFilters", config.get("user.home"));
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/d5633d0e/src/test/java/org/apache/tamaya/filter/ProgrammableFilterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/tamaya/filter/ProgrammableFilterTest.java b/src/test/java/org/apache/tamaya/filter/ProgrammableFilterTest.java
deleted file mode 100644
index 73db677..0000000
--- a/src/test/java/org/apache/tamaya/filter/ProgrammableFilterTest.java
+++ /dev/null
@@ -1,141 +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.filter;
-
-import org.apache.tamaya.spi.FilterContext;
-import org.apache.tamaya.spi.PropertyFilter;
-import org.junit.Test;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests for {@link ProgrammableFilter}. Created by atsticks on 11.02.16.
- */
-public class ProgrammableFilterTest {
-
-    @Test
-    public void testAddRemoveFilter() throws Exception {
-        ProgrammableFilter filter = new ProgrammableFilter();
-        RegexPropertyFilter regexFilter = new RegexPropertyFilter("test\\..*");
-        Map<String,String> map = new HashMap<>();
-        map.put("test1", "test1");
-        map.put("test2", "test2");
-        map.put("test.test3", "test.test3");
-        assertEquals(filter.filterProperty("test1", new FilterContext("test1", map, true)), "test1");
-        assertEquals(filter.filterProperty("test2", new FilterContext("test2", map, true)), "test2");
-        assertEquals(filter.filterProperty("test.test3", new FilterContext("test.test3", map, true)), "test.test3");
-        filter.addFilter(regexFilter);
-        assertEquals(filter.filterProperty("test1", new FilterContext("test1", map, true)), "test1");
-        assertEquals(filter.filterProperty("test2", new FilterContext("test2", map, true)), "test2");
-        assertNull(filter.filterProperty("test.test3", new FilterContext("test.test3", map, true)));
-        filter.removeFilter(0);
-        assertEquals(filter.filterProperty("test1", new FilterContext("test1", map, true)), "test1");
-        assertEquals(filter.filterProperty("test2", new FilterContext("test2", map, true)), "test2");
-        assertEquals(filter.filterProperty("test.test3", new FilterContext("test.test3", map, true)), "test.test3");
-        filter.addFilter(0, regexFilter);
-        assertEquals(filter.filterProperty("test1", new FilterContext("test1", map, true)), "test1");
-        assertEquals(filter.filterProperty("test2", new FilterContext("test2", map, true)), "test2");
-        assertNull(filter.filterProperty("test.test3", new FilterContext("test.test3", map, true)));
-    }
-
-    @Test
-    public void testClearFilters() throws Exception {
-        ProgrammableFilter filter = new ProgrammableFilter();
-        RegexPropertyFilter regexFilter = new RegexPropertyFilter("test\\..*");
-        Map<String,String> map = new HashMap<>();
-        map.put("test1", "test1");
-        map.put("test2", "test2");
-        map.put("test.test3", "test.test3");
-        assertEquals(filter.filterProperty("test1", new FilterContext("test1", map, true)), "test1");
-        assertEquals(filter.filterProperty("test2", new FilterContext("test2", map, true)), "test2");
-        assertEquals(filter.filterProperty("test.test3", new FilterContext("test.test3", map, true)), "test.test3");
-        filter.addFilter(regexFilter);
-        assertEquals(filter.filterProperty("test1", new FilterContext("test1", map, true)), "test1");
-        assertEquals(filter.filterProperty("test2", new FilterContext("test2", map, true)), "test2");
-        assertNull(filter.filterProperty("test.test3", new FilterContext("test.test3", map, true)));
-        filter.clearFilters();
-        assertEquals(filter.filterProperty("test1", new FilterContext("test1", map, true)), "test1");
-        assertEquals(filter.filterProperty("test2", new FilterContext("test2", map, true)), "test2");
-        assertEquals(filter.filterProperty("test.test3", new FilterContext("test.test3", map, true)), "test.test3");
-    }
-
-    @Test
-    public void testSetFilters() throws Exception {
-        ProgrammableFilter filter = new ProgrammableFilter();
-        RegexPropertyFilter regexFilter = new RegexPropertyFilter("test\\..*");
-        Map<String,String> map = new HashMap<>();
-        map.put("test1", "test1");
-        map.put("test2", "test2");
-        map.put("test.test3", "test.test3");
-        assertEquals(filter.filterProperty("test1", new FilterContext("test1", map, true)), "test1");
-        assertEquals(filter.filterProperty("test2", new FilterContext("test2", map, true)), "test2");
-        assertEquals(filter.filterProperty("test.test3", new FilterContext("test.test3", map, true)), "test.test3");
-        filter.setFilters(regexFilter);
-        assertEquals(filter.filterProperty("test1", new FilterContext("test1", map, true)), "test1");
-        assertEquals(filter.filterProperty("test2", new FilterContext("test2", map, true)), "test2");
-        assertNull(filter.filterProperty("test.test3", new FilterContext("test.test3", map, true)));
-    }
-
-    @Test
-    public void testSetFilters1() throws Exception {
-        ProgrammableFilter filter = new ProgrammableFilter();
-        RegexPropertyFilter regexFilter = new RegexPropertyFilter("test\\..*");
-        Map<String,String> map = new HashMap<>();
-        map.put("test1", "test1");
-        map.put("test2", "test2");
-        map.put("test.test3", "test.test3");
-        assertEquals(filter.filterProperty("test1", new FilterContext("test1", map, true)), "test1");
-        assertEquals(filter.filterProperty("test2", new FilterContext("test2", map, true)), "test2");
-        assertEquals(filter.filterProperty("test.test3", new FilterContext("test.test3", map, true)), "test.test3");
-        filter.setFilters(Arrays.asList(new PropertyFilter[]{regexFilter}));
-        assertEquals(filter.filterProperty("test1", new FilterContext("test1", map, true)), "test1");
-        assertEquals(filter.filterProperty("test2", new FilterContext("test2", map, true)), "test2");
-        assertNull(filter.filterProperty("test.test3", new FilterContext("test.test3", map, true)));
-    }
-
-    @Test
-    public void testGetFilters() throws Exception {
-        ProgrammableFilter filter = new ProgrammableFilter();
-        assertNotNull(filter.getFilters());
-        assertTrue(filter.getFilters().isEmpty());
-        RegexPropertyFilter regexFilter = new RegexPropertyFilter("test\\..*");
-        filter.addFilter(regexFilter);
-        assertNotNull(filter.getFilters());
-        assertFalse(filter.getFilters().isEmpty());
-        assertEquals(1, filter.getFilters().size());
-        assertEquals(regexFilter, filter.getFilters().get(0));
-    }
-
-    @Test
-    public void testToString() throws Exception {
-        ProgrammableFilter filter = new ProgrammableFilter();
-        assertFalse(filter.toString().contains("test\\..*"));
-        assertTrue(filter.toString().contains("ProgrammableFilter"));
-        assertFalse(filter.toString().contains("RegexPropertyFilter"));
-        RegexPropertyFilter regexFilter = new RegexPropertyFilter("test\\..*");
-        filter.addFilter(regexFilter);
-        assertTrue(filter.toString().contains("test\\..*"));
-        assertTrue(filter.toString().contains("ProgrammableFilter"));
-        assertTrue(filter.toString().contains("RegexPropertyFilter"));
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/d5633d0e/src/test/java/org/apache/tamaya/filter/RegexPropertyFilterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/tamaya/filter/RegexPropertyFilterTest.java b/src/test/java/org/apache/tamaya/filter/RegexPropertyFilterTest.java
deleted file mode 100644
index a560b04..0000000
--- a/src/test/java/org/apache/tamaya/filter/RegexPropertyFilterTest.java
+++ /dev/null
@@ -1,55 +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.filter;
-
-import org.apache.tamaya.spi.FilterContext;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests for {@link RegexPropertyFilter}. Created by anatole on 11.02.16.
- */
-public class RegexPropertyFilterTest {
-
-    @org.junit.Test
-    public void testFilterProperty() throws Exception {
-        RegexPropertyFilter filter = new RegexPropertyFilter("test\\..*");
-        Map<String,String> map = new HashMap<>();
-        map.put("test1", "test1");
-        map.put("test2", "test2");
-        map.put("test.test3", "test.test3");
-        assertEquals(filter.filterProperty("test1", new FilterContext("test1", map, true)), "test1");
-        assertEquals(filter.filterProperty("test2", new FilterContext("test2", map, true)), "test2");
-        assertNull(filter.filterProperty("test.test3", new FilterContext("test.test3", map, true)));
-        filter = new RegexPropertyFilter(".*");
-        assertNull(filter.filterProperty("test1", new FilterContext("test1", map, true)));
-        assertNull(filter.filterProperty("test2", new FilterContext("test2", map, true)));
-        assertNull(filter.filterProperty("test.test3", new FilterContext("test.test3", map, true)));
-    }
-
-    @org.junit.Test
-    public void testToString() throws Exception {
-        RegexPropertyFilter filter = new RegexPropertyFilter("test\\..*");
-        assertTrue(filter.toString().contains("test\\..*"));
-        assertTrue(filter.toString().contains("RegexPropertyFilter"));
-    }
-}
\ No newline at end of file


Mime
View raw message