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/03/05 15:45:31 UTC

[01/12] polygene-java git commit: Wrong class name for the assembler

Repository: polygene-java
Updated Branches:
  refs/heads/develop f29b50411 -> 5b90154dd


Wrong class name for the assembler


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

Branch: refs/heads/develop
Commit: 849f4f53105b7e4d8b72c7fccdd40d22d68b5df1
Parents: f29b504
Author: niclas <ni...@spicter.com>
Authored: Tue Feb 28 16:11:32 2017 +0800
Committer: niclas <ni...@spicter.com>
Committed: Tue Feb 28 16:11:32 2017 +0800

----------------------------------------------------------------------
 .../CassandraDBEntityStoreAssembler.java        | 46 --------------------
 .../assembly/CassandraEntityStoreAssembler.java | 46 ++++++++++++++++++++
 2 files changed, 46 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/849f4f53/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/assembly/CassandraDBEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/assembly/CassandraDBEntityStoreAssembler.java b/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/assembly/CassandraDBEntityStoreAssembler.java
deleted file mode 100644
index 15b3c60..0000000
--- a/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/assembly/CassandraDBEntityStoreAssembler.java
+++ /dev/null
@@ -1,46 +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.entitystore.cassandra.assembly;
-
-import org.apache.polygene.bootstrap.Assemblers;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.ServiceDeclaration;
-import org.apache.polygene.entitystore.cassandra.CassandraEntityStoreConfiguration;
-import org.apache.polygene.entitystore.cassandra.CassandraEntityStoreService;
-
-public class CassandraDBEntityStoreAssembler
-    extends Assemblers.VisibilityIdentityConfig<CassandraDBEntityStoreAssembler>
-{
-    @Override
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        ServiceDeclaration service = module.services( CassandraEntityStoreService.class ).visibleIn( visibility() );
-        if( hasIdentity() )
-        {
-            service.identifiedBy( identity() );
-        }
-        if( hasConfig() )
-        {
-            configModule().entities( CassandraEntityStoreConfiguration.class ).visibleIn( configVisibility() );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/849f4f53/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/assembly/CassandraEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/assembly/CassandraEntityStoreAssembler.java b/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/assembly/CassandraEntityStoreAssembler.java
new file mode 100644
index 0000000..70b4525
--- /dev/null
+++ b/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/assembly/CassandraEntityStoreAssembler.java
@@ -0,0 +1,46 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.entitystore.cassandra.assembly;
+
+import org.apache.polygene.bootstrap.Assemblers;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.ServiceDeclaration;
+import org.apache.polygene.entitystore.cassandra.CassandraEntityStoreConfiguration;
+import org.apache.polygene.entitystore.cassandra.CassandraEntityStoreService;
+
+public class CassandraEntityStoreAssembler
+    extends Assemblers.VisibilityIdentityConfig<CassandraEntityStoreAssembler>
+{
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        ServiceDeclaration service = module.services( CassandraEntityStoreService.class ).visibleIn( visibility() );
+        if( hasIdentity() )
+        {
+            service.identifiedBy( identity() );
+        }
+        if( hasConfig() )
+        {
+            configModule().entities( CassandraEntityStoreConfiguration.class ).visibleIn( configVisibility() );
+        }
+    }
+}


[07/12] polygene-java git commit: POLYGENE-235 : Adding "query" and "indexing" to RDF Indexing.

Posted by ni...@apache.org.
POLYGENE-235 : Adding "query" and "indexing" to RDF Indexing.


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

Branch: refs/heads/develop
Commit: 9a1ae98dd229295f90ca1ecbc5369b663b8bf30d
Parents: 9f38f3f
Author: niclas <ni...@spicter.com>
Authored: Sun Mar 5 13:35:40 2017 +0800
Committer: niclas <ni...@spicter.com>
Committed: Sun Mar 5 13:35:40 2017 +0800

----------------------------------------------------------------------
 .../index/rdf/assembly/RdfMemoryStoreAssembler.java | 16 +++++++---------
 .../rdf/assembly/RdfNativeSesameStoreAssembler.java | 15 +++++++--------
 .../rdf/assembly/RdfRdbmsSesameStoreAssembler.java  | 16 +++++++---------
 3 files changed, 21 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/9a1ae98d/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfMemoryStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfMemoryStoreAssembler.java b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfMemoryStoreAssembler.java
index 4a44889..be584c4 100644
--- a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfMemoryStoreAssembler.java
+++ b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfMemoryStoreAssembler.java
@@ -43,10 +43,7 @@ public class RdfMemoryStoreAssembler
         this( Visibility.application, Visibility.module );
     }
 
-    public RdfMemoryStoreAssembler(
-                                    Visibility indexingVisibility,
-                                    Visibility repositoryVisibility
-    )
+    public RdfMemoryStoreAssembler( Visibility indexingVisibility, Visibility repositoryVisibility )
     {
         this.indexingVisibility = indexingVisibility;
         this.repositoryVisibility = repositoryVisibility;
@@ -57,12 +54,13 @@ public class RdfMemoryStoreAssembler
         throws AssemblyException
     {
         module.services( MemoryRepositoryService.class )
-            .visibleIn( repositoryVisibility )
-            .instantiateOnStartup()
-            .identifiedBy( "rdf-repository" );
+              .visibleIn( repositoryVisibility )
+              .instantiateOnStartup()
+              .identifiedBy( "rdf-repository" );
         module.services( RdfIndexingEngineService.class )
-            .visibleIn( indexingVisibility )
-            .instantiateOnStartup();
+              .taggedWith( "rdf", "query", "indexing" )
+              .visibleIn( indexingVisibility )
+              .instantiateOnStartup();
         module.services( RdfQueryParserFactory.class ).visibleIn( indexingVisibility );
         module.services( OrgJsonValueSerializationService.class ).taggedWith( ValueSerialization.Formats.JSON );
         module.objects( EntityStateSerializer.class, EntityTypeSerializer.class );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/9a1ae98d/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfNativeSesameStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfNativeSesameStoreAssembler.java b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfNativeSesameStoreAssembler.java
index 19274a7..79ca58a 100644
--- a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfNativeSesameStoreAssembler.java
+++ b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfNativeSesameStoreAssembler.java
@@ -42,9 +42,7 @@ public class RdfNativeSesameStoreAssembler
         this( Visibility.application, Visibility.module );
     }
 
-    public RdfNativeSesameStoreAssembler( Visibility indexingVisibility,
-                                          Visibility repositoryVisibility
-    )
+    public RdfNativeSesameStoreAssembler( Visibility indexingVisibility, Visibility repositoryVisibility )
     {
         this.indexingVisibility = indexingVisibility;
         this.repositoryVisibility = repositoryVisibility;
@@ -55,12 +53,13 @@ public class RdfNativeSesameStoreAssembler
         throws AssemblyException
     {
         module.services( NativeRepositoryService.class )
-            .visibleIn( repositoryVisibility )
-            .instantiateOnStartup()
-            .identifiedBy( "rdf-indexing" );
+              .visibleIn( repositoryVisibility )
+              .instantiateOnStartup()
+              .identifiedBy( "rdf-indexing" );
         module.services( RdfIndexingEngineService.class )
-            .visibleIn( indexingVisibility )
-            .instantiateOnStartup();
+              .taggedWith( "rdf", "query", "indexing" )
+              .visibleIn( indexingVisibility )
+              .instantiateOnStartup();
         module.services( RdfQueryParserFactory.class ).visibleIn( indexingVisibility );
         module.services( OrgJsonValueSerializationService.class ).taggedWith( ValueSerialization.Formats.JSON );
         module.objects( EntityStateSerializer.class, EntityTypeSerializer.class );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/9a1ae98d/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfRdbmsSesameStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfRdbmsSesameStoreAssembler.java b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfRdbmsSesameStoreAssembler.java
index 4f10706..dcf9ffd 100644
--- a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfRdbmsSesameStoreAssembler.java
+++ b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfRdbmsSesameStoreAssembler.java
@@ -42,10 +42,7 @@ public class RdfRdbmsSesameStoreAssembler
         this( Visibility.application, Visibility.module );
     }
 
-    public RdfRdbmsSesameStoreAssembler(
-                                         Visibility indexingVisibility,
-                                         Visibility repositoryVisibility
-    )
+    public RdfRdbmsSesameStoreAssembler( Visibility indexingVisibility, Visibility repositoryVisibility )
     {
         this.indexingVisibility = indexingVisibility;
         this.repositoryVisibility = repositoryVisibility;
@@ -56,12 +53,13 @@ public class RdfRdbmsSesameStoreAssembler
         throws AssemblyException
     {
         module.services( RdbmsRepositoryService.class )
-            .visibleIn( repositoryVisibility )
-            .instantiateOnStartup()
-            .identifiedBy( "rdf-indexing" );
+              .visibleIn( repositoryVisibility )
+              .instantiateOnStartup()
+              .identifiedBy( "rdf-indexing" );
         module.services( RdfIndexingEngineService.class )
-            .visibleIn( indexingVisibility )
-            .instantiateOnStartup();
+              .taggedWith( "rdf", "query", "indexing" )
+              .visibleIn( indexingVisibility )
+              .instantiateOnStartup();
         module.services( RdfQueryParserFactory.class ).visibleIn( indexingVisibility );
         module.services( OrgJsonValueSerializationService.class ).taggedWith( ValueSerialization.Formats.JSON );
         module.objects( EntityStateSerializer.class, EntityTypeSerializer.class );


[08/12] polygene-java git commit: POLYGENE-235 : Adding "query" and "indexing" tags to ElasticSearch indexing.

Posted by ni...@apache.org.
POLYGENE-235 : Adding "query" and "indexing" tags to ElasticSearch indexing.


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

Branch: refs/heads/develop
Commit: 1648545573ce67443993f215d0792cc34e70e7a4
Parents: 9a1ae98
Author: niclas <ni...@spicter.com>
Authored: Sun Mar 5 13:36:11 2017 +0800
Committer: niclas <ni...@spicter.com>
Committed: Sun Mar 5 13:36:11 2017 +0800

----------------------------------------------------------------------
 .../elasticsearch/assembly/ESClientIndexQueryAssembler.java | 1 +
 .../assembly/ESClusterIndexQueryAssembler.java              | 9 +++++----
 .../assembly/ESFilesystemIndexQueryAssembler.java           | 9 +++++----
 3 files changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/16485455/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESClientIndexQueryAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESClientIndexQueryAssembler.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESClientIndexQueryAssembler.java
index eb73d62..10b1762 100644
--- a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESClientIndexQueryAssembler.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESClientIndexQueryAssembler.java
@@ -40,6 +40,7 @@ public class ESClientIndexQueryAssembler
     public void assemble( final ModuleAssembly module ) throws AssemblyException
     {
         module.services( ESClientIndexQueryService.class )
+              .taggedWith( "elasticsearch", "query", "indexing" )
               .identifiedBy( identity() )
               .setMetaInfo( client )
               .visibleIn( visibility() )

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/16485455/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESClusterIndexQueryAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESClusterIndexQueryAssembler.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESClusterIndexQueryAssembler.java
index 018d199..269a877 100644
--- a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESClusterIndexQueryAssembler.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESClusterIndexQueryAssembler.java
@@ -34,10 +34,11 @@ public class ESClusterIndexQueryAssembler
     public void assemble( ModuleAssembly module )
         throws AssemblyException
     {
-        module.services( ESClusterIndexQueryService.class ).
-            identifiedBy( identity() ).
-            visibleIn( visibility() ).
-            instantiateOnStartup();
+        module.services( ESClusterIndexQueryService.class )
+              .taggedWith( "elasticsearch", "query", "indexing" )
+              .identifiedBy( identity() )
+              .visibleIn( visibility() )
+              .instantiateOnStartup();
 
         module.services( OrgJsonValueSerializationService.class ).
             taggedWith( ValueSerialization.Formats.JSON );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/16485455/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESFilesystemIndexQueryAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESFilesystemIndexQueryAssembler.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESFilesystemIndexQueryAssembler.java
index acc5f4f..6b529ca 100644
--- a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESFilesystemIndexQueryAssembler.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESFilesystemIndexQueryAssembler.java
@@ -34,10 +34,11 @@ public class ESFilesystemIndexQueryAssembler
     public void assemble( ModuleAssembly module )
         throws AssemblyException
     {
-        module.services( ESFilesystemIndexQueryService.class ).
-            identifiedBy( identity() ).
-            visibleIn( visibility() ).
-            instantiateOnStartup();
+        module.services( ESFilesystemIndexQueryService.class )
+              .taggedWith( "elasticsearch", "query", "indexing" )
+              .identifiedBy( identity() )
+              .visibleIn( visibility() )
+              .instantiateOnStartup();
 
         module.services( OrgJsonValueSerializationService.class ).
             taggedWith( ValueSerialization.Formats.JSON );


[09/12] polygene-java git commit: Various improvements in Cassandra ES, from using it in an application.

Posted by ni...@apache.org.
Various improvements in Cassandra ES, from using it in an application.


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

Branch: refs/heads/develop
Commit: aeff80d3848dd8a91536dba1e91a634fa78204c2
Parents: 1648545
Author: niclas <ni...@spicter.com>
Authored: Sun Mar 5 13:39:40 2017 +0800
Committer: niclas <ni...@spicter.com>
Committed: Sun Mar 5 13:39:40 2017 +0800

----------------------------------------------------------------------
 .../entitystore/cassandra/CassandraCluster.java    | 17 ++++++++---------
 .../cassandra/CassandraEntityStoreMixin.java       | 12 ++++++------
 .../cassandra/CassandraEntityStoreService.java     |  3 +--
 .../assembly/CassandraEntityStoreAssembler.java    | 11 +++++------
 .../cassandra/CassandraMapEntityStoreTest.java     | 13 +++++--------
 5 files changed, 25 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/aeff80d3/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/CassandraCluster.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/CassandraCluster.java b/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/CassandraCluster.java
index 6b5d4d4..c707652 100644
--- a/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/CassandraCluster.java
+++ b/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/CassandraCluster.java
@@ -25,7 +25,6 @@ import com.datastax.driver.core.KeyspaceMetadata;
 import com.datastax.driver.core.PreparedStatement;
 import com.datastax.driver.core.Session;
 import com.datastax.driver.core.exceptions.AlreadyExistsException;
-import java.util.Objects;
 import org.apache.polygene.api.common.Optional;
 import org.apache.polygene.api.configuration.Configuration;
 import org.apache.polygene.api.injection.scope.Service;
@@ -48,10 +47,10 @@ public interface CassandraCluster
     String MANYASSOCIATIONS_COLUMN = "manyassocs";
     String NAMEDASSOCIATIONS_COLUMN = "namedassocs";
 
-    Session session();
-
     String tableName();
 
+    Session cassandraClientSession();
+
     PreparedStatement entityRetrieveStatement();
 
     PreparedStatement versionRetrieveStatement();
@@ -87,12 +86,6 @@ public interface CassandraCluster
         private PreparedStatement getVersionStatement;
 
         @Override
-        public Session session()
-        {
-            return session;
-        }
-
-        @Override
         public PreparedStatement entityRetrieveStatement()
         {
             return getEntityStatement;
@@ -116,6 +109,12 @@ public interface CassandraCluster
             return keyspaceName;
         }
 
+        @Override
+        public Session cassandraClientSession()
+        {
+            return session;
+        }
+
         public String tableName()
         {
             CassandraEntityStoreConfiguration config = configuration.get();

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/aeff80d3/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/CassandraEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/CassandraEntityStoreMixin.java b/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/CassandraEntityStoreMixin.java
index ab3631d..234a76f 100644
--- a/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/CassandraEntityStoreMixin.java
+++ b/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/CassandraEntityStoreMixin.java
@@ -121,7 +121,7 @@ public class CassandraEntityStoreMixin
 
     private EntityState queryFor( BoundStatement statement, ModuleDescriptor module, EntityReference reference )
     {
-        ResultSet result = cluster.session().execute( statement );
+        ResultSet result = cluster.cassandraClientSession().execute( statement );
         Row row = result.one();
         if( row == null )
         {
@@ -143,7 +143,7 @@ public class CassandraEntityStoreMixin
         {
             if( migration != null )
             {
-                migration.migrate( row, application.version(), cluster.session() );
+                migration.migrate( row, application.version(), cluster.cassandraClientSession() );
                 // State may have changed
                 status[ 0 ] = EntityStatus.UPDATED;
             }
@@ -294,7 +294,7 @@ public class CassandraEntityStoreMixin
     @Override
     public String versionOf( EntityStoreUnitOfWork unitOfWork, EntityReference reference )
     {
-        ResultSet result = cluster.session().execute( cluster.versionRetrieveStatement().bind( reference.identity().toString() ) );
+        ResultSet result = cluster.cassandraClientSession().execute( cluster.versionRetrieveStatement().bind( reference.identity().toString() ) );
         Row row = result.one();
         return row.getString( VERSION_COLUMN );
     }
@@ -348,7 +348,7 @@ public class CassandraEntityStoreMixin
                                 assocs,
                                 many,
                                 named );
-                            ResultSet result = cluster.session().execute( statement );
+                            ResultSet result = cluster.cassandraClientSession().execute( statement );
                             System.out.println( result );
                         } );
                 String ids = stream( state.spliterator(), false )
@@ -357,7 +357,7 @@ public class CassandraEntityStoreMixin
                     .collect( Collectors.joining( "," ) );
                 if( !ids.isEmpty() )
                 {
-                    cluster.session().execute( "DELETE FROM " + cluster.tableName() + " WHERE id IN (" + ids + ");" );
+                    cluster.cassandraClientSession().execute( "DELETE FROM " + cluster.tableName() + " WHERE id IN (" + ids + ");" );
                 }
             }
 
@@ -444,7 +444,7 @@ public class CassandraEntityStoreMixin
     @Override
     public Stream<EntityState> entityStates( ModuleDescriptor module )
     {
-        Session session = cluster.session();
+        Session session = cluster.cassandraClientSession();
         String tableName = cluster.tableName();
         ResultSet resultSet = session.execute( "SELECT "
                                                + IDENTITY_COLUMN + ", "

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/aeff80d3/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/CassandraEntityStoreService.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/CassandraEntityStoreService.java b/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/CassandraEntityStoreService.java
index 051c29b..98d7298 100644
--- a/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/CassandraEntityStoreService.java
+++ b/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/CassandraEntityStoreService.java
@@ -29,8 +29,6 @@ import org.apache.polygene.spi.entitystore.ConcurrentModificationCheckConcern;
 import org.apache.polygene.spi.entitystore.EntityStateVersions;
 import org.apache.polygene.spi.entitystore.EntityStore;
 import org.apache.polygene.spi.entitystore.StateChangeNotificationConcern;
-import org.apache.polygene.spi.entitystore.helpers.JSONMapEntityStoreActivation;
-import org.apache.polygene.spi.entitystore.helpers.JSONMapEntityStoreMixin;
 
 /**
  * Cassandra EntityStore service.
@@ -48,4 +46,5 @@ public interface CassandraEntityStoreService
     String CURRENT_STORAGE_VERSION = "1";
     String DEFAULT_KEYSPACE_NAME = "polygene";
     String DEFAULT_TABLE_NAME = "entitystore";
+
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/aeff80d3/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/assembly/CassandraEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/assembly/CassandraEntityStoreAssembler.java b/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/assembly/CassandraEntityStoreAssembler.java
index 70b4525..2736dfd 100644
--- a/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/assembly/CassandraEntityStoreAssembler.java
+++ b/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/assembly/CassandraEntityStoreAssembler.java
@@ -22,7 +22,6 @@ package org.apache.polygene.entitystore.cassandra.assembly;
 import org.apache.polygene.bootstrap.Assemblers;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.ServiceDeclaration;
 import org.apache.polygene.entitystore.cassandra.CassandraEntityStoreConfiguration;
 import org.apache.polygene.entitystore.cassandra.CassandraEntityStoreService;
 
@@ -33,11 +32,11 @@ public class CassandraEntityStoreAssembler
     public void assemble( ModuleAssembly module )
         throws AssemblyException
     {
-        ServiceDeclaration service = module.services( CassandraEntityStoreService.class ).visibleIn( visibility() );
-        if( hasIdentity() )
-        {
-            service.identifiedBy( identity() );
-        }
+        module.services( CassandraEntityStoreService.class )
+              .visibleIn( visibility() )
+              .identifiedBy( identity() )
+              .instantiateOnStartup();
+
         if( hasConfig() )
         {
             configModule().entities( CassandraEntityStoreConfiguration.class ).visibleIn( configVisibility() );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/aeff80d3/extensions/entitystore-cassandra/src/test/java/org/apache/polygene/entitystore/cassandra/CassandraMapEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-cassandra/src/test/java/org/apache/polygene/entitystore/cassandra/CassandraMapEntityStoreTest.java b/extensions/entitystore-cassandra/src/test/java/org/apache/polygene/entitystore/cassandra/CassandraMapEntityStoreTest.java
index 9b1f0ac..45e35e1 100644
--- a/extensions/entitystore-cassandra/src/test/java/org/apache/polygene/entitystore/cassandra/CassandraMapEntityStoreTest.java
+++ b/extensions/entitystore-cassandra/src/test/java/org/apache/polygene/entitystore/cassandra/CassandraMapEntityStoreTest.java
@@ -19,20 +19,17 @@
  */
 package org.apache.polygene.entitystore.cassandra;
 
-import org.apache.polygene.entitystore.cassandra.assembly.CassandraDBEntityStoreAssembler;
-import org.apache.polygene.test.entity.CanRemoveAll;
-import org.apache.polygene.test.internal.DockerRule;
-import org.apache.polygene.valueserialization.jackson.JacksonValueSerializationAssembler;
-import org.junit.BeforeClass;
 import org.apache.polygene.api.common.Visibility;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.entitystore.cassandra.assembly.CassandraEntityStoreAssembler;
 import org.apache.polygene.test.EntityTestAssembler;
 import org.apache.polygene.test.entity.AbstractEntityStoreTest;
+import org.apache.polygene.test.entity.CanRemoveAll;
+import org.apache.polygene.test.internal.DockerRule;
+import org.apache.polygene.valueserialization.jackson.JacksonValueSerializationAssembler;
 import org.junit.ClassRule;
 
-import static org.apache.polygene.test.util.Assume.assumeConnectivity;
-
 /**
  * Test the CassandraEntityStoreService.
  * <p>Installing Cassandra and starting it should suffice as the test use Cassandra defaults: 127.0.0.1:3000</p>
@@ -57,7 +54,7 @@ public class CassandraMapEntityStoreTest
         new JacksonValueSerializationAssembler().assemble( module );
 
         // START SNIPPET: assembly
-        new CassandraDBEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
+        new CassandraEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
         // END SNIPPET: assembly
 
         CassandraEntityStoreConfiguration cassandraConfig = config.forMixin( CassandraEntityStoreConfiguration.class ).declareDefaults();


[02/12] polygene-java git commit: Fixes on the Yeoman generator

Posted by ni...@apache.org.
Fixes on the Yeoman generator


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

Branch: refs/heads/develop
Commit: 33641902faf01f32b3a03763af18acaed8b43255
Parents: 849f4f5
Author: niclas <ni...@spicter.com>
Authored: Fri Mar 3 08:19:32 2017 +0800
Committer: niclas <ni...@spicter.com>
Committed: Fri Mar 3 08:19:32 2017 +0800

----------------------------------------------------------------------
 tools/generator-polygene/app/index.js           |  5 +-
 .../templates/RDFIndexingModule/bootstrap.tmpl  | 50 --------------------
 .../templates/RdfIndexingModule/bootstrap.tmpl  | 50 ++++++++++++++++++++
 .../templates/buildtool/gradle-bootstrap.tmpl   |  6 +--
 4 files changed, 56 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/33641902/tools/generator-polygene/app/index.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/index.js b/tools/generator-polygene/app/index.js
index cddb34a..be71f4f 100644
--- a/tools/generator-polygene/app/index.js
+++ b/tools/generator-polygene/app/index.js
@@ -55,7 +55,7 @@ module.exports = generators.Base.extend(
                         type: 'input',
                         name: 'packagename',
                         message: 'Java package name',
-                        default: this.appname // Default to current folder name
+                        default: "com.acme." + this.appname // Default to current folder name
                     },
                     {
                         type: 'list',
@@ -158,7 +158,7 @@ module.exports = generators.Base.extend(
 
             copyEntityStore( this, polygene.entitystore );
 
-            copyPolygeneBootstrap( this, "infrastructure", "RDFIndexingModule", hasIndexing( 'Rdf' ) );
+            copyPolygeneBootstrap( this, "infrastructure", "RdfIndexingModule", hasIndexing( 'Rdf' ) );
             copyPolygeneBootstrap( this, "infrastructure", "ElasticSearchIndexingModule", hasIndexing( 'Elasticsearch' ) );
             copyPolygeneBootstrap( this, "infrastructure", "SolrIndexingModule", hasIndexing( 'Solr' ) );
             copyPolygeneBootstrap( this, "infrastructure", "SqlIndexingModule", hasIndexing( 'Sql' ) );
@@ -178,6 +178,7 @@ module.exports = generators.Base.extend(
             copyPolygeneBootstrap( this, "infrastructure", "MigrationModule", hasFeature( 'version migration' ) );
 
             copyPolygeneBootstrap( this, "domain", "CrudModule", true );
+            copyPolygeneBootstrap( this, "domain", "SecurityModule", true );
             copyHeroesSampleApp( this );
             copyPolygeneDomain( this, "security", "RestApiModule", "SecurityRepository", hasFeature( 'rest api' ) );
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/33641902/tools/generator-polygene/app/templates/RDFIndexingModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/RDFIndexingModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/RDFIndexingModule/bootstrap.tmpl
deleted file mode 100644
index 8376a2b..0000000
--- a/tools/generator-polygene/app/templates/RDFIndexingModule/bootstrap.tmpl
+++ /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 <%= packageName %>.bootstrap.infrastructure;
-
-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;
-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 RdfIndexingModule
-    implements ModuleAssembler
-{
-    public static final String NAME = "Rdf Indexing Module";
-    private final ModuleAssembly configModule;
-
-    public RdfIndexingModule( ModuleAssembly configModule )
-    {
-        this.configModule = configModule;
-    }
-
-    @Override
-    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
-        throws AssemblyException
-    {
-        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/33641902/tools/generator-polygene/app/templates/RdfIndexingModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/RdfIndexingModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/RdfIndexingModule/bootstrap.tmpl
new file mode 100644
index 0000000..8376a2b
--- /dev/null
+++ b/tools/generator-polygene/app/templates/RdfIndexingModule/bootstrap.tmpl
@@ -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 <%= packageName %>.bootstrap.infrastructure;
+
+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;
+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 RdfIndexingModule
+    implements ModuleAssembler
+{
+    public static final String NAME = "Rdf Indexing Module";
+    private final ModuleAssembly configModule;
+
+    public RdfIndexingModule( ModuleAssembly configModule )
+    {
+        this.configModule = configModule;
+    }
+
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+        throws AssemblyException
+    {
+        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/33641902/tools/generator-polygene/app/templates/buildtool/gradle-bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/buildtool/gradle-bootstrap.tmpl b/tools/generator-polygene/app/templates/buildtool/gradle-bootstrap.tmpl
index d13cb96..ceb0541 100644
--- a/tools/generator-polygene/app/templates/buildtool/gradle-bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/buildtool/gradle-bootstrap.tmpl
@@ -29,8 +29,8 @@ dependencies {
 <% if( hasFeature( 'rest api' ) ) { %>
   compile "org.apache.polygene.libraries:org.apache.polygene.library.restlet:$polygeneVersion"
 <% } %>
-  compile "org.apache.polygene.extension:org.apache.polygene.extension.entitystore-<%= polygene.entitystore.toLowerCase() %>:$polygeneVersion"
-  compile "org.apache.polygene.extension:org.apache.polygene.extension.indexing-<%= polygene.indexing.toLowerCase() %>:$polygeneVersion"
-  compile "org.apache.polygene.extension:org.apache.polygene.extension.valueserialization-<%= polygene.serialization.toLowerCase() %>:$polygeneVersion"
+  compile "org.apache.polygene.extensions:org.apache.polygene.extension.entitystore-<%= polygene.entitystore.toLowerCase() %>:$polygeneVersion"
+  compile "org.apache.polygene.extensions:org.apache.polygene.extension.indexing-<%= polygene.indexing.toLowerCase() %>:$polygeneVersion"
+  compile "org.apache.polygene.extensions:org.apache.polygene.extension.valueserialization-<%= polygene.serialization.toLowerCase() %>:$polygeneVersion"
 
 }
\ No newline at end of file


[06/12] polygene-java git commit: POLYGENE-235: Adding "query" and "indexing" tags to SQL Indexing

Posted by ni...@apache.org.
POLYGENE-235: Adding "query" and "indexing" tags to SQL Indexing


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

Branch: refs/heads/develop
Commit: 9f38f3f51ebef70a90d184db8ed9d3e74bc76f6d
Parents: 32492c0
Author: niclas <ni...@spicter.com>
Authored: Sun Mar 5 13:34:53 2017 +0800
Committer: niclas <ni...@spicter.com>
Committed: Sun Mar 5 13:34:53 2017 +0800

----------------------------------------------------------------------
 .../sql/assembly/AbstractSQLIndexQueryAssembler.java  | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/9f38f3f5/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/AbstractSQLIndexQueryAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/AbstractSQLIndexQueryAssembler.java b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/AbstractSQLIndexQueryAssembler.java
index ca02bcb..11f257e 100644
--- a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/AbstractSQLIndexQueryAssembler.java
+++ b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/AbstractSQLIndexQueryAssembler.java
@@ -72,10 +72,11 @@ public abstract class AbstractSQLIndexQueryAssembler<AssemblerType>
                 throw new AssemblyException( "SQL Vendor could not be determined." );
             }
             module.services( getIndexQueryServiceType() )
-                .identifiedBy( identity() )
-                .setMetaInfo( sqlVendor )
-                .visibleIn( visibility() )
-                .instantiateOnStartup();
+                  .taggedWith( "sql", "query", "indexing" )
+                  .identifiedBy( identity() )
+                  .setMetaInfo( sqlVendor )
+                  .visibleIn( visibility() )
+                  .instantiateOnStartup();
         }
         catch( IOException ex )
         {
@@ -86,14 +87,13 @@ public abstract class AbstractSQLIndexQueryAssembler<AssemblerType>
             visibleIn( Visibility.module );
         module.services( ReindexingStrategy.class ).
             withMixins( reindexingStrategy ).
-            visibleIn( Visibility.module );
+                  visibleIn( Visibility.module );
 
         if( hasConfig() )
         {
             configModule().entities( SQLConfiguration.class,
                                      ReindexerConfiguration.class ).
-                visibleIn( configVisibility() );
+                              visibleIn( configVisibility() );
         }
     }
-
 }


[10/12] polygene-java git commit: POLYGENE-158 : A bunch of work on the Yeoman project creator. Still far from complete...

Posted by ni...@apache.org.
POLYGENE-158 : A bunch of work on the Yeoman project creator. Still far from complete...


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

Branch: refs/heads/develop
Commit: 46e02826b54771930a89bfa83a344c1f2f5b926e
Parents: aeff80d
Author: niclas <ni...@spicter.com>
Authored: Sun Mar 5 21:24:15 2017 +0800
Committer: niclas <ni...@spicter.com>
Committed: Sun Mar 5 21:24:15 2017 +0800

----------------------------------------------------------------------
 tools/generator-polygene/app/index.js           | 566 +++++++++++--------
 .../app/templates/CodahaleModule/bootstrap.tmpl |  50 ++
 .../app/templates/DomainLayer/bootstrap.tmpl    |   2 +
 .../app/templates/DomainModule/Crud.tmpl        |  41 ++
 .../app/templates/DomainModule/Entity.tmpl      |  41 ++
 .../app/templates/DomainModule/Object.tmpl      |  33 ++
 .../app/templates/DomainModule/Service.tmpl     |  36 ++
 .../app/templates/DomainModule/Value.tmpl       |  41 ++
 .../app/templates/DomainModule/bootstrap.tmpl   |  85 +++
 .../HardcodedSecurityRepositoryMixin.tmpl       |  51 --
 .../templates/SolrIndexingModule/bootstrap.tmpl |  49 ++
 11 files changed, 709 insertions(+), 286 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/46e02826/tools/generator-polygene/app/index.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/index.js b/tools/generator-polygene/app/index.js
index be71f4f..7ab5505 100644
--- a/tools/generator-polygene/app/index.js
+++ b/tools/generator-polygene/app/index.js
@@ -18,302 +18,398 @@
  *
  */
 
-var generators = require( 'yeoman-generator' );
+var generators = require('yeoman-generator');
+var fs = require('fs');
 
 var polygene = {};
 
 module.exports = generators.Base.extend(
     {
         // The name `constructor` is important here
-        constructor: function ()
-        {
+        constructor: function () {
             // Calling the super constructor is important so our generator is correctly set up
-            generators.Base.apply( this, arguments );
-
-            // this.option( 'coffee' ); // This method adds support for a `--coffee` flag
+            generators.Base.apply(this, arguments);
+
+            this.option('import-model'); // --import-model reads model.json in current directory and creates the domain model for it.
+
+            if (this.options.import != null) {
+                polygene = importModel(this, './imported-model.json');
+                polygene.name = polygene.name ? polygene.name : firstUpper(this.appname);
+                polygene.packageName = polygene.packageName ? polygene.packageName : ("com.acme." + this.appname);
+                polygene.singletonApp = false;  // not supported yet
+                polygene.features = polygene.features ? polygene.features : ['rest api'];
+                polygene.modules = polygene.modules ? polygene.modules : {};
+                polygene.indexing = polygene.indexing ? polygene.indexing : null;
+                polygene.entitystore = polygene.entitystore ? polygene.entitystore : null;
+                polygene.caching = polygene.caching ? polygene.caching : null;
+                polygene.serialization = polygene.serialization ? polygene.serialization : null;
+                console.log(JSON.stringify(polygene,null,4));
+            }
+            else {
+                polygene = {
+                    name: firstUpper(this.appname),
+                    packageName: "com.acme." + this.appname,
+                    singletonApp: false,
+                    entitystore: null,
+                    indexing: null,
+                    serialization: null,
+                    caching: null,
+                    features: ['rest api'],
+                    modules: {}
+                };
+            }
         },
 
-        method1: function ()
-        {
-            console.log( 'method 1 just ran' );
-        },
-        method2: function ()
-        {
-            console.log( 'method 2 just ran' );
-        },
-        prompting: function ()
-        {
-            return this.prompt(
-                [
-                    {
-                        type: 'input',
-                        name: 'name',
-                        message: 'Your project name',
-                        default: firstUpper( this.appname )
-                    },
-                    {
-                        type: 'input',
-                        name: 'packagename',
-                        message: 'Java package name',
-                        default: "com.acme." + this.appname // Default to current folder name
-                    },
-                    {
-                        type: 'list',
-                        name: 'entitystore',
-                        choices: [
-                            'Cassandra',
-                            'File',
-                            'DerbySQL',
-                            'Geode',
-                            'H2SQL',
-                            'Hazelcast',
-                            'JClouds',
-                            'Jdbm',
-                            'LevelDB',
-                            'Memory',
-                            'MongoDB',
-                            'MySQL',
-                            'Preferences',
-                            'Redis',
-                            'Riak',
-                            'PostgresSQL',
-                            'SQLite'
-                        ],
-                        message: 'Which entity store do you want to use?'
-                    },
-                    {
-                        type: 'list',
-                        name: 'indexing',
-                        choices: [
-                            'Rdf',
-                            'ElasticSearch',
-                            'Solr',
-                            'SQL'
-                        ],
-                        message: 'Which indexing system do you want to use?'
-                    },
-                    {
-                        type: 'list',
-                        name: 'caching',
-                        choices: [
-                            'none',
-                            'memcache',
-                            'ehcache'
-                        ],
-                        message: 'Which caching system do you want to use?'
-                    },
-                    {
-                        type: 'list',
-                        name: 'serialization',
-                        choices: [
-                            'Jackson',
-                            'Stax',
-                            'OrgJson'
-                        ],
-                        message: 'Which serialization system do you want to use?'
-                    },
-                    {
-                        type: 'checkbox',
-                        name: 'features',
-                        choices: [
-                            'rest api',
-                            // 'reindexer',
-                            // 'metrics',
-                            // 'jmx',
-                            // 'version migration',
-                            'sample (heroes) web application'
-                        ],
-                        message: 'Other features?'
-                    }
-                ]
-            ).then( function ( answers )
-                    {
-                        this.log( 'app name', answers.name );
-                        this.log( 'Entity Stores:', answers.entitystore );
-                        this.log( 'Indexing:', answers.indexing );
-                        this.log( 'Caching:', answers.caching );
-                        this.log( 'Serialization:', answers.serialization );
-                        this.log( 'Features:', answers.features );
-                        polygene = answers;
-                        polygene.javaPackageDir = polygene.packagename.replace( '.', '/' );
-                        polygene.singletonApp = false;
-                        if( hasFeature( 'sample (heroes) web application' ) )
+        prompting: function () {
+            if (this.options.noPrompt != null) {
+                return this.prompt([]);
+            }
+            else {
+                return this.prompt(
+                    [
+                        {
+                            type: 'input',
+                            name: 'name',
+                            message: 'Your project name',
+                            default: polygene.name
+                        },
+                        {
+                            type: 'input',
+                            name: 'packageName',
+                            message: 'Java package name',
+                            default: polygene.packageName
+                        },
                         {
-                            polygene.features.push( 'rest api' );
+                            type: 'list',
+                            name: 'entitystore',
+                            choices: [
+                                'Cassandra',
+                                'File',
+                                'DerbySQL',
+                                'Geode',
+                                'H2SQL',
+                                'Hazelcast',
+                                'JClouds',
+                                'Jdbm',
+                                'LevelDB',
+                                'Memory',
+                                'MongoDB',
+                                'MySQL',
+                                'Preferences',
+                                'Redis',
+                                'Riak',
+                                'PostgresSQL',
+                                'SQLite'
+                            ],
+                            message: 'Which entity store do you want to use?',
+                            default: polygene.entitystore
+                        },
+                        {
+                            type: 'list',
+                            name: 'indexing',
+                            choices: [
+                                'Rdf',
+                                'ElasticSearch',
+                                'Solr',
+                                'SQL'
+                            ],
+                            message: 'Which indexing system do you want to use?'
+                        },
+                        {
+                            type: 'list',
+                            name: 'caching',
+                            choices: [
+                                'none',
+                                'memcache',
+                                'ehcache'
+                            ],
+                            message: 'Which caching system do you want to use?'
+                        },
+                        {
+                            type: 'list',
+                            name: 'serialization',
+                            choices: [
+                                'Jackson',
+                                // 'Johnzon',
+                                'Stax'
+                            ],
+                            message: 'Which serialization system do you want to use?'
+                        },
+                        {
+                            type: 'list',
+                            name: 'metrics',
+                            choices: [
+                                'none',
+                                'codahale'
+                            ],
+                            message: 'Which metrics capturing system do you want to use?'
+                        },
+                        {
+                            type: 'checkbox',
+                            name: 'features',
+                            choices: [
+                                'rest api',
+                                // 'jmx',
+                                // 'version migration',
+                                'sample (heroes) web application'
+                            ],
+                            message: 'Other features?'
                         }
-                    }.bind( this )
-            );
+                    ]
+                ).then(function (answers) {
+                        this.log('app name', answers.name);
+                        this.log('Entity Stores:', answers.entitystore);
+                        this.log('Indexing:', answers.indexing);
+                        this.log('Caching:', answers.caching);
+                        this.log('Serialization:', answers.serialization);
+                        this.log('Features:', answers.features);
+                        polygene.name = answers.name;
+                        polygene.entitystore = answers.entitystore;
+                        polygene.indexing = answers.indexing;
+                        polygene.caching = answers.caching;
+                        polygene.serialization = answers.serialization;
+                        polygene.metrics = answers.metrics;
+                        polygene.packageName = answers.packageName;
+                        answers.features.forEach(function (f) {
+                            polygene.features.push(f);
+                        });
+                        polygene.javaPackageDir = polygene.javaPackageDir ? polygene.javaPackageDir : polygene.packageName.replace(/[.]/g, '/');
+                        polygene.singletonApp = false;
+                        if (hasFeature('sample (heroes) web application')) {
+                            polygene.features.push('rest api');
+                        }
+                    }.bind(this)
+                );
+            }
         },
 
-        writing: function ()
-        {
-            copyPolygeneBootstrap( this, "config", "ConfigurationLayer", !polygene.singeltonApp );
-            copyPolygeneBootstrap( this, "infrastructure", "InfrastructureLayer", !polygene.singeltonApp );
-            copyPolygeneBootstrap( this, "domain", "DomainLayer", !polygene.singeltonApp );
-            copyPolygeneBootstrap( this, "connectivity", "ConnectivityLayer", !polygene.singeltonApp );
-
-            copyPolygeneBootstrap( this, "config", "ConfigModule", true );
-
-            copyPolygeneBootstrap( this, "infrastructure", "FileConfigurationModule", true );
-
-            copyEntityStore( this, polygene.entitystore );
-
-            copyPolygeneBootstrap( this, "infrastructure", "RdfIndexingModule", hasIndexing( 'Rdf' ) );
-            copyPolygeneBootstrap( this, "infrastructure", "ElasticSearchIndexingModule", hasIndexing( 'Elasticsearch' ) );
-            copyPolygeneBootstrap( this, "infrastructure", "SolrIndexingModule", hasIndexing( 'Solr' ) );
-            copyPolygeneBootstrap( this, "infrastructure", "SqlIndexingModule", hasIndexing( 'Sql' ) );
-
-            copyPolygeneBootstrap( this, "infrastructure", "NoCachingModule", hasCaching( 'none' ) );
-            copyPolygeneBootstrap( this, "infrastructure", "MemcacheCachingModule", hasCaching( 'Memcache' ) );
-            copyPolygeneBootstrap( this, "infrastructure", "EhCacheCachingModule", hasCaching( 'Ehcache' ) );
-
-            copyPolygeneBootstrap( this, "infrastructure", "JacksonSerializationModule", hasSerialization( 'Jackson' ) );
-            copyPolygeneBootstrap( this, "infrastructure", "StaxSerializationModule", hasSerialization( 'Stax' ) );
-            copyPolygeneBootstrap( this, "infrastructure", "OrgJsonSerializationModule", hasSerialization( 'Orgjson' ) );
-
-            copyPolygeneBootstrap( this, "connectivity", "RestApiModule", hasFeature( 'rest api' ) );
-            copyPolygeneBootstrap( this, "infrastructure", "ReindexerModule", hasFeature( 'reindexer' ) );
-            copyPolygeneBootstrap( this, "infrastructure", "MetricsModule", hasFeature( 'metrics' ) );
-            copyPolygeneBootstrap( this, "infrastructure", "JmxModule", hasFeature( 'jmx' ) );
-            copyPolygeneBootstrap( this, "infrastructure", "MigrationModule", hasFeature( 'version migration' ) );
-
-            copyPolygeneBootstrap( this, "domain", "CrudModule", true );
-            copyPolygeneBootstrap( this, "domain", "SecurityModule", true );
-            copyHeroesSampleApp( this );
-            copyPolygeneDomain( this, "security", "RestApiModule", "SecurityRepository", hasFeature( 'rest api' ) );
-
-            copyRestFeature( this, hasFeature( 'rest api' ) );
-
-            copyTemplate( this, 'buildtool/gradle-app.tmpl', 'app/build.gradle' );
-            copyTemplate( this, 'buildtool/gradle-bootstrap.tmpl', 'bootstrap/build.gradle' );
-            copyTemplate( this, 'buildtool/gradle-model.tmpl', 'model/build.gradle' );
-            copyTemplate( this, 'buildtool/gradle-rest.tmpl', 'rest/build.gradle' );
-            copyTemplate( this, 'buildtool/gradle-root.tmpl', 'build.gradle' );
-            copyTemplate( this, 'buildtool/settings.tmpl', 'settings.gradle' );
-            copyTemplate( this, 'buildtool/gradlew.tmpl', 'gradlew' );
-            copyTemplate( this, 'buildtool/gradlew-bat.tmpl', 'gradlew.bat' );
-            this.fs.copy( this.templatePath( 'buildtool/gradle-wrapper.jar_' ), this.destinationPath( 'gradle/wrapper/gradle-wrapper.jar' ) );
-            this.fs.copy( this.templatePath( 'buildtool/gradle-wrapper.properties_' ), this.destinationPath( 'gradle/wrapper/gradle-wrapper.properties' ) );
+        writing: function () {
+            copyPolygeneBootstrap(this, "config", "ConfigurationLayer", !polygene.singeltonApp);
+            copyPolygeneBootstrap(this, "infrastructure", "InfrastructureLayer", !polygene.singeltonApp);
+            copyPolygeneBootstrap(this, "domain", "DomainLayer", !polygene.singeltonApp);
+            copyPolygeneBootstrap(this, "connectivity", "ConnectivityLayer", !polygene.singeltonApp);
+
+            copyPolygeneBootstrap(this, "config", "ConfigModule", true);
+
+            copyPolygeneBootstrap(this, "infrastructure", "FileConfigurationModule", true);
+
+            copyEntityStore(this, polygene.entitystore);
+
+            copyPolygeneBootstrap(this, "infrastructure", "RdfIndexingModule", hasIndexing('Rdf'));
+            copyPolygeneBootstrap(this, "infrastructure", "ElasticSearchIndexingModule", hasIndexing('Elasticsearch'));
+            copyPolygeneBootstrap(this, "infrastructure", "SolrIndexingModule", hasIndexing('Solr'));
+            copyPolygeneBootstrap(this, "infrastructure", "SqlIndexingModule", hasIndexing('Sql'));
+
+            copyPolygeneBootstrap(this, "infrastructure", "NoCachingModule", hasCaching('none'));
+            copyPolygeneBootstrap(this, "infrastructure", "MemcacheCachingModule", hasCaching('Memcache'));
+            copyPolygeneBootstrap(this, "infrastructure", "EhCacheCachingModule", hasCaching('Ehcache'));
+
+            copyPolygeneBootstrap(this, "infrastructure", "JacksonSerializationModule", hasSerialization('Jackson'));
+            copyPolygeneBootstrap(this, "infrastructure", "StaxSerializationModule", hasSerialization('Stax'));
+            copyPolygeneBootstrap(this, "infrastructure", "OrgJsonSerializationModule", hasSerialization('Orgjson'));
+
+            copyPolygeneBootstrap(this, "connectivity", "RestApiModule", hasFeature('rest api'));
+            copyPolygeneBootstrap(this, "infrastructure", "ReindexerModule", hasFeature('reindexer'));
+            copyPolygeneBootstrap(this, "infrastructure", "MetricsModule", hasFeature('metrics'));
+            copyPolygeneBootstrap(this, "infrastructure", "JmxModule", hasFeature('jmx'));
+            copyPolygeneBootstrap(this, "infrastructure", "MigrationModule", hasFeature('version migration'));
+
+            copyPolygeneBootstrap(this, "domain", "CrudModule", true);
+            var ctx = this;
+            Object.keys(polygene.modules).forEach(function (moduleName, index) {
+                copyPolygeneDomainModule(ctx, moduleName, polygene.modules[moduleName]);
+            });
+            copyPolygeneBootstrap(this, "domain", "CrudModule", hasFeature('rest api'));
+            // copyPolygeneBootstrap(this, "domain", "SecurityModule", true);
+            copyHeroesSampleApp(this);
+            copyPolygeneDomain(this, "security", "RestApiModule", "SecurityRepository", hasFeature('rest api'));
+
+            copyRestFeature(this, hasFeature('rest api'));
+
+            copyTemplate(this, 'buildtool/gradle-app.tmpl', 'app/build.gradle');
+            copyTemplate(this, 'buildtool/gradle-bootstrap.tmpl', 'bootstrap/build.gradle');
+            copyTemplate(this, 'buildtool/gradle-model.tmpl', 'model/build.gradle');
+            copyTemplate(this, 'buildtool/gradle-rest.tmpl', 'rest/build.gradle');
+            copyTemplate(this, 'buildtool/gradle-root.tmpl', 'build.gradle');
+            copyTemplate(this, 'buildtool/settings.tmpl', 'settings.gradle');
+            copyTemplate(this, 'buildtool/gradlew.tmpl', 'gradlew');
+            copyTemplate(this, 'buildtool/gradlew-bat.tmpl', 'gradlew.bat');
+            this.fs.copy(this.templatePath('buildtool/gradle-wrapper.jar_'), this.destinationPath('gradle/wrapper/gradle-wrapper.jar'));
+            this.fs.copy(this.templatePath('buildtool/gradle-wrapper.properties_'), this.destinationPath('gradle/wrapper/gradle-wrapper.properties'));
+
+            if (this.options.export != null) {
+                exportModel(this, "exported-model.json");
+            }
         }
     }
 );
 
-function copyPolygeneBootstrap( ctx, layer, moduleName, condition )
-{
-    if( condition )
-    {
-        copyTemplate( ctx,
-                      moduleName + '/bootstrap.tmpl',
-                      'bootstrap/src/main/java/' + polygene.javaPackageDir + '/bootstrap/' + layer + '/' + moduleName + '.java' );
+function copyPolygeneBootstrap(ctx, layer, moduleName, condition) {
+    if (condition) {
+        copyTemplate(ctx,
+            moduleName + '/bootstrap.tmpl',
+            'bootstrap/src/main/java/' + polygene.javaPackageDir + '/bootstrap/' + layer + '/' + moduleName + '.java');
     }
 }
 
-function copyEntityStore( ctx, entityStoreName )
-{
-    copyTemplate( ctx,
-                  'StorageModule/bootstrap.tmpl',
-                  'bootstrap/src/main/java/' + polygene.javaPackageDir + '/bootstrap/infrastructure/' + entityStoreName + 'StorageModule.java' );
+function copyEntityStore(ctx, entityStoreName) {
+    copyTemplate(ctx,
+        'StorageModule/bootstrap.tmpl',
+        'bootstrap/src/main/java/' + polygene.javaPackageDir + '/bootstrap/infrastructure/' + entityStoreName + 'StorageModule.java');
 }
 
-function copyPolygeneApp( ctx, name, condition )
-{
-    if( condition )
-    {
-        copyTemplate( ctx,
-                      name + '/bootstrap.tmpl',
-                      'bootstrap/src/main/java/' + polygene.javaPackageDir + '/bootstrap/' + name + 'ApplicationAssembler.java' );
+function copyPolygeneApp(ctx, name, condition) {
+    if (condition) {
+        copyTemplate(ctx,
+            name + '/bootstrap.tmpl',
+            'bootstrap/src/main/java/' + polygene.javaPackageDir + '/bootstrap/' + name + 'ApplicationAssembler.java');
 
-        copyTemplate( ctx,
-                      name + '/app.tmpl',
-                      'app/src/main/java/' + polygene.javaPackageDir + '/app/' + name + '.java' );
+        copyTemplate(ctx,
+            name + '/app.tmpl',
+            'app/src/main/java/' + polygene.javaPackageDir + '/app/' + name + '.java');
 
-        copyTemplate( ctx,
-                      name + '/webapp/',
-                      'app/src/main/webapp/' );
+        copyTemplate(ctx,
+            name + '/webapp/',
+            'app/src/main/webapp/');
     }
 }
 
-function copyPolygeneDomain( ctx, model, module, clazz, condition )
-{
-    if( condition )
-    {
-        copyTemplate( ctx,
-                      module + '/' + clazz + '.tmpl',
-                      'model/src/main/java/' + polygene.javaPackageDir + '/model/' + model + '/' + clazz + '.java' );
+function copyPolygeneDomain(ctx, model, module, clazz, condition) {
+    if (condition) {
+        copyTemplate(ctx,
+            module + '/' + clazz + '.tmpl',
+            'model/src/main/java/' + polygene.javaPackageDir + '/model/' + model + '/' + clazz + '.java');
     }
 }
 
-function copyRestFeature( ctx, condition )
-{
-    if( condition )
-    {
-        copyPolygeneBootstrap( ctx, "domain", "SecurityModule", true );
+function copyPolygeneDomainModule(ctx, moduleName, moduleDef) {
+    var clazz = firstUpper(moduleName) + "Module";
+    polygene.current = moduleDef;
+    polygene.current.name = moduleName;
+    copyTemplate(ctx,
+        'DomainModule/bootstrap.tmpl',
+        'bootstrap/src/main/java/' + polygene.javaPackageDir + '/bootstrap/domain/' + clazz + '.java');
+    for (var idx1 in moduleDef.cruds) {
+        if (moduleDef.cruds.hasOwnProperty(idx1)) {
+            polygene.current.clazz = moduleDef.cruds[idx1];
+            copyTemplate(ctx,
+                'DomainModule/Crud.tmpl',
+                'model/src/main/java/' + polygene.javaPackageDir + '/model/' + moduleName + '/' + moduleDef.cruds[idx1].name + '.java');
+        }
+    }
+    for (var idx2 in moduleDef.values) {
+        if (moduleDef.values.hasOwnProperty(idx2)) {
+            polygene.current.clazz = moduleDef.values[idx2];
+            copyTemplate(ctx,
+                'DomainModule/Value.tmpl',
+                'model/src/main/java/' + polygene.javaPackageDir + '/model/' + moduleName + '/' + moduleDef.values[idx2].name + '.java');
+        }
+    }
+    for (var idx3 in moduleDef.entities) {
+        if (moduleDef.entities.hasOwnProperty(idx3)) {
+            polygene.current.clazz = moduleDef.entities[idx2];
+            copyTemplate(ctx,
+                'DomainModule/Entity.tmpl',
+                'model/src/main/java/' + polygene.javaPackageDir + '/model/' + moduleName + '/' + moduleDef.entities[idx3].name + '.java');
+        }
+    }
+    for (var idx4 in moduleDef.transients) {
+        if (moduleDef.transients.hasOwnProperty(idx4)) {
+            polygene.current.clazz = moduleDef.transients[idx3];
+            copyTemplate(ctx,
+                'DomainModule/Transient.tmpl',
+                'model/src/main/java/' + polygene.javaPackageDir + '/model/' + moduleName + '/' + moduleDef.transients[idx4].name + '.java');
+        }
+    }
+    for (var idx5 in moduleDef.objects) {
+        if (moduleDef.objects.hasOwnProperty(idx5)) {
+            polygene.current.clazz = moduleDef.objects[idx5];
+            copyTemplate(ctx,
+                'DomainModule/Object.tmpl',
+                'model/src/main/java/' + polygene.javaPackageDir + '/model/' + moduleName + '/' + moduleDef.objects[idx5].name + '.java');
+        }
+    }
+    for (var idx6 in moduleDef.services) {
+        if (moduleDef.services.hasOwnProperty(idx6)) {
+            polygene.current.clazz = moduleDef.services[idx6];
+            copyTemplate(ctx,
+                'DomainModule/Service.tmpl',
+                'model/src/main/java/' + polygene.javaPackageDir + '/model/' + moduleName + '/' + moduleDef.services[idx6].name + '.java');
+        }
+    }
+}
 
-        copyTemplate( ctx,
-                      'RestApiModule/SimpleEnroler.tmpl',
-                      'rest/src/main/java/' + polygene.javaPackageDir + '/rest/security/SimpleEnroler.java' );
+function copyRestFeature(ctx, condition) {
+    if (condition) {
+        copyPolygeneBootstrap(ctx, "domain", "SecurityModule", true);
 
-        copyTemplate( ctx,
-                      'RestApiModule/SimpleVerifier.tmpl',
-                      'rest/src/main/java/' + polygene.javaPackageDir + '/rest/security/SimpleVerifier.java' );
+        copyTemplate(ctx,
+            'RestApiModule/SimpleEnroler.tmpl',
+            'rest/src/main/java/' + polygene.javaPackageDir + '/rest/security/SimpleEnroler.java');
 
-        copyTemplate( ctx,
-                      'RestApiModule/HardcodedSecurityRepositoryMixin.tmpl',
-                      'model/src/main/java/' + polygene.javaPackageDir + '/model/security/HardcodedSecurityRepositoryMixin.java' );
+        copyTemplate(ctx,
+            'RestApiModule/SimpleVerifier.tmpl',
+            'rest/src/main/java/' + polygene.javaPackageDir + '/rest/security/SimpleVerifier.java');
+
+        copyTemplate(ctx,
+            'RestApiModule/HardcodedSecurityRepositoryMixin.tmpl',
+            'model/src/main/java/' + polygene.javaPackageDir + '/model/security/HardcodedSecurityRepositoryMixin.java');
     }
 }
 
-function copyHeroesSampleApp( ctx )
-{
-    copyPolygeneDomain( ctx, "heroes", "Heroes", "Hero", hasFeature( 'sample (heroes) web application' ) );
-    copyPolygeneApp( ctx, "Heroes", hasFeature( 'sample (heroes) web application' ) );
-    copyTemplate( ctx,
-                  'Heroes/web.tmpl',
-                  'app/src/main/webapp/WEB-INF/web.xml' );
+function copyHeroesSampleApp(ctx) {
+    copyPolygeneDomain(ctx, "heroes", "Heroes", "Hero", hasFeature('sample (heroes) web application'));
+    copyPolygeneApp(ctx, "Heroes", hasFeature('sample (heroes) web application'));
+    copyTemplate(ctx,
+        'Heroes/web.tmpl',
+        'app/src/main/webapp/WEB-INF/web.xml');
 }
 
-function copyTemplate( ctx, from, to )
-{
+function copyTemplate(ctx, from, to) {
     ctx.fs.copyTpl(
-        ctx.templatePath( from ),
-        ctx.destinationPath( to ),
+        ctx.templatePath(from),
+        ctx.destinationPath(to),
         {
-            packageName: polygene.packagename,
+            packageName: polygene.packageName,
             hasFeature: hasFeature,
             hasEntityStore: hasEntityStore,
             hasIndexing: hasIndexing,
             hasCaching: hasCaching,
+            firstUpper: firstUpper,
             polygene: polygene
         }
     );
 }
 
-function hasEntityStore( esType )
-{
+function hasEntityStore(esType) {
     return polygene.entitystore === esType;
 }
 
-function hasIndexing( indexingType )
-{
+function hasIndexing(indexingType) {
     return polygene.indexing === indexingType;
 }
 
-function hasCaching( cachingType )
-{
+function hasCaching(cachingType) {
     return polygene.caching === cachingType;
 }
 
-function hasSerialization( serializer )
-{
+function hasSerialization(serializer) {
     return polygene.serialization === serializer;
 }
 
-function hasFeature( feature )
-{
-    return polygene.features.indexOf( feature ) >= 0;
+function hasFeature(feature) {
+    return polygene.features.indexOf(feature) >= 0;
+}
+
+function firstUpper(text) {
+    return text.charAt(0).toUpperCase() + text.substring(1);
+}
+
+function importModel(ctx, filename) {
+    return JSON.parse(fs.readFileSync(filename, 'utf8'));
 }
 
-function firstUpper( text )
-{
-    return text.charAt( 0 ).toUpperCase() + text.substring( 1 );
+function exportModel(ctx, filename) {
+    delete polygene.current;
+    return fs.writeFileSync(filename, JSON.stringify(polygene, null, 4) + "\n", 'utf8');
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/46e02826/tools/generator-polygene/app/templates/CodahaleModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/CodahaleModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/CodahaleModule/bootstrap.tmpl
new file mode 100644
index 0000000..ec826a2
--- /dev/null
+++ b/tools/generator-polygene/app/templates/CodahaleModule/bootstrap.tmpl
@@ -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 <%= packageName %>.bootstrap.infrastructure;
+
+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;
+import org.apache.polygene.bootstrap.layered.ModuleAssembler;
+import org.apache.polygene.metrics.codehale.assembly.CodahaleMetricsAssembler;
+import org.apache.polygene.library.rdf.repository.NativeConfiguration;
+
+public class RdfIndexingModule
+    implements ModuleAssembler
+{
+    public static final String NAME = "Rdf Indexing Module";
+    private final ModuleAssembly configModule;
+
+    public RdfIndexingModule( ModuleAssembly configModule )
+    {
+        this.configModule = configModule;
+    }
+
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+        throws AssemblyException
+    {
+        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/46e02826/tools/generator-polygene/app/templates/DomainLayer/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/bootstrap.tmpl b/tools/generator-polygene/app/templates/DomainLayer/bootstrap.tmpl
index 4e917f0..517942a 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/bootstrap.tmpl
@@ -32,7 +32,9 @@ public class DomainLayer extends LayeredLayerAssembler
         throws AssemblyException
     {
         createModule( layer, CrudModule.class );
+<% if( hasFeature( 'rest api' ) ) { %>
         createModule( layer, SecurityModule.class );
+<% } %>
         return layer;
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/46e02826/tools/generator-polygene/app/templates/DomainModule/Crud.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainModule/Crud.tmpl b/tools/generator-polygene/app/templates/DomainModule/Crud.tmpl
new file mode 100644
index 0000000..95eed76
--- /dev/null
+++ b/tools/generator-polygene/app/templates/DomainModule/Crud.tmpl
@@ -0,0 +1,41 @@
+<%#
+ *  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 <%= packageName %>.model.<%= polygene.current.name %>;
+
+import org.apache.polygene.api.injection.scope.This;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.property.Property;
+
+@Mixins( { <%= polygene.current.clazz.name %>.Mixin.class } )
+public interface <%= polygene.current.clazz.name %>
+{
+    interface State
+    {
+        Property<String> name();     // Sample hidden property
+    }
+
+    class Mixin
+        implements <%= polygene.current.clazz.name %>
+    {
+        @This
+        private State state;        // Sample reference to hidden property
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/46e02826/tools/generator-polygene/app/templates/DomainModule/Entity.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainModule/Entity.tmpl b/tools/generator-polygene/app/templates/DomainModule/Entity.tmpl
new file mode 100644
index 0000000..9262cad
--- /dev/null
+++ b/tools/generator-polygene/app/templates/DomainModule/Entity.tmpl
@@ -0,0 +1,41 @@
+<%#
+ *  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 <%= packageName %>.model.<%= polygene.current.name %>;
+
+import org.apache.polygene.api.injection.scope.This
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.property.Property;
+
+@Mixins( { <%= polygene.current.clazz.name %>.Mixin } )
+public interface <%= polygene.current.clazz.name %>
+{
+    interface State
+    {
+        Property<String> name();     // Sample hidden property
+    }
+
+    class Mixin
+        implements <%= polygene.current.clazz.name %>
+    {
+        @This
+        private State state;        // Sample reference to hidden property
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/46e02826/tools/generator-polygene/app/templates/DomainModule/Object.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainModule/Object.tmpl b/tools/generator-polygene/app/templates/DomainModule/Object.tmpl
new file mode 100644
index 0000000..27d6119
--- /dev/null
+++ b/tools/generator-polygene/app/templates/DomainModule/Object.tmpl
@@ -0,0 +1,33 @@
+<%#
+ *  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 <%= packageName %>.model.<%= polygene.current.name %>;
+
+import org.apache.polygene.api.injection.scope.This
+import org.apache.polygene.api.mixin.Mixins;
+
+public class <%= polygene.current.clazz.name %>
+{
+    @Uses
+    private String name;   // Sample @Uses injection
+
+    @Structure
+    private ValueBuilderFactory vbf;  // Sample @Structure injection
+
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/46e02826/tools/generator-polygene/app/templates/DomainModule/Service.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainModule/Service.tmpl b/tools/generator-polygene/app/templates/DomainModule/Service.tmpl
new file mode 100644
index 0000000..0edefdc
--- /dev/null
+++ b/tools/generator-polygene/app/templates/DomainModule/Service.tmpl
@@ -0,0 +1,36 @@
+<%#
+ *  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 <%= packageName %>.model.<%= polygene.current.name %>;
+
+import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.value.ValueBuilderFactory;
+
+@Mixins( { <%= polygene.current.clazz.name %>.Mixin.class } )
+public interface <%= polygene.current.clazz.name %>
+{
+    class Mixin
+        implements <%= polygene.current.clazz.name %>
+    {
+        @Structure
+        private ValueBuilderFactory vbf;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/46e02826/tools/generator-polygene/app/templates/DomainModule/Value.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainModule/Value.tmpl b/tools/generator-polygene/app/templates/DomainModule/Value.tmpl
new file mode 100644
index 0000000..9262cad
--- /dev/null
+++ b/tools/generator-polygene/app/templates/DomainModule/Value.tmpl
@@ -0,0 +1,41 @@
+<%#
+ *  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 <%= packageName %>.model.<%= polygene.current.name %>;
+
+import org.apache.polygene.api.injection.scope.This
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.property.Property;
+
+@Mixins( { <%= polygene.current.clazz.name %>.Mixin } )
+public interface <%= polygene.current.clazz.name %>
+{
+    interface State
+    {
+        Property<String> name();     // Sample hidden property
+    }
+
+    class Mixin
+        implements <%= polygene.current.clazz.name %>
+    {
+        @This
+        private State state;        // Sample reference to hidden property
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/46e02826/tools/generator-polygene/app/templates/DomainModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/DomainModule/bootstrap.tmpl
new file mode 100644
index 0000000..54bc82d
--- /dev/null
+++ b/tools/generator-polygene/app/templates/DomainModule/bootstrap.tmpl
@@ -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 <%= packageName %>.bootstrap.domain;
+
+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;
+<% for( var idx in polygene.current.cruds) { %><%= "import " + packageName + ".model." + polygene.current.name + "." + polygene.current.cruds[idx].name + ";" %><% } %>
+<% for( var idx in polygene.current.values) { %><%= "import " + packageName + ".model." + polygene.current.name + "." + polygene.current.values[idx].name + ";" %><% } %>
+<% for( var idx in polygene.current.entities) { %><%= "import " + packageName + ".model." + polygene.current.name + "." + polygene.current.entities[idx].name + ";" %><% } %>
+<% for( var idx in polygene.current.transients) { %><%= "import " + packageName + ".model." + polygene.current.name + "." + polygene.current.transients[idx].name + ";" %><% } %>
+<% for( var idx in polygene.current.objects) { %><%= "import " + packageName + ".model." + polygene.current.name + "." + polygene.current.objects[idx].name + ";" %><% } %>
+<% for( var idx in polygene.current.services) { %><%= "import " + packageName + ".model." + polygene.current.name + "." + polygene.current.services[idx].name + ";" %><% } %>
+
+import static org.apache.polygene.api.common.Visibility.layer;
+import static org.apache.polygene.api.common.Visibility.application;
+
+public class <%- firstUpper(polygene.current.name) %>Module
+    implements ModuleAssembler
+{
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+        throws AssemblyException
+    {
+<% if( polygene.current.cruds ) { %>
+  <% for( var value in polygene.current.cruds ) { %>
+    <% var crud1 = polygene.current.cruds[value]; %>
+    module.values(<%-  crud1.name + ".class" %>)<% if( crud1.visibility ) {%><%-".visibleIn(" + crud1.visibility +")"%><% } %>;
+  <% } %>
+  <% for( var value in polygene.current.cruds ) { %>
+    <% var crud2 = polygene.current.cruds[value]; %>
+        module.entities(<%= crud2.name + ".class" %>)<% if( crud2.visibility ) {%><%-".visibleIn(" + crud2.visibility +")"%><% } %>;
+  <% } %>
+<% } %>
+<% if( polygene.current.values ) { %>
+  <% for( var value in polygene.current.values ) { %>
+    <% var v = polygene.current.current[value]; %>
+        module.values(<%= v.name + ".class" %>)<% if( v.visibility ) {%><%-".visibleIn(" + v.visibility +")"%><% } %>;
+  <% } %>
+<% } %>
+<% if( polygene.current.entities ) { %>
+  <% for( var value in polygene.current.entities ) { %>
+    <% var entity = polygene.current.entities[value]; %>
+        module.values(<%= entity.name + ".class" %>)<% if( entity.visibility ) {%><%-".visibleIn(" + entity.visibility +")"%><% } %>;
+  <% } %>
+<% } %>
+<% if( polygene.current.transients ) { %>
+  <% for( var value in polygene.current.transients ) { %>
+    <% var trans = polygene.current.transients[value]; %>
+        module.values(<%= trans.name + ".class" %>)<% if( trans.visibility ) {%><%-".visibleIn(" + trans.visibility +")"%><% } %>;
+  <% } %>
+<% } %>
+<% if( polygene.current.objects ) { %>
+  <% for( var value in polygene.current.objects ) { %>
+    <% var obj = polygene.current.objects[value]; %>
+        module.values(<%= obj.name + ".class" %>)<% if( obj.visibility ) {%><%-".visibleIn(" + obj.visibility +")"%><% } %>;
+  <% } %>
+<% } %>
+<% if( polygene.current.services ) { %>
+  <% for( var value in polygene.current.services ) { %>
+    <% var service = polygene.current.services[value]; %>
+        module.values(<%= service.name + ".class" %>)<% if( service.visibility ) {%><%-".visibleIn(" + service.visibility +")"%><% } %>;
+  <% } %>
+<% } %>
+        return module;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/46e02826/tools/generator-polygene/app/templates/SecurityModule/HardcodedSecurityRepositoryMixin.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/SecurityModule/HardcodedSecurityRepositoryMixin.tmpl b/tools/generator-polygene/app/templates/SecurityModule/HardcodedSecurityRepositoryMixin.tmpl
deleted file mode 100644
index 91c66e6..0000000
--- a/tools/generator-polygene/app/templates/SecurityModule/HardcodedSecurityRepositoryMixin.tmpl
+++ /dev/null
@@ -1,51 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
--%>
-package <%= packageName %>.model.security;
-
-import java.util.Collections;
-import java.util.List;
-import org.apache.polygene.api.unitofwork.concern.UnitOfWorkPropagation;
-
-public class HardcodedSecurityRepositoryMixin
-    implements SecurityRepository
-{
-
-    @Override
-    public boolean verifyPassword( String userName, String password )
-    {
-        if( userName.equals("admin") && password.equals("secret") )        {
-            return true;
-        }
-        if( userName.equals("user") && password.equals("123") )        {
-            return true;
-        }
-        return false;
-    }
-
-    @UnitOfWorkPropagation
-    public List<String> findRoleNamesOfUser( String name )
-    {
-        if( "admin".equals( name ) )
-        {
-            return Collections.singletonList("admin");
-        }
-        return Collections.singletonList("user");
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/46e02826/tools/generator-polygene/app/templates/SolrIndexingModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/SolrIndexingModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/SolrIndexingModule/bootstrap.tmpl
new file mode 100644
index 0000000..2644f78
--- /dev/null
+++ b/tools/generator-polygene/app/templates/SolrIndexingModule/bootstrap.tmpl
@@ -0,0 +1,49 @@
+<%#
+ *  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 <%= packageName %>.bootstrap.infrastructure;
+
+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;
+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 SolrIndexingModule
+    implements ModuleAssembler
+{
+    public static final String NAME = "Solr Indexing Module";
+    private final ModuleAssembly configModule;
+
+    public SolrIndexingModule( ModuleAssembly configModule )
+    {
+        this.configModule = configModule;
+    }
+
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+        throws AssemblyException
+    {
+        new SolrAssembler(Visibility.application, Visibility.module).assemble( module );
+        return module;
+    }
+}
+


[05/12] polygene-java git commit: POLYGENE-234 : Adding the use of Assemblers in Solr indexing

Posted by ni...@apache.org.
POLYGENE-234 : Adding the use of Assemblers in Solr indexing


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

Branch: refs/heads/develop
Commit: 32492c0f82738036da2636adcb8229c0ba934d2e
Parents: d9be964
Author: niclas <ni...@spicter.com>
Authored: Sun Mar 5 13:26:57 2017 +0800
Committer: niclas <ni...@spicter.com>
Committed: Sun Mar 5 13:26:57 2017 +0800

----------------------------------------------------------------------
 .../polygene/index/solr/SolrAssembler.java      | 49 --------------------
 .../index/solr/assembly/SolrAssembler.java      | 48 +++++++++++++++++++
 .../index/solr/SolrEntityFinderTest.java        |  1 +
 .../polygene/index/solr/SolrNamedQueryTest.java |  1 +
 .../index/solr/SolrQueryServiceTest.java        |  1 +
 .../polygene/index/solr/SolrQueryTest.java      |  1 +
 6 files changed, 52 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/32492c0f/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/SolrAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/SolrAssembler.java b/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/SolrAssembler.java
deleted file mode 100644
index 84d2a79..0000000
--- a/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/SolrAssembler.java
+++ /dev/null
@@ -1,49 +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.index.solr;
-
-import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.api.value.ValueSerialization;
-import org.apache.polygene.bootstrap.Assembler;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.library.rdf.entity.EntityStateSerializer;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationService;
-
-/**
- * JAVADOC
- */
-public class SolrAssembler
-   implements Assembler
-{
-    @Override
-   public void assemble( ModuleAssembly module ) throws AssemblyException
-   {
-      module.services( EmbeddedSolrService.class ).identifiedBy( "solr" ).instantiateOnStartup();
-
-      module.services( SolrQueryService.class ).
-            taggedWith( "solr", "search" ).
-            identifiedBy( "solrquery" ).
-            visibleIn( Visibility.application );
-      module.services( OrgJsonValueSerializationService.class ).taggedWith( ValueSerialization.Formats.JSON );
-      module.objects( EntityStateSerializer.class );
-   }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/32492c0f/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/assembly/SolrAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/assembly/SolrAssembler.java b/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/assembly/SolrAssembler.java
new file mode 100644
index 0000000..38b97e3
--- /dev/null
+++ b/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/assembly/SolrAssembler.java
@@ -0,0 +1,48 @@
+/*
+ *  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.index.solr.assembly;
+
+import org.apache.polygene.api.value.ValueSerialization;
+import org.apache.polygene.bootstrap.Assemblers;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.ServiceDeclaration;
+import org.apache.polygene.index.solr.EmbeddedSolrService;
+import org.apache.polygene.index.solr.SolrQueryService;
+import org.apache.polygene.library.rdf.entity.EntityStateSerializer;
+import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationService;
+
+public class SolrAssembler extends Assemblers.VisibilityIdentity
+{
+    @Override
+   public void assemble( ModuleAssembly module ) throws AssemblyException
+   {
+      module.services( EmbeddedSolrService.class ).identifiedBy( "solr" ).instantiateOnStartup();
+      ServiceDeclaration queryService = module.services( SolrQueryService.class );
+      queryService.
+            taggedWith( "solr", "search", "indexing", "query" ).
+            identifiedBy( identity() ).
+            visibleIn( visibility() ).
+            instantiateOnStartup();
+      module.services( OrgJsonValueSerializationService.class ).taggedWith( ValueSerialization.Formats.JSON );
+      module.objects( EntityStateSerializer.class );
+   }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/32492c0f/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrEntityFinderTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrEntityFinderTest.java b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrEntityFinderTest.java
index bc56528..d51ca13 100644
--- a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrEntityFinderTest.java
+++ b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrEntityFinderTest.java
@@ -21,6 +21,7 @@ package org.apache.polygene.index.solr;
 
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.index.solr.assembly.SolrAssembler;
 import org.apache.polygene.library.fileconfig.FileConfigurationAssembler;
 import org.apache.polygene.library.fileconfig.FileConfigurationOverride;
 import org.apache.polygene.test.indexing.AbstractEntityFinderTest;

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/32492c0f/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrNamedQueryTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrNamedQueryTest.java b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrNamedQueryTest.java
index eb3a9a0..fab66ac 100644
--- a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrNamedQueryTest.java
+++ b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrNamedQueryTest.java
@@ -23,6 +23,7 @@ import java.util.function.Predicate;
 import org.apache.polygene.api.composite.Composite;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.index.solr.assembly.SolrAssembler;
 import org.apache.polygene.library.fileconfig.FileConfigurationAssembler;
 import org.apache.polygene.library.fileconfig.FileConfigurationOverride;
 import org.apache.polygene.test.indexing.AbstractNamedQueryTest;

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/32492c0f/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryServiceTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryServiceTest.java b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryServiceTest.java
index f752eba..c5b06f9 100644
--- a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryServiceTest.java
+++ b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryServiceTest.java
@@ -21,6 +21,7 @@ package org.apache.polygene.index.solr;
 
 import java.util.ArrayList;
 import java.util.List;
+import org.apache.polygene.index.solr.assembly.SolrAssembler;
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.common.SolrDocument;
 import org.apache.solr.common.SolrDocumentList;

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/32492c0f/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryTest.java b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryTest.java
index 8f6d28a..376574c 100644
--- a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryTest.java
+++ b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryTest.java
@@ -21,6 +21,7 @@ package org.apache.polygene.index.solr;
 
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.index.solr.assembly.SolrAssembler;
 import org.apache.polygene.library.fileconfig.FileConfigurationAssembler;
 import org.apache.polygene.library.fileconfig.FileConfigurationOverride;
 import org.apache.polygene.test.indexing.AbstractQueryTest;


[12/12] polygene-java git commit: The Metrics dependencies are all messed up. Killed libry("metrics") and put the 3 classes into core api, moved the abstract testcases over to testsupport. And updated the documentation.

Posted by ni...@apache.org.
The Metrics dependencies are all messed up. Killed libry("metrics") and put the 3 classes into core api, moved the abstract testcases over to testsupport. And updated the documentation.


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

Branch: refs/heads/develop
Commit: 5b90154dd037bc17f3d6a8fd3012de3541a8b802
Parents: 46e0282
Author: niclas <ni...@spicter.com>
Authored: Sun Mar 5 23:38:58 2017 +0800
Committer: niclas <ni...@spicter.com>
Committed: Sun Mar 5 23:38:58 2017 +0800

----------------------------------------------------------------------
 core/api/src/docs/metrics.txt                   |  44 +++
 .../polygene/api/metrics/TimingCapture.java     |  37 ++
 .../api/metrics/TimingCaptureAllConcern.java    |  84 +++++
 .../api/metrics/TimingCaptureConcern.java       |  49 +++
 .../api/metrics/DocumentationSupport.java       |  56 +++
 core/testsupport/build.gradle                   |   1 +
 .../metrics/AbstractPolygeneMetricsTest.java    | 338 +++++++++++++++++++
 .../test/metrics/AbstractTimingCaptureTest.java | 149 ++++++++
 .../cassandra/EmptyCassandraTableMixin.java     |   2 +-
 extensions/metrics-codahale/build.gradle        |   1 -
 .../codahale/CodahaleMetricsAssembler.java      | 122 -------
 .../codahale/CodahaleMetricsDeclaration.java    |  36 --
 .../metrics/codahale/CodahaleMetricsMixin.java  |   9 +-
 .../assembly/CodahaleMetricsAssembler.java      | 124 +++++++
 .../assembly/CodahaleMetricsDeclaration.java    |  57 ++++
 .../metrics/codahale/CodahaleMetricsTest.java   |   2 +
 .../codahale/CodahaleTimingCaptureTest.java     |  61 ++++
 .../metrics/AbstractPolygeneMetricsTest.java    | 338 -------------------
 libraries/metrics/build.gradle                  |  36 --
 libraries/metrics/dev-status.xml                |  39 ---
 libraries/metrics/src/docs/metrics.txt          |  66 ----
 .../polygene/library/metrics/TimingCapture.java |  37 --
 .../metrics/TimingCaptureAllConcern.java        |  88 -----
 .../library/metrics/TimingCaptureConcern.java   |  50 ---
 .../polygene/library/metrics/package.html       |  24 --
 .../metrics/AbstractTimingCaptureTest.java      | 147 --------
 .../metrics/CodahaleTimingCaptureTest.java      |  59 ----
 .../library/metrics/DocumentationSupport.java   |  80 -----
 manual/src/docs/userguide/libraries.txt         |   4 -
 settings.gradle                                 |   1 -
 30 files changed, 1008 insertions(+), 1133 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/core/api/src/docs/metrics.txt
----------------------------------------------------------------------
diff --git a/core/api/src/docs/metrics.txt b/core/api/src/docs/metrics.txt
index 766ed3a..bac278d 100644
--- a/core/api/src/docs/metrics.txt
+++ b/core/api/src/docs/metrics.txt
@@ -105,3 +105,47 @@ regularly to report its status, which is then forwarded to the monitoring system
 source=core/api/src/test/java/org/apache/polygene/api/metrics/DocumentationSupport.java
 tag=healthcheck
 --------------
+
+
+= Timing Capture =
+A lot of metrics are around the time it takes to execute something and Polygene supports this at its core.
+
+== Usage ==
+There are currently the following possibilities available;
+
+    * @TimingCapture - capture timing on a single method
+    * TimingCaptureAll - capture timing on all methods of a composite
+
+Before looking at the details of these, we need to point out that there are some pre-conditions for Metrics to be
+working. First of all, you need to install a Metrics Extensions, most likely the
+<<extension-metrics-codahale, Codahale Metrics Extension>>. See your chosen extension for details on how to do that.
+
+Once the Metrics extension is installed, you will also need a suitable backend to gather all the data out of a
+production plant and likewise a good front-end to view this. See your chosen Metrics Extension for this as well.
+
+== TimingCaptureAll ==
+There is a TimingCaptureAllConcern, which when added to a composite will install a _Timer_ for every method call
+in the composite.
+
+== @TimingCapture ==
+The +@TimingCapture+ annotation can be placed on any method of the composite, to indicate that
+a Timer is wanted on that method.
+
+Example;
+
+[snippet,java]
+----
+source=core/spi/src/test/java/org/apache/polygene/api/metrics/DocumentationSupport.java
+tag=capture
+----
+
+== Which method? ==
+It is valid to annotate either the composite interface methods or the mixin implementation methods.
+Any of the method declarations should work. From the testcases we have the following example;
+
+[snippet,java]
+----
+source=libraries/metrics/src/test/java/org/apache/polygene/library/metrics/AbstractTimingCaptureTest.java
+tag=complex-capture
+----
+

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/core/api/src/main/java/org/apache/polygene/api/metrics/TimingCapture.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/metrics/TimingCapture.java b/core/api/src/main/java/org/apache/polygene/api/metrics/TimingCapture.java
new file mode 100644
index 0000000..8c9007a
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/metrics/TimingCapture.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.api.metrics;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import org.apache.polygene.api.injection.InjectionScope;
+
+@Retention( RetentionPolicy.RUNTIME )
+@Target( { ElementType.METHOD } )
+@Documented
+@InjectionScope
+public @interface TimingCapture
+{
+    String value() default "";
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/core/api/src/main/java/org/apache/polygene/api/metrics/TimingCaptureAllConcern.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/metrics/TimingCaptureAllConcern.java b/core/api/src/main/java/org/apache/polygene/api/metrics/TimingCaptureAllConcern.java
new file mode 100644
index 0000000..da11550
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/metrics/TimingCaptureAllConcern.java
@@ -0,0 +1,84 @@
+/*
+ *  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.api.metrics;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import org.apache.polygene.api.common.Optional;
+import org.apache.polygene.api.concern.ConcernOf;
+import org.apache.polygene.api.injection.scope.Invocation;
+import org.apache.polygene.api.injection.scope.Service;
+import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.structure.Module;
+
+public class TimingCaptureAllConcern extends ConcernOf<InvocationHandler>
+    implements InvocationHandler
+{
+    private final MetricsTimer timer;
+
+    public TimingCaptureAllConcern( @Structure Module module,
+                                    @Service @Optional MetricsProvider metrics,
+                                    @Invocation Method method
+    )
+    {
+        if( metrics == null )
+        {
+            timer = null;
+        }
+        else
+        {
+            MetricsTimerFactory factory = metrics.createFactory( MetricsTimerFactory.class );
+            TimingCapture capture = method.getAnnotation( TimingCapture.class );
+            String timerName;
+            if( capture == null || "".equals( capture.value() ) )
+            {
+                timerName = MetricNames.nameFor( module, method );
+            }
+            else
+            {
+                timerName = capture.value();
+            }
+            timer = factory.createTimer( timerName );
+        }
+    }
+
+    @Override
+    public Object invoke( Object proxy, Method method, Object[] args )
+        throws Throwable
+    {
+        MetricsTimer.Context timing = null;
+        if( timer != null )
+        {
+            timing = timer.start();
+        }
+        try
+        {
+            return next.invoke( proxy, method, args );
+        }
+        finally
+        {
+            if( timing != null )
+            {
+                timing.stop();
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/core/api/src/main/java/org/apache/polygene/api/metrics/TimingCaptureConcern.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/metrics/TimingCaptureConcern.java b/core/api/src/main/java/org/apache/polygene/api/metrics/TimingCaptureConcern.java
new file mode 100644
index 0000000..b94daea
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/metrics/TimingCaptureConcern.java
@@ -0,0 +1,49 @@
+/*
+ *  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.api.metrics;
+
+import java.lang.reflect.Method;
+import org.apache.polygene.api.common.AppliesTo;
+import org.apache.polygene.api.common.Optional;
+import org.apache.polygene.api.injection.scope.Invocation;
+import org.apache.polygene.api.injection.scope.Service;
+import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.structure.Module;
+
+@AppliesTo( TimingCapture.class )
+public class TimingCaptureConcern extends TimingCaptureAllConcern
+{
+
+    public TimingCaptureConcern( @Structure Module module,
+                                 @Service @Optional MetricsProvider metrics,
+                                 @Invocation Method method
+    )
+    {
+        super( module, metrics, method );
+    }
+
+    @Override
+    public Object invoke( Object proxy, Method method, Object[] args )
+        throws Throwable
+    {
+        return super.invoke( proxy, method, args );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/core/api/src/test/java/org/apache/polygene/api/metrics/DocumentationSupport.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/metrics/DocumentationSupport.java b/core/api/src/test/java/org/apache/polygene/api/metrics/DocumentationSupport.java
index 005a5d2..aaaa052 100644
--- a/core/api/src/test/java/org/apache/polygene/api/metrics/DocumentationSupport.java
+++ b/core/api/src/test/java/org/apache/polygene/api/metrics/DocumentationSupport.java
@@ -20,9 +20,13 @@
 
 package org.apache.polygene.api.metrics;
 
+import java.util.List;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.LinkedBlockingQueue;
 import org.apache.polygene.api.injection.scope.Service;
+import org.apache.polygene.bootstrap.Assembler;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
 
 public class DocumentationSupport
 {
@@ -105,4 +109,56 @@ public class DocumentationSupport
             return errorMessage.equals( "OK" );
         }
     }
+
+
+    // START SNIPPET: capture
+    public interface Router
+    {
+        @TimingCapture
+        List<Coordinate> route( String source, String destination );
+    }
+
+    public class RouterAlgorithm1
+        implements Router
+    {
+        @Override
+        public List<Coordinate> route( String source, String destination )
+        {
+// END SNIPPET: capture
+            return null;
+// START SNIPPET: capture
+        }
+    }
+
+    public class RouterAlgorithm2
+        implements Router
+    {
+        @Override
+        public List<Coordinate> route( String source, String destination )
+        {
+// END SNIPPET: capture
+            return null;
+// START SNIPPET: capture
+        }
+
+        // END SNIPPET: capture
+        public class MyAssembler implements Assembler
+        {
+            // START SNIPPET: capture
+            @Override
+            public void assemble( ModuleAssembly module )
+                throws AssemblyException
+            {
+                module.addServices( Router.class ).identifiedBy( "router1" ).withMixins( RouterAlgorithm1.class );
+                module.addServices( Router.class ).identifiedBy( "router2" ).withMixins( RouterAlgorithm2.class );
+// END SNIPPET: capture
+// START SNIPPET: capture
+            }
+        }
+    }
+// END SNIPPET: capture
+
+    public class Coordinate
+    {
+    }
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/core/testsupport/build.gradle
----------------------------------------------------------------------
diff --git a/core/testsupport/build.gradle b/core/testsupport/build.gradle
index dd05437..adfa425 100644
--- a/core/testsupport/build.gradle
+++ b/core/testsupport/build.gradle
@@ -25,6 +25,7 @@ jar { manifest { name = "Apache Polygene\u2122 Core Test Support" } }
 dependencies {
   api polygene.core.bootstrap
   api libraries.junit
+  api libraries.hamcrest
 
   testRuntimeOnly polygene.core.runtime
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/core/testsupport/src/main/java/org/apache/polygene/test/metrics/AbstractPolygeneMetricsTest.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/metrics/AbstractPolygeneMetricsTest.java b/core/testsupport/src/main/java/org/apache/polygene/test/metrics/AbstractPolygeneMetricsTest.java
new file mode 100644
index 0000000..98efb6a
--- /dev/null
+++ b/core/testsupport/src/main/java/org/apache/polygene/test/metrics/AbstractPolygeneMetricsTest.java
@@ -0,0 +1,338 @@
+/*
+ *  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.test.metrics;
+
+import java.util.Collection;
+import org.apache.polygene.api.activation.ActivationException;
+import org.apache.polygene.api.activation.PassivationException;
+import org.apache.polygene.api.association.ManyAssociation;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.concern.Concerns;
+import org.apache.polygene.api.entity.EntityBuilder;
+import org.apache.polygene.api.identity.Identity;
+import org.apache.polygene.api.identity.StringIdentity;
+import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.metrics.TimingCapture;
+import org.apache.polygene.api.metrics.TimingCaptureAllConcern;
+import org.apache.polygene.api.metrics.TimingCaptureConcern;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.service.ServiceActivation;
+import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.api.unitofwork.NoSuchEntityException;
+import org.apache.polygene.api.unitofwork.UnitOfWork;
+import org.apache.polygene.api.unitofwork.concern.UnitOfWorkConcern;
+import org.apache.polygene.api.unitofwork.concern.UnitOfWorkPropagation;
+import org.apache.polygene.bootstrap.ApplicationAssembly;
+import org.apache.polygene.bootstrap.Assembler;
+import org.apache.polygene.bootstrap.Assemblers;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.test.AbstractPolygeneBaseTest;
+import org.apache.polygene.test.EntityTestAssembler;
+import org.apache.polygene.test.util.JmxFixture;
+import org.junit.Test;
+
+import static java.util.stream.Collectors.toList;
+import static org.apache.polygene.api.unitofwork.concern.UnitOfWorkPropagation.Propagation.MANDATORY;
+import static org.apache.polygene.api.usecase.UsecaseBuilder.newUsecase;
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.hamcrest.core.IsNot.not;
+import static org.hamcrest.core.StringContains.containsString;
+import static org.hamcrest.collection.IsIterableContainingInOrder .contains;
+import static org.junit.Assert.assertThat;
+
+// TODO Test errors
+public abstract class AbstractPolygeneMetricsTest extends AbstractPolygeneBaseTest
+{
+    public interface Person
+    {
+        Property<String> name();
+    }
+
+    public interface PersonList
+    {
+        Identity LIST_ID = StringIdentity.fromString( "person-list" );
+
+        ManyAssociation<Person> all();
+    }
+
+    @Concerns( { TimingCaptureAllConcern.class, UnitOfWorkConcern.class} )
+    @Mixins( CommandsMixin.class )
+    public interface Commands extends ServiceActivation
+    {
+        @UnitOfWorkPropagation( MANDATORY )
+        Person create( Identity id, String name );
+
+        @UnitOfWorkPropagation( MANDATORY )
+        void rename( Identity id, String newName );
+
+        @UnitOfWorkPropagation( MANDATORY )
+        void delete( Identity id );
+    }
+
+    public static class CommandsMixin implements Commands
+    {
+        @Structure
+        private Module module;
+
+        @Override
+        public void activateService() throws Exception
+        {
+            try (UnitOfWork uow = module.unitOfWorkFactory().newUnitOfWork( newUsecase( "Init Person List" ) ) )
+            {
+                try
+                {
+                    uow.get( PersonList.class, PersonList.LIST_ID );
+                }
+                catch( NoSuchEntityException ex )
+                {
+                    uow.newEntity( PersonList.class, PersonList.LIST_ID );
+                    uow.complete();
+                }
+            }
+        }
+
+        @Override
+        public void passivateService()
+        {
+        }
+
+        @Override
+        public Person create( Identity id, String name )
+        {
+            UnitOfWork uow = module.unitOfWorkFactory().currentUnitOfWork();
+            PersonList list = uow.get( PersonList.class, PersonList.LIST_ID );
+            EntityBuilder<Person> builder = uow.newEntityBuilder( Person.class, id );
+            builder.instance().name().set( name );
+            Person person = builder.newInstance();
+            list.all().add( person );
+            return person;
+        }
+
+        @Override
+        public void rename( Identity id, String newName )
+        {
+            module.unitOfWorkFactory().currentUnitOfWork().get( Person.class, id ).name().set( newName );
+        }
+
+        @Override
+        public void delete( Identity id )
+        {
+            UnitOfWork uow = module.unitOfWorkFactory().currentUnitOfWork();
+            PersonList list = uow.get( PersonList.class, PersonList.LIST_ID );
+            Person person = uow.get( Person.class, id );
+            list.all().remove( person );
+            uow.remove( person );
+        }
+    }
+
+    @Concerns( { TimingCaptureConcern.class, UnitOfWorkConcern.class} )
+    @Mixins( QueriesMixin.class )
+    public interface Queries
+    {
+        @UnitOfWorkPropagation( MANDATORY )
+        Person byId( Identity id );
+
+        @TimingCapture
+        @UnitOfWorkPropagation( MANDATORY )
+        Iterable<Person> all();
+    }
+
+    public static class QueriesMixin implements Queries
+    {
+        @Structure
+        private Module module;
+
+        @Override
+        public Person byId( Identity id )
+        {
+            return module.unitOfWorkFactory().currentUnitOfWork().get( Person.class, id );
+        }
+
+        @Override
+        public Iterable<Person> all()
+        {
+            return module.unitOfWorkFactory().currentUnitOfWork()
+                    .get( PersonList.class, PersonList.LIST_ID )
+                    .all().toList();
+        }
+    }
+
+    @Override
+    protected final void defineApplication( ApplicationAssembly app ) throws AssemblyException
+    {
+        app.setName( "app" );
+
+        LayerAssembly domain = app.layer( "domain" );
+        ModuleAssembly model = domain.module( "model" );
+        model.entities( Person.class, PersonList.class )
+                .visibleIn( Visibility.layer );
+        ModuleAssembly services = domain.module( "services" );
+        services.services( Commands.class, Queries.class )
+                .instantiateOnStartup()
+                .visibleIn( Visibility.application );
+
+        LayerAssembly config = app.layer( "config" );
+        ModuleAssembly configModule = config.module( "config" );
+        new EntityTestAssembler()
+                .visibleIn( Visibility.module )
+                .assemble( configModule );
+
+        LayerAssembly infra = app.layer( "infra" );
+        ModuleAssembly storage = infra.module( "storage" );
+        entityStoreAssembler( configModule, Visibility.application )
+                .visibleIn( Visibility.application )
+                .assemble( storage );
+        metricsAssembler()
+                .visibleIn( Visibility.application )
+                .assemble( infra.module( "metrics" ) );
+
+        domain.uses( infra );
+        infra.uses( config );
+    }
+
+    protected Assemblers.Visible<? extends Assembler> entityStoreAssembler( ModuleAssembly configModule, Visibility configVisibility ) throws AssemblyException
+    {
+        return new EntityTestAssembler();
+    }
+
+    protected abstract Assemblers.Visible<? extends Assembler> metricsAssembler();
+
+    protected Module metricsModule()
+    {
+        return application.findModule( "infra", "metrics" );
+    }
+
+    protected static final String UOW_TIMER_NAME = "app.domain.services.UnitOfWork.timer";
+    protected static final String ALL_NAME = "app.domain.services.AbstractPolygeneMetricsTest.Queries.all";
+    protected static final String CREATE_NAME = "app.domain.services.AbstractPolygeneMetricsTest.Commands.create";
+    protected static final String RENAME_NAME = "app.domain.services.AbstractPolygeneMetricsTest.Commands.rename";
+    protected static final String DELETE_NAME = "app.domain.services.AbstractPolygeneMetricsTest.Commands.delete";
+
+    protected final void assertUowTimer( MetricValuesProvider metrics ) throws PassivationException, ActivationException
+    {
+        Long initialUowCount = metrics.timerCount( UOW_TIMER_NAME );
+        runScenario1();
+        assertThat( UOW_TIMER_NAME + " count incremented by 3", metrics.timerCount( UOW_TIMER_NAME ), is( initialUowCount + 3L ) );
+        application.passivate();
+        application.activate();
+        assertThat( UOW_TIMER_NAME + " count reset on passivation", metrics.timerCount( UOW_TIMER_NAME ), equalTo( initialUowCount ) );
+    }
+
+    protected final void assertTimingCapture( MetricValuesProvider metrics ) throws PassivationException, ActivationException
+    {
+        // Initial state
+        assertThat( ALL_NAME + " count is 0 at start", metrics.timerCount( ALL_NAME ), is( 0L ) );
+        assertThat( CREATE_NAME + " count is 0 at start", metrics.timerCount( CREATE_NAME ), is( 0L ) );
+        assertThat( RENAME_NAME + " count is 0 at start", metrics.timerCount( RENAME_NAME ), is( 0L ) );
+        assertThat( DELETE_NAME+ " count is 0 at start", metrics.timerCount( DELETE_NAME ), is( 0L ) );
+
+        // Run scenario
+        runScenario1();
+
+        // Queries.byId() timings are not captured
+        assertThat( "Queries.byId() has no timer", metrics.registeredMetricNames(), not( contains( containsString( "byId" ) ) ) );
+
+        // Captured timings
+        assertThat( ALL_NAME + " count is 4 after scenario", metrics.timerCount( ALL_NAME ), is( 4L ) );
+        assertThat( CREATE_NAME + " count is 1 after scenario", metrics.timerCount( CREATE_NAME ), is( 1L ) );
+        assertThat( RENAME_NAME + " count is 1 after scenario", metrics.timerCount( RENAME_NAME ), is( 1L ) );
+        assertThat( DELETE_NAME + " count is 1 after scenario", metrics.timerCount( DELETE_NAME ), is( 1L ) );
+
+        // Reset on passivation
+        application.passivate();
+        application.activate();
+        assertThat( ALL_NAME + " count is 0 after restart", metrics.timerCount( ALL_NAME ), is( 0L ) );
+        assertThat( CREATE_NAME + " count is 0 after restart", metrics.timerCount( CREATE_NAME ), is( 0L ) );
+        assertThat( RENAME_NAME + " count is 0 after restart", metrics.timerCount( RENAME_NAME ), is( 0L ) );
+        assertThat( DELETE_NAME + " count is 0 after restart", metrics.timerCount( DELETE_NAME ), is( 0L ) );
+    }
+
+    protected final void runScenario1()
+    {
+        Module services = application.findModule( "domain", "services" );
+        Commands commands = services.findService( Commands.class ).get();
+        Queries queries = services.findService( Queries.class ).get();
+
+        Identity identity = StringIdentity.fromString( "1" );
+
+        try (UnitOfWork uow = services.unitOfWorkFactory().newUnitOfWork( newUsecase( "Step 1" ) ) )
+        {
+            assertThat( queries.all().iterator().hasNext(), is( false ) );
+            assertThat( commands.create( identity, "Bob Geldof" ).name().get(), equalTo( "Bob Geldof" ) );
+            assertThat( queries.byId( identity ).name().get(), equalTo( "Bob Geldof" ) );
+            uow.complete();
+        }
+
+        try (UnitOfWork uow = services.unitOfWorkFactory().newUnitOfWork(newUsecase("Step 2")))
+        {
+            assertThat( queries.all().iterator().next().name().get(), equalTo( "Bob Geldof" ) );
+            assertThat( queries.byId( identity ).name().get(), equalTo( "Bob Geldof" ) );
+            commands.rename( identity, "Nina Hagen" );
+            assertThat( queries.all().iterator().next().name().get(), equalTo( "Nina Hagen" ) );
+            uow.complete();
+        }
+
+        try (UnitOfWork uow = services.unitOfWorkFactory().newUnitOfWork(newUsecase("Step 3")))
+        {
+            commands.delete( identity );
+            assertThat( queries.all().iterator().hasNext(), is( false ) );
+            uow.complete();
+        }
+    }
+
+    protected static class JmxMetricTestAdapter implements MetricValuesProvider
+    {
+        private final JmxFixture jmx = new JmxFixture( "metrics:name=" );
+
+        @Override
+        public long timerCount( String name )
+        {
+            if( jmx.objectExists( name ) ) {
+                return jmx.attributeValue( name, "Count", Long.class );
+            }
+            return 0L;
+        }
+
+        @Override
+        public Collection<String> registeredMetricNames()
+        {
+            return jmx.allObjectNames().stream()
+                    .filter( objName -> objName.startsWith( jmx.prefix() ) )
+                    .map( objName -> objName.substring( jmx.prefix().length() ) )
+                    .collect( toList() );
+        }
+    }
+
+    @Test
+    public void uowTimerJmx() throws PassivationException, ActivationException
+    {
+        assertUowTimer( new JmxMetricTestAdapter() );
+    }
+
+    @Test
+    public void timingCaptureJmx() throws PassivationException, ActivationException
+    {
+        assertTimingCapture( new JmxMetricTestAdapter() );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/core/testsupport/src/main/java/org/apache/polygene/test/metrics/AbstractTimingCaptureTest.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/metrics/AbstractTimingCaptureTest.java b/core/testsupport/src/main/java/org/apache/polygene/test/metrics/AbstractTimingCaptureTest.java
new file mode 100644
index 0000000..4b25622
--- /dev/null
+++ b/core/testsupport/src/main/java/org/apache/polygene/test/metrics/AbstractTimingCaptureTest.java
@@ -0,0 +1,149 @@
+/*
+ *  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.test.metrics;
+
+import org.apache.polygene.api.common.Optional;
+import org.apache.polygene.api.composite.TransientComposite;
+import org.apache.polygene.api.metrics.TimingCapture;
+import org.apache.polygene.api.metrics.TimingCaptureAllConcern;
+import org.apache.polygene.api.metrics.TimingCaptureConcern;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.bootstrap.Assembler;
+import org.apache.polygene.bootstrap.Assemblers;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.test.AbstractPolygeneTest;
+import org.junit.Test;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+public abstract class AbstractTimingCaptureTest extends AbstractPolygeneTest
+{
+
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        module.layer().application().setName( "SomeApplication" );
+        module.transients( Country1.class );
+        module.transients( Country2.class ).withConcerns( TimingCaptureAllConcern.class );
+        module.transients( Country3.class ).withConcerns( TimingCaptureConcern.class );
+        metricsAssembler().assemble( module );
+    }
+
+    protected abstract Assemblers.Visible<? extends Assembler> metricsAssembler();
+
+    protected abstract MetricValuesProvider metricValuesProvider();
+
+    @Test
+    public void givenNonInstrumentedCompositeExpectNoTimers()
+    {
+        Country underTest = transientBuilderFactory.newTransient( Country1.class );
+        updateName( underTest, 10 );
+        assertThat( metricValuesProvider().timerCount( "Layer 1.Module 1.AbstractTimingCaptureTest.Country.name" ), is( 0L ) );
+        assertThat( metricValuesProvider().timerCount( "Layer 1.Module 1.AbstractTimingCaptureTest.Country.updateName" ), is( 0L ) );
+    }
+
+    @Test
+    public void givenInstrumentedWithAllCompositeWhenCallingUpdateNameExpectTimers()
+    {
+        Country underTest = transientBuilderFactory.newTransient( Country2.class );
+        updateName( underTest, 10 );
+        assertThat( metricValuesProvider().timerCount( "Layer 1.Module 1.AbstractTimingCaptureTest.Country.name" ), is( 10L ) );
+        assertThat( metricValuesProvider().timerCount( "Layer 1.Module 1.AbstractTimingCaptureTest.Country.updateName" ), is( 10L ) );
+    }
+
+    @Test
+    public void givenOneMethodAnnotatedWhenCallingUpdateNameExpectTimerForThatMethodOnly()
+    {
+        Country underTest = transientBuilderFactory.newTransient( Country3.class );
+        updateName( underTest, 10 );
+        assertThat( metricValuesProvider().timerCount( "Layer 1.Module 1.AbstractTimingCaptureTest.Country.name" ), is( 0L ) );
+        assertThat( metricValuesProvider().timerCount( "Country3.updateName" ), is( 10L ) );
+    }
+
+    private void updateName( Country underTest, int times )
+    {
+        for( int i = 0; i < times; i++ )
+        {
+            underTest.updateName( "Name" + i );
+        }
+    }
+
+    // START SNIPPET: complex-capture
+    public interface Country extends TransientComposite
+    {
+        @Optional
+        Property<String> name();
+
+        void updateName( String newName );
+    }
+
+    @Mixins( Country1Mixin.class )
+    public interface Country1 extends Country
+    {
+    }
+
+    public static abstract class Country1Mixin
+        implements Country1
+    {
+        @Override
+        public void updateName( String newName )
+        {
+            name().set( newName );
+        }
+    }
+
+    @Mixins( Country2Mixin.class )
+    public interface Country2 extends Country
+    {
+    }
+
+    public static abstract class Country2Mixin
+        implements Country2
+    {
+        @Override
+        public void updateName( String newName )
+        {
+            name().set( newName );
+        }
+    }
+
+    @Mixins( Country3Mixin.class )
+    public interface Country3 extends Country
+    {
+        @TimingCapture( "Country3.updateName" )
+        @Override
+        void updateName( String newName );
+    }
+
+    public static abstract class Country3Mixin
+        implements Country3
+    {
+        @Override
+        public void updateName( String newName )
+        {
+            name().set( newName );
+        }
+    }
+    // END SNIPPET: complex-capture
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/extensions/entitystore-cassandra/src/test/java/org/apache/polygene/entitystore/cassandra/EmptyCassandraTableMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-cassandra/src/test/java/org/apache/polygene/entitystore/cassandra/EmptyCassandraTableMixin.java b/extensions/entitystore-cassandra/src/test/java/org/apache/polygene/entitystore/cassandra/EmptyCassandraTableMixin.java
index 4f16dd8..d7f9b99 100644
--- a/extensions/entitystore-cassandra/src/test/java/org/apache/polygene/entitystore/cassandra/EmptyCassandraTableMixin.java
+++ b/extensions/entitystore-cassandra/src/test/java/org/apache/polygene/entitystore/cassandra/EmptyCassandraTableMixin.java
@@ -33,6 +33,6 @@ public class EmptyCassandraTableMixin
     @Override
     public void removeAll()
     {
-        cluster.session().execute( "TRUNCATE TABLE " + cluster.tableName() + ";");
+        cluster.cassandraClientSession().execute( "TRUNCATE TABLE " + cluster.tableName() + ";");
     }
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/extensions/metrics-codahale/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/metrics-codahale/build.gradle b/extensions/metrics-codahale/build.gradle
index 2805c35..4b7fd20 100644
--- a/extensions/metrics-codahale/build.gradle
+++ b/extensions/metrics-codahale/build.gradle
@@ -32,7 +32,6 @@ dependencies {
 
   testImplementation polygene.core.testsupport
   testImplementation polygene.library( 'jmx' )
-  testImplementation polygene.library( 'metrics' )
 
   testRuntimeOnly libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/CodahaleMetricsAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/CodahaleMetricsAssembler.java b/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/CodahaleMetricsAssembler.java
deleted file mode 100644
index cbacce5..0000000
--- a/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/CodahaleMetricsAssembler.java
+++ /dev/null
@@ -1,122 +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.metrics.codahale;
-
-import com.codahale.metrics.ConsoleReporter;
-import com.codahale.metrics.CsvReporter;
-import com.codahale.metrics.MetricRegistry;
-import com.codahale.metrics.Reporter;
-import com.codahale.metrics.Slf4jReporter;
-import org.apache.polygene.bootstrap.Assemblers;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.ServiceDeclaration;
-
-import java.io.File;
-import java.io.PrintStream;
-import java.util.concurrent.TimeUnit;
-import java.util.function.Function;
-
-public class CodahaleMetricsAssembler
-    extends Assemblers.VisibilityIdentity<CodahaleMetricsAssembler>
-{
-    private final CodahaleMetricsDeclaration declaration = new CodahaleMetricsDeclaration();
-
-    public CodahaleMetricsAssembler withPrefix( String prefix )
-    {
-        declaration.prefix = prefix;
-        return this;
-    }
-
-    public CodahaleMetricsAssembler withFullyQualifiedClassNames()
-    {
-        declaration.fqcn = true;
-        return this;
-    }
-
-    public CodahaleMetricsAssembler withSimpleClassNames()
-    {
-        declaration.fqcn = false;
-        return this;
-    }
-
-    public CodahaleMetricsAssembler withJmx()
-    {
-        declaration.jmx = true;
-        return this;
-    }
-
-    public CodahaleMetricsAssembler withoutJmx()
-    {
-        declaration.jmx = false;
-        return this;
-    }
-
-    public CodahaleMetricsAssembler withConsoleReporter( PrintStream out, long period, TimeUnit timeunit )
-    {
-        declaration.reportersFactories.add( metricRegistry -> {
-            ConsoleReporter reporter = ConsoleReporter.forRegistry( metricRegistry ).outputTo( out ).build();
-            reporter.start( period, timeunit );
-            return reporter;
-        });
-        return this;
-    }
-
-    public CodahaleMetricsAssembler withSlf4jReporter( Slf4jReporter.LoggingLevel level, long period, TimeUnit timeunit )
-    {
-        declaration.reportersFactories.add( metricRegistry -> {
-            Slf4jReporter reporter = Slf4jReporter.forRegistry( metricRegistry ).withLoggingLevel( level ).build();
-            reporter.start( period, timeunit );
-            return reporter;
-        });
-        return this;
-    }
-
-    public CodahaleMetricsAssembler withCsvReporter( File outDirectory, long period, TimeUnit timeunit )
-    {
-        declaration.reportersFactories.add( metricRegistry -> {
-            CsvReporter reporter = CsvReporter.forRegistry( metricRegistry ).build( outDirectory );
-            reporter.start( period, timeunit );
-            return reporter;
-        });
-        return this;
-    }
-
-    public CodahaleMetricsAssembler withReporter( Function<MetricRegistry, Reporter> factory )
-    {
-        declaration.reportersFactories.add( factory );
-        return this;
-    }
-
-    @Override
-    public void assemble( ModuleAssembly module )
-            throws AssemblyException
-    {
-        ServiceDeclaration service = module.services( CodahaleMetricsProvider.class )
-                .setMetaInfo( declaration )
-                .instantiateOnStartup()
-                .visibleIn( visibility() );
-        if( hasIdentity() )
-        {
-            service.identifiedBy( identity() );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/CodahaleMetricsDeclaration.java
----------------------------------------------------------------------
diff --git a/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/CodahaleMetricsDeclaration.java b/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/CodahaleMetricsDeclaration.java
deleted file mode 100644
index e666214..0000000
--- a/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/CodahaleMetricsDeclaration.java
+++ /dev/null
@@ -1,36 +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.metrics.codahale;
-
-import com.codahale.metrics.MetricRegistry;
-import com.codahale.metrics.Reporter;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.function.Function;
-
-class CodahaleMetricsDeclaration
-{
-    String prefix;
-
-    boolean fqcn = false;
-
-    boolean jmx = true;
-
-    final List<Function<MetricRegistry, Reporter>> reportersFactories = new ArrayList<>();
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/CodahaleMetricsMixin.java
----------------------------------------------------------------------
diff --git a/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/CodahaleMetricsMixin.java b/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/CodahaleMetricsMixin.java
index bf6b274..5ccfdfd 100644
--- a/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/CodahaleMetricsMixin.java
+++ b/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/CodahaleMetricsMixin.java
@@ -42,6 +42,7 @@ import org.apache.polygene.api.metrics.MetricsTimer;
 import org.apache.polygene.api.metrics.MetricsTimerFactory;
 import org.apache.polygene.api.service.ServiceDescriptor;
 import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.metrics.codahale.assembly.CodahaleMetricsDeclaration;
 import org.apache.polygene.spi.metrics.MetricsProviderAdapter;
 
 import java.io.Closeable;
@@ -74,15 +75,15 @@ public class CodahaleMetricsMixin extends MetricsProviderAdapter
         metricRegistry = new MetricRegistry();
         healthCheckRegistry = new HealthCheckRegistry();
         CodahaleMetricsDeclaration declaration = descriptor.metaInfo( CodahaleMetricsDeclaration.class );
-        prefix = declaration.prefix != null ? declaration.prefix : app.name();
-        fqcn = declaration.fqcn;
-        if( declaration.jmx )
+        prefix = declaration.prefix() != null ? declaration.prefix() : app.name();
+        fqcn = declaration.fqcn();
+        if( declaration.jmx() )
         {
             JmxReporter jmxReporter = JmxReporter.forRegistry( metricRegistry ).build();
             jmxReporter.start();
             reporters.add( jmxReporter );
         }
-        for( Function<MetricRegistry, Reporter> reporterFactory : declaration.reportersFactories)
+        for( Function<MetricRegistry, Reporter> reporterFactory : declaration.reportersFactories())
         {
             reporters.add( reporterFactory.apply( metricRegistry ) );
         }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/assembly/CodahaleMetricsAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/assembly/CodahaleMetricsAssembler.java b/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/assembly/CodahaleMetricsAssembler.java
new file mode 100644
index 0000000..7e9b843
--- /dev/null
+++ b/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/assembly/CodahaleMetricsAssembler.java
@@ -0,0 +1,124 @@
+/*
+ *  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.metrics.codahale.assembly;
+
+import com.codahale.metrics.ConsoleReporter;
+import com.codahale.metrics.CsvReporter;
+import com.codahale.metrics.MetricRegistry;
+import com.codahale.metrics.Reporter;
+import com.codahale.metrics.Slf4jReporter;
+import java.io.File;
+import java.io.PrintStream;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Function;
+import org.apache.polygene.bootstrap.Assemblers;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.ServiceDeclaration;
+import org.apache.polygene.metrics.codahale.CodahaleMetricsProvider;
+
+public class CodahaleMetricsAssembler
+    extends Assemblers.VisibilityIdentity<CodahaleMetricsAssembler>
+{
+    private final CodahaleMetricsDeclaration declaration = new CodahaleMetricsDeclaration();
+
+    public CodahaleMetricsAssembler withPrefix( String prefix )
+    {
+        declaration.prefix = prefix;
+        return this;
+    }
+
+    public CodahaleMetricsAssembler withFullyQualifiedClassNames()
+    {
+        declaration.fqcn = true;
+        return this;
+    }
+
+    public CodahaleMetricsAssembler withSimpleClassNames()
+    {
+        declaration.fqcn = false;
+        return this;
+    }
+
+    public CodahaleMetricsAssembler withJmx()
+    {
+        declaration.jmx = true;
+        return this;
+    }
+
+    public CodahaleMetricsAssembler withoutJmx()
+    {
+        declaration.jmx = false;
+        return this;
+    }
+
+    public CodahaleMetricsAssembler withConsoleReporter( PrintStream out, long period, TimeUnit timeunit )
+    {
+        declaration.reportersFactories.add( metricRegistry -> {
+            ConsoleReporter reporter = ConsoleReporter.forRegistry( metricRegistry ).outputTo( out ).build();
+            reporter.start( period, timeunit );
+            return reporter;
+        });
+        return this;
+    }
+
+    public CodahaleMetricsAssembler withSlf4jReporter( Slf4jReporter.LoggingLevel level, long period, TimeUnit timeunit )
+    {
+        declaration.reportersFactories.add( metricRegistry -> {
+            Slf4jReporter reporter = Slf4jReporter.forRegistry( metricRegistry ).withLoggingLevel( level ).build();
+            reporter.start( period, timeunit );
+            return reporter;
+        });
+        return this;
+    }
+
+    public CodahaleMetricsAssembler withCsvReporter( File outDirectory, long period, TimeUnit timeunit )
+    {
+        declaration.reportersFactories.add( metricRegistry -> {
+            CsvReporter reporter = CsvReporter.forRegistry( metricRegistry ).build( outDirectory );
+            reporter.start( period, timeunit );
+            return reporter;
+        });
+        return this;
+    }
+
+    public CodahaleMetricsAssembler withReporter( Function<MetricRegistry, Reporter> factory )
+    {
+        declaration.reportersFactories.add( factory );
+        return this;
+    }
+
+    @Override
+    public void assemble( ModuleAssembly module )
+            throws AssemblyException
+    {
+        ServiceDeclaration service =
+            module.services( CodahaleMetricsProvider.class )
+                  .setMetaInfo( declaration )
+                  .instantiateOnStartup()
+                  .identifiedBy( identity() )
+                  .visibleIn( visibility() );
+        if( hasIdentity() )
+        {
+            service.identifiedBy( identity() );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/assembly/CodahaleMetricsDeclaration.java
----------------------------------------------------------------------
diff --git a/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/assembly/CodahaleMetricsDeclaration.java b/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/assembly/CodahaleMetricsDeclaration.java
new file mode 100644
index 0000000..0b5cdb6
--- /dev/null
+++ b/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/assembly/CodahaleMetricsDeclaration.java
@@ -0,0 +1,57 @@
+/*
+ *  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.metrics.codahale.assembly;
+
+import com.codahale.metrics.MetricRegistry;
+import com.codahale.metrics.Reporter;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.function.Function;
+
+public class CodahaleMetricsDeclaration
+{
+    String prefix;
+
+    boolean fqcn = false;
+
+    boolean jmx = true;
+
+    final List<Function<MetricRegistry, Reporter>> reportersFactories = new ArrayList<>();
+
+
+    public String prefix()
+    {
+        return prefix;
+    }
+
+    public boolean fqcn()
+    {
+        return fqcn;
+    }
+
+    public boolean jmx()
+    {
+        return jmx;
+    }
+
+    public List<Function<MetricRegistry, Reporter>> reportersFactories()
+    {
+        return reportersFactories;
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/extensions/metrics-codahale/src/test/java/org/apache/polygene/metrics/codahale/CodahaleMetricsTest.java
----------------------------------------------------------------------
diff --git a/extensions/metrics-codahale/src/test/java/org/apache/polygene/metrics/codahale/CodahaleMetricsTest.java b/extensions/metrics-codahale/src/test/java/org/apache/polygene/metrics/codahale/CodahaleMetricsTest.java
index 91044cf..35fa19b 100644
--- a/extensions/metrics-codahale/src/test/java/org/apache/polygene/metrics/codahale/CodahaleMetricsTest.java
+++ b/extensions/metrics-codahale/src/test/java/org/apache/polygene/metrics/codahale/CodahaleMetricsTest.java
@@ -23,7 +23,9 @@ import org.apache.polygene.api.activation.PassivationException;
 import org.apache.polygene.api.structure.Module;
 import org.apache.polygene.bootstrap.Assembler;
 import org.apache.polygene.bootstrap.Assemblers;
+import org.apache.polygene.metrics.codahale.assembly.CodahaleMetricsAssembler;
 import org.apache.polygene.test.metrics.AbstractPolygeneMetricsTest;
+
 import org.apache.polygene.test.metrics.MetricValuesProvider;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/extensions/metrics-codahale/src/test/java/org/apache/polygene/metrics/codahale/CodahaleTimingCaptureTest.java
----------------------------------------------------------------------
diff --git a/extensions/metrics-codahale/src/test/java/org/apache/polygene/metrics/codahale/CodahaleTimingCaptureTest.java b/extensions/metrics-codahale/src/test/java/org/apache/polygene/metrics/codahale/CodahaleTimingCaptureTest.java
new file mode 100644
index 0000000..fa88caa
--- /dev/null
+++ b/extensions/metrics-codahale/src/test/java/org/apache/polygene/metrics/codahale/CodahaleTimingCaptureTest.java
@@ -0,0 +1,61 @@
+/*
+ *  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.metrics.codahale;
+
+import com.codahale.metrics.MetricRegistry;
+import org.apache.polygene.bootstrap.Assembler;
+import org.apache.polygene.bootstrap.Assemblers;
+import org.apache.polygene.metrics.codahale.assembly.CodahaleMetricsAssembler;
+import org.apache.polygene.test.metrics.AbstractTimingCaptureTest;
+import org.apache.polygene.test.metrics.MetricValuesProvider;
+
+import java.util.Collection;
+
+import static org.apache.polygene.api.common.Visibility.application;
+
+public class CodahaleTimingCaptureTest extends AbstractTimingCaptureTest
+{
+    @Override
+    protected Assemblers.Visible<? extends Assembler> metricsAssembler()
+    {
+        return new CodahaleMetricsAssembler();
+    }
+
+    @Override
+    protected MetricValuesProvider metricValuesProvider()
+    {
+        CodahaleMetricsProvider metricsProvider = serviceFinder.findService( CodahaleMetricsProvider.class ).get();
+        MetricRegistry metricRegistry = metricsProvider.metricRegistry();
+        return new MetricValuesProvider()
+        {
+            @Override
+            public Collection<String> registeredMetricNames()
+            {
+                return metricRegistry.getNames();
+            }
+
+            @Override
+            public long timerCount( String timerName )
+            {
+                return metricRegistry.timer( application.name() + '.' + timerName ).getCount();
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/extensions/metrics-codahale/src/test/java/org/apache/polygene/test/metrics/AbstractPolygeneMetricsTest.java
----------------------------------------------------------------------
diff --git a/extensions/metrics-codahale/src/test/java/org/apache/polygene/test/metrics/AbstractPolygeneMetricsTest.java b/extensions/metrics-codahale/src/test/java/org/apache/polygene/test/metrics/AbstractPolygeneMetricsTest.java
deleted file mode 100644
index 9616f91..0000000
--- a/extensions/metrics-codahale/src/test/java/org/apache/polygene/test/metrics/AbstractPolygeneMetricsTest.java
+++ /dev/null
@@ -1,338 +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.test.metrics;
-
-import org.apache.polygene.api.activation.ActivationException;
-import org.apache.polygene.api.activation.PassivationException;
-import org.apache.polygene.api.association.ManyAssociation;
-import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.api.concern.Concerns;
-import org.apache.polygene.api.entity.EntityBuilder;
-import org.apache.polygene.api.identity.Identity;
-import org.apache.polygene.api.identity.StringIdentity;
-import org.apache.polygene.api.injection.scope.Structure;
-import org.apache.polygene.api.mixin.Mixins;
-import org.apache.polygene.api.property.Property;
-import org.apache.polygene.api.service.ServiceActivation;
-import org.apache.polygene.api.structure.Module;
-import org.apache.polygene.api.unitofwork.NoSuchEntityException;
-import org.apache.polygene.api.unitofwork.UnitOfWork;
-import org.apache.polygene.api.unitofwork.concern.UnitOfWorkConcern;
-import org.apache.polygene.api.unitofwork.concern.UnitOfWorkPropagation;
-import org.apache.polygene.bootstrap.ApplicationAssembly;
-import org.apache.polygene.bootstrap.Assembler;
-import org.apache.polygene.bootstrap.Assemblers;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.library.metrics.TimingCapture;
-import org.apache.polygene.library.metrics.TimingCaptureAllConcern;
-import org.apache.polygene.library.metrics.TimingCaptureConcern;
-import org.apache.polygene.test.AbstractPolygeneBaseTest;
-import org.apache.polygene.test.EntityTestAssembler;
-import org.apache.polygene.test.util.JmxFixture;
-import org.junit.Test;
-
-import java.util.Collection;
-
-import static java.util.stream.Collectors.toList;
-import static org.apache.polygene.api.unitofwork.concern.UnitOfWorkPropagation.Propagation.MANDATORY;
-import static org.apache.polygene.api.usecase.UsecaseBuilder.newUsecase;
-import static org.hamcrest.Matchers.contains;
-import static org.hamcrest.Matchers.containsString;
-import static org.hamcrest.Matchers.equalTo;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.not;
-import static org.junit.Assert.assertThat;
-
-// TODO Test errors
-public abstract class AbstractPolygeneMetricsTest extends AbstractPolygeneBaseTest
-{
-    public interface Person
-    {
-        Property<String> name();
-    }
-
-    public interface PersonList
-    {
-        Identity LIST_ID = StringIdentity.fromString( "person-list" );
-
-        ManyAssociation<Person> all();
-    }
-
-    @Concerns( {TimingCaptureAllConcern.class, UnitOfWorkConcern.class} )
-    @Mixins( CommandsMixin.class )
-    public interface Commands extends ServiceActivation
-    {
-        @UnitOfWorkPropagation( MANDATORY )
-        Person create( Identity id, String name );
-
-        @UnitOfWorkPropagation( MANDATORY )
-        void rename( Identity id, String newName );
-
-        @UnitOfWorkPropagation( MANDATORY )
-        void delete( Identity id );
-    }
-
-    public static class CommandsMixin implements Commands
-    {
-        @Structure
-        private Module module;
-
-        @Override
-        public void activateService() throws Exception
-        {
-            try (UnitOfWork uow = module.unitOfWorkFactory().newUnitOfWork( newUsecase( "Init Person List" ) ) )
-            {
-                try
-                {
-                    uow.get( PersonList.class, PersonList.LIST_ID );
-                }
-                catch( NoSuchEntityException ex )
-                {
-                    uow.newEntity( PersonList.class, PersonList.LIST_ID );
-                    uow.complete();
-                }
-            }
-        }
-
-        @Override
-        public void passivateService()
-        {
-        }
-
-        @Override
-        public Person create( Identity id, String name )
-        {
-            UnitOfWork uow = module.unitOfWorkFactory().currentUnitOfWork();
-            PersonList list = uow.get( PersonList.class, PersonList.LIST_ID );
-            EntityBuilder<Person> builder = uow.newEntityBuilder( Person.class, id );
-            builder.instance().name().set( name );
-            Person person = builder.newInstance();
-            list.all().add( person );
-            return person;
-        }
-
-        @Override
-        public void rename( Identity id, String newName )
-        {
-            module.unitOfWorkFactory().currentUnitOfWork().get( Person.class, id ).name().set( newName );
-        }
-
-        @Override
-        public void delete( Identity id )
-        {
-            UnitOfWork uow = module.unitOfWorkFactory().currentUnitOfWork();
-            PersonList list = uow.get( PersonList.class, PersonList.LIST_ID );
-            Person person = uow.get( Person.class, id );
-            list.all().remove( person );
-            uow.remove( person );
-        }
-    }
-
-    @Concerns( {TimingCaptureConcern.class, UnitOfWorkConcern.class} )
-    @Mixins( QueriesMixin.class )
-    public interface Queries
-    {
-        @UnitOfWorkPropagation( MANDATORY )
-        Person byId( Identity id );
-
-        @TimingCapture
-        @UnitOfWorkPropagation( MANDATORY )
-        Iterable<Person> all();
-    }
-
-    public static class QueriesMixin implements Queries
-    {
-        @Structure
-        private Module module;
-
-        @Override
-        public Person byId( Identity id )
-        {
-            return module.unitOfWorkFactory().currentUnitOfWork().get( Person.class, id );
-        }
-
-        @Override
-        public Iterable<Person> all()
-        {
-            return module.unitOfWorkFactory().currentUnitOfWork()
-                    .get( PersonList.class, PersonList.LIST_ID )
-                    .all().toList();
-        }
-    }
-
-    @Override
-    protected final void defineApplication( ApplicationAssembly app ) throws AssemblyException
-    {
-        app.setName( "app" );
-
-        LayerAssembly domain = app.layer( "domain" );
-        ModuleAssembly model = domain.module( "model" );
-        model.entities( Person.class, PersonList.class )
-                .visibleIn( Visibility.layer );
-        ModuleAssembly services = domain.module( "services" );
-        services.services( Commands.class, Queries.class )
-                .instantiateOnStartup()
-                .visibleIn( Visibility.application );
-
-        LayerAssembly config = app.layer( "config" );
-        ModuleAssembly configModule = config.module( "config" );
-        new EntityTestAssembler()
-                .visibleIn( Visibility.module )
-                .assemble( configModule );
-
-        LayerAssembly infra = app.layer( "infra" );
-        ModuleAssembly storage = infra.module( "storage" );
-        entityStoreAssembler( configModule, Visibility.application )
-                .visibleIn( Visibility.application )
-                .assemble( storage );
-        metricsAssembler()
-                .visibleIn( Visibility.application )
-                .assemble( infra.module( "metrics" ) );
-
-        domain.uses( infra );
-        infra.uses( config );
-    }
-
-    protected Assemblers.Visible<? extends Assembler> entityStoreAssembler( ModuleAssembly configModule, Visibility configVisibility ) throws AssemblyException
-    {
-        return new EntityTestAssembler();
-    }
-
-    protected abstract Assemblers.Visible<? extends Assembler> metricsAssembler();
-
-    protected Module metricsModule()
-    {
-        return application.findModule( "infra", "metrics" );
-    }
-
-    protected static final String UOW_TIMER_NAME = "app.domain.services.UnitOfWork.timer";
-    protected static final String ALL_NAME = "app.domain.services.AbstractPolygeneMetricsTest.Queries.all";
-    protected static final String CREATE_NAME = "app.domain.services.AbstractPolygeneMetricsTest.Commands.create";
-    protected static final String RENAME_NAME = "app.domain.services.AbstractPolygeneMetricsTest.Commands.rename";
-    protected static final String DELETE_NAME = "app.domain.services.AbstractPolygeneMetricsTest.Commands.delete";
-
-    protected final void assertUowTimer( MetricValuesProvider metrics ) throws PassivationException, ActivationException
-    {
-        Long initialUowCount = metrics.timerCount( UOW_TIMER_NAME );
-        runScenario1();
-        assertThat( UOW_TIMER_NAME + " count incremented by 3", metrics.timerCount( UOW_TIMER_NAME ), is( initialUowCount + 3L ) );
-        application.passivate();
-        application.activate();
-        assertThat( UOW_TIMER_NAME + " count reset on passivation", metrics.timerCount( UOW_TIMER_NAME ), equalTo( initialUowCount ) );
-    }
-
-    protected final void assertTimingCapture( MetricValuesProvider metrics ) throws PassivationException, ActivationException
-    {
-        // Initial state
-        assertThat( ALL_NAME + " count is 0 at start", metrics.timerCount( ALL_NAME ), is( 0L ) );
-        assertThat( CREATE_NAME + " count is 0 at start", metrics.timerCount( CREATE_NAME ), is( 0L ) );
-        assertThat( RENAME_NAME + " count is 0 at start", metrics.timerCount( RENAME_NAME ), is( 0L ) );
-        assertThat( DELETE_NAME+ " count is 0 at start", metrics.timerCount( DELETE_NAME ), is( 0L ) );
-
-        // Run scenario
-        runScenario1();
-
-        // Queries.byId() timings are not captured
-        assertThat( "Queries.byId() has no timer", metrics.registeredMetricNames(), not( contains( containsString( "byId" ) ) ) );
-
-        // Captured timings
-        assertThat( ALL_NAME + " count is 4 after scenario", metrics.timerCount( ALL_NAME ), is( 4L ) );
-        assertThat( CREATE_NAME + " count is 1 after scenario", metrics.timerCount( CREATE_NAME ), is( 1L ) );
-        assertThat( RENAME_NAME + " count is 1 after scenario", metrics.timerCount( RENAME_NAME ), is( 1L ) );
-        assertThat( DELETE_NAME + " count is 1 after scenario", metrics.timerCount( DELETE_NAME ), is( 1L ) );
-
-        // Reset on passivation
-        application.passivate();
-        application.activate();
-        assertThat( ALL_NAME + " count is 0 after restart", metrics.timerCount( ALL_NAME ), is( 0L ) );
-        assertThat( CREATE_NAME + " count is 0 after restart", metrics.timerCount( CREATE_NAME ), is( 0L ) );
-        assertThat( RENAME_NAME + " count is 0 after restart", metrics.timerCount( RENAME_NAME ), is( 0L ) );
-        assertThat( DELETE_NAME + " count is 0 after restart", metrics.timerCount( DELETE_NAME ), is( 0L ) );
-    }
-
-    protected final void runScenario1()
-    {
-        Module services = application.findModule( "domain", "services" );
-        Commands commands = services.findService( Commands.class ).get();
-        Queries queries = services.findService( Queries.class ).get();
-
-        Identity identity = StringIdentity.fromString( "1" );
-
-        try (UnitOfWork uow = services.unitOfWorkFactory().newUnitOfWork( newUsecase( "Step 1" ) ) )
-        {
-            assertThat( queries.all().iterator().hasNext(), is( false ) );
-            assertThat( commands.create( identity, "Bob Geldof" ).name().get(), equalTo( "Bob Geldof" ) );
-            assertThat( queries.byId( identity ).name().get(), equalTo( "Bob Geldof" ) );
-            uow.complete();
-        }
-
-        try (UnitOfWork uow = services.unitOfWorkFactory().newUnitOfWork(newUsecase("Step 2")))
-        {
-            assertThat( queries.all().iterator().next().name().get(), equalTo( "Bob Geldof" ) );
-            assertThat( queries.byId( identity ).name().get(), equalTo( "Bob Geldof" ) );
-            commands.rename( identity, "Nina Hagen" );
-            assertThat( queries.all().iterator().next().name().get(), equalTo( "Nina Hagen" ) );
-            uow.complete();
-        }
-
-        try (UnitOfWork uow = services.unitOfWorkFactory().newUnitOfWork(newUsecase("Step 3")))
-        {
-            commands.delete( identity );
-            assertThat( queries.all().iterator().hasNext(), is( false ) );
-            uow.complete();
-        }
-    }
-
-    protected static class JmxMetricTestAdapter implements MetricValuesProvider
-    {
-        private final JmxFixture jmx = new JmxFixture( "metrics:name=" );
-
-        @Override
-        public long timerCount( String name )
-        {
-            if( jmx.objectExists( name ) ) {
-                return jmx.attributeValue( name, "Count", Long.class );
-            }
-            return 0L;
-        }
-
-        @Override
-        public Collection<String> registeredMetricNames()
-        {
-            return jmx.allObjectNames().stream()
-                    .filter( objName -> objName.startsWith( jmx.prefix() ) )
-                    .map( objName -> objName.substring( jmx.prefix().length() ) )
-                    .collect( toList() );
-        }
-    }
-
-    @Test
-    public void uowTimerJmx() throws PassivationException, ActivationException
-    {
-        assertUowTimer( new JmxMetricTestAdapter() );
-    }
-
-    @Test
-    public void timingCaptureJmx() throws PassivationException, ActivationException
-    {
-        assertTimingCapture( new JmxMetricTestAdapter() );
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/libraries/metrics/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/metrics/build.gradle b/libraries/metrics/build.gradle
deleted file mode 100644
index 5c52590..0000000
--- a/libraries/metrics/build.gradle
+++ /dev/null
@@ -1,36 +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.
- *
- *
- */
-
-apply plugin: 'polygene-library'
-
-description = "Apache Polygene\u2122 Metrics Library."
-
-jar { manifest { name = "Apache Polygene\u2122 Library - Metrics" } }
-
-dependencies {
-  api polygene.core.bootstrap
-
-  runtimeOnly polygene.core.runtime
-
-  testImplementation polygene.core.testsupport
-  testImplementation polygene.extension( 'metrics-codahale' )
-
-  testRuntimeOnly libraries.logback
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/libraries/metrics/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/metrics/dev-status.xml b/libraries/metrics/dev-status.xml
deleted file mode 100644
index aeeb8e4..0000000
--- a/libraries/metrics/dev-status.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
-  ~  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.
-  ~
-  ~
-  -->
-
-<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
-        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
-        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
-  <status>
-    <!--none,early,beta,stable,mature-->
-    <codebase>beta</codebase>
-
-    <!-- none, brief, good, complete -->
-    <documentation>brief</documentation>
-
-    <!-- none, some, good, complete -->
-    <unittests>some</unittests>
-  </status>
-  <licenses>
-    <license>ALv2</license>
-  </licenses>
-</module>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/libraries/metrics/src/docs/metrics.txt
----------------------------------------------------------------------
diff --git a/libraries/metrics/src/docs/metrics.txt b/libraries/metrics/src/docs/metrics.txt
deleted file mode 100644
index d4b0f57..0000000
--- a/libraries/metrics/src/docs/metrics.txt
+++ /dev/null
@@ -1,66 +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.
-//////////////////////
-
-[[library-metrics,Metrics Library]]
-= Metrics Library =
-
-The Metrics library is available to application code to get production metrics from their applications. It allows
-applications to easily mark critical section for metrics gathering, without handling the details with the Metrics
-Extension.
-
-include::../../build/docs/buildinfo/artifact.txt[]
-
-== Usage ==
-There are currently the following possibilities available;
-
-    * @TimingCapture - capture timing on a single method
-    * TimingCaptureAll - capture timing on all methods of a composite
-
-Before looking at the details of these, we need to point out that there are some pre-conditions for Metrics to be
-working. First of all, you need to install a Metrics Extensions, most likely the
-<<extension-metrics-codahale, Codahale Metrics Extension>>. See your chosen extension for details on how to do that.
-
-Once the Metrics extension is installed, you will also need a suitable backend to gather all the data out of a
-production plant and likewise a good front-end to view this. See your chosen Metrics Extension for this as well.
-
-== TimingCaptureAll ==
-There is a TimingCaptureAllConcern, which when added to a composite will install a _Timer_ for every method call
-in the composite.
-
-== @TimingCapture ==
-The +@TimingCapture+ annotation can be placed on any method of the composite, to indicate that
-a Timer is wanted on that method.
-
-Example;
-
-[snippet,java]
-----
-source=libraries/metrics/src/test/java/org/apache/polygene/library/metrics/DocumentationSupport.java
-tag=capture
-----
-
-== Which method? ==
-It is valid to annotate either the composite interface methods or the mixin implementation methods.
-Any of the method declarations should work. From the testcases we have the following example;
-
-[snippet,java]
-----
-source=libraries/metrics/src/test/java/org/apache/polygene/library/metrics/AbstractTimingCaptureTest.java
-tag=complex-capture
-----
-

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/libraries/metrics/src/main/java/org/apache/polygene/library/metrics/TimingCapture.java
----------------------------------------------------------------------
diff --git a/libraries/metrics/src/main/java/org/apache/polygene/library/metrics/TimingCapture.java b/libraries/metrics/src/main/java/org/apache/polygene/library/metrics/TimingCapture.java
deleted file mode 100644
index 1938afc..0000000
--- a/libraries/metrics/src/main/java/org/apache/polygene/library/metrics/TimingCapture.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.metrics;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import org.apache.polygene.api.injection.InjectionScope;
-
-@Retention( RetentionPolicy.RUNTIME )
-@Target( { ElementType.METHOD } )
-@Documented
-@InjectionScope
-public @interface TimingCapture
-{
-    String value() default "";
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/libraries/metrics/src/main/java/org/apache/polygene/library/metrics/TimingCaptureAllConcern.java
----------------------------------------------------------------------
diff --git a/libraries/metrics/src/main/java/org/apache/polygene/library/metrics/TimingCaptureAllConcern.java b/libraries/metrics/src/main/java/org/apache/polygene/library/metrics/TimingCaptureAllConcern.java
deleted file mode 100644
index fd0ff13..0000000
--- a/libraries/metrics/src/main/java/org/apache/polygene/library/metrics/TimingCaptureAllConcern.java
+++ /dev/null
@@ -1,88 +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.metrics;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import org.apache.polygene.api.common.Optional;
-import org.apache.polygene.api.concern.ConcernOf;
-import org.apache.polygene.api.injection.scope.Invocation;
-import org.apache.polygene.api.injection.scope.Service;
-import org.apache.polygene.api.injection.scope.Structure;
-import org.apache.polygene.api.metrics.MetricNames;
-import org.apache.polygene.api.metrics.MetricsProvider;
-import org.apache.polygene.api.metrics.MetricsTimer;
-import org.apache.polygene.api.metrics.MetricsTimerFactory;
-import org.apache.polygene.api.structure.Module;
-
-public class TimingCaptureAllConcern extends ConcernOf<InvocationHandler>
-    implements InvocationHandler
-{
-    private final MetricsTimer timer;
-
-    public TimingCaptureAllConcern( @Structure Module module,
-                                    @Service @Optional MetricsProvider metrics,
-                                    @Invocation Method method
-    )
-    {
-        if( metrics == null )
-        {
-            timer = null;
-        }
-        else
-        {
-            MetricsTimerFactory factory = metrics.createFactory( MetricsTimerFactory.class );
-            TimingCapture capture = method.getAnnotation( TimingCapture.class );
-            String timerName;
-            if( capture == null || "".equals( capture.value() ) )
-            {
-                timerName = MetricNames.nameFor( module, method );
-            }
-            else
-            {
-                timerName = capture.value();
-            }
-            timer = factory.createTimer( timerName );
-        }
-    }
-
-    @Override
-    public Object invoke( Object proxy, Method method, Object[] args )
-        throws Throwable
-    {
-        MetricsTimer.Context timing = null;
-        if( timer != null )
-        {
-            timing = timer.start();
-        }
-        try
-        {
-            return next.invoke( proxy, method, args );
-        }
-        finally
-        {
-            if( timing != null )
-            {
-                timing.stop();
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/libraries/metrics/src/main/java/org/apache/polygene/library/metrics/TimingCaptureConcern.java
----------------------------------------------------------------------
diff --git a/libraries/metrics/src/main/java/org/apache/polygene/library/metrics/TimingCaptureConcern.java b/libraries/metrics/src/main/java/org/apache/polygene/library/metrics/TimingCaptureConcern.java
deleted file mode 100644
index e5bf2d7..0000000
--- a/libraries/metrics/src/main/java/org/apache/polygene/library/metrics/TimingCaptureConcern.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.metrics;
-
-import java.lang.reflect.Method;
-import org.apache.polygene.api.common.AppliesTo;
-import org.apache.polygene.api.common.Optional;
-import org.apache.polygene.api.injection.scope.Invocation;
-import org.apache.polygene.api.injection.scope.Service;
-import org.apache.polygene.api.injection.scope.Structure;
-import org.apache.polygene.api.metrics.MetricsProvider;
-import org.apache.polygene.api.structure.Module;
-
-@AppliesTo( TimingCapture.class )
-public class TimingCaptureConcern extends TimingCaptureAllConcern
-{
-
-    public TimingCaptureConcern( @Structure Module module,
-                                 @Service @Optional MetricsProvider metrics,
-                                 @Invocation Method method
-    )
-    {
-        super( module, metrics, method );
-    }
-
-    @Override
-    public Object invoke( Object proxy, Method method, Object[] args )
-        throws Throwable
-    {
-        return super.invoke( proxy, method, args );
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/libraries/metrics/src/main/java/org/apache/polygene/library/metrics/package.html
----------------------------------------------------------------------
diff --git a/libraries/metrics/src/main/java/org/apache/polygene/library/metrics/package.html b/libraries/metrics/src/main/java/org/apache/polygene/library/metrics/package.html
deleted file mode 100644
index 4db8768..0000000
--- a/libraries/metrics/src/main/java/org/apache/polygene/library/metrics/package.html
+++ /dev/null
@@ -1,24 +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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Metrics Library.</h2>
-    </body>
-</html>
\ No newline at end of file


[03/12] polygene-java git commit: POLYGENE-234 : Adding a default name to services.

Posted by ni...@apache.org.
POLYGENE-234 : Adding a default name to services.


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

Branch: refs/heads/develop
Commit: 6c5f98655233a66a981accbb09314eb6f0076162
Parents: 3364190
Author: niclas <ni...@spicter.com>
Authored: Sun Mar 5 13:21:11 2017 +0800
Committer: niclas <ni...@spicter.com>
Committed: Sun Mar 5 13:21:11 2017 +0800

----------------------------------------------------------------------
 .../apache/polygene/runtime/bootstrap/ServiceDeclarationImpl.java | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/6c5f9865/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ServiceDeclarationImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ServiceDeclarationImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ServiceDeclarationImpl.java
index 9fe0cb0..45dfc74 100644
--- a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ServiceDeclarationImpl.java
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ServiceDeclarationImpl.java
@@ -58,6 +58,9 @@ public final class ServiceDeclarationImpl
     {
         for( ServiceAssemblyImpl serviceAssembly : serviceAssemblies )
         {
+            if( identity == null ) {
+                identity = serviceAssembly.types.get(0).getName();
+            }
             serviceAssembly.identity = new StringIdentity( identity );
         }
         return this;


[04/12] polygene-java git commit: POLYGENE-234 : Realized that there used to be some type of default before. Just need to stop 'null' to propagate from assemblers.

Posted by ni...@apache.org.
POLYGENE-234 : Realized that there used to be some type of default before. Just need to stop 'null' to propagate from assemblers.


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

Branch: refs/heads/develop
Commit: d9be964c4a0db2fc6be6ef53d811352dbbb38359
Parents: 6c5f986
Author: niclas <ni...@spicter.com>
Authored: Sun Mar 5 13:25:35 2017 +0800
Committer: niclas <ni...@spicter.com>
Committed: Sun Mar 5 13:25:35 2017 +0800

----------------------------------------------------------------------
 .../polygene/runtime/bootstrap/ServiceDeclarationImpl.java      | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/d9be964c/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ServiceDeclarationImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ServiceDeclarationImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ServiceDeclarationImpl.java
index 45dfc74..7740d37 100644
--- a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ServiceDeclarationImpl.java
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ServiceDeclarationImpl.java
@@ -58,10 +58,9 @@ public final class ServiceDeclarationImpl
     {
         for( ServiceAssemblyImpl serviceAssembly : serviceAssemblies )
         {
-            if( identity == null ) {
-                identity = serviceAssembly.types.get(0).getName();
+            if( identity != null ) {
+                serviceAssembly.identity = new StringIdentity( identity );
             }
-            serviceAssembly.identity = new StringIdentity( identity );
         }
         return this;
     }


[11/12] polygene-java git commit: The Metrics dependencies are all messed up. Killed libry("metrics") and put the 3 classes into core api, moved the abstract testcases over to testsupport. And updated the documentation.

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/AbstractTimingCaptureTest.java
----------------------------------------------------------------------
diff --git a/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/AbstractTimingCaptureTest.java b/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/AbstractTimingCaptureTest.java
deleted file mode 100644
index 8e28370..0000000
--- a/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/AbstractTimingCaptureTest.java
+++ /dev/null
@@ -1,147 +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.metrics;
-
-import org.apache.polygene.api.common.Optional;
-import org.apache.polygene.api.composite.TransientComposite;
-import org.apache.polygene.api.mixin.Mixins;
-import org.apache.polygene.api.property.Property;
-import org.apache.polygene.bootstrap.Assembler;
-import org.apache.polygene.bootstrap.Assemblers;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
-import org.apache.polygene.test.metrics.MetricValuesProvider;
-import org.junit.Test;
-
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-
-abstract class AbstractTimingCaptureTest extends AbstractPolygeneTest
-{
-
-    @Override
-    public void assemble( ModuleAssembly module )
-            throws AssemblyException
-    {
-        module.layer().application().setName( "SomeApplication" );
-        module.transients( Country1.class );
-        module.transients( Country2.class ).withConcerns( TimingCaptureAllConcern.class );
-        module.transients( Country3.class ).withConcerns( TimingCaptureConcern.class );
-        metricsAssembler().assemble( module );
-    }
-
-    protected abstract Assemblers.Visible<? extends Assembler> metricsAssembler();
-
-    protected abstract MetricValuesProvider metricValuesProvider();
-
-    @Test
-    public void givenNonInstrumentedCompositeExpectNoTimers()
-    {
-        Country underTest = transientBuilderFactory.newTransient( Country1.class );
-        updateName( underTest, 10 );
-        assertThat( metricValuesProvider().timerCount( "Layer 1.Module 1.AbstractTimingCaptureTest.Country.name" ), is( 0L ) );
-        assertThat( metricValuesProvider().timerCount( "Layer 1.Module 1.AbstractTimingCaptureTest.Country.updateName" ), is( 0L ) );
-    }
-
-    @Test
-    public void givenInstrumentedWithAllCompositeWhenCallingUpdateNameExpectTimers()
-    {
-        Country underTest = transientBuilderFactory.newTransient( Country2.class );
-        updateName( underTest, 10 );
-        assertThat( metricValuesProvider().timerCount( "Layer 1.Module 1.AbstractTimingCaptureTest.Country.name" ), is( 10L ) );
-        assertThat( metricValuesProvider().timerCount( "Layer 1.Module 1.AbstractTimingCaptureTest.Country.updateName" ), is( 10L ) );
-    }
-
-    @Test
-    public void givenOneMethodAnnotatedWhenCallingUpdateNameExpectTimerForThatMethodOnly()
-    {
-        Country underTest = transientBuilderFactory.newTransient( Country3.class );
-        updateName( underTest, 10 );
-        assertThat( metricValuesProvider().timerCount( "Layer 1.Module 1.AbstractTimingCaptureTest.Country.name" ), is( 0L ) );
-        assertThat( metricValuesProvider().timerCount( "Country3.updateName" ), is( 10L ) );
-    }
-
-    private void updateName( Country underTest, int times )
-    {
-        for( int i = 0; i < times; i++ )
-        {
-            underTest.updateName( "Name" + i );
-        }
-    }
-
-    // START SNIPPET: complex-capture
-    public interface Country extends TransientComposite
-    {
-        @Optional
-        Property<String> name();
-
-        void updateName( String newName );
-    }
-
-    @Mixins( Country1Mixin.class )
-    public interface Country1 extends Country
-    {
-    }
-
-    public static abstract class Country1Mixin
-            implements Country1
-    {
-        @Override
-        public void updateName( String newName )
-        {
-            name().set( newName );
-        }
-    }
-
-    @Mixins( Country2Mixin.class )
-    public interface Country2 extends Country
-    {
-    }
-
-    public static abstract class Country2Mixin
-            implements Country2
-    {
-        @Override
-        public void updateName( String newName )
-        {
-            name().set( newName );
-        }
-    }
-
-    @Mixins( Country3Mixin.class )
-    public interface Country3 extends Country
-    {
-        @TimingCapture( "Country3.updateName" )
-        @Override
-        void updateName(String newName);
-    }
-
-    public static abstract class Country3Mixin
-            implements Country3
-    {
-        @Override
-        public void updateName( String newName )
-        {
-            name().set( newName );
-        }
-    }
-    // END SNIPPET: complex-capture
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/CodahaleTimingCaptureTest.java
----------------------------------------------------------------------
diff --git a/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/CodahaleTimingCaptureTest.java b/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/CodahaleTimingCaptureTest.java
deleted file mode 100644
index 9fcd003..0000000
--- a/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/CodahaleTimingCaptureTest.java
+++ /dev/null
@@ -1,59 +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.metrics;
-
-import com.codahale.metrics.MetricRegistry;
-import org.apache.polygene.bootstrap.Assembler;
-import org.apache.polygene.bootstrap.Assemblers;
-import org.apache.polygene.metrics.codahale.CodahaleMetricsAssembler;
-import org.apache.polygene.metrics.codahale.CodahaleMetricsProvider;
-import org.apache.polygene.test.metrics.MetricValuesProvider;
-
-import java.util.Collection;
-
-public class CodahaleTimingCaptureTest extends AbstractTimingCaptureTest
-{
-    @Override
-    protected Assemblers.Visible<? extends Assembler> metricsAssembler()
-    {
-        return new CodahaleMetricsAssembler();
-    }
-
-    @Override
-    protected MetricValuesProvider metricValuesProvider()
-    {
-        CodahaleMetricsProvider metricsProvider = serviceFinder.findService( CodahaleMetricsProvider.class ).get();
-        MetricRegistry metricRegistry = metricsProvider.metricRegistry();
-        return new MetricValuesProvider()
-        {
-            @Override
-            public Collection<String> registeredMetricNames()
-            {
-                return metricRegistry.getNames();
-            }
-
-            @Override
-            public long timerCount( String timerName )
-            {
-                return metricRegistry.timer( application.name() + '.' + timerName ).getCount();
-            }
-        };
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/DocumentationSupport.java
----------------------------------------------------------------------
diff --git a/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/DocumentationSupport.java b/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/DocumentationSupport.java
deleted file mode 100644
index 0297906..0000000
--- a/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/DocumentationSupport.java
+++ /dev/null
@@ -1,80 +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.metrics;
-
-
-import java.util.List;
-import org.apache.polygene.bootstrap.Assembler;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-
-public class DocumentationSupport
-{
-// START SNIPPET: capture
-    public interface Router
-    {
-        @TimingCapture
-        List<Coordinate> route( String source, String destination );
-    }
-
-    public class RouterAlgorithm1
-        implements Router
-    {
-        @Override
-        public List<Coordinate> route( String source, String destination )
-        {
-// END SNIPPET: capture
-            return null;
-// START SNIPPET: capture
-        }
-    }
-
-    public class RouterAlgorithm2
-        implements Router
-    {
-        @Override
-        public List<Coordinate> route( String source, String destination )
-        {
-// END SNIPPET: capture
-            return null;
-// START SNIPPET: capture
-        }
-
-// END SNIPPET: capture
-        public class MyAssembler implements Assembler
-        {
-// START SNIPPET: capture
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.addServices( Router.class ).identifiedBy( "router1" ).withMixins( RouterAlgorithm1.class );
-                module.addServices( Router.class ).identifiedBy( "router2" ).withMixins( RouterAlgorithm2.class );
-// END SNIPPET: capture
-// START SNIPPET: capture
-            }
-        }
-    }
-// END SNIPPET: capture
-
-    public class Coordinate
-    {
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/manual/src/docs/userguide/libraries.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/userguide/libraries.txt b/manual/src/docs/userguide/libraries.txt
index 737c1a1..585ab3f 100644
--- a/manual/src/docs/userguide/libraries.txt
+++ b/manual/src/docs/userguide/libraries.txt
@@ -75,10 +75,6 @@ include::../../../../libraries/logging/src/docs/logging.txt[]
 
 :leveloffset: 2
 
-include::../../../../libraries/metrics/src/docs/metrics.txt[]
-
-:leveloffset: 2
-
 include::../../../../libraries/osgi/src/docs/osgi.txt[]
 
 :leveloffset: 2

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/settings.gradle
----------------------------------------------------------------------
diff --git a/settings.gradle b/settings.gradle
index 67ec7c4..a982fbb 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -36,7 +36,6 @@ include 'core:api',
         'libraries:jmx',
         'libraries:locking',
         'libraries:logging',
-        'libraries:metrics',
         'libraries:osgi',
         'libraries:rdf',
         'libraries:rest',