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/02 15:34:18 UTC
[1/5] polygene-java git commit: Constraint check is incorrect. Was
introduced when better reporting was attempted.
Repository: polygene-java
Updated Branches:
refs/heads/develop d22dc29ed -> cf12e4b89
Constraint check is incorrect. Was introduced when better reporting was attempted.
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/ed6ae814
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/ed6ae814
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/ed6ae814
Branch: refs/heads/develop
Commit: ed6ae8140f51f12f41946d09b561cac973e1260d
Parents: d22dc29
Author: niclas <ni...@hedhman.org>
Authored: Fri Jun 30 16:03:23 2017 +0800
Committer: niclas <ni...@hedhman.org>
Committed: Fri Jun 30 16:03:23 2017 +0800
----------------------------------------------------------------------
.../apache/polygene/runtime/bootstrap/CompositeAssemblyImpl.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ed6ae814/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/CompositeAssemblyImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/CompositeAssemblyImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/CompositeAssemblyImpl.java
index cb1c751..7f69916 100644
--- a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/CompositeAssemblyImpl.java
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/CompositeAssemblyImpl.java
@@ -596,8 +596,7 @@ public abstract class CompositeAssemblyImpl
// No implementation found!
// Check if if it's a composite constraints
- if( Arrays.stream( annotationType.getAnnotations() )
- .anyMatch( typeHasAnnotation( ConstraintDeclaration.class ) ) )
+ if( typeHasAnnotation( ConstraintDeclaration.class ).test( constraintAnnotation ) )
{
ValueConstraintsModel valueConstraintsModel = constraintsFor(
Arrays.stream( annotationType.getAnnotations() ),
[5/5] polygene-java git commit: Fixed a mistake in the larger
refactoring.
Posted by ni...@apache.org.
Fixed a mistake in the larger refactoring.
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/cf12e4b8
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/cf12e4b8
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/cf12e4b8
Branch: refs/heads/develop
Commit: cf12e4b892759b5c15911a96a7aa619084902c13
Parents: 3c7271c
Author: niclas <ni...@hedhman.org>
Authored: Sun Jul 2 16:19:48 2017 +0800
Committer: niclas <ni...@hedhman.org>
Committed: Sun Jul 2 16:19:48 2017 +0800
----------------------------------------------------------------------
.../app/templates/ConnectivityLayer/HttpServerModule/bootstrap.tmpl | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/cf12e4b8/tools/generator-polygene/app/templates/ConnectivityLayer/HttpServerModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/ConnectivityLayer/HttpServerModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/ConnectivityLayer/HttpServerModule/bootstrap.tmpl
index c7e161e..d30c1f3 100644
--- a/tools/generator-polygene/app/templates/ConnectivityLayer/HttpServerModule/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/ConnectivityLayer/HttpServerModule/bootstrap.tmpl
@@ -21,6 +21,7 @@ package <%= polygene.packageName %>.bootstrap.connectivity;
import java.util.HashMap;
<% if( hasFeature('security') ) { %>
+import java.io.File;
import org.apache.polygene.library.http.SecureJettyConfiguration;
import org.apache.polygene.library.http.SecureJettyServiceAssembler;
import org.apache.polygene.library.shiro.web.assembly.HttpShiroAssembler;
[4/5] polygene-java git commit: Forgot to maintain the toString()
proper.
Posted by ni...@apache.org.
Forgot to maintain the toString() proper.
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/3c7271c8
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/3c7271c8
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/3c7271c8
Branch: refs/heads/develop
Commit: 3c7271c8c037a9a9ccc04ceb99bf7028816e6309
Parents: c6b8916
Author: niclas <ni...@hedhman.org>
Authored: Sun Jul 2 14:47:50 2017 +0800
Committer: niclas <ni...@hedhman.org>
Committed: Sun Jul 2 14:47:50 2017 +0800
----------------------------------------------------------------------
.../java/org/apache/polygene/runtime/value/ValueInstance.java | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3c7271c8/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 8af2e08..79deff9 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
@@ -158,6 +158,11 @@ public final class ValueInstance extends TransientInstance
@Override
public String toString()
{
+ String json = toJsonString();
+ if( json != null )
+ {
+ return json;
+ }
return "ValueInstance{" +
"mixins=" + Arrays.toString( mixins ) +
", state=" + state +
[3/5] polygene-java git commit: Fixing the restlet library in
relation to the polygene generator to work.
Posted by ni...@apache.org.
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/develop
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;
+ }
+}
[2/5] polygene-java git commit: Fixing the restlet library in
relation to the polygene generator to work.
Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/IndexingModule.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/IndexingModule.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/IndexingModule.java
new file mode 100644
index 0000000..9977b93
--- /dev/null
+++ b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/IndexingModule.java
@@ -0,0 +1,54 @@
+/*
+ * 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/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/InfrastructureLayer.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/InfrastructureLayer.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/InfrastructureLayer.java
new file mode 100644
index 0000000..7d98ff3
--- /dev/null
+++ b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/InfrastructureLayer.java
@@ -0,0 +1,54 @@
+/*
+ * 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/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/SerializationModule.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/SerializationModule.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/SerializationModule.java
new file mode 100644
index 0000000..85bb76d
--- /dev/null
+++ b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/infrastructue/SerializationModule.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.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/test/java/org/apache/polygene/library/restlet/assembly/resource/ResourceLayer.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/resource/ResourceLayer.java b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/resource/ResourceLayer.java
new file mode 100644
index 0000000..a209315
--- /dev/null
+++ b/libraries/restlet/src/test/java/org/apache/polygene/library/restlet/assembly/resource/ResourceLayer.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.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/tools/generator-polygene/app/templates/ConnectivityLayer/HttpServerModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/ConnectivityLayer/HttpServerModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/ConnectivityLayer/HttpServerModule/bootstrap.tmpl
index d39b3c9..c7e161e 100644
--- a/tools/generator-polygene/app/templates/ConnectivityLayer/HttpServerModule/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/ConnectivityLayer/HttpServerModule/bootstrap.tmpl
@@ -19,9 +19,7 @@
-%>
package <%= polygene.packageName %>.bootstrap.connectivity;
-import java.io.File;
import java.util.HashMap;
-import javax.servlet.Servlet;
<% if( hasFeature('security') ) { %>
import org.apache.polygene.library.http.SecureJettyConfiguration;
import org.apache.polygene.library.http.SecureJettyServiceAssembler;
@@ -36,7 +34,7 @@ import org.apache.polygene.bootstrap.AssemblyException;
import org.apache.polygene.bootstrap.LayerAssembly;
import org.apache.polygene.bootstrap.ModuleAssembly;
import org.apache.polygene.bootstrap.layered.ModuleAssembler;
-import org.restlet.ext.servlet.ServerServlet;
+import org.apache.polygene.library.restlet.PolygeneServerServlet;
import <%= polygene.packageName %>.rest.<%= polygene.name %>RestApplication;
@@ -61,7 +59,6 @@ public class HttpServerModule
public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
throws AssemblyException
{
- module.services( Servlet.class ).withMixins( ServerServlet.class );
<% if( hasFeature('security') ) {
%> new HttpShiroAssembler()
.withConfig( module, Visibility.module );
@@ -89,7 +86,7 @@ public class HttpServerModule
defaults.port().set( DEFAULT_PORT );
HashMap<String, String> initParams = new HashMap<>();
initParams.put("org.restlet.application", <%= polygene.name %>RestApplication.class.getName() );
- addServlets( serve( "/" ).with(Servlet.class ).withInitParams( initParams ) ).to( module );
+ addServlets( serve( "/*" ).with(PolygeneServerServlet.class ).withInitParams( initParams ) ).to( module );
return module;
}
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/NullEnroler.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/NullEnroler.tmpl b/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/NullEnroler.tmpl
deleted file mode 100644
index c24ddce..0000000
--- a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/NullEnroler.tmpl
+++ /dev/null
@@ -1,32 +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 <%= polygene.packageName %>.rest.security;
-
-import org.restlet.data.ClientInfo;
-import org.restlet.security.Enroler;
-
-public class NullEnroler
- implements Enroler
-{
- @Override
- public void enrole( ClientInfo clientInfo )
- {
- }
-}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/NullVerifier.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/NullVerifier.tmpl b/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/NullVerifier.tmpl
deleted file mode 100644
index 5d6b349..0000000
--- a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/NullVerifier.tmpl
+++ /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 <%= polygene.packageName %>.rest.security;
-
-import org.restlet.security.SecretVerifier;
-import org.restlet.security.Verifier;
-
-public class NullVerifier extends SecretVerifier
- implements Verifier
-{
-
- @Override
- public int verify( String user, char[] secret )
- {
- return RESULT_VALID;
- }
-}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/bootstrap.tmpl
index 0594546..daa6755 100644
--- a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/bootstrap.tmpl
@@ -18,14 +18,12 @@
*
-%>
package <%= polygene.packageName %>.bootstrap.connectivity;
-
<% if( hasFeature('security') ) { %>
import <%= polygene.packageName %>.rest.security.DefaultEnroler;
import <%= polygene.packageName %>.rest.security.DefaultVerifier;
-<% } else { %>
-import <%= polygene.packageName %>.rest.security.NullEnroler;
-import <%= polygene.packageName %>.rest.security.NullVerifier;
<% } %>
+import <%= polygene.packageName %>.rest.<%= polygene.name %>RestApplication;
+import org.apache.polygene.api.common.Visibility;
import org.apache.polygene.bootstrap.AssemblyException;
import org.apache.polygene.bootstrap.LayerAssembly;
import org.apache.polygene.bootstrap.ModuleAssembly;
@@ -44,10 +42,10 @@ public class RestApiModule
{
<% if( hasFeature('security') ) { %>
module.objects( DefaultVerifier.class, DefaultEnroler.class);
-<% } else {%>
- module.objects( NullVerifier.class, NullEnroler.class);
<% } %>
new RestletCrudConnectivityAssembler().assemble( module );
+ module.objects( <%= polygene.name %>RestApplication.class )
+ .visibleIn( Visibility.layer );
module.values( EntryPoint.class );
module.values( /* add value types */ );
module.services( /* add services */ );
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/module.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/module.js b/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/module.js
index 8d4ad47..91e8104 100644
--- a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/module.js
+++ b/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/module.js
@@ -27,10 +27,6 @@ module.exports = {
copyFile(p, "DefaultEnroler");
copyFile(p, "DefaultVerifier");
}
- else {
- copyFile(p, "NullEnroler");
- copyFile(p, "NullVerifier");
- }
}
}
};
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/tools/generator-polygene/app/templates/DomainLayer/DomainModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/bootstrap.tmpl
index 5afbdd7..d23b640 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/bootstrap.tmpl
@@ -23,6 +23,7 @@ import org.apache.polygene.bootstrap.AssemblyException;
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.RestletCrudModuleAssembler;
<% for( var idx in polygene.current.cruds) {
%><%= "import " + polygene.packageName + ".model." + polygene.current.name + "." + polygene.current.cruds[idx].name + ";" %>
@@ -54,8 +55,7 @@ for( var idx in polygene.current.services) {
<%
} %>
-import static org.apache.polygene.api.common.Visibility.layer;
-import static org.apache.polygene.api.common.Visibility.application;
+import static org.apache.polygene.api.common.Visibility.*;
public class <%- firstUpper(polygene.current.name) %>Module
implements ModuleAssembler
@@ -69,8 +69,8 @@ if( polygene.current.cruds ) {
for( var value in polygene.current.cruds ) {
var crud = polygene.current.cruds[value];
%>
- <%- "module.values( " + crud.name + ".class )" + (crud.visibility ? ".visibleIn( " + crud.visibility +" )" : "" ) %>;
- <%- "module.entities( " + crud.name + ".class )" + (crud.visibility ? ".visibleIn( " + crud.visibility +" )" : "" ) %>;
+ new RestletCrudModuleAssembler( <%- crud.name %>.class )
+ .assemble( module );
<%
}
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/tools/generator-polygene/app/templates/RestAPIApplication/application.java.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/RestAPIApplication/application.java.tmpl b/tools/generator-polygene/app/templates/RestAPIApplication/application.java.tmpl
index 8b38091..e188755 100644
--- a/tools/generator-polygene/app/templates/RestAPIApplication/application.java.tmpl
+++ b/tools/generator-polygene/app/templates/RestAPIApplication/application.java.tmpl
@@ -38,19 +38,13 @@ if( hasFeature('security') ) {
%>import <%= polygene.packageName %>.rest.security.DefaultEnroler;
import <%= polygene.packageName %>.rest.security.DefaultVerifier;
<%
-} else {
-%>import <%= polygene.packageName %>.rest.security.NullEnroler;
-import <%= polygene.packageName %>.rest.security.NullVerifier;
-<%
}
%>
public class <%= polygene.name %>RestApplication extends PolygeneRestApplication
{
- private static final String BASEPATH = "/<%= polygene.name.toLowerCase() %>/";
-
- public <%= polygene.name %>RestApplication( Context context )
+ public <%= polygene.name %>RestApplication()
{
- super( context );
+ super( "/<%= polygene.name.toLowerCase() %>/", createContext() );
}
@Override
@@ -61,11 +55,18 @@ for( var moduleName in polygene.modules) {
var module = polygene.modules[moduleName];
for( var idx2 in module.cruds ) {
var crud = module.cruds[idx2];
-%> addResourcePath( "<%= crud.name.toLowerCase() %>", <%= crud.name %>.class, BASEPATH );
+%> addResourcePath( "<%= crud.name.toLowerCase() %>", <%= crud.name %>.class, basePath );
<%
}
}
-%> System.out.println( "REST API defined;" );
+%> }
+
+ @Override
+ public synchronized void start()
+ throws Exception
+ {
+ super.start();
+ System.out.println( "REST API defined;" );
printRoutes( System.out );
}
@@ -74,7 +75,8 @@ for( var moduleName in polygene.modules) {
<% if( hasFeature('security') ) {
%> return objectFactory.newObject(DefaultVerifier.class, this);
<% } else {
-%> return objectFactory.newObject(NullVerifier.class, this);
+%> // Security was not specified during generation, and Verifier is not needed.
+ return null;
<% }
%> }
@@ -83,7 +85,13 @@ for( var moduleName in polygene.modules) {
<% if( hasFeature('security') ) {
%> return objectFactory.newObject(DefaultEnroler.class, this);
<% } else {
-%> return objectFactory.newObject(NullEnroler.class, this);
+%> // Security was not specified during generation, and Enroler is not needed.
+ return null;
<% }
%> }
+
+ private static Context createContext()
+ {
+ return new Context("<%= polygene.packageName %>.rest");
+ }
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/tools/generator-polygene/app/templates/buildtool/gradle-app.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/buildtool/gradle-app.tmpl b/tools/generator-polygene/app/templates/buildtool/gradle-app.tmpl
index ad707f2..697a2b0 100644
--- a/tools/generator-polygene/app/templates/buildtool/gradle-app.tmpl
+++ b/tools/generator-polygene/app/templates/buildtool/gradle-app.tmpl
@@ -43,6 +43,7 @@ dependencies {
if( polygene.applicationtype === 'Rest API' ) {
%> implementation project( ":rest" )
implementation "org.apache.polygene.libraries:org.apache.polygene.library.restlet:$polygeneVersion"
+ runtimeOnly "org.restlet.jee:org.restlet.ext.servlet:$restletVersion"
<%
}
@@ -70,38 +71,37 @@ if( hasFeature( 'envisage' ) ) {
<%
}
if( polygene.entitystore == 'LevelDB' ) {
-%> implementation "org.fusesource.leveldbjni:leveldbjni-all:1.8"
+%> implementation "org.fusesource.leveldbjni:leveldbjni-all:$levelDbVersion"
<%
}
if( polygene.entitystore == 'DerbySQL' ) {
-%> implementation "org.apache.derby:derby:10.13.1.1"
+%> implementation "org.apache.derby:derby:$derbyVersion"
<%
}
if( polygene.entitystore == 'H2SQL' ) {
-%> implementation "com.h2database:h2:1.4.194"
+%> implementation "com.h2database:h2:$h2Version"
<%
}
if( polygene.entitystore == 'MySQL' ) {
-%> implementation "mysql:mysql-connector-java:6.0.6"
+%> implementation "mysql:mysql-connector-java:$mysqlVersion"
<%
}
if( polygene.entitystore == 'PostgreSQL' ) {
-%> implementation "org.postgresql:postgresql:42.0.0"
+%> implementation "org.postgresql:postgresql:$postgresVersion"
<%
}
if( polygene.entitystore == 'SQLite' ) {
-%> implementation "org.xerial:sqlite-jdbc:3.16.1"
+%> implementation "org.xerial:sqlite-jdbc:$sqliteVersion"
<%
}
%>
runtimeOnly "org.apache.polygene.core:org.apache.polygene.core.runtime:$polygeneVersion"
- runtimeOnly "org.restlet.jee:org.restlet.ext.servlet:2.3.4"
- runtimeOnly "org.apache.johnzon:johnzon-core:1.1.0"
- runtimeOnly "org.apache.johnzon:johnzon-mapper:1.1.0"
+ runtimeOnly "org.apache.johnzon:johnzon-core:$johnzonVersion"
+ runtimeOnly "org.apache.johnzon:johnzon-mapper:$johnzonVersion"
runtimeOnly "org.apache.geronimo.specs:geronimo-json_1.1_spec:1.0"
- implementation "ch.qos.logback:logback-classic:1.2.3"
- implementation "ch.qos.logback:logback-core:1.2.3"
+ runtimeOnly "ch.qos.logback:logback-classic:$logbackVersion"
+ runtimeOnly "ch.qos.logback:logback-core:$logbackVersion"
testImplementation "org.apache.polygene.tools:org.apache.polygene.tool.model-detail:$polygeneVersion"
testImplementation "org.apache.polygene.core:org.apache.polygene.core.testsupport:$polygeneVersion"
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/c6b89168/tools/generator-polygene/app/templates/buildtool/gradle-root.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/buildtool/gradle-root.tmpl b/tools/generator-polygene/app/templates/buildtool/gradle-root.tmpl
index 357b607..6ec2b7f 100644
--- a/tools/generator-polygene/app/templates/buildtool/gradle-root.tmpl
+++ b/tools/generator-polygene/app/templates/buildtool/gradle-root.tmpl
@@ -25,8 +25,35 @@ if( project.version == 'unspecified' )
rootProject.ext {
polygeneVersion = "<%= polygene.version %>"
+ logbackVersion = "1.2.3"
+ johnzonVersion = "1.1.0"
<% if( polygene.applicationtype === "Rest API" ) {
%> jettyVersion = "9.2.17.v20160517"
+ restletVersion = "2.3.4"
+<%
+}
+if( polygene.entitystore == 'DerbySQL' ) {
+%> derbyVersion "10.13.1.1"
+<%
+}
+if( polygene.entitystore == 'H2SQL' ) {
+%> h2Version = "1.4.194"
+<%
+}
+if( polygene.entitystore == 'MySQL' ) {
+%> mysqlVersion = "6.0.6"
+<%
+}
+if( polygene.entitystore == 'PostgreSQL' ) {
+%> postgresVersion = "42.0.0"
+<%
+}
+if( polygene.entitystore == 'LevelDB' ) {
+%> levelDbVersion = "1.8"
+<%
+}
+if( polygene.entitystore == 'SQLite' ) {
+%> sqliteVersion = "3.16.1"
<%
}
%>}