polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [22/35] polygene-java git commit: Trying to unify the naming of all the extensions.
Date Sun, 28 May 2017 16:10:42 GMT
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-riak/src/main/java/org/apache/polygene/entitystore/riak/RiakEntityStoreService.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/src/main/java/org/apache/polygene/entitystore/riak/RiakEntityStoreService.java b/extensions/entitystore-riak/src/main/java/org/apache/polygene/entitystore/riak/RiakEntityStoreService.java
new file mode 100644
index 0000000..4f3b9ca
--- /dev/null
+++ b/extensions/entitystore-riak/src/main/java/org/apache/polygene/entitystore/riak/RiakEntityStoreService.java
@@ -0,0 +1,53 @@
+/*
+ *  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.riak;
+
+import org.apache.polygene.api.concern.Concerns;
+import org.apache.polygene.api.configuration.Configuration;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.service.ServiceActivation;
+import org.apache.polygene.library.locking.LockingAbstractComposite;
+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;
+import org.apache.polygene.spi.entitystore.helpers.MapEntityStoreActivation;
+import org.apache.polygene.spi.entitystore.helpers.MapEntityStoreMixin;
+
+/**
+ * Riak EntityStore service.
+ * <p>Can be used with Riak implementations of MapEntityStore.</p>
+ * <p>Based on {@link JSONMapEntityStoreMixin}</p>
+ */
+@Concerns( { StateChangeNotificationConcern.class, ConcurrentModificationCheckConcern.class } )
+@Mixins( { JSONMapEntityStoreMixin.class, MapEntityStoreMixin.class } )
+public interface RiakEntityStoreService
+    extends EntityStore,
+            EntityStateVersions,
+            MapEntityStoreActivation,
+            JSONMapEntityStoreActivation,
+            ServiceActivation,
+            LockingAbstractComposite,
+            Configuration,
+            RiakAccessors
+{
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-riak/src/main/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/src/main/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreMixin.java b/extensions/entitystore-riak/src/main/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreMixin.java
deleted file mode 100644
index 9417df5..0000000
--- a/extensions/entitystore-riak/src/main/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreMixin.java
+++ /dev/null
@@ -1,384 +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.riak;
-
-import com.basho.riak.client.api.RiakClient;
-import com.basho.riak.client.api.commands.buckets.StoreBucketProperties;
-import com.basho.riak.client.api.commands.kv.DeleteValue;
-import com.basho.riak.client.api.commands.kv.FetchValue;
-import com.basho.riak.client.api.commands.kv.ListKeys;
-import com.basho.riak.client.api.commands.kv.StoreValue;
-import com.basho.riak.client.core.RiakCluster;
-import com.basho.riak.client.core.RiakNode;
-import com.basho.riak.client.core.query.Location;
-import com.basho.riak.client.core.query.Namespace;
-import com.basho.riak.client.core.util.HostAndPort;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.security.GeneralSecurityException;
-import java.security.KeyStore;
-import java.security.Provider;
-import java.security.Security;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import java.util.concurrent.ExecutionException;
-import java.util.stream.Stream;
-import java.util.stream.StreamSupport;
-import org.apache.polygene.api.common.InvalidApplicationException;
-import org.apache.polygene.api.configuration.Configuration;
-import org.apache.polygene.api.entity.EntityDescriptor;
-import org.apache.polygene.api.entity.EntityReference;
-import org.apache.polygene.api.injection.scope.This;
-import org.apache.polygene.api.service.ServiceActivation;
-import org.apache.polygene.spi.entitystore.EntityNotFoundException;
-import org.apache.polygene.spi.entitystore.EntityStoreException;
-import org.apache.polygene.spi.entitystore.helpers.MapEntityStore;
-
-/**
- * Riak Protobuf implementation of MapEntityStore.
- */
-public class RiakMapEntityStoreMixin implements ServiceActivation, MapEntityStore, RiakAccessors
-{
-    private static final String DEFAULT_HOST = "127.0.0.1";
-    private static final int DEFAULT_PORT = 8087;
-
-    @This
-    private Configuration<RiakEntityStoreConfiguration> configuration;
-
-    private RiakClient riakClient;
-    private Namespace namespace;
-
-    @Override
-    public void activateService() throws Exception
-    {
-        // Load configuration
-        configuration.refresh();
-        RiakEntityStoreConfiguration config = configuration.get();
-        String bucketName = config.bucket().get();
-        List<String> hosts = config.hosts().get();
-
-        // Setup Riak Cluster Client
-        List<HostAndPort> hostsAndPorts = parseHosts( hosts );
-        RiakNode.Builder nodeBuilder = new RiakNode.Builder();
-        nodeBuilder = configureNodes( config, nodeBuilder );
-        nodeBuilder = configureAuthentication( config, nodeBuilder );
-        List<RiakNode> nodes = new ArrayList<>();
-        for( HostAndPort host : hostsAndPorts )
-        {
-            nodes.add( nodeBuilder.withRemoteAddress( host ).build() );
-        }
-        RiakCluster.Builder clusterBuilder = RiakCluster.builder( nodes );
-        clusterBuilder = configureCluster( config, clusterBuilder );
-
-        // Start Riak Cluster
-        RiakCluster cluster = clusterBuilder.build();
-        cluster.start();
-        namespace = new Namespace( bucketName );
-        riakClient = new RiakClient( cluster );
-
-        // Initialize Bucket
-        riakClient.execute( new StoreBucketProperties.Builder( namespace ).build() );
-    }
-
-    private RiakNode.Builder configureNodes( RiakEntityStoreConfiguration config, RiakNode.Builder nodeBuilder )
-    {
-        Integer minConnections = config.minConnections().get();
-        Integer maxConnections = config.maxConnections().get();
-        Boolean blockOnMaxConnections = config.blockOnMaxConnections().get();
-        Integer connectionTimeout = config.connectionTimeout().get();
-        Integer idleTimeout = config.idleTimeout().get();
-        if( minConnections != null )
-        {
-            nodeBuilder = nodeBuilder.withMinConnections( minConnections );
-        }
-        if( maxConnections != null )
-        {
-            nodeBuilder = nodeBuilder.withMaxConnections( maxConnections );
-        }
-        nodeBuilder = nodeBuilder.withBlockOnMaxConnections( blockOnMaxConnections );
-        if( connectionTimeout != null )
-        {
-            nodeBuilder = nodeBuilder.withConnectionTimeout( connectionTimeout );
-        }
-        if( idleTimeout != null )
-        {
-            nodeBuilder = nodeBuilder.withIdleTimeout( idleTimeout );
-        }
-        return nodeBuilder;
-    }
-
-    private RiakNode.Builder configureAuthentication( RiakEntityStoreConfiguration config,
-                                                      RiakNode.Builder nodeBuilder )
-        throws IOException, GeneralSecurityException
-    {
-        String username = config.username().get();
-        String password = config.password().get();
-        String truststoreType = config.truststoreType().get();
-        String truststorePath = config.truststorePath().get();
-        String truststorePassword = config.truststorePassword().get();
-        String keystoreType = config.keystoreType().get();
-        String keystorePath = config.keystorePath().get();
-        String keystorePassword = config.keystorePassword().get();
-        String keyPassword = config.keyPassword().get();
-        if( username != null )
-        {
-            // Eventually load BouncyCastle to support PKCS12
-            if( "PKCS12".equals( keystoreType ) || "PKCS12".equals( truststoreType ) )
-            {
-                Provider bc = Security.getProvider( "BC" );
-                if( bc == null )
-                {
-                    try
-                    {
-                        Class<?> bcType = Class.forName( "org.bouncycastle.jce.provider.BouncyCastleProvider" );
-                        Security.addProvider( (Provider) bcType.newInstance() );
-                    }
-                    catch( Exception ex )
-                    {
-                        throw new InvalidApplicationException(
-                            "Need to open a PKCS#12 but unable to register BouncyCastle, check your classpath", ex );
-                    }
-                }
-            }
-            KeyStore truststore = loadStore( truststoreType, truststorePath, truststorePassword );
-            if( keystorePath != null )
-            {
-                KeyStore keyStore = loadStore( keystoreType, keystorePath, keystorePassword );
-                nodeBuilder = nodeBuilder.withAuth( username, password, truststore, keyStore, keyPassword );
-            }
-            else
-            {
-                nodeBuilder = nodeBuilder.withAuth( username, password, truststore );
-            }
-        }
-        return nodeBuilder;
-    }
-
-    private KeyStore loadStore( String type, String path, String password )
-        throws IOException, GeneralSecurityException
-    {
-        try( InputStream keystoreInput = new FileInputStream( new File( path ) ) )
-        {
-            KeyStore keyStore = KeyStore.getInstance( type );
-            keyStore.load( keystoreInput, password.toCharArray() );
-            return keyStore;
-        }
-    }
-
-    private RiakCluster.Builder configureCluster( RiakEntityStoreConfiguration config,
-                                                  RiakCluster.Builder clusterBuilder )
-    {
-        Integer clusterExecutionAttempts = config.clusterExecutionAttempts().get();
-        if( clusterExecutionAttempts != null )
-        {
-            clusterBuilder = clusterBuilder.withExecutionAttempts( clusterExecutionAttempts );
-        }
-        return clusterBuilder;
-    }
-
-    @Override
-    public void passivateService() throws Exception
-    {
-        riakClient.shutdown();
-        riakClient = null;
-        namespace = null;
-    }
-
-    @Override
-    public RiakClient riakClient()
-    {
-        return riakClient;
-    }
-
-    @Override
-    public Namespace riakNamespace()
-    {
-        return namespace;
-    }
-
-    @Override
-    public Reader get( EntityReference entityReference )
-    {
-        try
-        {
-            Location location = new Location( namespace, entityReference.identity().toString() );
-            FetchValue fetch = new FetchValue.Builder( location ).build();
-            FetchValue.Response response = riakClient.execute( fetch );
-            if( response.isNotFound() )
-            {
-                throw new EntityNotFoundException( entityReference );
-            }
-            String jsonState = response.getValue( String.class );
-            return new StringReader( jsonState );
-        }
-        catch( InterruptedException | ExecutionException ex )
-        {
-            throw new EntityStoreException( "Unable to get Entity " + entityReference.identity(), ex );
-        }
-    }
-
-    @Override
-    public void applyChanges( MapChanges changes )
-    {
-        try
-        {
-            changes.visitMap( new MapChanger()
-            {
-                @Override
-                public Writer newEntity( EntityReference ref, EntityDescriptor entityDescriptor )
-                {
-                    return new StringWriter( 1000 )
-                    {
-                        @Override
-                        public void close() throws IOException
-                        {
-                            try
-                            {
-                                super.close();
-                                StoreValue store = new StoreValue.Builder( toString() )
-                                    .withLocation( new Location( namespace, ref.identity().toString() ) )
-                                    .build();
-                                riakClient.execute( store );
-                            }
-                            catch( InterruptedException | ExecutionException ex )
-                            {
-                                throw new EntityStoreException( "Unable to apply entity change: newEntity", ex );
-                            }
-                        }
-                    };
-                }
-
-                @Override
-                public Writer updateEntity( MapChange mapChange )
-                {
-                    return new StringWriter( 1000 )
-                    {
-                        @Override
-                        public void close() throws IOException
-                        {
-                            try
-                            {
-                                super.close();
-                                EntityReference reference = mapChange.reference();
-                                Location location = new Location( namespace, reference.identity().toString() );
-                                FetchValue fetch = new FetchValue.Builder( location ).build();
-                                FetchValue.Response response = riakClient.execute( fetch );
-                                if( response.isNotFound() )
-                                {
-                                    throw new EntityNotFoundException( reference );
-                                }
-                                StoreValue store = new StoreValue.Builder( toString() )
-                                    .withLocation( location )
-                                    .build();
-                                riakClient.execute( store );
-                            }
-                            catch( InterruptedException | ExecutionException ex )
-                            {
-                                throw new EntityStoreException( "Unable to apply entity change: updateEntity", ex );
-                            }
-                        }
-                    };
-                }
-
-                @Override
-                public void removeEntity( EntityReference ref, EntityDescriptor entityDescriptor )
-                {
-                    try
-                    {
-                        Location location = new Location( namespace, ref.identity().toString() );
-                        FetchValue fetch = new FetchValue.Builder( location ).build();
-                        FetchValue.Response response = riakClient.execute( fetch );
-                        if( response.isNotFound() )
-                        {
-                            throw new EntityNotFoundException( ref );
-                        }
-                        DeleteValue delete = new DeleteValue.Builder( location ).build();
-                        riakClient.execute( delete );
-                    }
-                    catch( InterruptedException | ExecutionException ex )
-                    {
-                        throw new EntityStoreException( "Unable to apply entity change: removeEntity", ex );
-                    }
-                }
-            } );
-        }
-        catch( Exception ex )
-        {
-            throw new EntityStoreException( "Unable to apply entity changes.", ex );
-        }
-    }
-
-    @Override
-    public Stream<Reader> entityStates()
-    {
-        try
-        {
-            ListKeys listKeys = new ListKeys.Builder( namespace ).build();
-            ListKeys.Response listKeysResponse = riakClient.execute( listKeys );
-            return StreamSupport
-                .stream( listKeysResponse.spliterator(), false )
-                .map( location ->
-                      {
-                          try
-                          {
-                              FetchValue fetch = new FetchValue.Builder( location ).build();
-                              FetchValue.Response response = riakClient.execute( fetch );
-                              return response.getValue( String.class );
-                          }
-                          catch( InterruptedException | ExecutionException ex )
-                          {
-                              throw new EntityStoreException( "Unable to get entity states.", ex );
-                          }
-                      } )
-                .filter( Objects::nonNull )
-                .map( StringReader::new );
-        }
-        catch( InterruptedException | ExecutionException ex )
-        {
-            throw new EntityStoreException( "Unable to get entity states.", ex );
-        }
-    }
-
-    private List<HostAndPort> parseHosts( List<String> hosts )
-    {
-        if( hosts.isEmpty() )
-        {
-            hosts.add( DEFAULT_HOST );
-        }
-        List<HostAndPort> addresses = new ArrayList<>( hosts.size() );
-        for( String host : hosts )
-        {
-            String[] splitted = host.split( ":" );
-            int port = DEFAULT_PORT;
-            if( splitted.length > 1 )
-            {
-                host = splitted[ 0 ];
-                port = Integer.valueOf( splitted[ 1 ] );
-            }
-            addresses.add( HostAndPort.fromParts( host, port ) );
-        }
-        return addresses;
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-riak/src/main/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreService.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/src/main/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreService.java b/extensions/entitystore-riak/src/main/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreService.java
deleted file mode 100644
index 8965a59..0000000
--- a/extensions/entitystore-riak/src/main/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreService.java
+++ /dev/null
@@ -1,53 +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.riak;
-
-import org.apache.polygene.api.concern.Concerns;
-import org.apache.polygene.api.configuration.Configuration;
-import org.apache.polygene.api.mixin.Mixins;
-import org.apache.polygene.api.service.ServiceActivation;
-import org.apache.polygene.library.locking.LockingAbstractComposite;
-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;
-import org.apache.polygene.spi.entitystore.helpers.MapEntityStoreActivation;
-import org.apache.polygene.spi.entitystore.helpers.MapEntityStoreMixin;
-
-/**
- * Riak EntityStore service.
- * <p>Can be used with Riak implementations of MapEntityStore.</p>
- * <p>Based on {@link JSONMapEntityStoreMixin}</p>
- */
-@Concerns( { StateChangeNotificationConcern.class, ConcurrentModificationCheckConcern.class } )
-@Mixins( { JSONMapEntityStoreMixin.class, MapEntityStoreMixin.class } )
-public interface RiakMapEntityStoreService
-    extends EntityStore,
-            EntityStateVersions,
-            MapEntityStoreActivation,
-            JSONMapEntityStoreActivation,
-            ServiceActivation,
-            LockingAbstractComposite,
-            Configuration,
-            RiakAccessors
-{
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-riak/src/main/java/org/apache/polygene/entitystore/riak/assembly/RiakEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/src/main/java/org/apache/polygene/entitystore/riak/assembly/RiakEntityStoreAssembler.java b/extensions/entitystore-riak/src/main/java/org/apache/polygene/entitystore/riak/assembly/RiakEntityStoreAssembler.java
index 8174ed9..68f5e8d 100644
--- a/extensions/entitystore-riak/src/main/java/org/apache/polygene/entitystore/riak/assembly/RiakEntityStoreAssembler.java
+++ b/extensions/entitystore-riak/src/main/java/org/apache/polygene/entitystore/riak/assembly/RiakEntityStoreAssembler.java
@@ -22,8 +22,8 @@ import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.ServiceDeclaration;
 import org.apache.polygene.entitystore.riak.RiakEntityStoreConfiguration;
-import org.apache.polygene.entitystore.riak.RiakMapEntityStoreMixin;
-import org.apache.polygene.entitystore.riak.RiakMapEntityStoreService;
+import org.apache.polygene.entitystore.riak.RiakEntityStoreMixin;
+import org.apache.polygene.entitystore.riak.RiakEntityStoreService;
 
 /**
  * Riak EntityStore assembly.
@@ -34,8 +34,8 @@ public class RiakEntityStoreAssembler
     @Override
     public void assemble(ModuleAssembly module) throws AssemblyException
     {
-        ServiceDeclaration service = module.services( RiakMapEntityStoreService.class ).
-                withMixins( RiakMapEntityStoreMixin.class ).
+        ServiceDeclaration service = module.services( RiakEntityStoreService.class ).
+            withMixins( RiakEntityStoreMixin.class ).
                 visibleIn( visibility() );
         if( hasIdentity() )
         {

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakEntityStoreTest.java b/extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakEntityStoreTest.java
new file mode 100644
index 0000000..621cebb
--- /dev/null
+++ b/extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakEntityStoreTest.java
@@ -0,0 +1,71 @@
+/*
+ *  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.riak;
+
+import java.util.Collections;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.entitystore.riak.assembly.RiakEntityStoreAssembler;
+import org.apache.polygene.test.EntityTestAssembler;
+import org.apache.polygene.test.entity.AbstractEntityStoreTest;
+import org.apache.polygene.test.internal.DockerRule;
+import org.junit.ClassRule;
+
+public class RiakEntityStoreTest extends AbstractEntityStoreTest
+{
+    @ClassRule
+    public static final DockerRule DOCKER = new DockerRule( "riak","riak_auth_mods started on node");
+
+    private RiakFixture riakFixture;
+
+    @Override
+    public void setUp() throws Exception
+    {
+        super.setUp();
+        RiakEntityStoreService es = serviceFinder.findService( RiakEntityStoreService.class ).get();
+        riakFixture = new RiakFixture( es.riakClient(), es.riakNamespace() );
+        riakFixture.waitUntilReady();
+    }
+
+    @Override
+    public void tearDown() throws Exception
+    {
+        riakFixture.deleteTestData();
+        super.tearDown();
+    }
+
+    @Override
+    // START SNIPPET: assembly
+    public void assemble( ModuleAssembly module )
+    {
+        // END SNIPPET: assembly
+        super.assemble( module );
+        ModuleAssembly config = module.layer().module( "config" );
+        new EntityTestAssembler().assemble( config );
+        // START SNIPPET: assembly
+        new RiakEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
+        // END SNIPPET: assembly
+        RiakEntityStoreConfiguration riakConfig = config.forMixin( RiakEntityStoreConfiguration.class )
+                                                        .declareDefaults();
+        String host = DOCKER.getDockerHost();
+        int port = DOCKER.getExposedContainerPort( "8087/tcp" );
+        riakConfig.hosts().set( Collections.singletonList( host + ':' + port ) );
+        // START SNIPPET: assembly
+    }
+    // END SNIPPET: assembly
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakEntityStoreWithCacheTest.java b/extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakEntityStoreWithCacheTest.java
new file mode 100644
index 0000000..1647508
--- /dev/null
+++ b/extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakEntityStoreWithCacheTest.java
@@ -0,0 +1,69 @@
+/*
+ *  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.riak;
+
+import java.util.Collections;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.entitystore.riak.assembly.RiakEntityStoreAssembler;
+import org.apache.polygene.test.EntityTestAssembler;
+import org.apache.polygene.test.cache.AbstractEntityStoreWithCacheTest;
+import org.apache.polygene.test.internal.DockerRule;
+import org.junit.ClassRule;
+
+public class RiakEntityStoreWithCacheTest extends AbstractEntityStoreWithCacheTest
+{
+    @ClassRule
+    public static final DockerRule DOCKER = new DockerRule( "riak","riak_auth_mods started on node");
+
+    private RiakFixture riakFixture;
+
+    @Override
+    public void setUp() throws Exception
+    {
+        super.setUp();
+        RiakEntityStoreService es = serviceFinder.findService( RiakEntityStoreService.class ).get();
+        riakFixture = new RiakFixture( es.riakClient(), es.riakNamespace() );
+        riakFixture.waitUntilReady();
+    }
+
+    @Override
+    public void tearDown() throws Exception
+    {
+        riakFixture.deleteTestData();
+        super.tearDown();
+    }
+
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        super.assemble( module );
+        ModuleAssembly config = module.layer().module( "config" );
+        new EntityTestAssembler().assemble( config );
+        new RiakEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
+        RiakEntityStoreConfiguration riakConfig = config.forMixin( RiakEntityStoreConfiguration.class )
+                                                        .declareDefaults();
+        String host = DOCKER.getDockerHost();
+        int port = DOCKER.getExposedContainerPort( "8087/tcp" );
+        riakConfig.hosts().set( Collections.singletonList( host + ':' + port ) );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreTest.java b/extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreTest.java
deleted file mode 100644
index c43d846..0000000
--- a/extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreTest.java
+++ /dev/null
@@ -1,71 +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.riak;
-
-import java.util.Collections;
-import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.entitystore.riak.assembly.RiakEntityStoreAssembler;
-import org.apache.polygene.test.EntityTestAssembler;
-import org.apache.polygene.test.entity.AbstractEntityStoreTest;
-import org.apache.polygene.test.internal.DockerRule;
-import org.junit.ClassRule;
-
-public class RiakMapEntityStoreTest extends AbstractEntityStoreTest
-{
-    @ClassRule
-    public static final DockerRule DOCKER = new DockerRule( "riak","riak_auth_mods started on node");
-
-    private RiakFixture riakFixture;
-
-    @Override
-    public void setUp() throws Exception
-    {
-        super.setUp();
-        RiakMapEntityStoreService es = serviceFinder.findService( RiakMapEntityStoreService.class ).get();
-        riakFixture = new RiakFixture( es.riakClient(), es.riakNamespace() );
-        riakFixture.waitUntilReady();
-    }
-
-    @Override
-    public void tearDown() throws Exception
-    {
-        riakFixture.deleteTestData();
-        super.tearDown();
-    }
-
-    @Override
-    // START SNIPPET: assembly
-    public void assemble( ModuleAssembly module )
-    {
-        // END SNIPPET: assembly
-        super.assemble( module );
-        ModuleAssembly config = module.layer().module( "config" );
-        new EntityTestAssembler().assemble( config );
-        // START SNIPPET: assembly
-        new RiakEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
-        // END SNIPPET: assembly
-        RiakEntityStoreConfiguration riakConfig = config.forMixin( RiakEntityStoreConfiguration.class )
-                                                        .declareDefaults();
-        String host = DOCKER.getDockerHost();
-        int port = DOCKER.getExposedContainerPort( "8087/tcp" );
-        riakConfig.hosts().set( Collections.singletonList( host + ':' + port ) );
-        // START SNIPPET: assembly
-    }
-    // END SNIPPET: assembly
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreWithCacheTest.java b/extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreWithCacheTest.java
deleted file mode 100644
index ac4f3ec..0000000
--- a/extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreWithCacheTest.java
+++ /dev/null
@@ -1,69 +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.riak;
-
-import java.util.Collections;
-import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.entitystore.riak.assembly.RiakEntityStoreAssembler;
-import org.apache.polygene.test.EntityTestAssembler;
-import org.apache.polygene.test.cache.AbstractEntityStoreWithCacheTest;
-import org.apache.polygene.test.internal.DockerRule;
-import org.junit.ClassRule;
-
-public class RiakMapEntityStoreWithCacheTest extends AbstractEntityStoreWithCacheTest
-{
-    @ClassRule
-    public static final DockerRule DOCKER = new DockerRule( "riak","riak_auth_mods started on node");
-
-    private RiakFixture riakFixture;
-
-    @Override
-    public void setUp() throws Exception
-    {
-        super.setUp();
-        RiakMapEntityStoreService es = serviceFinder.findService( RiakMapEntityStoreService.class ).get();
-        riakFixture = new RiakFixture( es.riakClient(), es.riakNamespace() );
-        riakFixture.waitUntilReady();
-    }
-
-    @Override
-    public void tearDown() throws Exception
-    {
-        riakFixture.deleteTestData();
-        super.tearDown();
-    }
-
-    @Override
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        super.assemble( module );
-        ModuleAssembly config = module.layer().module( "config" );
-        new EntityTestAssembler().assemble( config );
-        new RiakEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
-        RiakEntityStoreConfiguration riakConfig = config.forMixin( RiakEntityStoreConfiguration.class )
-                                                        .declareDefaults();
-        String host = DOCKER.getDockerHost();
-        int port = DOCKER.getExposedContainerPort( "8087/tcp" );
-        riakConfig.hosts().set( Collections.singletonList( host + ':' + port ) );
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLEntityStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLEntityStoreConfiguration.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLEntityStoreConfiguration.java
new file mode 100644
index 0000000..19658ea
--- /dev/null
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLEntityStoreConfiguration.java
@@ -0,0 +1,47 @@
+/*
+ *  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.sql;
+
+import org.apache.polygene.api.common.UseDefaults;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.library.sql.common.SQLConfiguration;
+
+// START SNIPPET: config
+public interface SQLEntityStoreConfiguration extends SQLConfiguration
+{
+    /**
+     * Name of the database schema to use.
+     * Ignored on SQL databases that don't support schemas.
+     */
+    @UseDefaults( "POLYGENE_ES" )
+    @Override
+    Property<String> schemaName();
+
+    /**
+     * Name of the entities table.
+     */
+    @UseDefaults( "POLYGENE_ENTITIES" )
+    Property<String> entityTableName();
+
+    /**
+     * Defines whether the database schema and table should be created if not already present.
+     */
+    @UseDefaults( "true" )
+    Property<Boolean> createIfMissing();
+}
+// END SNIPPET: config

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLEntityStoreMixin.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLEntityStoreMixin.java
new file mode 100644
index 0000000..293ce58
--- /dev/null
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLEntityStoreMixin.java
@@ -0,0 +1,244 @@
+/*
+ *  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.sql;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Stream;
+import javax.sql.DataSource;
+import liquibase.Contexts;
+import liquibase.Liquibase;
+import liquibase.database.Database;
+import liquibase.database.ObjectQuotingStrategy;
+import liquibase.exception.LiquibaseException;
+import org.apache.polygene.api.configuration.Configuration;
+import org.apache.polygene.api.entity.EntityDescriptor;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.api.injection.scope.Service;
+import org.apache.polygene.api.injection.scope.This;
+import org.apache.polygene.api.injection.scope.Uses;
+import org.apache.polygene.api.service.ServiceActivation;
+import org.apache.polygene.api.service.ServiceDescriptor;
+import org.apache.polygene.library.sql.liquibase.LiquibaseService;
+import org.apache.polygene.serialization.javaxjson.JavaxJsonFactories;
+import org.apache.polygene.spi.entitystore.EntityNotFoundException;
+import org.apache.polygene.spi.entitystore.helpers.JSONKeys;
+import org.apache.polygene.spi.entitystore.helpers.MapEntityStore;
+import org.jooq.DSLContext;
+import org.jooq.Field;
+import org.jooq.Query;
+import org.jooq.Record;
+import org.jooq.SQLDialect;
+import org.jooq.Schema;
+import org.jooq.Table;
+import org.jooq.conf.Settings;
+import org.jooq.impl.DSL;
+
+public class SQLEntityStoreMixin
+    implements ServiceActivation, MapEntityStore
+{
+    private static final String TABLE_NAME_LIQUIBASE_PARAMETER = "es-sql.table";
+    private static final String IDENTITY_COLUMN_NAME = "ENTITY_IDENTITY";
+    private static final String VERSION_COLUMN_NAME = "ENTITY_VERSION";
+    private static final String STATE_COLUMN_NAME = "ENTITY_STATE";
+
+    @Service
+    private DataSource dataSource;
+
+    @Service
+    private LiquibaseService liquibaseService;
+
+    @Service
+    private JavaxJsonFactories jsonFactories;
+
+    @Uses
+    private ServiceDescriptor descriptor;
+
+    @This
+    private Configuration<SQLEntityStoreConfiguration> configuration;
+
+    private Schema schema;
+    private Table<Record> table;
+    private Field<String> identityColumn;
+    private Field<String> versionColumn;
+    private Field<String> stateColumn;
+    private DSLContext dsl;
+
+    @Override
+    public void activateService() throws Exception
+    {
+        configuration.refresh();
+        SQLEntityStoreConfiguration config = configuration.get();
+
+        // Prepare jooq DSL
+        SQLDialect dialect = descriptor.metaInfo( SQLDialect.class );
+        Settings settings = descriptor.metaInfo( Settings.class );
+        String schemaName = config.schemaName().get();
+        String tableName = config.entityTableName().get();
+        schema = DSL.schema( DSL.name( schemaName ) );
+        table = DSL.table(
+            dialect.equals( SQLDialect.SQLITE )
+            ? DSL.name( tableName )
+            : DSL.name( schema.getName(), tableName )
+        );
+        identityColumn = DSL.field( DSL.name( IDENTITY_COLUMN_NAME ), String.class );
+        versionColumn = DSL.field( DSL.name( VERSION_COLUMN_NAME ), String.class );
+        stateColumn = DSL.field( DSL.name( STATE_COLUMN_NAME ), String.class );
+        dsl = DSL.using( dataSource, dialect, settings );
+
+        // Eventually create schema and apply Liquibase changelog
+        if( config.createIfMissing().get() )
+        {
+            if( !dialect.equals( SQLDialect.SQLITE )
+                && dsl.meta().getSchemas().stream().noneMatch( s -> schema.getName().equalsIgnoreCase( s.getName() ) ) )
+            {
+                dsl.createSchema( schema ).execute();
+            }
+
+            applyLiquibaseChangelog( dialect );
+        }
+    }
+
+    private void applyLiquibaseChangelog( SQLDialect dialect ) throws SQLException, LiquibaseException
+    {
+        Liquibase liquibase = liquibaseService.newConnectedLiquibase();
+        Database db = liquibase.getDatabase();
+        db.setObjectQuotingStrategy( ObjectQuotingStrategy.QUOTE_ALL_OBJECTS );
+        try
+        {
+            if( !dialect.equals( SQLDialect.SQLITE ) )
+            {
+                if( db.supportsSchemas() )
+                {
+                    db.setDefaultSchemaName( schema.getName() );
+                    db.setLiquibaseSchemaName( schema.getName() );
+                }
+                if( db.supportsCatalogs() )
+                {
+                    db.setDefaultCatalogName( schema.getName() );
+                    db.setLiquibaseCatalogName( schema.getName() );
+                }
+            }
+            liquibase.getChangeLogParameters().set( TABLE_NAME_LIQUIBASE_PARAMETER, table.getName() );
+            liquibase.update( new Contexts() );
+        }
+        finally
+        {
+            db.close();
+        }
+    }
+
+    @Override
+    public void passivateService() throws Exception
+    {
+        dsl = null;
+        schema = null;
+        table = null;
+        identityColumn = null;
+        versionColumn = null;
+        stateColumn = null;
+    }
+
+    @Override
+    public Reader get( EntityReference entityReference )
+    {
+        String state = dsl.select( stateColumn )
+                          .from( table )
+                          .where( identityColumn.equal( entityReference.identity().toString() ) )
+                          .fetchOptional( stateColumn )
+                          .orElseThrow( () -> new EntityNotFoundException( entityReference ) );
+        return new StringReader( state );
+    }
+
+    @Override
+    public Stream<Reader> entityStates()
+    {
+        return dsl.select( stateColumn )
+                  .from( table )
+                  .fetch( stateColumn )
+                  .stream()
+                  .map( StringReader::new );
+    }
+
+    @Override
+    public void applyChanges( MapChanges changes ) throws Exception
+    {
+        List<Query> operations = new ArrayList<>();
+        changes.visitMap( new MapChanger()
+        {
+            @Override
+            public Writer newEntity( EntityReference ref, EntityDescriptor entityDescriptor )
+            {
+                return new StringWriter( 1000 )
+                {
+                    @Override
+                    public void close() throws IOException
+                    {
+                        super.close();
+                        String state = toString();
+                        String version = jsonFactories.readerFactory().createReader( new StringReader( state ) )
+                                                      .readObject()
+                                                      .getString( JSONKeys.VERSION );
+                        operations.add(
+                            dsl.insertInto( table )
+                               .columns( identityColumn, versionColumn, stateColumn )
+                               .values( ref.identity().toString(), version, state )
+                        );
+                    }
+                };
+            }
+
+            @Override
+            public Writer updateEntity( MapChange mapChange )
+            {
+                return new StringWriter( 1000 )
+                {
+                    @Override
+                    public void close() throws IOException
+                    {
+                        super.close();
+                        String state = toString();
+                        operations.add(
+                            dsl.update( table )
+                               .set( versionColumn, mapChange.newVersion() )
+                               .set( stateColumn, state )
+                               .where( identityColumn.equal( mapChange.reference().identity().toString() ) )
+                               .and( versionColumn.equal( mapChange.previousVersion() ) )
+                        );
+                    }
+                };
+            }
+
+            @Override
+            public void removeEntity( EntityReference ref, EntityDescriptor entityDescriptor )
+            {
+                operations.add(
+                    dsl.deleteFrom( table )
+                       .where( identityColumn.equal( ref.identity().toString() ) )
+                );
+            }
+        } );
+        dsl.batch( operations ).execute();
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLEntityStoreService.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLEntityStoreService.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLEntityStoreService.java
new file mode 100644
index 0000000..9e4e0e7
--- /dev/null
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLEntityStoreService.java
@@ -0,0 +1,43 @@
+/*
+ *  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.sql;
+
+import org.apache.polygene.api.concern.Concerns;
+import org.apache.polygene.api.configuration.Configuration;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.service.ServiceActivation;
+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;
+
+/**
+ * SQL EntityStore service.
+ */
+@Concerns( { StateChangeNotificationConcern.class, ConcurrentModificationCheckConcern.class } )
+@Mixins( { JSONMapEntityStoreMixin.class, SQLEntityStoreMixin.class } )
+public interface SQLEntityStoreService
+    extends ServiceActivation,
+    JSONMapEntityStoreActivation,
+    EntityStore,
+    EntityStateVersions,
+    Configuration
+{
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLMapEntityStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLMapEntityStoreConfiguration.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLMapEntityStoreConfiguration.java
deleted file mode 100644
index cd832c0..0000000
--- a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLMapEntityStoreConfiguration.java
+++ /dev/null
@@ -1,47 +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.sql;
-
-import org.apache.polygene.api.common.UseDefaults;
-import org.apache.polygene.api.property.Property;
-import org.apache.polygene.library.sql.common.SQLConfiguration;
-
-// START SNIPPET: config
-public interface SQLMapEntityStoreConfiguration extends SQLConfiguration
-{
-    /**
-     * Name of the database schema to use.
-     * Ignored on SQL databases that don't support schemas.
-     */
-    @UseDefaults( "POLYGENE_ES" )
-    @Override
-    Property<String> schemaName();
-
-    /**
-     * Name of the entities table.
-     */
-    @UseDefaults( "POLYGENE_ENTITIES" )
-    Property<String> entityTableName();
-
-    /**
-     * Defines whether the database schema and table should be created if not already present.
-     */
-    @UseDefaults( "true" )
-    Property<Boolean> createIfMissing();
-}
-// END SNIPPET: config

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLMapEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLMapEntityStoreMixin.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLMapEntityStoreMixin.java
deleted file mode 100644
index 682a5f7..0000000
--- a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLMapEntityStoreMixin.java
+++ /dev/null
@@ -1,244 +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.sql;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Stream;
-import javax.sql.DataSource;
-import liquibase.Contexts;
-import liquibase.Liquibase;
-import liquibase.database.Database;
-import liquibase.database.ObjectQuotingStrategy;
-import liquibase.exception.LiquibaseException;
-import org.apache.polygene.api.configuration.Configuration;
-import org.apache.polygene.api.entity.EntityDescriptor;
-import org.apache.polygene.api.entity.EntityReference;
-import org.apache.polygene.api.injection.scope.Service;
-import org.apache.polygene.api.injection.scope.This;
-import org.apache.polygene.api.injection.scope.Uses;
-import org.apache.polygene.api.service.ServiceActivation;
-import org.apache.polygene.api.service.ServiceDescriptor;
-import org.apache.polygene.library.sql.liquibase.LiquibaseService;
-import org.apache.polygene.serialization.javaxjson.JavaxJsonFactories;
-import org.apache.polygene.spi.entitystore.EntityNotFoundException;
-import org.apache.polygene.spi.entitystore.helpers.JSONKeys;
-import org.apache.polygene.spi.entitystore.helpers.MapEntityStore;
-import org.jooq.DSLContext;
-import org.jooq.Field;
-import org.jooq.Query;
-import org.jooq.Record;
-import org.jooq.SQLDialect;
-import org.jooq.Schema;
-import org.jooq.Table;
-import org.jooq.conf.Settings;
-import org.jooq.impl.DSL;
-
-public class SQLMapEntityStoreMixin
-    implements ServiceActivation, MapEntityStore
-{
-    private static final String TABLE_NAME_LIQUIBASE_PARAMETER = "es-sql.table";
-    private static final String IDENTITY_COLUMN_NAME = "ENTITY_IDENTITY";
-    private static final String VERSION_COLUMN_NAME = "ENTITY_VERSION";
-    private static final String STATE_COLUMN_NAME = "ENTITY_STATE";
-
-    @Service
-    private DataSource dataSource;
-
-    @Service
-    private LiquibaseService liquibaseService;
-
-    @Service
-    private JavaxJsonFactories jsonFactories;
-
-    @Uses
-    private ServiceDescriptor descriptor;
-
-    @This
-    private Configuration<SQLMapEntityStoreConfiguration> configuration;
-
-    private Schema schema;
-    private Table<Record> table;
-    private Field<String> identityColumn;
-    private Field<String> versionColumn;
-    private Field<String> stateColumn;
-    private DSLContext dsl;
-
-    @Override
-    public void activateService() throws Exception
-    {
-        configuration.refresh();
-        SQLMapEntityStoreConfiguration config = configuration.get();
-
-        // Prepare jooq DSL
-        SQLDialect dialect = descriptor.metaInfo( SQLDialect.class );
-        Settings settings = descriptor.metaInfo( Settings.class );
-        String schemaName = config.schemaName().get();
-        String tableName = config.entityTableName().get();
-        schema = DSL.schema( DSL.name( schemaName ) );
-        table = DSL.table(
-            dialect.equals( SQLDialect.SQLITE )
-            ? DSL.name( tableName )
-            : DSL.name( schema.getName(), tableName )
-        );
-        identityColumn = DSL.field( DSL.name( IDENTITY_COLUMN_NAME ), String.class );
-        versionColumn = DSL.field( DSL.name( VERSION_COLUMN_NAME ), String.class );
-        stateColumn = DSL.field( DSL.name( STATE_COLUMN_NAME ), String.class );
-        dsl = DSL.using( dataSource, dialect, settings );
-
-        // Eventually create schema and apply Liquibase changelog
-        if( config.createIfMissing().get() )
-        {
-            if( !dialect.equals( SQLDialect.SQLITE )
-                && dsl.meta().getSchemas().stream().noneMatch( s -> schema.getName().equalsIgnoreCase( s.getName() ) ) )
-            {
-                dsl.createSchema( schema ).execute();
-            }
-
-            applyLiquibaseChangelog( dialect );
-        }
-    }
-
-    private void applyLiquibaseChangelog( SQLDialect dialect ) throws SQLException, LiquibaseException
-    {
-        Liquibase liquibase = liquibaseService.newConnectedLiquibase();
-        Database db = liquibase.getDatabase();
-        db.setObjectQuotingStrategy( ObjectQuotingStrategy.QUOTE_ALL_OBJECTS );
-        try
-        {
-            if( !dialect.equals( SQLDialect.SQLITE ) )
-            {
-                if( db.supportsSchemas() )
-                {
-                    db.setDefaultSchemaName( schema.getName() );
-                    db.setLiquibaseSchemaName( schema.getName() );
-                }
-                if( db.supportsCatalogs() )
-                {
-                    db.setDefaultCatalogName( schema.getName() );
-                    db.setLiquibaseCatalogName( schema.getName() );
-                }
-            }
-            liquibase.getChangeLogParameters().set( TABLE_NAME_LIQUIBASE_PARAMETER, table.getName() );
-            liquibase.update( new Contexts() );
-        }
-        finally
-        {
-            db.close();
-        }
-    }
-
-    @Override
-    public void passivateService() throws Exception
-    {
-        dsl = null;
-        schema = null;
-        table = null;
-        identityColumn = null;
-        versionColumn = null;
-        stateColumn = null;
-    }
-
-    @Override
-    public Reader get( EntityReference entityReference )
-    {
-        String state = dsl.select( stateColumn )
-                          .from( table )
-                          .where( identityColumn.equal( entityReference.identity().toString() ) )
-                          .fetchOptional( stateColumn )
-                          .orElseThrow( () -> new EntityNotFoundException( entityReference ) );
-        return new StringReader( state );
-    }
-
-    @Override
-    public Stream<Reader> entityStates()
-    {
-        return dsl.select( stateColumn )
-                  .from( table )
-                  .fetch( stateColumn )
-                  .stream()
-                  .map( StringReader::new );
-    }
-
-    @Override
-    public void applyChanges( MapChanges changes ) throws Exception
-    {
-        List<Query> operations = new ArrayList<>();
-        changes.visitMap( new MapChanger()
-        {
-            @Override
-            public Writer newEntity( EntityReference ref, EntityDescriptor entityDescriptor )
-            {
-                return new StringWriter( 1000 )
-                {
-                    @Override
-                    public void close() throws IOException
-                    {
-                        super.close();
-                        String state = toString();
-                        String version = jsonFactories.readerFactory().createReader( new StringReader( state ) )
-                                                      .readObject()
-                                                      .getString( JSONKeys.VERSION );
-                        operations.add(
-                            dsl.insertInto( table )
-                               .columns( identityColumn, versionColumn, stateColumn )
-                               .values( ref.identity().toString(), version, state )
-                        );
-                    }
-                };
-            }
-
-            @Override
-            public Writer updateEntity( MapChange mapChange )
-            {
-                return new StringWriter( 1000 )
-                {
-                    @Override
-                    public void close() throws IOException
-                    {
-                        super.close();
-                        String state = toString();
-                        operations.add(
-                            dsl.update( table )
-                               .set( versionColumn, mapChange.newVersion() )
-                               .set( stateColumn, state )
-                               .where( identityColumn.equal( mapChange.reference().identity().toString() ) )
-                               .and( versionColumn.equal( mapChange.previousVersion() ) )
-                        );
-                    }
-                };
-            }
-
-            @Override
-            public void removeEntity( EntityReference ref, EntityDescriptor entityDescriptor )
-            {
-                operations.add(
-                    dsl.deleteFrom( table )
-                       .where( identityColumn.equal( ref.identity().toString() ) )
-                );
-            }
-        } );
-        dsl.batch( operations ).execute();
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLMapEntityStoreService.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLMapEntityStoreService.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLMapEntityStoreService.java
deleted file mode 100644
index 341de3b..0000000
--- a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLMapEntityStoreService.java
+++ /dev/null
@@ -1,43 +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.sql;
-
-import org.apache.polygene.api.concern.Concerns;
-import org.apache.polygene.api.configuration.Configuration;
-import org.apache.polygene.api.mixin.Mixins;
-import org.apache.polygene.api.service.ServiceActivation;
-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;
-
-/**
- * SQL EntityStore service.
- */
-@Concerns( { StateChangeNotificationConcern.class, ConcurrentModificationCheckConcern.class } )
-@Mixins( { JSONMapEntityStoreMixin.class, SQLMapEntityStoreMixin.class } )
-public interface SQLMapEntityStoreService
-    extends ServiceActivation,
-    JSONMapEntityStoreActivation,
-    EntityStore,
-    EntityStateVersions,
-    Configuration
-{
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/AbstractSQLEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/AbstractSQLEntityStoreAssembler.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/AbstractSQLEntityStoreAssembler.java
new file mode 100644
index 0000000..b23d678
--- /dev/null
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/AbstractSQLEntityStoreAssembler.java
@@ -0,0 +1,97 @@
+/*
+ *  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.sql.assembly;
+
+import org.apache.polygene.api.identity.Identity;
+import org.apache.polygene.api.identity.StringIdentity;
+import org.apache.polygene.bootstrap.Assemblers;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.entitystore.sql.SQLEntityStoreConfiguration;
+import org.apache.polygene.entitystore.sql.SQLEntityStoreService;
+import org.apache.polygene.library.sql.liquibase.LiquibaseAssembler;
+import org.apache.polygene.library.sql.liquibase.LiquibaseConfiguration;
+import org.jooq.SQLDialect;
+import org.jooq.conf.RenderNameStyle;
+import org.jooq.conf.Settings;
+
+/**
+ * Base SQL EntityStore assembly.
+ */
+public abstract class AbstractSQLEntityStoreAssembler<AssemblerType>
+    extends Assemblers.VisibilityIdentityConfig<AssemblerType>
+{
+    public static final Identity DEFAULT_ENTITYSTORE_IDENTITY = new StringIdentity( "entitystore-sql" );
+    private static final String DEFAULT_CHANGELOG_PATH = "org/apache/polygene/entitystore/sql/changelog.xml";
+
+    private String changelogPath = DEFAULT_CHANGELOG_PATH;
+
+    @Override
+    public void assemble( ModuleAssembly module )
+    {
+        SQLDialect dialect = getSQLDialect();
+        if( dialect == null )
+        {
+            throw new AssemblyException( "SQLDialect must not be null" );
+        }
+        Settings settings = getSettings();
+        if( settings == null )
+        {
+            throw new AssemblyException( "Settings must not be null" );
+        }
+
+        String identity = ( hasIdentity() ? identity() : DEFAULT_ENTITYSTORE_IDENTITY ).toString();
+
+        LiquibaseAssembler liquibase = new LiquibaseAssembler().identifiedBy( identity + "-liquibase" );
+        if( hasConfig() )
+        {
+            liquibase.withConfig( configModule(), configVisibility() );
+            LiquibaseConfiguration liquibaseconfig = configModule().forMixin( LiquibaseConfiguration.class )
+                                                                   .declareDefaults();
+            liquibaseconfig.changeLog().set( changelogPath );
+        }
+        liquibase.assemble( module );
+
+        module.services( SQLEntityStoreService.class )
+              .identifiedBy( identity )
+              .visibleIn( visibility() )
+              .setMetaInfo( dialect )
+              .setMetaInfo( settings );
+
+        if( hasConfig() )
+        {
+            configModule().entities( SQLEntityStoreConfiguration.class ).visibleIn( configVisibility() );
+        }
+    }
+
+    public AssemblerType withLiquibaseChangelog( String changelogPath )
+    {
+        this.changelogPath = changelogPath;
+        return (AssemblerType) this;
+    }
+
+    protected Settings getSettings()
+    {
+        return new Settings().withRenderNameStyle( RenderNameStyle.QUOTED );
+    }
+
+    protected SQLDialect getSQLDialect()
+    {
+        return SQLDialect.DEFAULT;
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/AbstractSQLMapEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/AbstractSQLMapEntityStoreAssembler.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/AbstractSQLMapEntityStoreAssembler.java
deleted file mode 100644
index aac6dfc..0000000
--- a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/AbstractSQLMapEntityStoreAssembler.java
+++ /dev/null
@@ -1,97 +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.sql.assembly;
-
-import org.apache.polygene.api.identity.Identity;
-import org.apache.polygene.api.identity.StringIdentity;
-import org.apache.polygene.bootstrap.Assemblers;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.entitystore.sql.SQLMapEntityStoreConfiguration;
-import org.apache.polygene.entitystore.sql.SQLMapEntityStoreService;
-import org.apache.polygene.library.sql.liquibase.LiquibaseAssembler;
-import org.apache.polygene.library.sql.liquibase.LiquibaseConfiguration;
-import org.jooq.SQLDialect;
-import org.jooq.conf.RenderNameStyle;
-import org.jooq.conf.Settings;
-
-/**
- * Base SQL EntityStore assembly.
- */
-public abstract class AbstractSQLMapEntityStoreAssembler<AssemblerType>
-    extends Assemblers.VisibilityIdentityConfig<AssemblerType>
-{
-    public static final Identity DEFAULT_ENTITYSTORE_IDENTITY = new StringIdentity( "entitystore-sql" );
-    private static final String DEFAULT_CHANGELOG_PATH = "org/apache/polygene/entitystore/sql/changelog.xml";
-
-    private String changelogPath = DEFAULT_CHANGELOG_PATH;
-
-    @Override
-    public void assemble( ModuleAssembly module )
-    {
-        SQLDialect dialect = getSQLDialect();
-        if( dialect == null )
-        {
-            throw new AssemblyException( "SQLDialect must not be null" );
-        }
-        Settings settings = getSettings();
-        if( settings == null )
-        {
-            throw new AssemblyException( "Settings must not be null" );
-        }
-
-        String identity = ( hasIdentity() ? identity() : DEFAULT_ENTITYSTORE_IDENTITY ).toString();
-
-        LiquibaseAssembler liquibase = new LiquibaseAssembler().identifiedBy( identity + "-liquibase" );
-        if( hasConfig() )
-        {
-            liquibase.withConfig( configModule(), configVisibility() );
-            LiquibaseConfiguration liquibaseconfig = configModule().forMixin( LiquibaseConfiguration.class )
-                                                                   .declareDefaults();
-            liquibaseconfig.changeLog().set( changelogPath );
-        }
-        liquibase.assemble( module );
-
-        module.services( SQLMapEntityStoreService.class )
-              .identifiedBy( identity )
-              .visibleIn( visibility() )
-              .setMetaInfo( dialect )
-              .setMetaInfo( settings );
-
-        if( hasConfig() )
-        {
-            configModule().entities( SQLMapEntityStoreConfiguration.class ).visibleIn( configVisibility() );
-        }
-    }
-
-    public AssemblerType withLiquibaseChangelog( String changelogPath )
-    {
-        this.changelogPath = changelogPath;
-        return (AssemblerType) this;
-    }
-
-    protected Settings getSettings()
-    {
-        return new Settings().withRenderNameStyle( RenderNameStyle.QUOTED );
-    }
-
-    protected SQLDialect getSQLDialect()
-    {
-        return SQLDialect.DEFAULT;
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/DerbySQLEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/DerbySQLEntityStoreAssembler.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/DerbySQLEntityStoreAssembler.java
index 6288d85..4e88d01 100644
--- a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/DerbySQLEntityStoreAssembler.java
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/DerbySQLEntityStoreAssembler.java
@@ -25,7 +25,7 @@ import org.jooq.SQLDialect;
  * Derby EntityStore assembly.
  */
 public class DerbySQLEntityStoreAssembler
-    extends AbstractSQLMapEntityStoreAssembler<DerbySQLEntityStoreAssembler>
+    extends AbstractSQLEntityStoreAssembler<DerbySQLEntityStoreAssembler>
 {
     @Override
     protected SQLDialect getSQLDialect()

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/H2SQLEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/H2SQLEntityStoreAssembler.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/H2SQLEntityStoreAssembler.java
index 018251e..928e660 100644
--- a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/H2SQLEntityStoreAssembler.java
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/H2SQLEntityStoreAssembler.java
@@ -25,7 +25,7 @@ import org.jooq.SQLDialect;
  * H2 EntityStore assembly.
  */
 public class H2SQLEntityStoreAssembler
-    extends AbstractSQLMapEntityStoreAssembler<H2SQLEntityStoreAssembler>
+    extends AbstractSQLEntityStoreAssembler<H2SQLEntityStoreAssembler>
 {
     @Override
     protected SQLDialect getSQLDialect()

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/MySQLEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/MySQLEntityStoreAssembler.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/MySQLEntityStoreAssembler.java
index ff46c82..dec7be5 100644
--- a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/MySQLEntityStoreAssembler.java
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/MySQLEntityStoreAssembler.java
@@ -25,7 +25,7 @@ import org.jooq.SQLDialect;
  * MySQL EntityStore assembly.
  */
 public class MySQLEntityStoreAssembler
-    extends AbstractSQLMapEntityStoreAssembler<MySQLEntityStoreAssembler>
+    extends AbstractSQLEntityStoreAssembler<MySQLEntityStoreAssembler>
 {
     @Override
     protected SQLDialect getSQLDialect()

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/PostgreSQLEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/PostgreSQLEntityStoreAssembler.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/PostgreSQLEntityStoreAssembler.java
index 4400b8e..8e3e31f 100644
--- a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/PostgreSQLEntityStoreAssembler.java
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/PostgreSQLEntityStoreAssembler.java
@@ -25,7 +25,7 @@ import org.jooq.SQLDialect;
  * PostgreSQL EntityStore assembly.
  */
 public class PostgreSQLEntityStoreAssembler
-    extends AbstractSQLMapEntityStoreAssembler<PostgreSQLEntityStoreAssembler>
+    extends AbstractSQLEntityStoreAssembler<PostgreSQLEntityStoreAssembler>
 {
     @Override
     protected SQLDialect getSQLDialect()

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/SQLiteEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/SQLiteEntityStoreAssembler.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/SQLiteEntityStoreAssembler.java
index 1b7fa5e..2615316 100644
--- a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/SQLiteEntityStoreAssembler.java
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/SQLiteEntityStoreAssembler.java
@@ -25,7 +25,7 @@ import org.jooq.SQLDialect;
  * SQLite EntityStore assembly.
  */
 public class SQLiteEntityStoreAssembler
-    extends AbstractSQLMapEntityStoreAssembler<SQLiteEntityStoreAssembler>
+    extends AbstractSQLEntityStoreAssembler<SQLiteEntityStoreAssembler>
 {
     @Override
     protected SQLDialect getSQLDialect()

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/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 f66ca9c..fe4c23e 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
@@ -80,8 +80,8 @@ public class DerbySQLEntityStoreTest
             "Delete " + getClass().getSimpleName() + " test data" ) );
         try
         {
-            SQLMapEntityStoreConfiguration config = uow.get( SQLMapEntityStoreConfiguration.class,
-                                                             DEFAULT_ENTITYSTORE_IDENTITY );
+            SQLEntityStoreConfiguration config = uow.get( SQLEntityStoreConfiguration.class,
+                                                          DEFAULT_ENTITYSTORE_IDENTITY );
             Connection connection = serviceFinder.findService( DataSource.class ).get().getConnection();
             connection.setAutoCommit( false );
             try( Statement stmt = connection.createStatement() )

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/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 c82bd61..00f4728 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
@@ -107,8 +107,8 @@ public class MySQLEntityStoreTest
         try
         {
             Connection connection = serviceFinder.findService( DataSource.class ).get().getConnection();
-            SQLMapEntityStoreConfiguration configuration = uow.get( SQLMapEntityStoreConfiguration.class,
-                                                                    DEFAULT_ENTITYSTORE_IDENTITY );
+            SQLEntityStoreConfiguration configuration = uow.get( SQLEntityStoreConfiguration.class,
+                                                                 DEFAULT_ENTITYSTORE_IDENTITY );
             connection.setAutoCommit( false );
             try( Statement stmt = connection.createStatement() )
             {

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchClusterConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchClusterConfiguration.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchClusterConfiguration.java
index 346a58d..ee3eae7 100644
--- a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchClusterConfiguration.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchClusterConfiguration.java
@@ -25,7 +25,7 @@ import org.apache.polygene.api.property.Property;
 
 // START SNIPPET: config
 public interface ElasticSearchClusterConfiguration
-        extends ElasticSearchConfiguration
+    extends ElasticSearchIndexingConfiguration
 {
 
     /**


Mime
View raw message