polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [24/35] polygene-java git commit: Trying to unify the naming of all the extensions.
Date Sun, 28 May 2017 16:10:44 GMT
Trying to unify the naming of all the extensions.

Signed-off-by: niclas <niclas@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/develop
Commit: ea3f84a5c9e069856de27c6b68415a2aec103e42
Parents: 09b9280
Author: niclas <niclas@hedhman.org>
Authored: Thu May 25 14:19:44 2017 +0800
Committer: niclas <niclas@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() );
+    }
+}


Mime
View raw message