You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2017/05/27 02:11:56 UTC

[1/9] polygene-java git commit: POLYGENE-172 - Also fix inconsistent naming in the extension. All classes has "MongoDB" instead of "Mongo" in the name.

Repository: polygene-java
Updated Branches:
  refs/heads/yeoman-work 8721a02ec -> 582022309


POLYGENE-172 - Also fix inconsistent naming in the extension. All classes has "MongoDB" instead of "Mongo" in the name.

Signed-off-by: niclas <ni...@hedhman.org>


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

Branch: refs/heads/yeoman-work
Commit: 09b9280102065597909889d1cef823833917d600
Parents: f510c1e
Author: niclas <ni...@hedhman.org>
Authored: Thu May 25 12:38:12 2017 +0800
Committer: niclas <ni...@hedhman.org>
Committed: Thu May 25 12:38:12 2017 +0800

----------------------------------------------------------------------
 .../entitystore/mongodb/MongoAccessors.java     |  32 --
 .../entitystore/mongodb/MongoDBAccessors.java   |  32 ++
 .../MongoDBEntityStoreConfiguration.java        |  92 ++++++
 .../mongodb/MongoDBMapEntityStoreMixin.java     | 322 +++++++++++++++++++
 .../mongodb/MongoDBMapEntityStoreService.java   |  49 +++
 .../mongodb/MongoEntityStoreConfiguration.java  |  92 ------
 .../mongodb/MongoMapEntityStoreMixin.java       | 322 -------------------
 .../mongodb/MongoMapEntityStoreService.java     |  49 ---
 .../assembly/MongoDBEntityStoreAssembler.java   |   8 +-
 .../mongodb/EmbedMongoDBMapEntityStoreTest.java |  88 +++++
 .../mongodb/EmbedMongoMapEntityStoreTest.java   |  88 -----
 .../mongodb/MongoDBMapEntityStoreTest.java      |  88 +++++
 .../MongoDBMapEntityStoreWithCacheTest.java     |  84 +++++
 .../mongodb/MongoMapEntityStoreTest.java        |  88 -----
 .../MongoMapEntityStoreWithCacheTest.java       |  84 -----
 15 files changed, 759 insertions(+), 759 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/09b92801/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoAccessors.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoAccessors.java b/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoAccessors.java
deleted file mode 100644
index 2d3ddd8..0000000
--- a/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoAccessors.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.polygene.entitystore.mongodb;
-
-import com.mongodb.MongoClient;
-import com.mongodb.client.MongoDatabase;
-
-public interface MongoAccessors
-{
-    MongoClient mongoInstanceUsed();
-
-    MongoDatabase dbInstanceUsed();
-
-    String collectionUsed();
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/09b92801/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBAccessors.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBAccessors.java b/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBAccessors.java
new file mode 100644
index 0000000..d6b5723
--- /dev/null
+++ b/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBAccessors.java
@@ -0,0 +1,32 @@
+/*
+ *  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.mongodb;
+
+import com.mongodb.MongoClient;
+import com.mongodb.client.MongoDatabase;
+
+public interface MongoDBAccessors
+{
+    MongoClient mongoInstanceUsed();
+
+    MongoDatabase dbInstanceUsed();
+
+    String collectionUsed();
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/09b92801/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreConfiguration.java b/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreConfiguration.java
new file mode 100644
index 0000000..2e8146e
--- /dev/null
+++ b/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreConfiguration.java
@@ -0,0 +1,92 @@
+/*
+ *  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.mongodb;
+
+import java.util.List;
+import org.apache.polygene.api.common.Optional;
+import org.apache.polygene.api.common.UseDefaults;
+import org.apache.polygene.api.property.Property;
+
+// START SNIPPET: config
+public interface MongoDBEntityStoreConfiguration
+{
+
+    @Optional
+    Property<String> hostname();
+
+    @Optional
+    Property<Integer> port();
+
+    @UseDefaults
+    Property<List<String>> nodes();
+
+    @UseDefaults
+    Property<String> username();
+
+    @UseDefaults
+    Property<String> password();
+
+    @Optional
+    Property<String> database();
+
+    @Optional
+    Property<String> collection();
+
+    @UseDefaults
+    Property<WriteConcern> writeConcern();
+
+    enum WriteConcern
+    {
+        /**
+         *  Write operations that use this write concern will wait for acknowledgement,
+         *  using the default write concern configured on the server.
+         *  This is the default value.
+         */
+        ACKNOWLEDGED,
+        /**
+         * Write operations that use this write concern will wait for acknowledgement from a single member.
+         */
+        W1,
+        /**
+         * Write operations that use this write concern will wait for acknowledgement from two members.
+         */
+        W2,
+        /**
+         * Write operations that use this write concern will wait for acknowledgement from three members.
+         */
+        W3,
+        /**
+         * Write operations that use this write concern will return as soon as the message is written to the socket.
+         * Exceptions are raised for network issues, but not server errors.
+         */
+        UNACKNOWLEDGED,
+        /**
+         * Write operations wait for the server to group commit to the journal file on disk.
+         */
+        JOURNALED,
+        /**
+         * Exceptions are raised for network issues, and server errors;
+         * waits on a majority of servers for the write operation.
+         */
+        MAJORITY
+
+    }
+}
+// END SNIPPET: config
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/09b92801/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreMixin.java b/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreMixin.java
new file mode 100644
index 0000000..3294910
--- /dev/null
+++ b/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreMixin.java
@@ -0,0 +1,322 @@
+/*
+ *  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.mongodb;
+
+import com.mongodb.BasicDBObject;
+import com.mongodb.MongoClient;
+import com.mongodb.MongoClientOptions;
+import com.mongodb.MongoCredential;
+import com.mongodb.ServerAddress;
+import com.mongodb.WriteConcern;
+import com.mongodb.client.MongoCollection;
+import com.mongodb.client.MongoCursor;
+import com.mongodb.client.MongoDatabase;
+import com.mongodb.util.JSON;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
+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;
+import org.bson.Document;
+import org.bson.conversions.Bson;
+
+import static com.mongodb.client.model.Filters.eq;
+import static java.util.stream.Collectors.toList;
+
+/**
+ * MongoDB implementation of MapEntityStore.
+ */
+public class MongoDBMapEntityStoreMixin
+    implements ServiceActivation, MapEntityStore, MongoDBAccessors
+{
+    private static final String DEFAULT_DATABASE_NAME = "polygene:entitystore";
+    private static final String DEFAULT_COLLECTION_NAME = "polygene:entitystore:entities";
+    public static final String IDENTITY_COLUMN = "_id";
+    public static final String STATE_COLUMN = "state";
+    @This
+    private Configuration<MongoDBEntityStoreConfiguration> configuration;
+    private List<ServerAddress> serverAddresses;
+    private String databaseName;
+    private String collectionName;
+    private WriteConcern writeConcern;
+    private String username;
+    private char[] password;
+    private MongoClient mongo;
+    private MongoDatabase db;
+
+    @Override
+    public void activateService()
+        throws Exception
+    {
+        loadConfiguration();
+
+        // Create Mongo driver and open the database
+        MongoClientOptions options = MongoClientOptions.builder().writeConcern( writeConcern ).build();
+        if( username.isEmpty() )
+        {
+            mongo = new MongoClient( serverAddresses, options );
+        }
+        else
+        {
+            MongoCredential credential = MongoCredential.createMongoCRCredential( username, databaseName, password );
+            mongo = new MongoClient( serverAddresses, Collections.singletonList( credential ), options );
+        }
+        db = mongo.getDatabase( databaseName );
+
+        // Create index if needed
+        MongoCollection<Document> entities = db.getCollection( collectionName );
+        if( !entities.listIndexes().iterator().hasNext() )
+        {
+            entities.createIndex( new BasicDBObject( IDENTITY_COLUMN, 1 ) );
+        }
+    }
+
+    private void loadConfiguration()
+        throws UnknownHostException
+    {
+        configuration.refresh();
+        MongoDBEntityStoreConfiguration config = configuration.get();
+
+        // Combine hostname, port and nodes configuration properties
+        // If no configuration, use 127.0.0.1:27017
+        serverAddresses = new ArrayList<>();
+        int port = config.port().get() == null ? 27017 : config.port().get();
+        List<String> nodes = config.nodes().get();
+        if( nodes.isEmpty() )
+        {
+            String hostname = config.hostname().get() == null ? "127.0.0.1" : config.hostname().get();
+            serverAddresses.add( new ServerAddress( hostname, port ) );
+        }
+        else
+        {
+            if( config.hostname().get() != null && !config.hostname().get().isEmpty() )
+            {
+                serverAddresses.add( new ServerAddress( config.hostname().get(), port ) );
+            }
+            serverAddresses.addAll( nodes.stream()
+                                         .map( this::parseNode )
+                                         .collect( toList() )
+                                  );
+        }
+
+        // If database name not configured, set it to polygene:entitystore
+        databaseName = config.database().get();
+        if( databaseName == null )
+        {
+            databaseName = DEFAULT_DATABASE_NAME;
+        }
+
+        // If collection name not configured, set it to polygene:entitystore:entities
+        collectionName = config.collection().get();
+        if( collectionName == null )
+        {
+            collectionName = DEFAULT_COLLECTION_NAME;
+        }
+
+        // If write concern not configured, set it to normal
+        switch( config.writeConcern().get() )
+        {
+        case W1:
+            writeConcern = WriteConcern.W1;
+            break;
+        case W2:
+            writeConcern = WriteConcern.W2;
+            break;
+        case W3:
+            writeConcern = WriteConcern.W3;
+            break;
+        case UNACKNOWLEDGED:
+            writeConcern = WriteConcern.UNACKNOWLEDGED;
+            break;
+        case JOURNALED:
+            writeConcern = WriteConcern.JOURNALED;
+            break;
+        case MAJORITY:
+            writeConcern = WriteConcern.MAJORITY;
+            break;
+        case ACKNOWLEDGED:
+        default:
+            writeConcern = WriteConcern.ACKNOWLEDGED;
+        }
+
+        // Username and password are defaulted to empty strings
+        username = config.username().get();
+        password = config.password().get().toCharArray();
+    }
+
+    private <R> ServerAddress parseNode( String nodeString )
+    {
+        String[] parts = nodeString.split( ":" );
+        String host = parts[ 0 ];
+        if( parts.length == 2 )
+        {
+            int port = Integer.parseInt( parts[ 1 ] );
+            return new ServerAddress( host, port );
+        }
+        return new ServerAddress( host );
+    }
+
+    @Override
+    public void passivateService()
+        throws Exception
+    {
+        mongo.close();
+        mongo = null;
+        databaseName = null;
+        collectionName = null;
+        writeConcern = null;
+        username = null;
+        Arrays.fill( password, ' ' );
+        password = null;
+        db = null;
+    }
+
+    @Override
+    public MongoClient mongoInstanceUsed()
+    {
+        return mongo;
+    }
+
+    @Override
+    public MongoDatabase dbInstanceUsed()
+    {
+        return db;
+    }
+
+    @Override
+    public String collectionUsed()
+    {
+        return collectionName;
+    }
+
+    @Override
+    public Reader get( EntityReference entityReference )
+        throws EntityStoreException
+    {
+        MongoCursor<Document> cursor = db.getCollection( collectionName )
+                                         .find( byIdentity( entityReference ) )
+                                         .limit( 1 ).iterator();
+        if( !cursor.hasNext() )
+        {
+            throw new EntityNotFoundException( entityReference );
+        }
+        Document bsonState = (Document) cursor.next().get( STATE_COLUMN );
+        String jsonState = JSON.serialize( bsonState );
+        return new StringReader( jsonState );
+    }
+
+    @Override
+    public void applyChanges( MapChanges changes )
+        throws Exception
+    {
+        final MongoCollection<Document> entities = db.getCollection( collectionName );
+
+        changes.visitMap( new MapChanger()
+        {
+            @Override
+            public Writer newEntity( EntityReference ref, EntityDescriptor entityDescriptor )
+                throws IOException
+            {
+                return new StringWriter( 1000 )
+                {
+                    @Override
+                    public void close()
+                        throws IOException
+                    {
+                        super.close();
+                        Document bsonState = Document.parse( toString() );
+                        Document entity = new Document();
+                        entity.put( IDENTITY_COLUMN, ref.identity().toString() );
+                        entity.put( STATE_COLUMN, bsonState );
+                        entities.insertOne( entity );
+                    }
+                };
+            }
+
+            @Override
+            public Writer updateEntity( MapChange mapChange )
+                throws IOException
+            {
+                return new StringWriter( 1000 )
+                {
+                    @Override
+                    public void close()
+                        throws IOException
+                    {
+                        super.close();
+                        Document bsonState = Document.parse( toString() );
+                        Document entity = new Document();
+                        entity.put( IDENTITY_COLUMN, mapChange.reference().identity().toString() );
+                        entity.put( STATE_COLUMN, bsonState );
+                        entities.replaceOne( byIdentity( mapChange.reference() ), entity );
+                    }
+                };
+            }
+
+            @Override
+            public void removeEntity( EntityReference ref, EntityDescriptor entityDescriptor )
+                throws EntityNotFoundException
+            {
+                Bson byIdFilter = byIdentity( ref );
+                MongoCursor<Document> cursor = db.getCollection( collectionName )
+                                                 .find( byIdFilter )
+                                                 .limit( 1 ).iterator();
+                if( !cursor.hasNext() )
+                {
+                    throw new EntityNotFoundException( ref );
+                }
+                entities.deleteOne( byIdFilter );
+            }
+        } );
+    }
+
+    @Override
+    public Stream<Reader> entityStates()
+    {
+        return StreamSupport
+            .stream( db.getCollection( collectionName ).find().spliterator(), false )
+            .map( eachEntity ->
+                  {
+                      Document bsonState = (Document) eachEntity.get( STATE_COLUMN );
+                      String jsonState = JSON.serialize( bsonState );
+                      return new StringReader( jsonState );
+                  } );
+    }
+
+    private Bson byIdentity( EntityReference entityReference )
+    {
+        return eq( IDENTITY_COLUMN, entityReference.identity().toString() );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/09b92801/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreService.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreService.java b/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreService.java
new file mode 100644
index 0000000..4f34214
--- /dev/null
+++ b/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreService.java
@@ -0,0 +1,49 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.entitystore.mongodb;
+
+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;
+
+/**
+ * MongoDB EntityStore service.
+ * <p>Based on @{@link JSONMapEntityStoreMixin}.</p>
+ */
+@Concerns( { StateChangeNotificationConcern.class, ConcurrentModificationCheckConcern.class } )
+@Mixins( { JSONMapEntityStoreMixin.class, MongoDBMapEntityStoreMixin.class } )
+public interface MongoDBMapEntityStoreService
+    extends EntityStore,
+            EntityStateVersions,
+            ServiceActivation,
+            JSONMapEntityStoreActivation,
+            LockingAbstractComposite,
+            Configuration,
+            MongoDBAccessors
+{
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/09b92801/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoEntityStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoEntityStoreConfiguration.java b/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoEntityStoreConfiguration.java
deleted file mode 100644
index 75c95ac..0000000
--- a/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoEntityStoreConfiguration.java
+++ /dev/null
@@ -1,92 +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.mongodb;
-
-import java.util.List;
-import org.apache.polygene.api.common.Optional;
-import org.apache.polygene.api.common.UseDefaults;
-import org.apache.polygene.api.property.Property;
-
-// START SNIPPET: config
-public interface MongoEntityStoreConfiguration
-{
-
-    @Optional
-    Property<String> hostname();
-
-    @Optional
-    Property<Integer> port();
-
-    @UseDefaults
-    Property<List<String>> nodes();
-
-    @UseDefaults
-    Property<String> username();
-
-    @UseDefaults
-    Property<String> password();
-
-    @Optional
-    Property<String> database();
-
-    @Optional
-    Property<String> collection();
-
-    @UseDefaults
-    Property<WriteConcern> writeConcern();
-
-    enum WriteConcern
-    {
-        /**
-         *  Write operations that use this write concern will wait for acknowledgement,
-         *  using the default write concern configured on the server.
-         *  This is the default value.
-         */
-        ACKNOWLEDGED,
-        /**
-         * Write operations that use this write concern will wait for acknowledgement from a single member.
-         */
-        W1,
-        /**
-         * Write operations that use this write concern will wait for acknowledgement from two members.
-         */
-        W2,
-        /**
-         * Write operations that use this write concern will wait for acknowledgement from three members.
-         */
-        W3,
-        /**
-         * Write operations that use this write concern will return as soon as the message is written to the socket.
-         * Exceptions are raised for network issues, but not server errors.
-         */
-        UNACKNOWLEDGED,
-        /**
-         * Write operations wait for the server to group commit to the journal file on disk.
-         */
-        JOURNALED,
-        /**
-         * Exceptions are raised for network issues, and server errors;
-         * waits on a majority of servers for the write operation.
-         */
-        MAJORITY
-
-    }
-}
-// END SNIPPET: config
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/09b92801/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreMixin.java b/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreMixin.java
deleted file mode 100644
index 3766b82..0000000
--- a/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreMixin.java
+++ /dev/null
@@ -1,322 +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.mongodb;
-
-import com.mongodb.BasicDBObject;
-import com.mongodb.MongoClient;
-import com.mongodb.MongoClientOptions;
-import com.mongodb.MongoCredential;
-import com.mongodb.ServerAddress;
-import com.mongodb.WriteConcern;
-import com.mongodb.client.MongoCollection;
-import com.mongodb.client.MongoCursor;
-import com.mongodb.client.MongoDatabase;
-import com.mongodb.util.JSON;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Stream;
-import java.util.stream.StreamSupport;
-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;
-import org.bson.Document;
-import org.bson.conversions.Bson;
-
-import static com.mongodb.client.model.Filters.eq;
-import static java.util.stream.Collectors.toList;
-
-/**
- * MongoDB implementation of MapEntityStore.
- */
-public class MongoMapEntityStoreMixin
-    implements ServiceActivation, MapEntityStore, MongoAccessors
-{
-    private static final String DEFAULT_DATABASE_NAME = "polygene:entitystore";
-    private static final String DEFAULT_COLLECTION_NAME = "polygene:entitystore:entities";
-    public static final String IDENTITY_COLUMN = "_id";
-    public static final String STATE_COLUMN = "state";
-    @This
-    private Configuration<MongoEntityStoreConfiguration> configuration;
-    private List<ServerAddress> serverAddresses;
-    private String databaseName;
-    private String collectionName;
-    private WriteConcern writeConcern;
-    private String username;
-    private char[] password;
-    private MongoClient mongo;
-    private MongoDatabase db;
-
-    @Override
-    public void activateService()
-        throws Exception
-    {
-        loadConfiguration();
-
-        // Create Mongo driver and open the database
-        MongoClientOptions options = MongoClientOptions.builder().writeConcern( writeConcern ).build();
-        if( username.isEmpty() )
-        {
-            mongo = new MongoClient( serverAddresses, options );
-        }
-        else
-        {
-            MongoCredential credential = MongoCredential.createMongoCRCredential( username, databaseName, password );
-            mongo = new MongoClient( serverAddresses, Collections.singletonList( credential ), options );
-        }
-        db = mongo.getDatabase( databaseName );
-
-        // Create index if needed
-        MongoCollection<Document> entities = db.getCollection( collectionName );
-        if( !entities.listIndexes().iterator().hasNext() )
-        {
-            entities.createIndex( new BasicDBObject( IDENTITY_COLUMN, 1 ) );
-        }
-    }
-
-    private void loadConfiguration()
-        throws UnknownHostException
-    {
-        configuration.refresh();
-        MongoEntityStoreConfiguration config = configuration.get();
-
-        // Combine hostname, port and nodes configuration properties
-        // If no configuration, use 127.0.0.1:27017
-        serverAddresses = new ArrayList<>();
-        int port = config.port().get() == null ? 27017 : config.port().get();
-        List<String> nodes = config.nodes().get();
-        if( nodes.isEmpty() )
-        {
-            String hostname = config.hostname().get() == null ? "127.0.0.1" : config.hostname().get();
-            serverAddresses.add( new ServerAddress( hostname, port ) );
-        }
-        else
-        {
-            if( config.hostname().get() != null && !config.hostname().get().isEmpty() )
-            {
-                serverAddresses.add( new ServerAddress( config.hostname().get(), port ) );
-            }
-            serverAddresses.addAll( nodes.stream()
-                                         .map( this::parseNode )
-                                         .collect( toList() )
-                                  );
-        }
-
-        // If database name not configured, set it to polygene:entitystore
-        databaseName = config.database().get();
-        if( databaseName == null )
-        {
-            databaseName = DEFAULT_DATABASE_NAME;
-        }
-
-        // If collection name not configured, set it to polygene:entitystore:entities
-        collectionName = config.collection().get();
-        if( collectionName == null )
-        {
-            collectionName = DEFAULT_COLLECTION_NAME;
-        }
-
-        // If write concern not configured, set it to normal
-        switch( config.writeConcern().get() )
-        {
-        case W1:
-            writeConcern = WriteConcern.W1;
-            break;
-        case W2:
-            writeConcern = WriteConcern.W2;
-            break;
-        case W3:
-            writeConcern = WriteConcern.W3;
-            break;
-        case UNACKNOWLEDGED:
-            writeConcern = WriteConcern.UNACKNOWLEDGED;
-            break;
-        case JOURNALED:
-            writeConcern = WriteConcern.JOURNALED;
-            break;
-        case MAJORITY:
-            writeConcern = WriteConcern.MAJORITY;
-            break;
-        case ACKNOWLEDGED:
-        default:
-            writeConcern = WriteConcern.ACKNOWLEDGED;
-        }
-
-        // Username and password are defaulted to empty strings
-        username = config.username().get();
-        password = config.password().get().toCharArray();
-    }
-
-    private <R> ServerAddress parseNode( String nodeString )
-    {
-        String[] parts = nodeString.split( ":" );
-        String host = parts[ 0 ];
-        if( parts.length == 2 )
-        {
-            int port = Integer.parseInt( parts[ 1 ] );
-            return new ServerAddress( host, port );
-        }
-        return new ServerAddress( host );
-    }
-
-    @Override
-    public void passivateService()
-        throws Exception
-    {
-        mongo.close();
-        mongo = null;
-        databaseName = null;
-        collectionName = null;
-        writeConcern = null;
-        username = null;
-        Arrays.fill( password, ' ' );
-        password = null;
-        db = null;
-    }
-
-    @Override
-    public MongoClient mongoInstanceUsed()
-    {
-        return mongo;
-    }
-
-    @Override
-    public MongoDatabase dbInstanceUsed()
-    {
-        return db;
-    }
-
-    @Override
-    public String collectionUsed()
-    {
-        return collectionName;
-    }
-
-    @Override
-    public Reader get( EntityReference entityReference )
-        throws EntityStoreException
-    {
-        MongoCursor<Document> cursor = db.getCollection( collectionName )
-                                         .find( byIdentity( entityReference ) )
-                                         .limit( 1 ).iterator();
-        if( !cursor.hasNext() )
-        {
-            throw new EntityNotFoundException( entityReference );
-        }
-        Document bsonState = (Document) cursor.next().get( STATE_COLUMN );
-        String jsonState = JSON.serialize( bsonState );
-        return new StringReader( jsonState );
-    }
-
-    @Override
-    public void applyChanges( MapChanges changes )
-        throws Exception
-    {
-        final MongoCollection<Document> entities = db.getCollection( collectionName );
-
-        changes.visitMap( new MapChanger()
-        {
-            @Override
-            public Writer newEntity( EntityReference ref, EntityDescriptor entityDescriptor )
-                throws IOException
-            {
-                return new StringWriter( 1000 )
-                {
-                    @Override
-                    public void close()
-                        throws IOException
-                    {
-                        super.close();
-                        Document bsonState = Document.parse( toString() );
-                        Document entity = new Document();
-                        entity.put( IDENTITY_COLUMN, ref.identity().toString() );
-                        entity.put( STATE_COLUMN, bsonState );
-                        entities.insertOne( entity );
-                    }
-                };
-            }
-
-            @Override
-            public Writer updateEntity( MapChange mapChange )
-                throws IOException
-            {
-                return new StringWriter( 1000 )
-                {
-                    @Override
-                    public void close()
-                        throws IOException
-                    {
-                        super.close();
-                        Document bsonState = Document.parse( toString() );
-                        Document entity = new Document();
-                        entity.put( IDENTITY_COLUMN, mapChange.reference().identity().toString() );
-                        entity.put( STATE_COLUMN, bsonState );
-                        entities.replaceOne( byIdentity( mapChange.reference() ), entity );
-                    }
-                };
-            }
-
-            @Override
-            public void removeEntity( EntityReference ref, EntityDescriptor entityDescriptor )
-                throws EntityNotFoundException
-            {
-                Bson byIdFilter = byIdentity( ref );
-                MongoCursor<Document> cursor = db.getCollection( collectionName )
-                                                 .find( byIdFilter )
-                                                 .limit( 1 ).iterator();
-                if( !cursor.hasNext() )
-                {
-                    throw new EntityNotFoundException( ref );
-                }
-                entities.deleteOne( byIdFilter );
-            }
-        } );
-    }
-
-    @Override
-    public Stream<Reader> entityStates()
-    {
-        return StreamSupport
-            .stream( db.getCollection( collectionName ).find().spliterator(), false )
-            .map( eachEntity ->
-                  {
-                      Document bsonState = (Document) eachEntity.get( STATE_COLUMN );
-                      String jsonState = JSON.serialize( bsonState );
-                      return new StringReader( jsonState );
-                  } );
-    }
-
-    private Bson byIdentity( EntityReference entityReference )
-    {
-        return eq( IDENTITY_COLUMN, entityReference.identity().toString() );
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/09b92801/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreService.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreService.java b/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreService.java
deleted file mode 100644
index 2145544..0000000
--- a/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreService.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.polygene.entitystore.mongodb;
-
-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;
-
-/**
- * MongoDB EntityStore service.
- * <p>Based on @{@link JSONMapEntityStoreMixin}.</p>
- */
-@Concerns( { StateChangeNotificationConcern.class, ConcurrentModificationCheckConcern.class } )
-@Mixins( { JSONMapEntityStoreMixin.class, MongoMapEntityStoreMixin.class } )
-public interface MongoMapEntityStoreService
-    extends EntityStore,
-            EntityStateVersions,
-            ServiceActivation,
-            JSONMapEntityStoreActivation,
-            LockingAbstractComposite,
-            Configuration,
-            MongoAccessors
-{
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/09b92801/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/assembly/MongoDBEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/assembly/MongoDBEntityStoreAssembler.java b/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/assembly/MongoDBEntityStoreAssembler.java
index a270305..eff0463 100644
--- a/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/assembly/MongoDBEntityStoreAssembler.java
+++ b/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/assembly/MongoDBEntityStoreAssembler.java
@@ -23,8 +23,8 @@ import org.apache.polygene.bootstrap.Assemblers;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.ServiceDeclaration;
-import org.apache.polygene.entitystore.mongodb.MongoEntityStoreConfiguration;
-import org.apache.polygene.entitystore.mongodb.MongoMapEntityStoreService;
+import org.apache.polygene.entitystore.mongodb.MongoDBEntityStoreConfiguration;
+import org.apache.polygene.entitystore.mongodb.MongoDBMapEntityStoreService;
 
 public class MongoDBEntityStoreAssembler
     extends Assemblers.VisibilityIdentityConfig<MongoDBEntityStoreAssembler>
@@ -33,14 +33,14 @@ public class MongoDBEntityStoreAssembler
     public void assemble( ModuleAssembly module )
         throws AssemblyException
     {
-        ServiceDeclaration service = module.services( MongoMapEntityStoreService.class ).visibleIn( visibility() );
+        ServiceDeclaration service = module.services( MongoDBMapEntityStoreService.class ).visibleIn( visibility() );
         if( hasIdentity() )
         {
             service.identifiedBy( identity() );
         }
         if( hasConfig() )
         {
-            configModule().entities( MongoEntityStoreConfiguration.class ).visibleIn( configVisibility() );
+            configModule().entities( MongoDBEntityStoreConfiguration.class ).visibleIn( configVisibility() );
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/09b92801/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/EmbedMongoDBMapEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/EmbedMongoDBMapEntityStoreTest.java b/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/EmbedMongoDBMapEntityStoreTest.java
new file mode 100644
index 0000000..9f285aa
--- /dev/null
+++ b/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/EmbedMongoDBMapEntityStoreTest.java
@@ -0,0 +1,88 @@
+/*
+ *  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.mongodb;
+
+import de.flapdoodle.embed.mongo.MongodExecutable;
+import de.flapdoodle.embed.mongo.MongodStarter;
+import de.flapdoodle.embed.mongo.config.MongodConfigBuilder;
+import de.flapdoodle.embed.mongo.config.Net;
+import de.flapdoodle.embed.mongo.distribution.Version;
+import de.flapdoodle.embed.process.runtime.Network;
+import java.io.IOException;
+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.mongodb.assembly.MongoDBEntityStoreAssembler;
+import org.apache.polygene.test.EntityTestAssembler;
+import org.apache.polygene.test.entity.AbstractEntityStoreTest;
+import org.apache.polygene.test.util.FreePortFinder;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.rules.TestName;
+
+public class EmbedMongoDBMapEntityStoreTest extends AbstractEntityStoreTest
+{
+    private static final MongodStarter MONGO_STARTER = MongodStarter.getDefaultInstance();
+
+    @Rule
+    public TestName testName = new TestName();
+    private static int port;
+    private static MongodExecutable mongod;
+
+    @BeforeClass
+    public static void startEmbedMongo()
+        throws IOException
+    {
+        port = FreePortFinder.findFreePortOnLoopback();
+        mongod = MONGO_STARTER.prepare( new MongodConfigBuilder()
+                                            .version( Version.Main.PRODUCTION )
+                                            .net( new Net( "localhost", port, Network.localhostIsIPv6() ) )
+                                            .build() );
+        mongod.start();
+    }
+
+    @AfterClass
+    public static void stopEmbedMongo()
+    {
+        if( mongod != null )
+        {
+            mongod.stop();
+        }
+    }
+
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        super.assemble( module );
+
+        ModuleAssembly config = module.layer().module( "config" );
+        new EntityTestAssembler().assemble( config );
+
+        new MongoDBEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
+
+        MongoDBEntityStoreConfiguration mongoConfig = config.forMixin( MongoDBEntityStoreConfiguration.class )
+                                                            .declareDefaults();
+        mongoConfig.writeConcern().set( MongoDBEntityStoreConfiguration.WriteConcern.MAJORITY );
+        mongoConfig.database().set( "polygene-test" );
+        mongoConfig.collection().set( testName.getMethodName() );
+        mongoConfig.nodes().set( Collections.singletonList( "localhost:" + port ) );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/09b92801/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/EmbedMongoMapEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/EmbedMongoMapEntityStoreTest.java b/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/EmbedMongoMapEntityStoreTest.java
deleted file mode 100644
index 5a65389..0000000
--- a/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/EmbedMongoMapEntityStoreTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.polygene.entitystore.mongodb;
-
-import de.flapdoodle.embed.mongo.MongodExecutable;
-import de.flapdoodle.embed.mongo.MongodStarter;
-import de.flapdoodle.embed.mongo.config.MongodConfigBuilder;
-import de.flapdoodle.embed.mongo.config.Net;
-import de.flapdoodle.embed.mongo.distribution.Version;
-import de.flapdoodle.embed.process.runtime.Network;
-import java.io.IOException;
-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.mongodb.assembly.MongoDBEntityStoreAssembler;
-import org.apache.polygene.test.EntityTestAssembler;
-import org.apache.polygene.test.entity.AbstractEntityStoreTest;
-import org.apache.polygene.test.util.FreePortFinder;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.rules.TestName;
-
-public class EmbedMongoMapEntityStoreTest extends AbstractEntityStoreTest
-{
-    private static final MongodStarter MONGO_STARTER = MongodStarter.getDefaultInstance();
-
-    @Rule
-    public TestName testName = new TestName();
-    private static int port;
-    private static MongodExecutable mongod;
-
-    @BeforeClass
-    public static void startEmbedMongo()
-        throws IOException
-    {
-        port = FreePortFinder.findFreePortOnLoopback();
-        mongod = MONGO_STARTER.prepare( new MongodConfigBuilder()
-                                            .version( Version.Main.PRODUCTION )
-                                            .net( new Net( "localhost", port, Network.localhostIsIPv6() ) )
-                                            .build() );
-        mongod.start();
-    }
-
-    @AfterClass
-    public static void stopEmbedMongo()
-    {
-        if( mongod != null )
-        {
-            mongod.stop();
-        }
-    }
-
-    @Override
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        super.assemble( module );
-
-        ModuleAssembly config = module.layer().module( "config" );
-        new EntityTestAssembler().assemble( config );
-
-        new MongoDBEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
-
-        MongoEntityStoreConfiguration mongoConfig = config.forMixin( MongoEntityStoreConfiguration.class )
-                                                          .declareDefaults();
-        mongoConfig.writeConcern().set( MongoEntityStoreConfiguration.WriteConcern.MAJORITY );
-        mongoConfig.database().set( "polygene-test" );
-        mongoConfig.collection().set( testName.getMethodName() );
-        mongoConfig.nodes().set( Collections.singletonList( "localhost:" + port ) );
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/09b92801/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreTest.java b/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreTest.java
new file mode 100644
index 0000000..f98fdc3
--- /dev/null
+++ b/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreTest.java
@@ -0,0 +1,88 @@
+/*
+ *  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.mongodb;
+
+import com.mongodb.Mongo;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.entitystore.mongodb.assembly.MongoDBEntityStoreAssembler;
+import org.apache.polygene.test.EntityTestAssembler;
+import org.apache.polygene.test.entity.AbstractEntityStoreTest;
+import org.junit.BeforeClass;
+
+import static org.apache.polygene.test.util.Assume.assumeConnectivity;
+
+/**
+ * Test the MongoDBMapEntityStoreService.
+ * <p>Installing mongodb and starting it should suffice as the test use mongodb defaults: 127.0.0.1:27017</p>
+ */
+public class MongoDBMapEntityStoreTest extends AbstractEntityStoreTest
+{
+    @BeforeClass
+    public static void beforeRedisMapEntityStoreTests()
+    {
+        assumeConnectivity( "localhost", 27017 );
+    }
+
+    @Override
+    // START SNIPPET: assembly
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        // END SNIPPET: assembly
+        super.assemble( module );
+
+        ModuleAssembly config = module.layer().module( "config" );
+        new EntityTestAssembler().assemble( config );
+
+        // START SNIPPET: assembly
+        new MongoDBEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
+        // END SNIPPET: assembly
+
+        MongoDBEntityStoreConfiguration mongoConfig = config.forMixin( MongoDBEntityStoreConfiguration.class ).declareDefaults();
+        mongoConfig.writeConcern().set( MongoDBEntityStoreConfiguration.WriteConcern.MAJORITY );
+        mongoConfig.database().set( "polygene:test" );
+        mongoConfig.collection().set( "polygene:test:entities" );
+        // START SNIPPET: assembly
+    }
+
+    // END SNIPPET: assembly
+    private Mongo mongo;
+    private String dbName;
+
+    @Override
+    public void setUp()
+        throws Exception
+    {
+        super.setUp();
+        MongoDBMapEntityStoreService es = serviceFinder.findService( MongoDBMapEntityStoreService.class ).get();
+        mongo = es.mongoInstanceUsed();
+        dbName = es.dbInstanceUsed().getName();
+    }
+
+    @Override
+    public void tearDown()
+        throws Exception
+    {
+        mongo.dropDatabase( dbName );
+        super.tearDown();
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/09b92801/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreWithCacheTest.java b/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreWithCacheTest.java
new file mode 100644
index 0000000..65e9a13
--- /dev/null
+++ b/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreWithCacheTest.java
@@ -0,0 +1,84 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.entitystore.mongodb;
+
+import com.mongodb.Mongo;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.entitystore.mongodb.assembly.MongoDBEntityStoreAssembler;
+import org.apache.polygene.test.EntityTestAssembler;
+import org.apache.polygene.test.cache.AbstractEntityStoreWithCacheTest;
+import org.junit.BeforeClass;
+
+import static org.apache.polygene.test.util.Assume.assumeConnectivity;
+
+/**
+ * Test the MongoDBMapEntityStoreService usage with a CachePool.
+ * <p>Installing mongodb and starting it should suffice as the test use mongodb defaults: 127.0.0.1:27017</p>
+ */
+public class MongoDBMapEntityStoreWithCacheTest
+    extends AbstractEntityStoreWithCacheTest
+{
+    @BeforeClass
+    public static void beforeRedisMapEntityStoreTests()
+    {
+        assumeConnectivity( "localhost", 27017 );
+    }
+
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        super.assemble( module );
+
+        ModuleAssembly config = module.layer().module( "config" );
+        new EntityTestAssembler().assemble( config );
+
+        new MongoDBEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
+
+        MongoDBEntityStoreConfiguration mongoConfig = config.forMixin( MongoDBEntityStoreConfiguration.class ).declareDefaults();
+        mongoConfig.writeConcern().set( MongoDBEntityStoreConfiguration.WriteConcern.MAJORITY );
+        mongoConfig.database().set( "polygene:test" );
+        mongoConfig.collection().set( "polygene:test:entities" );
+    }
+
+    private Mongo mongo;
+    private String dbName;
+
+    @Override
+    public void setUp()
+        throws Exception
+    {
+        super.setUp();
+        MongoDBMapEntityStoreService es = serviceFinder.findService( MongoDBMapEntityStoreService.class ).get();
+        mongo = es.mongoInstanceUsed();
+        dbName = es.dbInstanceUsed().getName();
+
+    }
+
+    @Override
+    public void tearDown()
+        throws Exception
+    {
+        mongo.dropDatabase( dbName );
+        super.tearDown();
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/09b92801/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreTest.java b/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreTest.java
deleted file mode 100644
index 9c48fe5..0000000
--- a/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.polygene.entitystore.mongodb;
-
-import com.mongodb.Mongo;
-import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.entitystore.mongodb.assembly.MongoDBEntityStoreAssembler;
-import org.apache.polygene.test.EntityTestAssembler;
-import org.apache.polygene.test.entity.AbstractEntityStoreTest;
-import org.junit.BeforeClass;
-
-import static org.apache.polygene.test.util.Assume.assumeConnectivity;
-
-/**
- * Test the MongoMapEntityStoreService.
- * <p>Installing mongodb and starting it should suffice as the test use mongodb defaults: 127.0.0.1:27017</p>
- */
-public class MongoMapEntityStoreTest extends AbstractEntityStoreTest
-{
-    @BeforeClass
-    public static void beforeRedisMapEntityStoreTests()
-    {
-        assumeConnectivity( "localhost", 27017 );
-    }
-
-    @Override
-    // START SNIPPET: assembly
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        // END SNIPPET: assembly
-        super.assemble( module );
-
-        ModuleAssembly config = module.layer().module( "config" );
-        new EntityTestAssembler().assemble( config );
-
-        // START SNIPPET: assembly
-        new MongoDBEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
-        // END SNIPPET: assembly
-
-        MongoEntityStoreConfiguration mongoConfig = config.forMixin( MongoEntityStoreConfiguration.class ).declareDefaults();
-        mongoConfig.writeConcern().set( MongoEntityStoreConfiguration.WriteConcern.MAJORITY );
-        mongoConfig.database().set( "polygene:test" );
-        mongoConfig.collection().set( "polygene:test:entities" );
-        // START SNIPPET: assembly
-    }
-
-    // END SNIPPET: assembly
-    private Mongo mongo;
-    private String dbName;
-
-    @Override
-    public void setUp()
-        throws Exception
-    {
-        super.setUp();
-        MongoMapEntityStoreService es = serviceFinder.findService( MongoMapEntityStoreService.class ).get();
-        mongo = es.mongoInstanceUsed();
-        dbName = es.dbInstanceUsed().getName();
-    }
-
-    @Override
-    public void tearDown()
-        throws Exception
-    {
-        mongo.dropDatabase( dbName );
-        super.tearDown();
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/09b92801/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreWithCacheTest.java b/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreWithCacheTest.java
deleted file mode 100644
index cad95ea..0000000
--- a/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreWithCacheTest.java
+++ /dev/null
@@ -1,84 +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.mongodb;
-
-import com.mongodb.Mongo;
-import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.entitystore.mongodb.assembly.MongoDBEntityStoreAssembler;
-import org.apache.polygene.test.EntityTestAssembler;
-import org.apache.polygene.test.cache.AbstractEntityStoreWithCacheTest;
-import org.junit.BeforeClass;
-
-import static org.apache.polygene.test.util.Assume.assumeConnectivity;
-
-/**
- * Test the MongoMapEntityStoreService usage with a CachePool.
- * <p>Installing mongodb and starting it should suffice as the test use mongodb defaults: 127.0.0.1:27017</p>
- */
-public class MongoMapEntityStoreWithCacheTest
-    extends AbstractEntityStoreWithCacheTest
-{
-    @BeforeClass
-    public static void beforeRedisMapEntityStoreTests()
-    {
-        assumeConnectivity( "localhost", 27017 );
-    }
-
-    @Override
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        super.assemble( module );
-
-        ModuleAssembly config = module.layer().module( "config" );
-        new EntityTestAssembler().assemble( config );
-
-        new MongoDBEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
-
-        MongoEntityStoreConfiguration mongoConfig = config.forMixin( MongoEntityStoreConfiguration.class ).declareDefaults();
-        mongoConfig.writeConcern().set( MongoEntityStoreConfiguration.WriteConcern.MAJORITY );
-        mongoConfig.database().set( "polygene:test" );
-        mongoConfig.collection().set( "polygene:test:entities" );
-    }
-
-    private Mongo mongo;
-    private String dbName;
-
-    @Override
-    public void setUp()
-        throws Exception
-    {
-        super.setUp();
-        MongoMapEntityStoreService es = serviceFinder.findService( MongoMapEntityStoreService.class ).get();
-        mongo = es.mongoInstanceUsed();
-        dbName = es.dbInstanceUsed().getName();
-
-    }
-
-    @Override
-    public void tearDown()
-        throws Exception
-    {
-        mongo.dropDatabase( dbName );
-        super.tearDown();
-    }
-}


[2/9] polygene-java git commit: Trying to unify the naming of all the extensions.

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/libraries/rest/src/test/java/org/apache/polygene/library/rest/admin/DomainAssembler.java
----------------------------------------------------------------------
diff --git a/libraries/rest/src/test/java/org/apache/polygene/library/rest/admin/DomainAssembler.java b/libraries/rest/src/test/java/org/apache/polygene/library/rest/admin/DomainAssembler.java
index 33090b2..b385b68 100644
--- a/libraries/rest/src/test/java/org/apache/polygene/library/rest/admin/DomainAssembler.java
+++ b/libraries/rest/src/test/java/org/apache/polygene/library/rest/admin/DomainAssembler.java
@@ -24,7 +24,7 @@ import org.apache.polygene.bootstrap.Assembler;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.entitystore.memory.MemoryEntityStoreService;
-import org.apache.polygene.index.rdf.RdfIndexingEngineService;
+import org.apache.polygene.index.rdf.RdfIndexingService;
 import org.apache.polygene.library.rdf.repository.MemoryRepositoryService;
 
 import static org.apache.polygene.api.common.Visibility.application;
@@ -41,7 +41,7 @@ public class DomainAssembler
     {
         module.services(
             MemoryEntityStoreService.class,
-            RdfIndexingEngineService.class
+            RdfIndexingService.class
         ).visibleIn( application );
         module.services( MemoryRepositoryService.class ).identifiedBy( "rdf-indexing" ).visibleIn( layer );
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/jdbm/JdbmEntityStorePerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/jdbm/JdbmEntityStorePerformanceTest.java b/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/jdbm/JdbmEntityStorePerformanceTest.java
index 3b4e179..fd7e6b0 100644
--- a/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/jdbm/JdbmEntityStorePerformanceTest.java
+++ b/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/jdbm/JdbmEntityStorePerformanceTest.java
@@ -24,7 +24,7 @@ import org.apache.polygene.bootstrap.Assembler;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.cache.ehcache.EhCacheConfiguration;
 import org.apache.polygene.cache.ehcache.EhCachePoolService;
-import org.apache.polygene.entitystore.jdbm.JdbmConfiguration;
+import org.apache.polygene.entitystore.jdbm.JdbmEntityStoreConfiguration;
 import org.apache.polygene.entitystore.jdbm.assembly.JdbmEntityStoreAssembler;
 import org.apache.polygene.test.EntityTestAssembler;
 import org.apache.polygene.test.performance.entitystore.AbstractEntityStorePerformanceTest;
@@ -46,7 +46,7 @@ public class JdbmEntityStorePerformanceTest
         {
             new JdbmEntityStoreAssembler().assemble( module );
             ModuleAssembly configModule = module.layer().module( "Config" );
-            configModule.entities( JdbmConfiguration.class ).visibleIn( Visibility.layer );
+            configModule.entities( JdbmEntityStoreConfiguration.class ).visibleIn( Visibility.layer );
             new EntityTestAssembler().assemble( configModule );
 
             module.services( EhCachePoolService.class );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/sql/DerbySQLEntityStorePerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/sql/DerbySQLEntityStorePerformanceTest.java b/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/sql/DerbySQLEntityStorePerformanceTest.java
index 09a0331..2ece1bc 100644
--- a/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/sql/DerbySQLEntityStorePerformanceTest.java
+++ b/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/sql/DerbySQLEntityStorePerformanceTest.java
@@ -26,7 +26,7 @@ import org.apache.polygene.api.usecase.UsecaseBuilder;
 import org.apache.polygene.bootstrap.Assembler;
 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.SQLEntityStoreConfiguration;
 import org.apache.polygene.entitystore.sql.assembly.DerbySQLEntityStoreAssembler;
 import org.apache.polygene.library.sql.assembly.DataSourceAssembler;
 import org.apache.polygene.library.sql.dbcp.DBCPDataSourceServiceAssembler;
@@ -93,8 +93,8 @@ public class DerbySQLEntityStorePerformanceTest
         );
         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/tests/performance/src/perf/java/org/apache/polygene/test/performance/indexing/rdf/QueryPerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/polygene/test/performance/indexing/rdf/QueryPerformanceTest.java b/tests/performance/src/perf/java/org/apache/polygene/test/performance/indexing/rdf/QueryPerformanceTest.java
index c83356a..e1ec809 100644
--- a/tests/performance/src/perf/java/org/apache/polygene/test/performance/indexing/rdf/QueryPerformanceTest.java
+++ b/tests/performance/src/perf/java/org/apache/polygene/test/performance/indexing/rdf/QueryPerformanceTest.java
@@ -44,7 +44,7 @@ import org.apache.polygene.bootstrap.LayerAssembly;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.entitystore.memory.assembly.MemoryEntityStoreAssembler;
 import org.apache.polygene.index.rdf.assembly.RdfNativeSesameStoreAssembler;
-import org.apache.polygene.index.rdf.indexing.RdfIndexingService;
+import org.apache.polygene.index.rdf.indexing.RdfIndexerService;
 import org.apache.polygene.index.rdf.query.SesameExpressions;
 import org.apache.polygene.library.rdf.repository.NativeConfiguration;
 import org.apache.polygene.test.EntityTestAssembler;
@@ -136,7 +136,7 @@ public class QueryPerformanceTest
         application = polygene.newApplication( this );
         module = application.findModule( LAYER_DOMAIN, MODULE_DOMAIN );
         application.activate();
-        indexingDataDir = module.findService( RdfIndexingService.class ).get().dataDir();
+        indexingDataDir = module.findService( RdfIndexerService.class ).get().dataDir();
         uowf = module.unitOfWorkFactory();
     }
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/tools/envisage/src/test/java/org/apache/polygene/envisage/school/infrastructure/persistence/PersistenceAssembler.java
----------------------------------------------------------------------
diff --git a/tools/envisage/src/test/java/org/apache/polygene/envisage/school/infrastructure/persistence/PersistenceAssembler.java b/tools/envisage/src/test/java/org/apache/polygene/envisage/school/infrastructure/persistence/PersistenceAssembler.java
index ffdab72..24a3094 100644
--- a/tools/envisage/src/test/java/org/apache/polygene/envisage/school/infrastructure/persistence/PersistenceAssembler.java
+++ b/tools/envisage/src/test/java/org/apache/polygene/envisage/school/infrastructure/persistence/PersistenceAssembler.java
@@ -24,7 +24,7 @@ import org.apache.polygene.bootstrap.Assembler;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.entitystore.memory.MemoryEntityStoreService;
-import org.apache.polygene.index.rdf.RdfIndexingEngineService;
+import org.apache.polygene.index.rdf.RdfIndexingService;
 import org.apache.polygene.index.rdf.query.RdfQueryParserFactory;
 import org.apache.polygene.library.rdf.entity.EntityStateSerializer;
 import org.apache.polygene.library.rdf.entity.EntityTypeSerializer;
@@ -44,7 +44,7 @@ public class PersistenceAssembler
         module.services(
             MemoryEntityStoreService.class,
             // Query
-            RdfQueryParserFactory.class, RdfIndexingEngineService.class,
+            RdfQueryParserFactory.class, RdfIndexingService.class,
             MemoryRepositoryService.class
         ).visibleIn( application ).instantiateOnStartup();
     }


[4/9] polygene-java git commit: Trying to unify the naming of all the extensions.

Posted by ni...@apache.org.
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
 {
 
     /**


[9/9] polygene-java git commit: Added EntityStore configuration properties files. Added Datasource files. Modified some default values in various entitystores.

Posted by ni...@apache.org.
Added EntityStore configuration properties files. Added Datasource files. Modified some default values in various entitystores.

Signed-off-by: niclas <ni...@hedhman.org>


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

Branch: refs/heads/yeoman-work
Commit: 5820223091f16f8067dc002bcfcd5fa2400b8687
Parents: 32b29f9
Author: niclas <ni...@hedhman.org>
Authored: Sat May 27 10:10:19 2017 +0800
Committer: niclas <ni...@hedhman.org>
Committed: Sat May 27 10:10:19 2017 +0800

----------------------------------------------------------------------
 .../cassandra/CassandraEntityStoreTest.java     |  4 +-
 .../HazelcastEntityStoreConfiguration.java      | 17 ++++--
 .../entitystore/jclouds/JCloudsS3Test.java      |  4 +-
 .../LevelDBEntityStoreConfiguration.java        |  3 ++
 .../leveldb/LevelDBEntityStoreMixin.java        | 15 ++----
 .../mongodb/MongoDBEntityStoreMixin.java        |  2 +-
 .../StorageModule/bootstrap.tmpl                | 20 ++++++-
 .../InfrastructureLayer/StorageModule/module.js | 19 +++++++
 .../storage/ds-derbysql.properties              | 24 +++++++++
 .../StorageModule/storage/ds-h2sql.properties   | 24 +++++++++
 .../StorageModule/storage/ds-mysql.properties   | 24 +++++++++
 .../storage/ds-postgresql.properties            | 24 +++++++++
 .../StorageModule/storage/ds-sqlite.properties  | 24 +++++++++
 .../storage/es-cassandra.properties             | 48 +++++++++++++++++
 .../StorageModule/storage/es-file.properties    | 46 ++++++++++++++++
 .../StorageModule/storage/es-geode.properties   | 44 +++++++++++++++
 .../storage/es-hazelcast.properties             | 23 ++++++++
 .../StorageModule/storage/es-jclouds.properties | 34 ++++++++++++
 .../StorageModule/storage/es-jdbm.properties    | 22 ++++++++
 .../StorageModule/storage/es-leveldb.properties | 29 ++++++++++
 .../StorageModule/storage/es-mongodb.properties | 53 ++++++++++++++++++
 .../StorageModule/storage/es-redis.properties   | 29 ++++++++++
 .../StorageModule/storage/es-riak.properties    | 57 ++++++++++++++++++++
 .../StorageModule/storage/es-sql.properties     | 27 ++++++++++
 24 files changed, 597 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/58202230/extensions/entitystore-cassandra/src/test/java/org/apache/polygene/entitystore/cassandra/CassandraEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-cassandra/src/test/java/org/apache/polygene/entitystore/cassandra/CassandraEntityStoreTest.java b/extensions/entitystore-cassandra/src/test/java/org/apache/polygene/entitystore/cassandra/CassandraEntityStoreTest.java
index 3431081..8e2745a 100644
--- a/extensions/entitystore-cassandra/src/test/java/org/apache/polygene/entitystore/cassandra/CassandraEntityStoreTest.java
+++ b/extensions/entitystore-cassandra/src/test/java/org/apache/polygene/entitystore/cassandra/CassandraEntityStoreTest.java
@@ -52,7 +52,9 @@ public class CassandraEntityStoreTest
         module.services( CassandraEntityStoreService.class ).withTypes( CanRemoveAll.class ).withMixins( EmptyCassandraTableMixin.class );
 
         // START SNIPPET: assembly
-        new CassandraEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
+        new CassandraEntityStoreAssembler()
+            .withConfig( config, Visibility.layer )
+            .assemble( module );
         // END SNIPPET: assembly
 
         CassandraEntityStoreConfiguration cassandraConfig = config.forMixin( CassandraEntityStoreConfiguration.class ).declareDefaults();

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/58202230/extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreConfiguration.java b/extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreConfiguration.java
index 011c454..8ed17c3 100644
--- a/extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreConfiguration.java
+++ b/extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreConfiguration.java
@@ -19,7 +19,7 @@
  */
 package org.apache.polygene.entitystore.hazelcast;
 
-import org.apache.polygene.api.common.UseDefaults;
+import org.apache.polygene.api.common.Optional;
 import org.apache.polygene.api.property.Property;
 
 /**
@@ -29,10 +29,21 @@ import org.apache.polygene.api.property.Property;
 public interface HazelcastEntityStoreConfiguration
 {
 
-    @UseDefaults
+    /**
+     * The location of the Hazelcast configuration XML file.
+     * If the property is not a URL, it will be tried as a path name on the classpath.
+     *
+     * @return The location of the Hazelcast configuration XML file. Defaults to hazelcast-default.xml
+     */
+    @Optional
     Property<String> configXmlLocation();
 
-    @UseDefaults
+    /**
+     * The name of the Hazelcast map that is the key-value entity store.
+     *
+     * @return the name of Hazelcast map containing the entities. Defaults to "polygene:entitystore:data"
+     */
+    @Optional
     Property<String> mapName();
 
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/58202230/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsS3Test.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsS3Test.java b/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsS3Test.java
index ac64f7f..6bbb613 100644
--- a/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsS3Test.java
+++ b/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsS3Test.java
@@ -39,8 +39,8 @@ public class JCloudsS3Test extends AbstractEntityStoreTest
         ModuleAssembly config = module.layer().module( "config" );
         new EntityTestAssembler().assemble( config );
         new JCloudsEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
-        JCloudsMapEntityStoreConfiguration defaults =
-            config.forMixin( JCloudsMapEntityStoreConfiguration.class ).declareDefaults();
+        JCloudsEntityStoreConfiguration defaults =
+            config.forMixin( JCloudsEntityStoreConfiguration.class ).declareDefaults();
 
         String host = DOCKER.getDockerHost();
         int port = DOCKER.getExposedContainerPort( "8000/tcp" );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/58202230/extensions/entitystore-leveldb/src/main/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-leveldb/src/main/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreConfiguration.java b/extensions/entitystore-leveldb/src/main/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreConfiguration.java
index 1042b69..b1131f8 100644
--- a/extensions/entitystore-leveldb/src/main/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreConfiguration.java
+++ b/extensions/entitystore-leveldb/src/main/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreConfiguration.java
@@ -58,5 +58,8 @@ public interface LevelDBEntityStoreConfiguration
 
     @Optional
     Property<Integer> writeBufferSize();
+
+    @Optional
+    Property<Boolean> errorIfExists();
 }
 // END SNIPPET: config

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/58202230/extensions/entitystore-leveldb/src/main/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-leveldb/src/main/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreMixin.java b/extensions/entitystore-leveldb/src/main/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreMixin.java
index 1db246e..6e8eecf 100644
--- a/extensions/entitystore-leveldb/src/main/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreMixin.java
+++ b/extensions/entitystore-leveldb/src/main/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreMixin.java
@@ -127,6 +127,10 @@ public class LevelDBEntityStoreMixin
         {
             options.writeBufferSize( config.writeBufferSize().get() );
         }
+        if( config.errorIfExists().get() != null )
+        {
+            options.errorIfExists( config.errorIfExists().get() );
+        }
 
         // Open/Create the database
         File dbFile = new File( fileConfig.dataDirectory(), descriptor.identity().toString() );
@@ -236,8 +240,7 @@ public class LevelDBEntityStoreMixin
     public void applyChanges( MapChanges changes )
         throws Exception
     {
-        final WriteBatch writeBatch = db.createWriteBatch();
-        try
+        try( WriteBatch writeBatch = db.createWriteBatch() )
         {
             changes.visitMap( new MapChanger()
             {
@@ -257,7 +260,6 @@ public class LevelDBEntityStoreMixin
                             String jsonState = toString();
                             writeBatch.put( ref.identity().toString().getBytes( charset ), jsonState.getBytes( charset ) );
                         }
-
                     };
                 }
 
@@ -277,7 +279,6 @@ public class LevelDBEntityStoreMixin
                             writeBatch.put( mapChange.reference().identity().toString().getBytes( charset ),
                                             jsonState.getBytes( charset ) );
                         }
-
                     };
                 }
 
@@ -287,14 +288,8 @@ public class LevelDBEntityStoreMixin
                 {
                     writeBatch.delete( ref.identity().toString().getBytes( charset ) );
                 }
-
             } );
             db.write( writeBatch );
         }
-        finally
-        {
-            writeBatch.close();
-        }
     }
-
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/58202230/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreMixin.java b/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreMixin.java
index 35fede7..306d6e7 100644
--- a/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreMixin.java
+++ b/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreMixin.java
@@ -62,7 +62,7 @@ public class MongoDBEntityStoreMixin
     implements ServiceActivation, MapEntityStore, MongoDBAccessors
 {
     private static final String DEFAULT_DATABASE_NAME = "polygene:entitystore";
-    private static final String DEFAULT_COLLECTION_NAME = "polygene:entitystore:entities";
+    private static final String DEFAULT_COLLECTION_NAME = "entities";
     public static final String IDENTITY_COLUMN = "_id";
     public static final String STATE_COLUMN = "state";
     @This

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/58202230/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/bootstrap.tmpl
index 151dfab..2df7306 100644
--- a/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/bootstrap.tmpl
@@ -41,10 +41,26 @@ public class <%- polygene.entitystore %>StorageModule
     public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
         throws AssemblyException
     {
-        new <%- polygene.entitystore %>EntityStoreAssembler()
+<% if( polygene.entitystore.contains( 'SQL' ) ) {
+%>        // DataSourceService
+        new DBCPDataSourceServiceAssembler()
+            .identifiedBy( "<%= polygene.entitystore.toLowerCase() %>-datasource-service" )
+            .visibleIn( Visibility.module )
+            .withConfig( config, Visibility.layer )
+            .assemble( module );
+
+        // DataSource
+        new DataSourceAssembler()
+            .withDataSourceServiceIdentity( "<%= polygene.entitystore.toLowerCase() %>-datasource-service" )
+            .identifiedBy( "ds-<%= polygene.entitystore.toLowerCase() %>" )
+            .visibleIn( Visibility.module )
+            .withCircuitBreaker()
+            .assemble( module );
+<% }
+%>        new <%- polygene.entitystore %>EntityStoreAssembler()
             .visibleIn( Visibility.application  )
             .withConfig( configModule, Visibility.application )
-            .identifiedBy( "entitystore-<%- polygene.entitystore.toLowerCase() %>" )
+            .identifiedBy( "es-<%- polygene.entitystore.toLowerCase() %>" )
             .assemble( module );
         return module;
     }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/58202230/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/module.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/module.js b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/module.js
index 3c17fcc..270d464 100644
--- a/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/module.js
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/module.js
@@ -22,5 +22,24 @@ module.exports = {
         p.copyTemplate(p.ctx,
             'InfrastructureLayer/StorageModule/bootstrap.tmpl',
             'bootstrap/src/main/java/' + p.javaPackageDir + '/bootstrap/infrastructure/' + p.entitystore + 'StorageModule.java');
+
+        var configurationFile = 'InfrastructureLayer/StorageModule/storage/es-' + p.entitystore.toLowerCase() + '.properties';
+        var confFile = require(configurationFile);
+        if (confFile.existsSync(path)) {
+            p.copyTemplate(p.ctx,
+                configurationFile,
+                'app/src/main/resources/config/');
+        }
+
+        var datasourceFile = 'InfrastructureLayer/StorageModule/storage/ds-' + p.entitystore.toLowerCase() + '.properties';
+        var dsFile = require(datasourceFile);
+        if (dsFile.existsSync(path)) {
+            p.copyTemplate(p.ctx,
+                'InfrastructureLayer/StorageModule/storage/es-sql.properties',
+                'app/src/main/resources/config/es-' + p.entitystore.toLowerCase());
+            p.copyTemplate(p.ctx,
+                configurationFile,
+                'app/src/main/resources/config/');
+        }
     }
 };

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/58202230/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/ds-derbysql.properties
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/ds-derbysql.properties b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/ds-derbysql.properties
new file mode 100644
index 0000000..39d9ca0
--- /dev/null
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/ds-derbysql.properties
@@ -0,0 +1,24 @@
+#
+#  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.
+#
+#
+#
+enabled=true
+url=jdbc:derby:memory:<%= polygene.name %>;create=true
+driver=org.apache.derby.jdbc.EmbeddedDriver
+username=
+password=

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/58202230/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/ds-h2sql.properties
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/ds-h2sql.properties b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/ds-h2sql.properties
new file mode 100644
index 0000000..69f4a33
--- /dev/null
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/ds-h2sql.properties
@@ -0,0 +1,24 @@
+#
+#  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.
+#
+#
+#
+enabled=true
+url=jdbc:h2:file:h2-entities/
+driver=org.h2.Driver
+username=
+password=

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/58202230/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/ds-mysql.properties
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/ds-mysql.properties b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/ds-mysql.properties
new file mode 100644
index 0000000..c1fd527
--- /dev/null
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/ds-mysql.properties
@@ -0,0 +1,24 @@
+#
+#  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.
+#
+#
+#
+enabled=true
+url=jdbc:mysql://127.0.0.1:3306/<%= polygene.name %>?profileSQL=false&useLegacyDatetimeCode=false&serverTimezone=UTC&nullCatalogMeansCurrent=true&nullNamePatternMatchesAll=true
+driver=com.mysql.cj.jdbc.Driver
+username=polygene
+password=ThisIsGreat!

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/58202230/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/ds-postgresql.properties
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/ds-postgresql.properties b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/ds-postgresql.properties
new file mode 100644
index 0000000..333d6aa
--- /dev/null
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/ds-postgresql.properties
@@ -0,0 +1,24 @@
+#
+#  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.
+#
+#
+#
+enabled=true
+url=jdbc:postgres://127.0.0.1:5432/<%= polygene.name %>
+driver=org.postgresql.Driver
+username=polygene
+password=ThisIsGreat!

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/58202230/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/ds-sqlite.properties
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/ds-sqlite.properties b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/ds-sqlite.properties
new file mode 100644
index 0000000..5c49ece
--- /dev/null
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/ds-sqlite.properties
@@ -0,0 +1,24 @@
+#
+#  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.
+#
+#
+#
+enabled=true
+url=jdbc:sqlite:sqlite-entities/
+driver=org.sqlite.JDBC
+username=polygene
+password=ThisIsGreat

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/58202230/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-cassandra.properties
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-cassandra.properties b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-cassandra.properties
new file mode 100644
index 0000000..c2a7a45
--- /dev/null
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-cassandra.properties
@@ -0,0 +1,48 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+# A comma or space separated list of <code>hostname:port</code> to the
+# Cassandra cluster.
+#
+# A small list of hostnames should be given, as the client is capable to
+# discover the topology by itself and only need one host that it can connect
+# to.
+# Also not that Cassandra refuse to bind to all interfaces on a host, so you
+# need to know which hostname corresponds to the interface that Cassandra is
+# bound to. This may not include 'localhost'.
+# Defaults: null
+# hostnames=
+# The name of the cluster to connect to.
+# Defaults: polygene-cluster
+# clusterName=polygene-cluster
+# The replication factor to be used, if a KEYSPACE is created.
+# Defaults: 3
+# replicationFactor=3
+# The Cassandra client uses the CQL interface, and typically needs a username
+# and password.
+# Defaults: no user name will be attempted.
+# username=
+# password=
+# The name of the KEYSPACE to be used.
+# Defaults:polygene
+# keySpace=polygene
+# The name of the entity TABLE to be used.
+# All entities are stored in the same table, with one entity per row.
+# Defaults: entitystore
+# entityTableName=entitystore
+# Defines whether a KEYSPACE and entity TABLE should be created if not already
+# present in the Cassandra cluster.
+# Defaults: false
+# createIfMissing=false
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/58202230/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-file.properties
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-file.properties b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-file.properties
new file mode 100644
index 0000000..6683bf7
--- /dev/null
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-file.properties
@@ -0,0 +1,46 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+# The directory where the File Entity Store will be keep its persisted state.
+#     If no configuration is provided at all, then the default location is
+#     {@code System.getProperty( "user.dir" ) + "/polygene/filestore"; }.
+#     If a configuration is given, the entity store will be placed in the
+#     DATA directory, which is operating system specific.
+# Default locations;
+#  Linux/Unix : {user}/.{application}/data
+#  OSX : {user}/Library/Application Support/{application}
+#  Windows : {user}/Application Data/{application}/data
+# where;
+#   {user} = Current User's home directory
+#   {application} = Application's name, as set in assembly.
+#
+# Ignored if the FileConfiguration service is found.
+# The content inside this directory should not be modified directly, and doing so may corrupt the data.
+# directory=
+# Defines how many slice directories the store should use.
+# Many operating systems run into performance problems when the number of files
+# in a directory grows. If you expect a large number of entities in the file
+# entity store, it is wise to set the number of slices (default is 1) to an
+# approximation of the square root of number of expected entities.
+# For instance, if you estimate that you will have 1 million entities in the
+# file entity store, you should set the slices to 1000.
+# There is an limit of minimum 1 slice and maximum 10,000 slices, and if more
+# slices than that is needed, you are probably pushing this entitystore beyond
+# its capabilities.
+# Note that the slices() can not be changed once it has been set, as it would
+# cause the entity store not to find the entities anymore.
+#
+# @Range(min=1, max=10000)
+# slices=1

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/58202230/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-geode.properties
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-geode.properties b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-geode.properties
new file mode 100644
index 0000000..e257168
--- /dev/null
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-geode.properties
@@ -0,0 +1,44 @@
+#  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.
+# Geode Topology.
+# Possible values; EMBEDDED, CLIENT_SERVER
+# Default: EMBEDDED
+#
+# topology=EMBEDDED
+# Geode Cache Name.
+# Default: polygene:cache
+#
+#cacheName=polygene:cache
+# Cache properties path, loaded from the classpath.
+# Default: <null>
+# cachePropertiesPath=
+# Cache Region Shortcut.
+#
+# In {@literal EMBEDDED} {@link #topology()}, defaults to  {@literal LOCAL},
+# see {@link org.apache.geode.cache.RegionShortcut}.
+#
+# In {@literal CLIENT_SERVER} {@link #topology()}, defaults to {@literal PROXY},
+# see {@link org.apache.geode.cache.client.ClientRegionShortcut}.
+#
+# Default: <null>
+#
+# regionShortcut=
+# Geode Region Name.
+#
+# Region names may only be alphanumeric and may contain hyphens or underscores.
+# Defaults: polygene-entitystore-region
+#
+# regionName=polygene-entitystore-region

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/58202230/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-hazelcast.properties
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-hazelcast.properties b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-hazelcast.properties
new file mode 100644
index 0000000..bd838b9
--- /dev/null
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-hazelcast.properties
@@ -0,0 +1,23 @@
+#  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.
+# The location of the Hazelcast configuration XML file.
+# If the property is not a URL, it will be tried as a path name on the \
+# classpath.
+# Defaults: hazelcast-default.xml
+# configXmlLocation=hazelcast-default.xml
+# The name of the Hazelcast map that is the key-value entity store.
+# Defaults: polygene:entitystore:data
+# mapName=polygene:entitystore:data

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/58202230/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-jclouds.properties
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-jclouds.properties b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-jclouds.properties
new file mode 100644
index 0000000..8fc32dc
--- /dev/null
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-jclouds.properties
@@ -0,0 +1,34 @@
+#  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.
+# Name of the JClouds provider to use.
+# Defaults: 'transient'.
+# provider=transient
+# Endpoint for the BlobStore provider.
+# Defaults:
+# endpoint=
+# Name of the JClouds container to use.
+# Defaults: polygene-entities
+# container=polygene-entities
+# The identifier and password (i.e. credentials) to connect to the JClouss
+# instance.
+#
+# identifier=
+# credential=
+# Use this to fine tune your provider implementation according to JClouds
+# documentation.
+# properties=
+
+

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/58202230/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-jdbm.properties
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-jdbm.properties b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-jdbm.properties
new file mode 100644
index 0000000..095c379
--- /dev/null
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-jdbm.properties
@@ -0,0 +1,22 @@
+#  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.
+# The file where the JDBM data will be stored
+# Default: System.getProperty( "user.dir" ) + "/polygene/jdbmstore.data";
+# file=
+# See JDBM documentation on RecordManagerOptions.AUTO_COMMIT
+# autoCommit=false
+# See JDBM documentation on RecordManagerOptions.DISABLE_TRANSACTIONS
+# disableTransactions=false

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/58202230/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-leveldb.properties
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-leveldb.properties b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-leveldb.properties
new file mode 100644
index 0000000..169a0d4
--- /dev/null
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-leveldb.properties
@@ -0,0 +1,29 @@
+#  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.
+# LevelDB flavour, can be 'java' or 'jni'.
+# Defaults: tries 'jni' and fallback to 'java'.
+# flavour=java
+# blockRestartInterval=
+# blockSize=
+# cacheSize=
+# Type of compression to be used. Either SNAPPY or NONE
+# compression=NONE
+# Maximum number of files to open.
+# maxOpenFiles=
+# paranoidChecks=
+# verifyChecksums=
+# writeBufferSize=
+# errorIfExists=false
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/58202230/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-mongodb.properties
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-mongodb.properties b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-mongodb.properties
new file mode 100644
index 0000000..75ed36b
--- /dev/null
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-mongodb.properties
@@ -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.
+# Defaults: 127.0.0.1
+# hostname=
+# port=
+# nodes=
+# username=
+# password=
+# Defaults: polygene:entitystore
+# database=polygene:entitystore
+# Defaults: entities
+# collection=entities
+# The write concern to be used. One of the following;
+#
+# ACKNOWLEDGED : Write operations that use this write concern will wait for
+#                acknowledgement,  using the default write concern configured
+#                on the server.  This is the default value.
+#
+# W1 : Write operations that use this write concern will wait for
+#      acknowledgement from a single member.
+#
+# W2 : Write operations that use this write concern will wait for
+#      acknowledgement from two members.
+#
+# W3 : Write operations that use this write concern will wait for
+#      acknowledgement from three members.
+#
+# UNACKNOWLEDGED : Write operations that use this write concern will return
+#                  as soon as the message is written to the socket. Exceptions
+#                  are raised for network issues, but not server errors.
+#
+# JOURNALED : Write operations wait for the server to group commit to the
+#             journal file on disk.
+#
+# MAJORITY : Exceptions are raised for network issues, and server errors waits
+#            on a majority of servers for the write operation.
+#
+# Defaults: ACKNOWLEDGED
+# writeConcern=ACKNOWLEDGED
+

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/58202230/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-redis.properties
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-redis.properties b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-redis.properties
new file mode 100644
index 0000000..ae9e1da
--- /dev/null
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-redis.properties
@@ -0,0 +1,29 @@
+#  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.
+# Redis host.
+# Defaults: 127.0.0.1
+# host=127.0.0.1
+# Redis port.
+# Defaults: 6379
+# port=6379
+# Connection timeout in milliseconds.
+# Defaults: 2000
+# timeout=2000
+# Password.
+# password=
+# Database number.
+# Defaults: 0
+# database=

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/58202230/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-riak.properties
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-riak.properties b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-riak.properties
new file mode 100644
index 0000000..bca287b
--- /dev/null
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-riak.properties
@@ -0,0 +1,57 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+# List of Riak Protocol Buffer hosts.
+#
+# Each entry can contain either an IP address / hostname
+# or an IP address / hostname followed by a column and the host's port.
+#
+# Defaults: 127.0.0.1
+# hosts=
+# User name to use for authentication.
+# username=
+# Password to use for authentication.
+# password=
+# Type of the keystore used for server certificate authentication.
+# @OneOf( { "PKCS12", "JCEKS", "JKS" } )
+# truststoreType=
+# Path of the keystore used for server certificate authentication.
+# truststorePath=
+# Password of the keystore used for server certificate authentication.
+# truststorePassword=
+# Type of the keystore used for client certificate authentication.
+# @OneOf( { "PKCS12", "JCEKS", "JKS" } )
+# keystoreType=
+# Path of the keystore used for client certificate authentication.
+# keystorePath=
+# Password of the keystore used for client certificate authentication.
+# keystorePassword=
+# Password of the key used for client certificate authentication.
+# keyPassword=
+# Riak Bucket where Entities state will be stored.
+# Defaults:" polygene:entities
+# bucket=polygene:entities
+# Cluster execution attempts.
+# clusterExecutionAttempts=
+# Minimum connections per node.
+# minConnections
+# Maximum connections per node.
+# maxConnections=
+# Block on maximum connections.
+# blockOnMaxConnections=
+# Connection timeout.
+# connectionTimeout=
+# Idle timeout.
+# idleTimeout=

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/58202230/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-sql.properties
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-sql.properties b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-sql.properties
new file mode 100644
index 0000000..4ce8bb3
--- /dev/null
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/storage/es-sql.properties
@@ -0,0 +1,27 @@
+#  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.
+# Name of the database schema to use.
+# Ignored on SQL databases that don't support schemas.
+# Defaults: POLYGENE_ES
+# schemaName=POLYGENE_ES
+# Name of the entities table.
+# Defaults: POLYGENE_ENTITIES
+# entityTableName=POLYGENE_ENTITIES
+# Defines whether the database schema and table should be created if not
+# already present.
+# Defaults: true
+# createIfMissing=true
+


[8/9] polygene-java git commit: Merging in 'develop'

Posted by ni...@apache.org.
Merging in 'develop'

Signed-off-by: niclas <ni...@hedhman.org>


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

Branch: refs/heads/yeoman-work
Commit: 32b29f99177d7bb61a73d317ce1b5b1e88ddf4e7
Parents: 8721a02 4a7611c
Author: niclas <ni...@hedhman.org>
Authored: Fri May 26 14:56:08 2017 +0800
Committer: niclas <ni...@hedhman.org>
Committed: Fri May 26 14:56:08 2017 +0800

----------------------------------------------------------------------
 .../entitystore/geode/GeodeConfiguration.java   |  81 ----
 .../geode/GeodeEntityStoreConfiguration.java    |  81 ++++
 .../geode/GeodeEntityStoreMixin.java            |  10 +-
 .../assembly/GeodeEntityStoreAssembler.java     |   4 +-
 .../hazelcast/HazelcastConfiguration.java       |  39 --
 .../HazelcastEntityStoreConfiguration.java      |  39 ++
 .../hazelcast/HazelcastEntityStoreMixin.java    |   6 +-
 .../assembly/HazelcastEntityStoreAssembler.java |   4 +-
 .../JCloudsEntityStoreConfiguration.java        |  54 +++
 .../jclouds/JCloudsEntityStoreMixin.java        | 284 ++++++++++++++
 .../jclouds/JCloudsEntityStoreService.java      |  48 +++
 .../JCloudsMapEntityStoreConfiguration.java     |  54 ---
 .../jclouds/JCloudsMapEntityStoreMixin.java     | 284 --------------
 .../jclouds/JCloudsMapEntityStoreService.java   |  48 ---
 .../assembly/JCloudsEntityStoreAssembler.java   |   8 +-
 .../jclouds/JCloudsFilesystemTest.java          |   4 +-
 .../entitystore/jdbm/JdbmConfiguration.java     |  52 ---
 .../jdbm/JdbmEntityStoreConfiguration.java      |  52 +++
 .../entitystore/jdbm/JdbmEntityStoreMixin.java  |   4 +-
 .../jdbm/JdbmEntityStoreService.java            |   8 +-
 .../jdbm/assembly/JdbmEntityStoreAssembler.java |   4 +-
 .../entitystore/mongodb/MongoAccessors.java     |  32 --
 .../entitystore/mongodb/MongoDBAccessors.java   |  32 ++
 .../mongodb/MongoDBEntityStoreMixin.java        | 322 ++++++++++++++++
 .../mongodb/MongoDBEntityStoreService.java      |  49 +++
 .../mongodb/MongoMapEntityStoreMixin.java       | 322 ----------------
 .../mongodb/MongoMapEntityStoreService.java     |  49 ---
 .../assembly/MongoDBEntityStoreAssembler.java   |   4 +-
 .../mongodb/EmbedMongoDBMapEntityStoreTest.java |  88 +++++
 .../mongodb/EmbedMongoMapEntityStoreTest.java   |  88 -----
 .../mongodb/MongoDBEntityStoreTest.java         |  88 +++++
 .../MongoDBEntityStoreWithCacheTest.java        |  84 ++++
 .../mongodb/MongoMapEntityStoreTest.java        |  88 -----
 .../MongoMapEntityStoreWithCacheTest.java       |  84 ----
 .../redis/RedisEntityStoreConfiguration.java    |   2 +-
 .../redis/RedisEntityStoreMixin.java            | 177 +++++++++
 .../redis/RedisEntityStoreService.java          |  49 +++
 .../redis/RedisMapEntityStoreMixin.java         | 177 ---------
 .../redis/RedisMapEntityStoreService.java       |  49 ---
 .../assembly/RedisEntityStoreAssembler.java     |   4 +-
 .../entitystore/redis/RedisEntityStoreTest.java |  80 ++++
 .../redis/RedisEntityStoreWithCacheTest.java    |  74 ++++
 .../redis/RedisMapEntityStoreTest.java          |  80 ----
 .../redis/RedisMapEntityStoreWithCacheTest.java |  74 ----
 .../entitystore/riak/RiakEntityStoreMixin.java  | 384 +++++++++++++++++++
 .../riak/RiakEntityStoreService.java            |  53 +++
 .../riak/RiakMapEntityStoreMixin.java           | 384 -------------------
 .../riak/RiakMapEntityStoreService.java         |  53 ---
 .../riak/assembly/RiakEntityStoreAssembler.java |   8 +-
 .../entitystore/riak/RiakEntityStoreTest.java   |  71 ++++
 .../riak/RiakEntityStoreWithCacheTest.java      |  69 ++++
 .../riak/RiakMapEntityStoreTest.java            |  71 ----
 .../riak/RiakMapEntityStoreWithCacheTest.java   |  69 ----
 .../sql/SQLEntityStoreConfiguration.java        |  47 +++
 .../entitystore/sql/SQLEntityStoreMixin.java    | 244 ++++++++++++
 .../entitystore/sql/SQLEntityStoreService.java  |  43 +++
 .../sql/SQLMapEntityStoreConfiguration.java     |  47 ---
 .../entitystore/sql/SQLMapEntityStoreMixin.java | 244 ------------
 .../sql/SQLMapEntityStoreService.java           |  43 ---
 .../AbstractSQLEntityStoreAssembler.java        |  97 +++++
 .../AbstractSQLMapEntityStoreAssembler.java     |  97 -----
 .../assembly/DerbySQLEntityStoreAssembler.java  |   2 +-
 .../sql/assembly/H2SQLEntityStoreAssembler.java |   2 +-
 .../sql/assembly/MySQLEntityStoreAssembler.java |   2 +-
 .../PostgreSQLEntityStoreAssembler.java         |   2 +-
 .../assembly/SQLiteEntityStoreAssembler.java    |   2 +-
 .../sql/DerbySQLEntityStoreTest.java            |   4 +-
 .../entitystore/sql/MySQLEntityStoreTest.java   |   4 +-
 .../ElasticSearchClusterConfiguration.java      |   2 +-
 .../ElasticSearchConfiguration.java             |  50 ---
 .../ElasticSearchIndexException.java            |  36 --
 .../ElasticSearchIndexExporter.java             |   5 +-
 .../elasticsearch/ElasticSearchIndexer.java     |   2 +-
 .../ElasticSearchIndexingConfiguration.java     |  49 +++
 .../ElasticSearchIndexingException.java         |  35 ++
 .../elasticsearch/ElasticSearchSupport.java     |   5 +-
 .../assembly/ESClientIndexQueryAssembler.java   |   4 +-
 .../ESFilesystemIndexQueryAssembler.java        |   4 +-
 .../elasticsearch/client/ESClientSupport.java   |   6 +-
 .../filesystem/ESFilesystemSupport.java         |   6 +-
 .../ElasticSearchComplexQueryTest.java          |   2 +-
 .../elasticsearch/ElasticSearchFinderTest.java  |   2 +-
 .../ElasticSearchQueryMultimoduleTest.java      |   2 +-
 .../elasticsearch/ElasticSearchQueryTest.java   |   2 +-
 .../index/elasticsearch/ElasticSearchTest.java  |   2 +-
 .../index/elasticsearch/ImmenseTermTest.java    |   2 +-
 .../index/rdf/RdfIndexingEngineService.java     |  30 --
 .../polygene/index/rdf/RdfIndexingService.java  |  30 ++
 .../rdf/assembly/RdfMemoryStoreAssembler.java   |   4 +-
 .../assembly/RdfNativeSesameStoreAssembler.java |   4 +-
 .../assembly/RdfRdbmsSesameStoreAssembler.java  |   4 +-
 .../index/rdf/indexing/RdfExporter.java         | 106 -----
 .../index/rdf/indexing/RdfIndexExporter.java    |  92 +++++
 .../index/rdf/indexing/RdfIndexerService.java   | 239 ++++++++++++
 .../index/rdf/indexing/RdfIndexingService.java  | 240 ------------
 .../polygene/index/rdf/RdfComplexQueryTest.java |   2 +-
 .../polygene/index/rdf/RdfEntityFinderTest.java |   2 +-
 .../polygene/index/rdf/qi95/Qi95IssueTest.java  |   6 +-
 .../polygene/index/solr/SolrQueryService.java   |   3 +-
 .../index/sql/SQLIndexingConfiguration.java     |  31 ++
 .../sql/SQLIndexingEngineConfiguration.java     |  31 --
 .../index/sql/SQLIndexingEngineService.java     |  44 ---
 .../polygene/index/sql/SQLIndexingService.java  |  44 +++
 .../AbstractSQLIndexQueryAssembler.java         |   7 +-
 .../assembly/PostgreSQLIndexQueryAssembler.java |   4 +-
 .../support/postgresql/PostgreSQLService.java   |   4 +-
 .../codahale/CodahaleMetricsProvider.java       |   3 +-
 .../polygene/index/reindexer/ReindexerTest.java |   6 +-
 .../library/rest/admin/IndexResource.java       |  10 +-
 .../library/rest/admin/DomainAssembler.java     |   4 +-
 .../jdbm/JdbmEntityStorePerformanceTest.java    |   4 +-
 .../sql/DerbySQLEntityStorePerformanceTest.java |   6 +-
 .../indexing/rdf/QueryPerformanceTest.java      |   4 +-
 .../persistence/PersistenceAssembler.java       |   4 +-
 114 files changed, 3236 insertions(+), 3254 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/32b29f99/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreTest.java
----------------------------------------------------------------------
diff --cc extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreTest.java
index 0000000,131e76e..eeeca64
mode 000000,100644..100644
--- a/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreTest.java
+++ b/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreTest.java
@@@ -1,0 -1,88 +1,88 @@@
+ /*
+  *  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.mongodb;
+ 
+ import com.mongodb.Mongo;
+ import org.apache.polygene.api.common.Visibility;
+ import org.apache.polygene.bootstrap.AssemblyException;
+ import org.apache.polygene.bootstrap.ModuleAssembly;
+ import org.apache.polygene.entitystore.mongodb.assembly.MongoDBEntityStoreAssembler;
+ import org.apache.polygene.test.EntityTestAssembler;
+ import org.apache.polygene.test.entity.AbstractEntityStoreTest;
+ import org.junit.BeforeClass;
+ 
+ import static org.apache.polygene.test.util.Assume.assumeConnectivity;
+ 
+ /**
+  * Test the MongoDBEntityStoreService.
+  * <p>Installing mongodb and starting it should suffice as the test use mongodb defaults: 127.0.0.1:27017</p>
+  */
+ public class MongoDBEntityStoreTest extends AbstractEntityStoreTest
+ {
+     @BeforeClass
 -    public static void beforeRedisMapEntityStoreTests()
++    public static void beforeMongoMapEntityStoreTests()
+     {
+         assumeConnectivity( "localhost", 27017 );
+     }
+ 
+     @Override
+     // START SNIPPET: assembly
+     public void assemble( ModuleAssembly module )
+         throws AssemblyException
+     {
+         // END SNIPPET: assembly
+         super.assemble( module );
+ 
+         ModuleAssembly config = module.layer().module( "config" );
+         new EntityTestAssembler().assemble( config );
+ 
+         // START SNIPPET: assembly
+         new MongoDBEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
+         // END SNIPPET: assembly
+ 
+         MongoDBEntityStoreConfiguration mongoConfig = config.forMixin( MongoDBEntityStoreConfiguration.class ).declareDefaults();
+         mongoConfig.writeConcern().set( MongoDBEntityStoreConfiguration.WriteConcern.MAJORITY );
+         mongoConfig.database().set( "polygene:test" );
+         mongoConfig.collection().set( "polygene:test:entities" );
+         // START SNIPPET: assembly
+     }
+ 
+     // END SNIPPET: assembly
+     private Mongo mongo;
+     private String dbName;
+ 
+     @Override
+     public void setUp()
+         throws Exception
+     {
+         super.setUp();
+         MongoDBEntityStoreService es = serviceFinder.findService( MongoDBEntityStoreService.class ).get();
+         mongo = es.mongoInstanceUsed();
+         dbName = es.dbInstanceUsed().getName();
+     }
+ 
+     @Override
+     public void tearDown()
+         throws Exception
+     {
+         mongo.dropDatabase( dbName );
+         super.tearDown();
+     }
+ }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/32b29f99/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisEntityStoreTest.java
----------------------------------------------------------------------
diff --cc extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisEntityStoreTest.java
index 0000000,671bffa..f980e59
mode 000000,100644..100644
--- a/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisEntityStoreTest.java
+++ b/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisEntityStoreTest.java
@@@ -1,0 -1,80 +1,80 @@@
+ /*
+  *  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.redis;
+ 
+ import org.apache.polygene.api.common.Visibility;
+ import org.apache.polygene.bootstrap.AssemblyException;
+ import org.apache.polygene.bootstrap.ModuleAssembly;
+ import org.apache.polygene.entitystore.redis.assembly.RedisEntityStoreAssembler;
+ import org.apache.polygene.test.EntityTestAssembler;
++import org.apache.polygene.test.docker.DockerRule;
+ import org.apache.polygene.test.entity.AbstractEntityStoreTest;
 -import org.apache.polygene.test.internal.DockerRule;
+ import org.junit.ClassRule;
+ import redis.clients.jedis.Jedis;
+ import redis.clients.jedis.JedisPool;
+ 
+ public class RedisEntityStoreTest
+     extends AbstractEntityStoreTest
+ {
+     @ClassRule
+     public static final DockerRule DOCKER = new DockerRule( "redis", 6379 );
+ 
+     @Override
+     // START SNIPPET: assembly
+     public void assemble( ModuleAssembly module )
+         throws AssemblyException
+     {
+         // END SNIPPET: assembly
+         super.assemble( module );
+         ModuleAssembly config = module.layer().module( "config" );
+         new EntityTestAssembler().assemble( config );
+         // START SNIPPET: assembly
+         new RedisEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
+         // END SNIPPET: assembly
+         RedisEntityStoreConfiguration redisConfig = config.forMixin( RedisEntityStoreConfiguration.class )
+                                                           .declareDefaults();
+         redisConfig.host().set( DOCKER.getDockerHost() );
+         redisConfig.port().set( DOCKER.getExposedContainerPort( "6379/tcp" ) );
+         // START SNIPPET: assembly
+     }
+     // END SNIPPET: assembly
+ 
+     private JedisPool jedisPool;
+ 
+     @Override
+     public void setUp()
+         throws Exception
+     {
+         super.setUp();
+         RedisEntityStoreService es = serviceFinder.findService( RedisEntityStoreService.class ).get();
+         jedisPool = es.jedisPool();
+     }
+ 
+     @Override
+     public void tearDown()
+         throws Exception
+     {
+         try( Jedis jedis = jedisPool.getResource() )
+         {
+             jedis.flushDB();
+         }
+         super.tearDown();
+     }
+ }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/32b29f99/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --cc extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisEntityStoreWithCacheTest.java
index 0000000,7cd9cbe..d8c72d3
mode 000000,100644..100644
--- a/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisEntityStoreWithCacheTest.java
+++ b/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisEntityStoreWithCacheTest.java
@@@ -1,0 -1,74 +1,74 @@@
+ /*
+  *  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.redis;
+ 
+ import org.apache.polygene.api.common.Visibility;
+ import org.apache.polygene.bootstrap.AssemblyException;
+ import org.apache.polygene.bootstrap.ModuleAssembly;
+ import org.apache.polygene.entitystore.redis.assembly.RedisEntityStoreAssembler;
+ import org.apache.polygene.test.EntityTestAssembler;
+ import org.apache.polygene.test.cache.AbstractEntityStoreWithCacheTest;
 -import org.apache.polygene.test.internal.DockerRule;
++import org.apache.polygene.test.docker.DockerRule;
+ import org.junit.ClassRule;
+ import redis.clients.jedis.Jedis;
+ import redis.clients.jedis.JedisPool;
+ 
+ public class RedisEntityStoreWithCacheTest
+     extends AbstractEntityStoreWithCacheTest
+ {
+     @ClassRule
+     public static final DockerRule DOCKER = new DockerRule( "redis", 6379 );
+ 
+     @Override
+     public void assemble( ModuleAssembly module )
+         throws AssemblyException
+     {
+         super.assemble( module );
+         ModuleAssembly config = module.layer().module( "config" );
+         new EntityTestAssembler().assemble( config );
+         new RedisEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
+         RedisEntityStoreConfiguration redisConfig = config.forMixin( RedisEntityStoreConfiguration.class )
+                                                           .declareDefaults();
+         redisConfig.host().set( DOCKER.getDockerHost() );
+         redisConfig.port().set( DOCKER.getExposedContainerPort( "6379/tcp" ) );
+     }
+ 
+     private JedisPool jedisPool;
+ 
+     @Override
+     public void setUp()
+         throws Exception
+     {
+         super.setUp();
+         RedisEntityStoreService es = serviceFinder.findService( RedisEntityStoreService.class ).get();
+         jedisPool = es.jedisPool();
+     }
+ 
+     @Override
+     public void tearDown()
+         throws Exception
+     {
+         try( Jedis jedis = jedisPool.getResource() )
+         {
+             jedis.flushDB();
+         }
+         super.tearDown();
+     }
+ }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/32b29f99/extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakEntityStoreTest.java
----------------------------------------------------------------------
diff --cc extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakEntityStoreTest.java
index 0000000,621cebb..8656b62
mode 000000,100644..100644
--- 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
@@@ -1,0 -1,71 +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.docker.DockerRule;
+ 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/32b29f99/extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --cc extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakEntityStoreWithCacheTest.java
index 0000000,1647508..9bbecb0
mode 000000,100644..100644
--- 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
@@@ -1,0 -1,69 +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.apache.polygene.test.docker.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/32b29f99/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/MySQLEntityStoreTest.java
----------------------------------------------------------------------


[7/9] polygene-java git commit: Upgrade4 the Docker plugin for Gradle. Old one doesn't work propertly on my machine.

Posted by ni...@apache.org.
Upgrade4 the Docker plugin for Gradle. Old one doesn't work propertly on my machine.

Signed-off-by: niclas <ni...@hedhman.org>


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

Branch: refs/heads/yeoman-work
Commit: 4a7611cfbe6107e4aa92abe6803c36c0c1152934
Parents: ea3f84a
Author: niclas <ni...@hedhman.org>
Authored: Thu May 25 16:52:33 2017 +0800
Committer: niclas <ni...@hedhman.org>
Committed: Thu May 25 16:52:33 2017 +0800

----------------------------------------------------------------------
 buildSrc/build.gradle | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/4a7611cf/buildSrc/build.gradle
----------------------------------------------------------------------
diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle
index b5ac8d6..1927808 100644
--- a/buildSrc/build.gradle
+++ b/buildSrc/build.gradle
@@ -33,7 +33,7 @@ dependencies {
   compile 'org.hibernate.build.gradle:gradle-maven-publish-auth:2.0.1'
   compile 'org.apache.httpcomponents:httpclient:4.5.2'
   compile 'org.apache.httpcomponents:httpmime:4.5.2'
-  compile 'com.bmuschko:gradle-docker-plugin:3.0.5'
+  compile 'com.bmuschko:gradle-docker-plugin:3.0.7'
   compile 'com.moowork.gradle:gradle-node-plugin:1.1.1'
 
   testCompile 'junit:junit:4.12'


[3/9] polygene-java git commit: Trying to unify the naming of all the extensions.

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchConfiguration.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchConfiguration.java
deleted file mode 100644
index df0c96a..0000000
--- a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchConfiguration.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.polygene.index.elasticsearch;
-
-import org.apache.polygene.api.common.Optional;
-import org.apache.polygene.api.common.UseDefaults;
-import org.apache.polygene.api.property.Property;
-
-// START SNIPPET: config
-public interface ElasticSearchConfiguration
-{
-
-    /**
-     * Cluster name.
-     * Defaults to 'polygene_cluster'.
-     */
-    @Optional Property<String> clusterName();
-
-    /**
-     * Index name.
-     * Defaults to 'polygene_index'.
-     */
-    @Optional Property<String> index();
-
-    /**
-     * Set to true to index non aggregated associations as if they were aggregated.
-     * WARN: Don't use this if your domain model contains circular dependencies.
-     * Defaults to 'FALSE'.
-     */
-    @UseDefaults Property<Boolean> indexNonAggregatedAssociations();
-
-}
-// END SNIPPET: config

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexException.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexException.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexException.java
deleted file mode 100644
index b792a17..0000000
--- a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexException.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.polygene.index.elasticsearch;
-
-public class ElasticSearchIndexException
-        extends RuntimeException
-{
-
-    public ElasticSearchIndexException( String string )
-    {
-        super( string );
-    }
-
-    public ElasticSearchIndexException( String string, Throwable thrwbl )
-    {
-        super( string, thrwbl );
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexExporter.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexExporter.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexExporter.java
index 41ba67a..3796deb 100644
--- a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexExporter.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexExporter.java
@@ -26,10 +26,8 @@ import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.spi.query.IndexExporter;
 
 @Mixins( ElasticSearchIndexExporter.Mixin.class )
-public interface ElasticSearchIndexExporter
-        extends IndexExporter
+public interface ElasticSearchIndexExporter extends IndexExporter
 {
-
     class Mixin
             implements ElasticSearchIndexExporter
     {
@@ -49,5 +47,4 @@ public interface ElasticSearchIndexExporter
         }
 
     }
-
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/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 c8caa7d..0737f86 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
@@ -149,7 +149,7 @@ public interface ElasticSearchIndexer extends StateChangeListener
                 // Handle errors
                 if( bulkResponse.hasFailures() )
                 {
-                    throw new ElasticSearchIndexException( bulkResponse.buildFailureMessage() );
+                    throw new ElasticSearchIndexingException( bulkResponse.buildFailureMessage() );
                 }
 
                 LOGGER.debug( "Indexing changed Entity states took {}ms", bulkResponse.getTookInMillis() );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexingConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexingConfiguration.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexingConfiguration.java
new file mode 100644
index 0000000..27ba86d
--- /dev/null
+++ b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexingConfiguration.java
@@ -0,0 +1,49 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.index.elasticsearch;
+
+import org.apache.polygene.api.common.Optional;
+import org.apache.polygene.api.common.UseDefaults;
+import org.apache.polygene.api.property.Property;
+
+// START SNIPPET: config
+public interface ElasticSearchIndexingConfiguration
+{
+    /**
+     * Cluster name.
+     * Defaults to 'polygene_cluster'.
+     */
+    @Optional Property<String> clusterName();
+
+    /**
+     * Index name.
+     * Defaults to 'polygene_index'.
+     */
+    @Optional Property<String> index();
+
+    /**
+     * Set to true to index non aggregated associations as if they were aggregated.
+     * WARN: Don't use this if your domain model contains circular dependencies.
+     * Defaults to 'FALSE'.
+     */
+    @UseDefaults Property<Boolean> indexNonAggregatedAssociations();
+
+}
+// END SNIPPET: config

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexingException.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexingException.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexingException.java
new file mode 100644
index 0000000..b578c6a
--- /dev/null
+++ b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexingException.java
@@ -0,0 +1,35 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.index.elasticsearch;
+
+public class ElasticSearchIndexingException extends RuntimeException
+{
+
+    public ElasticSearchIndexingException( String string )
+    {
+        super( string );
+    }
+
+    public ElasticSearchIndexingException( String string, Throwable thrwbl )
+    {
+        super( string, thrwbl );
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchSupport.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchSupport.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchSupport.java
index 36331d8..c62e0d6 100644
--- a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchSupport.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchSupport.java
@@ -19,11 +19,10 @@
  */
 package org.apache.polygene.index.elasticsearch;
 
-import org.elasticsearch.client.Client;
 import org.apache.polygene.api.service.ServiceActivation;
+import org.elasticsearch.client.Client;
 
-public interface ElasticSearchSupport
-        extends ServiceActivation
+public interface ElasticSearchSupport extends ServiceActivation
 {
 
     Client client();

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/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 c6a0bdc..e1ad4cf 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
@@ -19,7 +19,7 @@ package org.apache.polygene.index.elasticsearch.assembly;
 
 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.ElasticSearchIndexingConfiguration;
 import org.apache.polygene.index.elasticsearch.client.ESClientIndexQueryService;
 import org.apache.polygene.index.elasticsearch.internal.AbstractElasticSearchAssembler;
 import org.elasticsearch.client.Client;
@@ -46,7 +46,7 @@ public class ESClientIndexQueryAssembler
 
         if( hasConfig() )
         {
-            configModule().entities( ElasticSearchConfiguration.class )
+            configModule().entities( ElasticSearchIndexingConfiguration.class )
                           .visibleIn( configVisibility() );
         }
     }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/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 1998fd8..cb7da97 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
@@ -21,7 +21,7 @@ package org.apache.polygene.index.elasticsearch.assembly;
 
 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.ElasticSearchIndexingConfiguration;
 import org.apache.polygene.index.elasticsearch.filesystem.ESFilesystemIndexQueryService;
 import org.apache.polygene.index.elasticsearch.internal.AbstractElasticSearchAssembler;
 
@@ -40,7 +40,7 @@ public class ESFilesystemIndexQueryAssembler
 
         if( hasConfig() )
         {
-            configModule().entities( ElasticSearchConfiguration.class ).
+            configModule().entities( ElasticSearchIndexingConfiguration.class ).
                 visibleIn( configVisibility() );
         }
     }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/client/ESClientSupport.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/client/ESClientSupport.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/client/ESClientSupport.java
index 24ee996..229e7c3 100644
--- a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/client/ESClientSupport.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/client/ESClientSupport.java
@@ -21,14 +21,14 @@ import org.apache.polygene.api.configuration.Configuration;
 import org.apache.polygene.api.injection.scope.This;
 import org.apache.polygene.api.injection.scope.Uses;
 import org.apache.polygene.api.service.ServiceDescriptor;
-import org.apache.polygene.index.elasticsearch.ElasticSearchConfiguration;
+import org.apache.polygene.index.elasticsearch.ElasticSearchIndexingConfiguration;
 import org.apache.polygene.index.elasticsearch.internal.AbstractElasticSearchSupport;
 import org.elasticsearch.client.Client;
 
 public class ESClientSupport extends AbstractElasticSearchSupport
 {
     @This
-    private Configuration<ElasticSearchConfiguration> configuration;
+    private Configuration<ElasticSearchIndexingConfiguration> configuration;
 
     @Uses
     private ServiceDescriptor descriptor;
@@ -37,7 +37,7 @@ public class ESClientSupport extends AbstractElasticSearchSupport
     protected void activateElasticSearch() throws Exception
     {
         configuration.refresh();
-        ElasticSearchConfiguration config = configuration.get();
+        ElasticSearchIndexingConfiguration config = configuration.get();
 
         index = config.index().get() == null ? DEFAULT_INDEX_NAME : config.index().get();
         indexNonAggregatedAssociations = config.indexNonAggregatedAssociations().get();

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/filesystem/ESFilesystemSupport.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/filesystem/ESFilesystemSupport.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/filesystem/ESFilesystemSupport.java
index 99d581f..d7a1f54 100644
--- a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/filesystem/ESFilesystemSupport.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/filesystem/ESFilesystemSupport.java
@@ -26,7 +26,7 @@ import org.apache.polygene.api.identity.HasIdentity;
 import org.apache.polygene.api.identity.Identity;
 import org.apache.polygene.api.injection.scope.Service;
 import org.apache.polygene.api.injection.scope.This;
-import org.apache.polygene.index.elasticsearch.ElasticSearchConfiguration;
+import org.apache.polygene.index.elasticsearch.ElasticSearchIndexingConfiguration;
 import org.apache.polygene.index.elasticsearch.internal.AbstractElasticSearchSupport;
 import org.apache.polygene.library.fileconfig.FileConfiguration;
 import org.elasticsearch.common.settings.Settings;
@@ -36,7 +36,7 @@ public class ESFilesystemSupport
     extends AbstractElasticSearchSupport
 {
     @This
-    private Configuration<ElasticSearchConfiguration> configuration;
+    private Configuration<ElasticSearchIndexingConfiguration> configuration;
 
     @This
     private HasIdentity hasIdentity;
@@ -51,7 +51,7 @@ public class ESFilesystemSupport
         throws Exception
     {
         configuration.refresh();
-        ElasticSearchConfiguration config = configuration.get();
+        ElasticSearchIndexingConfiguration config = configuration.get();
 
         String clusterName = config.clusterName().get() == null ? DEFAULT_CLUSTER_NAME : config.clusterName().get();
         index = config.index().get() == null ? DEFAULT_INDEX_NAME : config.index().get();

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchComplexQueryTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchComplexQueryTest.java b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchComplexQueryTest.java
index 8dcea1b..65e9280 100644
--- a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchComplexQueryTest.java
+++ b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchComplexQueryTest.java
@@ -70,7 +70,7 @@ public class ElasticSearchComplexQueryTest
         new ESClientIndexQueryAssembler( ELASTIC_SEARCH.client() )
             .withConfig( config, Visibility.layer )
             .assemble( module );
-        ElasticSearchConfiguration esConfig = config.forMixin( ElasticSearchConfiguration.class ).declareDefaults();
+        ElasticSearchIndexingConfiguration esConfig = config.forMixin( ElasticSearchIndexingConfiguration.class ).declareDefaults();
         esConfig.index().set( ELASTIC_SEARCH.indexName( ElasticSearchQueryTest.class.getName(),
                                                         testName.getMethodName() ) );
         esConfig.indexNonAggregatedAssociations().set( Boolean.TRUE );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchFinderTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchFinderTest.java b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchFinderTest.java
index 61d26dd..66a6eab 100644
--- a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchFinderTest.java
+++ b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchFinderTest.java
@@ -68,7 +68,7 @@ public class ElasticSearchFinderTest
         new ESClientIndexQueryAssembler( ELASTIC_SEARCH.client() )
             .withConfig( config, Visibility.layer )
             .assemble( module );
-        ElasticSearchConfiguration esConfig = config.forMixin( ElasticSearchConfiguration.class ).declareDefaults();
+        ElasticSearchIndexingConfiguration esConfig = config.forMixin( ElasticSearchIndexingConfiguration.class ).declareDefaults();
         esConfig.index().set( ELASTIC_SEARCH.indexName( ElasticSearchQueryTest.class.getName(),
                                                         testName.getMethodName() ) );
         esConfig.indexNonAggregatedAssociations().set( Boolean.TRUE );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryMultimoduleTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryMultimoduleTest.java b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryMultimoduleTest.java
index a55ff31..fb25e39 100644
--- a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryMultimoduleTest.java
+++ b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryMultimoduleTest.java
@@ -53,7 +53,7 @@ public class ElasticSearchQueryMultimoduleTest extends ElasticSearchQueryTest
             .withConfig( config, Visibility.application )
             .visibleIn( Visibility.layer )
             .assemble( module );
-        ElasticSearchConfiguration esConfig = config.forMixin( ElasticSearchConfiguration.class ).declareDefaults();
+        ElasticSearchIndexingConfiguration esConfig = config.forMixin( ElasticSearchIndexingConfiguration.class ).declareDefaults();
         esConfig.index().set( ELASTIC_SEARCH.indexName( ElasticSearchQueryTest.class.getName(),
                                                         testName.getMethodName() ) );
         esConfig.indexNonAggregatedAssociations().set( Boolean.TRUE );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryTest.java b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryTest.java
index 6b6feab..7843c26 100644
--- a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryTest.java
+++ b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryTest.java
@@ -73,7 +73,7 @@ public class ElasticSearchQueryTest extends AbstractQueryTest
         new ESClientIndexQueryAssembler( ELASTIC_SEARCH.client() )
             .withConfig( config, Visibility.layer )
             .assemble( module );
-        ElasticSearchConfiguration esConfig = config.forMixin( ElasticSearchConfiguration.class ).declareDefaults();
+        ElasticSearchIndexingConfiguration esConfig = config.forMixin( ElasticSearchIndexingConfiguration.class ).declareDefaults();
         esConfig.index().set( ELASTIC_SEARCH.indexName( ElasticSearchQueryTest.class.getName(),
                                                         testName.getMethodName() ) );
         esConfig.indexNonAggregatedAssociations().set( Boolean.TRUE );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchTest.java b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchTest.java
index a52babb..c6578f0 100644
--- a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchTest.java
+++ b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchTest.java
@@ -137,7 +137,7 @@ public class ElasticSearchTest
         new ESClientIndexQueryAssembler( ELASTIC_SEARCH.client() )
             .withConfig( config, Visibility.layer )
             .assemble( module );
-        ElasticSearchConfiguration esConfig = config.forMixin( ElasticSearchConfiguration.class ).declareDefaults();
+        ElasticSearchIndexingConfiguration esConfig = config.forMixin( ElasticSearchIndexingConfiguration.class ).declareDefaults();
         esConfig.index().set( ELASTIC_SEARCH.indexName( ElasticSearchQueryTest.class.getName(),
                                                         testName.getMethodName() ) );
         esConfig.indexNonAggregatedAssociations().set( Boolean.TRUE );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ImmenseTermTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ImmenseTermTest.java b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ImmenseTermTest.java
index a8bd09b..8e48aeb 100644
--- a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ImmenseTermTest.java
+++ b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ImmenseTermTest.java
@@ -103,7 +103,7 @@ public class ImmenseTermTest
         new ESClientIndexQueryAssembler( ELASTIC_SEARCH.client() )
             .withConfig( config, Visibility.layer )
             .assemble( module );
-        ElasticSearchConfiguration esConfig = config.forMixin( ElasticSearchConfiguration.class ).declareDefaults();
+        ElasticSearchIndexingConfiguration esConfig = config.forMixin( ElasticSearchIndexingConfiguration.class ).declareDefaults();
         esConfig.index().set( ELASTIC_SEARCH.indexName( ElasticSearchQueryTest.class.getName(),
                                                         testName.getMethodName() ) );
         esConfig.indexNonAggregatedAssociations().set( Boolean.TRUE );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/RdfIndexingEngineService.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/RdfIndexingEngineService.java b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/RdfIndexingEngineService.java
deleted file mode 100644
index 089c255..0000000
--- a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/RdfIndexingEngineService.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.polygene.index.rdf;
-
-import org.apache.polygene.index.rdf.indexing.RdfExporter;
-import org.apache.polygene.index.rdf.indexing.RdfIndexingService;
-import org.apache.polygene.index.rdf.query.RdfQueryService;
-
-public interface RdfIndexingEngineService
-    extends RdfQueryService, RdfIndexingService, RdfExporter
-{
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/RdfIndexingService.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/RdfIndexingService.java b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/RdfIndexingService.java
new file mode 100644
index 0000000..aefd780
--- /dev/null
+++ b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/RdfIndexingService.java
@@ -0,0 +1,30 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+
+package org.apache.polygene.index.rdf;
+
+import org.apache.polygene.index.rdf.indexing.RdfIndexExporter;
+import org.apache.polygene.index.rdf.indexing.RdfIndexerService;
+import org.apache.polygene.index.rdf.query.RdfQueryService;
+
+public interface RdfIndexingService
+    extends RdfQueryService, RdfIndexerService, RdfIndexExporter
+{
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/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 b4738db..351b2f9 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
@@ -23,7 +23,7 @@ package org.apache.polygene.index.rdf.assembly;
 import org.apache.polygene.api.common.Visibility;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.index.rdf.RdfIndexingEngineService;
+import org.apache.polygene.index.rdf.RdfIndexingService;
 import org.apache.polygene.index.rdf.query.RdfQueryParserFactory;
 import org.apache.polygene.library.rdf.entity.EntityStateSerializer;
 import org.apache.polygene.library.rdf.entity.EntityTypeSerializer;
@@ -51,7 +51,7 @@ public class RdfMemoryStoreAssembler extends AbstractRdfIndexingAssembler<RdfNat
         module.services( MemoryRepositoryService.class )
               .visibleIn( repositoryVisibility )
               .instantiateOnStartup();
-        module.services( RdfIndexingEngineService.class )
+        module.services( RdfIndexingService.class )
               .taggedWith( "rdf", "query", "indexing" )
               .visibleIn( visibility() )
               .instantiateOnStartup();

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/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 57173db..f9e7724 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
@@ -22,7 +22,7 @@ package org.apache.polygene.index.rdf.assembly;
 import org.apache.polygene.api.common.Visibility;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.index.rdf.RdfIndexingEngineService;
+import org.apache.polygene.index.rdf.RdfIndexingService;
 import org.apache.polygene.index.rdf.query.RdfQueryParserFactory;
 import org.apache.polygene.library.rdf.entity.EntityStateSerializer;
 import org.apache.polygene.library.rdf.entity.EntityTypeSerializer;
@@ -52,7 +52,7 @@ public class RdfNativeSesameStoreAssembler extends AbstractRdfIndexingAssembler<
         module.services( NativeRepositoryService.class )
               .visibleIn( repositoryVisibility )
               .instantiateOnStartup();
-        module.services( RdfIndexingEngineService.class )
+        module.services( RdfIndexingService.class )
               .taggedWith( "rdf", "query", "indexing" )
               .visibleIn( visibility() )
               .instantiateOnStartup();

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfRdbmsSesameStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfRdbmsSesameStoreAssembler.java b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfRdbmsSesameStoreAssembler.java
index 5629697..6462e4f 100644
--- a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfRdbmsSesameStoreAssembler.java
+++ b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfRdbmsSesameStoreAssembler.java
@@ -22,7 +22,7 @@ package org.apache.polygene.index.rdf.assembly;
 import org.apache.polygene.api.common.Visibility;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.index.rdf.RdfIndexingEngineService;
+import org.apache.polygene.index.rdf.RdfIndexingService;
 import org.apache.polygene.index.rdf.query.RdfQueryParserFactory;
 import org.apache.polygene.library.rdf.entity.EntityStateSerializer;
 import org.apache.polygene.library.rdf.entity.EntityTypeSerializer;
@@ -52,7 +52,7 @@ public class RdfRdbmsSesameStoreAssembler  extends AbstractRdfIndexingAssembler<
         module.services( RdbmsRepositoryService.class )
               .visibleIn( repositoryVisibility )
               .instantiateOnStartup();
-        module.services( RdfIndexingEngineService.class )
+        module.services( RdfIndexingService.class )
               .taggedWith( "rdf", "query", "indexing" )
               .visibleIn( visibility() )
               .instantiateOnStartup();

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfExporter.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfExporter.java b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfExporter.java
deleted file mode 100644
index a69c017..0000000
--- a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfExporter.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.polygene.index.rdf.indexing;
-
-import java.io.IOException;
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import org.openrdf.repository.Repository;
-import org.openrdf.repository.RepositoryConnection;
-import org.openrdf.repository.RepositoryException;
-import org.openrdf.rio.RDFFormat;
-import org.openrdf.rio.RDFWriter;
-import org.openrdf.rio.Rio;
-import org.apache.polygene.api.injection.scope.Service;
-import org.apache.polygene.api.mixin.Mixins;
-import org.apache.polygene.spi.query.IndexExporter;
-
-/**
- * JAVADOC
- */
-@Mixins( RdfExporter.RdfExporterMixin.class )
-public interface RdfExporter
-    extends IndexExporter
-{
-    /**
-     * JAVADOC
-     */
-    class RdfExporterMixin
-        implements IndexExporter
-    {
-        @Service
-        private Repository repository;
-
-        @Override
-        public void exportReadableToStream( PrintStream out )
-            throws IOException
-        {
-            RDFWriter rdfWriter = Rio.createWriter( RDFFormat.TRIG, out );
-            try
-            {
-                final RepositoryConnection connection = repository.getConnection();
-                try
-                {
-                    connection.export( rdfWriter );
-                }
-                catch( Exception e )
-                {
-                    e.printStackTrace();
-                }
-                finally
-                {
-                    connection.close();
-                }
-            }
-            catch( RepositoryException e )
-            {
-                throw new IOException( e );
-            }
-        }
-
-        @Override
-        public void exportFormalToWriter( PrintWriter out )
-            throws IOException
-        {
-            RDFWriter rdfWriter = Rio.createWriter( RDFFormat.RDFXML, out );
-            try
-            {
-                final RepositoryConnection connection = repository.getConnection();
-                try
-                {
-                    connection.export( rdfWriter );
-                }
-                catch( Exception e )
-                {
-                    e.printStackTrace();
-                }
-                finally
-                {
-                    connection.close();
-                }
-            }
-            catch( RepositoryException e )
-            {
-                throw new IOException( e );
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfIndexExporter.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfIndexExporter.java b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfIndexExporter.java
new file mode 100644
index 0000000..ad0e599
--- /dev/null
+++ b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfIndexExporter.java
@@ -0,0 +1,92 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+
+package org.apache.polygene.index.rdf.indexing;
+
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import org.apache.polygene.api.injection.scope.Service;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.spi.query.IndexExporter;
+import org.openrdf.repository.Repository;
+import org.openrdf.repository.RepositoryConnection;
+import org.openrdf.repository.RepositoryException;
+import org.openrdf.rio.RDFFormat;
+import org.openrdf.rio.RDFWriter;
+import org.openrdf.rio.Rio;
+
+/**
+ * JAVADOC
+ */
+@Mixins( RdfIndexExporter.RdfExporterMixin.class )
+public interface RdfIndexExporter extends IndexExporter
+{
+    /**
+     * JAVADOC
+     */
+    class RdfExporterMixin
+        implements IndexExporter
+    {
+        @Service
+        private Repository repository;
+
+        @Override
+        public void exportReadableToStream( PrintStream out )
+            throws IOException
+        {
+            RDFWriter rdfWriter = Rio.createWriter( RDFFormat.TRIG, out );
+            exportToWriter( rdfWriter );
+        }
+
+        @Override
+        public void exportFormalToWriter( PrintWriter out )
+            throws IOException
+        {
+            RDFWriter rdfWriter = Rio.createWriter( RDFFormat.RDFXML, out );
+            exportToWriter( rdfWriter );
+        }
+
+        private void exportToWriter( RDFWriter rdfWriter )
+            throws IOException
+        {
+            try
+            {
+                final RepositoryConnection connection = repository.getConnection();
+                try
+                {
+                    connection.export( rdfWriter );
+                }
+                catch( Exception e )
+                {
+                    e.printStackTrace();
+                }
+                finally
+                {
+                    connection.close();
+                }
+            }
+            catch( RepositoryException e )
+            {
+                throw new IOException( e );
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfIndexerService.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfIndexerService.java b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfIndexerService.java
new file mode 100644
index 0000000..d47a7f7
--- /dev/null
+++ b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfIndexerService.java
@@ -0,0 +1,239 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+
+package org.apache.polygene.index.rdf.indexing;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.polygene.api.activation.ActivatorAdapter;
+import org.apache.polygene.api.activation.Activators;
+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.Uses;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.service.ServiceReference;
+import org.apache.polygene.api.util.Classes;
+import org.apache.polygene.library.rdf.entity.EntityStateSerializer;
+import org.apache.polygene.library.rdf.entity.EntityTypeSerializer;
+import org.apache.polygene.spi.entity.EntityState;
+import org.apache.polygene.spi.entity.EntityStatus;
+import org.apache.polygene.spi.entitystore.StateChangeListener;
+import org.openrdf.model.Graph;
+import org.openrdf.model.Resource;
+import org.openrdf.model.Statement;
+import org.openrdf.model.URI;
+import org.openrdf.model.ValueFactory;
+import org.openrdf.model.impl.GraphImpl;
+import org.openrdf.repository.Repository;
+import org.openrdf.repository.RepositoryConnection;
+import org.openrdf.repository.RepositoryException;
+
+@Mixins( RdfIndexerService.RdfEntityIndexerMixin.class )
+@Activators( RdfIndexerService.Activator.class )
+public interface RdfIndexerService extends StateChangeListener
+{
+    void initialize();
+
+    File dataDir();
+
+    class Activator extends ActivatorAdapter<ServiceReference<RdfIndexerService>>
+    {
+
+        @Override
+        public void afterActivation( ServiceReference<RdfIndexerService> activated )
+            throws Exception
+        {
+            activated.get().initialize();
+        }
+    }
+
+    /**
+     * JAVADOC Add JavaDoc
+     */
+    abstract class RdfEntityIndexerMixin
+        implements RdfIndexerService
+    {
+        @Service
+        private ServiceReference<Repository> repository;
+
+        @Uses
+        private EntityStateSerializer stateSerializer;
+
+        @Uses
+        private EntityTypeSerializer typeSerializer;
+
+        private Set<EntityDescriptor> indexedEntityTypes;
+        private ValueFactory valueFactory;
+
+        @Override
+        public void initialize()
+        {
+            indexedEntityTypes = new HashSet<>();
+        }
+
+        @Override
+        public void notifyChanges( Iterable<EntityState> entityStates )
+        {
+            try
+            {
+                if( repository == null || !repository.isActive() ) // has been shut down, or not yet started...
+                {
+                    return;
+                }
+                final RepositoryConnection connection = repository.get().getConnection();
+                // The Repository is being initialized and not ready yet.
+                // This happens when the Repository is being initialized and it is accessing its own configuration.
+                if( connection == null )
+                {
+                    return;
+                }
+                connection.setAutoCommit( false );
+                try
+                {
+                    removeEntityStates( entityStates, connection );
+                    connection.commit();
+                    final Set<EntityDescriptor> entityTypes = indexUpdates( entityStates, connection );
+                    indexNewTypes( connection, entityTypes );
+                }
+                finally
+                {
+                    connection.commit();
+                    connection.close();
+                }
+            }
+            catch( Throwable e )
+            {
+                e.printStackTrace();
+                //TODO What shall we do with the exception?
+            }
+        }
+
+        private void indexNewTypes( RepositoryConnection connection, Set<EntityDescriptor> entityTypes )
+            throws RepositoryException
+        {
+            // Index new types
+            for( EntityDescriptor entityType : entityTypes )
+            {
+                if( !indexedEntityTypes.contains( entityType ) )
+                {
+                    indexEntityType( entityType, connection );
+                    indexedEntityTypes.add( entityType );
+                }
+            }
+        }
+
+        private Set<EntityDescriptor> indexUpdates( Iterable<EntityState> entityStates,
+                                                    RepositoryConnection connection
+        )
+            throws RepositoryException
+        {
+            // Figure out what to update
+            final Set<EntityDescriptor> entityTypes = new HashSet<>();
+            for( EntityState entityState : entityStates )
+            {
+                if( entityState.status().equals( EntityStatus.UPDATED ) )
+                {
+                    indexEntityState( entityState, connection );
+                    entityTypes.add( entityState.entityDescriptor() );
+                }
+                else if( entityState.status().equals( EntityStatus.NEW ) )
+                {
+                    indexEntityState( entityState, connection );
+                    entityTypes.add( entityState.entityDescriptor() );
+                }
+            }
+            return entityTypes;
+        }
+
+        private void removeEntityStates( Iterable<EntityState> entityStates, RepositoryConnection connection )
+            throws RepositoryException
+        {
+            List<URI> removedStates = new ArrayList<>();
+            for( EntityState entityState : entityStates )
+            {
+                if( entityState.status().equals( EntityStatus.REMOVED ) )
+                {
+                    removedStates.add( stateSerializer.createEntityURI( getValueFactory(), entityState.entityReference() ) );
+                }
+                else if( entityState.status().equals( EntityStatus.UPDATED ) )
+                {
+                    removedStates.add( stateSerializer.createEntityURI( getValueFactory(), entityState.entityReference() ) );
+                }
+            }
+
+            if( !removedStates.isEmpty() )
+            {
+                Resource[] resources = removedStates.toArray( new Resource[ removedStates.size() ] );
+                connection.remove( null, null, null, resources );
+            }
+        }
+
+        private void indexEntityState( final EntityState entityState,
+                                       final RepositoryConnection connection
+        )
+            throws RepositoryException
+        {
+            if( entityState.entityDescriptor().queryable() )
+            {
+                EntityReference reference = entityState.entityReference();
+                final URI entityURI = stateSerializer.createEntityURI( getValueFactory(), reference);
+                Graph graph = new GraphImpl();
+                stateSerializer.serialize( entityState, false, graph );
+                connection.add( graph, entityURI );
+            }
+        }
+
+        private void indexEntityType( final EntityDescriptor entityType,
+                                      final RepositoryConnection connection
+        )
+            throws RepositoryException
+        {
+            if( entityType.queryable() )
+            {
+                String uri = Classes.toURI(entityType.types().findFirst().orElse(null));
+                final URI compositeURI = getValueFactory().createURI( uri );
+                // remove composite type if already present
+                connection.clear( compositeURI );
+
+                Iterable<Statement> statements = typeSerializer.serialize( entityType );
+                connection.add( statements, compositeURI );
+            }
+        }
+
+        private ValueFactory getValueFactory()
+        {
+            if( valueFactory == null )
+            {
+                valueFactory = repository.get().getValueFactory();
+            }
+            return valueFactory;
+        }
+
+        @Override
+        public File dataDir()
+        {
+            return repository.get().getDataDir();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfIndexingService.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfIndexingService.java b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfIndexingService.java
deleted file mode 100644
index 11c5ce7..0000000
--- a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfIndexingService.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.polygene.index.rdf.indexing;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.apache.polygene.api.activation.ActivatorAdapter;
-import org.apache.polygene.api.activation.Activators;
-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.Uses;
-import org.apache.polygene.api.mixin.Mixins;
-import org.apache.polygene.api.service.ServiceReference;
-import org.apache.polygene.api.util.Classes;
-import org.apache.polygene.library.rdf.entity.EntityStateSerializer;
-import org.apache.polygene.library.rdf.entity.EntityTypeSerializer;
-import org.apache.polygene.spi.entity.EntityState;
-import org.apache.polygene.spi.entity.EntityStatus;
-import org.apache.polygene.spi.entitystore.StateChangeListener;
-import org.openrdf.model.Graph;
-import org.openrdf.model.Resource;
-import org.openrdf.model.Statement;
-import org.openrdf.model.URI;
-import org.openrdf.model.ValueFactory;
-import org.openrdf.model.impl.GraphImpl;
-import org.openrdf.repository.Repository;
-import org.openrdf.repository.RepositoryConnection;
-import org.openrdf.repository.RepositoryException;
-
-@Mixins( RdfIndexingService.RdfEntityIndexerMixin.class )
-@Activators( RdfIndexingService.Activator.class )
-public interface RdfIndexingService
-    extends StateChangeListener
-{
-    void initialize();
-
-    File dataDir();
-
-    class Activator extends ActivatorAdapter<ServiceReference<RdfIndexingService>>
-    {
-
-        @Override
-        public void afterActivation( ServiceReference<RdfIndexingService> activated )
-            throws Exception
-        {
-            activated.get().initialize();
-        }
-    }
-
-    /**
-     * JAVADOC Add JavaDoc
-     */
-    abstract class RdfEntityIndexerMixin
-        implements RdfIndexingService
-    {
-        @Service
-        private ServiceReference<Repository> repository;
-
-        @Uses
-        private EntityStateSerializer stateSerializer;
-
-        @Uses
-        private EntityTypeSerializer typeSerializer;
-
-        private Set<EntityDescriptor> indexedEntityTypes;
-        private ValueFactory valueFactory;
-
-        @Override
-        public void initialize()
-        {
-            indexedEntityTypes = new HashSet<>();
-        }
-
-        @Override
-        public void notifyChanges( Iterable<EntityState> entityStates )
-        {
-            try
-            {
-                if( repository == null || !repository.isActive() ) // has been shut down, or not yet started...
-                {
-                    return;
-                }
-                final RepositoryConnection connection = repository.get().getConnection();
-                // The Repository is being initialized and not ready yet.
-                // This happens when the Repository is being initialized and it is accessing its own configuration.
-                if( connection == null )
-                {
-                    return;
-                }
-                connection.setAutoCommit( false );
-                try
-                {
-                    removeEntityStates( entityStates, connection );
-                    connection.commit();
-                    final Set<EntityDescriptor> entityTypes = indexUpdates( entityStates, connection );
-                    indexNewTypes( connection, entityTypes );
-                }
-                finally
-                {
-                    connection.commit();
-                    connection.close();
-                }
-            }
-            catch( Throwable e )
-            {
-                e.printStackTrace();
-                //TODO What shall we do with the exception?
-            }
-        }
-
-        private void indexNewTypes( RepositoryConnection connection, Set<EntityDescriptor> entityTypes )
-            throws RepositoryException
-        {
-            // Index new types
-            for( EntityDescriptor entityType : entityTypes )
-            {
-                if( !indexedEntityTypes.contains( entityType ) )
-                {
-                    indexEntityType( entityType, connection );
-                    indexedEntityTypes.add( entityType );
-                }
-            }
-        }
-
-        private Set<EntityDescriptor> indexUpdates( Iterable<EntityState> entityStates,
-                                                    RepositoryConnection connection
-        )
-            throws RepositoryException
-        {
-            // Figure out what to update
-            final Set<EntityDescriptor> entityTypes = new HashSet<>();
-            for( EntityState entityState : entityStates )
-            {
-                if( entityState.status().equals( EntityStatus.UPDATED ) )
-                {
-                    indexEntityState( entityState, connection );
-                    entityTypes.add( entityState.entityDescriptor() );
-                }
-                else if( entityState.status().equals( EntityStatus.NEW ) )
-                {
-                    indexEntityState( entityState, connection );
-                    entityTypes.add( entityState.entityDescriptor() );
-                }
-            }
-            return entityTypes;
-        }
-
-        private void removeEntityStates( Iterable<EntityState> entityStates, RepositoryConnection connection )
-            throws RepositoryException
-        {
-            List<URI> removedStates = new ArrayList<>();
-            for( EntityState entityState : entityStates )
-            {
-                if( entityState.status().equals( EntityStatus.REMOVED ) )
-                {
-                    removedStates.add( stateSerializer.createEntityURI( getValueFactory(), entityState.entityReference() ) );
-                }
-                else if( entityState.status().equals( EntityStatus.UPDATED ) )
-                {
-                    removedStates.add( stateSerializer.createEntityURI( getValueFactory(), entityState.entityReference() ) );
-                }
-            }
-
-            if( !removedStates.isEmpty() )
-            {
-                Resource[] resources = removedStates.toArray( new Resource[ removedStates.size() ] );
-                connection.remove( null, null, null, resources );
-            }
-        }
-
-        private void indexEntityState( final EntityState entityState,
-                                       final RepositoryConnection connection
-        )
-            throws RepositoryException
-        {
-            if( entityState.entityDescriptor().queryable() )
-            {
-                EntityReference reference = entityState.entityReference();
-                final URI entityURI = stateSerializer.createEntityURI( getValueFactory(), reference);
-                Graph graph = new GraphImpl();
-                stateSerializer.serialize( entityState, false, graph );
-                connection.add( graph, entityURI );
-            }
-        }
-
-        private void indexEntityType( final EntityDescriptor entityType,
-                                      final RepositoryConnection connection
-        )
-            throws RepositoryException
-        {
-            if( entityType.queryable() )
-            {
-                String uri = Classes.toURI(entityType.types().findFirst().orElse(null));
-                final URI compositeURI = getValueFactory().createURI( uri );
-                // remove composite type if already present
-                connection.clear( compositeURI );
-
-                Iterable<Statement> statements = typeSerializer.serialize( entityType );
-                connection.add( statements, compositeURI );
-            }
-        }
-
-        private ValueFactory getValueFactory()
-        {
-            if( valueFactory == null )
-            {
-                valueFactory = repository.get().getValueFactory();
-            }
-            return valueFactory;
-        }
-
-        @Override
-        public File dataDir()
-        {
-            return repository.get().getDataDir();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfComplexQueryTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfComplexQueryTest.java b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfComplexQueryTest.java
index 31c2d3c..63ca3fd 100644
--- a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfComplexQueryTest.java
+++ b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfComplexQueryTest.java
@@ -37,7 +37,7 @@ public class RdfComplexQueryTest
             throws AssemblyException
     {
         super.assemble( module );
-        module.services( RdfIndexingEngineService.class ).instantiateOnStartup();
+        module.services( RdfIndexingService.class ).instantiateOnStartup();
         module.objects( EntityStateSerializer.class, EntityTypeSerializer.class );
         module.services( MemoryRepositoryService.class ).identifiedBy( "rdf-indexing" ).instantiateOnStartup();
     }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfEntityFinderTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfEntityFinderTest.java b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfEntityFinderTest.java
index 86723ce..73bde3b 100644
--- a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfEntityFinderTest.java
+++ b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfEntityFinderTest.java
@@ -34,7 +34,7 @@ public class RdfEntityFinderTest extends AbstractEntityFinderTest
     {
         super.assemble( module );
         module.objects( EntityStateSerializer.class, EntityTypeSerializer.class );
-        module.services( RdfIndexingEngineService.class ).instantiateOnStartup();
+        module.services( RdfIndexingService.class ).instantiateOnStartup();
         module.services( MemoryRepositoryService.class ).identifiedBy( "rdf-indexing" ).instantiateOnStartup();
         // module.services( NativeRdfRepositoryService.class ).identifiedBy( "rdf-indexing" );
         // module.addComposites( NativeRdfConfiguration.class );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java
index 2694153..5e6dd79 100644
--- a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java
+++ b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java
@@ -41,7 +41,7 @@ import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.Energy4Java;
 import org.apache.polygene.bootstrap.LayerAssembly;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.entitystore.jdbm.JdbmConfiguration;
+import org.apache.polygene.entitystore.jdbm.JdbmEntityStoreConfiguration;
 import org.apache.polygene.entitystore.jdbm.assembly.JdbmEntityStoreAssembler;
 import org.apache.polygene.index.rdf.assembly.RdfMemoryStoreAssembler;
 import org.apache.polygene.index.rdf.assembly.RdfNativeSesameStoreAssembler;
@@ -307,8 +307,8 @@ public class Qi95IssueTest
                     .dataDirectory()
                     .set( rdfDirectory().getAbsolutePath() );
 
-                module.entities( JdbmConfiguration.class ).visibleIn( Visibility.application );
-                module.forMixin( JdbmConfiguration.class )
+                module.entities( JdbmEntityStoreConfiguration.class ).visibleIn( Visibility.application );
+                module.forMixin( JdbmEntityStoreConfiguration.class )
                     .declareDefaults()
                     .file()
                     .set( jdbmDirectory().getAbsolutePath() );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/SolrQueryService.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/SolrQueryService.java b/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/SolrQueryService.java
index 445f7ea..13daa9f 100644
--- a/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/SolrQueryService.java
+++ b/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/SolrQueryService.java
@@ -33,8 +33,7 @@ import org.apache.polygene.spi.query.EntityFinder;
  */
 @Mixins( { SolrEntityIndexerMixin.class, SolrEntityQueryMixin.class } )
 @Activators( SolrQueryService.Activator.class )
-public interface SolrQueryService
-        extends EntityFinder, StateChangeListener, SolrSearch
+public interface SolrQueryService extends EntityFinder, StateChangeListener, SolrSearch
 {
 
     void inflateSolrSchema();

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingConfiguration.java b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingConfiguration.java
new file mode 100644
index 0000000..33e6b66
--- /dev/null
+++ b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingConfiguration.java
@@ -0,0 +1,31 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.index.sql;
+
+import org.apache.polygene.api.common.UseDefaults;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.library.sql.common.SQLConfiguration;
+
+public interface SQLIndexingConfiguration extends SQLConfiguration
+{
+    @UseDefaults( "POLYGENE_INDEX" )
+    @Override
+    Property<String> schemaName();
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingEngineConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingEngineConfiguration.java b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingEngineConfiguration.java
deleted file mode 100644
index 5920ed6..0000000
--- a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingEngineConfiguration.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.polygene.index.sql;
-
-import org.apache.polygene.api.common.UseDefaults;
-import org.apache.polygene.api.property.Property;
-import org.apache.polygene.library.sql.common.SQLConfiguration;
-
-public interface SQLIndexingEngineConfiguration extends SQLConfiguration
-{
-    @UseDefaults( "POLYGENE_INDEX" )
-    @Override
-    Property<String> schemaName();
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingEngineService.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingEngineService.java b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingEngineService.java
deleted file mode 100644
index e43d465..0000000
--- a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingEngineService.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.polygene.index.sql;
-
-import org.apache.polygene.api.mixin.Mixins;
-import org.apache.polygene.index.sql.internal.SQLEntityFinder;
-import org.apache.polygene.index.sql.internal.SQLStateChangeListener;
-import org.apache.polygene.spi.entitystore.StateChangeListener;
-import org.apache.polygene.spi.query.EntityFinder;
-
-/**
- * This is actual service responsible of managing indexing and queries and creating database structure.
- * <p>
- * The reason why all these components are in one single service is that they all require some data about
- * the database structure. Rather than exposing all of that data publicly to be available via another service,
- * it is stored in a state-style private mixin. Thus all the database-related data is available only to this
- * service, and no one else.
- * </p>
- */
-@Mixins( {
-    SQLEntityFinder.class,
-    SQLStateChangeListener.class
-} )
-public interface SQLIndexingEngineService
-        extends StateChangeListener, EntityFinder
-{
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingService.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingService.java b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingService.java
new file mode 100644
index 0000000..b3bdcd4
--- /dev/null
+++ b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingService.java
@@ -0,0 +1,44 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.index.sql;
+
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.index.sql.internal.SQLEntityFinder;
+import org.apache.polygene.index.sql.internal.SQLStateChangeListener;
+import org.apache.polygene.spi.entitystore.StateChangeListener;
+import org.apache.polygene.spi.query.EntityFinder;
+
+/**
+ * This is actual service responsible of managing indexing and queries and creating database structure.
+ * <p>
+ * The reason why all these components are in one single service is that they all require some data about
+ * the database structure. Rather than exposing all of that data publicly to be available via another service,
+ * it is stored in a state-style private mixin. Thus all the database-related data is available only to this
+ * service, and no one else.
+ * </p>
+ */
+@Mixins( {
+    SQLEntityFinder.class,
+    SQLStateChangeListener.class
+} )
+public interface SQLIndexingService
+        extends StateChangeListener, EntityFinder
+{
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/AbstractSQLIndexQueryAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/AbstractSQLIndexQueryAssembler.java b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/AbstractSQLIndexQueryAssembler.java
index 776c3c9..5708e79 100644
--- a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/AbstractSQLIndexQueryAssembler.java
+++ b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/AbstractSQLIndexQueryAssembler.java
@@ -28,13 +28,12 @@ import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.index.reindexer.ReindexerConfiguration;
 import org.apache.polygene.index.reindexer.ReindexerService;
-import org.apache.polygene.index.sql.SQLIndexingEngineConfiguration;
+import org.apache.polygene.index.sql.SQLIndexingConfiguration;
 import org.apache.polygene.index.sql.support.common.ReindexingStrategy;
 import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
 import org.apache.polygene.library.sql.generator.vendor.SQLVendorProvider;
 
-public abstract class AbstractSQLIndexQueryAssembler<AssemblerType>
-    extends Assemblers.VisibilityIdentityConfig<AssemblerType>
+public abstract class AbstractSQLIndexQueryAssembler<AssemblerType> extends Assemblers.VisibilityIdentityConfig<AssemblerType>
 {
     public static final Identity DEFAULT_IDENTITY = new StringIdentity( "indexing-sql" );
 
@@ -91,7 +90,7 @@ public abstract class AbstractSQLIndexQueryAssembler<AssemblerType>
 
         if( hasConfig() )
         {
-            configModule().entities( SQLIndexingEngineConfiguration.class,
+            configModule().entities( SQLIndexingConfiguration.class,
                                      ReindexerConfiguration.class ).
                               visibleIn( configVisibility() );
         }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/PostgreSQLIndexQueryAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/PostgreSQLIndexQueryAssembler.java b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/PostgreSQLIndexQueryAssembler.java
index b5e8cc6..3d4320e 100644
--- a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/PostgreSQLIndexQueryAssembler.java
+++ b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/PostgreSQLIndexQueryAssembler.java
@@ -25,10 +25,8 @@ import org.apache.polygene.library.sql.generator.vendor.PostgreSQLVendor;
 import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
 import org.apache.polygene.library.sql.generator.vendor.SQLVendorProvider;
 
-public class PostgreSQLIndexQueryAssembler
-    extends AbstractSQLIndexQueryAssembler<PostgreSQLIndexQueryAssembler>
+public class PostgreSQLIndexQueryAssembler extends AbstractSQLIndexQueryAssembler<PostgreSQLIndexQueryAssembler>
 {
-
     @Override
     protected SQLVendor getSQLVendor()
         throws IOException

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/postgresql/PostgreSQLService.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/postgresql/PostgreSQLService.java b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/postgresql/PostgreSQLService.java
index 6f05878..84e367c 100644
--- a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/postgresql/PostgreSQLService.java
+++ b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/postgresql/PostgreSQLService.java
@@ -20,7 +20,7 @@
 package org.apache.polygene.index.sql.support.postgresql;
 
 import org.apache.polygene.api.mixin.Mixins;
-import org.apache.polygene.index.sql.SQLIndexingEngineService;
+import org.apache.polygene.index.sql.SQLIndexingService;
 import org.apache.polygene.index.sql.internal.SQLEntityFinder;
 import org.apache.polygene.index.sql.internal.SQLStateChangeListener;
 import org.apache.polygene.index.sql.support.api.SQLAppStartup;
@@ -47,7 +47,7 @@ import org.apache.polygene.spi.query.IndexExporter;
     PostgreSQLIndexExporter.class
 })
 public interface PostgreSQLService
-    extends SQLAppStartup, SQLIndexing, SQLQuerying, IndexExporter, SQLIndexingEngineService
+    extends SQLAppStartup, SQLIndexing, SQLQuerying, IndexExporter, SQLIndexingService
 {
 
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/CodahaleMetricsProvider.java
----------------------------------------------------------------------
diff --git a/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/CodahaleMetricsProvider.java b/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/CodahaleMetricsProvider.java
index 18a5483..21b87ec 100644
--- a/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/CodahaleMetricsProvider.java
+++ b/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/CodahaleMetricsProvider.java
@@ -26,8 +26,7 @@ import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.api.service.ServiceActivation;
 
 @Mixins( CodahaleMetricsMixin.class )
-public interface CodahaleMetricsProvider
-        extends MetricsProvider, ServiceActivation
+public interface CodahaleMetricsProvider extends MetricsProvider, ServiceActivation
 {
     MetricRegistry metricRegistry();
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/reindexer/src/test/java/org/apache/polygene/index/reindexer/ReindexerTest.java
----------------------------------------------------------------------
diff --git a/extensions/reindexer/src/test/java/org/apache/polygene/index/reindexer/ReindexerTest.java b/extensions/reindexer/src/test/java/org/apache/polygene/index/reindexer/ReindexerTest.java
index 38c91a8..3ee1fcb 100644
--- a/extensions/reindexer/src/test/java/org/apache/polygene/index/reindexer/ReindexerTest.java
+++ b/extensions/reindexer/src/test/java/org/apache/polygene/index/reindexer/ReindexerTest.java
@@ -34,7 +34,7 @@ import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.api.unitofwork.UnitOfWorkCompletionException;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.entitystore.jdbm.JdbmConfiguration;
+import org.apache.polygene.entitystore.jdbm.JdbmEntityStoreConfiguration;
 import org.apache.polygene.entitystore.jdbm.assembly.JdbmEntityStoreAssembler;
 import org.apache.polygene.index.rdf.assembly.RdfNativeSesameStoreAssembler;
 import org.apache.polygene.library.rdf.repository.NativeConfiguration;
@@ -75,9 +75,9 @@ public class ReindexerTest
         // Configuration
         ModuleAssembly config = module.layer().module( "config" );
         new EntityTestAssembler().assemble( config );
-        config.entities( JdbmConfiguration.class, NativeConfiguration.class, ReindexerConfiguration.class )
+        config.entities( JdbmEntityStoreConfiguration.class, NativeConfiguration.class, ReindexerConfiguration.class )
               .visibleIn( Visibility.layer );
-        config.forMixin( JdbmConfiguration.class ).declareDefaults()
+        config.forMixin( JdbmEntityStoreConfiguration.class ).declareDefaults()
               .file().set( new File( tmpDir.getRoot(), ENTITIES_DIR ).getAbsolutePath() );
         config.forMixin( NativeConfiguration.class ).declareDefaults()
               .dataDirectory().set( new File( tmpDir.getRoot(), INDEX_DIR ).getAbsolutePath() );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/IndexResource.java
----------------------------------------------------------------------
diff --git a/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/IndexResource.java b/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/IndexResource.java
index 971b405..41798c0 100644
--- a/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/IndexResource.java
+++ b/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/IndexResource.java
@@ -20,10 +20,14 @@
 
 package org.apache.polygene.library.rest.admin;
 
-import java.io.*;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintStream;
+import java.io.PrintWriter;
 import java.util.Arrays;
 import org.apache.polygene.api.injection.scope.Service;
-import org.apache.polygene.index.rdf.indexing.RdfExporter;
+import org.apache.polygene.index.rdf.indexing.RdfIndexExporter;
 import org.restlet.data.MediaType;
 import org.restlet.representation.OutputRepresentation;
 import org.restlet.representation.Representation;
@@ -38,7 +42,7 @@ public class IndexResource
     extends ServerResource
 {
     @Service
-    private RdfExporter exporter;
+    private RdfIndexExporter exporter;
 
     public IndexResource()
     {


[5/9] polygene-java git commit: Trying to unify the naming of all the extensions.

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreService.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreService.java b/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreService.java
new file mode 100644
index 0000000..df2c510
--- /dev/null
+++ b/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreService.java
@@ -0,0 +1,49 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.entitystore.mongodb;
+
+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;
+
+/**
+ * MongoDB EntityStore service.
+ * <p>Based on @{@link JSONMapEntityStoreMixin}.</p>
+ */
+@Concerns( { StateChangeNotificationConcern.class, ConcurrentModificationCheckConcern.class } )
+@Mixins( { JSONMapEntityStoreMixin.class, MongoDBEntityStoreMixin.class } )
+public interface MongoDBEntityStoreService
+    extends EntityStore,
+            EntityStateVersions,
+            ServiceActivation,
+            JSONMapEntityStoreActivation,
+            LockingAbstractComposite,
+            Configuration,
+            MongoDBAccessors
+{
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreMixin.java b/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreMixin.java
deleted file mode 100644
index 3294910..0000000
--- a/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreMixin.java
+++ /dev/null
@@ -1,322 +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.mongodb;
-
-import com.mongodb.BasicDBObject;
-import com.mongodb.MongoClient;
-import com.mongodb.MongoClientOptions;
-import com.mongodb.MongoCredential;
-import com.mongodb.ServerAddress;
-import com.mongodb.WriteConcern;
-import com.mongodb.client.MongoCollection;
-import com.mongodb.client.MongoCursor;
-import com.mongodb.client.MongoDatabase;
-import com.mongodb.util.JSON;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Stream;
-import java.util.stream.StreamSupport;
-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;
-import org.bson.Document;
-import org.bson.conversions.Bson;
-
-import static com.mongodb.client.model.Filters.eq;
-import static java.util.stream.Collectors.toList;
-
-/**
- * MongoDB implementation of MapEntityStore.
- */
-public class MongoDBMapEntityStoreMixin
-    implements ServiceActivation, MapEntityStore, MongoDBAccessors
-{
-    private static final String DEFAULT_DATABASE_NAME = "polygene:entitystore";
-    private static final String DEFAULT_COLLECTION_NAME = "polygene:entitystore:entities";
-    public static final String IDENTITY_COLUMN = "_id";
-    public static final String STATE_COLUMN = "state";
-    @This
-    private Configuration<MongoDBEntityStoreConfiguration> configuration;
-    private List<ServerAddress> serverAddresses;
-    private String databaseName;
-    private String collectionName;
-    private WriteConcern writeConcern;
-    private String username;
-    private char[] password;
-    private MongoClient mongo;
-    private MongoDatabase db;
-
-    @Override
-    public void activateService()
-        throws Exception
-    {
-        loadConfiguration();
-
-        // Create Mongo driver and open the database
-        MongoClientOptions options = MongoClientOptions.builder().writeConcern( writeConcern ).build();
-        if( username.isEmpty() )
-        {
-            mongo = new MongoClient( serverAddresses, options );
-        }
-        else
-        {
-            MongoCredential credential = MongoCredential.createMongoCRCredential( username, databaseName, password );
-            mongo = new MongoClient( serverAddresses, Collections.singletonList( credential ), options );
-        }
-        db = mongo.getDatabase( databaseName );
-
-        // Create index if needed
-        MongoCollection<Document> entities = db.getCollection( collectionName );
-        if( !entities.listIndexes().iterator().hasNext() )
-        {
-            entities.createIndex( new BasicDBObject( IDENTITY_COLUMN, 1 ) );
-        }
-    }
-
-    private void loadConfiguration()
-        throws UnknownHostException
-    {
-        configuration.refresh();
-        MongoDBEntityStoreConfiguration config = configuration.get();
-
-        // Combine hostname, port and nodes configuration properties
-        // If no configuration, use 127.0.0.1:27017
-        serverAddresses = new ArrayList<>();
-        int port = config.port().get() == null ? 27017 : config.port().get();
-        List<String> nodes = config.nodes().get();
-        if( nodes.isEmpty() )
-        {
-            String hostname = config.hostname().get() == null ? "127.0.0.1" : config.hostname().get();
-            serverAddresses.add( new ServerAddress( hostname, port ) );
-        }
-        else
-        {
-            if( config.hostname().get() != null && !config.hostname().get().isEmpty() )
-            {
-                serverAddresses.add( new ServerAddress( config.hostname().get(), port ) );
-            }
-            serverAddresses.addAll( nodes.stream()
-                                         .map( this::parseNode )
-                                         .collect( toList() )
-                                  );
-        }
-
-        // If database name not configured, set it to polygene:entitystore
-        databaseName = config.database().get();
-        if( databaseName == null )
-        {
-            databaseName = DEFAULT_DATABASE_NAME;
-        }
-
-        // If collection name not configured, set it to polygene:entitystore:entities
-        collectionName = config.collection().get();
-        if( collectionName == null )
-        {
-            collectionName = DEFAULT_COLLECTION_NAME;
-        }
-
-        // If write concern not configured, set it to normal
-        switch( config.writeConcern().get() )
-        {
-        case W1:
-            writeConcern = WriteConcern.W1;
-            break;
-        case W2:
-            writeConcern = WriteConcern.W2;
-            break;
-        case W3:
-            writeConcern = WriteConcern.W3;
-            break;
-        case UNACKNOWLEDGED:
-            writeConcern = WriteConcern.UNACKNOWLEDGED;
-            break;
-        case JOURNALED:
-            writeConcern = WriteConcern.JOURNALED;
-            break;
-        case MAJORITY:
-            writeConcern = WriteConcern.MAJORITY;
-            break;
-        case ACKNOWLEDGED:
-        default:
-            writeConcern = WriteConcern.ACKNOWLEDGED;
-        }
-
-        // Username and password are defaulted to empty strings
-        username = config.username().get();
-        password = config.password().get().toCharArray();
-    }
-
-    private <R> ServerAddress parseNode( String nodeString )
-    {
-        String[] parts = nodeString.split( ":" );
-        String host = parts[ 0 ];
-        if( parts.length == 2 )
-        {
-            int port = Integer.parseInt( parts[ 1 ] );
-            return new ServerAddress( host, port );
-        }
-        return new ServerAddress( host );
-    }
-
-    @Override
-    public void passivateService()
-        throws Exception
-    {
-        mongo.close();
-        mongo = null;
-        databaseName = null;
-        collectionName = null;
-        writeConcern = null;
-        username = null;
-        Arrays.fill( password, ' ' );
-        password = null;
-        db = null;
-    }
-
-    @Override
-    public MongoClient mongoInstanceUsed()
-    {
-        return mongo;
-    }
-
-    @Override
-    public MongoDatabase dbInstanceUsed()
-    {
-        return db;
-    }
-
-    @Override
-    public String collectionUsed()
-    {
-        return collectionName;
-    }
-
-    @Override
-    public Reader get( EntityReference entityReference )
-        throws EntityStoreException
-    {
-        MongoCursor<Document> cursor = db.getCollection( collectionName )
-                                         .find( byIdentity( entityReference ) )
-                                         .limit( 1 ).iterator();
-        if( !cursor.hasNext() )
-        {
-            throw new EntityNotFoundException( entityReference );
-        }
-        Document bsonState = (Document) cursor.next().get( STATE_COLUMN );
-        String jsonState = JSON.serialize( bsonState );
-        return new StringReader( jsonState );
-    }
-
-    @Override
-    public void applyChanges( MapChanges changes )
-        throws Exception
-    {
-        final MongoCollection<Document> entities = db.getCollection( collectionName );
-
-        changes.visitMap( new MapChanger()
-        {
-            @Override
-            public Writer newEntity( EntityReference ref, EntityDescriptor entityDescriptor )
-                throws IOException
-            {
-                return new StringWriter( 1000 )
-                {
-                    @Override
-                    public void close()
-                        throws IOException
-                    {
-                        super.close();
-                        Document bsonState = Document.parse( toString() );
-                        Document entity = new Document();
-                        entity.put( IDENTITY_COLUMN, ref.identity().toString() );
-                        entity.put( STATE_COLUMN, bsonState );
-                        entities.insertOne( entity );
-                    }
-                };
-            }
-
-            @Override
-            public Writer updateEntity( MapChange mapChange )
-                throws IOException
-            {
-                return new StringWriter( 1000 )
-                {
-                    @Override
-                    public void close()
-                        throws IOException
-                    {
-                        super.close();
-                        Document bsonState = Document.parse( toString() );
-                        Document entity = new Document();
-                        entity.put( IDENTITY_COLUMN, mapChange.reference().identity().toString() );
-                        entity.put( STATE_COLUMN, bsonState );
-                        entities.replaceOne( byIdentity( mapChange.reference() ), entity );
-                    }
-                };
-            }
-
-            @Override
-            public void removeEntity( EntityReference ref, EntityDescriptor entityDescriptor )
-                throws EntityNotFoundException
-            {
-                Bson byIdFilter = byIdentity( ref );
-                MongoCursor<Document> cursor = db.getCollection( collectionName )
-                                                 .find( byIdFilter )
-                                                 .limit( 1 ).iterator();
-                if( !cursor.hasNext() )
-                {
-                    throw new EntityNotFoundException( ref );
-                }
-                entities.deleteOne( byIdFilter );
-            }
-        } );
-    }
-
-    @Override
-    public Stream<Reader> entityStates()
-    {
-        return StreamSupport
-            .stream( db.getCollection( collectionName ).find().spliterator(), false )
-            .map( eachEntity ->
-                  {
-                      Document bsonState = (Document) eachEntity.get( STATE_COLUMN );
-                      String jsonState = JSON.serialize( bsonState );
-                      return new StringReader( jsonState );
-                  } );
-    }
-
-    private Bson byIdentity( EntityReference entityReference )
-    {
-        return eq( IDENTITY_COLUMN, entityReference.identity().toString() );
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreService.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreService.java b/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreService.java
deleted file mode 100644
index 4f34214..0000000
--- a/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreService.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.polygene.entitystore.mongodb;
-
-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;
-
-/**
- * MongoDB EntityStore service.
- * <p>Based on @{@link JSONMapEntityStoreMixin}.</p>
- */
-@Concerns( { StateChangeNotificationConcern.class, ConcurrentModificationCheckConcern.class } )
-@Mixins( { JSONMapEntityStoreMixin.class, MongoDBMapEntityStoreMixin.class } )
-public interface MongoDBMapEntityStoreService
-    extends EntityStore,
-            EntityStateVersions,
-            ServiceActivation,
-            JSONMapEntityStoreActivation,
-            LockingAbstractComposite,
-            Configuration,
-            MongoDBAccessors
-{
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/assembly/MongoDBEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/assembly/MongoDBEntityStoreAssembler.java b/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/assembly/MongoDBEntityStoreAssembler.java
index eff0463..1c3b780 100644
--- a/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/assembly/MongoDBEntityStoreAssembler.java
+++ b/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/assembly/MongoDBEntityStoreAssembler.java
@@ -24,7 +24,7 @@ import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.ServiceDeclaration;
 import org.apache.polygene.entitystore.mongodb.MongoDBEntityStoreConfiguration;
-import org.apache.polygene.entitystore.mongodb.MongoDBMapEntityStoreService;
+import org.apache.polygene.entitystore.mongodb.MongoDBEntityStoreService;
 
 public class MongoDBEntityStoreAssembler
     extends Assemblers.VisibilityIdentityConfig<MongoDBEntityStoreAssembler>
@@ -33,7 +33,7 @@ public class MongoDBEntityStoreAssembler
     public void assemble( ModuleAssembly module )
         throws AssemblyException
     {
-        ServiceDeclaration service = module.services( MongoDBMapEntityStoreService.class ).visibleIn( visibility() );
+        ServiceDeclaration service = module.services( MongoDBEntityStoreService.class ).visibleIn( visibility() );
         if( hasIdentity() )
         {
             service.identifiedBy( identity() );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreTest.java b/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreTest.java
new file mode 100644
index 0000000..131e76e
--- /dev/null
+++ b/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreTest.java
@@ -0,0 +1,88 @@
+/*
+ *  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.mongodb;
+
+import com.mongodb.Mongo;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.entitystore.mongodb.assembly.MongoDBEntityStoreAssembler;
+import org.apache.polygene.test.EntityTestAssembler;
+import org.apache.polygene.test.entity.AbstractEntityStoreTest;
+import org.junit.BeforeClass;
+
+import static org.apache.polygene.test.util.Assume.assumeConnectivity;
+
+/**
+ * Test the MongoDBEntityStoreService.
+ * <p>Installing mongodb and starting it should suffice as the test use mongodb defaults: 127.0.0.1:27017</p>
+ */
+public class MongoDBEntityStoreTest extends AbstractEntityStoreTest
+{
+    @BeforeClass
+    public static void beforeRedisMapEntityStoreTests()
+    {
+        assumeConnectivity( "localhost", 27017 );
+    }
+
+    @Override
+    // START SNIPPET: assembly
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        // END SNIPPET: assembly
+        super.assemble( module );
+
+        ModuleAssembly config = module.layer().module( "config" );
+        new EntityTestAssembler().assemble( config );
+
+        // START SNIPPET: assembly
+        new MongoDBEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
+        // END SNIPPET: assembly
+
+        MongoDBEntityStoreConfiguration mongoConfig = config.forMixin( MongoDBEntityStoreConfiguration.class ).declareDefaults();
+        mongoConfig.writeConcern().set( MongoDBEntityStoreConfiguration.WriteConcern.MAJORITY );
+        mongoConfig.database().set( "polygene:test" );
+        mongoConfig.collection().set( "polygene:test:entities" );
+        // START SNIPPET: assembly
+    }
+
+    // END SNIPPET: assembly
+    private Mongo mongo;
+    private String dbName;
+
+    @Override
+    public void setUp()
+        throws Exception
+    {
+        super.setUp();
+        MongoDBEntityStoreService es = serviceFinder.findService( MongoDBEntityStoreService.class ).get();
+        mongo = es.mongoInstanceUsed();
+        dbName = es.dbInstanceUsed().getName();
+    }
+
+    @Override
+    public void tearDown()
+        throws Exception
+    {
+        mongo.dropDatabase( dbName );
+        super.tearDown();
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreWithCacheTest.java b/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreWithCacheTest.java
new file mode 100644
index 0000000..bb077cb
--- /dev/null
+++ b/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreWithCacheTest.java
@@ -0,0 +1,84 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.entitystore.mongodb;
+
+import com.mongodb.Mongo;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.entitystore.mongodb.assembly.MongoDBEntityStoreAssembler;
+import org.apache.polygene.test.EntityTestAssembler;
+import org.apache.polygene.test.cache.AbstractEntityStoreWithCacheTest;
+import org.junit.BeforeClass;
+
+import static org.apache.polygene.test.util.Assume.assumeConnectivity;
+
+/**
+ * Test the MongoDBEntityStoreService usage with a CachePool.
+ * <p>Installing mongodb and starting it should suffice as the test use mongodb defaults: 127.0.0.1:27017</p>
+ */
+public class MongoDBEntityStoreWithCacheTest
+    extends AbstractEntityStoreWithCacheTest
+{
+    @BeforeClass
+    public static void beforeRedisMapEntityStoreTests()
+    {
+        assumeConnectivity( "localhost", 27017 );
+    }
+
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        super.assemble( module );
+
+        ModuleAssembly config = module.layer().module( "config" );
+        new EntityTestAssembler().assemble( config );
+
+        new MongoDBEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
+
+        MongoDBEntityStoreConfiguration mongoConfig = config.forMixin( MongoDBEntityStoreConfiguration.class ).declareDefaults();
+        mongoConfig.writeConcern().set( MongoDBEntityStoreConfiguration.WriteConcern.MAJORITY );
+        mongoConfig.database().set( "polygene:test" );
+        mongoConfig.collection().set( "polygene:test:entities" );
+    }
+
+    private Mongo mongo;
+    private String dbName;
+
+    @Override
+    public void setUp()
+        throws Exception
+    {
+        super.setUp();
+        MongoDBEntityStoreService es = serviceFinder.findService( MongoDBEntityStoreService.class ).get();
+        mongo = es.mongoInstanceUsed();
+        dbName = es.dbInstanceUsed().getName();
+
+    }
+
+    @Override
+    public void tearDown()
+        throws Exception
+    {
+        mongo.dropDatabase( dbName );
+        super.tearDown();
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreTest.java b/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreTest.java
deleted file mode 100644
index f98fdc3..0000000
--- a/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.polygene.entitystore.mongodb;
-
-import com.mongodb.Mongo;
-import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.entitystore.mongodb.assembly.MongoDBEntityStoreAssembler;
-import org.apache.polygene.test.EntityTestAssembler;
-import org.apache.polygene.test.entity.AbstractEntityStoreTest;
-import org.junit.BeforeClass;
-
-import static org.apache.polygene.test.util.Assume.assumeConnectivity;
-
-/**
- * Test the MongoDBMapEntityStoreService.
- * <p>Installing mongodb and starting it should suffice as the test use mongodb defaults: 127.0.0.1:27017</p>
- */
-public class MongoDBMapEntityStoreTest extends AbstractEntityStoreTest
-{
-    @BeforeClass
-    public static void beforeRedisMapEntityStoreTests()
-    {
-        assumeConnectivity( "localhost", 27017 );
-    }
-
-    @Override
-    // START SNIPPET: assembly
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        // END SNIPPET: assembly
-        super.assemble( module );
-
-        ModuleAssembly config = module.layer().module( "config" );
-        new EntityTestAssembler().assemble( config );
-
-        // START SNIPPET: assembly
-        new MongoDBEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
-        // END SNIPPET: assembly
-
-        MongoDBEntityStoreConfiguration mongoConfig = config.forMixin( MongoDBEntityStoreConfiguration.class ).declareDefaults();
-        mongoConfig.writeConcern().set( MongoDBEntityStoreConfiguration.WriteConcern.MAJORITY );
-        mongoConfig.database().set( "polygene:test" );
-        mongoConfig.collection().set( "polygene:test:entities" );
-        // START SNIPPET: assembly
-    }
-
-    // END SNIPPET: assembly
-    private Mongo mongo;
-    private String dbName;
-
-    @Override
-    public void setUp()
-        throws Exception
-    {
-        super.setUp();
-        MongoDBMapEntityStoreService es = serviceFinder.findService( MongoDBMapEntityStoreService.class ).get();
-        mongo = es.mongoInstanceUsed();
-        dbName = es.dbInstanceUsed().getName();
-    }
-
-    @Override
-    public void tearDown()
-        throws Exception
-    {
-        mongo.dropDatabase( dbName );
-        super.tearDown();
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreWithCacheTest.java b/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreWithCacheTest.java
deleted file mode 100644
index 65e9a13..0000000
--- a/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoDBMapEntityStoreWithCacheTest.java
+++ /dev/null
@@ -1,84 +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.mongodb;
-
-import com.mongodb.Mongo;
-import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.entitystore.mongodb.assembly.MongoDBEntityStoreAssembler;
-import org.apache.polygene.test.EntityTestAssembler;
-import org.apache.polygene.test.cache.AbstractEntityStoreWithCacheTest;
-import org.junit.BeforeClass;
-
-import static org.apache.polygene.test.util.Assume.assumeConnectivity;
-
-/**
- * Test the MongoDBMapEntityStoreService usage with a CachePool.
- * <p>Installing mongodb and starting it should suffice as the test use mongodb defaults: 127.0.0.1:27017</p>
- */
-public class MongoDBMapEntityStoreWithCacheTest
-    extends AbstractEntityStoreWithCacheTest
-{
-    @BeforeClass
-    public static void beforeRedisMapEntityStoreTests()
-    {
-        assumeConnectivity( "localhost", 27017 );
-    }
-
-    @Override
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        super.assemble( module );
-
-        ModuleAssembly config = module.layer().module( "config" );
-        new EntityTestAssembler().assemble( config );
-
-        new MongoDBEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
-
-        MongoDBEntityStoreConfiguration mongoConfig = config.forMixin( MongoDBEntityStoreConfiguration.class ).declareDefaults();
-        mongoConfig.writeConcern().set( MongoDBEntityStoreConfiguration.WriteConcern.MAJORITY );
-        mongoConfig.database().set( "polygene:test" );
-        mongoConfig.collection().set( "polygene:test:entities" );
-    }
-
-    private Mongo mongo;
-    private String dbName;
-
-    @Override
-    public void setUp()
-        throws Exception
-    {
-        super.setUp();
-        MongoDBMapEntityStoreService es = serviceFinder.findService( MongoDBMapEntityStoreService.class ).get();
-        mongo = es.mongoInstanceUsed();
-        dbName = es.dbInstanceUsed().getName();
-
-    }
-
-    @Override
-    public void tearDown()
-        throws Exception
-    {
-        mongo.dropDatabase( dbName );
-        super.tearDown();
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisEntityStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisEntityStoreConfiguration.java b/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisEntityStoreConfiguration.java
index c3ba3f1..8b001bc 100644
--- a/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisEntityStoreConfiguration.java
+++ b/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisEntityStoreConfiguration.java
@@ -23,7 +23,7 @@ import org.apache.polygene.api.common.Optional;
 import org.apache.polygene.api.property.Property;
 
 /**
- * Configuration for RedisMapEntityStoreService.
+ * Configuration for RedisEntityStoreService.
  */
 // START SNIPPET: config
 public interface RedisEntityStoreConfiguration

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisEntityStoreMixin.java b/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisEntityStoreMixin.java
new file mode 100644
index 0000000..f3a3b11
--- /dev/null
+++ b/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisEntityStoreMixin.java
@@ -0,0 +1,177 @@
+/*
+ *  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.redis;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.stream.Stream;
+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.EntityAlreadyExistsException;
+import org.apache.polygene.spi.entitystore.EntityNotFoundException;
+import org.apache.polygene.spi.entitystore.EntityStoreException;
+import org.apache.polygene.spi.entitystore.helpers.MapEntityStore;
+import redis.clients.jedis.Jedis;
+import redis.clients.jedis.JedisPool;
+import redis.clients.jedis.JedisPoolConfig;
+import redis.clients.jedis.Protocol;
+
+/**
+ * Redis implementation of MapEntityStore.
+ */
+public class RedisEntityStoreMixin
+    implements ServiceActivation, RedisAccessors, MapEntityStore
+{
+    private static final String DEFAULT_HOST = "127.0.0.1";
+    private static final String NIL = "nil";
+    @This
+    private Configuration<RedisEntityStoreConfiguration> configuration;
+    private JedisPool pool;
+
+    @Override
+    public void activateService()
+        throws Exception
+    {
+        configuration.refresh();
+        RedisEntityStoreConfiguration config = configuration.get();
+
+        String host = config.host().get() == null ? DEFAULT_HOST : config.host().get();
+        int port = config.port().get() == null ? Protocol.DEFAULT_PORT : config.port().get();
+        int timeout = config.timeout().get() == null ? Protocol.DEFAULT_TIMEOUT : config.timeout().get();
+        String password = config.password().get();
+        int database = config.database().get() == null ? Protocol.DEFAULT_DATABASE : config.database().get();
+
+        pool = new JedisPool( new JedisPoolConfig(), host, port, timeout, password, database );
+    }
+
+    @Override
+    public void passivateService()
+        throws Exception
+    {
+        pool.destroy();
+        pool = null;
+    }
+
+    @Override
+    public JedisPool jedisPool()
+    {
+        return pool;
+    }
+
+    @Override
+    public Reader get( EntityReference entityReference )
+        throws EntityStoreException
+    {
+        try( Jedis jedis = pool.getResource() )
+        {
+            String jsonState = jedis.get( entityReference.identity().toString() );
+            if( notFound( jsonState ) )
+            {
+                throw new EntityNotFoundException( entityReference );
+            }
+            return new StringReader( jsonState );
+        }
+    }
+
+    @Override
+    public void applyChanges( MapChanges changes )
+        throws Exception
+    {
+        try( Jedis jedis = pool.getResource() )
+        {
+            changes.visitMap( new MapChanger()
+            {
+                @Override
+                public Writer newEntity( EntityReference ref, EntityDescriptor entityDescriptor )
+                    throws IOException
+                {
+                    return new StringWriter( 1000 )
+                    {
+                        @Override
+                        public void close()
+                            throws IOException
+                        {
+                            super.close();
+                            String statusCode = jedis.set( ref.identity().toString(), toString(), "NX" );
+                            if( !"OK".equals( statusCode ) )
+                            {
+                                throw new EntityAlreadyExistsException( ref );
+                            }
+                        }
+                    };
+                }
+
+                @Override
+                public Writer updateEntity( MapChange mapChange )
+                    throws IOException
+                {
+                    return new StringWriter( 1000 )
+                    {
+                        @Override
+                        public void close()
+                            throws IOException
+                        {
+                            super.close();
+                            String statusCode = jedis.set( mapChange.reference().identity().toString(),
+                                                           toString(),
+                                                           "XX" );
+                            if( !"OK".equals( statusCode ) )
+                            {
+                                throw new EntityNotFoundException( mapChange.reference() );
+                            }
+                        }
+                    };
+                }
+
+                @Override
+                public void removeEntity( EntityReference ref, EntityDescriptor entityDescriptor )
+                    throws EntityNotFoundException
+                {
+                    String jsonState = jedis.get( ref.identity().toString() );
+                    if( notFound( jsonState ) )
+                    {
+                        throw new EntityNotFoundException( ref );
+                    }
+                    jedis.del( ref.identity().toString() );
+                }
+            } );
+        }
+    }
+
+    @Override
+    public Stream<Reader> entityStates()
+    {
+        Jedis jedis = pool.getResource();
+        return jedis.keys( "*" ).stream()
+                    .map( key -> (Reader) new StringReader( jedis.get( key ) ) )
+                    .onClose( jedis::close );
+    }
+
+    private static boolean notFound( String jsonState )
+    {
+        return jsonState == null || NIL.equals( jsonState );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisEntityStoreService.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisEntityStoreService.java b/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisEntityStoreService.java
new file mode 100644
index 0000000..8e2ed6b
--- /dev/null
+++ b/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisEntityStoreService.java
@@ -0,0 +1,49 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.entitystore.redis;
+
+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;
+
+/**
+ * Redis EntityStore service.
+ * <p>Based on @{@link JSONMapEntityStoreMixin}.</p>
+ */
+@Concerns( { StateChangeNotificationConcern.class, ConcurrentModificationCheckConcern.class } )
+@Mixins( { JSONMapEntityStoreMixin.class, RedisEntityStoreMixin.class } )
+public interface RedisEntityStoreService
+        extends EntityStore,
+                EntityStateVersions,
+                ServiceActivation,
+                JSONMapEntityStoreActivation,
+                LockingAbstractComposite,
+                Configuration,
+                RedisAccessors
+{
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreMixin.java b/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreMixin.java
deleted file mode 100644
index 0fcb2c5..0000000
--- a/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreMixin.java
+++ /dev/null
@@ -1,177 +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.redis;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.util.stream.Stream;
-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.EntityAlreadyExistsException;
-import org.apache.polygene.spi.entitystore.EntityNotFoundException;
-import org.apache.polygene.spi.entitystore.EntityStoreException;
-import org.apache.polygene.spi.entitystore.helpers.MapEntityStore;
-import redis.clients.jedis.Jedis;
-import redis.clients.jedis.JedisPool;
-import redis.clients.jedis.JedisPoolConfig;
-import redis.clients.jedis.Protocol;
-
-/**
- * Redis implementation of MapEntityStore.
- */
-public class RedisMapEntityStoreMixin
-    implements ServiceActivation, RedisAccessors, MapEntityStore
-{
-    private static final String DEFAULT_HOST = "127.0.0.1";
-    private static final String NIL = "nil";
-    @This
-    private Configuration<RedisEntityStoreConfiguration> configuration;
-    private JedisPool pool;
-
-    @Override
-    public void activateService()
-        throws Exception
-    {
-        configuration.refresh();
-        RedisEntityStoreConfiguration config = configuration.get();
-
-        String host = config.host().get() == null ? DEFAULT_HOST : config.host().get();
-        int port = config.port().get() == null ? Protocol.DEFAULT_PORT : config.port().get();
-        int timeout = config.timeout().get() == null ? Protocol.DEFAULT_TIMEOUT : config.timeout().get();
-        String password = config.password().get();
-        int database = config.database().get() == null ? Protocol.DEFAULT_DATABASE : config.database().get();
-
-        pool = new JedisPool( new JedisPoolConfig(), host, port, timeout, password, database );
-    }
-
-    @Override
-    public void passivateService()
-        throws Exception
-    {
-        pool.destroy();
-        pool = null;
-    }
-
-    @Override
-    public JedisPool jedisPool()
-    {
-        return pool;
-    }
-
-    @Override
-    public Reader get( EntityReference entityReference )
-        throws EntityStoreException
-    {
-        try( Jedis jedis = pool.getResource() )
-        {
-            String jsonState = jedis.get( entityReference.identity().toString() );
-            if( notFound( jsonState ) )
-            {
-                throw new EntityNotFoundException( entityReference );
-            }
-            return new StringReader( jsonState );
-        }
-    }
-
-    @Override
-    public void applyChanges( MapChanges changes )
-        throws Exception
-    {
-        try( Jedis jedis = pool.getResource() )
-        {
-            changes.visitMap( new MapChanger()
-            {
-                @Override
-                public Writer newEntity( EntityReference ref, EntityDescriptor entityDescriptor )
-                    throws IOException
-                {
-                    return new StringWriter( 1000 )
-                    {
-                        @Override
-                        public void close()
-                            throws IOException
-                        {
-                            super.close();
-                            String statusCode = jedis.set( ref.identity().toString(), toString(), "NX" );
-                            if( !"OK".equals( statusCode ) )
-                            {
-                                throw new EntityAlreadyExistsException( ref );
-                            }
-                        }
-                    };
-                }
-
-                @Override
-                public Writer updateEntity( MapChange mapChange )
-                    throws IOException
-                {
-                    return new StringWriter( 1000 )
-                    {
-                        @Override
-                        public void close()
-                            throws IOException
-                        {
-                            super.close();
-                            String statusCode = jedis.set( mapChange.reference().identity().toString(),
-                                                           toString(),
-                                                           "XX" );
-                            if( !"OK".equals( statusCode ) )
-                            {
-                                throw new EntityNotFoundException( mapChange.reference() );
-                            }
-                        }
-                    };
-                }
-
-                @Override
-                public void removeEntity( EntityReference ref, EntityDescriptor entityDescriptor )
-                    throws EntityNotFoundException
-                {
-                    String jsonState = jedis.get( ref.identity().toString() );
-                    if( notFound( jsonState ) )
-                    {
-                        throw new EntityNotFoundException( ref );
-                    }
-                    jedis.del( ref.identity().toString() );
-                }
-            } );
-        }
-    }
-
-    @Override
-    public Stream<Reader> entityStates()
-    {
-        Jedis jedis = pool.getResource();
-        return jedis.keys( "*" ).stream()
-                    .map( key -> (Reader) new StringReader( jedis.get( key ) ) )
-                    .onClose( jedis::close );
-    }
-
-    private static boolean notFound( String jsonState )
-    {
-        return jsonState == null || NIL.equals( jsonState );
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreService.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreService.java b/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreService.java
deleted file mode 100644
index 0ebaa52..0000000
--- a/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreService.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.polygene.entitystore.redis;
-
-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;
-
-/**
- * Redis EntityStore service.
- * <p>Based on @{@link JSONMapEntityStoreMixin}.</p>
- */
-@Concerns( { StateChangeNotificationConcern.class, ConcurrentModificationCheckConcern.class } )
-@Mixins( { JSONMapEntityStoreMixin.class, RedisMapEntityStoreMixin.class } )
-public interface RedisMapEntityStoreService
-        extends EntityStore,
-                EntityStateVersions,
-                ServiceActivation,
-                JSONMapEntityStoreActivation,
-                LockingAbstractComposite,
-                Configuration,
-                RedisAccessors
-{
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/assembly/RedisEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/assembly/RedisEntityStoreAssembler.java b/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/assembly/RedisEntityStoreAssembler.java
index a0d8f04..1262e70 100644
--- a/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/assembly/RedisEntityStoreAssembler.java
+++ b/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/assembly/RedisEntityStoreAssembler.java
@@ -24,7 +24,7 @@ import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.ServiceDeclaration;
 import org.apache.polygene.entitystore.redis.RedisEntityStoreConfiguration;
-import org.apache.polygene.entitystore.redis.RedisMapEntityStoreService;
+import org.apache.polygene.entitystore.redis.RedisEntityStoreService;
 
 /**
  * Redis EntityStore assembly.
@@ -36,7 +36,7 @@ public class RedisEntityStoreAssembler
     public void assemble( ModuleAssembly module )
         throws AssemblyException
     {
-        ServiceDeclaration service = module.services( RedisMapEntityStoreService.class ).visibleIn( visibility() );
+        ServiceDeclaration service = module.services( RedisEntityStoreService.class ).visibleIn( visibility() );
         if( hasIdentity() )
         {
             service.identifiedBy( identity() );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisEntityStoreTest.java b/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisEntityStoreTest.java
new file mode 100644
index 0000000..671bffa
--- /dev/null
+++ b/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisEntityStoreTest.java
@@ -0,0 +1,80 @@
+/*
+ *  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.redis;
+
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.entitystore.redis.assembly.RedisEntityStoreAssembler;
+import org.apache.polygene.test.EntityTestAssembler;
+import org.apache.polygene.test.entity.AbstractEntityStoreTest;
+import org.apache.polygene.test.internal.DockerRule;
+import org.junit.ClassRule;
+import redis.clients.jedis.Jedis;
+import redis.clients.jedis.JedisPool;
+
+public class RedisEntityStoreTest
+    extends AbstractEntityStoreTest
+{
+    @ClassRule
+    public static final DockerRule DOCKER = new DockerRule( "redis", 6379 );
+
+    @Override
+    // START SNIPPET: assembly
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        // END SNIPPET: assembly
+        super.assemble( module );
+        ModuleAssembly config = module.layer().module( "config" );
+        new EntityTestAssembler().assemble( config );
+        // START SNIPPET: assembly
+        new RedisEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
+        // END SNIPPET: assembly
+        RedisEntityStoreConfiguration redisConfig = config.forMixin( RedisEntityStoreConfiguration.class )
+                                                          .declareDefaults();
+        redisConfig.host().set( DOCKER.getDockerHost() );
+        redisConfig.port().set( DOCKER.getExposedContainerPort( "6379/tcp" ) );
+        // START SNIPPET: assembly
+    }
+    // END SNIPPET: assembly
+
+    private JedisPool jedisPool;
+
+    @Override
+    public void setUp()
+        throws Exception
+    {
+        super.setUp();
+        RedisEntityStoreService es = serviceFinder.findService( RedisEntityStoreService.class ).get();
+        jedisPool = es.jedisPool();
+    }
+
+    @Override
+    public void tearDown()
+        throws Exception
+    {
+        try( Jedis jedis = jedisPool.getResource() )
+        {
+            jedis.flushDB();
+        }
+        super.tearDown();
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisEntityStoreWithCacheTest.java b/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisEntityStoreWithCacheTest.java
new file mode 100644
index 0000000..7cd9cbe
--- /dev/null
+++ b/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisEntityStoreWithCacheTest.java
@@ -0,0 +1,74 @@
+/*
+ *  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.redis;
+
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.entitystore.redis.assembly.RedisEntityStoreAssembler;
+import org.apache.polygene.test.EntityTestAssembler;
+import org.apache.polygene.test.cache.AbstractEntityStoreWithCacheTest;
+import org.apache.polygene.test.internal.DockerRule;
+import org.junit.ClassRule;
+import redis.clients.jedis.Jedis;
+import redis.clients.jedis.JedisPool;
+
+public class RedisEntityStoreWithCacheTest
+    extends AbstractEntityStoreWithCacheTest
+{
+    @ClassRule
+    public static final DockerRule DOCKER = new DockerRule( "redis", 6379 );
+
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        super.assemble( module );
+        ModuleAssembly config = module.layer().module( "config" );
+        new EntityTestAssembler().assemble( config );
+        new RedisEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
+        RedisEntityStoreConfiguration redisConfig = config.forMixin( RedisEntityStoreConfiguration.class )
+                                                          .declareDefaults();
+        redisConfig.host().set( DOCKER.getDockerHost() );
+        redisConfig.port().set( DOCKER.getExposedContainerPort( "6379/tcp" ) );
+    }
+
+    private JedisPool jedisPool;
+
+    @Override
+    public void setUp()
+        throws Exception
+    {
+        super.setUp();
+        RedisEntityStoreService es = serviceFinder.findService( RedisEntityStoreService.class ).get();
+        jedisPool = es.jedisPool();
+    }
+
+    @Override
+    public void tearDown()
+        throws Exception
+    {
+        try( Jedis jedis = jedisPool.getResource() )
+        {
+            jedis.flushDB();
+        }
+        super.tearDown();
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreTest.java b/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreTest.java
deleted file mode 100644
index e654afc..0000000
--- a/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreTest.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.polygene.entitystore.redis;
-
-import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.entitystore.redis.assembly.RedisEntityStoreAssembler;
-import org.apache.polygene.test.EntityTestAssembler;
-import org.apache.polygene.test.entity.AbstractEntityStoreTest;
-import org.apache.polygene.test.internal.DockerRule;
-import org.junit.ClassRule;
-import redis.clients.jedis.Jedis;
-import redis.clients.jedis.JedisPool;
-
-public class RedisMapEntityStoreTest
-    extends AbstractEntityStoreTest
-{
-    @ClassRule
-    public static final DockerRule DOCKER = new DockerRule( "redis", 6379 );
-
-    @Override
-    // START SNIPPET: assembly
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        // END SNIPPET: assembly
-        super.assemble( module );
-        ModuleAssembly config = module.layer().module( "config" );
-        new EntityTestAssembler().assemble( config );
-        // START SNIPPET: assembly
-        new RedisEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
-        // END SNIPPET: assembly
-        RedisEntityStoreConfiguration redisConfig = config.forMixin( RedisEntityStoreConfiguration.class )
-                                                          .declareDefaults();
-        redisConfig.host().set( DOCKER.getDockerHost() );
-        redisConfig.port().set( DOCKER.getExposedContainerPort( "6379/tcp" ) );
-        // START SNIPPET: assembly
-    }
-    // END SNIPPET: assembly
-
-    private JedisPool jedisPool;
-
-    @Override
-    public void setUp()
-        throws Exception
-    {
-        super.setUp();
-        RedisMapEntityStoreService es = serviceFinder.findService( RedisMapEntityStoreService.class ).get();
-        jedisPool = es.jedisPool();
-    }
-
-    @Override
-    public void tearDown()
-        throws Exception
-    {
-        try( Jedis jedis = jedisPool.getResource() )
-        {
-            jedis.flushDB();
-        }
-        super.tearDown();
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreWithCacheTest.java b/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreWithCacheTest.java
deleted file mode 100644
index 1dba76a..0000000
--- a/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreWithCacheTest.java
+++ /dev/null
@@ -1,74 +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.redis;
-
-import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.entitystore.redis.assembly.RedisEntityStoreAssembler;
-import org.apache.polygene.test.EntityTestAssembler;
-import org.apache.polygene.test.cache.AbstractEntityStoreWithCacheTest;
-import org.apache.polygene.test.internal.DockerRule;
-import org.junit.ClassRule;
-import redis.clients.jedis.Jedis;
-import redis.clients.jedis.JedisPool;
-
-public class RedisMapEntityStoreWithCacheTest
-    extends AbstractEntityStoreWithCacheTest
-{
-    @ClassRule
-    public static final DockerRule DOCKER = new DockerRule( "redis", 6379 );
-
-    @Override
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        super.assemble( module );
-        ModuleAssembly config = module.layer().module( "config" );
-        new EntityTestAssembler().assemble( config );
-        new RedisEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
-        RedisEntityStoreConfiguration redisConfig = config.forMixin( RedisEntityStoreConfiguration.class )
-                                                          .declareDefaults();
-        redisConfig.host().set( DOCKER.getDockerHost() );
-        redisConfig.port().set( DOCKER.getExposedContainerPort( "6379/tcp" ) );
-    }
-
-    private JedisPool jedisPool;
-
-    @Override
-    public void setUp()
-        throws Exception
-    {
-        super.setUp();
-        RedisMapEntityStoreService es = serviceFinder.findService( RedisMapEntityStoreService.class ).get();
-        jedisPool = es.jedisPool();
-    }
-
-    @Override
-    public void tearDown()
-        throws Exception
-    {
-        try( Jedis jedis = jedisPool.getResource() )
-        {
-            jedis.flushDB();
-        }
-        super.tearDown();
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-riak/src/main/java/org/apache/polygene/entitystore/riak/RiakEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/src/main/java/org/apache/polygene/entitystore/riak/RiakEntityStoreMixin.java b/extensions/entitystore-riak/src/main/java/org/apache/polygene/entitystore/riak/RiakEntityStoreMixin.java
new file mode 100644
index 0000000..39fd13a
--- /dev/null
+++ b/extensions/entitystore-riak/src/main/java/org/apache/polygene/entitystore/riak/RiakEntityStoreMixin.java
@@ -0,0 +1,384 @@
+/*
+ *  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 RiakEntityStoreMixin 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;
+    }
+}


[6/9] polygene-java git commit: Trying to unify the naming of all the extensions.

Posted by ni...@apache.org.
Trying to unify the naming of all the extensions.

Signed-off-by: niclas <ni...@hedhman.org>


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

Branch: refs/heads/yeoman-work
Commit: ea3f84a5c9e069856de27c6b68415a2aec103e42
Parents: 09b9280
Author: niclas <ni...@hedhman.org>
Authored: Thu May 25 14:19:44 2017 +0800
Committer: niclas <ni...@hedhman.org>
Committed: Thu May 25 14:19:45 2017 +0800

----------------------------------------------------------------------
 .../entitystore/geode/GeodeConfiguration.java   |  81 ----
 .../geode/GeodeEntityStoreConfiguration.java    |  81 ++++
 .../geode/GeodeEntityStoreMixin.java            |  10 +-
 .../assembly/GeodeEntityStoreAssembler.java     |   4 +-
 .../hazelcast/HazelcastConfiguration.java       |  39 --
 .../HazelcastEntityStoreConfiguration.java      |  39 ++
 .../hazelcast/HazelcastEntityStoreMixin.java    |   6 +-
 .../assembly/HazelcastEntityStoreAssembler.java |   4 +-
 .../JCloudsEntityStoreConfiguration.java        |  54 +++
 .../jclouds/JCloudsEntityStoreMixin.java        | 284 ++++++++++++++
 .../jclouds/JCloudsEntityStoreService.java      |  48 +++
 .../JCloudsMapEntityStoreConfiguration.java     |  54 ---
 .../jclouds/JCloudsMapEntityStoreMixin.java     | 284 --------------
 .../jclouds/JCloudsMapEntityStoreService.java   |  48 ---
 .../assembly/JCloudsEntityStoreAssembler.java   |   8 +-
 .../jclouds/JCloudsFilesystemTest.java          |   4 +-
 .../entitystore/jclouds/JCloudsS3Test.java      |   4 +-
 .../entitystore/jdbm/JdbmConfiguration.java     |  52 ---
 .../jdbm/JdbmEntityStoreConfiguration.java      |  52 +++
 .../entitystore/jdbm/JdbmEntityStoreMixin.java  |   4 +-
 .../jdbm/JdbmEntityStoreService.java            |   8 +-
 .../jdbm/assembly/JdbmEntityStoreAssembler.java |   4 +-
 .../mongodb/MongoDBEntityStoreMixin.java        | 322 ++++++++++++++++
 .../mongodb/MongoDBEntityStoreService.java      |  49 +++
 .../mongodb/MongoDBMapEntityStoreMixin.java     | 322 ----------------
 .../mongodb/MongoDBMapEntityStoreService.java   |  49 ---
 .../assembly/MongoDBEntityStoreAssembler.java   |   4 +-
 .../mongodb/MongoDBEntityStoreTest.java         |  88 +++++
 .../MongoDBEntityStoreWithCacheTest.java        |  84 ++++
 .../mongodb/MongoDBMapEntityStoreTest.java      |  88 -----
 .../MongoDBMapEntityStoreWithCacheTest.java     |  84 ----
 .../redis/RedisEntityStoreConfiguration.java    |   2 +-
 .../redis/RedisEntityStoreMixin.java            | 177 +++++++++
 .../redis/RedisEntityStoreService.java          |  49 +++
 .../redis/RedisMapEntityStoreMixin.java         | 177 ---------
 .../redis/RedisMapEntityStoreService.java       |  49 ---
 .../assembly/RedisEntityStoreAssembler.java     |   4 +-
 .../entitystore/redis/RedisEntityStoreTest.java |  80 ++++
 .../redis/RedisEntityStoreWithCacheTest.java    |  74 ++++
 .../redis/RedisMapEntityStoreTest.java          |  80 ----
 .../redis/RedisMapEntityStoreWithCacheTest.java |  74 ----
 .../entitystore/riak/RiakEntityStoreMixin.java  | 384 +++++++++++++++++++
 .../riak/RiakEntityStoreService.java            |  53 +++
 .../riak/RiakMapEntityStoreMixin.java           | 384 -------------------
 .../riak/RiakMapEntityStoreService.java         |  53 ---
 .../riak/assembly/RiakEntityStoreAssembler.java |   8 +-
 .../entitystore/riak/RiakEntityStoreTest.java   |  71 ++++
 .../riak/RiakEntityStoreWithCacheTest.java      |  69 ++++
 .../riak/RiakMapEntityStoreTest.java            |  71 ----
 .../riak/RiakMapEntityStoreWithCacheTest.java   |  69 ----
 .../sql/SQLEntityStoreConfiguration.java        |  47 +++
 .../entitystore/sql/SQLEntityStoreMixin.java    | 244 ++++++++++++
 .../entitystore/sql/SQLEntityStoreService.java  |  43 +++
 .../sql/SQLMapEntityStoreConfiguration.java     |  47 ---
 .../entitystore/sql/SQLMapEntityStoreMixin.java | 244 ------------
 .../sql/SQLMapEntityStoreService.java           |  43 ---
 .../AbstractSQLEntityStoreAssembler.java        |  97 +++++
 .../AbstractSQLMapEntityStoreAssembler.java     |  97 -----
 .../assembly/DerbySQLEntityStoreAssembler.java  |   2 +-
 .../sql/assembly/H2SQLEntityStoreAssembler.java |   2 +-
 .../sql/assembly/MySQLEntityStoreAssembler.java |   2 +-
 .../PostgreSQLEntityStoreAssembler.java         |   2 +-
 .../assembly/SQLiteEntityStoreAssembler.java    |   2 +-
 .../sql/DerbySQLEntityStoreTest.java            |   4 +-
 .../entitystore/sql/MySQLEntityStoreTest.java   |   4 +-
 .../ElasticSearchClusterConfiguration.java      |   2 +-
 .../ElasticSearchConfiguration.java             |  50 ---
 .../ElasticSearchIndexException.java            |  36 --
 .../ElasticSearchIndexExporter.java             |   5 +-
 .../elasticsearch/ElasticSearchIndexer.java     |   2 +-
 .../ElasticSearchIndexingConfiguration.java     |  49 +++
 .../ElasticSearchIndexingException.java         |  35 ++
 .../elasticsearch/ElasticSearchSupport.java     |   5 +-
 .../assembly/ESClientIndexQueryAssembler.java   |   4 +-
 .../ESFilesystemIndexQueryAssembler.java        |   4 +-
 .../elasticsearch/client/ESClientSupport.java   |   6 +-
 .../filesystem/ESFilesystemSupport.java         |   6 +-
 .../ElasticSearchComplexQueryTest.java          |   2 +-
 .../elasticsearch/ElasticSearchFinderTest.java  |   2 +-
 .../ElasticSearchQueryMultimoduleTest.java      |   2 +-
 .../elasticsearch/ElasticSearchQueryTest.java   |   2 +-
 .../index/elasticsearch/ElasticSearchTest.java  |   2 +-
 .../index/elasticsearch/ImmenseTermTest.java    |   2 +-
 .../index/rdf/RdfIndexingEngineService.java     |  30 --
 .../polygene/index/rdf/RdfIndexingService.java  |  30 ++
 .../rdf/assembly/RdfMemoryStoreAssembler.java   |   4 +-
 .../assembly/RdfNativeSesameStoreAssembler.java |   4 +-
 .../assembly/RdfRdbmsSesameStoreAssembler.java  |   4 +-
 .../index/rdf/indexing/RdfExporter.java         | 106 -----
 .../index/rdf/indexing/RdfIndexExporter.java    |  92 +++++
 .../index/rdf/indexing/RdfIndexerService.java   | 239 ++++++++++++
 .../index/rdf/indexing/RdfIndexingService.java  | 240 ------------
 .../polygene/index/rdf/RdfComplexQueryTest.java |   2 +-
 .../polygene/index/rdf/RdfEntityFinderTest.java |   2 +-
 .../polygene/index/rdf/qi95/Qi95IssueTest.java  |   6 +-
 .../polygene/index/solr/SolrQueryService.java   |   3 +-
 .../index/sql/SQLIndexingConfiguration.java     |  31 ++
 .../sql/SQLIndexingEngineConfiguration.java     |  31 --
 .../index/sql/SQLIndexingEngineService.java     |  44 ---
 .../polygene/index/sql/SQLIndexingService.java  |  44 +++
 .../AbstractSQLIndexQueryAssembler.java         |   7 +-
 .../assembly/PostgreSQLIndexQueryAssembler.java |   4 +-
 .../support/postgresql/PostgreSQLService.java   |   4 +-
 .../codahale/CodahaleMetricsProvider.java       |   3 +-
 .../polygene/index/reindexer/ReindexerTest.java |   6 +-
 .../library/rest/admin/IndexResource.java       |  10 +-
 .../library/rest/admin/DomainAssembler.java     |   4 +-
 .../jdbm/JdbmEntityStorePerformanceTest.java    |   4 +-
 .../sql/DerbySQLEntityStorePerformanceTest.java |   6 +-
 .../indexing/rdf/QueryPerformanceTest.java      |   4 +-
 .../persistence/PersistenceAssembler.java       |   4 +-
 111 files changed, 3118 insertions(+), 3136 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-geode/src/main/java/org/apache/polygene/entitystore/geode/GeodeConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-geode/src/main/java/org/apache/polygene/entitystore/geode/GeodeConfiguration.java b/extensions/entitystore-geode/src/main/java/org/apache/polygene/entitystore/geode/GeodeConfiguration.java
deleted file mode 100644
index 4408bee..0000000
--- a/extensions/entitystore-geode/src/main/java/org/apache/polygene/entitystore/geode/GeodeConfiguration.java
+++ /dev/null
@@ -1,81 +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.geode;
-
-import org.apache.polygene.api.common.Optional;
-import org.apache.polygene.api.common.UseDefaults;
-import org.apache.polygene.api.property.Property;
-
-/**
- * Geode Configuration.
- */
-// START SNIPPET: config
-public interface GeodeConfiguration
-{
-    /**
-     * Geode Topology.
-     * Defaults to {@literal EMBEDDED}, see {@link GeodeTopology}.
-     *
-     * @return Geode Topology
-     */
-    @UseDefaults
-    Property<GeodeTopology> topology();
-
-    /**
-     * Geode Cache Name.
-     *
-     * @return Geode Cache Name
-     */
-    @UseDefaults( "polygene:cache" )
-    Property<String> cacheName();
-
-    /**
-     * Cache properties path, loaded from the classpath.
-     *
-     * @return Cache properties path
-     */
-    @Optional
-    Property<String> cachePropertiesPath();
-
-    /**
-     * Cache Region Shortcut.
-     *
-     * In {@literal EMBEDDED} {@link #topology()}, defaults to  {@literal LOCAL},
-     * see {@link org.apache.geode.cache.RegionShortcut}.
-     *
-     * In {@literal CLIENT_SERVER} {@link #topology()}, defaults to {@literal PROXY},
-     * see {@link org.apache.geode.cache.client.ClientRegionShortcut}.
-     *
-     * @return Cache Region Shortcut
-     */
-    @Optional
-    Property<String> regionShortcut();
-
-    /**
-     * Geode Region Name.
-     *
-     * Region names may only be alphanumeric and may contain hyphens or underscores.
-     *
-     * @return Geode Region Name
-     */
-    @UseDefaults( "polygene-entitystore-region" )
-    Property<String> regionName();
-}
-// END SNIPPET: config

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-geode/src/main/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-geode/src/main/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreConfiguration.java b/extensions/entitystore-geode/src/main/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreConfiguration.java
new file mode 100644
index 0000000..cb018a1
--- /dev/null
+++ b/extensions/entitystore-geode/src/main/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreConfiguration.java
@@ -0,0 +1,81 @@
+/*
+ *  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.geode;
+
+import org.apache.polygene.api.common.Optional;
+import org.apache.polygene.api.common.UseDefaults;
+import org.apache.polygene.api.property.Property;
+
+/**
+ * Geode Configuration.
+ */
+// START SNIPPET: config
+public interface GeodeEntityStoreConfiguration
+{
+    /**
+     * Geode Topology.
+     * Defaults to {@literal EMBEDDED}, see {@link GeodeTopology}.
+     *
+     * @return Geode Topology
+     */
+    @UseDefaults
+    Property<GeodeTopology> topology();
+
+    /**
+     * Geode Cache Name.
+     *
+     * @return Geode Cache Name
+     */
+    @UseDefaults( "polygene:cache" )
+    Property<String> cacheName();
+
+    /**
+     * Cache properties path, loaded from the classpath.
+     *
+     * @return Cache properties path
+     */
+    @Optional
+    Property<String> cachePropertiesPath();
+
+    /**
+     * Cache Region Shortcut.
+     *
+     * In {@literal EMBEDDED} {@link #topology()}, defaults to  {@literal LOCAL},
+     * see {@link org.apache.geode.cache.RegionShortcut}.
+     *
+     * In {@literal CLIENT_SERVER} {@link #topology()}, defaults to {@literal PROXY},
+     * see {@link org.apache.geode.cache.client.ClientRegionShortcut}.
+     *
+     * @return Cache Region Shortcut
+     */
+    @Optional
+    Property<String> regionShortcut();
+
+    /**
+     * Geode Region Name.
+     *
+     * Region names may only be alphanumeric and may contain hyphens or underscores.
+     *
+     * @return Geode Region Name
+     */
+    @UseDefaults( "polygene-entitystore-region" )
+    Property<String> regionName();
+}
+// END SNIPPET: config

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-geode/src/main/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-geode/src/main/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreMixin.java b/extensions/entitystore-geode/src/main/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreMixin.java
index c140c28..37f4bf7 100644
--- a/extensions/entitystore-geode/src/main/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreMixin.java
+++ b/extensions/entitystore-geode/src/main/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreMixin.java
@@ -50,7 +50,7 @@ public class GeodeEntityStoreMixin
         implements ServiceActivation, MapEntityStore
 {
     @This
-    private Configuration<GeodeConfiguration> config;
+    private Configuration<GeodeEntityStoreConfiguration> config;
 
     private AutoCloseable closeable;
     private Region<String, String> region;
@@ -60,7 +60,7 @@ public class GeodeEntityStoreMixin
             throws Exception
     {
         config.refresh();
-        GeodeConfiguration configuration = config.get();
+        GeodeEntityStoreConfiguration configuration = config.get();
         switch( configuration.topology().get() )
         {
             case EMBEDDED:
@@ -75,7 +75,7 @@ public class GeodeEntityStoreMixin
         }
     }
 
-    private void activateEmbedded( GeodeConfiguration configuration )
+    private void activateEmbedded( GeodeEntityStoreConfiguration configuration )
             throws IOException
     {
         Properties cacheProperties = buildCacheProperties( configuration );
@@ -92,7 +92,7 @@ public class GeodeEntityStoreMixin
         closeable = cache;
     }
 
-    private void activateClientServer( GeodeConfiguration configuration )
+    private void activateClientServer( GeodeEntityStoreConfiguration configuration )
             throws IOException
     {
         Properties cacheProperties = buildCacheProperties( configuration );
@@ -109,7 +109,7 @@ public class GeodeEntityStoreMixin
         closeable = cache;
     }
 
-    private Properties buildCacheProperties( GeodeConfiguration config )
+    private Properties buildCacheProperties( GeodeEntityStoreConfiguration config )
             throws IOException
     {
         Properties properties = new Properties();

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-geode/src/main/java/org/apache/polygene/entitystore/geode/assembly/GeodeEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-geode/src/main/java/org/apache/polygene/entitystore/geode/assembly/GeodeEntityStoreAssembler.java b/extensions/entitystore-geode/src/main/java/org/apache/polygene/entitystore/geode/assembly/GeodeEntityStoreAssembler.java
index 741d420..de87ccc 100644
--- a/extensions/entitystore-geode/src/main/java/org/apache/polygene/entitystore/geode/assembly/GeodeEntityStoreAssembler.java
+++ b/extensions/entitystore-geode/src/main/java/org/apache/polygene/entitystore/geode/assembly/GeodeEntityStoreAssembler.java
@@ -23,7 +23,7 @@ import org.apache.polygene.bootstrap.Assemblers;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.ServiceDeclaration;
-import org.apache.polygene.entitystore.geode.GeodeConfiguration;
+import org.apache.polygene.entitystore.geode.GeodeEntityStoreConfiguration;
 import org.apache.polygene.entitystore.geode.GeodeEntityStoreService;
 
 /**
@@ -43,7 +43,7 @@ public class GeodeEntityStoreAssembler
         }
         if( hasConfig() )
         {
-            configModule().entities( GeodeConfiguration.class ).visibleIn( configVisibility() );
+            configModule().entities( GeodeEntityStoreConfiguration.class ).visibleIn( configVisibility() );
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/HazelcastConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/HazelcastConfiguration.java b/extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/HazelcastConfiguration.java
deleted file mode 100644
index dd124b8..0000000
--- a/extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/HazelcastConfiguration.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.polygene.entitystore.hazelcast;
-
-import org.apache.polygene.api.common.UseDefaults;
-import org.apache.polygene.api.property.Property;
-
-/**
- * Configuration of HazelcastEntityStoreService.
- */
-// START SNIPPET: config
-public interface HazelcastConfiguration
-{
-
-    @UseDefaults
-    Property<String> configXmlLocation();
-
-    @UseDefaults
-    Property<String> mapName();
-
-}
-// END SNIPPET: config

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreConfiguration.java b/extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreConfiguration.java
new file mode 100644
index 0000000..011c454
--- /dev/null
+++ b/extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreConfiguration.java
@@ -0,0 +1,39 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.entitystore.hazelcast;
+
+import org.apache.polygene.api.common.UseDefaults;
+import org.apache.polygene.api.property.Property;
+
+/**
+ * Configuration of HazelcastEntityStoreService.
+ */
+// START SNIPPET: config
+public interface HazelcastEntityStoreConfiguration
+{
+
+    @UseDefaults
+    Property<String> configXmlLocation();
+
+    @UseDefaults
+    Property<String> mapName();
+
+}
+// END SNIPPET: config

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreMixin.java b/extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreMixin.java
index 749d980..b92bda2 100644
--- a/extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreMixin.java
+++ b/extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreMixin.java
@@ -50,7 +50,7 @@ public class HazelcastEntityStoreMixin
     private static final String DEFAULT_MAPNAME = "polygene:entitystore:data";
 
     @This
-    private Configuration<HazelcastConfiguration> config;
+    private Configuration<HazelcastEntityStoreConfiguration> config;
 
     private IMap<String, String> stringMap;
     private HazelcastInstance hazelcastInstance;
@@ -59,7 +59,7 @@ public class HazelcastEntityStoreMixin
     public void activateService()
         throws Exception
     {
-        HazelcastConfiguration configuration = config.get();
+        HazelcastEntityStoreConfiguration configuration = config.get();
         Config conf = createConfig( configuration );
         hazelcastInstance = Hazelcast.newHazelcastInstance( conf );
         String mapName = DEFAULT_MAPNAME;
@@ -148,7 +148,7 @@ public class HazelcastEntityStoreMixin
         return stringMap.values().stream().map( StringReader::new );
     }
 
-    private Config createConfig( HazelcastConfiguration configuration )
+    private Config createConfig( HazelcastEntityStoreConfiguration configuration )
         throws IOException
     {
         String hzConfLocation = configuration.configXmlLocation().get();

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/assembly/HazelcastEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/assembly/HazelcastEntityStoreAssembler.java b/extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/assembly/HazelcastEntityStoreAssembler.java
index 0fc1605..f4c8cef 100644
--- a/extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/assembly/HazelcastEntityStoreAssembler.java
+++ b/extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/assembly/HazelcastEntityStoreAssembler.java
@@ -23,7 +23,7 @@ import org.apache.polygene.bootstrap.Assemblers;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.ServiceDeclaration;
-import org.apache.polygene.entitystore.hazelcast.HazelcastConfiguration;
+import org.apache.polygene.entitystore.hazelcast.HazelcastEntityStoreConfiguration;
 import org.apache.polygene.entitystore.hazelcast.HazelcastEntityStoreService;
 
 public class HazelcastEntityStoreAssembler
@@ -42,7 +42,7 @@ public class HazelcastEntityStoreAssembler
         }
         if( hasConfig() )
         {
-            configModule().entities( HazelcastConfiguration.class ).visibleIn( configVisibility() );
+            configModule().entities( HazelcastEntityStoreConfiguration.class ).visibleIn( configVisibility() );
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsEntityStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsEntityStoreConfiguration.java b/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsEntityStoreConfiguration.java
new file mode 100644
index 0000000..b34b921
--- /dev/null
+++ b/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsEntityStoreConfiguration.java
@@ -0,0 +1,54 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+
+package org.apache.polygene.entitystore.jclouds;
+
+import java.util.Map;
+import org.apache.polygene.api.common.Optional;
+import org.apache.polygene.api.common.UseDefaults;
+import org.apache.polygene.api.property.Property;
+
+/**
+ * Configuration of JCloudsMapEntityStore service.
+ */
+public interface JCloudsEntityStoreConfiguration
+{
+    // START SNIPPET: config
+    /**
+     * Name of the JClouds provider to use. Defaults to 'transient'.
+     */
+    @Optional Property<String> provider();
+    @UseDefaults Property<String> identifier();
+    @UseDefaults Property<String> credential();
+    /**
+     * Use this to fine tune your provider implementation according to JClouds documentation.
+     */
+    @UseDefaults Property<Map<String, String>> properties();
+    /**
+     * Name of the JClouds container to use. Defaults to 'polygene-entities'.
+     */
+    @Optional Property<String> container();
+    /**
+     * Endpoint for the BlobStore provider.
+     */
+    @Optional Property<String> endpoint();
+    // END SNIPPET: config
+
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsEntityStoreMixin.java b/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsEntityStoreMixin.java
new file mode 100644
index 0000000..38b8d74
--- /dev/null
+++ b/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsEntityStoreMixin.java
@@ -0,0 +1,284 @@
+/*
+ *  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.jclouds;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Maps;
+import com.google.common.io.ByteSource;
+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.nio.charset.StandardCharsets;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Scanner;
+import java.util.Set;
+import java.util.stream.Stream;
+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;
+import org.jclouds.ContextBuilder;
+import org.jclouds.apis.ApiMetadata;
+import org.jclouds.apis.Apis;
+import org.jclouds.blobstore.BlobStore;
+import org.jclouds.blobstore.BlobStoreContext;
+import org.jclouds.blobstore.domain.Blob;
+import org.jclouds.io.Payload;
+import org.jclouds.providers.ProviderMetadata;
+import org.jclouds.providers.Providers;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static com.google.common.base.Charsets.UTF_8;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.collect.Iterables.contains;
+
+/**
+ * JClouds implementation of MapEntityStore.
+ */
+// TODO Expose Location in configuration
+//      To be done once JClouds 1.5 has stabilized their Location API.
+//      A list of ISO-3166 country codes.
+//      It defines where your entities are allowed to be stored.
+//      @UseDefaults Property<List<String>> geopoliticalBoundaries(); ???
+//      SEE  http://www.jclouds.org/documentation/reference/location-metadata-design
+public class JCloudsEntityStoreMixin
+    implements ServiceActivation, MapEntityStore
+{
+
+    private static final Logger LOGGER = LoggerFactory.getLogger( "org.apache.polygene.entitystore.jclouds" );
+
+    private static final Map<String, ApiMetadata> allApis = Maps.uniqueIndex(
+        Apis.viewableAs( BlobStoreContext.class ),
+        Apis.idFunction()
+    );
+
+    private static final Map<String, ProviderMetadata> appProviders = Maps.uniqueIndex(
+        Providers.viewableAs( BlobStoreContext.class ),
+        Providers.idFunction()
+    );
+
+    private static final Set<String> allKeys = ImmutableSet.copyOf(
+        Iterables.concat( appProviders.keySet(), allApis.keySet() )
+    );
+
+    @This
+    private Configuration<JCloudsEntityStoreConfiguration> configuration;
+
+    private BlobStoreContext storeContext;
+
+    private String container;
+
+    @Override
+    public void activateService()
+        throws Exception
+    {
+        configuration.refresh();
+        String provider = configuration.get().provider().get();
+        String identifier = configuration.get().identifier().get();
+        String credentials = configuration.get().credential().get();
+        String endpoint = configuration.get().endpoint().get();
+        Map<String, String> properties = configuration.get().properties().get();
+        container = configuration.get().container().get();
+        if( provider != null )
+        {
+            checkArgument( contains( allKeys, provider ), "provider %s not in supported list: %s", provider, allKeys );
+        }
+        else
+        {
+            provider = "transient";
+        }
+        if( container == null )
+        {
+            container = "polygene-entities";
+        }
+        storeContext = ContextBuilder.newBuilder( provider )
+                                     .endpoint( endpoint == null ? "" : endpoint )
+                                     .credentials( identifier, credentials )
+                                     .overrides( asProperties( properties ) )
+                                     .buildView( BlobStoreContext.class );
+        BlobStore blobStore = storeContext.getBlobStore();
+        if( !blobStore.containerExists( container ) )
+        {
+            if( !blobStore.createContainerInLocation( null, container ) )
+            {
+                throw new EntityStoreException( "Unable to create JClouds Blob Container, cannot continue." );
+            }
+            else
+            {
+                LOGGER.debug( "Created new container: {}", container );
+            }
+        }
+        LOGGER.info( "Activated using {} cloud provider [id:{}]", provider, identifier );
+    }
+
+    private Properties asProperties( Map<String, String> map )
+    {
+        Properties props = new Properties();
+        for( Map.Entry<String, String> eachEntry : map.entrySet() )
+        {
+            props.put( eachEntry.getKey(), eachEntry.getValue() );
+        }
+        return props;
+    }
+
+    @Override
+    public void passivateService()
+        throws Exception
+    {
+        if( storeContext != null )
+        {
+            storeContext.close();
+            storeContext = null;
+            container = null;
+        }
+    }
+
+    @Override
+    public Reader get( EntityReference entityReference )
+        throws EntityStoreException
+    {
+        Blob blob = storeContext.getBlobStore().getBlob( container, entityReference.identity().toString() );
+        if( blob == null )
+        {
+            throw new EntityNotFoundException( entityReference );
+        }
+        Payload payload = blob.getPayload();
+        if( payload == null )
+        {
+            throw new EntityNotFoundException( entityReference );
+        }
+        try( InputStream input = payload.openStream() )
+        {
+            String state = new Scanner( input, StandardCharsets.UTF_8.name() ).useDelimiter( "\\Z" ).next();
+            return new StringReader( state );
+        }
+        catch( IOException ex )
+        {
+            throw new EntityStoreException( "Unable to read entity state for: " + entityReference, ex );
+        }
+    }
+
+    @Override
+    public void applyChanges( MapChanges changes )
+        throws Exception
+    {
+        final BlobStore blobStore = storeContext.getBlobStore();
+        changes.visitMap(
+            new MapChanger()
+            {
+                @Override
+                public Writer newEntity( final EntityReference ref, EntityDescriptor entityDescriptor )
+                    throws IOException
+                {
+                    return new StringWriter()
+                    {
+                        @Override
+                        public void close()
+                            throws IOException
+                        {
+                            super.close();
+                            ByteSource payload = ByteSource.wrap( toString().getBytes( UTF_8 ) );
+                            Blob blob = blobStore.blobBuilder( ref.identity().toString() )
+                                                 .payload( payload )
+                                                 .contentLength( payload.size() )
+                                                 .build();
+                            blobStore.putBlob( container, blob );
+                        }
+                    };
+                }
+
+                @Override
+                public Writer updateEntity( MapChange mapChange )
+                    throws IOException
+                {
+                    String identity = mapChange.reference().identity().toString();
+                    if( !blobStore.blobExists( container, identity ) )
+                    {
+                        throw new EntityNotFoundException( mapChange.reference() );
+                    }
+                    return new StringWriter()
+                    {
+                        @Override
+                        public void close()
+                            throws IOException
+                        {
+                            super.close();
+                            ByteSource payload = ByteSource.wrap( toString().getBytes( UTF_8 ) );
+                            Blob blob = blobStore.blobBuilder( identity )
+                                                 .payload( payload )
+                                                 .contentLength( payload.size() )
+                                                 .build();
+                            blobStore.putBlob( container, blob );
+                        }
+                    };
+                }
+
+                @Override
+                public void removeEntity( EntityReference ref, EntityDescriptor entityDescriptor )
+                    throws EntityNotFoundException
+                {
+                    if( !blobStore.blobExists( container, ref.identity().toString() ) )
+                    {
+                        throw new EntityNotFoundException( ref );
+                    }
+                    blobStore.removeBlob( container, ref.identity().toString() );
+                }
+            }
+        );
+    }
+
+    @Override
+    public Stream<Reader> entityStates()
+    {
+        return storeContext
+            .getBlobStore().list( container ).stream()
+            .map( metadata ->
+                  {
+                      Payload payload = storeContext.getBlobStore()
+                                                    .getBlob( container, metadata.getName() )
+                                                    .getPayload();
+                      if( payload == null )
+                      {
+                          EntityReference reference = EntityReference.parseEntityReference( metadata.getName() );
+                          throw new EntityNotFoundException( reference );
+                      }
+                      try( InputStream input = payload.openStream() )
+                      {
+                          String state = new Scanner( input, UTF_8.name() ).useDelimiter( "\\Z" ).next();
+                          return (Reader) new StringReader( state );
+                      }
+                      catch( IOException ex )
+                      {
+                          throw new EntityStoreException( ex );
+                      }
+                  } );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsEntityStoreService.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsEntityStoreService.java b/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsEntityStoreService.java
new file mode 100644
index 0000000..38c08b9
--- /dev/null
+++ b/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsEntityStoreService.java
@@ -0,0 +1,48 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.entitystore.jclouds;
+
+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;
+
+/**
+ * JClouds EntityStore service.
+ * <p>Based on @{@link JSONMapEntityStoreMixin}.</p>
+ */
+@Concerns( { StateChangeNotificationConcern.class, ConcurrentModificationCheckConcern.class } )
+@Mixins( { JSONMapEntityStoreMixin.class, JCloudsEntityStoreMixin.class } )
+public interface JCloudsEntityStoreService
+    extends ServiceActivation,
+            JSONMapEntityStoreActivation,
+            EntityStore,
+            EntityStateVersions,
+            LockingAbstractComposite,
+            Configuration
+{
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsMapEntityStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsMapEntityStoreConfiguration.java b/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsMapEntityStoreConfiguration.java
deleted file mode 100644
index 8782ec9..0000000
--- a/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsMapEntityStoreConfiguration.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.polygene.entitystore.jclouds;
-
-import java.util.Map;
-import org.apache.polygene.api.common.Optional;
-import org.apache.polygene.api.common.UseDefaults;
-import org.apache.polygene.api.property.Property;
-
-/**
- * Configuration of JCloudsMapEntityStore service.
- */
-public interface JCloudsMapEntityStoreConfiguration
-{
-    // START SNIPPET: config
-    /**
-     * Name of the JClouds provider to use. Defaults to 'transient'.
-     */
-    @Optional Property<String> provider();
-    @UseDefaults Property<String> identifier();
-    @UseDefaults Property<String> credential();
-    /**
-     * Use this to fine tune your provider implementation according to JClouds documentation.
-     */
-    @UseDefaults Property<Map<String, String>> properties();
-    /**
-     * Name of the JClouds container to use. Defaults to 'polygene-entities'.
-     */
-    @Optional Property<String> container();
-    /**
-     * Endpoint for the BlobStore provider.
-     */
-    @Optional Property<String> endpoint();
-    // END SNIPPET: config
-
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsMapEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsMapEntityStoreMixin.java b/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsMapEntityStoreMixin.java
deleted file mode 100644
index 2ab821b..0000000
--- a/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsMapEntityStoreMixin.java
+++ /dev/null
@@ -1,284 +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.jclouds;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Maps;
-import com.google.common.io.ByteSource;
-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.nio.charset.StandardCharsets;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Scanner;
-import java.util.Set;
-import java.util.stream.Stream;
-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;
-import org.jclouds.ContextBuilder;
-import org.jclouds.apis.ApiMetadata;
-import org.jclouds.apis.Apis;
-import org.jclouds.blobstore.BlobStore;
-import org.jclouds.blobstore.BlobStoreContext;
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.io.Payload;
-import org.jclouds.providers.ProviderMetadata;
-import org.jclouds.providers.Providers;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static com.google.common.base.Charsets.UTF_8;
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.collect.Iterables.contains;
-
-/**
- * JClouds implementation of MapEntityStore.
- */
-// TODO Expose Location in configuration
-//      To be done once JClouds 1.5 has stabilized their Location API.
-//      A list of ISO-3166 country codes.
-//      It defines where your entities are allowed to be stored.
-//      @UseDefaults Property<List<String>> geopoliticalBoundaries(); ???
-//      SEE  http://www.jclouds.org/documentation/reference/location-metadata-design
-public class JCloudsMapEntityStoreMixin
-    implements ServiceActivation, MapEntityStore
-{
-
-    private static final Logger LOGGER = LoggerFactory.getLogger( "org.apache.polygene.entitystore.jclouds" );
-
-    private static final Map<String, ApiMetadata> allApis = Maps.uniqueIndex(
-        Apis.viewableAs( BlobStoreContext.class ),
-        Apis.idFunction()
-    );
-
-    private static final Map<String, ProviderMetadata> appProviders = Maps.uniqueIndex(
-        Providers.viewableAs( BlobStoreContext.class ),
-        Providers.idFunction()
-    );
-
-    private static final Set<String> allKeys = ImmutableSet.copyOf(
-        Iterables.concat( appProviders.keySet(), allApis.keySet() )
-    );
-
-    @This
-    private Configuration<JCloudsMapEntityStoreConfiguration> configuration;
-
-    private BlobStoreContext storeContext;
-
-    private String container;
-
-    @Override
-    public void activateService()
-        throws Exception
-    {
-        configuration.refresh();
-        String provider = configuration.get().provider().get();
-        String identifier = configuration.get().identifier().get();
-        String credentials = configuration.get().credential().get();
-        String endpoint = configuration.get().endpoint().get();
-        Map<String, String> properties = configuration.get().properties().get();
-        container = configuration.get().container().get();
-        if( provider != null )
-        {
-            checkArgument( contains( allKeys, provider ), "provider %s not in supported list: %s", provider, allKeys );
-        }
-        else
-        {
-            provider = "transient";
-        }
-        if( container == null )
-        {
-            container = "polygene-entities";
-        }
-        storeContext = ContextBuilder.newBuilder( provider )
-                                     .endpoint( endpoint == null ? "" : endpoint )
-                                     .credentials( identifier, credentials )
-                                     .overrides( asProperties( properties ) )
-                                     .buildView( BlobStoreContext.class );
-        BlobStore blobStore = storeContext.getBlobStore();
-        if( !blobStore.containerExists( container ) )
-        {
-            if( !blobStore.createContainerInLocation( null, container ) )
-            {
-                throw new EntityStoreException( "Unable to create JClouds Blob Container, cannot continue." );
-            }
-            else
-            {
-                LOGGER.debug( "Created new container: {}", container );
-            }
-        }
-        LOGGER.info( "Activated using {} cloud provider [id:{}]", provider, identifier );
-    }
-
-    private Properties asProperties( Map<String, String> map )
-    {
-        Properties props = new Properties();
-        for( Map.Entry<String, String> eachEntry : map.entrySet() )
-        {
-            props.put( eachEntry.getKey(), eachEntry.getValue() );
-        }
-        return props;
-    }
-
-    @Override
-    public void passivateService()
-        throws Exception
-    {
-        if( storeContext != null )
-        {
-            storeContext.close();
-            storeContext = null;
-            container = null;
-        }
-    }
-
-    @Override
-    public Reader get( EntityReference entityReference )
-        throws EntityStoreException
-    {
-        Blob blob = storeContext.getBlobStore().getBlob( container, entityReference.identity().toString() );
-        if( blob == null )
-        {
-            throw new EntityNotFoundException( entityReference );
-        }
-        Payload payload = blob.getPayload();
-        if( payload == null )
-        {
-            throw new EntityNotFoundException( entityReference );
-        }
-        try( InputStream input = payload.openStream() )
-        {
-            String state = new Scanner( input, StandardCharsets.UTF_8.name() ).useDelimiter( "\\Z" ).next();
-            return new StringReader( state );
-        }
-        catch( IOException ex )
-        {
-            throw new EntityStoreException( "Unable to read entity state for: " + entityReference, ex );
-        }
-    }
-
-    @Override
-    public void applyChanges( MapChanges changes )
-        throws Exception
-    {
-        final BlobStore blobStore = storeContext.getBlobStore();
-        changes.visitMap(
-            new MapChanger()
-            {
-                @Override
-                public Writer newEntity( final EntityReference ref, EntityDescriptor entityDescriptor )
-                    throws IOException
-                {
-                    return new StringWriter()
-                    {
-                        @Override
-                        public void close()
-                            throws IOException
-                        {
-                            super.close();
-                            ByteSource payload = ByteSource.wrap( toString().getBytes( UTF_8 ) );
-                            Blob blob = blobStore.blobBuilder( ref.identity().toString() )
-                                                 .payload( payload )
-                                                 .contentLength( payload.size() )
-                                                 .build();
-                            blobStore.putBlob( container, blob );
-                        }
-                    };
-                }
-
-                @Override
-                public Writer updateEntity( MapChange mapChange )
-                    throws IOException
-                {
-                    String identity = mapChange.reference().identity().toString();
-                    if( !blobStore.blobExists( container, identity ) )
-                    {
-                        throw new EntityNotFoundException( mapChange.reference() );
-                    }
-                    return new StringWriter()
-                    {
-                        @Override
-                        public void close()
-                            throws IOException
-                        {
-                            super.close();
-                            ByteSource payload = ByteSource.wrap( toString().getBytes( UTF_8 ) );
-                            Blob blob = blobStore.blobBuilder( identity )
-                                                 .payload( payload )
-                                                 .contentLength( payload.size() )
-                                                 .build();
-                            blobStore.putBlob( container, blob );
-                        }
-                    };
-                }
-
-                @Override
-                public void removeEntity( EntityReference ref, EntityDescriptor entityDescriptor )
-                    throws EntityNotFoundException
-                {
-                    if( !blobStore.blobExists( container, ref.identity().toString() ) )
-                    {
-                        throw new EntityNotFoundException( ref );
-                    }
-                    blobStore.removeBlob( container, ref.identity().toString() );
-                }
-            }
-        );
-    }
-
-    @Override
-    public Stream<Reader> entityStates()
-    {
-        return storeContext
-            .getBlobStore().list( container ).stream()
-            .map( metadata ->
-                  {
-                      Payload payload = storeContext.getBlobStore()
-                                                    .getBlob( container, metadata.getName() )
-                                                    .getPayload();
-                      if( payload == null )
-                      {
-                          EntityReference reference = EntityReference.parseEntityReference( metadata.getName() );
-                          throw new EntityNotFoundException( reference );
-                      }
-                      try( InputStream input = payload.openStream() )
-                      {
-                          String state = new Scanner( input, UTF_8.name() ).useDelimiter( "\\Z" ).next();
-                          return (Reader) new StringReader( state );
-                      }
-                      catch( IOException ex )
-                      {
-                          throw new EntityStoreException( ex );
-                      }
-                  } );
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsMapEntityStoreService.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsMapEntityStoreService.java b/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsMapEntityStoreService.java
deleted file mode 100644
index 332be21..0000000
--- a/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsMapEntityStoreService.java
+++ /dev/null
@@ -1,48 +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.jclouds;
-
-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;
-
-/**
- * JClouds EntityStore service.
- * <p>Based on @{@link JSONMapEntityStoreMixin}.</p>
- */
-@Concerns( { StateChangeNotificationConcern.class, ConcurrentModificationCheckConcern.class } )
-@Mixins( { JSONMapEntityStoreMixin.class, JCloudsMapEntityStoreMixin.class } )
-public interface JCloudsMapEntityStoreService
-    extends ServiceActivation,
-            JSONMapEntityStoreActivation,
-            EntityStore,
-            EntityStateVersions,
-            LockingAbstractComposite,
-            Configuration
-{
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/assembly/JCloudsEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/assembly/JCloudsEntityStoreAssembler.java b/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/assembly/JCloudsEntityStoreAssembler.java
index 304e7dd..fe99f13 100644
--- a/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/assembly/JCloudsEntityStoreAssembler.java
+++ b/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/assembly/JCloudsEntityStoreAssembler.java
@@ -24,8 +24,8 @@ import org.apache.polygene.bootstrap.Assemblers;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.ServiceDeclaration;
-import org.apache.polygene.entitystore.jclouds.JCloudsMapEntityStoreConfiguration;
-import org.apache.polygene.entitystore.jclouds.JCloudsMapEntityStoreService;
+import org.apache.polygene.entitystore.jclouds.JCloudsEntityStoreConfiguration;
+import org.apache.polygene.entitystore.jclouds.JCloudsEntityStoreService;
 
 public class JCloudsEntityStoreAssembler
     extends Assemblers.VisibilityIdentityConfig<JCloudsEntityStoreAssembler>
@@ -34,7 +34,7 @@ public class JCloudsEntityStoreAssembler
     public void assemble( ModuleAssembly module )
         throws AssemblyException
     {
-        ServiceDeclaration service = module.services( JCloudsMapEntityStoreService.class ).
+        ServiceDeclaration service = module.services( JCloudsEntityStoreService.class ).
             visibleIn( visibility() ).
             instantiateOnStartup();
         if( hasIdentity() )
@@ -43,7 +43,7 @@ public class JCloudsEntityStoreAssembler
         }
         if( hasConfig() )
         {
-            configModule().entities( JCloudsMapEntityStoreConfiguration.class ).visibleIn( configVisibility() );
+            configModule().entities( JCloudsEntityStoreConfiguration.class ).visibleIn( configVisibility() );
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsFilesystemTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsFilesystemTest.java b/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsFilesystemTest.java
index 91abf14..cb1303e 100644
--- a/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsFilesystemTest.java
+++ b/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsFilesystemTest.java
@@ -43,8 +43,8 @@ public class JCloudsFilesystemTest
         ModuleAssembly config = module.layer().module( "config" );
         new EntityTestAssembler().assemble( config );
         new JCloudsEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
-        JCloudsMapEntityStoreConfiguration defaults = config.forMixin( JCloudsMapEntityStoreConfiguration.class )
-                                                            .declareDefaults();
+        JCloudsEntityStoreConfiguration defaults = config.forMixin( JCloudsEntityStoreConfiguration.class )
+                                                         .declareDefaults();
         defaults.provider().set( "filesystem" );
         defaults.properties().set( Collections.singletonMap( FilesystemConstants.PROPERTY_BASEDIR,
                                                              tmpDir.getRoot().getAbsolutePath() ) );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsS3Test.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsS3Test.java b/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsS3Test.java
index 720b072..d0fb544 100644
--- a/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsS3Test.java
+++ b/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsS3Test.java
@@ -39,8 +39,8 @@ public class JCloudsS3Test extends AbstractEntityStoreTest
         ModuleAssembly config = module.layer().module( "config" );
         new EntityTestAssembler().assemble( config );
         new JCloudsEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
-        JCloudsMapEntityStoreConfiguration defaults = config.forMixin( JCloudsMapEntityStoreConfiguration.class )
-                                                            .declareDefaults();
+        JCloudsEntityStoreConfiguration defaults = config.forMixin( JCloudsEntityStoreConfiguration.class )
+                                                         .declareDefaults();
         String host = DOCKER.getDockerHost();
         int port = DOCKER.getExposedContainerPort( "8000/tcp" );
         defaults.provider().set( "s3" );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmConfiguration.java b/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmConfiguration.java
deleted file mode 100644
index 03143a1..0000000
--- a/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmConfiguration.java
+++ /dev/null
@@ -1,52 +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.jdbm;
-
-import org.apache.polygene.api.common.Optional;
-import org.apache.polygene.api.common.UseDefaults;
-import org.apache.polygene.api.property.Property;
-
-/**
- * Configuration for the JdbmEntityStoreService.
- */
-// START SNIPPET: config
-public interface JdbmConfiguration
-{
-    // END SNIPPET: config
-   /**
-    * The file where the JDBM data will be stored
-    * <p>
-    * Default: System.getProperty( "user.dir" ) + "/polygene/jdbmstore.data";
-    * </p>
-    * @return path to data file relative to current path
-    */
-    // START SNIPPET: config
-   @Optional
-   Property<String> file();
-
-   // JDBM RecordManager options
-
-   @UseDefaults
-   Property<Boolean> autoCommit();
-
-   @UseDefaults
-   Property<Boolean> disableTransactions();
-}
-// END SNIPPET: config

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreConfiguration.java b/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreConfiguration.java
new file mode 100644
index 0000000..8997063
--- /dev/null
+++ b/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreConfiguration.java
@@ -0,0 +1,52 @@
+/*
+ *  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.jdbm;
+
+import org.apache.polygene.api.common.Optional;
+import org.apache.polygene.api.common.UseDefaults;
+import org.apache.polygene.api.property.Property;
+
+/**
+ * Configuration for the JdbmEntityStoreService.
+ */
+// START SNIPPET: config
+public interface JdbmEntityStoreConfiguration
+{
+    // END SNIPPET: config
+   /**
+    * The file where the JDBM data will be stored
+    * <p>
+    * Default: System.getProperty( "user.dir" ) + "/polygene/jdbmstore.data";
+    * </p>
+    * @return path to data file relative to current path
+    */
+    // START SNIPPET: config
+   @Optional
+   Property<String> file();
+
+   // JDBM RecordManager options
+
+   @UseDefaults
+   Property<Boolean> autoCommit();
+
+   @UseDefaults
+   Property<Boolean> disableTransactions();
+}
+// END SNIPPET: config

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreMixin.java b/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreMixin.java
index 312c002..9490dc5 100644
--- a/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreMixin.java
+++ b/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreMixin.java
@@ -74,7 +74,7 @@ public class JdbmEntityStoreMixin
     FileConfiguration fileConfiguration;
 
     @This
-    private Configuration<JdbmConfiguration> config;
+    private Configuration<JdbmEntityStoreConfiguration> config;
 
     @Uses
     private ServiceDescriptor descriptor;
@@ -438,7 +438,7 @@ public class JdbmEntityStoreMixin
 
     private Properties getProperties()
     {
-        JdbmConfiguration config = this.config.get();
+        JdbmEntityStoreConfiguration config = this.config.get();
 
         Properties properties = new Properties();
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreService.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreService.java b/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreService.java
index e9d9d94..1ce92a2 100644
--- a/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreService.java
+++ b/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreService.java
@@ -25,7 +25,11 @@ import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.library.locking.LockingAbstractComposite;
 import org.apache.polygene.library.locking.ReadLockConcern;
 import org.apache.polygene.library.locking.WriteLockConcern;
-import org.apache.polygene.spi.entitystore.*;
+import org.apache.polygene.spi.entitystore.BackupRestore;
+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.StateStore;
@@ -44,6 +48,6 @@ public interface JdbmEntityStoreService
             StateStore,
             BackupRestore,
             LockingAbstractComposite,
-            Configuration<JdbmConfiguration>
+            Configuration<JdbmEntityStoreConfiguration>
 {
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/assembly/JdbmEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/assembly/JdbmEntityStoreAssembler.java b/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/assembly/JdbmEntityStoreAssembler.java
index f62e792..3a223ba 100644
--- a/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/assembly/JdbmEntityStoreAssembler.java
+++ b/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/assembly/JdbmEntityStoreAssembler.java
@@ -23,7 +23,7 @@ import org.apache.polygene.bootstrap.Assemblers;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.ServiceDeclaration;
-import org.apache.polygene.entitystore.jdbm.JdbmConfiguration;
+import org.apache.polygene.entitystore.jdbm.JdbmEntityStoreConfiguration;
 import org.apache.polygene.entitystore.jdbm.JdbmEntityStoreService;
 
 public class JdbmEntityStoreAssembler
@@ -40,7 +40,7 @@ public class JdbmEntityStoreAssembler
         }
         if( hasConfig() )
         {
-            configModule().entities( JdbmConfiguration.class ).visibleIn( configVisibility() );
+            configModule().entities( JdbmEntityStoreConfiguration.class ).visibleIn( configVisibility() );
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreMixin.java b/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreMixin.java
new file mode 100644
index 0000000..35fede7
--- /dev/null
+++ b/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoDBEntityStoreMixin.java
@@ -0,0 +1,322 @@
+/*
+ *  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.mongodb;
+
+import com.mongodb.BasicDBObject;
+import com.mongodb.MongoClient;
+import com.mongodb.MongoClientOptions;
+import com.mongodb.MongoCredential;
+import com.mongodb.ServerAddress;
+import com.mongodb.WriteConcern;
+import com.mongodb.client.MongoCollection;
+import com.mongodb.client.MongoCursor;
+import com.mongodb.client.MongoDatabase;
+import com.mongodb.util.JSON;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
+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;
+import org.bson.Document;
+import org.bson.conversions.Bson;
+
+import static com.mongodb.client.model.Filters.eq;
+import static java.util.stream.Collectors.toList;
+
+/**
+ * MongoDB implementation of MapEntityStore.
+ */
+public class MongoDBEntityStoreMixin
+    implements ServiceActivation, MapEntityStore, MongoDBAccessors
+{
+    private static final String DEFAULT_DATABASE_NAME = "polygene:entitystore";
+    private static final String DEFAULT_COLLECTION_NAME = "polygene:entitystore:entities";
+    public static final String IDENTITY_COLUMN = "_id";
+    public static final String STATE_COLUMN = "state";
+    @This
+    private Configuration<MongoDBEntityStoreConfiguration> configuration;
+    private List<ServerAddress> serverAddresses;
+    private String databaseName;
+    private String collectionName;
+    private WriteConcern writeConcern;
+    private String username;
+    private char[] password;
+    private MongoClient mongo;
+    private MongoDatabase db;
+
+    @Override
+    public void activateService()
+        throws Exception
+    {
+        loadConfiguration();
+
+        // Create Mongo driver and open the database
+        MongoClientOptions options = MongoClientOptions.builder().writeConcern( writeConcern ).build();
+        if( username.isEmpty() )
+        {
+            mongo = new MongoClient( serverAddresses, options );
+        }
+        else
+        {
+            MongoCredential credential = MongoCredential.createMongoCRCredential( username, databaseName, password );
+            mongo = new MongoClient( serverAddresses, Collections.singletonList( credential ), options );
+        }
+        db = mongo.getDatabase( databaseName );
+
+        // Create index if needed
+        MongoCollection<Document> entities = db.getCollection( collectionName );
+        if( !entities.listIndexes().iterator().hasNext() )
+        {
+            entities.createIndex( new BasicDBObject( IDENTITY_COLUMN, 1 ) );
+        }
+    }
+
+    private void loadConfiguration()
+        throws UnknownHostException
+    {
+        configuration.refresh();
+        MongoDBEntityStoreConfiguration config = configuration.get();
+
+        // Combine hostname, port and nodes configuration properties
+        // If no configuration, use 127.0.0.1:27017
+        serverAddresses = new ArrayList<>();
+        int port = config.port().get() == null ? 27017 : config.port().get();
+        List<String> nodes = config.nodes().get();
+        if( nodes.isEmpty() )
+        {
+            String hostname = config.hostname().get() == null ? "127.0.0.1" : config.hostname().get();
+            serverAddresses.add( new ServerAddress( hostname, port ) );
+        }
+        else
+        {
+            if( config.hostname().get() != null && !config.hostname().get().isEmpty() )
+            {
+                serverAddresses.add( new ServerAddress( config.hostname().get(), port ) );
+            }
+            serverAddresses.addAll( nodes.stream()
+                                         .map( this::parseNode )
+                                         .collect( toList() )
+                                  );
+        }
+
+        // If database name not configured, set it to polygene:entitystore
+        databaseName = config.database().get();
+        if( databaseName == null )
+        {
+            databaseName = DEFAULT_DATABASE_NAME;
+        }
+
+        // If collection name not configured, set it to polygene:entitystore:entities
+        collectionName = config.collection().get();
+        if( collectionName == null )
+        {
+            collectionName = DEFAULT_COLLECTION_NAME;
+        }
+
+        // If write concern not configured, set it to normal
+        switch( config.writeConcern().get() )
+        {
+        case W1:
+            writeConcern = WriteConcern.W1;
+            break;
+        case W2:
+            writeConcern = WriteConcern.W2;
+            break;
+        case W3:
+            writeConcern = WriteConcern.W3;
+            break;
+        case UNACKNOWLEDGED:
+            writeConcern = WriteConcern.UNACKNOWLEDGED;
+            break;
+        case JOURNALED:
+            writeConcern = WriteConcern.JOURNALED;
+            break;
+        case MAJORITY:
+            writeConcern = WriteConcern.MAJORITY;
+            break;
+        case ACKNOWLEDGED:
+        default:
+            writeConcern = WriteConcern.ACKNOWLEDGED;
+        }
+
+        // Username and password are defaulted to empty strings
+        username = config.username().get();
+        password = config.password().get().toCharArray();
+    }
+
+    private <R> ServerAddress parseNode( String nodeString )
+    {
+        String[] parts = nodeString.split( ":" );
+        String host = parts[ 0 ];
+        if( parts.length == 2 )
+        {
+            int port = Integer.parseInt( parts[ 1 ] );
+            return new ServerAddress( host, port );
+        }
+        return new ServerAddress( host );
+    }
+
+    @Override
+    public void passivateService()
+        throws Exception
+    {
+        mongo.close();
+        mongo = null;
+        databaseName = null;
+        collectionName = null;
+        writeConcern = null;
+        username = null;
+        Arrays.fill( password, ' ' );
+        password = null;
+        db = null;
+    }
+
+    @Override
+    public MongoClient mongoInstanceUsed()
+    {
+        return mongo;
+    }
+
+    @Override
+    public MongoDatabase dbInstanceUsed()
+    {
+        return db;
+    }
+
+    @Override
+    public String collectionUsed()
+    {
+        return collectionName;
+    }
+
+    @Override
+    public Reader get( EntityReference entityReference )
+        throws EntityStoreException
+    {
+        MongoCursor<Document> cursor = db.getCollection( collectionName )
+                                         .find( byIdentity( entityReference ) )
+                                         .limit( 1 ).iterator();
+        if( !cursor.hasNext() )
+        {
+            throw new EntityNotFoundException( entityReference );
+        }
+        Document bsonState = (Document) cursor.next().get( STATE_COLUMN );
+        String jsonState = JSON.serialize( bsonState );
+        return new StringReader( jsonState );
+    }
+
+    @Override
+    public void applyChanges( MapChanges changes )
+        throws Exception
+    {
+        final MongoCollection<Document> entities = db.getCollection( collectionName );
+
+        changes.visitMap( new MapChanger()
+        {
+            @Override
+            public Writer newEntity( EntityReference ref, EntityDescriptor entityDescriptor )
+                throws IOException
+            {
+                return new StringWriter( 1000 )
+                {
+                    @Override
+                    public void close()
+                        throws IOException
+                    {
+                        super.close();
+                        Document bsonState = Document.parse( toString() );
+                        Document entity = new Document();
+                        entity.put( IDENTITY_COLUMN, ref.identity().toString() );
+                        entity.put( STATE_COLUMN, bsonState );
+                        entities.insertOne( entity );
+                    }
+                };
+            }
+
+            @Override
+            public Writer updateEntity( MapChange mapChange )
+                throws IOException
+            {
+                return new StringWriter( 1000 )
+                {
+                    @Override
+                    public void close()
+                        throws IOException
+                    {
+                        super.close();
+                        Document bsonState = Document.parse( toString() );
+                        Document entity = new Document();
+                        entity.put( IDENTITY_COLUMN, mapChange.reference().identity().toString() );
+                        entity.put( STATE_COLUMN, bsonState );
+                        entities.replaceOne( byIdentity( mapChange.reference() ), entity );
+                    }
+                };
+            }
+
+            @Override
+            public void removeEntity( EntityReference ref, EntityDescriptor entityDescriptor )
+                throws EntityNotFoundException
+            {
+                Bson byIdFilter = byIdentity( ref );
+                MongoCursor<Document> cursor = db.getCollection( collectionName )
+                                                 .find( byIdFilter )
+                                                 .limit( 1 ).iterator();
+                if( !cursor.hasNext() )
+                {
+                    throw new EntityNotFoundException( ref );
+                }
+                entities.deleteOne( byIdFilter );
+            }
+        } );
+    }
+
+    @Override
+    public Stream<Reader> entityStates()
+    {
+        return StreamSupport
+            .stream( db.getCollection( collectionName ).find().spliterator(), false )
+            .map( eachEntity ->
+                  {
+                      Document bsonState = (Document) eachEntity.get( STATE_COLUMN );
+                      String jsonState = JSON.serialize( bsonState );
+                      return new StringReader( jsonState );
+                  } );
+    }
+
+    private Bson byIdentity( EntityReference entityReference )
+    {
+        return eq( IDENTITY_COLUMN, entityReference.identity().toString() );
+    }
+}