You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2017/07/10 06:53:31 UTC

[29/50] polygene-java git commit: Fixing the restlet library in relation to the polygene generator to work.

Fixing the restlet library in relation to the polygene generator to work.


Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/c6b89168
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/c6b89168
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/c6b89168

Branch: refs/heads/es-jooq
Commit: c6b89168f155bb55d8af892d088b8977d9e26834
Parents: ed6ae81
Author: niclas <ni...@hedhman.org>
Authored: Sun Jul 2 14:08:40 2017 +0800
Committer: niclas <ni...@hedhman.org>
Committed: Sun Jul 2 14:08:40 2017 +0800

----------------------------------------------------------------------
 .../polygene/runtime/value/ValueInstance.java   | 18 ++++-
 libraries/restlet/build.gradle                  |  5 +-
 .../library/restlet/PolygeneEntityRestlet.java  |  1 -
 .../restlet/PolygeneRestApplication.java        | 36 ++++++---
 .../library/restlet/PolygeneServerServlet.java  | 13 ++-
 .../restlet/assembly/GenericRestLayer.java      | 34 --------
 .../assembly/RestApplicationAssembler.java      | 85 --------------------
 .../RestletCrudConnectivityAssembler.java       |  3 +
 .../assembly/RestletCrudModuleAssembler.java    | 23 ++++--
 .../configuration/ConfigurationLayer.java       | 45 -----------
 .../configuration/ConfigurationModule.java      | 39 ---------
 .../connectivity/ConnectivityLayer.java         | 39 ---------
 .../assembly/connectivity/RestModule.java       | 40 ---------
 .../assembly/connectivity/SecurityModule.java   | 35 --------
 .../restlet/assembly/domain/CrudModule.java     | 38 ---------
 .../restlet/assembly/domain/DomainLayer.java    | 37 ---------
 .../infrastructue/FileStorageModule.java        | 50 ------------
 .../assembly/infrastructue/IndexingModule.java  | 54 -------------
 .../infrastructue/InfrastructureLayer.java      | 54 -------------
 .../infrastructue/SerializationModule.java      | 37 ---------
 .../assembly/resource/ResourceLayer.java        | 37 ---------
 .../restlet/crud/EntityListResource.java        |  5 +-
 .../library/restlet/crud/EntityResource.java    | 13 +--
 .../restlet/resource/CreationResource.java      |  8 +-
 .../restlet/resource/EntryPointResource.java    |  4 +-
 .../restlet/resource/ResourceBuilder.java       | 32 ++++----
 .../serialization/JsonRepresentation.java       |  7 +-
 .../library/restlet/TestApplication.java        | 10 +--
 .../assembly/RestApplicationAssembler.java      | 85 ++++++++++++++++++++
 .../configuration/ConfigurationLayer.java       | 45 +++++++++++
 .../configuration/ConfigurationModule.java      | 39 +++++++++
 .../connectivity/ConnectivityLayer.java         | 39 +++++++++
 .../assembly/connectivity/RestModule.java       | 40 +++++++++
 .../assembly/connectivity/SecurityModule.java   | 35 ++++++++
 .../restlet/assembly/domain/CrudModule.java     | 38 +++++++++
 .../restlet/assembly/domain/DomainLayer.java    | 37 +++++++++
 .../infrastructue/FileStorageModule.java        | 50 ++++++++++++
 .../assembly/infrastructue/IndexingModule.java  | 54 +++++++++++++
 .../infrastructue/InfrastructureLayer.java      | 54 +++++++++++++
 .../infrastructue/SerializationModule.java      | 37 +++++++++
 .../assembly/resource/ResourceLayer.java        | 37 +++++++++
 .../HttpServerModule/bootstrap.tmpl             |  7 +-
 .../RestApiModule/NullEnroler.tmpl              | 32 --------
 .../RestApiModule/NullVerifier.tmpl             | 34 --------
 .../RestApiModule/bootstrap.tmpl                | 10 +--
 .../ConnectivityLayer/RestApiModule/module.js   |  4 -
 .../DomainLayer/DomainModule/bootstrap.tmpl     |  8 +-
 .../RestAPIApplication/application.java.tmpl    | 32 +++++---
 .../app/templates/buildtool/gradle-app.tmpl     | 22 ++---
 .../app/templates/buildtool/gradle-root.tmpl    | 27 +++++++
 50 files changed, 761 insertions(+), 807 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueInstance.java
index 5e678c5..8af2e08 100644
--- a/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueInstance.java
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueInstance.java
@@ -20,6 +20,7 @@
 package org.apache.polygene.runtime.value;
 
 import java.lang.reflect.Proxy;
+import java.util.Arrays;
 import org.apache.polygene.api.composite.CompositeInstance;
 import org.apache.polygene.api.serialization.Serializer;
 import org.apache.polygene.runtime.composite.MixinsInstance;
@@ -144,10 +145,23 @@ public final class ValueInstance extends TransientInstance
         return hash + state.hashCode() * 5; // State
     }
 
+    public String toJsonString()
+    {
+        Serializer serialization = ( (ModuleSpi) module().instance() ).serialization();
+        if( serialization != null )
+        {
+            return serialization.serialize( Serializer.Options.NO_TYPE_INFO, proxy() );
+        }
+        return null;
+    }
+
     @Override
     public String toString()
     {
-        Serializer serialization = ( (ModuleSpi) module().instance() ).serialization();
-        return serialization.serialize( Serializer.Options.NO_TYPE_INFO, proxy() );
+        return "ValueInstance{" +
+               "mixins=" + Arrays.toString( mixins ) +
+               ", state=" + state +
+               ", compositeModel=" + compositeModel +
+               '}';
     }
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/restlet/build.gradle b/libraries/restlet/build.gradle
index 95ab44b..7a8705c 100644
--- a/libraries/restlet/build.gradle
+++ b/libraries/restlet/build.gradle
@@ -30,8 +30,6 @@ dependencies {
 
   api polygene.core.bootstrap
 
-  implementation polygene.extension( 'entitystore-file' )
-  implementation polygene.extension( 'indexing-rdf' )
   implementation libraries.restlet
 
   runtimeOnly polygene.core.runtime
@@ -39,7 +37,8 @@ dependencies {
   testImplementation polygene.core.testsupport
   testImplementation polygene.library( 'http' )
   testImplementation libraries.http_client
-
+  testImplementation polygene.extension( 'entitystore-file' )
+  testImplementation polygene.extension( 'indexing-rdf' )
   testRuntimeOnly libraries.logback
 }
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/PolygeneEntityRestlet.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/PolygeneEntityRestlet.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/PolygeneEntityRestlet.java
index b76bfd3..da27d9e 100644
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/PolygeneEntityRestlet.java
+++ b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/PolygeneEntityRestlet.java
@@ -152,7 +152,6 @@ public class PolygeneEntityRestlet<T extends HasIdentity> extends Restlet
                              }
                              Representation representation = converter.toRepresentation( result, new Variant(), null );
                              response.setEntity( representation );
-                             response.setEntity( representation );
                              response.setStatus( Status.SUCCESS_OK );
                          }
                          else

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/PolygeneRestApplication.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/PolygeneRestApplication.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/PolygeneRestApplication.java
index 854592e..0bfd614 100644
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/PolygeneRestApplication.java
+++ b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/PolygeneRestApplication.java
@@ -33,6 +33,7 @@ import org.apache.polygene.library.restlet.resource.EntryPointResource;
 import org.apache.polygene.library.restlet.resource.ResourceFactory;
 import org.apache.polygene.library.restlet.resource.ServerResource;
 import org.apache.polygene.library.restlet.serialization.PolygeneConverter;
+import org.restlet.Component;
 import org.restlet.Context;
 import org.restlet.Restlet;
 import org.restlet.data.ChallengeScheme;
@@ -59,10 +60,12 @@ public abstract class PolygeneRestApplication extends org.restlet.Application
     protected ObjectFactory objectFactory;
 
     protected Router router;
+    protected String basePath;
 
-    protected PolygeneRestApplication( Context context )
+    protected PolygeneRestApplication( String basePath, Context context )
     {
         super( context );
+        this.basePath = basePath;
     }
 
     protected void printRoutes( PrintStream out )
@@ -105,25 +108,34 @@ public abstract class PolygeneRestApplication extends org.restlet.Application
         router = new Router( context );
 
         addRoutes( router );
-        router.attach( "/", newPolygeneRestlet( EntryPointResource.class, EntryPoint.class ) );
-
-        ChallengeAuthenticator guard = new ChallengeAuthenticator( context, ChallengeScheme.HTTP_BASIC, getName() + " Realm" );
+        router.attach( basePath, newPolygeneRestlet( EntryPointResource.class, EntryPoint.class ) );
 
         Verifier verifier = createVerifier();
-        if( verifier != null )
+        Enroler enroler = createEnroler();
+        if( verifier == null && enroler == null )
         {
-            guard.setVerifier( verifier );
+            return createInterceptors(new Filter()
+                {
+                } );
         }
-
-        Enroler enroler = createEnroler();
-        if( enroler != null )
+        else
         {
-            guard.setEnroler( enroler );
+            ChallengeAuthenticator guard = new ChallengeAuthenticator( context, ChallengeScheme.HTTP_BASIC, getName() + " Realm" );
+
+            if( verifier != null )
+            {
+                guard.setVerifier( verifier );
+            }
+
+            if( enroler != null )
+            {
+                guard.setEnroler( enroler );
+            }
+            return createInterceptors( guard );
         }
-        return createInterceptors( guard );
     }
 
-    private Restlet createInterceptors( ChallengeAuthenticator guard )
+    private Restlet createInterceptors( Filter guard )
     {
         Filter inner = createInnerInterceptor();
         if( inner != null )

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/PolygeneServerServlet.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/PolygeneServerServlet.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/PolygeneServerServlet.java
index ce5cf03..4d2c125 100644
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/PolygeneServerServlet.java
+++ b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/PolygeneServerServlet.java
@@ -19,12 +19,16 @@
  */
 package org.apache.polygene.library.restlet;
 
+import java.util.List;
 import javax.servlet.Servlet;
 import org.apache.polygene.api.injection.scope.Structure;
 import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.object.ObjectFactory;
 import org.apache.polygene.api.structure.Module;
 import org.restlet.Context;
 import org.restlet.ext.servlet.ServerServlet;
+import org.restlet.routing.VirtualHost;
+import org.restlet.util.ServerList;
 
 /**
  * Restlet ServerServlet backed by a org.restlet.Application object.
@@ -32,16 +36,17 @@ import org.restlet.ext.servlet.ServerServlet;
 @Mixins( PolygeneServerServlet.Mixin.class )
 public interface PolygeneServerServlet extends Servlet
 {
-    class Mixin
-        extends ServerServlet
+    class Mixin extends ServerServlet
     {
         @Structure
-        private Module module;
+        private ObjectFactory objectFactory;
 
         @Override
         protected org.restlet.Application createApplication( Context parentContext )
         {
-            return module.newObject( org.restlet.Application.class, parentContext.createChildContext() );
+            ServerList servers = getComponent().getServers();
+            System.out.println(servers);
+            return objectFactory.newObject( PolygeneRestApplication.class, parentContext.createChildContext() );
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/GenericRestLayer.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/GenericRestLayer.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/GenericRestLayer.java
deleted file mode 100644
index bbe10ab..0000000
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/GenericRestLayer.java
+++ /dev/null
@@ -1,34 +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.polygene.library.restlet.assembly;
-
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler;
-
-public class GenericRestLayer extends LayeredLayerAssembler
-{
-
-    @Override
-    public LayerAssembly assemble( LayerAssembly layer )
-    {
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/RestApplicationAssembler.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/RestApplicationAssembler.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/RestApplicationAssembler.java
deleted file mode 100644
index c520e75..0000000
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/RestApplicationAssembler.java
+++ /dev/null
@@ -1,85 +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.polygene.library.restlet.assembly;
-
-import java.util.LinkedHashMap;
-import java.util.function.BinaryOperator;
-import org.apache.polygene.api.activation.PassivationException;
-import org.apache.polygene.api.structure.Application;
-import org.apache.polygene.bootstrap.ApplicationAssembly;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.layered.LayerAssembler;
-import org.apache.polygene.bootstrap.layered.LayeredApplicationAssembler;
-import org.apache.polygene.bootstrap.layered.ModuleAssembler;
-
-public class RestApplicationAssembler extends LayeredApplicationAssembler
-{
-    private final LinkedHashMap<Class<? extends LayerAssembler>, LayerAssembly> assemblies = new LinkedHashMap<>();
-    private Class<? extends LayerAssembler>[] layers;
-
-    @SafeVarargs
-    public RestApplicationAssembler( String name, String version, Application.Mode mode, Class<? extends LayerAssembler>... layers )
-        throws AssemblyException
-    {
-        super( name, version, mode );
-        this.layers = layers;
-    }
-
-    @Override
-    protected void assembleLayers( ApplicationAssembly assembly )
-    {
-        for( Class<? extends LayerAssembler> layer : layers )
-        {
-            LayerAssembly layerAssembly = createLayer( layer );
-            assemblies.put( layer, layerAssembly );
-        }
-    }
-
-    public void setupUses( BinaryOperator<LayerAssembly> uses )
-    {
-        assemblies.values().stream().reduce( uses );
-    }
-
-    public void setupUses()
-    {
-        assemblies.values().stream().reduce( LayerAssembly::uses );
-    }
-
-    public LayerAssembly layer( Class<? extends LayerAssembler> layerClass, ModuleAssembler... assemblers )
-    {
-        return assemblies.get( layerClass );
-    }
-
-    public void addShutdownHook()
-    {
-        Runtime.getRuntime().addShutdownHook( new Thread( () -> {
-            try
-            {
-                stop();
-            }
-            catch( PassivationException e )
-            {
-                e.printStackTrace();
-            }
-        } ) );
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/RestletCrudConnectivityAssembler.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/RestletCrudConnectivityAssembler.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/RestletCrudConnectivityAssembler.java
index 6da0361..0eb1d5e 100644
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/RestletCrudConnectivityAssembler.java
+++ b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/RestletCrudConnectivityAssembler.java
@@ -38,6 +38,9 @@ import org.apache.polygene.library.restlet.resource.ResourceBuilder;
 import org.apache.polygene.library.restlet.serialization.FormRepresentation;
 import org.apache.polygene.library.restlet.serialization.JsonRepresentation;
 
+/** This assembler should go to a module in the layer of the {@link RestletCrudModuleAssembler}.
+ *
+ */
 public class RestletCrudConnectivityAssembler
     implements Assembler
 {

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/RestletCrudModuleAssembler.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/RestletCrudModuleAssembler.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/RestletCrudModuleAssembler.java
index 562586f..490804b 100644
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/RestletCrudModuleAssembler.java
+++ b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/RestletCrudModuleAssembler.java
@@ -22,14 +22,17 @@ package org.apache.polygene.library.restlet.assembly;
 
 import org.apache.polygene.api.common.Visibility;
 import org.apache.polygene.api.unitofwork.concern.UnitOfWorkConcern;
-import org.apache.polygene.bootstrap.Assembler;
+import org.apache.polygene.bootstrap.Assemblers;
 import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.ServiceDeclaration;
 import org.apache.polygene.library.restlet.repository.CrudRepository;
 import org.apache.polygene.library.restlet.repository.EntityTypeDescriptor;
 import org.apache.polygene.library.restlet.repository.SmallCrudRepositoryMixin;
 
-public class RestletCrudModuleAssembler
-    implements Assembler
+/**
+ * This assembler should be used for each module that has CRUD types, reachable by the REST API.
+ */
+public class RestletCrudModuleAssembler extends Assemblers.VisibilityIdentity<RestletCrudModuleAssembler>
 {
     private final Class type;
     private final Class repositoryType;
@@ -49,15 +52,21 @@ public class RestletCrudModuleAssembler
     @Override
     public void assemble( ModuleAssembly module )
     {
-        module
+        ServiceDeclaration declaration = module
             .addServices( repositoryType )
-            .identifiedBy( "repository_" + type.getSimpleName() )
             .visibleIn( Visibility.application )
             .withMixins( SmallCrudRepositoryMixin.class )
             .withConcerns( UnitOfWorkConcern.class )
             .taggedWith( type.getSimpleName() )
-            .setMetaInfo( new EntityTypeDescriptor( type ) )
-        ;
+            .setMetaInfo( new EntityTypeDescriptor( type ) );
+        if( hasIdentity() )
+        {
+            declaration.identifiedBy( identity() );
+        }
+        else
+        {
+            declaration.identifiedBy( "repository_" + type.getSimpleName() );
+        }
         module.entities( type ).visibleIn( Visibility.layer );
         module.values( type ).visibleIn( Visibility.layer );
     }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationLayer.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationLayer.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationLayer.java
deleted file mode 100644
index e615347..0000000
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationLayer.java
+++ /dev/null
@@ -1,45 +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.polygene.library.restlet.assembly.configuration;
-
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.layered.LayerAssembler;
-import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler;
-
-public class ConfigurationLayer extends LayeredLayerAssembler
-    implements LayerAssembler
-{
-    public static final String NAME = "Configuration Layer";
-    private ModuleAssembly configModule;
-
-    @Override
-    public LayerAssembly assemble( LayerAssembly layer )
-    {
-        configModule = createModule( layer, ConfigurationModule.class );
-        return layer;
-    }
-
-    public ModuleAssembly configModule()
-    {
-        return configModule;
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationModule.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationModule.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationModule.java
deleted file mode 100644
index dd65cfa..0000000
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationModule.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy 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.polygene.library.restlet.assembly.configuration;
-
-import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.layered.ModuleAssembler;
-import org.apache.polygene.entitystore.memory.MemoryEntityStoreService;
-
-public class ConfigurationModule
-    implements ModuleAssembler
-{
-    public static final String NAME = "Configuration Module";
-    @Override
-    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
-    {
-        module.services( MemoryEntityStoreService.class ).visibleIn( Visibility.layer );
-        return module;
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/connectivity/ConnectivityLayer.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/connectivity/ConnectivityLayer.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/connectivity/ConnectivityLayer.java
deleted file mode 100644
index c0d45dc..0000000
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/connectivity/ConnectivityLayer.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy 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.polygene.library.restlet.assembly.connectivity;
-
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.layered.LayerAssembler;
-import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler;
-
-public class ConnectivityLayer extends LayeredLayerAssembler
-    implements LayerAssembler
-{
-    public static final String NAME = "Connectivity Layer";
-
-    @Override
-    public LayerAssembly assemble( LayerAssembly layer )
-    {
-        createModule( layer, RestModule.class );
-        createModule( layer, SecurityModule.class );
-        return layer;
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/connectivity/RestModule.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/connectivity/RestModule.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/connectivity/RestModule.java
deleted file mode 100644
index 29349f5..0000000
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/connectivity/RestModule.java
+++ /dev/null
@@ -1,40 +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.polygene.library.restlet.assembly.connectivity;
-
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.layered.ModuleAssembler;
-import org.apache.polygene.library.restlet.assembly.RestletCrudConnectivityAssembler;
-import org.apache.polygene.library.restlet.resource.EntryPoint;
-
-public class RestModule
-    implements ModuleAssembler
-{
-    public static final String NAME = "REST Module";
-
-    @Override
-    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
-    {
-        new RestletCrudConnectivityAssembler().assemble( module );
-        module.values( EntryPoint.class );
-        return module;
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/connectivity/SecurityModule.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/connectivity/SecurityModule.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/connectivity/SecurityModule.java
deleted file mode 100644
index 02ca63f..0000000
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/connectivity/SecurityModule.java
+++ /dev/null
@@ -1,35 +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.polygene.library.restlet.assembly.connectivity;
-
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.layered.ModuleAssembler;
-
-public class SecurityModule
-    implements ModuleAssembler
-{
-    @Override
-    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
-    {
-        return module;
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/domain/CrudModule.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/domain/CrudModule.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/domain/CrudModule.java
deleted file mode 100644
index 769390b..0000000
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/domain/CrudModule.java
+++ /dev/null
@@ -1,38 +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.polygene.library.restlet.assembly.domain;
-
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.layered.ModuleAssembler;
-import org.apache.polygene.library.restlet.assembly.CrudServiceAssembler;
-
-public class CrudModule
-    implements ModuleAssembler
-{
-    public static final String NAME = "CRUD Module";
-
-    @Override
-    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
-    {
-        new CrudServiceAssembler().assemble( module );
-        return module;
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/domain/DomainLayer.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/domain/DomainLayer.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/domain/DomainLayer.java
deleted file mode 100644
index 9fe73f3..0000000
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/domain/DomainLayer.java
+++ /dev/null
@@ -1,37 +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.polygene.library.restlet.assembly.domain;
-
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.layered.LayerAssembler;
-import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler;
-
-public class DomainLayer extends LayeredLayerAssembler
-    implements LayerAssembler
-{
-    public static final String NAME = "Domain Layer";
-
-    @Override
-    public LayerAssembly assemble( LayerAssembly layer )
-    {
-        createModule( layer, CrudModule.class );
-        return layer;
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/infrastructue/FileStorageModule.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/infrastructue/FileStorageModule.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/infrastructue/FileStorageModule.java
deleted file mode 100644
index 4d410f7..0000000
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/infrastructue/FileStorageModule.java
+++ /dev/null
@@ -1,50 +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.polygene.library.restlet.assembly.infrastructue;
-
-import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.layered.ModuleAssembler;
-import org.apache.polygene.entitystore.file.assembly.FileEntityStoreAssembler;
-
-public class FileStorageModule
-    implements ModuleAssembler
-{
-    public static final String NAME = "Storage Module";
-
-    private final ModuleAssembly configModule;
-
-    public FileStorageModule( ModuleAssembly configModule )
-    {
-        this.configModule = configModule;
-    }
-
-    @Override
-    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
-    {
-        new FileEntityStoreAssembler()
-            .visibleIn( Visibility.application  )
-            .withConfig( configModule, Visibility.application )
-            .assemble( module );
-        return module;
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/infrastructue/IndexingModule.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/infrastructue/IndexingModule.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/infrastructue/IndexingModule.java
deleted file mode 100644
index 9977b93..0000000
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/infrastructue/IndexingModule.java
+++ /dev/null
@@ -1,54 +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.polygene.library.restlet.assembly.infrastructue;
-
-import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.layered.ModuleAssembler;
-import org.apache.polygene.index.rdf.assembly.RdfNativeSesameStoreAssembler;
-import org.apache.polygene.library.rdf.repository.NativeConfiguration;
-
-public class IndexingModule
-    implements ModuleAssembler
-{
-    public static final String NAME = "Indexing Module";
-    private final ModuleAssembly configModule;
-
-    public IndexingModule( ModuleAssembly configModule )
-    {
-        this.configModule = configModule;
-    }
-
-    @Override
-    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
-    {
-//        new FileConfigurationAssembler().assemble( module );
-//        new ESFilesystemIndexQueryAssembler()
-//            .visibleIn( Visibility.application )
-//            .withConfig( configModule, Visibility.application )
-//            .assemble( module );
-
-        configModule.entities( NativeConfiguration.class ).visibleIn( Visibility.application );
-        new RdfNativeSesameStoreAssembler(Visibility.application, Visibility.module).assemble( module );
-        return module;
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/infrastructue/InfrastructureLayer.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/infrastructue/InfrastructureLayer.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/infrastructue/InfrastructureLayer.java
deleted file mode 100644
index 7d98ff3..0000000
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/infrastructue/InfrastructureLayer.java
+++ /dev/null
@@ -1,54 +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.polygene.library.restlet.assembly.infrastructue;
-
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.layered.LayerAssembler;
-import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler;
-import org.apache.polygene.library.restlet.assembly.configuration.ConfigurationLayer;
-import org.apache.polygene.library.restlet.assembly.configuration.ConfigurationModule;
-
-public class InfrastructureLayer extends LayeredLayerAssembler
-    implements LayerAssembler
-{
-    public static final String NAME = "Infrastructure Layer";
-    private final ModuleAssembly configModule;
-
-    public static InfrastructureLayer create( LayerAssembly layer )
-    {
-        ModuleAssembly config = layer.application().layer( ConfigurationLayer.NAME ).module( ConfigurationModule.NAME );
-        return new InfrastructureLayer( config );
-    }
-
-    public InfrastructureLayer( ModuleAssembly configModule )
-    {
-        this.configModule = configModule;
-    }
-
-    @Override
-    public LayerAssembly assemble( LayerAssembly layer )
-    {
-        new IndexingModule( configModule ).assemble( layer, layer.module( IndexingModule.NAME ) );
-        new SerializationModule().assemble( layer, layer.module( SerializationModule.NAME ) );
-        return layer;
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/infrastructue/SerializationModule.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/infrastructue/SerializationModule.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/infrastructue/SerializationModule.java
deleted file mode 100644
index 85bb76d..0000000
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/infrastructue/SerializationModule.java
+++ /dev/null
@@ -1,37 +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.polygene.library.restlet.assembly.infrastructue;
-
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.layered.ModuleAssembler;
-
-public class SerializationModule
-    implements ModuleAssembler
-{
-    public static final String NAME = "Serialization Module";
-
-    @Override
-    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
-    {
-        return module;
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/resource/ResourceLayer.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/resource/ResourceLayer.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/resource/ResourceLayer.java
deleted file mode 100644
index a209315..0000000
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/resource/ResourceLayer.java
+++ /dev/null
@@ -1,37 +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.polygene.library.restlet.assembly.resource;
-
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.layered.LayerAssembler;
-import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler;
-
-public class ResourceLayer extends LayeredLayerAssembler
-    implements LayerAssembler
-{
-    public static final String NAME = "Resource Layer";
-
-    @Override
-    public LayerAssembly assemble( LayerAssembly layer )
-    {
-        return layer;
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/crud/EntityListResource.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/crud/EntityListResource.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/crud/EntityListResource.java
index 6085c22..175ee7c 100644
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/crud/EntityListResource.java
+++ b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/crud/EntityListResource.java
@@ -93,13 +93,10 @@ public interface EntityListResource<T extends HasIdentity> extends ServerResourc
                 name = nameField.value().get();
             }
             Reference base = parameters.request().get().getResourceRef();
-
-            //noinspection unchecked
             Class<T> entityType = parameters.entityType().get();
-
             Identity identity = identityManager.generate(entityType, name);
             locator.find( entityType ).create( identity );
-            return resourceBuilder.createRestLink( identity, base, Method.GET );
+            return resourceBuilder.createRestLink( identity.toString(), base, Method.GET );
         }
 
         @SuppressWarnings( "unchecked" )

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/crud/EntityResource.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/crud/EntityResource.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/crud/EntityResource.java
index 965a33a..91b05ea 100644
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/crud/EntityResource.java
+++ b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/crud/EntityResource.java
@@ -40,7 +40,6 @@ import org.apache.polygene.library.restlet.RestLink;
 import org.apache.polygene.library.restlet.repository.RepositoryLocator;
 import org.apache.polygene.library.restlet.resource.ResourceBuilder;
 import org.apache.polygene.library.restlet.resource.ServerResource;
-import org.apache.polygene.spi.PolygeneSPI;
 import org.restlet.data.Reference;
 
 @Mixins( EntityResource.Mixin.class )
@@ -57,15 +56,9 @@ public interface EntityResource<T extends HasIdentity> extends ServerResource<T>
     {
 
         @Structure
-        private PolygeneSPI spi;
-
-        @Structure
         private ValueBuilderFactory vbf;
 
         @This
-        private HasIdentity me;
-
-        @This
         private Parameters<T> parameters;
 
         @This
@@ -95,7 +88,7 @@ public interface EntityResource<T extends HasIdentity> extends ServerResource<T>
         @Override
         public void delete()
         {
-            Class entityType = parameters.entityType().get();
+            Class<? extends HasIdentity> entityType = parameters.entityType().get();
             String idOfEntity = parameters.id().get();
             locator.find( entityType ).delete( StringIdentity.identityOf( idOfEntity ) );
         }
@@ -137,10 +130,10 @@ public interface EntityResource<T extends HasIdentity> extends ServerResource<T>
                 throw new RuntimeException( message, e );
             }
             Reference base = parameters.request().get().getResourceRef();
-            return resourceBuilder.createRestLink( StringIdentity.identityOf( "" ), base, org.restlet.data.Method.GET );
+            return resourceBuilder.createRestLink( "", base, org.restlet.data.Method.GET );
         }
 
-        private Object createParametersComposite( RestForm form, Class argType )
+        private Object createParametersComposite( RestForm form, Class<?> argType )
         {
             ValueBuilder<?> vb = vbf.newValueBuilderWithState(
                 argType,

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/CreationResource.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/CreationResource.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/CreationResource.java
index fe86473..cee4b23 100644
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/CreationResource.java
+++ b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/CreationResource.java
@@ -66,11 +66,11 @@ public interface CreationResource<T extends HasIdentity> extends ServerResource<
         public RestLink post( RestForm form )
         {
             String name = form.field( "name" ).value().get();
-            Class entityType = parameters.entityType().get();
+            Class<? extends HasIdentity> entityType = parameters.entityType().get();
             Identity identity = identityManager.generate( entityType, name );
             locator.find( entityType ).create( identity );
             doParameterization( form, entityType, identity );
-            return resourceBuilder.createRestLink( identity, parameters.request().get().getResourceRef(), Method.GET );
+            return resourceBuilder.createRestLink( identity.toString(), parameters.request().get().getResourceRef(), Method.GET );
         }
 
         private <P> void doParameterization( RestForm form, Class entityType, Identity identity )
@@ -79,7 +79,7 @@ public interface CreationResource<T extends HasIdentity> extends ServerResource<
             {
                 return;
             }
-            //noinspection unchecked
+            @SuppressWarnings( "unchecked" )
             CreationParameterized<P> created = (CreationParameterized<P>) locator.find( entityType ).get( identity );
             P parameterization = createParameterizationValue( form, created );
             created.parameterize( parameterization );
@@ -94,7 +94,7 @@ public interface CreationResource<T extends HasIdentity> extends ServerResource<
                 association -> null,
                 association -> null,
                 association -> null
-            );
+                                                             );
             return vb.newInstance();
         }
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/EntryPointResource.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/EntryPointResource.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/EntryPointResource.java
index b497ebd..2e56c8a 100644
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/EntryPointResource.java
+++ b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/EntryPointResource.java
@@ -80,11 +80,11 @@ public interface EntryPointResource extends ServerResource<EntryPoint>
                         RestLink link;
                         if( route.getDescription() == null )
                         {
-                            link = resourceBuilder.createRestLink( StringIdentity.identityOf( template.getPattern() ), hostRef, Method.GET );
+                            link = resourceBuilder.createRestLink( template.getPattern(), hostRef, Method.GET );
                         }
                         else
                         {
-                            link = resourceBuilder.createRestLink( StringIdentity.identityOf( template.getPattern() ), hostRef, Method.GET, route.getDescription() );
+                            link = resourceBuilder.createRestLink( template.getPattern(), hostRef, Method.GET, route.getDescription() );
                         }
                         entryPoints.put( route.getName(), link );
                     }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/ResourceBuilder.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/ResourceBuilder.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/ResourceBuilder.java
index be851a6..fded105 100644
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/ResourceBuilder.java
+++ b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/resource/ResourceBuilder.java
@@ -24,7 +24,6 @@ import java.io.IOException;
 import java.util.Collections;
 import org.apache.polygene.api.identity.HasIdentity;
 import org.apache.polygene.api.identity.Identity;
-import org.apache.polygene.api.identity.StringIdentity;
 import org.apache.polygene.api.injection.scope.Service;
 import org.apache.polygene.api.injection.scope.Structure;
 import org.apache.polygene.api.mixin.Mixins;
@@ -48,13 +47,13 @@ import org.restlet.routing.Router;
 @Mixins( ResourceBuilder.Mixin.class )
 public interface ResourceBuilder
 {
-    EntityRef createEntityRef(Identity name, Reference base );
+    EntityRef createEntityRef( Identity name, Reference base );
 
     EntityRef createEntityRef( Identity name, RestLink get, RestLink put, RestLink delete );
 
-    RestLink createRestLink( Identity name, Reference base, Method method );
+    RestLink createRestLink( String name, Reference base, Method method );
 
-    RestLink createRestLink( Identity name, Reference base, Method method, String description );
+    RestLink createRestLink( String name, Reference base, Method method, String description );
 
     Command createCommand( Reference base );
 
@@ -62,9 +61,9 @@ public interface ResourceBuilder
 
     FormField createFormField( String name, String type );
 
-    <T extends HasIdentity> Representation toRepresentation(Class<T> type, T composite );
+    <T extends HasIdentity> Representation toRepresentation( Class<T> type, T composite );
 
-    <T extends HasIdentity> T toObject(Class<T> type, Representation representation )
+    <T extends HasIdentity> T toObject( Class<T> type, Representation representation )
         throws IOException;
 
     Route findRoute( String name, Router router );
@@ -88,9 +87,11 @@ public interface ResourceBuilder
         @Override
         public EntityRef createEntityRef( Identity identity, Reference base )
         {
-            RestLink get = createRestLink( identity, base, Method.GET );
-            RestLink put = createRestLink( identity, base, Method.PUT );
-            RestLink delete = createRestLink( identity, base, Method.DELETE );
+            String name = identityManager.extractName( identity );
+
+            RestLink get = createRestLink( name, base, Method.GET );
+            RestLink put = createRestLink( name, base, Method.PUT );
+            RestLink delete = createRestLink( name, base, Method.DELETE );
             return createEntityRef( identity, get, put, delete );
         }
 
@@ -107,10 +108,8 @@ public interface ResourceBuilder
         }
 
         @Override
-        public RestLink createRestLink( Identity identity, Reference base, Method method )
+        public RestLink createRestLink( String name, Reference base, Method method )
         {
-            String name = identityManager.extractName( identity );
-
             ValueBuilder<RestLink> builder = vbf.newValueBuilder( RestLink.class );
             RestLink prototype = builder.prototype();
             String path = base.toUri().resolve( name ).getPath();
@@ -120,9 +119,8 @@ public interface ResourceBuilder
         }
 
         @Override
-        public RestLink createRestLink( Identity identity, Reference base, Method method, String description )
+        public RestLink createRestLink( String name, Reference base, Method method, String description )
         {
-            String name = identityManager.extractName( identity );
             ValueBuilder<RestLink> builder = vbf.newValueBuilder( RestLink.class );
             RestLink prototype = builder.prototype();
             prototype.path().set( base.toUri().resolve( name ).getPath() + "/" );
@@ -143,7 +141,7 @@ public interface ResourceBuilder
         public RestForm createNameForm( Reference base )
         {
             ValueBuilder<RestForm> builder = vbf.newValueBuilder( RestForm.class );
-            builder.prototype().link().set( createRestLink( StringIdentity.identityOf( "form" ), base, Method.POST ) );
+            builder.prototype().link().set( createRestLink( "form", base, Method.POST ) );
             builder.prototype().fields().set( Collections.singletonList( createFormField( "name", FormField.TEXT ) ) );
             return builder.newInstance();
         }
@@ -157,13 +155,13 @@ public interface ResourceBuilder
         }
 
         @Override
-        public <T extends HasIdentity> Representation toRepresentation(Class<T> type, T composite )
+        public <T extends HasIdentity> Representation toRepresentation( Class<T> type, T composite )
         {
             return converter.toRepresentation( composite, new Variant(), null );
         }
 
         @Override
-        public <T extends HasIdentity> T toObject(Class<T> type, Representation representation )
+        public <T extends HasIdentity> T toObject( Class<T> type, Representation representation )
             throws IOException
         {
             return converter.toObject( representation, type, null );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/serialization/JsonRepresentation.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/serialization/JsonRepresentation.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/serialization/JsonRepresentation.java
index ea0929b..fafabe4 100644
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/serialization/JsonRepresentation.java
+++ b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/serialization/JsonRepresentation.java
@@ -23,12 +23,12 @@ package org.apache.polygene.library.restlet.serialization;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
-import java.io.OutputStreamWriter;
 import org.apache.polygene.api.common.Optional;
 import org.apache.polygene.api.injection.scope.Service;
 import org.apache.polygene.api.injection.scope.Structure;
 import org.apache.polygene.api.injection.scope.Uses;
 import org.apache.polygene.api.serialization.Serialization;
+import org.apache.polygene.api.serialization.Serializer;
 import org.apache.polygene.api.structure.ModuleDescriptor;
 import org.apache.polygene.spi.PolygeneSPI;
 import org.restlet.data.MediaType;
@@ -84,7 +84,7 @@ public class JsonRepresentation<T> extends OutputRepresentation
      *
      * @return The wrapped object.
      *
-     * @throws IOException
+     * @throws IOException if there is an underlying I/O problem.
      */
     public T getObject()
         throws IOException
@@ -123,8 +123,7 @@ public class JsonRepresentation<T> extends OutputRepresentation
         }
         else if( object != null )
         {
-            // TODO was WITHOUT TYPE INFO
-            stateSerialization.serialize( new OutputStreamWriter( outputStream ), object );
+            stateSerialization.serialize( Serializer.Options.NO_TYPE_INFO, outputStream, object );
             outputStream.write( '\n' );
         }
     }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/TestApplication.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/TestApplication.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/TestApplication.java
index 6d21d05..3b8fb2b 100644
--- a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/TestApplication.java
+++ b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/TestApplication.java
@@ -45,11 +45,11 @@ public class TestApplication
         throws Exception
     {
         RestApplicationAssembler assembler = new RestApplicationAssembler( NAME, VERSION, MODE,
-            ConfigurationLayer.class,
-            InfrastructureLayer.class,
-            DomainLayer.class,
-            ResourceLayer.class,
-            ConnectivityLayer.class
+                                                                           ConnectivityLayer.class,
+                                                                           ResourceLayer.class,
+                                                                           DomainLayer.class,
+                                                                           InfrastructureLayer.class,
+                                                                           ConfigurationLayer.class
         );
 
         assembler.initialize();

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/RestApplicationAssembler.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/RestApplicationAssembler.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/RestApplicationAssembler.java
new file mode 100644
index 0000000..c520e75
--- /dev/null
+++ b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/RestApplicationAssembler.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.polygene.library.restlet.assembly;
+
+import java.util.LinkedHashMap;
+import java.util.function.BinaryOperator;
+import org.apache.polygene.api.activation.PassivationException;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.bootstrap.ApplicationAssembly;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.layered.LayerAssembler;
+import org.apache.polygene.bootstrap.layered.LayeredApplicationAssembler;
+import org.apache.polygene.bootstrap.layered.ModuleAssembler;
+
+public class RestApplicationAssembler extends LayeredApplicationAssembler
+{
+    private final LinkedHashMap<Class<? extends LayerAssembler>, LayerAssembly> assemblies = new LinkedHashMap<>();
+    private Class<? extends LayerAssembler>[] layers;
+
+    @SafeVarargs
+    public RestApplicationAssembler( String name, String version, Application.Mode mode, Class<? extends LayerAssembler>... layers )
+        throws AssemblyException
+    {
+        super( name, version, mode );
+        this.layers = layers;
+    }
+
+    @Override
+    protected void assembleLayers( ApplicationAssembly assembly )
+    {
+        for( Class<? extends LayerAssembler> layer : layers )
+        {
+            LayerAssembly layerAssembly = createLayer( layer );
+            assemblies.put( layer, layerAssembly );
+        }
+    }
+
+    public void setupUses( BinaryOperator<LayerAssembly> uses )
+    {
+        assemblies.values().stream().reduce( uses );
+    }
+
+    public void setupUses()
+    {
+        assemblies.values().stream().reduce( LayerAssembly::uses );
+    }
+
+    public LayerAssembly layer( Class<? extends LayerAssembler> layerClass, ModuleAssembler... assemblers )
+    {
+        return assemblies.get( layerClass );
+    }
+
+    public void addShutdownHook()
+    {
+        Runtime.getRuntime().addShutdownHook( new Thread( () -> {
+            try
+            {
+                stop();
+            }
+            catch( PassivationException e )
+            {
+                e.printStackTrace();
+            }
+        } ) );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationLayer.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationLayer.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationLayer.java
new file mode 100644
index 0000000..e615347
--- /dev/null
+++ b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationLayer.java
@@ -0,0 +1,45 @@
+/*
+ *  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.polygene.library.restlet.assembly.configuration;
+
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.LayerAssembler;
+import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler;
+
+public class ConfigurationLayer extends LayeredLayerAssembler
+    implements LayerAssembler
+{
+    public static final String NAME = "Configuration Layer";
+    private ModuleAssembly configModule;
+
+    @Override
+    public LayerAssembly assemble( LayerAssembly layer )
+    {
+        configModule = createModule( layer, ConfigurationModule.class );
+        return layer;
+    }
+
+    public ModuleAssembly configModule()
+    {
+        return configModule;
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationModule.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationModule.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationModule.java
new file mode 100644
index 0000000..dd65cfa
--- /dev/null
+++ b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationModule.java
@@ -0,0 +1,39 @@
+/*
+ *  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.polygene.library.restlet.assembly.configuration;
+
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.ModuleAssembler;
+import org.apache.polygene.entitystore.memory.MemoryEntityStoreService;
+
+public class ConfigurationModule
+    implements ModuleAssembler
+{
+    public static final String NAME = "Configuration Module";
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+    {
+        module.services( MemoryEntityStoreService.class ).visibleIn( Visibility.layer );
+        return module;
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/connectivity/ConnectivityLayer.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/connectivity/ConnectivityLayer.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/connectivity/ConnectivityLayer.java
new file mode 100644
index 0000000..c0d45dc
--- /dev/null
+++ b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/connectivity/ConnectivityLayer.java
@@ -0,0 +1,39 @@
+/*
+ *  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.polygene.library.restlet.assembly.connectivity;
+
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.layered.LayerAssembler;
+import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler;
+
+public class ConnectivityLayer extends LayeredLayerAssembler
+    implements LayerAssembler
+{
+    public static final String NAME = "Connectivity Layer";
+
+    @Override
+    public LayerAssembly assemble( LayerAssembly layer )
+    {
+        createModule( layer, RestModule.class );
+        createModule( layer, SecurityModule.class );
+        return layer;
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/connectivity/RestModule.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/connectivity/RestModule.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/connectivity/RestModule.java
new file mode 100644
index 0000000..29349f5
--- /dev/null
+++ b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/connectivity/RestModule.java
@@ -0,0 +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.polygene.library.restlet.assembly.connectivity;
+
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.ModuleAssembler;
+import org.apache.polygene.library.restlet.assembly.RestletCrudConnectivityAssembler;
+import org.apache.polygene.library.restlet.resource.EntryPoint;
+
+public class RestModule
+    implements ModuleAssembler
+{
+    public static final String NAME = "REST Module";
+
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+    {
+        new RestletCrudConnectivityAssembler().assemble( module );
+        module.values( EntryPoint.class );
+        return module;
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/connectivity/SecurityModule.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/connectivity/SecurityModule.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/connectivity/SecurityModule.java
new file mode 100644
index 0000000..02ca63f
--- /dev/null
+++ b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/connectivity/SecurityModule.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.polygene.library.restlet.assembly.connectivity;
+
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.ModuleAssembler;
+
+public class SecurityModule
+    implements ModuleAssembler
+{
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+    {
+        return module;
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/domain/CrudModule.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/domain/CrudModule.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/domain/CrudModule.java
new file mode 100644
index 0000000..769390b
--- /dev/null
+++ b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/domain/CrudModule.java
@@ -0,0 +1,38 @@
+/*
+ *  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.polygene.library.restlet.assembly.domain;
+
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.ModuleAssembler;
+import org.apache.polygene.library.restlet.assembly.CrudServiceAssembler;
+
+public class CrudModule
+    implements ModuleAssembler
+{
+    public static final String NAME = "CRUD Module";
+
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+    {
+        new CrudServiceAssembler().assemble( module );
+        return module;
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/domain/DomainLayer.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/domain/DomainLayer.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/domain/DomainLayer.java
new file mode 100644
index 0000000..9fe73f3
--- /dev/null
+++ b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/domain/DomainLayer.java
@@ -0,0 +1,37 @@
+/*
+ *  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.polygene.library.restlet.assembly.domain;
+
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.layered.LayerAssembler;
+import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler;
+
+public class DomainLayer extends LayeredLayerAssembler
+    implements LayerAssembler
+{
+    public static final String NAME = "Domain Layer";
+
+    @Override
+    public LayerAssembly assemble( LayerAssembly layer )
+    {
+        createModule( layer, CrudModule.class );
+        return layer;
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/FileStorageModule.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/FileStorageModule.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/FileStorageModule.java
new file mode 100644
index 0000000..4d410f7
--- /dev/null
+++ b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/FileStorageModule.java
@@ -0,0 +1,50 @@
+/*
+ *  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.polygene.library.restlet.assembly.infrastructue;
+
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.ModuleAssembler;
+import org.apache.polygene.entitystore.file.assembly.FileEntityStoreAssembler;
+
+public class FileStorageModule
+    implements ModuleAssembler
+{
+    public static final String NAME = "Storage Module";
+
+    private final ModuleAssembly configModule;
+
+    public FileStorageModule( ModuleAssembly configModule )
+    {
+        this.configModule = configModule;
+    }
+
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+    {
+        new FileEntityStoreAssembler()
+            .visibleIn( Visibility.application  )
+            .withConfig( configModule, Visibility.application )
+            .assemble( module );
+        return module;
+    }
+}