polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [01/12] zest-java git commit: ZEST-136 - Massive changes to the Runtime, refactoring the Model and Instance relationship.
Date Thu, 17 Dec 2015 13:16:17 GMT
Repository: zest-java
Updated Branches:
  refs/heads/ZEST-105 [created] 72314b856


http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/libraries/rdf/src/test/java/org/apache/zest/library/rdf/repository/MemoryRepositoryTest.java
----------------------------------------------------------------------
diff --git a/libraries/rdf/src/test/java/org/apache/zest/library/rdf/repository/MemoryRepositoryTest.java b/libraries/rdf/src/test/java/org/apache/zest/library/rdf/repository/MemoryRepositoryTest.java
index 1c696c0..a9d5abe 100644
--- a/libraries/rdf/src/test/java/org/apache/zest/library/rdf/repository/MemoryRepositoryTest.java
+++ b/libraries/rdf/src/test/java/org/apache/zest/library/rdf/repository/MemoryRepositoryTest.java
@@ -43,13 +43,8 @@ public class MemoryRepositoryTest
     @Test
     public void testMemoryRepository() throws RepositoryException
     {
-        module.injectTo( this );
-
-
         RepositoryConnection conn = repository.getConnection();
-
         Assert.assertThat( "repository is open", conn.isOpen(), CoreMatchers.equalTo( true ) );
-
         conn.close();
     }
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/libraries/rdf/src/test/java/org/apache/zest/library/rdf/repository/NativeRepositoryTest.java
----------------------------------------------------------------------
diff --git a/libraries/rdf/src/test/java/org/apache/zest/library/rdf/repository/NativeRepositoryTest.java b/libraries/rdf/src/test/java/org/apache/zest/library/rdf/repository/NativeRepositoryTest.java
index 4f756f2..8b36d06 100644
--- a/libraries/rdf/src/test/java/org/apache/zest/library/rdf/repository/NativeRepositoryTest.java
+++ b/libraries/rdf/src/test/java/org/apache/zest/library/rdf/repository/NativeRepositoryTest.java
@@ -30,8 +30,7 @@ import org.apache.zest.test.EntityTestAssembler;
 /**
  * JAVADOC
  */
-public class NativeRepositoryTest
-        extends AbstractZestTest
+public class NativeRepositoryTest extends AbstractZestTest
 {
    @Service
    Repository repository;
@@ -48,12 +47,8 @@ public class NativeRepositoryTest
    @Test
    public void testNativeRepository() throws RepositoryException
    {
-      module.injectTo(this);
-
       RepositoryConnection conn = repository.getConnection();
-
       Assert.assertThat("repository is open", conn.isOpen(), CoreMatchers.equalTo(true));
-
       conn.close();
    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/libraries/rest-client/src/main/java/org/apache/zest/library/rest/client/RequestWriterDelegator.java
----------------------------------------------------------------------
diff --git a/libraries/rest-client/src/main/java/org/apache/zest/library/rest/client/RequestWriterDelegator.java b/libraries/rest-client/src/main/java/org/apache/zest/library/rest/client/RequestWriterDelegator.java
index 6df65f1..e985bb5 100644
--- a/libraries/rest-client/src/main/java/org/apache/zest/library/rest/client/RequestWriterDelegator.java
+++ b/libraries/rest-client/src/main/java/org/apache/zest/library/rest/client/RequestWriterDelegator.java
@@ -57,7 +57,7 @@ public class RequestWriterDelegator
       {
          try
          {
-            Class writerClass = module.classLoader().loadClass( className.trim() );
+            Class writerClass = module.descriptor().classLoader().loadClass( className.trim() );
             RequestWriter requestWriter = (RequestWriter) module.newObject( writerClass );
             registerRequestWriter(requestWriter);
          } catch (ClassNotFoundException e)

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/libraries/rest-client/src/main/java/org/apache/zest/library/rest/client/ResponseReaderDelegator.java
----------------------------------------------------------------------
diff --git a/libraries/rest-client/src/main/java/org/apache/zest/library/rest/client/ResponseReaderDelegator.java b/libraries/rest-client/src/main/java/org/apache/zest/library/rest/client/ResponseReaderDelegator.java
index 0eb46f2..29dd0b3 100644
--- a/libraries/rest-client/src/main/java/org/apache/zest/library/rest/client/ResponseReaderDelegator.java
+++ b/libraries/rest-client/src/main/java/org/apache/zest/library/rest/client/ResponseReaderDelegator.java
@@ -54,7 +54,7 @@ public class ResponseReaderDelegator
       {
          try
          {
-            Class readerClass = module.classLoader().loadClass( className.trim() );
+            Class readerClass = module.descriptor().classLoader().loadClass( className.trim() );
             ResponseReader reader = (ResponseReader) module.newObject( readerClass );
             registerResponseReader( reader );
          } catch (ClassNotFoundException e)

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/libraries/rest-client/src/main/java/org/apache/zest/library/rest/client/responsereader/JSONResponseReader.java
----------------------------------------------------------------------
diff --git a/libraries/rest-client/src/main/java/org/apache/zest/library/rest/client/responsereader/JSONResponseReader.java b/libraries/rest-client/src/main/java/org/apache/zest/library/rest/client/responsereader/JSONResponseReader.java
index 3507347..09ecfb4 100644
--- a/libraries/rest-client/src/main/java/org/apache/zest/library/rest/client/responsereader/JSONResponseReader.java
+++ b/libraries/rest-client/src/main/java/org/apache/zest/library/rest/client/responsereader/JSONResponseReader.java
@@ -18,17 +18,17 @@
 package org.apache.zest.library.rest.client.responsereader;
 
 import java.util.Iterator;
-import org.json.JSONException;
-import org.json.JSONObject;
 import org.apache.zest.api.injection.scope.Service;
 import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.service.qualifier.Tagged;
-import org.apache.zest.api.structure.Module;
+import org.apache.zest.api.structure.ModuleDescriptor;
 import org.apache.zest.api.type.ValueCompositeType;
 import org.apache.zest.api.value.ValueComposite;
 import org.apache.zest.api.value.ValueDeserializer;
 import org.apache.zest.api.value.ValueSerialization;
 import org.apache.zest.library.rest.client.spi.ResponseReader;
+import org.json.JSONException;
+import org.json.JSONObject;
 import org.restlet.Response;
 import org.restlet.data.Form;
 import org.restlet.data.MediaType;
@@ -41,7 +41,7 @@ public class JSONResponseReader
    implements ResponseReader
 {
    @Structure
-   private Module module;
+   private ModuleDescriptor module;
 
    @Service
    @Tagged( ValueSerialization.Formats.JSON )
@@ -56,7 +56,7 @@ public class JSONResponseReader
          {
             String jsonValue = response.getEntityAsText();
             ValueCompositeType valueType = module.valueDescriptor( resultType.getName() ).valueType();
-            return valueDeserializer.deserialize( valueType, jsonValue );
+            return valueDeserializer.deserialize( module, valueType, jsonValue );
          }
          else if (resultType.equals(Form.class))
          {

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/ContextResourceClientFactoryTest.java
----------------------------------------------------------------------
diff --git a/libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/ContextResourceClientFactoryTest.java b/libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/ContextResourceClientFactoryTest.java
index c1d0595..b4cc831 100644
--- a/libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/ContextResourceClientFactoryTest.java
+++ b/libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/ContextResourceClientFactoryTest.java
@@ -141,7 +141,7 @@ public class ContextResourceClientFactoryTest
         throws Exception
     {
         server = new Server( Protocol.HTTP, 8888 );
-        ContextRestlet restlet = module.newObject( ContextRestlet.class, new org.restlet.Context() );
+        ContextRestlet restlet = objectFactory.newObject( ContextRestlet.class, new org.restlet.Context() );
 
         ChallengeAuthenticator guard = new ChallengeAuthenticator(null, ChallengeScheme.HTTP_BASIC, "testRealm");
         MapVerifier mapVerifier = new MapVerifier();
@@ -156,7 +156,7 @@ public class ContextResourceClientFactoryTest
         //START SNIPPET: client-create1
         Client client =   new Client( Protocol.HTTP );
 
-        ContextResourceClientFactory contextResourceClientFactory = module.newObject( ContextResourceClientFactory.class, client );
+        ContextResourceClientFactory contextResourceClientFactory = objectFactory.newObject( ContextResourceClientFactory.class, client );
         contextResourceClientFactory.setAcceptedMediaTypes( MediaType.APPLICATION_JSON );
         //END SNIPPET: client-create1
 
@@ -249,7 +249,7 @@ public class ContextResourceClientFactoryTest
             @Override
             public HandlerCommand handleResult( TestQuery result, ContextResourceClient client )
             {
-                ValueBuilder<TestQuery> builder = module.newValueBuilderWithPrototype( result );
+                ValueBuilder<TestQuery> builder = valueBuilderFactory.newValueBuilderWithPrototype( result );
 
                 builder.prototype().abc().set( "abc" + builder.prototype().abc().get() );
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/ContinuousIntegrationTest.java
----------------------------------------------------------------------
diff --git a/libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/ContinuousIntegrationTest.java b/libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/ContinuousIntegrationTest.java
index da652d1..bfe5c2e 100644
--- a/libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/ContinuousIntegrationTest.java
+++ b/libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/ContinuousIntegrationTest.java
@@ -116,7 +116,7 @@ public class ContinuousIntegrationTest
         throws Exception
     {
         server = new Server( Protocol.HTTP, 8888 );
-        ContextRestlet restlet = module.newObject( ContextRestlet.class, new org.restlet.Context() );
+        ContextRestlet restlet = objectFactory.newObject( ContextRestlet.class, new org.restlet.Context() );
 
         ChallengeAuthenticator guard = new ChallengeAuthenticator( null, ChallengeScheme.HTTP_BASIC, "testRealm" );
         MapVerifier mapVerifier = new MapVerifier();
@@ -131,7 +131,7 @@ public class ContinuousIntegrationTest
         //START SNIPPET: client-create1
         Client client = new Client( Protocol.HTTP );
 
-        ContextResourceClientFactory contextResourceClientFactory = module.newObject( ContextResourceClientFactory.class, client );
+        ContextResourceClientFactory contextResourceClientFactory = objectFactory.newObject( ContextResourceClientFactory.class, client );
         contextResourceClientFactory.setAcceptedMediaTypes( MediaType.APPLICATION_JSON );
         //END SNIPPET: client-create1
 
@@ -225,7 +225,7 @@ public class ContinuousIntegrationTest
             @Override
             public HandlerCommand handleResult( BuildSpec result, ContextResourceClient client )
             {
-                ValueBuilder<BuildSpec> builder = module.newValueBuilderWithPrototype( result );
+                ValueBuilder<BuildSpec> builder = valueBuilderFactory.newValueBuilderWithPrototype( result );
 
                 builder.prototype().buildNo().set( "#28" );
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/RssReaderTest.java
----------------------------------------------------------------------
diff --git a/libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/RssReaderTest.java b/libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/RssReaderTest.java
index 21c7eac..816fcb3 100644
--- a/libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/RssReaderTest.java
+++ b/libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/RssReaderTest.java
@@ -84,7 +84,7 @@ public class RssReaderTest
     {
         Client client = new Client( Protocol.HTTPS );
         Reference ref = new Reference( "https://github.com/Qi4j/qi4j-sdk/commits/develop.atom" );
-        ContextResourceClientFactory contextResourceClientFactory = module.newObject( ContextResourceClientFactory.class, client );
+        ContextResourceClientFactory contextResourceClientFactory = objectFactory.newObject( ContextResourceClientFactory.class, client );
 
         contextResourceClientFactory.registerResponseReader( new ResponseReader()
         {

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/libraries/rest-common/src/main/java/org/apache/zest/library/rest/common/table/TableQuery.java
----------------------------------------------------------------------
diff --git a/libraries/rest-common/src/main/java/org/apache/zest/library/rest/common/table/TableQuery.java b/libraries/rest-common/src/main/java/org/apache/zest/library/rest/common/table/TableQuery.java
index 081ab49..cd365a6 100644
--- a/libraries/rest-common/src/main/java/org/apache/zest/library/rest/common/table/TableQuery.java
+++ b/libraries/rest-common/src/main/java/org/apache/zest/library/rest/common/table/TableQuery.java
@@ -157,7 +157,7 @@ public interface TableQuery
       public Table applyTo(Table table)
       {
          ValueBuilder<Table> tableBuilder = ZestAPI.FUNCTION_COMPOSITE_INSTANCE_OF
-             .apply( table ).module().newValueBuilderWithPrototype( table );
+             .apply( table ).module().instance().newValueBuilderWithPrototype( table );
 
 /* TODO Finish label setting
          if (label() != null)

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/api/ContextResource.java
----------------------------------------------------------------------
diff --git a/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/api/ContextResource.java b/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/api/ContextResource.java
index 67c8584..eb99a46 100644
--- a/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/api/ContextResource.java
+++ b/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/api/ContextResource.java
@@ -37,6 +37,7 @@ import org.apache.zest.api.injection.scope.Service;
 import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.injection.scope.Uses;
 import org.apache.zest.api.structure.Module;
+import org.apache.zest.api.structure.ModuleDescriptor;
 import org.apache.zest.api.unitofwork.EntityTypeNotFoundException;
 import org.apache.zest.api.unitofwork.NoSuchEntityException;
 import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
@@ -871,13 +872,13 @@ public class ContextResource
         Class<?> valueType = interactionMethod.getParameterTypes()[ 0 ];
         if( ValueComposite.class.isAssignableFrom( valueType ) )
         {
-            ValueDescriptor valueDescriptor = module.valueDescriptor( valueType.getName() );
+            ValueDescriptor valueDescriptor = module.descriptor().valueDescriptor( valueType.getName() );
 
             valueDescriptor.state().properties().forEach( propertyDescriptor -> {
                 String value = getValue( propertyDescriptor.qualifiedName().name(), queryAsForm, entityAsForm );
                 if( value == null )
                 {
-                    Object initialValue = propertyDescriptor.initialValue( module );
+                    Object initialValue = propertyDescriptor.initialValue( module.descriptor() );
                     if( initialValue != null )
                     {
                         value = initialValue.toString();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/restlet/RequestReaderDelegator.java
----------------------------------------------------------------------
diff --git a/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/restlet/RequestReaderDelegator.java b/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/restlet/RequestReaderDelegator.java
index 801dca9..49f998f 100644
--- a/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/restlet/RequestReaderDelegator.java
+++ b/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/restlet/RequestReaderDelegator.java
@@ -68,7 +68,7 @@ public class RequestReaderDelegator
         {
             try
             {
-                Class readerClass = module.classLoader().loadClass( className.trim() );
+                Class readerClass = module.descriptor().classLoader().loadClass( className.trim() );
                 RequestReader writer = (RequestReader) module.newObject( readerClass );
                 registerRequestReader( writer );
             }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/restlet/ResponseWriterDelegator.java
----------------------------------------------------------------------
diff --git a/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/restlet/ResponseWriterDelegator.java b/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/restlet/ResponseWriterDelegator.java
index 7d49388..c7cd54a 100644
--- a/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/restlet/ResponseWriterDelegator.java
+++ b/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/restlet/ResponseWriterDelegator.java
@@ -65,7 +65,7 @@ public class ResponseWriterDelegator
         {
             try
             {
-                Class writerClass = module.classLoader().loadClass( className.trim() );
+                Class writerClass = module.descriptor().classLoader().loadClass( className.trim() );
                 ResponseWriter writer = (ResponseWriter) module.newObject( writerClass );
                 registerResultWriter( writer );
             }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/restlet/requestreader/DefaultRequestReader.java
----------------------------------------------------------------------
diff --git a/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/restlet/requestreader/DefaultRequestReader.java b/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/restlet/requestreader/DefaultRequestReader.java
index fed3812..383e78a 100644
--- a/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/restlet/requestreader/DefaultRequestReader.java
+++ b/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/restlet/requestreader/DefaultRequestReader.java
@@ -32,6 +32,7 @@ import org.apache.zest.api.injection.scope.Service;
 import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.property.PropertyDescriptor;
 import org.apache.zest.api.service.qualifier.Tagged;
+import org.apache.zest.api.structure.ModuleDescriptor;
 import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
 import org.apache.zest.api.util.Dates;
 import org.apache.zest.api.value.ValueBuilder;
@@ -76,6 +77,9 @@ public class DefaultRequestReader
     private UnitOfWorkFactory uowf;
 
     @Structure
+    private ModuleDescriptor module;
+
+    @Structure
     private ValueBuilderFactory vbf;
 
     @Service
@@ -296,7 +300,7 @@ public class DefaultRequestReader
                     {
                         try
                         {
-                            return valueDeserializer.deserialize( propertyDescriptor.valueType(), value );
+                            return valueDeserializer.deserialize( module, propertyDescriptor.valueType(), value );
                         }
                         catch( ValueSerializationException e )
                         {

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/restlet/responsewriter/ValueDescriptorResponseWriter.java
----------------------------------------------------------------------
diff --git a/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/restlet/responsewriter/ValueDescriptorResponseWriter.java b/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/restlet/responsewriter/ValueDescriptorResponseWriter.java
index 10ba4b7..001a495 100644
--- a/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/restlet/responsewriter/ValueDescriptorResponseWriter.java
+++ b/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/restlet/responsewriter/ValueDescriptorResponseWriter.java
@@ -25,12 +25,12 @@ import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import org.json.JSONException;
-import org.json.JSONObject;
 import org.apache.zest.api.injection.scope.Service;
 import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.structure.Module;
+import org.apache.zest.api.structure.ModuleDescriptor;
 import org.apache.zest.api.value.ValueDescriptor;
+import org.json.JSONException;
+import org.json.JSONObject;
 import org.restlet.Response;
 import org.restlet.data.MediaType;
 import org.restlet.representation.Representation;
@@ -46,7 +46,7 @@ public class ValueDescriptorResponseWriter extends AbstractResponseWriter
     private static final List<MediaType> supportedMediaTypes = Arrays.asList( MediaType.TEXT_HTML, MediaType.APPLICATION_JSON );
 
     @Structure
-    private Module module;
+    private ModuleDescriptor module;
 
     @Service
     private Configuration cfg;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/libraries/rest/src/main/java/org/apache/zest/library/rest/admin/EntityResource.java
----------------------------------------------------------------------
diff --git a/libraries/rest/src/main/java/org/apache/zest/library/rest/admin/EntityResource.java b/libraries/rest/src/main/java/org/apache/zest/library/rest/admin/EntityResource.java
index 3390e38..8665ee8 100755
--- a/libraries/rest/src/main/java/org/apache/zest/library/rest/admin/EntityResource.java
+++ b/libraries/rest/src/main/java/org/apache/zest/library/rest/admin/EntityResource.java
@@ -33,6 +33,7 @@ import org.apache.zest.api.entity.EntityReference;
 import org.apache.zest.api.injection.scope.Service;
 import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.injection.scope.Uses;
+import org.apache.zest.api.structure.ModuleDescriptor;
 import org.apache.zest.api.usecase.Usecase;
 import org.apache.zest.api.usecase.UsecaseBuilder;
 import org.apache.zest.api.value.ValueSerialization;
@@ -48,7 +49,6 @@ import org.apache.zest.spi.entitystore.EntityNotFoundException;
 import org.apache.zest.spi.entitystore.EntityStore;
 import org.apache.zest.spi.entitystore.EntityStoreUnitOfWork;
 import org.apache.zest.spi.entitystore.helpers.JSONEntityState;
-import org.apache.zest.spi.module.ModuleSpi;
 import org.openrdf.model.Statement;
 import org.openrdf.rio.RDFHandlerException;
 import org.restlet.data.CharacterSet;
@@ -77,7 +77,7 @@ public class EntityResource
     private ValueSerialization valueSerialization;
 
     @Structure
-    private ModuleSpi module;
+    private ModuleDescriptor module;
 
     @Uses
     private EntityStateSerializer entitySerializer;
@@ -108,7 +108,7 @@ public class EntityResource
         throws ResourceException
     {
         Usecase usecase = UsecaseBuilder.newUsecase( "Remove entity" );
-        EntityStoreUnitOfWork uow = entityStore.newUnitOfWork( usecase, System.currentTimeMillis() );
+        EntityStoreUnitOfWork uow = entityStore.newUnitOfWork( module, usecase, System.currentTimeMillis() );
         try
         {
             EntityReference identityRef = EntityReference.parseEntityReference( identity );
@@ -129,7 +129,7 @@ public class EntityResource
     protected Representation get( Variant variant )
         throws ResourceException
     {
-        EntityStoreUnitOfWork uow = entityStore.newUnitOfWork( UsecaseBuilder.newUsecase( "Get entity" ),
+        EntityStoreUnitOfWork uow = entityStore.newUnitOfWork( module, UsecaseBuilder.newUsecase( "Get entity" ),
                                                                System.currentTimeMillis() );
 
         try
@@ -349,7 +349,7 @@ public class EntityResource
         throws ResourceException
     {
         Usecase usecase = UsecaseBuilder.newUsecase( "Update entity" );
-        EntityStoreUnitOfWork unitOfWork = entityStore.newUnitOfWork( usecase, System.currentTimeMillis() );
+        EntityStoreUnitOfWork unitOfWork = entityStore.newUnitOfWork( module, usecase, System.currentTimeMillis() );
         EntityState entity = getEntityState( unitOfWork );
 
         Form form = new Form( entityRepresentation );
@@ -371,7 +371,7 @@ public class EntityResource
                     {
                         entity.setPropertyValue(
                             persistentProperty.qualifiedName(),
-                            valueSerialization.deserialize( persistentProperty.valueType(), formValue ) );
+                            valueSerialization.deserialize( module, persistentProperty.valueType(), formValue ) );
                     }
                 }
             } );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/libraries/rest/src/test/java/org/apache/zest/library/rest/admin/RestTest.java
----------------------------------------------------------------------
diff --git a/libraries/rest/src/test/java/org/apache/zest/library/rest/admin/RestTest.java b/libraries/rest/src/test/java/org/apache/zest/library/rest/admin/RestTest.java
index bb75c84..9271501 100644
--- a/libraries/rest/src/test/java/org/apache/zest/library/rest/admin/RestTest.java
+++ b/libraries/rest/src/test/java/org/apache/zest/library/rest/admin/RestTest.java
@@ -123,7 +123,7 @@ public class RestTest
     public void givenAnIdentityWhenExecutingGetCommandThenExpectTheCorrectRdf()
         throws Exception
     {
-        RestTester restTester = module.newObject( RestTester.class );
+        RestTester restTester = objectFactory.newObject( RestTester.class );
         String rdf = restTester.getEntity( "P1" );
         // System.out.println( rdf.replaceAll( "\n", "\\\\n" ).replaceAll( "\"", "\\\\\"" ) );
         assertThat( "Incorrect RDF produced", rdf, anyOf(
@@ -140,7 +140,7 @@ public class RestTest
     public void givenExistingIdentityWhenExecutingPutCommandThenNewValuesInEntity()
         throws Throwable
     {
-        RestTester restTester = module.newObject( RestTester.class );
+        RestTester restTester = objectFactory.newObject( RestTester.class );
         Map<String, String> properties = new HashMap<String, String>();
         properties.put( "identity", "P1" );
         properties.put( "firstname", "Jack" );
@@ -164,7 +164,7 @@ public class RestTest
     public void givenExistingIdentityWhenExecutingDeleteCommandThenEntityIsRemoved()
         throws Throwable
     {
-        RestTester restTester = module.newObject( RestTester.class );
+        RestTester restTester = objectFactory.newObject( RestTester.class );
         restTester.deleteEntity( "P1" );
         UnitOfWork work = uowf.newUnitOfWork();
         try
@@ -191,7 +191,7 @@ public class RestTest
     public void givenExistingEntitiesWhenExecutingGetCommandThenExpectTheCorrectRdf()
         throws Exception
     {
-        final RestTester restTester = module.newObject( RestTester.class );
+        final RestTester restTester = objectFactory.newObject( RestTester.class );
         final String result = restTester.getEntities().replace( "\r", "" );
         assertThat(
             "Returned RDF", result,

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/libraries/restlet/src/main/java/org/apache/zest/library/restlet/serialization/JsonRepresentation.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/zest/library/restlet/serialization/JsonRepresentation.java b/libraries/restlet/src/main/java/org/apache/zest/library/restlet/serialization/JsonRepresentation.java
index ba6e9aa..f50c926 100644
--- a/libraries/restlet/src/main/java/org/apache/zest/library/restlet/serialization/JsonRepresentation.java
+++ b/libraries/restlet/src/main/java/org/apache/zest/library/restlet/serialization/JsonRepresentation.java
@@ -26,6 +26,7 @@ import org.apache.zest.api.common.Optional;
 import org.apache.zest.api.injection.scope.Service;
 import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.injection.scope.Uses;
+import org.apache.zest.api.structure.ModuleDescriptor;
 import org.apache.zest.api.value.ValueSerialization;
 import org.apache.zest.api.value.ValueSerializer;
 import org.apache.zest.spi.ZestSPI;
@@ -49,6 +50,9 @@ public class JsonRepresentation<T> extends OutputRepresentation
     @Service
     private ValueSerialization serializer;
 
+    @Structure
+    private ModuleDescriptor module;
+
     /**
      * The (parsed) object to format.
      */
@@ -94,7 +98,7 @@ public class JsonRepresentation<T> extends OutputRepresentation
         }
         else if( this.representation != null )
         {
-            result = serializer.deserialize( objectClass, this.representation.getStream() );
+            result = serializer.deserialize( module, objectClass, this.representation.getStream() );
         }
         return result;
     }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/libraries/scheduler/src/test/java/org/apache/zest/library/scheduler/SchedulerTest.java
----------------------------------------------------------------------
diff --git a/libraries/scheduler/src/test/java/org/apache/zest/library/scheduler/SchedulerTest.java b/libraries/scheduler/src/test/java/org/apache/zest/library/scheduler/SchedulerTest.java
index f2c8fc6..ad9bf9d 100644
--- a/libraries/scheduler/src/test/java/org/apache/zest/library/scheduler/SchedulerTest.java
+++ b/libraries/scheduler/src/test/java/org/apache/zest/library/scheduler/SchedulerTest.java
@@ -98,7 +98,7 @@ public class SchedulerTest
         long sleepMillis;
         try( UnitOfWork uow = uowf.newUnitOfWork( usecase ) )
         {
-            Scheduler scheduler = module.findService( Scheduler.class ).get();
+            Scheduler scheduler = serviceFinder.findService( Scheduler.class ).get();
 
             FooTask task = createFooTask( uow, usecase.name(), BAZAR );
             taskIdentity = task.identity().get();
@@ -119,7 +119,7 @@ public class SchedulerTest
         //noinspection unused
         try( UnitOfWork uow = uowf.newUnitOfWork( usecase ) )
         {
-            Timeline timeline = module.findService( Timeline.class ).get();
+            Timeline timeline = serviceFinder.findService( Timeline.class ).get();
             DateTime now = new DateTime();
 
             // Queries returning past records
@@ -147,7 +147,7 @@ public class SchedulerTest
         System.setProperty( "zest.entity.print.state", Boolean.TRUE.toString() );
         final Usecase usecase = UsecaseBuilder.newUsecase( "TestOnce" );
         final String taskIdentity;
-        Scheduler scheduler = module.findService( Scheduler.class ).get();
+        Scheduler scheduler = serviceFinder.findService( Scheduler.class ).get();
 
         Schedule schedule1;
         Schedule schedule2;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/PasswordDomainTest.java
----------------------------------------------------------------------
diff --git a/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/PasswordDomainTest.java b/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/PasswordDomainTest.java
index 35a9ceb..422b49e 100644
--- a/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/PasswordDomainTest.java
+++ b/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/PasswordDomainTest.java
@@ -119,7 +119,7 @@ public class PasswordDomainTest
 
         UnitOfWork uow = uowf.newUnitOfWork();
 
-        UserFactory userFactory = module.findService( UserFactory.class ).get();
+        UserFactory userFactory = serviceFinder.findService( UserFactory.class ).get();
         // START SNIPPET: usage
         User user = userFactory.createNewUser( "foo", "bar" );
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/PermissionsDomainTest.java
----------------------------------------------------------------------
diff --git a/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/PermissionsDomainTest.java b/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/PermissionsDomainTest.java
index a436896..4c55058 100644
--- a/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/PermissionsDomainTest.java
+++ b/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/PermissionsDomainTest.java
@@ -121,8 +121,8 @@ public class PermissionsDomainTest
     @Before
     public void before_PermissionsDomainTest()
     {
-        userFactory = module.findService( UserFactory.class ).get();
-        roleFactory = module.findService( RoleFactory.class ).get();
+        userFactory = serviceFinder.findService( UserFactory.class ).get();
+        roleFactory = serviceFinder.findService( RoleFactory.class ).get();
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/libraries/spring/src/main/java/org/apache/zest/library/spring/bootstrap/internal/service/ServiceLocator.java
----------------------------------------------------------------------
diff --git a/libraries/spring/src/main/java/org/apache/zest/library/spring/bootstrap/internal/service/ServiceLocator.java b/libraries/spring/src/main/java/org/apache/zest/library/spring/bootstrap/internal/service/ServiceLocator.java
index 9b2c867..c02a8e1 100644
--- a/libraries/spring/src/main/java/org/apache/zest/library/spring/bootstrap/internal/service/ServiceLocator.java
+++ b/libraries/spring/src/main/java/org/apache/zest/library/spring/bootstrap/internal/service/ServiceLocator.java
@@ -27,8 +27,6 @@ import org.apache.zest.api.structure.Module;
 import org.apache.zest.api.structure.ModuleDescriptor;
 import org.apache.zest.functional.HierarchicalVisitor;
 
-import static org.apache.zest.functional.Iterables.first;
-
 final class ServiceLocator
     implements HierarchicalVisitor<Object, Object, RuntimeException>
 {

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/libraries/sql/src/main/java/org/apache/zest/library/sql/jmx/DataSourceConfigurationManagerService.java
----------------------------------------------------------------------
diff --git a/libraries/sql/src/main/java/org/apache/zest/library/sql/jmx/DataSourceConfigurationManagerService.java b/libraries/sql/src/main/java/org/apache/zest/library/sql/jmx/DataSourceConfigurationManagerService.java
index 03c04ce..7bca2be 100644
--- a/libraries/sql/src/main/java/org/apache/zest/library/sql/jmx/DataSourceConfigurationManagerService.java
+++ b/libraries/sql/src/main/java/org/apache/zest/library/sql/jmx/DataSourceConfigurationManagerService.java
@@ -51,7 +51,7 @@ import org.apache.zest.api.service.ServiceComposite;
 import org.apache.zest.api.service.ServiceImporter;
 import org.apache.zest.api.service.ServiceReference;
 import org.apache.zest.api.structure.Application;
-import org.apache.zest.api.structure.Module;
+import org.apache.zest.api.structure.ModuleDescriptor;
 import org.apache.zest.api.unitofwork.UnitOfWork;
 import org.apache.zest.api.unitofwork.UnitOfWorkCompletionException;
 import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
@@ -124,7 +124,7 @@ public interface DataSourceConfigurationManagerService
         {
             for ( ServiceReference<DataSource> dataSource : dataSources ) {
                 String name = dataSource.identity();
-                Module module = spi.moduleOf( dataSource );
+                ModuleDescriptor module = spi.moduleOf( dataSource );
                 EntityDescriptor descriptor = module.entityDescriptor( DataSourceConfiguration.class.getName() );
                 List<MBeanAttributeInfo> attributes = new ArrayList<>();
                 Map<String, AccessibleObject> properties = new LinkedHashMap<>();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/libraries/sql/src/test/java/org/apache/zest/library/sql/datasource/ExternalDataSourceTest.java
----------------------------------------------------------------------
diff --git a/libraries/sql/src/test/java/org/apache/zest/library/sql/datasource/ExternalDataSourceTest.java b/libraries/sql/src/test/java/org/apache/zest/library/sql/datasource/ExternalDataSourceTest.java
index 74eb368..a0d679b 100644
--- a/libraries/sql/src/test/java/org/apache/zest/library/sql/datasource/ExternalDataSourceTest.java
+++ b/libraries/sql/src/test/java/org/apache/zest/library/sql/datasource/ExternalDataSourceTest.java
@@ -49,7 +49,7 @@ public class ExternalDataSourceTest
     public void test()
             throws SQLException
     {
-        DataSource dataSource = module.findService( DataSource.class ).get();
+        DataSource dataSource = serviceFinder.findService( DataSource.class ).get();
         Connection connection = dataSource.getConnection();
         try {
             connection.getMetaData();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/libraries/uid/src/test/java/org/apache/zest/library/uid/sequence/PersistingSequencingTest.java
----------------------------------------------------------------------
diff --git a/libraries/uid/src/test/java/org/apache/zest/library/uid/sequence/PersistingSequencingTest.java b/libraries/uid/src/test/java/org/apache/zest/library/uid/sequence/PersistingSequencingTest.java
index 7cc48b4..138d7e7 100644
--- a/libraries/uid/src/test/java/org/apache/zest/library/uid/sequence/PersistingSequencingTest.java
+++ b/libraries/uid/src/test/java/org/apache/zest/library/uid/sequence/PersistingSequencingTest.java
@@ -43,7 +43,7 @@ public class PersistingSequencingTest extends AbstractZestTest
     public void whenTransientSequencingThenNumbersStartAtZero()
         throws Exception
     {
-        UnderTest underTest = module.newTransient( UnderTest.class );
+        UnderTest underTest = transientBuilderFactory.newTransient( UnderTest.class );
         assertEquals( 0, underTest.currentValue() );
     }
 
@@ -51,7 +51,7 @@ public class PersistingSequencingTest extends AbstractZestTest
     public void whenTransientSequencingThenFirstNextValueIsOne()
         throws Exception
     {
-        UnderTest underTest = module.newTransient( UnderTest.class );
+        UnderTest underTest = transientBuilderFactory.newTransient( UnderTest.class );
         assertEquals( 1, underTest.nextValue() );
         assertEquals( 1, underTest.currentValue() );
     }
@@ -60,7 +60,7 @@ public class PersistingSequencingTest extends AbstractZestTest
     public void whenTransientSequencingThenFirst100ValuesAreInSequence()
         throws Exception
     {
-        UnderTest underTest = module.newTransient( UnderTest.class );
+        UnderTest underTest = transientBuilderFactory.newTransient( UnderTest.class );
         for( int i = 1; i <= 100; i++ )
         {
             assertEquals( i, underTest.nextValue() );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/libraries/uid/src/test/java/org/apache/zest/library/uid/sequence/TransientSequencingTest.java
----------------------------------------------------------------------
diff --git a/libraries/uid/src/test/java/org/apache/zest/library/uid/sequence/TransientSequencingTest.java b/libraries/uid/src/test/java/org/apache/zest/library/uid/sequence/TransientSequencingTest.java
index fe47e0c..c80b0af 100644
--- a/libraries/uid/src/test/java/org/apache/zest/library/uid/sequence/TransientSequencingTest.java
+++ b/libraries/uid/src/test/java/org/apache/zest/library/uid/sequence/TransientSequencingTest.java
@@ -41,7 +41,7 @@ public class TransientSequencingTest extends AbstractZestTest
     public void whenTransientSequencingThenNumbersStartAtZero()
         throws Exception
     {
-        UnderTest underTest = module.newTransient( UnderTest.class );
+        UnderTest underTest = transientBuilderFactory.newTransient( UnderTest.class );
         assertEquals( 0, underTest.currentValue() );
     }
 
@@ -49,7 +49,7 @@ public class TransientSequencingTest extends AbstractZestTest
     public void whenTransientSequencingThenFirstNextValueIsOne()
         throws Exception
     {
-        UnderTest underTest = module.newTransient( UnderTest.class );
+        UnderTest underTest = transientBuilderFactory.newTransient( UnderTest.class );
         assertEquals( 1, underTest.nextValue() );
         assertEquals( 1, underTest.currentValue() );
     }
@@ -58,7 +58,7 @@ public class TransientSequencingTest extends AbstractZestTest
     public void whenTransientSequencingThenFirst100ValuesAreInSequence()
         throws Exception
     {
-        UnderTest underTest = module.newTransient( UnderTest.class );
+        UnderTest underTest = transientBuilderFactory.newTransient( UnderTest.class );
         for( int i = 1; i <= 100; i++ )
         {
             assertEquals( i, underTest.nextValue() );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/libraries/uid/src/test/java/org/apache/zest/library/uid/uuid/UuidServiceTest.java
----------------------------------------------------------------------
diff --git a/libraries/uid/src/test/java/org/apache/zest/library/uid/uuid/UuidServiceTest.java b/libraries/uid/src/test/java/org/apache/zest/library/uid/uuid/UuidServiceTest.java
index b4389fe..15e486c 100644
--- a/libraries/uid/src/test/java/org/apache/zest/library/uid/uuid/UuidServiceTest.java
+++ b/libraries/uid/src/test/java/org/apache/zest/library/uid/uuid/UuidServiceTest.java
@@ -41,7 +41,7 @@ public class UuidServiceTest extends AbstractZestTest
     public void whenGeneratingUuidGivenHashLengthLargerThanZeroThenValidateTheSizeAndContent()
         throws Exception
     {
-        UnderTest ut = module.newTransient( UnderTest.class );
+        UnderTest ut = transientBuilderFactory.newTransient( UnderTest.class );
         for( int hashLength = 1; hashLength < 50; hashLength++ )
         {
             String uid = ut.generateUuid( hashLength );
@@ -58,7 +58,7 @@ public class UuidServiceTest extends AbstractZestTest
     public void whenGeneratingUuidGivenZeroHashLengthThenValidateFormat()
         throws Exception
     {
-        UnderTest ut = module.newTransient( UnderTest.class );
+        UnderTest ut = transientBuilderFactory.newTransient( UnderTest.class );
         String uid = ut.generateUuid( 0 );
         int dashCounter = 0;
         for( int i = 0; i < uid.length(); i++ )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/libraries/uowfile/src/test/java/org/apache/zest/library/uowfile/HasUoWFileTest.java
----------------------------------------------------------------------
diff --git a/libraries/uowfile/src/test/java/org/apache/zest/library/uowfile/HasUoWFileTest.java b/libraries/uowfile/src/test/java/org/apache/zest/library/uowfile/HasUoWFileTest.java
index 58e4703..6751994 100644
--- a/libraries/uowfile/src/test/java/org/apache/zest/library/uowfile/HasUoWFileTest.java
+++ b/libraries/uowfile/src/test/java/org/apache/zest/library/uowfile/HasUoWFileTest.java
@@ -179,7 +179,7 @@ public class HasUoWFileTest
     @Before
     public void beforeTest()
     {
-        testService = module.<TestService>findService( TestService.class ).get();
+        testService = serviceFinder.findService( TestService.class ).get();
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/libraries/uowfile/src/test/java/org/apache/zest/library/uowfile/HasUoWFilesTest.java
----------------------------------------------------------------------
diff --git a/libraries/uowfile/src/test/java/org/apache/zest/library/uowfile/HasUoWFilesTest.java b/libraries/uowfile/src/test/java/org/apache/zest/library/uowfile/HasUoWFilesTest.java
index 7c0418c..74f8998 100644
--- a/libraries/uowfile/src/test/java/org/apache/zest/library/uowfile/HasUoWFilesTest.java
+++ b/libraries/uowfile/src/test/java/org/apache/zest/library/uowfile/HasUoWFilesTest.java
@@ -195,7 +195,7 @@ public class HasUoWFilesTest
     @Before
     public void beforeTest()
     {
-        testService = module.<TestService>findService( TestService.class ).get();
+        testService = serviceFinder.findService( TestService.class ).get();
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/conversion/EntityToDTOService.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/conversion/EntityToDTOService.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/conversion/EntityToDTOService.java
index f78fbcf..bc7d3a6 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/conversion/EntityToDTOService.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/conversion/EntityToDTOService.java
@@ -33,7 +33,7 @@ import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.mixin.Mixins;
 import org.apache.zest.api.property.PropertyDescriptor;
 import org.apache.zest.api.service.ServiceComposite;
-import org.apache.zest.api.structure.Module;
+import org.apache.zest.api.structure.ModuleDescriptor;
 import org.apache.zest.api.type.CollectionType;
 import org.apache.zest.api.value.NoSuchValueException;
 import org.apache.zest.api.value.ValueBuilder;
@@ -68,7 +68,7 @@ public interface EntityToDTOService
         private ZestSPI spi;
 
         @Structure
-        private Module module;
+        private ModuleDescriptor module;
 
         @Override
         public <T> T convert( final Class<T> valueType, Object entity )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/conversion/EntityToDTOService.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/conversion/EntityToDTOService.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/conversion/EntityToDTOService.java
index 8747517..98cbbf4 100644
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/conversion/EntityToDTOService.java
+++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/conversion/EntityToDTOService.java
@@ -33,7 +33,7 @@ import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.mixin.Mixins;
 import org.apache.zest.api.property.PropertyDescriptor;
 import org.apache.zest.api.service.ServiceComposite;
-import org.apache.zest.api.structure.Module;
+import org.apache.zest.api.structure.ModuleDescriptor;
 import org.apache.zest.api.type.CollectionType;
 import org.apache.zest.api.value.NoSuchValueException;
 import org.apache.zest.api.value.ValueBuilder;
@@ -68,7 +68,7 @@ public interface EntityToDTOService
         private ZestSPI spi;
 
         @Structure
-        private Module module;
+        private ModuleDescriptor module;
 
         @Override
         public <T> T convert( final Class<T> valueType, Object entity )
@@ -111,7 +111,8 @@ public interface EntityToDTOService
                                 {
                                     return null;
                                 }
-                                Object entity = associationState.associationFor( associationDescriptor.accessor() ).get();
+                                Object entity = associationState.associationFor( associationDescriptor.accessor() )
+                                    .get();
                                 if( entity != null )
                                 {
                                     return ( (Identity) entity ).identity().get();
@@ -122,7 +123,9 @@ public interface EntityToDTOService
                                 }
                             }
                             else if( descriptor.valueType() instanceof CollectionType
-                                     && ( (CollectionType) descriptor.valueType() ).collectedType().mainType().equals( String.class ) )
+                                     && ( (CollectionType) descriptor.valueType() ).collectedType()
+                                         .mainType()
+                                         .equals( String.class ) )
                             {
                                 AssociationDescriptor associationDescriptor;
                                 try
@@ -208,7 +211,8 @@ public interface EntityToDTOService
                                     return null;
                                 }
 
-                                Object entity = associationState.associationFor( associationDescriptor.accessor() ).get();
+                                Object entity = associationState.associationFor( associationDescriptor.accessor() )
+                                    .get();
                                 if( entity != null )
                                 {
                                     return ( (Identity) entity ).identity().get();
@@ -216,7 +220,9 @@ public interface EntityToDTOService
                                 return null;
                             }
                             else if( descriptor.valueType() instanceof CollectionType
-                                     && ( (CollectionType) descriptor.valueType() ).collectedType().mainType().equals( String.class ) )
+                                     && ( (CollectionType) descriptor.valueType() ).collectedType()
+                                         .mainType()
+                                         .equals( String.class ) )
                             {
                                 AssociationDescriptor associationDescriptor;
                                 try
@@ -255,7 +261,8 @@ public interface EntityToDTOService
                                     return null;
                                 }
 
-                                Object entity = associationState.associationFor( associationDescriptor.accessor() ).get();
+                                Object entity = associationState.associationFor( associationDescriptor.accessor() )
+                                    .get();
                                 if( entity != null )
                                 {
                                     return convert( type, entity );
@@ -282,7 +289,8 @@ public interface EntityToDTOService
                         }
 
                         return EntityReference.entityReferenceFor( associationState
-                            .associationFor( associationDescriptor.accessor() ).get() );
+                                                                       .associationFor( associationDescriptor.accessor() )
+                                                                       .get() );
                     }
                 }, new Function<AssociationDescriptor, Iterable<EntityReference>>()
                 {
@@ -321,5 +329,4 @@ public interface EntityToDTOService
             return (T) builder.newInstance();
         }
     }
-
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/samples/rental/src/main/java/org/apache/zest/sample/rental/web/QuikitServlet.java
----------------------------------------------------------------------
diff --git a/samples/rental/src/main/java/org/apache/zest/sample/rental/web/QuikitServlet.java b/samples/rental/src/main/java/org/apache/zest/sample/rental/web/QuikitServlet.java
index df063bc..57b4e9a 100644
--- a/samples/rental/src/main/java/org/apache/zest/sample/rental/web/QuikitServlet.java
+++ b/samples/rental/src/main/java/org/apache/zest/sample/rental/web/QuikitServlet.java
@@ -57,8 +57,6 @@ import org.w3c.dom.Element;
 import org.xml.sax.EntityResolver;
 import org.xml.sax.SAXException;
 
-import static org.apache.zest.functional.Iterables.first;
-
 public class QuikitServlet
     extends HttpServlet
 {
@@ -74,7 +72,7 @@ public class QuikitServlet
     {
         try
         {
-            mountPoints = new TreeMap<String, Page>();
+            mountPoints = new TreeMap<>();
             documentFactory = DocumentBuilderFactory.newInstance();
             documentFactory.setNamespaceAware( true );
             ClassLoader cl = getClass().getClassLoader();
@@ -194,6 +192,7 @@ public class QuikitServlet
     private void renderPage( Page page, String path, PrintWriter output, HttpServletRequest httpRequest )
         throws ParserConfigurationException, SAXException, IOException, RenderException, TransformerException
     {
+        @SuppressWarnings( "unchecked" )
         Class<? extends Composite> pageClass =
             (Class<Composite>) ZestAPI.FUNCTION_DESCRIPTOR_FOR.apply( page ).types().findFirst().orElse( null );
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/InvocationPerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/InvocationPerformanceTest.java b/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/InvocationPerformanceTest.java
index 664607d..21d2d13 100644
--- a/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/InvocationPerformanceTest.java
+++ b/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/InvocationPerformanceTest.java
@@ -56,7 +56,7 @@ public class InvocationPerformanceTest
     public void testInvokeMixin()
     {
         // Create instance
-        TransientBuilder<SimpleComposite> builder = module.newTransientBuilder( SimpleComposite.class );
+        TransientBuilder<SimpleComposite> builder = transientBuilderFactory.newTransientBuilder( SimpleComposite.class );
         Simple simple = builder.newInstance();
 
         for( int i = 0; i < 60000; i++ )
@@ -76,7 +76,7 @@ public class InvocationPerformanceTest
     public void testInvokeMixinWithTypedConcern()
     {
         // Create instance
-        Simple simple = module.newTransient( SimpleWithTypedConcernComposite.class );
+        Simple simple = transientBuilderFactory.newTransient( SimpleWithTypedConcernComposite.class );
 
         for( int i = 0; i < 60000; i++ )
         {
@@ -94,7 +94,7 @@ public class InvocationPerformanceTest
     public void testInvokeMixinWithGenericConcern()
     {
         // Create instance
-        Simple simple = module.newTransient( SimpleWithGenericConcernComposite.class );
+        Simple simple = transientBuilderFactory.newTransient( SimpleWithGenericConcernComposite.class );
 
         for( int i = 0; i < 60000; i++ )
         {

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/PropertyMixinInvocationPerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/PropertyMixinInvocationPerformanceTest.java b/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/PropertyMixinInvocationPerformanceTest.java
index d6bfcc6..a8dabed 100644
--- a/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/PropertyMixinInvocationPerformanceTest.java
+++ b/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/PropertyMixinInvocationPerformanceTest.java
@@ -51,7 +51,7 @@ public class PropertyMixinInvocationPerformanceTest
     public void testNewInstance()
     {
         {
-            TransientBuilder<SimpleComposite> builder = module.newTransientBuilder( SimpleComposite.class );
+            TransientBuilder<SimpleComposite> builder = transientBuilderFactory.newTransientBuilder( SimpleComposite.class );
             SimpleComposite simple = builder.newInstance();
 
             int rounds = 1;
@@ -62,7 +62,7 @@ public class PropertyMixinInvocationPerformanceTest
         }
 
         {
-            TransientBuilder<SimpleComposite> builder = module.newTransientBuilder( SimpleComposite.class );
+            TransientBuilder<SimpleComposite> builder = transientBuilderFactory.newTransientBuilder( SimpleComposite.class );
             SimpleComposite simple = builder.newInstance();
 
             int rounds = 1;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/tests/regression/src/main/java/org/apache/zest/test/regression/niclas2/ConcernsOnPropertyTest.java
----------------------------------------------------------------------
diff --git a/tests/regression/src/main/java/org/apache/zest/test/regression/niclas2/ConcernsOnPropertyTest.java b/tests/regression/src/main/java/org/apache/zest/test/regression/niclas2/ConcernsOnPropertyTest.java
index b063291..2c911be 100644
--- a/tests/regression/src/main/java/org/apache/zest/test/regression/niclas2/ConcernsOnPropertyTest.java
+++ b/tests/regression/src/main/java/org/apache/zest/test/regression/niclas2/ConcernsOnPropertyTest.java
@@ -42,11 +42,10 @@ public class ConcernsOnPropertyTest
         module.transients( CarComposite.class );
     }
 
-
     @Test
     public void whenConcernOnPropertyThenConcernIsInvoked()
     {
-        TransientBuilder<Car> builder = module.newTransientBuilder( Car.class );
+        TransientBuilder<Car> builder = transientBuilderFactory.newTransientBuilder( Car.class );
         Car prototype = builder.prototypeFor( Car.class );
         prototype.manufacturer().set( "Volvo" );
         Car car = builder.newInstance();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/tools/model-detail/src/main/java/org/apache/zest/tools/model/descriptor/ApplicationDetailDescriptorBuilder.java
----------------------------------------------------------------------
diff --git a/tools/model-detail/src/main/java/org/apache/zest/tools/model/descriptor/ApplicationDetailDescriptorBuilder.java b/tools/model-detail/src/main/java/org/apache/zest/tools/model/descriptor/ApplicationDetailDescriptorBuilder.java
index e378cf0..2e0e48b 100644
--- a/tools/model-detail/src/main/java/org/apache/zest/tools/model/descriptor/ApplicationDetailDescriptorBuilder.java
+++ b/tools/model-detail/src/main/java/org/apache/zest/tools/model/descriptor/ApplicationDetailDescriptorBuilder.java
@@ -43,7 +43,6 @@ import org.apache.zest.api.sideeffect.SideEffectsDescriptor;
 import org.apache.zest.api.structure.ApplicationDescriptor;
 import org.apache.zest.api.structure.LayerDescriptor;
 import org.apache.zest.api.structure.ModuleDescriptor;
-import org.apache.zest.api.structure.UsedLayersDescriptor;
 import org.apache.zest.api.value.ValueDescriptor;
 import org.apache.zest.functional.HierarchicalVisitor;
 
@@ -130,13 +129,13 @@ public final class ApplicationDetailDescriptorBuilder
                 currLayerDescriptor = getLayerDetailDescriptor( layerDescriptor );
                 applicationDescriptor.addLayer( currLayerDescriptor );
 
-                UsedLayersDescriptor usedLayesDescriptor = layerDescriptor.usedLayers();
-                Iterable<? extends LayerDescriptor> usedLayers = usedLayesDescriptor.layers();
-                for( LayerDescriptor usedLayer : usedLayers )
-                {
-                    LayerDetailDescriptor usedLayerDetailDesc = getLayerDetailDescriptor( usedLayer );
-                    currLayerDescriptor.addUsedLayer( usedLayerDetailDesc );
-                }
+                layerDescriptor.usedLayers().layers().forEach(
+                    usedLayer ->
+                    {
+                        LayerDetailDescriptor usedLayerDetailDesc = getLayerDetailDescriptor( usedLayer );
+                        currLayerDescriptor.addUsedLayer( usedLayerDetailDesc );
+                    }
+                );
             }
             else if( visited instanceof ModuleDescriptor )
             {
@@ -480,5 +479,4 @@ public final class ApplicationDetailDescriptorBuilder
             currMethodSideEffectDescriptor = null;
         }
     }
-
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/tools/model-detail/src/main/java/org/apache/zest/tools/model/descriptor/ImportedServiceCompositeDescriptor.java
----------------------------------------------------------------------
diff --git a/tools/model-detail/src/main/java/org/apache/zest/tools/model/descriptor/ImportedServiceCompositeDescriptor.java b/tools/model-detail/src/main/java/org/apache/zest/tools/model/descriptor/ImportedServiceCompositeDescriptor.java
index 13c80ed..14db1b0 100644
--- a/tools/model-detail/src/main/java/org/apache/zest/tools/model/descriptor/ImportedServiceCompositeDescriptor.java
+++ b/tools/model-detail/src/main/java/org/apache/zest/tools/model/descriptor/ImportedServiceCompositeDescriptor.java
@@ -26,8 +26,8 @@ import org.apache.zest.api.common.Visibility;
 import org.apache.zest.api.composite.CompositeDescriptor;
 import org.apache.zest.api.service.ImportedServiceDescriptor;
 import org.apache.zest.api.service.ServiceImporter;
+import org.apache.zest.api.structure.ModuleDescriptor;
 import org.apache.zest.api.util.Classes;
-import org.apache.zest.functional.Iterables;
 
 /**
  * XXX Workaround for inconsistency in Zest core-api/spi
@@ -50,6 +50,12 @@ public class ImportedServiceCompositeDescriptor
     }
 
     @Override
+    public ModuleDescriptor module()
+    {
+        return importedService.module();
+    }
+
+    @Override
     public Stream<Class<?>> mixinTypes()
     {
         return mixins.stream();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/tutorials/cargo/src/test/java/org/apache/zest/tutorials/cargo/step2/Step2TestCase.java
----------------------------------------------------------------------
diff --git a/tutorials/cargo/src/test/java/org/apache/zest/tutorials/cargo/step2/Step2TestCase.java b/tutorials/cargo/src/test/java/org/apache/zest/tutorials/cargo/step2/Step2TestCase.java
index 2521680..02fc7ec 100644
--- a/tutorials/cargo/src/test/java/org/apache/zest/tutorials/cargo/step2/Step2TestCase.java
+++ b/tutorials/cargo/src/test/java/org/apache/zest/tutorials/cargo/step2/Step2TestCase.java
@@ -36,13 +36,13 @@ public class Step2TestCase
         throws Exception
     {
         super.setUp();
-        TransientBuilder<VoyageComposite> voyageBuilder = module.newTransientBuilder( VoyageComposite.class );
+        TransientBuilder<VoyageComposite> voyageBuilder = transientBuilderFactory.newTransientBuilder( VoyageComposite.class );
         voyageBuilder.prototypeFor( Voyage.class ).bookedCargoSize().set( 0.0 );
         voyageBuilder.prototypeFor( Voyage.class ).capacity().set( 100.0 );
         voyage = voyageBuilder.newInstance();
 
         TransientBuilder<ShippingServiceComposite> shippingBuilder =
-            module.newTransientBuilder( ShippingServiceComposite.class );
+            transientBuilderFactory.newTransientBuilder( ShippingServiceComposite.class );
         shippingService = shippingBuilder.newInstance();
     }
 
@@ -94,7 +94,7 @@ public class Step2TestCase
 
     private Cargo newCargo( double size )
     {
-        TransientBuilder<CargoComposite> builder = module.newTransientBuilder( CargoComposite.class );
+        TransientBuilder<CargoComposite> builder = transientBuilderFactory.newTransientBuilder( CargoComposite.class );
         builder.prototypeFor( Cargo.class ).size().set( size );
         return builder.newInstance();
     }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest.java
----------------------------------------------------------------------
diff --git a/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest.java b/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest.java
index 50007b5..2093dea 100644
--- a/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest.java
+++ b/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest.java
@@ -40,7 +40,7 @@ public class HelloTest extends AbstractZestTest
     @Test
     public void givenHelloValueInitializedToHelloWorldWhenCallingSayExpectHelloWorld()
     {
-        ValueBuilder<Hello> builder = module.newValueBuilder( Hello.class );
+        ValueBuilder<Hello> builder = valueBuilderFactory.newValueBuilder( Hello.class );
         builder.prototypeFor( Hello.State.class ).phrase().set( "Hello" );
         builder.prototypeFor( Hello.State.class ).name().set( "World" );
         Hello underTest = builder.newInstance();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest2.java
----------------------------------------------------------------------
diff --git a/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest2.java b/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest2.java
index efaa8c3..a1094f6 100644
--- a/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest2.java
+++ b/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest2.java
@@ -34,7 +34,7 @@ public class HelloTest2 extends AbstractZestTest
     @Test
     public void givenHelloValueInitializedToHelloWorldWhenCallingSayExpectHelloWorld()
     {
-        TransientBuilder<Hello> builder = module.newTransientBuilder( Hello.class );
+        TransientBuilder<Hello> builder = transientBuilderFactory.newTransientBuilder( Hello.class );
         builder.prototypeFor( Hello.State.class ).phrase().set( "Hello" );
         builder.prototypeFor( Hello.State.class ).name().set( "World" );
         Hello underTest = builder.newInstance();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest3.java
----------------------------------------------------------------------
diff --git a/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest3.java b/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest3.java
index 173dbfd..513f0a8 100644
--- a/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest3.java
+++ b/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest3.java
@@ -37,7 +37,7 @@ public class HelloTest3 extends AbstractZestTest
     @Test
     public void givenHelloValueInitializedToHelloWorldWhenCallingSayExpectHelloWorld()
     {
-        ServiceReference<Hello> service = module.findService( Hello.class );
+        ServiceReference<Hello> service = serviceFinder.findService( Hello.class );
         String result = service.get().say();
         assertThat( result, equalTo( "Hello World" ) );
     }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/tutorials/services/src/test/java/org/apache/zest/tutorials/services/step2/LibraryTest.java
----------------------------------------------------------------------
diff --git a/tutorials/services/src/test/java/org/apache/zest/tutorials/services/step2/LibraryTest.java b/tutorials/services/src/test/java/org/apache/zest/tutorials/services/step2/LibraryTest.java
index 3c00051..4554704 100644
--- a/tutorials/services/src/test/java/org/apache/zest/tutorials/services/step2/LibraryTest.java
+++ b/tutorials/services/src/test/java/org/apache/zest/tutorials/services/step2/LibraryTest.java
@@ -29,7 +29,7 @@ public class LibraryTest
     public void testLibrary()
         throws Exception
     {
-        Consumer consumer = module.newObject( Consumer.class );
+        Consumer consumer = objectFactory.newObject( Consumer.class );
         consumer.run();
     }
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/tutorials/services/src/test/java/org/apache/zest/tutorials/services/step3/LibraryTest.java
----------------------------------------------------------------------
diff --git a/tutorials/services/src/test/java/org/apache/zest/tutorials/services/step3/LibraryTest.java b/tutorials/services/src/test/java/org/apache/zest/tutorials/services/step3/LibraryTest.java
index f0911a5..db31d8f 100644
--- a/tutorials/services/src/test/java/org/apache/zest/tutorials/services/step3/LibraryTest.java
+++ b/tutorials/services/src/test/java/org/apache/zest/tutorials/services/step3/LibraryTest.java
@@ -29,7 +29,7 @@ public class LibraryTest
     public void testLibrary()
         throws Exception
     {
-        Consumer consumer = module.newObject( Consumer.class );
+        Consumer consumer = objectFactory.newObject( Consumer.class );
         consumer.run();
     }
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/tutorials/services/src/test/java/org/apache/zest/tutorials/services/step4/LibraryTest.java
----------------------------------------------------------------------
diff --git a/tutorials/services/src/test/java/org/apache/zest/tutorials/services/step4/LibraryTest.java b/tutorials/services/src/test/java/org/apache/zest/tutorials/services/step4/LibraryTest.java
index 5245481..71823f7 100644
--- a/tutorials/services/src/test/java/org/apache/zest/tutorials/services/step4/LibraryTest.java
+++ b/tutorials/services/src/test/java/org/apache/zest/tutorials/services/step4/LibraryTest.java
@@ -30,7 +30,7 @@ public class LibraryTest
     public void testLibrary()
         throws Exception
     {
-        Consumer consumer = module.newObject( Consumer.class );
+        Consumer consumer = objectFactory.newObject( Consumer.class );
         consumer.run();
     }
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/tutorials/services/src/test/java/org/apache/zest/tutorials/services/step5/LibraryTest.java
----------------------------------------------------------------------
diff --git a/tutorials/services/src/test/java/org/apache/zest/tutorials/services/step5/LibraryTest.java b/tutorials/services/src/test/java/org/apache/zest/tutorials/services/step5/LibraryTest.java
index 4a167c3..8e61154 100644
--- a/tutorials/services/src/test/java/org/apache/zest/tutorials/services/step5/LibraryTest.java
+++ b/tutorials/services/src/test/java/org/apache/zest/tutorials/services/step5/LibraryTest.java
@@ -30,7 +30,7 @@ public class LibraryTest
     public void testLibrary()
         throws Exception
     {
-        Consumer consumer = module.newObject( Consumer.class );
+        Consumer consumer = objectFactory.newObject( Consumer.class );
         consumer.run();
     }
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/tutorials/services/src/test/java/org/apache/zest/tutorials/services/step6/LibraryTest.java
----------------------------------------------------------------------
diff --git a/tutorials/services/src/test/java/org/apache/zest/tutorials/services/step6/LibraryTest.java b/tutorials/services/src/test/java/org/apache/zest/tutorials/services/step6/LibraryTest.java
index 366fb6a..b513dd0 100644
--- a/tutorials/services/src/test/java/org/apache/zest/tutorials/services/step6/LibraryTest.java
+++ b/tutorials/services/src/test/java/org/apache/zest/tutorials/services/step6/LibraryTest.java
@@ -30,7 +30,7 @@ public class LibraryTest
     public void testLibrary()
         throws Exception
     {
-        Consumer consumer = module.newObject( Consumer.class );
+        Consumer consumer = objectFactory.newObject( Consumer.class );
         consumer.run();
     }
 


Mime
View raw message