You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by an...@apache.org on 2015/08/28 12:34:21 UTC

[1/3] incubator-tamaya git commit: - Ensured functions module is compatible with Java 7. - Ensured management module is compatible with Java 7. - Added small feature to info queries to provide an additional (optional) info map to be included in the repor

Repository: incubator-tamaya
Updated Branches:
  refs/heads/master ced71fe23 -> 0c97691b9


- Ensured functions module is compatible with Java 7.
- Ensured management module is compatible with Java 7.
- Added small feature to info queries to provide an additional (optional) info map to be included in the report payload.


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

Branch: refs/heads/master
Commit: 5483221f69ce882382b73fa5b9daa3e68ae47ec9
Parents: ced71fe
Author: anatole <an...@apache.org>
Authored: Fri Aug 28 12:12:55 2015 +0200
Committer: anatole <an...@apache.org>
Committed: Fri Aug 28 12:12:55 2015 +0200

----------------------------------------------------------------------
 modules/functions/pom.xml                       |   4 +-
 .../functions/ConfigurationFunctions.java       | 241 ++++++++++++++-----
 .../tamaya/functions/FilteredConfiguration.java |  22 ++
 .../functions/FilteredPropertySource.java       |  10 +
 .../tamaya/functions/MappedConfiguration.java   |  22 ++
 .../tamaya/functions/MappedPropertySource.java  |   5 +
 .../functions/MetaEnrichedPropertySource.java   |  10 +
 .../functions/ValueFilteredPropertySource.java  |   5 +
 modules/management/pom.xml                      |   4 +
 .../apache/tamaya/management/ManagedConfig.java |   6 +
 .../tamaya/management/ManagedConfigMBean.java   |   4 +-
 11 files changed, 274 insertions(+), 59 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5483221f/modules/functions/pom.xml
----------------------------------------------------------------------
diff --git a/modules/functions/pom.xml b/modules/functions/pom.xml
index 2410f1b..631b2c9 100644
--- a/modules/functions/pom.xml
+++ b/modules/functions/pom.xml
@@ -38,13 +38,13 @@ under the License.
     <dependencies>
         <dependency>
             <groupId>org.apache.tamaya</groupId>
-            <artifactId>tamaya-api</artifactId>
+            <artifactId>tamaya-java7-api</artifactId>
             <version>${project.version}</version>
         </dependency>
         <!-- Test scope only, do not create a code dependency! -->
         <dependency>
             <groupId>org.apache.tamaya</groupId>
-            <artifactId>tamaya-core</artifactId>
+            <artifactId>tamaya-java7-core</artifactId>
             <version>${project.version}</version>
             <scope>test</scope>
         </dependency>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5483221f/modules/functions/src/main/java/org/apache/tamaya/functions/ConfigurationFunctions.java
----------------------------------------------------------------------
diff --git a/modules/functions/src/main/java/org/apache/tamaya/functions/ConfigurationFunctions.java b/modules/functions/src/main/java/org/apache/tamaya/functions/ConfigurationFunctions.java
index 34b0129..2968cfc 100644
--- a/modules/functions/src/main/java/org/apache/tamaya/functions/ConfigurationFunctions.java
+++ b/modules/functions/src/main/java/org/apache/tamaya/functions/ConfigurationFunctions.java
@@ -22,58 +22,54 @@ import org.apache.tamaya.ConfigOperator;
 import org.apache.tamaya.ConfigQuery;
 import org.apache.tamaya.Configuration;
 
+import java.net.Inet4Address;
 import java.util.Arrays;
+import java.util.Collections;
+import java.util.Date;
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeMap;
 import java.util.TreeSet;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 /**
  * Accessor that provides useful functions along with configuration.
  */
 public final class ConfigurationFunctions {
 
-    private static final ConfigQuery<String> INFO_JSON_QUERY = new ConfigQuery<String>(){
-        @Override
-        public String query(Configuration config) {
-            StringBuilder builder = new StringBuilder();
-            Map<String,String> props = new TreeMap<>(config.getProperties());
-            builder.append("\"configuration\": {\n")
-                    .append("  \"class\": \""+ config.getClass().getName() + "\",\n")
-                    .append("  \"timestamp\": " + System.currentTimeMillis() + ",\n")
-                    .append("  \"data\": {\n");
-            for(Map.Entry<String,String> en: props.entrySet()){
-                builder.append("     \"" + escape(en.getKey()) +"\": \""+escape(en.getValue())+"\",\n");
-            }
-            builder.append("    }\n}");
-            return builder.toString();
-        }
-    };
-    private static final ConfigQuery<String> INFO_XML_QUERY = new ConfigQuery<String>(){
-        @Override
-        public String query(Configuration config) {
-            StringBuilder builder = new StringBuilder();
-            Map<String,String> props = new TreeMap<>(config.getProperties());
-            builder.append("<configuration>\n")
-                    .append("  <class>"+ config.getClass().getName() + "</class>\n")
-                    .append("  <timestamp>" + System.currentTimeMillis() + "</timestamp>\n")
-                    .append("  <data>\n");
-            for(Map.Entry<String,String> en: props.entrySet()){
-                builder.append("     <entry key=\"" + escape(en.getKey()) +"\">"+escape(en.getValue())+"</entry>\n");
-            }
-            builder.append("   </data>\n</configuration>\n");
-            return builder.toString();
+    /**
+     * The Logger used.
+     */
+    private static final Logger LOG = Logger.getLogger(ConfigurationFunctions.class.getName());
+
+
+    private static void addFooter(StringBuilder b) {
+        b.append("</body>\n</html>\n");
+    }
+
+    private static void addHeader(StringBuilder b) {
+        String host = "unknown";
+        try {
+            host = Inet4Address.getLocalHost().getHostName();
+        } catch (Exception e) {
+            LOG.log(Level.INFO, "Failed to lookup hostname.", e);
         }
-    };
+        b.append("<html>\n<head><title>System Configuration</title></head>\n" +
+                "<body>\n" +
+                "<h1>Sysem Configuration</h1>\n" +
+                "<p>This view shows the system configuration of " + host + " at " + new Date() + ".</p>");
 
+    }
 
     /**
      * Replaces new lines, returns, tabs and '"' with escaped variants.
+     *
      * @param text the input text, not null
      * @return the escaped text.
      */
-    private static String escape(String text){
-        return text.replace("\n", "\\n").replace("\r", "\\r").replace("\t", "\\t").replace("\"", "\\\"");
+    private static String escape(String text) {
+        return text.replace("\t", "\\t").replace("\"", "\\\"");
     }
 
     /**
@@ -146,7 +142,7 @@ public final class ConfigurationFunctions {
                                 return isKeyInSection(k, areaKey);
                             }
                         }, "section: " + areaKey);
-                if(stripKeys){
+                if (stripKeys) {
                     return new MappedConfiguration(filtered, new Function<String, String>() {
                         @Override
                         public String apply(String k) {
@@ -162,26 +158,32 @@ public final class ConfigurationFunctions {
     /**
      * Calculates the current section key and compares it with the given key.
      *
-     * @param key     the fully qualified entry key, not null
+     * @param key        the fully qualified entry key, not null
      * @param sectionKey the section key, not null
      * @return true, if the entry is exact in this section
      */
     public static boolean isKeyInSection(String key, String sectionKey) {
         int lastIndex = key.lastIndexOf('.');
-        String curAreaKey = lastIndex > 0 ? key.substring(0, lastIndex) : "";
-        return curAreaKey.equals(sectionKey);
+        if(lastIndex<0){
+            return false;
+        }
+        String curAreaKey = key.substring(0, lastIndex);
+        if(curAreaKey.startsWith(sectionKey)){
+            return true;
+        }
+        return false;
     }
 
     /**
      * Calculates the current section key and compares it with the given section keys.
      *
-     * @param key     the fully qualified entry key, not null
+     * @param key         the fully qualified entry key, not null
      * @param sectionKeys the section keys, not null
      * @return true, if the entry is exact in this section
      */
     public static boolean isKeyInSections(String key, String... sectionKeys) {
-        for(String areaKey:sectionKeys){
-            if(isKeyInSection(key, areaKey)){
+        for (String areaKey : sectionKeys) {
+            if (isKeyInSection(key, areaKey)) {
                 return true;
             }
         }
@@ -200,7 +202,7 @@ public final class ConfigurationFunctions {
             @Override
             public Set<String> query(Configuration config) {
                 final Set<String> areas = new TreeSet<>();
-                for(String s: config.getProperties().keySet()) {
+                for (String s : config.getProperties().keySet()) {
                     int index = s.lastIndexOf('.');
                     if (index > 0) {
                         areas.add(s.substring(0, index));
@@ -248,12 +250,12 @@ public final class ConfigurationFunctions {
      * @return s set with all sections, never {@code null}.
      */
     public static ConfigQuery<Set<String>> sections(final Predicate<String> predicate) {
-        return new ConfigQuery<Set<String>>(){
+        return new ConfigQuery<Set<String>>() {
             @Override
             public Set<String> query(Configuration config) {
                 Set<String> result = new TreeSet<>();
-                for(String s : sections().query(config)){
-                    if(predicate.test(s)){
+                for (String s : sections().query(config)) {
+                    if (predicate.test(s)) {
                         result.add(s);
                     }
                 }
@@ -273,12 +275,12 @@ public final class ConfigurationFunctions {
      * @return s set with all transitive sections, never {@code null}.
      */
     public static ConfigQuery<Set<String>> transitiveSections(final Predicate<String> predicate) {
-        return new ConfigQuery<Set<String>>(){
+        return new ConfigQuery<Set<String>>() {
             @Override
             public Set<String> query(Configuration config) {
                 Set<String> result = new TreeSet<>();
-                for(String s: transitiveSections().query(config)){
-                    if(predicate.test(s)){
+                for (String s : transitiveSections().query(config)) {
+                    if (predicate.test(s)) {
                         result.add(s);
                     }
                 }
@@ -303,12 +305,12 @@ public final class ConfigurationFunctions {
      * Creates a ConfigOperator that creates a Configuration containing only keys
      * that are contained in the given section (recursive).
      *
-     * @param sectionKeys   the section keys, not null
-     * @param stripKeys if set to true, the section key is stripped away fromMap the resulting key.
+     * @param sectionKeys the section keys, not null
+     * @param stripKeys   if set to true, the section key is stripped away fromMap the resulting key.
      * @return the section configuration, with the areaKey stripped away.
      */
     public static ConfigOperator sectionRecursive(final boolean stripKeys, final String... sectionKeys) {
-        return new ConfigOperator(){
+        return new ConfigOperator() {
             @Override
             public Configuration operate(Configuration config) {
                 Configuration filtered = new FilteredConfiguration(config, new BiPredicate<String, String>() {
@@ -316,8 +318,8 @@ public final class ConfigurationFunctions {
                     public boolean test(final String k, String v) {
                         return isKeyInSections(k, sectionKeys);
                     }
-                } , "sections: " + Arrays.toString(sectionKeys));
-                if(stripKeys){
+                }, "sections: " + Arrays.toString(sectionKeys));
+                if (stripKeys) {
                     return new MappedConfiguration(filtered, new Function<String, String>() {
                         @Override
                         public String apply(String s) {
@@ -335,15 +337,146 @@ public final class ConfigurationFunctions {
      * @return the given query.
      */
     public static ConfigQuery<String> jsonInfo() {
-        return INFO_JSON_QUERY;
+        return jsonInfo(null);
+    }
+
+    /**
+     * Creates a ConfigQuery that creates a JSON formatted ouitput of all properties in the given configuration.
+     * @param info the additional information attributes to be added to the output, e.g. the original request
+     *             parameters.
+     * @return the given query.
+     */
+    public static ConfigQuery<String> jsonInfo(final Map<String,String> info) {
+        return new ConfigQuery<String>() {
+            @Override
+            public String query(Configuration config) {
+                StringBuilder builder = new StringBuilder();
+                Map<String, String> props = new TreeMap<>(config.getProperties());
+                builder.append("\"configuration\": {\n")
+                        .append("  \"class\": \"" + config.getClass().getName() + "\",\n")
+                        .append("  \"timestamp\": " + System.currentTimeMillis() + ",\n");
+                if (info!=null && !info.isEmpty()) {
+                    builder.append("  \"info\": {\n");
+                    for (Map.Entry<String, String> en : info.entrySet()) {
+                        builder.append("     \"" + escape(en.getKey()) + "\": \"" + escape(en.getValue()) + "\",\n");
+                    }
+                    builder.append("  },\n");
+                }
+                builder.append("  \"data\": {\n");
+                for (Map.Entry<String, String> en : props.entrySet()) {
+                    builder.append("     \"" + escape(en.getKey()) + "\": \"" + escape(en.getValue()) + "\",\n");
+                }
+                builder.append("    }\n}");
+                return builder.toString();
+            }
+        };
     }
 
     /**
      * Creates a ConfigQuery that creates a XML formatted ouitput of all properties in the given configuration.
+     *
      * @return the given query.
      */
     public static ConfigQuery<String> xmlInfo() {
-        return INFO_XML_QUERY;
+        return xmlInfo(null);
+    }
+
+    /**
+     * Creates a ConfigQuery that creates a XML formatted ouitput of all properties in the given configuration.
+     * @param info the additional information attributes to be added to the output, e.g. the original request
+     *             parameters.
+     * @return the given query.
+     */
+    public static ConfigQuery<String> xmlInfo(final Map<String,String> info) {
+        return new ConfigQuery<String>() {
+            @Override
+            public String query(Configuration config) {
+                StringBuilder builder = new StringBuilder();
+                Map<String, String> props = new TreeMap<>(config.getProperties());
+                builder.append("<configuration>\n")
+                        .append("  <class>" + config.getClass().getName() + "</class>\n")
+                        .append("  <timestamp>" + System.currentTimeMillis() + "</timestamp>\n");
+                if (info!=null && !info.isEmpty()) {
+                    builder.append("  <info>\n");
+                    for (Map.Entry<String, String> en : info.entrySet()) {
+                        builder.append("     <entry key=\"" + escape(en.getKey()) + "\">" + escape(en.getValue()) + "</entry>\n");
+                    }
+                    builder.append("  </info>\n");
+                }
+                builder.append("  <data>\n");
+                for (Map.Entry<String, String> en : props.entrySet()) {
+                    builder.append("     <entry key=\"" + escape(en.getKey()) + "\">" + escape(en.getValue()) + "</entry>\n");
+                }
+                builder.append("   </data>\n</configuration>\n");
+                return builder.toString();
+            }
+        };
+    }
+
+    /**
+     * Creates a ConfigQuery that creates a plain text formatted ouitput of all properties in the given configuration.
+     *
+     * @return the given query.
+     */
+    public static ConfigQuery<String> textInfo() {
+        return textInfo(null);
+    }
+
+    /**
+     * Creates a ConfigQuery that creates a plain text formatted ouitput of all properties in the given configuration.
+     *
+     * @return the given query.
+     */
+    public static ConfigQuery<String> textInfo(final Map<String,String> info) {
+        return new ConfigQuery<String>() {
+            @Override
+            public String query(Configuration config) {
+                StringBuilder builder = new StringBuilder();
+                Map<String, String> props = new TreeMap<>(config.getProperties());
+                builder.append("configuration:\n")
+                        .append("  class     : " + config.getClass().getName() + "\n")
+                        .append("  timestamp : " + System.currentTimeMillis() + "\n");
+                if (info != null && !info.isEmpty()) {
+                    builder.append("  info:\n");
+                    for (Map.Entry<String, String> en : info.entrySet()) {
+                        builder.append("    " + escape(en.getKey()) + ": " + escape(en.getValue()).replace("\n", "\n     ") + "\n");
+                    }
+                }
+                builder.append("  data:\n");
+                for (Map.Entry<String, String> en : props.entrySet()) {
+                    builder.append("    " + escape(en.getKey()) + ": " + escape(en.getValue()).replace("\n", "\n     ") + ",\n");
+                }
+                builder.append("\n");
+                return builder.toString();
+            }
+        };
+    }
+
+    /**
+     * Creates a ConfigQuery that creates a html formatted ouitput of all properties in the given configuration.
+     *
+     * @return the given query.
+     */
+    public static ConfigQuery<String> htmlInfo() {
+        return htmlInfo(null);
+    }
+
+    /**
+     * Creates a ConfigQuery that creates a html formatted ouitput of all properties in the given configuration.
+     *
+     * @return the given query.
+     */
+    public static ConfigQuery<String> htmlInfo(final Map<String,String> info) {
+        return new ConfigQuery<String>() {
+            @Override
+            public String query(Configuration config) {
+                StringBuilder builder = new StringBuilder();
+                addHeader(builder);
+                builder.append("<pre>\n").append(textInfo(info).query(config)).append("</pre>\n");
+                addFooter(builder);
+                return builder.toString();
+            }
+        };
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5483221f/modules/functions/src/main/java/org/apache/tamaya/functions/FilteredConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/functions/src/main/java/org/apache/tamaya/functions/FilteredConfiguration.java b/modules/functions/src/main/java/org/apache/tamaya/functions/FilteredConfiguration.java
index 8797211..5eb7ebd 100644
--- a/modules/functions/src/main/java/org/apache/tamaya/functions/FilteredConfiguration.java
+++ b/modules/functions/src/main/java/org/apache/tamaya/functions/FilteredConfiguration.java
@@ -18,6 +18,8 @@
  */
 package org.apache.tamaya.functions;
 
+import org.apache.tamaya.ConfigOperator;
+import org.apache.tamaya.ConfigQuery;
 import org.apache.tamaya.Configuration;
 import org.apache.tamaya.TypeLiteral;
 
@@ -42,6 +44,16 @@ class FilteredConfiguration implements Configuration {
     }
 
     @Override
+    public String get(String key) {
+        return get(key, String.class);
+    }
+
+    @Override
+    public <T> T get(String key, Class<T> type) {
+        return (T)get(key, TypeLiteral.of(type));
+    }
+
+    @Override
     public <T> T get(String key, TypeLiteral<T> type) {
         String value = baseConfiguration.get(key);
         if (filter.test(key, value)) {
@@ -62,6 +74,16 @@ class FilteredConfiguration implements Configuration {
     }
 
     @Override
+    public Configuration with(ConfigOperator operator) {
+        return null;
+    }
+
+    @Override
+    public <T> T query(ConfigQuery<T> query) {
+        return query.query(this);
+    }
+
+    @Override
     public String toString() {
         return "FilteredConfiguration{" +
                 "baseConfiguration=" + baseConfiguration +

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5483221f/modules/functions/src/main/java/org/apache/tamaya/functions/FilteredPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/functions/src/main/java/org/apache/tamaya/functions/FilteredPropertySource.java b/modules/functions/src/main/java/org/apache/tamaya/functions/FilteredPropertySource.java
index 119ec71..ed3a350 100644
--- a/modules/functions/src/main/java/org/apache/tamaya/functions/FilteredPropertySource.java
+++ b/modules/functions/src/main/java/org/apache/tamaya/functions/FilteredPropertySource.java
@@ -53,6 +53,11 @@ class FilteredPropertySource implements PropertySource {
     }
 
     @Override
+    public String get(String key) {
+        return getProperties().get(key);
+    }
+
+    @Override
     public Map<String,String> getProperties(){
         final Map<String,String> result = new HashMap<>();
         for(Map.Entry<String,String> en: this.baseSource.getProperties().entrySet()) {
@@ -64,6 +69,11 @@ class FilteredPropertySource implements PropertySource {
     }
 
     @Override
+    public boolean isScannable() {
+        return baseSource.isScannable();
+    }
+
+    @Override
     public String toString() {
         return "FilteredPropertySource{" +
                 "baseSource=" + baseSource +

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5483221f/modules/functions/src/main/java/org/apache/tamaya/functions/MappedConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/functions/src/main/java/org/apache/tamaya/functions/MappedConfiguration.java b/modules/functions/src/main/java/org/apache/tamaya/functions/MappedConfiguration.java
index a4b729b..1fb8c38 100644
--- a/modules/functions/src/main/java/org/apache/tamaya/functions/MappedConfiguration.java
+++ b/modules/functions/src/main/java/org/apache/tamaya/functions/MappedConfiguration.java
@@ -18,6 +18,8 @@
  */
 package org.apache.tamaya.functions;
 
+import org.apache.tamaya.ConfigOperator;
+import org.apache.tamaya.ConfigQuery;
 import org.apache.tamaya.Configuration;
 import org.apache.tamaya.TypeLiteral;
 
@@ -42,6 +44,16 @@ class MappedConfiguration implements Configuration {
     }
 
     @Override
+    public String get(String key) {
+        return get(key, String.class);
+    }
+
+    @Override
+    public <T> T get(String key, Class<T> type) {
+        return (T)get(key, TypeLiteral.of(type));
+    }
+
+    @Override
     public <T> T get(String key, TypeLiteral<T> type) {
         return baseConfiguration.get(this.keyMapper.apply(key), type);
     }
@@ -57,6 +69,16 @@ class MappedConfiguration implements Configuration {
     }
 
     @Override
+    public Configuration with(ConfigOperator operator) {
+        return operator.operate(this);
+    }
+
+    @Override
+    public <T> T query(ConfigQuery<T> query) {
+        return query.query(this);
+    }
+
+    @Override
     public String toString() {
         return "FilteredConfiguration{" +
                 "baseConfiguration=" + baseConfiguration +

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5483221f/modules/functions/src/main/java/org/apache/tamaya/functions/MappedPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/functions/src/main/java/org/apache/tamaya/functions/MappedPropertySource.java b/modules/functions/src/main/java/org/apache/tamaya/functions/MappedPropertySource.java
index 3717fbb..ce2bcac 100644
--- a/modules/functions/src/main/java/org/apache/tamaya/functions/MappedPropertySource.java
+++ b/modules/functions/src/main/java/org/apache/tamaya/functions/MappedPropertySource.java
@@ -76,6 +76,11 @@ class MappedPropertySource implements PropertySource {
     }
 
     @Override
+    public boolean isScannable() {
+        return propertySource.isScannable();
+    }
+
+    @Override
     public String get(String key) {
         return getProperties().get(key);
     }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5483221f/modules/functions/src/main/java/org/apache/tamaya/functions/MetaEnrichedPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/functions/src/main/java/org/apache/tamaya/functions/MetaEnrichedPropertySource.java b/modules/functions/src/main/java/org/apache/tamaya/functions/MetaEnrichedPropertySource.java
index c2aeb8e..42b5957 100644
--- a/modules/functions/src/main/java/org/apache/tamaya/functions/MetaEnrichedPropertySource.java
+++ b/modules/functions/src/main/java/org/apache/tamaya/functions/MetaEnrichedPropertySource.java
@@ -54,6 +54,11 @@ class MetaEnrichedPropertySource implements PropertySource {
     }
 
     @Override
+    public int getOrdinal() {
+        return basePropertySource.getOrdinal();
+    }
+
+    @Override
     public String getName() {
         return basePropertySource.getName();
     }
@@ -71,6 +76,11 @@ class MetaEnrichedPropertySource implements PropertySource {
     }
 
     @Override
+    public boolean isScannable() {
+        return basePropertySource.isScannable();
+    }
+
+    @Override
     public String toString() {
         return "MetaEnrichedPropertySource{" +
                 "basePropertySource=" + basePropertySource +

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5483221f/modules/functions/src/main/java/org/apache/tamaya/functions/ValueFilteredPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/functions/src/main/java/org/apache/tamaya/functions/ValueFilteredPropertySource.java b/modules/functions/src/main/java/org/apache/tamaya/functions/ValueFilteredPropertySource.java
index cdbc577..f6a7d0d 100644
--- a/modules/functions/src/main/java/org/apache/tamaya/functions/ValueFilteredPropertySource.java
+++ b/modules/functions/src/main/java/org/apache/tamaya/functions/ValueFilteredPropertySource.java
@@ -68,6 +68,11 @@ class ValueFilteredPropertySource implements PropertySource{
     }
 
     @Override
+    public boolean isScannable() {
+        return source.isScannable();
+    }
+
+    @Override
     public String toString() {
         return "ValueFilteredPropertySource{" +
                 "source=" + source.getName() +

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5483221f/modules/management/pom.xml
----------------------------------------------------------------------
diff --git a/modules/management/pom.xml b/modules/management/pom.xml
index f519307..ba11a28 100644
--- a/modules/management/pom.xml
+++ b/modules/management/pom.xml
@@ -31,6 +31,10 @@ under the License.
     <name>Apache Tamaya Modules - Java Management Extensions</name>
     <packaging>jar</packaging>
 
+    <properties>
+        <jdkVersion>1.7</jdkVersion>
+    </properties>
+
     <dependencies>
         <dependency>
             <groupId>org.apache.tamaya</groupId>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5483221f/modules/management/src/main/java/org/apache/tamaya/management/ManagedConfig.java
----------------------------------------------------------------------
diff --git a/modules/management/src/main/java/org/apache/tamaya/management/ManagedConfig.java b/modules/management/src/main/java/org/apache/tamaya/management/ManagedConfig.java
index 970f8ce..91b8256 100644
--- a/modules/management/src/main/java/org/apache/tamaya/management/ManagedConfig.java
+++ b/modules/management/src/main/java/org/apache/tamaya/management/ManagedConfig.java
@@ -90,6 +90,12 @@ public class ManagedConfig implements ManagedConfigMBean {
                 ConfigurationFunctions.section(area)).getProperties().isEmpty();
     }
 
+    @Override
+    public boolean isAreaEmpty(String area) {
+        return getSection(area, true).isEmpty();
+    }
+
+
     /**
      * Evaluate the current configuration. By default this class is temporarely setting the
      * TCCL to the instance active on bean creation and then calls {@link ConfigurationProvider#getConfiguration()}.

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5483221f/modules/management/src/main/java/org/apache/tamaya/management/ManagedConfigMBean.java
----------------------------------------------------------------------
diff --git a/modules/management/src/main/java/org/apache/tamaya/management/ManagedConfigMBean.java b/modules/management/src/main/java/org/apache/tamaya/management/ManagedConfigMBean.java
index 746d494..7fa1eef 100644
--- a/modules/management/src/main/java/org/apache/tamaya/management/ManagedConfigMBean.java
+++ b/modules/management/src/main/java/org/apache/tamaya/management/ManagedConfigMBean.java
@@ -114,8 +114,6 @@ public interface ManagedConfigMBean {
      * @param area the target section key, not null.
      * @return true, if such an section exists and is not empty.
      */
-    default boolean isAreaEmpty(String area){
-        return getSection(area, true).isEmpty();
-    }
+    boolean isAreaEmpty(String area);
 
 }
\ No newline at end of file


[3/3] incubator-tamaya git commit: Removed unused import.

Posted by an...@apache.org.
Removed unused import.


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

Branch: refs/heads/master
Commit: 0c97691b9f9a94afab94bf9f7d5b82caf6c8dce0
Parents: 95d73d5
Author: anatole <an...@apache.org>
Authored: Fri Aug 28 12:33:54 2015 +0200
Committer: anatole <an...@apache.org>
Committed: Fri Aug 28 12:33:54 2015 +0200

----------------------------------------------------------------------
 .../java/org/apache/tamaya/functions/ConfigurationFunctions.java    | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0c97691b/modules/functions/src/main/java/org/apache/tamaya/functions/ConfigurationFunctions.java
----------------------------------------------------------------------
diff --git a/modules/functions/src/main/java/org/apache/tamaya/functions/ConfigurationFunctions.java b/modules/functions/src/main/java/org/apache/tamaya/functions/ConfigurationFunctions.java
index 2968cfc..efcc053 100644
--- a/modules/functions/src/main/java/org/apache/tamaya/functions/ConfigurationFunctions.java
+++ b/modules/functions/src/main/java/org/apache/tamaya/functions/ConfigurationFunctions.java
@@ -24,7 +24,6 @@ import org.apache.tamaya.Configuration;
 
 import java.net.Inet4Address;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.Date;
 import java.util.Map;
 import java.util.Set;


[2/3] incubator-tamaya git commit: Bugfixes and implementation streamlining. Manual tests and formats look now valid, so we can continue with the remote part (module).

Posted by an...@apache.org.
Bugfixes and implementation streamlining. Manual tests and formats look now valid, so we can continue with the remote part (module).


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

Branch: refs/heads/master
Commit: 95d73d5b7d849d0ba6d890e6e92096f331105119
Parents: 5483221
Author: anatole <an...@apache.org>
Authored: Fri Aug 28 12:14:23 2015 +0200
Committer: anatole <an...@apache.org>
Committed: Fri Aug 28 12:14:23 2015 +0200

----------------------------------------------------------------------
 sandbox/server/pom.xml                          |   4 +
 .../tamaya/server/BaseConfigServerServlet.java  |  51 -----
 .../org/apache/tamaya/server/CXFServer.java     |  53 ------
 .../tamaya/server/ConfigProviderService.java    |  17 --
 .../org/apache/tamaya/server/ConfigServer.java  |  40 +++-
 .../org/apache/tamaya/server/ConfigService.java |  14 --
 .../java/org/apache/tamaya/server/Server.java   |  46 +++++
 .../tamaya/server/internal/CXFServer.java       |  83 ++++++++
 .../server/internal/DefaultConfigService.java   | 188 +++++++++++++++++++
 .../server/spi/ConfigProviderService.java       |  56 ++++++
 .../apache/tamaya/server/spi/ScopeManager.java  |  85 +++++++++
 .../apache/tamaya/server/spi/ScopeProvider.java |  35 ++++
 .../services/org.apache.tamaya.server.Server    |  19 ++
 13 files changed, 550 insertions(+), 141 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/95d73d5b/sandbox/server/pom.xml
----------------------------------------------------------------------
diff --git a/sandbox/server/pom.xml b/sandbox/server/pom.xml
index ab55fe5..cdd2a24 100644
--- a/sandbox/server/pom.xml
+++ b/sandbox/server/pom.xml
@@ -31,6 +31,10 @@ under the License.
     <name>Apache Tamaya Configuration: Server Extension</name>
     <packaging>jar</packaging>
 
+    <properties>
+        <jdkVersion>1.7</jdkVersion>
+    </properties>
+
     <dependencies>
         <dependency>
             <groupId>org.apache.tamaya</groupId>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/95d73d5b/sandbox/server/src/main/java/org/apache/tamaya/server/BaseConfigServerServlet.java
----------------------------------------------------------------------
diff --git a/sandbox/server/src/main/java/org/apache/tamaya/server/BaseConfigServerServlet.java b/sandbox/server/src/main/java/org/apache/tamaya/server/BaseConfigServerServlet.java
deleted file mode 100644
index 0306803..0000000
--- a/sandbox/server/src/main/java/org/apache/tamaya/server/BaseConfigServerServlet.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.server;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Simple servlet base class that delivers a configuration with the given parameter key/value keys.
- */
-public abstract class BaseConfigServerServlet extends HttpServlet {
-
-    @Override
-    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
-        Map<String,String> params = new HashMap<>();
-        req.getParameterMap().forEach((k,v) -> params.put(k, v[0]));
-        String config = getFormattedConfiguration(params);
-        if(config!=null){
-            // write config to response
-            resp.getWriter().print(config);
-        }
-        else{
-            resp.sendError(404, "No such config: " + params.toString());
-        }
-
-    }
-
-    protected abstract String getFormattedConfiguration(Map<String, String> params);
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/95d73d5b/sandbox/server/src/main/java/org/apache/tamaya/server/CXFServer.java
----------------------------------------------------------------------
diff --git a/sandbox/server/src/main/java/org/apache/tamaya/server/CXFServer.java b/sandbox/server/src/main/java/org/apache/tamaya/server/CXFServer.java
deleted file mode 100644
index 2dd06f7..0000000
--- a/sandbox/server/src/main/java/org/apache/tamaya/server/CXFServer.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.apache.tamaya.server;
-
-/*
-HelloWorldImpl implementor = new HelloWorldImpl();
-JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
-svrFactory.setServiceClass(HelloWorld.class);
-svrFactory.setAddress("http://localhost:9000/helloWorld");
-svrFactory.setServiceBean(implementor);
-svrFactory.getInInterceptors().add(new LoggingInInterceptor());
-svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
-svrFactory.create();
- */
-
-import org.apache.cxf.endpoint.Server;
-import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
-
-public class CXFServer implements ConfigServer{
-
-    private Server cxfEndpoint;
-
-    public void start(int port) {
-        JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
-        ConfigService confService = new ConfigService();
-        sf.setServiceBeanObjects(confService);
-        sf.setAddress("http://localhost:"+port+"/");
-        cxfEndpoint = sf.create();
-    }
-
-    public boolean isStarted(){
-        if(cxfEndpoint!=null){
-            return cxfEndpoint.isStarted();
-        }
-        return false;
-    }
-
-    public void stop(){
-        if(cxfEndpoint!=null){
-            cxfEndpoint.stop();
-        }
-    }
-
-    public void destroy(){
-        if(cxfEndpoint!=null){
-            cxfEndpoint.destroy();
-            cxfEndpoint = null;
-        }
-    }
-
-    public static void main(String... args){
-        new CXFServer().start(8888);
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/95d73d5b/sandbox/server/src/main/java/org/apache/tamaya/server/ConfigProviderService.java
----------------------------------------------------------------------
diff --git a/sandbox/server/src/main/java/org/apache/tamaya/server/ConfigProviderService.java b/sandbox/server/src/main/java/org/apache/tamaya/server/ConfigProviderService.java
deleted file mode 100644
index 117911a..0000000
--- a/sandbox/server/src/main/java/org/apache/tamaya/server/ConfigProviderService.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.apache.tamaya.server;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-
-/**
- * Created by Anatole on 23.08.2015.
- */
-public interface ConfigProviderService {
-
-    @GET
-    @Path("/config/{id}/")
-    @Produces("application/json")
-    String getConfiguration(@PathParam("id") String configId);
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/95d73d5b/sandbox/server/src/main/java/org/apache/tamaya/server/ConfigServer.java
----------------------------------------------------------------------
diff --git a/sandbox/server/src/main/java/org/apache/tamaya/server/ConfigServer.java b/sandbox/server/src/main/java/org/apache/tamaya/server/ConfigServer.java
index c6bfb5d..101bf7c 100644
--- a/sandbox/server/src/main/java/org/apache/tamaya/server/ConfigServer.java
+++ b/sandbox/server/src/main/java/org/apache/tamaya/server/ConfigServer.java
@@ -1,12 +1,40 @@
+/*
+ * 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.server;
 
+import org.apache.tamaya.spi.ServiceContextManager;
+
 /**
- * Created by Anatole on 23.08.2015.
+ * Simple abstraction of the Server interface.
  */
-public interface ConfigServer {
+public final class ConfigServer {
+
+    /**
+     * Creates a new server instance.
+     * @return a new server instance.
+     */
+    public static Server createServer(){
+        return ServiceContextManager.getServiceContext().getService(Server.class);
+    }
+
+    public static void main(String... args){
+        createServer().start(8888);
+    }
 
-    void start(int port);
-    boolean isStarted();
-    void stop();
-    void destroy();
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/95d73d5b/sandbox/server/src/main/java/org/apache/tamaya/server/ConfigService.java
----------------------------------------------------------------------
diff --git a/sandbox/server/src/main/java/org/apache/tamaya/server/ConfigService.java b/sandbox/server/src/main/java/org/apache/tamaya/server/ConfigService.java
deleted file mode 100644
index b1b6283..0000000
--- a/sandbox/server/src/main/java/org/apache/tamaya/server/ConfigService.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.apache.tamaya.server;
-
-import org.apache.tamaya.ConfigurationProvider;
-import static org.apache.tamaya.functions.ConfigurationFunctions.*;
-/**
- * Created by Anatole on 23.08.2015.
- */
-public class ConfigService implements ConfigProviderService{
-    @Override
-    public String getConfiguration(String configId) {
-        // currently ignore: with(section(configId,false))
-        return ConfigurationProvider.getConfiguration().query(jsonInfo());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/95d73d5b/sandbox/server/src/main/java/org/apache/tamaya/server/Server.java
----------------------------------------------------------------------
diff --git a/sandbox/server/src/main/java/org/apache/tamaya/server/Server.java b/sandbox/server/src/main/java/org/apache/tamaya/server/Server.java
new file mode 100644
index 0000000..5e2cb52
--- /dev/null
+++ b/sandbox/server/src/main/java/org/apache/tamaya/server/Server.java
@@ -0,0 +1,46 @@
+/*
+ * 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.server;
+
+/**
+ * Simple abstraction of the Server interface.
+ */
+public interface Server {
+    /**
+     * Starts the server on the given port-
+     * @param port the target port.
+     */
+    void start(int port);
+
+    /**
+     * Checks if the server us started.
+     * @return true if the server us started.
+     */
+    boolean isStarted();
+
+    /**
+     * Stops the server, but does not destroy it, so it might be restarted.
+     */
+    void stop();
+
+    /**
+     * Destroy the server instance.
+     */
+    void destroy();
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/95d73d5b/sandbox/server/src/main/java/org/apache/tamaya/server/internal/CXFServer.java
----------------------------------------------------------------------
diff --git a/sandbox/server/src/main/java/org/apache/tamaya/server/internal/CXFServer.java b/sandbox/server/src/main/java/org/apache/tamaya/server/internal/CXFServer.java
new file mode 100644
index 0000000..c976723
--- /dev/null
+++ b/sandbox/server/src/main/java/org/apache/tamaya/server/internal/CXFServer.java
@@ -0,0 +1,83 @@
+/*
+ * 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.server.internal;
+
+
+import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
+import org.apache.tamaya.server.Server;
+
+/**
+ * CXF based implementation of a JAX-RS server, serving the {@link DefaultConfigService} service.
+ */
+public class CXFServer implements Server {
+    /** The CXF endpoint. */
+    private org.apache.cxf.endpoint.Server cxfEndpoint;
+
+    /**
+     * Starts the CXF server under the port.
+     * @param port the port.
+     */
+    public void start(int port) {
+        if(cxfEndpoint!=null){
+            if(cxfEndpoint.isStarted()){
+                return;
+            }
+            // start it at the end...
+        }
+        else {
+            JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
+            DefaultConfigService confService = new DefaultConfigService();
+            sf.setServiceBeanObjects(confService);
+            sf.setAddress("http://localhost:" + port + "/");
+            cxfEndpoint = sf.create();
+        }
+        cxfEndpoint.start();
+    }
+
+    /**
+     * Returns the current started state.
+     * @return true, if the server is started.
+     */
+    public boolean isStarted(){
+        if(cxfEndpoint!=null){
+            return cxfEndpoint.isStarted();
+        }
+        return false;
+    }
+
+    /**
+     * Stops the server if running.
+     */
+    public void stop(){
+        if(cxfEndpoint!=null){
+            cxfEndpoint.stop();
+        }
+    }
+
+    /**
+     * Destroy the server.
+     */
+    public void destroy(){
+        if(cxfEndpoint!=null){
+            cxfEndpoint.destroy();
+            cxfEndpoint = null;
+        }
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/95d73d5b/sandbox/server/src/main/java/org/apache/tamaya/server/internal/DefaultConfigService.java
----------------------------------------------------------------------
diff --git a/sandbox/server/src/main/java/org/apache/tamaya/server/internal/DefaultConfigService.java b/sandbox/server/src/main/java/org/apache/tamaya/server/internal/DefaultConfigService.java
new file mode 100644
index 0000000..019b0b3
--- /dev/null
+++ b/sandbox/server/src/main/java/org/apache/tamaya/server/internal/DefaultConfigService.java
@@ -0,0 +1,188 @@
+/*
+ * 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.server.internal;
+
+import org.apache.tamaya.ConfigOperator;
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.functions.ConfigurationFunctions;
+import org.apache.tamaya.server.spi.ConfigProviderService;
+import org.apache.tamaya.server.spi.ScopeManager;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * Implementation of the JAX-RS interface for serving configuration.
+ */
+public class DefaultConfigService implements ConfigProviderService {
+
+    @Override
+    @GET
+    @Path("/config/filtered/{path}")
+    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.TEXT_HTML, MediaType.TEXT_PLAIN})
+    public String getConfigurationWithPath(@PathParam("path") String path,
+                                    @Context HttpServletRequest request){
+        Map<String,String> requestInfo = new HashMap<>();
+        requestInfo.put("filter",path);
+        requestInfo.put("timestamp", String.valueOf(System.currentTimeMillis()));
+        String format = request.getParameter("format");
+        if(format==null){
+            format = request.getHeader(HttpHeaders.ACCEPT);
+        }
+        requestInfo.put("format", format);
+        String scope = request.getParameter("scope");
+        if(scope!=null){
+            return getScopedConfigurationWithPath(scope, path, request, format, requestInfo);
+        }
+        Configuration config = ConfigurationProvider.getConfiguration()
+                .with(ConfigurationFunctions.sectionsRecursive(path.split(",")));
+        if(format.contains(MediaType.APPLICATION_JSON)) {
+            Response.status(Response.Status.OK).encoding("utf-8").type(MediaType.APPLICATION_JSON_TYPE);
+            return config.query(ConfigurationFunctions.jsonInfo(requestInfo));
+        }
+        if(format.contains(MediaType.APPLICATION_XML)) {
+            Response.status(Response.Status.OK).encoding("utf-8").type(MediaType.APPLICATION_XML_TYPE);
+            return config.query(ConfigurationFunctions.xmlInfo(requestInfo));
+        }
+        if(format.contains(MediaType.TEXT_HTML)) {
+            Response.status(Response.Status.OK).encoding("utf-8").type(MediaType.TEXT_HTML_TYPE);
+            return config.query(ConfigurationFunctions.htmlInfo(requestInfo));
+        }
+        if(format.contains(MediaType.TEXT_PLAIN)) {
+            Response.status(Response.Status.OK).encoding("utf-8").type(MediaType.TEXT_PLAIN_TYPE);
+            return config.query(ConfigurationFunctions.textInfo(requestInfo));
+        }
+        Response.status(Response.Status.BAD_REQUEST).allow(MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML)
+                .build();
+        return null;
+    }
+
+
+
+    @Override
+    @GET
+    @Path("/config")
+    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.TEXT_HTML, MediaType.TEXT_PLAIN})
+    public String getConfiguration(@Context HttpServletRequest request) {
+        Map<String,String> requestInfo = new HashMap<>();
+        requestInfo.put("timestamp", String.valueOf(System.currentTimeMillis()));
+        String format = request.getParameter("format");
+        if(format==null){
+            format = request.getHeader(HttpHeaders.ACCEPT);
+        }
+        String scope = request.getParameter("scope");
+        if(scope!=null){
+            return getScopedConfiguration(scope, request, format, requestInfo);
+        }
+        Configuration config = ConfigurationProvider.getConfiguration();
+        if(format.contains(MediaType.APPLICATION_JSON)) {
+            Response.status(Response.Status.OK).encoding("utf-8").type(MediaType.APPLICATION_JSON_TYPE);
+            return config.query(ConfigurationFunctions.jsonInfo(requestInfo));
+        }
+        if(format.contains(MediaType.APPLICATION_XML)) {
+            Response.status(Response.Status.OK).encoding("utf-8").type(MediaType.APPLICATION_XML_TYPE);
+            return config.query(ConfigurationFunctions.xmlInfo(requestInfo));
+        }
+        if(format.contains(MediaType.TEXT_HTML)) {
+            Response.status(Response.Status.OK).encoding("utf-8").type(MediaType.TEXT_HTML_TYPE);
+            return config.query(ConfigurationFunctions.htmlInfo(requestInfo));
+        }
+        if(format.contains(MediaType.TEXT_PLAIN)) {
+            Response.status(Response.Status.OK).encoding("utf-8").type(MediaType.TEXT_PLAIN_TYPE);
+            return config.query(ConfigurationFunctions.textInfo(requestInfo));
+        }
+        Response.status(Response.Status.BAD_REQUEST).allow(MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML);
+        return null;
+    }
+
+    private String getScopedConfigurationWithPath(String scope, String path, HttpServletRequest request, String format, Map<String,String> requestInfo) {
+        requestInfo.put("scope", scope);
+        Configuration config = ConfigurationProvider.getConfiguration()
+                .with(getScope(scope)).with(ConfigurationFunctions.sectionsRecursive(path.split(",")));
+        if(format.contains(MediaType.APPLICATION_JSON)) {
+            Response.status(Response.Status.OK).encoding("utf-8").type(MediaType.APPLICATION_JSON_TYPE);
+            return config.query(ConfigurationFunctions.jsonInfo(requestInfo));
+        }
+        if(format.contains(MediaType.APPLICATION_XML)) {
+            Response.status(Response.Status.OK).encoding("utf-8").type(MediaType.APPLICATION_XML_TYPE);
+            return config.query(ConfigurationFunctions.xmlInfo(requestInfo));
+        }
+        if(format.contains(MediaType.TEXT_HTML)) {
+            Response.status(Response.Status.OK).encoding("utf-8").type(MediaType.TEXT_HTML_TYPE);
+            return config.query(ConfigurationFunctions.htmlInfo(requestInfo));
+        }
+        if(format.contains(MediaType.TEXT_PLAIN)) {
+            Response.status(Response.Status.OK).encoding("utf-8").type(MediaType.TEXT_PLAIN_TYPE);
+            return config.query(ConfigurationFunctions.textInfo(requestInfo));
+        }
+        Response.status(Response.Status.BAD_REQUEST).allow(MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML);
+        return null;
+    }
+
+    private String getScopedConfiguration(String scope, HttpServletRequest request, String format, Map<String,String> requestInfo) {
+        requestInfo.put("scope", scope);
+        Configuration config = ConfigurationProvider.getConfiguration().with(getScope(scope));
+        if(format.contains(MediaType.APPLICATION_JSON)) {
+            Response.status(Response.Status.OK).encoding("utf-8").type(MediaType.APPLICATION_JSON_TYPE);
+            return config.query(ConfigurationFunctions.jsonInfo(requestInfo));
+        }
+        if(format.contains(MediaType.APPLICATION_XML)) {
+            Response.status(Response.Status.OK).encoding("utf-8").type(MediaType.APPLICATION_XML_TYPE);
+            return config.query(ConfigurationFunctions.xmlInfo(requestInfo));
+        }
+        if(format.contains(MediaType.TEXT_HTML)) {
+            Response.status(Response.Status.OK).encoding("utf-8").type(MediaType.TEXT_HTML_TYPE);
+            return config.query(ConfigurationFunctions.htmlInfo(requestInfo));
+        }
+        if(format.contains(MediaType.TEXT_PLAIN)) {
+            Response.status(Response.Status.OK).encoding("utf-8").type(MediaType.TEXT_PLAIN_TYPE);
+            return config.query(ConfigurationFunctions.textInfo(requestInfo));
+        }
+        Response.status(Response.Status.BAD_REQUEST).allow(MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML)
+                .build();
+        return null;
+    }
+
+    private ConfigOperator getScope(String scope) {
+        return ScopeManager.getScope(scope);
+    }
+
+    @Override
+    public String updateConfiguration(@Context HttpServletRequest request) {
+        Response.status(Response.Status.INTERNAL_SERVER_ERROR);
+        return "UPDATE Configuration: Not implemented";
+    }
+
+    @Override
+    public String deleteConfiguration(String paths, @Context HttpServletRequest request) {
+        Response.status(Response.Status.INTERNAL_SERVER_ERROR);
+        return "DELETE Configuration: Not implemented";
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/95d73d5b/sandbox/server/src/main/java/org/apache/tamaya/server/spi/ConfigProviderService.java
----------------------------------------------------------------------
diff --git a/sandbox/server/src/main/java/org/apache/tamaya/server/spi/ConfigProviderService.java b/sandbox/server/src/main/java/org/apache/tamaya/server/spi/ConfigProviderService.java
new file mode 100644
index 0000000..1e080c3
--- /dev/null
+++ b/sandbox/server/src/main/java/org/apache/tamaya/server/spi/ConfigProviderService.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.server.spi;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+
+/**
+ * Configuration serving RESTful service interface.
+ */
+public interface ConfigProviderService {
+
+    @GET
+    @Path("/config/filtered/{path}")
+    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.TEXT_HTML, MediaType.TEXT_PLAIN})
+    String getConfigurationWithPath(@PathParam("path") String path,
+                                        @Context HttpServletRequest request);
+
+    @GET
+    @Path("/config")
+    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.TEXT_HTML, MediaType.TEXT_PLAIN})
+    String getConfiguration(@Context HttpServletRequest request);
+
+    @PUT
+    @Path("/config")
+    @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+    String updateConfiguration(@Context HttpServletRequest request);
+
+    @DELETE
+    @Path("/config/{paths}")
+    String deleteConfiguration(@PathParam("paths") String paths, @Context HttpServletRequest request);
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/95d73d5b/sandbox/server/src/main/java/org/apache/tamaya/server/spi/ScopeManager.java
----------------------------------------------------------------------
diff --git a/sandbox/server/src/main/java/org/apache/tamaya/server/spi/ScopeManager.java b/sandbox/server/src/main/java/org/apache/tamaya/server/spi/ScopeManager.java
new file mode 100644
index 0000000..7bd6c81
--- /dev/null
+++ b/sandbox/server/src/main/java/org/apache/tamaya/server/spi/ScopeManager.java
@@ -0,0 +1,85 @@
+/*
+ * 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.server.spi;
+
+import org.apache.tamaya.ConfigException;
+import org.apache.tamaya.ConfigOperator;
+import org.apache.tamaya.spi.ServiceContextManager;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Singleton manager for scopes, used by the server component to filtering returned config.
+ */
+public final class ScopeManager {
+    /** The logger used. */
+    private static final Logger LOG = Logger.getLogger(ScopeManager.class.getName());
+
+    /**
+     * Singleton constructor.
+     */
+    private ScopeManager(){
+    }
+
+    /** The scopes read from the {@link org.apache.tamaya.spi.ServiceContext}. */
+    private static final Map<String,ConfigOperator> scopes = readScopes();
+
+    /**
+     * Read the scopes from the providers, ordered by their priority.
+     * @return the map of registered scopes.
+     */
+    private static Map<String, ConfigOperator> readScopes() {
+        Map<String,ConfigOperator> scopes = new ConcurrentHashMap<>();
+        for(ScopeProvider prov: ServiceContextManager.getServiceContext().getServices(ScopeProvider.class)){
+            try{
+                ScopeManager.scopes.putAll(prov.getScopes());
+            }
+            catch(Exception e){
+                LOG.log(Level.WARNING, "Error loading scopes from " + prov, e);
+            }
+        }
+        return scopes;
+    }
+
+    /**
+     * Get the scope given its name.
+     * @param scopeId the scope name
+     * @return the scope matching
+     * @throws ConfigException, if nos such scope is defined.
+     */
+    public static ConfigOperator getScope(String scopeId){
+        ConfigOperator op = scopes.get(scopeId);
+        if(op==null){
+            throw new ConfigException("No such scope: " + scopeId);
+        }
+        return op;
+    }
+
+    /**
+     * Get the defined scope names.
+     * @return the defined scope names, never null.
+     */
+    public Set<String> getScopes(){
+        return scopes.keySet();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/95d73d5b/sandbox/server/src/main/java/org/apache/tamaya/server/spi/ScopeProvider.java
----------------------------------------------------------------------
diff --git a/sandbox/server/src/main/java/org/apache/tamaya/server/spi/ScopeProvider.java b/sandbox/server/src/main/java/org/apache/tamaya/server/spi/ScopeProvider.java
new file mode 100644
index 0000000..b74f551
--- /dev/null
+++ b/sandbox/server/src/main/java/org/apache/tamaya/server/spi/ScopeProvider.java
@@ -0,0 +1,35 @@
+/*
+ * 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.server.spi;
+
+import org.apache.tamaya.ConfigOperator;
+
+import java.util.Map;
+
+/**
+ * Simple registratable provider class to register scopes for the server extension.
+ */
+public interface ScopeProvider {
+
+    /**
+     * Return the scopes to be registered.
+     * @return the scope map. The keys are the scope ids that identify the scope operators to be used.
+     */
+    Map<String,ConfigOperator> getScopes();
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/95d73d5b/sandbox/server/src/main/resources/META-INF/services/org.apache.tamaya.server.Server
----------------------------------------------------------------------
diff --git a/sandbox/server/src/main/resources/META-INF/services/org.apache.tamaya.server.Server b/sandbox/server/src/main/resources/META-INF/services/org.apache.tamaya.server.Server
new file mode 100644
index 0000000..72b1998
--- /dev/null
+++ b/sandbox/server/src/main/resources/META-INF/services/org.apache.tamaya.server.Server
@@ -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.server.internal.CXFServer
\ No newline at end of file