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:22 UTC

[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).

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