polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paulmer...@apache.org
Subject [08/19] polygene-java git commit: Serialization 3 step 1
Date Fri, 03 Feb 2017 07:58:09 GMT
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/DatabaseSQLStringsBuilder.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/DatabaseSQLStringsBuilder.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/DatabaseSQLStringsBuilder.java
index f75ba5a..6fb04cb 100644
--- a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/DatabaseSQLStringsBuilder.java
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/DatabaseSQLStringsBuilder.java
@@ -1,10 +1,10 @@
 /*
  *  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
+ *  distributed with work for additional information
+ *  regarding copyright ownership.  The ASF licenses file
  *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
+ *  "License"); you may not use file except in compliance
  *  with the License.  You may obtain a copy of the License at
  *
  *       http://www.apache.org/licenses/LICENSE-2.0
@@ -29,7 +29,6 @@ import org.sql.generation.api.grammar.builders.modification.DeleteBySearchBuilde
 import org.sql.generation.api.grammar.builders.modification.UpdateBySearchBuilder;
 import org.sql.generation.api.grammar.common.SQLStatement;
 import org.sql.generation.api.grammar.common.datatypes.SQLDataType;
-import org.sql.generation.api.grammar.definition.table.AutoGenerationPolicy;
 import org.sql.generation.api.grammar.definition.table.UniqueSpecification;
 import org.sql.generation.api.grammar.factories.BooleanFactory;
 import org.sql.generation.api.grammar.factories.ColumnsFactory;
@@ -60,91 +59,68 @@ public interface DatabaseSQLStringsBuilder
 
     String buildSQLForRemoveEntityStatement();
 
-    @SuppressWarnings("PublicInnerClass")
     abstract class CommonMixin
         implements DatabaseSQLStringsBuilder
     {
-
         private static final Logger LOGGER = LoggerFactory.getLogger( DatabaseSQLStringsBuilder.class );
 
         @This
-        private DatabaseSQLServiceState _state;
+        private DatabaseSQLServiceState dbState;
 
         private SQLVendor vendor;
-
         private String schemaName;
 
         private String[] schemaCreationSQLs;
-
         private String[] indexCreationSQLs;
-
         private String[] tableCreationSQLs;
 
         private String selectAllEntitiesSQL;
-
         private String selectEntitySQL;
-
         private String insertEntitySQL;
-
         private String updateEntitySQL;
-
         private String removeEntitySQL;
 
         @Override
         public void init()
         {
-            this.vendor = this._state.vendor().get();
-
-            this.schemaName = this._state.schemaName().get();
+            vendor = dbState.vendor().get();
+            schemaName = dbState.schemaName().get();
+            schemaCreationSQLs = toString( createSchemaStatements( vendor ) );
+            indexCreationSQLs = toString( createIndicesStatements( vendor ) );
+            tableCreationSQLs = toString( createTableStatements( vendor ) );
+            selectAllEntitiesSQL = vendor.toString( createSelectAllEntitiesStatement( vendor ) );
+            selectEntitySQL = vendor.toString( createSelectEntityStatement( vendor ) );
+            insertEntitySQL = vendor.toString( createInsertEntityStatement( vendor ) );
+            updateEntitySQL = vendor.toString( createUpdateEntityStatement( vendor ) );
+            removeEntitySQL = vendor.toString( createRemoveEntityStatement( vendor ) );
 
-            this.schemaCreationSQLs = this.toString( this.createSchemaStatements( this.vendor ) );
             if( LOGGER.isTraceEnabled() )
             {
-                LOGGER.trace( "SQL for schema creation: {}", Arrays.asList( this.schemaCreationSQLs ) );
+                LOGGER.trace( "SQL for schema creation: {}", Arrays.asList( schemaCreationSQLs ) );
+                LOGGER.trace( "SQL for index creation: {}", Arrays.asList( indexCreationSQLs ) );
+                LOGGER.trace( "SQL for table creation: {}", Arrays.asList( tableCreationSQLs ) );
+                LOGGER.trace( "SQL for select all entities: {}", selectAllEntitiesSQL );
+                LOGGER.trace( "SQL for select entity: {}", selectEntitySQL );
+                LOGGER.trace( "SQL for insert entity: {}", insertEntitySQL );
+                LOGGER.trace( "SQL for update entity: {}", updateEntitySQL );
+                LOGGER.trace( "SQL for remove entity: {}", removeEntitySQL );
             }
-
-            this.indexCreationSQLs = this.toString( this.createIndicesStatements( this.vendor ) );
-            if( LOGGER.isTraceEnabled() )
-            {
-                LOGGER.trace( "SQL for index creation: {}", Arrays.asList( this.indexCreationSQLs ) );
-            }
-
-            this.tableCreationSQLs = this.toString( this.createTableStatements( this.vendor ) );
-            if( LOGGER.isTraceEnabled() )
-            {
-                LOGGER.trace( "SQL for table creation: {}", Arrays.asList( this.tableCreationSQLs ) );
-            }
-
-            this.selectAllEntitiesSQL = this.vendor.toString( this.createSelectAllEntitiesStatement( this.vendor ) );
-            LOGGER.trace( "SQL for select all entities: {}", this.selectAllEntitiesSQL );
-
-            this.selectEntitySQL = this.vendor.toString( this.createSelectEntityStatement( this.vendor ) );
-            LOGGER.trace( "SQL for select entity: {}", this.selectEntitySQL );
-
-            this.insertEntitySQL = this.vendor.toString( this.createInsertEntityStatement( this.vendor ) );
-            LOGGER.trace( "SQL for insert entity: {}", this.insertEntitySQL );
-
-            this.updateEntitySQL = this.vendor.toString( this.createUpdateEntityStatement( this.vendor ) );
-            LOGGER.trace( "SQL for update entity: {}", this.updateEntitySQL );
-
-            this.removeEntitySQL = this.vendor.toString( this.createRemoveEntityStatement( this.vendor ) );
-            LOGGER.trace( "SQL for remove entity: {}", this.removeEntitySQL );
         }
 
         protected String[] toString( SQLStatement[] stmts )
         {
-            List<String> result = new ArrayList<String>();
+            List<String> result = new ArrayList<>();
             if( stmts != null )
             {
                 for( Integer idx = 0; idx < stmts.length; ++idx )
                 {
-                    SQLStatement statement = stmts[idx];
+                    SQLStatement statement = stmts[ idx ];
                     if( statement != null )
                     {
-                        String stringStatement = this.vendor.toString( statement );
+                        String stringStatement = vendor.toString( statement );
                         if( stringStatement != null && stringStatement.length() > 0 )
                         {
-                            result.add( this.vendor.toString( statement ) );
+                            result.add( vendor.toString( statement ) );
                         }
                     }
                 }
@@ -154,29 +130,24 @@ public interface DatabaseSQLStringsBuilder
 
         protected SQLVendor getVendor()
         {
-            return this.vendor;
+            return vendor;
         }
 
         protected String getSchemaName()
         {
-            return this.schemaName;
+            return schemaName;
         }
 
         protected SQLStatement[] createSchemaStatements( SQLVendor vendor )
         {
-            // @formatter:off
-            return new SQLStatement[]
-            {
+            return new SQLStatement[] {
                 vendor.getDefinitionFactory().createSchemaDefinitionBuilder()
-                .setSchemaName( this.schemaName )
-                .createExpression()
+                      .setSchemaName( schemaName ).createExpression()
             };
-            // @formatter:on
         }
 
         protected SQLStatement[] createIndicesStatements( SQLVendor vendor )
         {
-            // TODO
             return new SQLStatement[] {};
         }
 
@@ -185,31 +156,25 @@ public interface DatabaseSQLStringsBuilder
             DefinitionFactory d = vendor.getDefinitionFactory();
             TableReferenceFactory t = vendor.getTableReferenceFactory();
 
-
-            // @formatter:off
-            return new SQLStatement[]
-            {
+            return new SQLStatement[] {
                 d.createTableDefinitionBuilder()
-                    .setTableName( t.tableName( this.getSchemaName(), SQLs.TABLE_NAME ) )
-                    .setTableContentsSource( d.createTableElementListBuilder()
-                        .addTableElement( d.createColumnDefinition( SQLs.ENTITY_PK_COLUMN_NAME, this.getPKType(), false, AutoGenerationPolicy.BY_DEFAULT ) )
-                        .addTableElement( d.createColumnDefinition( SQLs.ENTITY_OPTIMISTIC_LOCK_COLUMN_NAME, this.getOptimisticLockType(), false ) )
-                        .addTableElement( d.createColumnDefinition( SQLs.ENTITY_IDENTITY_COLUMN_NAME, this.getIDType(), false ) )
-                        .addTableElement( d.createColumnDefinition( SQLs.ENTITY_STATE_COLUMN_NAME, this.getStateType(), false ) )
-                        .addTableElement( d.createColumnDefinition( SQLs.ENTITY_LAST_MODIFIED_COLUMN_NAME, this.getLastModifiedType(), false ) )
-                        .addTableElement( d.createTableConstraintDefinition( d.createUniqueConstraintBuilder()
-                            .setUniqueness( UniqueSpecification.PRIMARY_KEY )
-                            .addColumns( SQLs.ENTITY_PK_COLUMN_NAME )
-                            .createExpression() ) )
-                        .addTableElement( d.createTableConstraintDefinition( d.createUniqueConstraintBuilder()
-                            .setUniqueness( UniqueSpecification.UNIQUE )
-                            .addColumns( SQLs.ENTITY_IDENTITY_COLUMN_NAME )
-                            .createExpression() ) )
-                        .createExpression()
-                        )
-                   .createExpression()
+                 .setTableName( t.tableName( getSchemaName(), SQLs.TABLE_NAME ) )
+                 .setTableContentsSource(
+                     d.createTableElementListBuilder()
+                      .addTableElement( d.createColumnDefinition( SQLs.ENTITY_IDENTITY_COLUMN_NAME,
+                                                                  getIDType(), false ) )
+                      .addTableElement( d.createColumnDefinition( SQLs.ENTITY_VERSION_COLUMN_NAME,
+                                                                  getVersionType(), false ) )
+                      .addTableElement( d.createColumnDefinition( SQLs.ENTITY_STATE_COLUMN_NAME,
+                                                                  getStateType(), false ) )
+                      .addTableElement( d.createTableConstraintDefinition(
+                          d.createUniqueConstraintBuilder()
+                           .setUniqueness( UniqueSpecification.PRIMARY_KEY )
+                           .addColumns( SQLs.ENTITY_IDENTITY_COLUMN_NAME )
+                           .createExpression() )
+                      ).createExpression()
+                 ).createExpression()
             };
-            // @formatter:on
         }
 
         protected SQLStatement createSelectAllEntitiesStatement( SQLVendor vendor )
@@ -217,12 +182,10 @@ public interface DatabaseSQLStringsBuilder
             QueryFactory q = vendor.getQueryFactory();
             TableReferenceFactory t = vendor.getTableReferenceFactory();
 
-            // @formatter:off
             return q.simpleQueryBuilder()
-                .select( SQLs.ENTITY_PK_COLUMN_NAME, SQLs.ENTITY_OPTIMISTIC_LOCK_COLUMN_NAME, SQLs.ENTITY_STATE_COLUMN_NAME )
-                .from( t.tableName( this.schemaName, SQLs.TABLE_NAME ) )
-                .createExpression();
-            // @formatter:on
+                    .select( SQLs.ENTITY_STATE_COLUMN_NAME )
+                    .from( t.tableName( schemaName, SQLs.TABLE_NAME ) )
+                    .createExpression();
         }
 
         protected SQLStatement createSelectEntityStatement( SQLVendor vendor )
@@ -233,13 +196,11 @@ public interface DatabaseSQLStringsBuilder
             ColumnsFactory c = vendor.getColumnsFactory();
             LiteralFactory l = vendor.getLiteralFactory();
 
-            // @formatter:off
             return q.simpleQueryBuilder()
-                .select( SQLs.ENTITY_PK_COLUMN_NAME, SQLs.ENTITY_OPTIMISTIC_LOCK_COLUMN_NAME, SQLs.ENTITY_STATE_COLUMN_NAME )
-                .from( t.tableName( this.schemaName, SQLs.TABLE_NAME ) )
-                .where( b.eq( c.colName( SQLs.ENTITY_IDENTITY_COLUMN_NAME ), l.param() ) )
-                .createExpression();
-            // @formatter:on
+                    .select( SQLs.ENTITY_STATE_COLUMN_NAME )
+                    .from( t.tableName( schemaName, SQLs.TABLE_NAME ) )
+                    .where( b.eq( c.colName( SQLs.ENTITY_IDENTITY_COLUMN_NAME ), l.param() ) )
+                    .createExpression();
         }
 
         protected SQLStatement createInsertEntityStatement( SQLVendor vendor )
@@ -248,26 +209,15 @@ public interface DatabaseSQLStringsBuilder
             TableReferenceFactory t = vendor.getTableReferenceFactory();
             LiteralFactory l = vendor.getLiteralFactory();
 
-            // @formatter:off
             return m.insert()
-                .setTableName( t.tableName( this.schemaName, SQLs.TABLE_NAME ) )
-                .setColumnSource( m.columnSourceByValues()
-                    .addColumnNames(
-                        SQLs.ENTITY_OPTIMISTIC_LOCK_COLUMN_NAME,
-                        SQLs.ENTITY_IDENTITY_COLUMN_NAME,
-                        SQLs.ENTITY_STATE_COLUMN_NAME,
-                        SQLs.ENTITY_LAST_MODIFIED_COLUMN_NAME
-                        )
-                    .addValues(
-                        l.n( 0 ),
-                        l.param(),
-                        l.param(),
-                        l.param()
-                        )
-                    .createExpression()
-                    )
-                 .createExpression();
-            // @formatter:on
+                    .setTableName( t.tableName( schemaName, SQLs.TABLE_NAME ) )
+                    .setColumnSource( m.columnSourceByValues()
+                                       .addColumnNames( SQLs.ENTITY_IDENTITY_COLUMN_NAME,
+                                                        SQLs.ENTITY_STATE_COLUMN_NAME )
+                                       .addValues( l.param(),
+                                                   l.param() )
+                                       .createExpression()
+                    ).createExpression();
         }
 
         protected SQLStatement createUpdateEntityStatement( SQLVendor vendor )
@@ -278,20 +228,18 @@ public interface DatabaseSQLStringsBuilder
             BooleanFactory b = vendor.getBooleanFactory();
             ColumnsFactory c = vendor.getColumnsFactory();
 
-            // @formatter:off
-            UpdateBySearchBuilder builder = m.updateBySearch()
-                .setTargetTable( m.createTargetTable( t.tableName( this.schemaName, SQLs.TABLE_NAME ) ) )
-                .addSetClauses(
-                    m.setClause( SQLs.ENTITY_OPTIMISTIC_LOCK_COLUMN_NAME, m.updateSourceByExp( l.param() ) ),
-                    m.setClause( SQLs.ENTITY_STATE_COLUMN_NAME, m.updateSourceByExp( l.param() ) ),
-                    m.setClause( SQLs.ENTITY_LAST_MODIFIED_COLUMN_NAME, m.updateSourceByExp( l.param() ) )
-                    );
-            builder
-                .getWhereBuilder()
-                    .reset( b.eq( c.colName( SQLs.ENTITY_PK_COLUMN_NAME ), l.param() ) )
-                    .and( b.eq( c.colName( SQLs.ENTITY_OPTIMISTIC_LOCK_COLUMN_NAME ), l.param() ) );
+            UpdateBySearchBuilder builder = m.updateBySearch().setTargetTable(
+                m.createTargetTable( t.tableName( schemaName, SQLs.TABLE_NAME ) )
+            ).addSetClauses(
+                m.setClause( SQLs.ENTITY_VERSION_COLUMN_NAME, m.updateSourceByExp( l.param() ) ),
+                m.setClause( SQLs.ENTITY_STATE_COLUMN_NAME, m.updateSourceByExp( l.param() ) )
+            );
+            builder.getWhereBuilder().reset(
+                b.eq( c.colName( SQLs.ENTITY_IDENTITY_COLUMN_NAME ), l.param() )
+            ).and(
+                b.eq( c.colName( SQLs.ENTITY_VERSION_COLUMN_NAME ), l.param() )
+            );
             return builder.createExpression();
-            // @formatter:on
         }
 
         protected SQLStatement createRemoveEntityStatement( SQLVendor vendor )
@@ -302,88 +250,76 @@ public interface DatabaseSQLStringsBuilder
             BooleanFactory b = vendor.getBooleanFactory();
             ColumnsFactory c = vendor.getColumnsFactory();
 
-            // @formatter:off
-            DeleteBySearchBuilder builder = m.deleteBySearch()
-                .setTargetTable( m.createTargetTable( t.tableName( this.schemaName, SQLs.TABLE_NAME ) ) );
-            builder.getWhere()
-                .reset( b.eq( c.colName( SQLs.ENTITY_PK_COLUMN_NAME ), l.param() ) );
+            DeleteBySearchBuilder builder = m.deleteBySearch().setTargetTable(
+                m.createTargetTable( t.tableName( schemaName, SQLs.TABLE_NAME ) )
+            );
+            builder.getWhere().reset(
+                b.eq( c.colName( SQLs.ENTITY_IDENTITY_COLUMN_NAME ), l.param() )
+            );
             return builder.createExpression();
-            // @formatter:on
-        }
-
-        protected SQLDataType getPKType()
-        {
-            return this.vendor.getDataTypeFactory().bigInt();
-        }
-
-        protected SQLDataType getOptimisticLockType()
-        {
-            return this.vendor.getDataTypeFactory().bigInt();
         }
 
         protected SQLDataType getIDType()
         {
-            return this.vendor.getDataTypeFactory().sqlVarChar( 64 );
+            return vendor.getDataTypeFactory().sqlVarChar( 64 );
         }
 
-        protected SQLDataType getStateType()
+        protected SQLDataType getVersionType()
         {
-            return this.vendor.getDataTypeFactory().sqlVarChar( 10000 );
+            return vendor.getDataTypeFactory().sqlVarChar( 64 );
         }
 
-        protected SQLDataType getLastModifiedType()
+        protected SQLDataType getStateType()
         {
-            return this.vendor.getDataTypeFactory().bigInt();
+            return vendor.getDataTypeFactory().sqlVarChar( 10000 );
         }
 
         @Override
         public String[] buildSQLForSchemaCreation()
         {
-            return this.schemaCreationSQLs;
+            return schemaCreationSQLs;
         }
 
         @Override
         public String[] buildSQLForIndexCreation()
         {
-            return this.indexCreationSQLs;
+            return indexCreationSQLs;
         }
 
         @Override
         public String buildSQLForSelectAllEntitiesStatement()
         {
-            return this.selectAllEntitiesSQL;
+            return selectAllEntitiesSQL;
         }
 
         @Override
         public String buildSQLForSelectEntityStatement()
         {
-            return this.selectEntitySQL;
+            return selectEntitySQL;
         }
 
         @Override
         public String buildSQLForInsertEntityStatement()
         {
-            return this.insertEntitySQL;
+            return insertEntitySQL;
         }
 
         @Override
         public String buildSQLForUpdateEntityStatement()
         {
-            return this.updateEntitySQL;
+            return updateEntitySQL;
         }
 
         @Override
         public String buildSQLForRemoveEntityStatement()
         {
-            return this.removeEntitySQL;
+            return removeEntitySQL;
         }
 
         @Override
         public String[] buildSQLForTableCreation()
         {
-            return this.tableCreationSQLs;
+            return tableCreationSQLs;
         }
-
     }
-
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/DerbySQLDatabaseSQLServiceMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/DerbySQLDatabaseSQLServiceMixin.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/DerbySQLDatabaseSQLServiceMixin.java
index 527cdab..083d79e 100644
--- a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/DerbySQLDatabaseSQLServiceMixin.java
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/DerbySQLDatabaseSQLServiceMixin.java
@@ -19,6 +19,7 @@
  */
 package org.apache.polygene.entitystore.sql.internal;
 
+import java.io.Reader;
 import java.io.StringReader;
 import java.sql.Connection;
 import java.sql.ResultSet;
@@ -28,11 +29,10 @@ import org.apache.polygene.library.sql.common.SQLUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-@SuppressWarnings("ProtectedField")
+@SuppressWarnings( "ProtectedField" )
 public abstract class DerbySQLDatabaseSQLServiceMixin
     implements DatabaseSQLService, DatabaseSQLStringsBuilder, DatabaseSQLServiceSpi
 {
-
     private static final Logger LOGGER = LoggerFactory.getLogger( DerbySQLDatabaseSQLServiceMixin.class );
 
     @This
@@ -46,10 +46,8 @@ public abstract class DerbySQLDatabaseSQLServiceMixin
         try
         {
             String tableNameForQuery = SQLs.TABLE_NAME.toUpperCase();
-            rs = connection.getMetaData().getTables( null, null, tableNameForQuery, new String[]
-            {
-                "TABLE"
-            } );
+            rs = connection.getMetaData().getTables( null, null, tableNameForQuery,
+                                                     new String[] { "TABLE" } );
             boolean tableExists = rs.next();
             LOGGER.trace( "Found table {}? {}", tableNameForQuery, tableExists );
             return tableExists;
@@ -61,12 +59,9 @@ public abstract class DerbySQLDatabaseSQLServiceMixin
     }
 
     @Override
-    public EntityValueResult getEntityValue( ResultSet rs )
+    public Reader getEntityStateReader( ResultSet rs )
         throws SQLException
     {
-        return new EntityValueResult( rs.getLong( SQLs.ENTITY_PK_COLUMN_NAME ),
-            rs.getLong( SQLs.ENTITY_OPTIMISTIC_LOCK_COLUMN_NAME ), new StringReader(
-                rs.getString( SQLs.ENTITY_STATE_COLUMN_NAME ) ) );
+        return new StringReader( rs.getString( SQLs.ENTITY_STATE_COLUMN_NAME ) );
     }
-
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/H2SQLDatabaseSQLServiceMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/H2SQLDatabaseSQLServiceMixin.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/H2SQLDatabaseSQLServiceMixin.java
index ba34b36..3b870c6 100644
--- a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/H2SQLDatabaseSQLServiceMixin.java
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/H2SQLDatabaseSQLServiceMixin.java
@@ -19,6 +19,7 @@
  */
 package org.apache.polygene.entitystore.sql.internal;
 
+import java.io.Reader;
 import java.io.StringReader;
 import java.sql.Connection;
 import java.sql.ResultSet;
@@ -29,35 +30,35 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public abstract class H2SQLDatabaseSQLServiceMixin
-        implements DatabaseSQLService, DatabaseSQLStringsBuilder, DatabaseSQLServiceSpi
+    implements DatabaseSQLService, DatabaseSQLStringsBuilder, DatabaseSQLServiceSpi
 {
-
     private static final Logger LOGGER = LoggerFactory.getLogger( H2SQLDatabaseSQLServiceMixin.class );
 
     @This
     protected DatabaseSQLServiceSpi spi;
 
     public boolean tableExists( Connection connection )
-            throws SQLException
+        throws SQLException
     {
         ResultSet rs = null;
-        try {
+        try
+        {
             String tableNameForQuery = SQLs.TABLE_NAME.toUpperCase();
-            rs = connection.getMetaData().getTables( null, null, tableNameForQuery, new String[]{ "TABLE" } );
+            rs = connection.getMetaData().getTables( null, null, tableNameForQuery,
+                                                     new String[] { "TABLE" } );
             boolean tableExists = rs.next();
             LOGGER.trace( "Found table {}? {}", tableNameForQuery, tableExists );
             return tableExists;
-        } finally {
+        }
+        finally
+        {
             SQLUtil.closeQuietly( rs );
         }
     }
 
-    public EntityValueResult getEntityValue( ResultSet rs )
-            throws SQLException
+    public Reader getEntityStateReader( ResultSet rs )
+        throws SQLException
     {
-        return new EntityValueResult( rs.getLong( SQLs.ENTITY_PK_COLUMN_NAME ),
-                                      rs.getLong( SQLs.ENTITY_OPTIMISTIC_LOCK_COLUMN_NAME ),
-                                      new StringReader( rs.getString( SQLs.ENTITY_STATE_COLUMN_NAME ) ) );
+        return new StringReader( rs.getString( SQLs.ENTITY_STATE_COLUMN_NAME ) );
     }
-
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/MySQLDatabaseSQLServiceMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/MySQLDatabaseSQLServiceMixin.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/MySQLDatabaseSQLServiceMixin.java
index da3479d..1c6c534 100644
--- a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/MySQLDatabaseSQLServiceMixin.java
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/MySQLDatabaseSQLServiceMixin.java
@@ -19,6 +19,7 @@
  */
 package org.apache.polygene.entitystore.sql.internal;
 
+import java.io.Reader;
 import java.io.StringReader;
 import java.sql.Connection;
 import java.sql.ResultSet;
@@ -28,7 +29,7 @@ import org.apache.polygene.library.sql.common.SQLUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-@SuppressWarnings("ProtectedField")
+@SuppressWarnings( "ProtectedField" )
 public abstract class MySQLDatabaseSQLServiceMixin
     implements DatabaseSQLService, DatabaseSQLStringsBuilder, DatabaseSQLServiceSpi
 {
@@ -45,11 +46,9 @@ public abstract class MySQLDatabaseSQLServiceMixin
         ResultSet rs = null;
         try
         {
-            String tableNameForQuery = SQLs.TABLE_NAME;
-            rs = connection.getMetaData().getTables( null, null, tableNameForQuery, new String[]
-            {
-                "TABLE"
-            } );
+            String tableNameForQuery = SQLs.TABLE_NAME.toUpperCase();
+            rs = connection.getMetaData().getTables( null, null, tableNameForQuery,
+                                                     new String[] { "TABLE" } );
             boolean tableExists = rs.next();
             LOGGER.trace( "Found table {}? {}", tableNameForQuery, tableExists );
             return tableExists;
@@ -61,12 +60,9 @@ public abstract class MySQLDatabaseSQLServiceMixin
     }
 
     @Override
-    public EntityValueResult getEntityValue( ResultSet rs )
+    public Reader getEntityStateReader( ResultSet rs )
         throws SQLException
     {
-        return new EntityValueResult( rs.getLong( SQLs.ENTITY_PK_COLUMN_NAME ),
-            rs.getLong( SQLs.ENTITY_OPTIMISTIC_LOCK_COLUMN_NAME ), new StringReader(
-                rs.getString( SQLs.ENTITY_STATE_COLUMN_NAME ) ) );
+        return new StringReader( rs.getString( SQLs.ENTITY_STATE_COLUMN_NAME ) );
     }
-
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/PostgreSQLDatabaseSQLServiceMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/PostgreSQLDatabaseSQLServiceMixin.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/PostgreSQLDatabaseSQLServiceMixin.java
index 9052146..a4cf014 100644
--- a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/PostgreSQLDatabaseSQLServiceMixin.java
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/PostgreSQLDatabaseSQLServiceMixin.java
@@ -19,6 +19,7 @@
  */
 package org.apache.polygene.entitystore.sql.internal;
 
+import java.io.Reader;
 import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.SQLException;
@@ -28,9 +29,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public abstract class PostgreSQLDatabaseSQLServiceMixin
-        implements DatabaseSQLServiceSpi, DatabaseSQLStringsBuilder, DatabaseSQLService
+    implements DatabaseSQLServiceSpi, DatabaseSQLStringsBuilder, DatabaseSQLService
 {
-
     private static final Logger LOGGER = LoggerFactory.getLogger( PostgreSQLDatabaseSQLServiceMixin.class );
 
     @This
@@ -38,31 +38,27 @@ public abstract class PostgreSQLDatabaseSQLServiceMixin
 
     @Override
     public boolean tableExists( Connection connection )
-            throws SQLException
+        throws SQLException
     {
         ResultSet rs = null;
-        try {
-
-            rs = connection.getMetaData().getTables( null,
-                                                     this.spi.getCurrentSchemaName(),
-                                                     SQLs.TABLE_NAME,
-                                                     new String[]{ "TABLE" } );
+        try
+        {
+            rs = connection.getMetaData().getTables( null, spi.getCurrentSchemaName(), SQLs.TABLE_NAME,
+                                                     new String[] { "TABLE" } );
             boolean tableExists = rs.next();
             LOGGER.trace( "Found table {}? {}", SQLs.TABLE_NAME, tableExists );
             return tableExists;
-
-        } finally {
+        }
+        finally
+        {
             SQLUtil.closeQuietly( rs );
         }
     }
 
     @Override
-    public EntityValueResult getEntityValue( ResultSet rs )
-            throws SQLException
+    public Reader getEntityStateReader( ResultSet rs )
+        throws SQLException
     {
-        return new EntityValueResult( rs.getLong( SQLs.ENTITY_PK_COLUMN_NAME ),
-                                      rs.getLong( SQLs.ENTITY_OPTIMISTIC_LOCK_COLUMN_NAME ),
-                                      rs.getCharacterStream( SQLs.ENTITY_STATE_COLUMN_NAME ) );
+        return rs.getCharacterStream( SQLs.ENTITY_STATE_COLUMN_NAME );
     }
-
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/SQLiteDatabaseSQLServiceMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/SQLiteDatabaseSQLServiceMixin.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/SQLiteDatabaseSQLServiceMixin.java
index 2715a00..d762f8b 100644
--- a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/SQLiteDatabaseSQLServiceMixin.java
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/SQLiteDatabaseSQLServiceMixin.java
@@ -19,6 +19,7 @@
  */
 package org.apache.polygene.entitystore.sql.internal;
 
+import java.io.Reader;
 import java.io.StringReader;
 import java.sql.Connection;
 import java.sql.ResultSet;
@@ -29,9 +30,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public abstract class SQLiteDatabaseSQLServiceMixin
-        implements DatabaseSQLService, DatabaseSQLStringsBuilder, DatabaseSQLServiceSpi
+    implements DatabaseSQLService, DatabaseSQLStringsBuilder, DatabaseSQLServiceSpi
 {
-
     private static final Logger LOGGER = LoggerFactory.getLogger( SQLiteDatabaseSQLServiceMixin.class );
 
     @This
@@ -39,27 +39,28 @@ public abstract class SQLiteDatabaseSQLServiceMixin
 
     @Override
     public boolean tableExists( Connection connection )
-            throws SQLException
+        throws SQLException
     {
         ResultSet rs = null;
-        try {
+        try
+        {
             String tableNameForQuery = SQLs.TABLE_NAME.toUpperCase();
-            rs = connection.getMetaData().getTables( null, null, tableNameForQuery, new String[]{ "TABLE" } );
+            rs = connection.getMetaData().getTables( null, null, tableNameForQuery,
+                                                     new String[] { "TABLE" } );
             boolean tableExists = rs.next();
             LOGGER.trace( "Found table {}? {}", tableNameForQuery, tableExists );
             return tableExists;
-        } finally {
+        }
+        finally
+        {
             SQLUtil.closeQuietly( rs );
         }
     }
 
     @Override
-    public EntityValueResult getEntityValue( ResultSet rs )
-            throws SQLException
+    public Reader getEntityStateReader( ResultSet rs )
+        throws SQLException
     {
-        return new EntityValueResult( rs.getLong( SQLs.ENTITY_PK_COLUMN_NAME ),
-                                      rs.getLong( SQLs.ENTITY_OPTIMISTIC_LOCK_COLUMN_NAME ),
-                                      new StringReader( rs.getString( SQLs.ENTITY_STATE_COLUMN_NAME ) ) );
+        return new StringReader( rs.getString( SQLs.ENTITY_STATE_COLUMN_NAME ) );
     }
-
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/SQLs.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/SQLs.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/SQLs.java
index bcadde1..8555a5d 100644
--- a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/SQLs.java
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/SQLs.java
@@ -21,19 +21,9 @@ package org.apache.polygene.entitystore.sql.internal;
 
 public interface SQLs
 {
-
-    String DEFAULT_SCHEMA_NAME = "polygene_es";
-
-    String TABLE_NAME = "polygene_entities";
-
-    String ENTITY_PK_COLUMN_NAME = "entity_pk";
-
-    String ENTITY_IDENTITY_COLUMN_NAME = "entity_id";
-
-    String ENTITY_STATE_COLUMN_NAME = "entity_state";
-
-    String ENTITY_OPTIMISTIC_LOCK_COLUMN_NAME = "entity_optimistic_lock";
-
-    String ENTITY_LAST_MODIFIED_COLUMN_NAME = "entity_last_modified";
-
+    String DEFAULT_SCHEMA_NAME = "POLYGENE_ES";
+    String TABLE_NAME = "POLYGENE_ENTITIES";
+    String ENTITY_IDENTITY_COLUMN_NAME = "ENTITY_IDENTITY";
+    String ENTITY_VERSION_COLUMN_NAME = "ENTITY_VERSION";
+    String ENTITY_STATE_COLUMN_NAME = "ENTITY_STATE";
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/DerbySQLEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/DerbySQLEntityStoreTest.java b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/DerbySQLEntityStoreTest.java
index 498fb41..6d849cc 100644
--- a/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/DerbySQLEntityStoreTest.java
+++ b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/DerbySQLEntityStoreTest.java
@@ -19,11 +19,9 @@
  */
 package org.apache.polygene.entitystore.sql;
 
-import java.io.File;
 import java.sql.Connection;
 import java.sql.Statement;
 import javax.sql.DataSource;
-import org.apache.derby.iapi.services.io.FileUtil;
 import org.apache.polygene.api.common.Visibility;
 import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.api.usecase.UsecaseBuilder;
@@ -36,7 +34,6 @@ import org.apache.polygene.library.sql.common.SQLConfiguration;
 import org.apache.polygene.library.sql.dbcp.DBCPDataSourceServiceAssembler;
 import org.apache.polygene.test.EntityTestAssembler;
 import org.apache.polygene.test.entity.AbstractEntityStoreTest;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
 
 public class DerbySQLEntityStoreTest
     extends AbstractEntityStoreTest
@@ -50,29 +47,28 @@ public class DerbySQLEntityStoreTest
         super.assemble( module );
         ModuleAssembly config = module.layer().module( "config" );
         new EntityTestAssembler().assemble( config );
-        new OrgJsonValueSerializationAssembler().assemble( module );
 
         // START SNIPPET: assembly
         // DataSourceService
-        new DBCPDataSourceServiceAssembler().
-            identifiedBy( "derby-datasource-service" ).
-            visibleIn( Visibility.module ).
-            withConfig( config, Visibility.layer ).
-            assemble( module );
+        new DBCPDataSourceServiceAssembler()
+            .identifiedBy( "derby-datasource-service" )
+            .visibleIn( Visibility.module )
+            .withConfig( config, Visibility.layer )
+            .assemble( module );
 
         // DataSource
-        new DataSourceAssembler().
-            withDataSourceServiceIdentity( "derby-datasource-service" ).
-            identifiedBy( "derby-datasource" ).
-            visibleIn( Visibility.module ).
-            withCircuitBreaker().
-            assemble( module );
+        new DataSourceAssembler()
+            .withDataSourceServiceIdentity( "derby-datasource-service" )
+            .identifiedBy( "derby-datasource" )
+            .visibleIn( Visibility.module )
+            .withCircuitBreaker()
+            .assemble( module );
 
         // SQL EntityStore
-        new DerbySQLEntityStoreAssembler().
-            visibleIn( Visibility.application ).
-            withConfig( config, Visibility.layer ).
-            assemble( module );
+        new DerbySQLEntityStoreAssembler()
+            .visibleIn( Visibility.application )
+            .withConfig( config, Visibility.layer )
+            .assemble( module );
     }
     // END SNIPPET: assembly
 
@@ -84,7 +80,8 @@ public class DerbySQLEntityStoreTest
             "Delete " + getClass().getSimpleName() + " test data" ) );
         try
         {
-            SQLConfiguration config = uow.get( SQLConfiguration.class, DerbySQLEntityStoreAssembler.DEFAULT_ENTITYSTORE_IDENTITY );
+            SQLConfiguration config = uow.get( SQLConfiguration.class,
+                                               DerbySQLEntityStoreAssembler.DEFAULT_ENTITYSTORE_IDENTITY );
             Connection connection = serviceFinder.findService( DataSource.class ).get().getConnection();
             connection.setAutoCommit( false );
             String schemaName = config.schemaName().get();
@@ -94,10 +91,9 @@ public class DerbySQLEntityStoreTest
             }
             try( Statement stmt = connection.createStatement() )
             {
-                stmt.execute( String.format( "DELETE FROM %s." + SQLs.TABLE_NAME, schemaName ) );
+                stmt.execute( String.format( "DELETE FROM %s.%s", schemaName, SQLs.TABLE_NAME ) );
                 connection.commit();
             }
-            FileUtil.removeDirectory( new File( "target/polygene-data" ) );
         }
         finally
         {
@@ -105,5 +101,4 @@ public class DerbySQLEntityStoreTest
             super.tearDown();
         }
     }
-
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/H2SQLEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/H2SQLEntityStoreTest.java b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/H2SQLEntityStoreTest.java
index 8b54b3d..1aed71f 100644
--- a/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/H2SQLEntityStoreTest.java
+++ b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/H2SQLEntityStoreTest.java
@@ -19,8 +19,6 @@
  */
 package org.apache.polygene.entitystore.sql;
 
-import java.io.File;
-import org.apache.derby.iapi.services.io.FileUtil;
 import org.apache.polygene.api.common.Visibility;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
@@ -29,7 +27,6 @@ import org.apache.polygene.library.sql.assembly.DataSourceAssembler;
 import org.apache.polygene.library.sql.dbcp.DBCPDataSourceServiceAssembler;
 import org.apache.polygene.test.EntityTestAssembler;
 import org.apache.polygene.test.entity.AbstractEntityStoreTest;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
 
 public class H2SQLEntityStoreTest
     extends AbstractEntityStoreTest
@@ -43,44 +40,28 @@ public class H2SQLEntityStoreTest
         super.assemble( module );
         ModuleAssembly config = module.layer().module( "config" );
         new EntityTestAssembler().assemble( config );
-        new OrgJsonValueSerializationAssembler().assemble( module );
 
         // START SNIPPET: assembly
         // DataSourceService
-        new DBCPDataSourceServiceAssembler().
-            identifiedBy( "h2-datasource-service" ).
-            visibleIn( Visibility.module ).
-            withConfig( config, Visibility.layer ).
-            assemble( module );
+        new DBCPDataSourceServiceAssembler()
+            .identifiedBy( "h2-datasource-service" )
+            .visibleIn( Visibility.module )
+            .withConfig( config, Visibility.layer )
+            .assemble( module );
 
         // DataSource
-        new DataSourceAssembler().
-            withDataSourceServiceIdentity( "h2-datasource-service" ).
-            identifiedBy( "h2-datasource" ).
-            visibleIn( Visibility.module ).
-            withCircuitBreaker().
-            assemble( module );
+        new DataSourceAssembler()
+            .withDataSourceServiceIdentity( "h2-datasource-service" )
+            .identifiedBy( "h2-datasource" )
+            .visibleIn( Visibility.module )
+            .withCircuitBreaker()
+            .assemble( module );
 
         // SQL EntityStore
-        new H2SQLEntityStoreAssembler().
-            visibleIn( Visibility.application ).
-            withConfig( config, Visibility.layer ).
-            assemble( module );
+        new H2SQLEntityStoreAssembler()
+            .visibleIn( Visibility.application )
+            .withConfig( config, Visibility.layer )
+            .assemble( module );
     }
     // END SNIPPET: assembly
-
-    @Override
-    public void tearDown()
-        throws Exception
-    {
-        try
-        {
-            FileUtil.removeDirectory( new File( "target/polygene-data" ) );
-        }
-        finally
-        {
-            super.tearDown();
-        }
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/MySQLEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/MySQLEntityStoreTest.java b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/MySQLEntityStoreTest.java
index 9183801..b5bce1e 100644
--- a/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/MySQLEntityStoreTest.java
+++ b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/MySQLEntityStoreTest.java
@@ -36,7 +36,6 @@ import org.apache.polygene.library.sql.datasource.DataSourceConfiguration;
 import org.apache.polygene.library.sql.dbcp.DBCPDataSourceServiceAssembler;
 import org.apache.polygene.test.EntityTestAssembler;
 import org.apache.polygene.test.entity.AbstractEntityStoreTest;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
 import org.junit.ClassRule;
 
 public class MySQLEntityStoreTest
@@ -64,29 +63,28 @@ public class MySQLEntityStoreTest
         super.assemble( module );
         ModuleAssembly config = module.layer().module( "config" );
         new EntityTestAssembler().assemble( config );
-        new OrgJsonValueSerializationAssembler().assemble( module );
 
         // START SNIPPET: assembly
         // DataSourceService
-        new DBCPDataSourceServiceAssembler().
-            identifiedBy( "mysql-datasource-service" ).
-            visibleIn( Visibility.module ).
-            withConfig( config, Visibility.layer ).
-            assemble( module );
+        new DBCPDataSourceServiceAssembler()
+            .identifiedBy( "mysql-datasource-service" )
+            .visibleIn( Visibility.module )
+            .withConfig( config, Visibility.layer )
+            .assemble( module );
 
         // DataSource
-        new DataSourceAssembler().
-            withDataSourceServiceIdentity( "mysql-datasource-service" ).
-            identifiedBy( "mysql-datasource" ).
-            visibleIn( Visibility.module ).
-            withCircuitBreaker().
-            assemble( module );
+        new DataSourceAssembler()
+            .withDataSourceServiceIdentity( "mysql-datasource-service" )
+            .identifiedBy( "mysql-datasource" )
+            .visibleIn( Visibility.module )
+            .withCircuitBreaker()
+            .assemble( module );
 
         // SQL EntityStore
-        new MySQLEntityStoreAssembler().
-            visibleIn( Visibility.application ).
-            withConfig( config, Visibility.layer ).
-            assemble( module );
+        new MySQLEntityStoreAssembler()
+            .visibleIn( Visibility.application )
+            .withConfig( config, Visibility.layer )
+            .assemble( module );
         // END SNIPPET: assembly
         String mysqlHost = DOCKER.getDockerHost();
         int mysqlPort = DOCKER.getExposedContainerPort( "3306/tcp" );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/PostgreSQLEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/PostgreSQLEntityStoreTest.java b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/PostgreSQLEntityStoreTest.java
index 49d5a13..c6dd48c 100644
--- a/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/PostgreSQLEntityStoreTest.java
+++ b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/PostgreSQLEntityStoreTest.java
@@ -36,7 +36,6 @@ import org.apache.polygene.library.sql.datasource.DataSourceConfiguration;
 import org.apache.polygene.library.sql.dbcp.DBCPDataSourceServiceAssembler;
 import org.apache.polygene.test.EntityTestAssembler;
 import org.apache.polygene.test.entity.AbstractEntityStoreTest;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
 import org.junit.ClassRule;
 
 /**
@@ -88,29 +87,28 @@ public class PostgreSQLEntityStoreTest
         super.assemble( module );
         ModuleAssembly config = module.layer().module( "config" );
         new EntityTestAssembler().assemble( config );
-        new OrgJsonValueSerializationAssembler().assemble( module );
 
         // START SNIPPET: assembly
         // DataSourceService
-        new DBCPDataSourceServiceAssembler().
-            identifiedBy( "postgresql-datasource-service" ).
-            visibleIn( Visibility.module ).
-            withConfig( config, Visibility.layer ).
-            assemble( module );
+        new DBCPDataSourceServiceAssembler()
+            .identifiedBy( "postgresql-datasource-service" )
+            .visibleIn( Visibility.module )
+            .withConfig( config, Visibility.layer )
+            .assemble( module );
 
         // DataSource
-        new DataSourceAssembler().
-            withDataSourceServiceIdentity( "postgresql-datasource-service" ).
-            identifiedBy( "postgresql-datasource" ).
-            visibleIn( Visibility.module ).
-            withCircuitBreaker().
-            assemble( module );
+        new DataSourceAssembler()
+            .withDataSourceServiceIdentity( "postgresql-datasource-service" )
+            .identifiedBy( "postgresql-datasource" )
+            .visibleIn( Visibility.module )
+            .withCircuitBreaker()
+            .assemble( module );
 
         // SQL EntityStore
-        new PostgreSQLEntityStoreAssembler().
-            visibleIn( Visibility.application ).
-            withConfig( config, Visibility.layer ).
-            assemble( module );
+        new PostgreSQLEntityStoreAssembler()
+            .visibleIn( Visibility.application )
+            .withConfig( config, Visibility.layer )
+            .assemble( module );
         // END SNIPPET: assembly
         String host = DOCKER.getDockerHost();
         int port = DOCKER.getExposedContainerPort( "5432/tcp" );
@@ -129,7 +127,8 @@ public class PostgreSQLEntityStoreTest
         );
         try
         {
-            SQLConfiguration config = uow.get( SQLConfiguration.class, PostgreSQLEntityStoreAssembler.DEFAULT_ENTITYSTORE_IDENTITY );
+            SQLConfiguration config = uow.get( SQLConfiguration.class,
+                                               PostgreSQLEntityStoreAssembler.DEFAULT_ENTITYSTORE_IDENTITY );
             Connection connection = serviceFinder.findService( DataSource.class ).get().getConnection();
             connection.setAutoCommit( false );
             String schemaName = config.schemaName().get();
@@ -139,7 +138,7 @@ public class PostgreSQLEntityStoreTest
             }
             try( Statement stmt = connection.createStatement() )
             {
-                stmt.execute( String.format( "DELETE FROM %s." + SQLs.TABLE_NAME, schemaName ) );
+                stmt.execute( String.format( "DROP SCHEMA \"%s\" CASCADE", schemaName ) );
                 connection.commit();
             }
         }
@@ -149,5 +148,4 @@ public class PostgreSQLEntityStoreTest
             super.tearDown();
         }
     }
-
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/SQLiteEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/SQLiteEntityStoreTest.java b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/SQLiteEntityStoreTest.java
index aac68f8..24dd298 100644
--- a/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/SQLiteEntityStoreTest.java
+++ b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/SQLiteEntityStoreTest.java
@@ -19,9 +19,6 @@
  */
 package org.apache.polygene.entitystore.sql;
 
-import java.io.File;
-import org.apache.derby.iapi.services.io.FileUtil;
-import org.junit.BeforeClass;
 import org.apache.polygene.api.common.Visibility;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
@@ -30,7 +27,7 @@ import org.apache.polygene.library.sql.assembly.DataSourceAssembler;
 import org.apache.polygene.library.sql.dbcp.DBCPDataSourceServiceAssembler;
 import org.apache.polygene.test.EntityTestAssembler;
 import org.apache.polygene.test.entity.AbstractEntityStoreTest;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
+import org.junit.BeforeClass;
 
 import static org.apache.polygene.test.util.Assume.assumeNoIbmJdk;
 
@@ -52,44 +49,28 @@ public class SQLiteEntityStoreTest
         super.assemble( module );
         ModuleAssembly config = module.layer().module( "config" );
         new EntityTestAssembler().assemble( config );
-        new OrgJsonValueSerializationAssembler().assemble( module );
 
         // START SNIPPET: assembly
         // DataSourceService
-        new DBCPDataSourceServiceAssembler().
-            identifiedBy( "sqlite-datasource-service" ).
-            visibleIn( Visibility.module ).
-            withConfig( config, Visibility.layer ).
-            assemble( module );
+        new DBCPDataSourceServiceAssembler()
+            .identifiedBy( "sqlite-datasource-service" )
+            .visibleIn( Visibility.module )
+            .withConfig( config, Visibility.layer )
+            .assemble( module );
 
         // DataSource
-        new DataSourceAssembler().
-            withDataSourceServiceIdentity( "sqlite-datasource-service" ).
-            identifiedBy( "sqlite-datasource" ).
-            visibleIn( Visibility.module ).
-            withCircuitBreaker().
-            assemble( module );
+        new DataSourceAssembler()
+            .withDataSourceServiceIdentity( "sqlite-datasource-service" )
+            .identifiedBy( "sqlite-datasource" )
+            .visibleIn( Visibility.module )
+            .withCircuitBreaker()
+            .assemble( module );
 
         // SQL EntityStore
-        new SQLiteEntityStoreAssembler().
-            visibleIn( Visibility.application ).
-            withConfig( config, Visibility.layer ).
-            assemble( module );
+        new SQLiteEntityStoreAssembler()
+            .visibleIn( Visibility.application )
+            .withConfig( config, Visibility.layer )
+            .assemble( module );
     }
     // END SNIPPET: assembly
-
-    @Override
-    public void tearDown()
-        throws Exception
-    {
-        try
-        {
-            FileUtil.removeDirectory( new File( "target/polygene-data" ) );
-        }
-        finally
-        {
-            super.tearDown();
-        }
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-sql/src/test/resources/mysql-datasource.properties
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/test/resources/mysql-datasource.properties b/extensions/entitystore-sql/src/test/resources/mysql-datasource.properties
index 6ace8dc..291d6a7 100644
--- a/extensions/entitystore-sql/src/test/resources/mysql-datasource.properties
+++ b/extensions/entitystore-sql/src/test/resources/mysql-datasource.properties
@@ -20,6 +20,6 @@
 
 enabled=true
 #url=jdbc:mysql://localhost:3306/jdbc_test_db?profileSQL=true&useLegacyDatetimeCode=false&serverTimezone=UTC
-driver=com.mysql.jdbc.Driver
+driver=com.mysql.cj.jdbc.Driver
 username=root
 password=

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexer.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexer.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexer.java
index 80172cc..ad023bd 100644
--- a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexer.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexer.java
@@ -19,10 +19,13 @@
  */
 package org.apache.polygene.index.elasticsearch;
 
-import java.util.Collections;
+import java.io.StringReader;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.stream.Collectors;
+import javax.json.Json;
+import javax.json.JsonArrayBuilder;
+import javax.json.JsonObjectBuilder;
+import javax.json.JsonValue;
 import org.apache.polygene.api.entity.EntityDescriptor;
 import org.apache.polygene.api.entity.EntityReference;
 import org.apache.polygene.api.identity.Identity;
@@ -30,15 +33,12 @@ import org.apache.polygene.api.injection.scope.Service;
 import org.apache.polygene.api.injection.scope.Structure;
 import org.apache.polygene.api.injection.scope.This;
 import org.apache.polygene.api.mixin.Mixins;
-import org.apache.polygene.api.service.qualifier.Tagged;
+import org.apache.polygene.api.serialization.Serializer;
 import org.apache.polygene.api.structure.ModuleDescriptor;
 import org.apache.polygene.api.time.SystemTime;
-import org.apache.polygene.api.type.ValueType;
 import org.apache.polygene.api.usecase.UsecaseBuilder;
 import org.apache.polygene.api.util.Classes;
-import org.apache.polygene.api.value.ValueSerialization;
-import org.apache.polygene.api.value.ValueSerializer;
-import org.apache.polygene.api.value.ValueSerializer.Options;
+import org.apache.polygene.serialization.javaxjson.JavaxJson;
 import org.apache.polygene.spi.entity.EntityState;
 import org.apache.polygene.spi.entity.EntityStatus;
 import org.apache.polygene.spi.entity.ManyAssociationState;
@@ -46,11 +46,9 @@ import org.apache.polygene.spi.entity.NamedAssociationState;
 import org.apache.polygene.spi.entitystore.EntityStore;
 import org.apache.polygene.spi.entitystore.EntityStoreUnitOfWork;
 import org.apache.polygene.spi.entitystore.StateChangeListener;
+import org.apache.polygene.spi.serialization.JsonSerializer;
 import org.elasticsearch.action.bulk.BulkRequestBuilder;
 import org.elasticsearch.action.bulk.BulkResponse;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -60,14 +58,11 @@ import org.slf4j.LoggerFactory;
  * QUID Use two indices, one for strict queries, one for full text and fuzzy search?
  */
 @Mixins( ElasticSearchIndexer.Mixin.class )
-public interface ElasticSearchIndexer
-    extends StateChangeListener
+public interface ElasticSearchIndexer extends StateChangeListener
 {
-
     class Mixin
         implements StateChangeListener
     {
-
         private static final Logger LOGGER = LoggerFactory.getLogger( ElasticSearchIndexer.class );
 
         @Structure
@@ -77,8 +72,7 @@ public interface ElasticSearchIndexer
         private EntityStore entityStore;
 
         @Service
-        @Tagged( ValueSerialization.Formats.JSON )
-        private ValueSerializer valueSerializer;
+        private JsonSerializer jsonSerializer;
 
         @This
         private ElasticSearchSupport support;
@@ -102,9 +96,9 @@ public interface ElasticSearchIndexer
             }
 
             EntityStoreUnitOfWork uow = entityStore.newUnitOfWork(
-                    module,
-                    UsecaseBuilder.newUsecase( "Load associations for indexing" ),
-                    SystemTime.now()
+                module,
+                UsecaseBuilder.newUsecase( "Load associations for indexing" ),
+                SystemTime.now()
             );
 
             // Bulk index request builder
@@ -117,27 +111,27 @@ public interface ElasticSearchIndexer
                 {
                     switch( changedState.status() )
                     {
-                    case REMOVED:
-                        LOGGER.trace( "Removing Entity State from Index: {}", changedState );
-                        remove( bulkBuilder, changedState.entityReference().identity().toString() );
-                        break;
-                    case UPDATED:
-                        LOGGER.trace( "Updating Entity State in Index: {}", changedState );
-                        remove( bulkBuilder, changedState.entityReference().identity().toString() );
-                        String updatedJson = toJSON( changedState, newStates, uow );
-                        LOGGER.trace( "Will index: {}", updatedJson );
-                        index( bulkBuilder, changedState.entityReference().identity().toString(), updatedJson );
-                        break;
-                    case NEW:
-                        LOGGER.trace( "Creating Entity State in Index: {}", changedState );
-                        String newJson = toJSON( changedState, newStates, uow );
-                        LOGGER.trace( "Will index: {}", newJson );
-                        index( bulkBuilder, changedState.entityReference().identity().toString(), newJson );
-                        break;
-                    case LOADED:
-                    default:
-                        // Ignored
-                        break;
+                        case REMOVED:
+                            LOGGER.trace( "Removing Entity State from Index: {}", changedState );
+                            remove( bulkBuilder, changedState.entityReference().identity().toString() );
+                            break;
+                        case UPDATED:
+                            LOGGER.trace( "Updating Entity State in Index: {}", changedState );
+                            remove( bulkBuilder, changedState.entityReference().identity().toString() );
+                            String updatedJson = toJSON( changedState, newStates, uow );
+                            LOGGER.trace( "Will index: {}", updatedJson );
+                            index( bulkBuilder, changedState.entityReference().identity().toString(), updatedJson );
+                            break;
+                        case NEW:
+                            LOGGER.trace( "Creating Entity State in Index: {}", changedState );
+                            String newJson = toJSON( changedState, newStates, uow );
+                            LOGGER.trace( "Will index: {}", newJson );
+                            index( bulkBuilder, changedState.entityReference().identity().toString(), newJson );
+                            break;
+                        case LOADED:
+                        default:
+                            // Ignored
+                            break;
                     }
                 }
             }
@@ -173,7 +167,7 @@ public interface ElasticSearchIndexer
         {
             bulkBuilder.add( support.client().
                 prepareIndex( support.index(), support.entitiesType(), identity ).
-                setSource( json ) );
+                                        setSource( json ) );
         }
 
         /**
@@ -190,72 +184,40 @@ public interface ElasticSearchIndexer
          */
         private String toJSON( EntityState state, Map<String, EntityState> newStates, EntityStoreUnitOfWork uow )
         {
-            JSONObject json = new JSONObject();
+            JsonObjectBuilder builder = Json.createObjectBuilder();
 
-            try
-            {
-                json.put( "_identity", state.entityReference().identity().toString() );
-                json.put( "_types", state.entityDescriptor()
-                    .mixinTypes()
-                    .map( Classes.toClassName() )
-                    .collect( Collectors.toList() ) );
-            }
-            catch( JSONException e )
-            {
-                throw new ElasticSearchIndexException( "Could not index EntityState", e );
-            }
+            builder.add( "_identity", state.entityReference().identity().toString() );
+
+            JsonArrayBuilder typesBuilder = Json.createArrayBuilder();
+            state.entityDescriptor().mixinTypes().map( Classes.toClassName() ).forEach( typesBuilder::add );
+            builder.add( "_types", typesBuilder.build() );
 
             EntityDescriptor entityType = state.entityDescriptor();
 
             // Properties
-            entityType.state().properties().forEach( propDesc -> {
-                try
+            entityType.state().properties().forEach(
+                propDesc ->
                 {
                     if( propDesc.queryable() )
                     {
                         String key = propDesc.qualifiedName().name();
                         Object value = state.propertyValueOf( propDesc.qualifiedName() );
-                        if( value == null || ValueType.isPrimitiveValue( value ) )
-                        {
-                            json.put( key, value );
-                        }
-                        else
-                        {
-                            String serialized = valueSerializer.serialize( new Options().withoutTypeInfo(), value );
-                            // TODO Theses tests are pretty fragile, find a better way to fix this, Jackson API should behave better
-                            if( serialized.startsWith( "{" ) )
-                            {
-                                json.put( key, new JSONObject( serialized ) );
-                            }
-                            else if( serialized.startsWith( "[" ) )
-                            {
-                                json.put( key, new JSONArray( serialized ) );
-                            }
-                            else
-                            {
-                                json.put( key, serialized );
-                            }
-                        }
+                        JsonValue jsonValue = jsonSerializer.toJson( Serializer.Options.NO_TYPE_INFO, value );
+                        builder.add( key, jsonValue );
                     }
-                }
-                catch( JSONException e )
-                {
-                    throw new ElasticSearchIndexException( "Could not index EntityState", e );
-                }
-            } );
+                } );
 
             // Associations
-            entityType.state().associations().forEach( assocDesc -> {
-                try
+            entityType.state().associations().forEach(
+                assocDesc ->
                 {
                     if( assocDesc.queryable() )
                     {
                         String key = assocDesc.qualifiedName().name();
                         EntityReference associated = state.associationValueOf( assocDesc.qualifiedName() );
-                        Object value;
                         if( associated == null )
                         {
-                            value = null;
+                            builder.add( key, JsonValue.NULL );
                         }
                         else
                         {
@@ -263,114 +225,120 @@ public interface ElasticSearchIndexer
                             {
                                 if( newStates.containsKey( associated.identity().toString() ) )
                                 {
-                                    value = new JSONObject( toJSON( newStates.get( associated.identity().toString() ), newStates, uow ) );
+                                    builder.add( key,
+                                                 Json.createReader( new StringReader(
+                                                     toJSON( newStates.get( associated.identity().toString() ),
+                                                             newStates, uow )
+                                                 ) ).readObject() );
                                 }
                                 else
                                 {
                                     EntityReference reference = EntityReference.create( associated.identity() );
                                     EntityState assocState = uow.entityStateOf( module, reference );
-                                    value = new JSONObject( toJSON( assocState, newStates, uow ) );
+                                    builder.add( key,
+                                                 Json.createReader( new StringReader(
+                                                     toJSON( assocState, newStates, uow )
+                                                 ) ).readObject() );
                                 }
                             }
                             else
                             {
-                                value = new JSONObject( Collections.singletonMap( "reference", associated.identity().toString() ) );
+                                builder.add( key, Json.createObjectBuilder()
+                                                      .add( "reference", associated.identity().toString() ) );
                             }
                         }
-                        json.put( key, value );
                     }
-                }
-                catch( JSONException e )
-                {
-                    throw new ElasticSearchIndexException( "Could not index EntityState", e );
-                }
-            } );
+                } );
 
             // ManyAssociations
-            entityType.state().manyAssociations().forEach( manyAssocDesc -> {
-                try
+            entityType.state().manyAssociations().forEach(
+                manyAssocDesc ->
                 {
                     if( manyAssocDesc.queryable() )
                     {
                         String key = manyAssocDesc.qualifiedName().name();
-                        JSONArray array = new JSONArray();
-                        ManyAssociationState associateds = state.manyAssociationValueOf( manyAssocDesc.qualifiedName() );
-                        for( EntityReference associated : associateds )
+                        JsonArrayBuilder assBuilder = Json.createArrayBuilder();
+                        ManyAssociationState assocs = state.manyAssociationValueOf( manyAssocDesc.qualifiedName() );
+                        for( EntityReference associated : assocs )
                         {
                             if( manyAssocDesc.isAggregated() || support.indexNonAggregatedAssociations() )
                             {
                                 if( newStates.containsKey( associated.identity().toString() ) )
                                 {
-                                    array.put( new JSONObject( toJSON( newStates.get( associated.identity().toString() ), newStates, uow ) ) );
+                                    assBuilder.add(
+                                        Json.createReader( new StringReader(
+                                            toJSON( newStates.get( associated.identity().toString() ), newStates, uow )
+                                        ) ).readObject() );
                                 }
                                 else
                                 {
                                     EntityReference reference = EntityReference.create( associated.identity() );
                                     EntityState assocState = uow.entityStateOf( module, reference );
-                                    array.put( new JSONObject( toJSON( assocState, newStates, uow ) ) );
+                                    assBuilder.add(
+                                        Json.createReader( new StringReader(
+                                            toJSON( assocState, newStates, uow )
+                                        ) ).readObject() );
                                 }
                             }
                             else
                             {
-                                array.put( new JSONObject( Collections.singletonMap( "reference", associated.identity().toString() ) ) );
+                                assBuilder.add( Json.createObjectBuilder().add( "reference",
+                                                                                associated.identity().toString() ) );
                             }
                         }
-                        json.put( key, array );
+                        builder.add( key, assBuilder.build() );
                     }
-                }
-                catch( JSONException e )
-                {
-                    throw new ElasticSearchIndexException( "Could not index EntityState", e );
-                }
-            } );
+                } );
 
             // NamedAssociations
-            entityType.state().namedAssociations().forEach( namedAssocDesc -> {
-                try
+            entityType.state().namedAssociations().forEach(
+                namedAssocDesc ->
                 {
                     if( namedAssocDesc.queryable() )
                     {
                         String key = namedAssocDesc.qualifiedName().name();
-                        JSONArray array = new JSONArray();
-                        NamedAssociationState associateds = state.namedAssociationValueOf( namedAssocDesc.qualifiedName() );
-                        for( String name : associateds )
+                        JsonArrayBuilder assBuilder = Json.createArrayBuilder();
+                        NamedAssociationState assocs = state.namedAssociationValueOf(
+                            namedAssocDesc.qualifiedName() );
+                        for( String name : assocs )
                         {
-                            Identity identity = associateds.get(name).identity();
+                            Identity identity = assocs.get( name ).identity();
                             if( namedAssocDesc.isAggregated() || support.indexNonAggregatedAssociations() )
                             {
                                 String identityString = identity.toString();
                                 if( newStates.containsKey( identityString ) )
                                 {
-                                    JSONObject obj = new JSONObject( toJSON( newStates.get( identityString ), newStates, uow ) );
-                                    obj.put( "_named", name );
-                                    array.put( obj );
+                                    assBuilder.add(
+                                        JavaxJson.toBuilder(
+                                            Json.createReader( new StringReader(
+                                                toJSON( newStates.get( identityString ), newStates, uow ) )
+                                            ).readObject()
+                                        ).add( "_named", name ).build() );
                                 }
                                 else
                                 {
                                     EntityReference reference = EntityReference.create( identity );
                                     EntityState assocState = uow.entityStateOf( module, reference );
-                                    JSONObject obj = new JSONObject( toJSON( assocState, newStates, uow ) );
-                                    obj.put( "_named", name );
-                                    array.put( obj );
+                                    assBuilder.add(
+                                        JavaxJson.toBuilder(
+                                            Json.createReader( new StringReader(
+                                                toJSON( assocState, newStates, uow )
+                                            ) ).readObject()
+                                        ).add( "_named", name ).build() );
                                 }
                             }
                             else
                             {
-                                JSONObject obj = new JSONObject();
-                                obj.put( "_named", name );
-                                obj.put( "reference", identity.toString() );
-                                array.put( obj );
+                                assBuilder.add( Json.createObjectBuilder()
+                                                    .add( "_named", name )
+                                                    .add( "reference", identity.toString() )
+                                                    .build() );
                             }
                         }
-                        json.put( key, array );
+                        builder.add( key, assBuilder.build() );
                     }
-                }
-                catch( JSONException e )
-                {
-                    throw new ElasticSearchIndexException( "Could not index EntityState", e );
-                }
-            } );
-            return json.toString();
+                } );
+            return builder.build().toString();
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/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..ec60616 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
@@ -17,13 +17,11 @@
  */
 package org.apache.polygene.index.elasticsearch.assembly;
 
-import org.apache.polygene.api.value.ValueSerialization;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.index.elasticsearch.ElasticSearchConfiguration;
 import org.apache.polygene.index.elasticsearch.client.ESClientIndexQueryService;
 import org.apache.polygene.index.elasticsearch.internal.AbstractElasticSearchAssembler;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationService;
 import org.elasticsearch.client.Client;
 
 public class ESClientIndexQueryAssembler
@@ -45,9 +43,6 @@ public class ESClientIndexQueryAssembler
               .visibleIn( visibility() )
               .instantiateOnStartup();
 
-        module.services( OrgJsonValueSerializationService.class )
-              .taggedWith( ValueSerialization.Formats.JSON );
-
         if( hasConfig() )
         {
             configModule().entities( ElasticSearchConfiguration.class )

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/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..8142101 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
@@ -19,13 +19,11 @@
  */
 package org.apache.polygene.index.elasticsearch.assembly;
 
-import org.apache.polygene.api.value.ValueSerialization;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.index.elasticsearch.ElasticSearchClusterConfiguration;
 import org.apache.polygene.index.elasticsearch.cluster.ESClusterIndexQueryService;
 import org.apache.polygene.index.elasticsearch.internal.AbstractElasticSearchAssembler;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationService;
 
 public class ESClusterIndexQueryAssembler
     extends AbstractElasticSearchAssembler<ESClusterIndexQueryAssembler>
@@ -39,9 +37,6 @@ public class ESClusterIndexQueryAssembler
             visibleIn( visibility() ).
             instantiateOnStartup();
 
-        module.services( OrgJsonValueSerializationService.class ).
-            taggedWith( ValueSerialization.Formats.JSON );
-
         if( hasConfig() )
         {
             configModule().entities( ElasticSearchClusterConfiguration.class ).

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/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..b291038 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
@@ -19,13 +19,11 @@
  */
 package org.apache.polygene.index.elasticsearch.assembly;
 
-import org.apache.polygene.api.value.ValueSerialization;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.index.elasticsearch.ElasticSearchConfiguration;
 import org.apache.polygene.index.elasticsearch.filesystem.ESFilesystemIndexQueryService;
 import org.apache.polygene.index.elasticsearch.internal.AbstractElasticSearchAssembler;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationService;
 
 public class ESFilesystemIndexQueryAssembler
     extends AbstractElasticSearchAssembler<ESFilesystemIndexQueryAssembler>
@@ -39,9 +37,6 @@ public class ESFilesystemIndexQueryAssembler
             visibleIn( visibility() ).
             instantiateOnStartup();
 
-        module.services( OrgJsonValueSerializationService.class ).
-            taggedWith( ValueSerialization.Formats.JSON );
-
         if( hasConfig() )
         {
             configModule().entities( ElasticSearchConfiguration.class ).

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/indexing-rdf/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/build.gradle b/extensions/indexing-rdf/build.gradle
index e8295ed..8381dc7 100644
--- a/extensions/indexing-rdf/build.gradle
+++ b/extensions/indexing-rdf/build.gradle
@@ -33,7 +33,6 @@ dependencies {
   runtime polygene.core.runtime
 
   testCompile polygene.core.testsupport
-  testCompile polygene.extension( 'valueserialization-orgjson' )
   testCompile polygene.extension( 'entitystore-preferences' )
   testCompile polygene.extension( 'entitystore-jdbm' )
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/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..d53a095 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
@@ -21,7 +21,6 @@
 package org.apache.polygene.index.rdf.assembly;
 
 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;
@@ -30,7 +29,6 @@ import org.apache.polygene.index.rdf.query.RdfQueryParserFactory;
 import org.apache.polygene.library.rdf.entity.EntityStateSerializer;
 import org.apache.polygene.library.rdf.entity.EntityTypeSerializer;
 import org.apache.polygene.library.rdf.repository.MemoryRepositoryService;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationService;
 
 public class RdfMemoryStoreAssembler
     implements Assembler
@@ -64,7 +62,6 @@ public class RdfMemoryStoreAssembler
             .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/e4cca11e/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..3d3d406 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
@@ -20,7 +20,6 @@
 package org.apache.polygene.index.rdf.assembly;
 
 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;
@@ -29,7 +28,6 @@ import org.apache.polygene.index.rdf.query.RdfQueryParserFactory;
 import org.apache.polygene.library.rdf.entity.EntityStateSerializer;
 import org.apache.polygene.library.rdf.entity.EntityTypeSerializer;
 import org.apache.polygene.library.rdf.repository.NativeRepositoryService;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationService;
 
 public class RdfNativeSesameStoreAssembler
     implements Assembler
@@ -62,7 +60,6 @@ public class RdfNativeSesameStoreAssembler
             .visibleIn( indexingVisibility )
             .instantiateOnStartup();
         module.services( RdfQueryParserFactory.class ).visibleIn( indexingVisibility );
-        module.services( OrgJsonValueSerializationService.class ).taggedWith( ValueSerialization.Formats.JSON );
         module.objects( EntityStateSerializer.class, EntityTypeSerializer.class );
     }
 }


Mime
View raw message