polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paulmer...@apache.org
Subject [1/2] zest-java git commit: ZEST-176 Rework Riak EntityStore for Riak 2
Date Mon, 12 Sep 2016 01:40:34 GMT
Repository: zest-java
Updated Branches:
  refs/heads/develop ea3f3a6f2 -> e6133864e


ZEST-176 Rework Riak EntityStore for Riak 2

Riak 2 Java Client only supports protocol buffer based communication, no
more HTTP. This commit replace the previous two Riak EntitStores
(protobuf & http) with a single one.

See https://github.com/basho/riak-java-client/wiki/Riak-Java-Client-2.0-Upgrade-Guide


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

Branch: refs/heads/develop
Commit: efe76702320fc4fb7fa56b3f33bf4824e5614fc4
Parents: ea3f3a6
Author: Paul Merlin <paulmerlin@apache.org>
Authored: Sun Sep 11 18:24:12 2016 -0700
Committer: Paul Merlin <paulmerlin@apache.org>
Committed: Sun Sep 11 18:36:17 2016 -0700

----------------------------------------------------------------------
 .../entitystore-riak/src/docs/es-riak.txt       |  30 +-
 .../riak/AbstractRiakMapEntityStore.java        | 235 --------------
 .../zest/entitystore/riak/RiakAccessors.java    |   4 +-
 .../riak/RiakEntityStoreConfiguration.java      | 104 ++++++
 .../riak/RiakHttpEntityStoreConfiguration.java  |  69 ----
 .../riak/RiakHttpMapEntityStoreMixin.java       |  70 -----
 .../riak/RiakMapEntityStoreMixin.java           | 313 +++++++++++++++++++
 .../RiakProtobufEntityStoreConfiguration.java   | 104 ------
 .../riak/RiakProtobufMapEntityStoreMixin.java   |  90 ------
 .../riak/assembly/RiakEntityStoreAssembler.java |  36 +++
 .../assembly/RiakHttpEntityStoreAssembler.java  |  56 ----
 .../RiakProtobufEntityStoreAssembler.java       |  56 ----
 .../riak/RiakHttpMapEntityStoreTest.java        |  83 -----
 .../riak/RiakMapEntityStoreTest.java            |  70 +++++
 .../riak/RiakMapEntityStoreWithCacheTest.java   |  26 +-
 .../riak/RiakProtobufMapEntityStoreTest.java    |  83 -----
 libraries.gradle                                |   2 +-
 tools/generator-zest/app/index.js               |   3 +-
 18 files changed, 550 insertions(+), 884 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/efe76702/extensions/entitystore-riak/src/docs/es-riak.txt
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/src/docs/es-riak.txt b/extensions/entitystore-riak/src/docs/es-riak.txt
index 6ea2dc9..cc067b5 100644
--- a/extensions/entitystore-riak/src/docs/es-riak.txt
+++ b/extensions/entitystore-riak/src/docs/es-riak.txt
@@ -27,44 +27,28 @@ source=extensions/entitystore-riak/dev-status.xml
 
 EntityStore service backed by a http://basho.com/[Riak] bucket.
 
-The EntityStore comes in two flavours: HTTP or ProtocolBuffer based. See the Riak documentation.
+The EntityStore only supports accessing Riak using protocol buffers.
+HTTP is not supported since the 2.x serie of the Riak Java client.
+See the Riak documentation.
 
 include::../../build/docs/buildinfo/artifact.txt[]
 
 == Assembly ==
 
-Assembly is done using the provided Assemblers.
-
-For HTTP based Riak client:
-
-[snippet,java]
-----
-source=extensions/entitystore-riak/src/test/java/org/apache/zest/entitystore/riak/RiakHttpMapEntityStoreTest.java
-tag=assembly
-----
-
-For ProtocolBuffer based Riak client:
+Assembly is done using the provided Assembler:
 
 [snippet,java]
 ----
-source=extensions/entitystore-riak/src/test/java/org/apache/zest/entitystore/riak/RiakProtobufMapEntityStoreTest.java
+source=extensions/entitystore-riak/src/test/java/org/apache/zest/entitystore/riak/RiakMapEntityStoreTest.java
 tag=assembly
 ----
 
 == Configuration ==
 
-Here are the configuration properties for the HTTP based Riak client:
-
-[snippet,java]
-----
-source=extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakHttpEntityStoreConfiguration.java
-tag=config
-----
-
-Here are the configuration properties for the ProtocolBuffer based Riak client:
+Here are the available configuration properties:
 
 [snippet,java]
 ----
-source=extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakProtobufEntityStoreConfiguration.java
+source=extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakEntityStoreConfiguration.java
 tag=config
 ----

http://git-wip-us.apache.org/repos/asf/zest-java/blob/efe76702/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/AbstractRiakMapEntityStore.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/AbstractRiakMapEntityStore.java b/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/AbstractRiakMapEntityStore.java
deleted file mode 100644
index 800be55..0000000
--- a/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/AbstractRiakMapEntityStore.java
+++ /dev/null
@@ -1,235 +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.zest.entitystore.riak;
-
-import com.basho.riak.client.IRiakClient;
-import com.basho.riak.client.IRiakObject;
-import com.basho.riak.client.RiakException;
-import com.basho.riak.client.RiakRetryFailedException;
-import com.basho.riak.client.bucket.Bucket;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.io.Writer;
-import org.apache.zest.api.entity.EntityDescriptor;
-import org.apache.zest.api.entity.EntityReference;
-import org.apache.zest.api.service.ServiceActivation;
-import org.apache.zest.io.Input;
-import org.apache.zest.io.Output;
-import org.apache.zest.io.Receiver;
-import org.apache.zest.io.Sender;
-import org.apache.zest.spi.entitystore.EntityNotFoundException;
-import org.apache.zest.spi.entitystore.EntityStoreException;
-import org.apache.zest.spi.entitystore.helpers.MapEntityStore;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Base Riak implementation of MapEntityStore.
- */
-/* package */ abstract class AbstractRiakMapEntityStore
-    implements ServiceActivation, MapEntityStore, RiakAccessors
-{
-
-    protected static final Logger LOGGER = LoggerFactory.getLogger( "org.apache.zest.entitystore.riak" );
-    protected static final int DEFAULT_MAX_CONNECTIONS = 50;
-
-    /* package */ static final String DEFAULT_BUCKET_KEY = "zest:entities";
-    protected IRiakClient riakClient;
-    protected String bucketKey;
-
-    @Override
-    public void passivateService()
-        throws Exception
-    {
-        riakClient.shutdown();
-        riakClient = null;
-        bucketKey = null;
-    }
-
-    @Override
-    public IRiakClient riakClient()
-    {
-        return riakClient;
-    }
-
-    @Override
-    public String bucket()
-    {
-        return bucketKey;
-    }
-
-    @Override
-    public Reader get( EntityReference entityReference )
-        throws EntityStoreException
-    {
-        try
-        {
-
-            Bucket bucket = riakClient.fetchBucket( bucketKey ).execute();
-            IRiakObject entity = bucket.fetch( entityReference.identity() ).execute();
-            if( entity == null )
-            {
-                throw new EntityNotFoundException( entityReference );
-            }
-            String jsonState = entity.getValueAsString();
-            return new StringReader( jsonState );
-
-        }
-        catch( RiakRetryFailedException ex )
-        {
-            throw new EntityStoreException( "Unable to get Entity " + entityReference.identity(), ex );
-        }
-    }
-
-    @Override
-    public void applyChanges( MapChanges changes )
-        throws IOException
-    {
-        try
-        {
-            final Bucket bucket = riakClient.fetchBucket( bucketKey ).execute();
-
-            changes.visitMap( new MapChanger()
-            {
-
-                @Override
-                public Writer newEntity( final EntityReference ref, EntityDescriptor entityDescriptor )
-                    throws IOException
-                {
-                    return new StringWriter( 1000 )
-                    {
-
-                        @Override
-                        public void close()
-                            throws IOException
-                        {
-                            try
-                            {
-                                super.close();
-                                bucket.store( ref.identity(), toString() ).execute();
-                            }
-                            catch( RiakException ex )
-                            {
-                                throw new EntityStoreException( "Unable to apply entity change: newEntity", ex );
-                            }
-                        }
-
-                    };
-                }
-
-                @Override
-                public Writer updateEntity( final EntityReference ref, EntityDescriptor entityDescriptor )
-                    throws IOException
-                {
-                    return new StringWriter( 1000 )
-                    {
-
-                        @Override
-                        public void close()
-                            throws IOException
-                        {
-                            try
-                            {
-                                super.close();
-                                IRiakObject entity = bucket.fetch( ref.identity() ).execute();
-                                if( entity == null )
-                                {
-                                    throw new EntityNotFoundException( ref );
-                                }
-                                bucket.store( ref.identity(), toString() ).execute();
-                            }
-                            catch( RiakException ex )
-                            {
-                                throw new EntityStoreException( "Unable to apply entity change: updateEntity", ex );
-                            }
-                        }
-
-                    };
-                }
-
-                @Override
-                public void removeEntity( EntityReference ref, EntityDescriptor entityDescriptor )
-                    throws EntityNotFoundException
-                {
-                    try
-                    {
-                        IRiakObject entity = bucket.fetch( ref.identity() ).execute();
-                        if( entity == null )
-                        {
-                            throw new EntityNotFoundException( ref );
-                        }
-                        bucket.delete( ref.identity() ).execute();
-                    }
-                    catch( RiakException ex )
-                    {
-                        throw new EntityStoreException( "Unable to apply entity change: removeEntity", ex );
-                    }
-                }
-
-            } );
-
-        }
-        catch( RiakRetryFailedException ex )
-        {
-            throw new EntityStoreException( "Unable to apply entity changes.", ex );
-        }
-    }
-
-    @Override
-    public Input<Reader, IOException> entityStates()
-    {
-        return new Input<Reader, IOException>()
-        {
-
-            @Override
-            public <ReceiverThrowableType extends Throwable> void transferTo( Output<? super Reader, ReceiverThrowableType> output )
-                throws IOException, ReceiverThrowableType
-            {
-                output.receiveFrom( new Sender<Reader, IOException>()
-                {
-
-                    @Override
-                    public <ReceiverThrowableType extends Throwable> void sendTo( Receiver<? super Reader, ReceiverThrowableType> receiver )
-                        throws ReceiverThrowableType, IOException
-                    {
-                        try
-                        {
-                            final Bucket bucket = riakClient.fetchBucket( bucketKey ).execute();
-                            for( String key : bucket.keys() )
-                            {
-                                String jsonState = bucket.fetch( key ).execute().getValueAsString();
-                                receiver.receive( new StringReader( jsonState ) );
-                            }
-                        }
-                        catch( RiakException ex )
-                        {
-                            throw new EntityStoreException( "Unable to apply entity changes.", ex );
-                        }
-                    }
-
-                } );
-            }
-
-        };
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/efe76702/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakAccessors.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakAccessors.java b/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakAccessors.java
index cf5e62a..47e5af3 100644
--- a/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakAccessors.java
+++ b/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakAccessors.java
@@ -19,12 +19,12 @@
  */
 package org.apache.zest.entitystore.riak;
 
-import com.basho.riak.client.IRiakClient;
+import com.basho.riak.client.api.RiakClient;
 
 public interface RiakAccessors
 {
 
-    IRiakClient riakClient();
+    RiakClient riakClient();
 
     String bucket();
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/efe76702/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakEntityStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakEntityStoreConfiguration.java b/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakEntityStoreConfiguration.java
new file mode 100644
index 0000000..febd329
--- /dev/null
+++ b/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakEntityStoreConfiguration.java
@@ -0,0 +1,104 @@
+/*
+ *  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.zest.entitystore.riak;
+
+import org.apache.zest.api.common.Optional;
+import org.apache.zest.api.common.UseDefaults;
+import org.apache.zest.api.configuration.ConfigurationComposite;
+import org.apache.zest.api.property.Property;
+
+import java.util.List;
+
+/**
+ * Configuration for RiakEntityStoreService.
+ */
+// START SNIPPET: config
+public interface RiakEntityStoreConfiguration extends ConfigurationComposite
+{
+    /**
+     * 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.
+     *
+     * Defaulted to 127.0.0.1 if empty.
+     *
+     * @return List of Riak nodes
+     */
+    @UseDefaults
+    Property<List<String>> hosts();
+
+    /**
+     * Riak Bucket where Entities state will be stored.
+     *
+     * Defaulted to "zest:entities".
+     *
+     * @return Riak bucket name
+     */
+    @UseDefaults( "zest:entities" )
+    Property<String> bucket();
+
+    /**
+     * Cluster execution attempts.
+     *
+     * @return Cluster execution attempts
+     */
+    @Optional
+    Property<Integer> clusterExecutionAttempts();
+
+    /**
+     * Minimum connections per node.
+     *
+     * @return Minimum connections per node
+     */
+    @Optional
+    Property<Integer> minConnections();
+
+    /**
+     * Maximum connections per node.
+     *
+     * @return Maximum connections per node
+     */
+    @Optional
+    Property<Integer> maxConnections();
+
+    /**
+     * Block on maximum connections.
+     *
+     * @return Block on maximum connections
+     */
+    @UseDefaults
+    Property<Boolean> blockOnMaxConnections();
+
+    /**
+     * Connection timeout.
+     *
+     * @return Connection timeout
+     */
+    @Optional
+    Property<Integer> connectionTimeout();
+
+    /**
+     * Idle timeout.
+     *
+     * @return idle timeout
+     */
+    @Optional
+    Property<Integer> idleTimeout();
+}
+// END SNIPPET: config

http://git-wip-us.apache.org/repos/asf/zest-java/blob/efe76702/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakHttpEntityStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakHttpEntityStoreConfiguration.java b/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakHttpEntityStoreConfiguration.java
deleted file mode 100644
index e2d3699..0000000
--- a/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakHttpEntityStoreConfiguration.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.zest.entitystore.riak;
-
-import java.util.List;
-import org.apache.zest.api.common.Optional;
-import org.apache.zest.api.common.UseDefaults;
-import org.apache.zest.api.configuration.ConfigurationComposite;
-import org.apache.zest.api.property.Property;
-
-/**
- * Configuration for RiakHttpEntityStoreService.
- */
-// START SNIPPET: config
-public interface RiakHttpEntityStoreConfiguration
-        extends ConfigurationComposite
-{
-
-    /**
-     * List of Riak URLs.
-     *
-     * Defaulted to http://127.0.0.1:8098/riak if empty.
-     */
-    @UseDefaults
-    Property<List<String>> urls();
-
-    /**
-     * Riak Bucket where Entities state will be stored.
-     *
-     * Defaulted to "zest:entities".
-     */
-    @Optional
-    Property<String> bucket();
-
-    /**
-     * Maximum total connections.
-     *
-     * Defaulted to 50. Use 0 for infinite number of connections.
-     */
-    @Optional
-    Property<Integer> maxConnections();
-
-    /**
-     * The connection, socket read and pooled connection acquisition timeout in milliseconds.
-     *
-     * Defaulted to 0 (infinite).
-     */
-    @UseDefaults
-    Property<Integer> timeout();
-
-}
-// END SNIPPET: config
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/efe76702/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakHttpMapEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakHttpMapEntityStoreMixin.java b/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakHttpMapEntityStoreMixin.java
deleted file mode 100644
index 041d8bb..0000000
--- a/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakHttpMapEntityStoreMixin.java
+++ /dev/null
@@ -1,70 +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.zest.entitystore.riak;
-
-import com.basho.riak.client.RiakFactory;
-import com.basho.riak.client.raw.http.HTTPClientConfig;
-import com.basho.riak.client.raw.http.HTTPClusterConfig;
-import java.util.List;
-import org.apache.zest.api.configuration.Configuration;
-import org.apache.zest.api.injection.scope.This;
-
-/**
- * Riak Http implementation of MapEntityStore.
- */
-public class RiakHttpMapEntityStoreMixin
-    extends AbstractRiakMapEntityStore
-{
-
-    private static final String DEFAULT_URL = "http://127.0.0.1:8098/riak";
-    @This
-    private Configuration<RiakHttpEntityStoreConfiguration> configuration;
-
-    @Override
-    public void activateService()
-        throws Exception
-    {
-        configuration.refresh();
-        RiakHttpEntityStoreConfiguration config = configuration.get();
-
-        int maxConnections = config.maxConnections().get() == null ? DEFAULT_MAX_CONNECTIONS : config.maxConnections().get();
-        int timeoutMillis = config.timeout().get();
-        List<String> urls = config.urls().get();
-        if( urls.isEmpty() )
-        {
-            urls.add( DEFAULT_URL );
-        }
-        bucketKey = config.bucket().get() == null ? DEFAULT_BUCKET_KEY : config.bucket().get();
-
-        HTTPClusterConfig httpClusterConfig = new HTTPClusterConfig( maxConnections );
-        for( String url : urls )
-        {
-            HTTPClientConfig clientConfig = new HTTPClientConfig.Builder().withTimeout( timeoutMillis ).withUrl( url ).build();
-            httpClusterConfig.addClient( clientConfig );
-        }
-        riakClient = RiakFactory.newClient( httpClusterConfig );
-
-        if( !riakClient.listBuckets().contains( bucketKey ) )
-        {
-            riakClient.createBucket( bucketKey ).execute();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/efe76702/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakMapEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakMapEntityStoreMixin.java b/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakMapEntityStoreMixin.java
new file mode 100644
index 0000000..5b14890
--- /dev/null
+++ b/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakMapEntityStoreMixin.java
@@ -0,0 +1,313 @@
+/*
+ *  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.zest.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 org.apache.zest.api.configuration.Configuration;
+import org.apache.zest.api.entity.EntityDescriptor;
+import org.apache.zest.api.entity.EntityReference;
+import org.apache.zest.api.injection.scope.This;
+import org.apache.zest.api.service.ServiceActivation;
+import org.apache.zest.io.Input;
+import org.apache.zest.io.Output;
+import org.apache.zest.io.Receiver;
+import org.apache.zest.io.Sender;
+import org.apache.zest.spi.entitystore.EntityNotFoundException;
+import org.apache.zest.spi.entitystore.EntityStoreException;
+import org.apache.zest.spi.entitystore.helpers.MapEntityStore;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+
+/**
+ * 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();
+        Integer clusterExecutionAttempts = config.clusterExecutionAttempts().get();
+        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();
+
+        // Setup Riak Cluster Client
+        List<HostAndPort> hostsAndPorts = parseHosts( hosts );
+        RiakNode.Builder nodeBuilder = new RiakNode.Builder();
+        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 );
+        }
+        List<RiakNode> nodes = new ArrayList<>();
+        for( HostAndPort host : hostsAndPorts )
+        {
+            nodes.add( nodeBuilder.withRemoteAddress( host ).build() );
+        }
+        RiakCluster.Builder clusterBuilder = RiakCluster.builder( nodes );
+        if( clusterExecutionAttempts != null )
+        {
+            clusterBuilder = clusterBuilder.withExecutionAttempts( clusterExecutionAttempts );
+        }
+
+        // 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() );
+    }
+
+    @Override
+    public void passivateService()
+            throws Exception
+    {
+        riakClient.shutdown();
+        riakClient = null;
+        namespace = null;
+    }
+
+    @Override
+    public RiakClient riakClient()
+    {
+        return riakClient;
+    }
+
+    @Override
+    public String bucket()
+    {
+        return namespace.getBucketNameAsString();
+    }
+
+    @Override
+    public Reader get(EntityReference entityReference )
+            throws EntityStoreException
+    {
+        try
+        {
+            Location location = new Location( namespace, entityReference.identity() );
+            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 )
+            throws IOException
+    {
+        try
+        {
+            changes.visitMap( new MapChanger()
+            {
+                @Override
+                public Writer newEntity(final EntityReference ref, EntityDescriptor entityDescriptor )
+                        throws IOException
+                {
+                    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() ) )
+                                        .build();
+                                riakClient.execute( store );
+                            }
+                            catch( InterruptedException | ExecutionException ex )
+                            {
+                                throw new EntityStoreException( "Unable to apply entity change: newEntity", ex );
+                            }
+                        }
+                    };
+                }
+
+                @Override
+                public Writer updateEntity( final EntityReference ref, EntityDescriptor entityDescriptor )
+                        throws IOException
+                {
+                    return new StringWriter( 1000 )
+                    {
+                        @Override
+                        public void close()
+                                throws IOException
+                        {
+                            try
+                            {
+                                super.close();
+                                Location location = new Location( namespace, ref.identity() );
+                                FetchValue fetch = new FetchValue.Builder( location ).build();
+                                FetchValue.Response response = riakClient.execute( fetch );
+                                if( response.isNotFound() )
+                                {
+                                    throw new EntityNotFoundException( ref );
+                                }
+                                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 )
+                        throws EntityNotFoundException
+                {
+                    try
+                    {
+                        Location location = new Location( namespace, ref.identity() );
+                        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 Input<Reader, IOException> entityStates()
+    {
+        return new Input<Reader, IOException>()
+        {
+            @Override
+            public <ReceiverThrowableType extends Throwable> void transferTo( Output<? super Reader, ReceiverThrowableType> output )
+                    throws IOException, ReceiverThrowableType
+            {
+                output.receiveFrom( new Sender<Reader, IOException>()
+                {
+                    @Override
+                    public <ReceiverThrowableType extends Throwable> void sendTo( Receiver<? super Reader, ReceiverThrowableType> receiver )
+                            throws ReceiverThrowableType, IOException
+                    {
+                        try
+                        {
+                            ListKeys listKeys = new ListKeys.Builder( namespace ).build();
+                            ListKeys.Response listKeysResponse = riakClient.execute( listKeys );
+                            for( Location location : listKeysResponse )
+                            {
+                                FetchValue fetch = new FetchValue.Builder( location ).build();
+                                FetchValue.Response response = riakClient.execute( fetch );
+                                String jsonState = response.getValue( String.class );
+                                receiver.receive( new StringReader( jsonState ) );
+                            }
+                        }
+                        catch( InterruptedException | ExecutionException ex )
+                        {
+                            throw new EntityStoreException( "Unable to apply entity changes.", 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/zest-java/blob/efe76702/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakProtobufEntityStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakProtobufEntityStoreConfiguration.java b/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakProtobufEntityStoreConfiguration.java
deleted file mode 100644
index e4f1d14..0000000
--- a/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakProtobufEntityStoreConfiguration.java
+++ /dev/null
@@ -1,104 +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.zest.entitystore.riak;
-
-import java.util.List;
-import org.apache.zest.api.common.Optional;
-import org.apache.zest.api.common.UseDefaults;
-import org.apache.zest.api.configuration.ConfigurationComposite;
-import org.apache.zest.api.property.Property;
-
-/**
- * Configuration for RiakProtobufEntityStore service.
- */
-// START SNIPPET: config
-public interface RiakProtobufEntityStoreConfiguration
-    extends ConfigurationComposite
-{
-
-    /**
-     * 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.
-     *
-     * Defaulted to 127.0.0.1 if empty.
-     */
-    @UseDefaults
-    Property<List<String>> hosts();
-
-    /**
-     * Riak Bucket where Entities state will be stored.
-     *
-     * Defaulted to "zest:entities".
-     */
-    @Optional
-    Property<String> bucket();
-
-    /**
-     * Maximum total connections.
-     *
-     * Defaulted to 50. Use 0 for infinite number of connections.
-     */
-    @Optional
-    Property<Integer> maxConnections();
-
-    /**
-     * The connection timeout in milliseconds.
-     *
-     * Defaulted to 1000.
-     */
-    @Optional
-    Property<Integer> connectionTimeout();
-
-    /**
-     * Idle connection time to live in milliseconds.
-     *
-     * Defaulted to 1000.
-     */
-    @Optional
-    Property<Integer> idleConnectionTTL();
-
-    /**
-     * Max pool size.
-     *
-     * Defaulted to 0 (unlimited).
-     */
-    @UseDefaults
-    Property<Integer> maxPoolSize();
-
-    /**
-     * Initial pool size.
-     *
-     * Defaulted to 0.
-     */
-    @UseDefaults
-    Property<Integer> initialPoolSize();
-
-    /**
-     * Socket buffer size in KB.
-     *
-     * Defaulted to 16.
-     */
-    @Optional
-    Property<Integer> socketBufferSizeKb();
-
-}
-// END SNIPPET: config
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/efe76702/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakProtobufMapEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakProtobufMapEntityStoreMixin.java b/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakProtobufMapEntityStoreMixin.java
deleted file mode 100644
index ec15eba..0000000
--- a/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakProtobufMapEntityStoreMixin.java
+++ /dev/null
@@ -1,90 +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.zest.entitystore.riak;
-
-import com.basho.riak.client.RiakFactory;
-import com.basho.riak.client.raw.pbc.PBClientConfig;
-import com.basho.riak.client.raw.pbc.PBClusterConfig;
-import java.util.List;
-import org.apache.zest.api.configuration.Configuration;
-import org.apache.zest.api.injection.scope.This;
-
-/**
- * Riak Protobuf implementation of MapEntityStore.
- */
-public class RiakProtobufMapEntityStoreMixin
-    extends AbstractRiakMapEntityStore
-{
-
-    private static final int DEFAULT_CONNECTION_TIMEOUT = 1000;
-    private static final int DEFAULT_IDLE_CONNECTION_TTL = 1000;
-    private static final int DEFAULT_SOCKET_BUFFER_SIZE_KB = 16;
-    private static final String DEFAULT_HOST = "127.0.0.1";
-    private static final int DEFAULT_PORT = 8087;
-    @This
-    private Configuration<RiakProtobufEntityStoreConfiguration> configuration;
-
-    @Override
-    public void activateService()
-        throws Exception
-    {
-        configuration.refresh();
-        RiakProtobufEntityStoreConfiguration config = configuration.get();
-
-        int maxConnections = config.maxConnections().get() == null ? DEFAULT_MAX_CONNECTIONS : config.maxConnections().get();
-        int connectionTimeout = config.connectionTimeout().get() == null ? DEFAULT_CONNECTION_TIMEOUT : config.connectionTimeout().get();
-        int idleConnectionTTL = config.idleConnectionTTL().get() == null ? DEFAULT_IDLE_CONNECTION_TTL : config.idleConnectionTTL().get();
-        int maxPoolSize = config.maxPoolSize().get();
-        int initialPoolSize = config.initialPoolSize().get();
-        int socketBufferSize = config.socketBufferSizeKb().get() == null ? DEFAULT_SOCKET_BUFFER_SIZE_KB : config.socketBufferSizeKb().get();
-        List<String> hosts = config.hosts().get();
-        if( hosts.isEmpty() )
-        {
-            hosts.add( DEFAULT_HOST );
-        }
-        bucketKey = config.bucket().get() == null ? DEFAULT_BUCKET_KEY : config.bucket().get();
-
-        PBClusterConfig pbClusterConfig = new PBClusterConfig( maxConnections );
-        for( String host : hosts )
-        {
-            String[] splitted = host.split( ":" );
-            int port = DEFAULT_PORT;
-            if( splitted.length > 1 )
-            {
-                host = splitted[0];
-                port = Integer.valueOf( splitted[1] );
-            }
-            PBClientConfig clientConfig = new PBClientConfig.Builder().withConnectionTimeoutMillis( connectionTimeout ).
-                withIdleConnectionTTLMillis( idleConnectionTTL ).
-                withPoolSize( maxPoolSize ).
-                withInitialPoolSize( initialPoolSize ).
-                withSocketBufferSizeKb( socketBufferSize ).
-                withHost( host ).withPort( port ).build();
-            pbClusterConfig.addClient( clientConfig );
-        }
-        riakClient = RiakFactory.newClient( pbClusterConfig );
-
-        if( !riakClient.listBuckets().contains( bucketKey ) )
-        {
-            riakClient.createBucket( bucketKey ).execute();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/efe76702/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/assembly/RiakEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/assembly/RiakEntityStoreAssembler.java b/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/assembly/RiakEntityStoreAssembler.java
new file mode 100644
index 0000000..10c2dd1
--- /dev/null
+++ b/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/assembly/RiakEntityStoreAssembler.java
@@ -0,0 +1,36 @@
+package org.apache.zest.entitystore.riak.assembly;
+
+import org.apache.zest.bootstrap.Assemblers;
+import org.apache.zest.bootstrap.AssemblyException;
+import org.apache.zest.bootstrap.ModuleAssembly;
+import org.apache.zest.bootstrap.ServiceDeclaration;
+import org.apache.zest.entitystore.riak.RiakEntityStoreConfiguration;
+import org.apache.zest.entitystore.riak.RiakMapEntityStoreMixin;
+import org.apache.zest.entitystore.riak.RiakMapEntityStoreService;
+import org.apache.zest.spi.uuid.UuidIdentityGeneratorService;
+
+/**
+ * Riak EntityStore assembly.
+ */
+public class RiakEntityStoreAssembler
+        extends Assemblers.VisibilityIdentityConfig<RiakEntityStoreAssembler>
+{
+    @Override
+    public void assemble(ModuleAssembly module) throws AssemblyException
+    {
+        module.services( UuidIdentityGeneratorService.class ).
+                visibleIn( visibility() );
+        ServiceDeclaration service = module.services( RiakMapEntityStoreService.class ).
+                withMixins( RiakMapEntityStoreMixin.class ).
+                visibleIn( visibility() );
+        if( hasIdentity() )
+        {
+            service.identifiedBy( identity() );
+        }
+        if( hasConfig() )
+        {
+            configModule().entities( RiakEntityStoreConfiguration.class ).
+                    visibleIn( configVisibility() );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/efe76702/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/assembly/RiakHttpEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/assembly/RiakHttpEntityStoreAssembler.java b/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/assembly/RiakHttpEntityStoreAssembler.java
deleted file mode 100644
index 2a97e88..0000000
--- a/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/assembly/RiakHttpEntityStoreAssembler.java
+++ /dev/null
@@ -1,56 +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.zest.entitystore.riak.assembly;
-
-import org.apache.zest.bootstrap.Assemblers;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.bootstrap.ServiceDeclaration;
-import org.apache.zest.entitystore.riak.RiakHttpEntityStoreConfiguration;
-import org.apache.zest.entitystore.riak.RiakHttpMapEntityStoreMixin;
-import org.apache.zest.entitystore.riak.RiakMapEntityStoreService;
-import org.apache.zest.spi.uuid.UuidIdentityGeneratorService;
-
-/**
- * Riak Http EntityStore assembly.
- */
-public class RiakHttpEntityStoreAssembler
-    extends Assemblers.VisibilityIdentityConfig<RiakHttpEntityStoreAssembler>
-{
-    @Override
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        module.services( UuidIdentityGeneratorService.class ).
-            visibleIn( visibility() );
-        ServiceDeclaration service = module.services( RiakMapEntityStoreService.class ).
-            withMixins( RiakHttpMapEntityStoreMixin.class ).
-            visibleIn( visibility() );
-        if( hasIdentity() )
-        {
-            service.identifiedBy( identity() );
-        }
-        if( hasConfig() )
-        {
-            configModule().entities( RiakHttpEntityStoreConfiguration.class ).
-                visibleIn( configVisibility() );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/efe76702/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/assembly/RiakProtobufEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/assembly/RiakProtobufEntityStoreAssembler.java b/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/assembly/RiakProtobufEntityStoreAssembler.java
deleted file mode 100644
index 8ddd6c2..0000000
--- a/extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/assembly/RiakProtobufEntityStoreAssembler.java
+++ /dev/null
@@ -1,56 +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.zest.entitystore.riak.assembly;
-
-import org.apache.zest.bootstrap.Assemblers;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.bootstrap.ServiceDeclaration;
-import org.apache.zest.entitystore.riak.RiakMapEntityStoreService;
-import org.apache.zest.entitystore.riak.RiakProtobufEntityStoreConfiguration;
-import org.apache.zest.entitystore.riak.RiakProtobufMapEntityStoreMixin;
-import org.apache.zest.spi.uuid.UuidIdentityGeneratorService;
-
-/**
- * Riak Protobuf EntityStore assembly.
- */
-public class RiakProtobufEntityStoreAssembler
-    extends Assemblers.VisibilityIdentityConfig<RiakProtobufEntityStoreAssembler>
-{
-    @Override
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        module.services( UuidIdentityGeneratorService.class ).
-            visibleIn( visibility() );
-        ServiceDeclaration service = module.services( RiakMapEntityStoreService.class ).
-            withMixins( RiakProtobufMapEntityStoreMixin.class ).
-            visibleIn( visibility() );
-        if( hasIdentity() )
-        {
-            service.identifiedBy( identity() );
-        }
-        if( hasConfig() )
-        {
-            configModule().entities( RiakProtobufEntityStoreConfiguration.class ).
-                visibleIn( configVisibility() );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/efe76702/extensions/entitystore-riak/src/test/java/org/apache/zest/entitystore/riak/RiakHttpMapEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/src/test/java/org/apache/zest/entitystore/riak/RiakHttpMapEntityStoreTest.java b/extensions/entitystore-riak/src/test/java/org/apache/zest/entitystore/riak/RiakHttpMapEntityStoreTest.java
deleted file mode 100644
index 9117173..0000000
--- a/extensions/entitystore-riak/src/test/java/org/apache/zest/entitystore/riak/RiakHttpMapEntityStoreTest.java
+++ /dev/null
@@ -1,83 +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.zest.entitystore.riak;
-
-import com.basho.riak.client.IRiakClient;
-import com.basho.riak.client.bucket.Bucket;
-import org.apache.zest.entitystore.riak.assembly.RiakHttpEntityStoreAssembler;
-import org.junit.BeforeClass;
-import org.apache.zest.api.common.Visibility;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.test.EntityTestAssembler;
-import org.apache.zest.test.entity.AbstractEntityStoreTest;
-import org.apache.zest.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
-
-import static org.apache.zest.test.util.Assume.assumeConnectivity;
-
-public class RiakHttpMapEntityStoreTest
-    extends AbstractEntityStoreTest
-{
-    @BeforeClass
-    public static void beforeRiakHttpMapEntityStoreTests()
-    {
-        assumeConnectivity( "localhost", 8087 );
-    }
-
-    @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 );
-        new OrgJsonValueSerializationAssembler().assemble( module );
-        // START SNIPPET: assembly
-        new RiakHttpEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
-    }
-    // END SNIPPET: assembly
-    private IRiakClient riakClient;
-    private String bucketKey;
-
-    @Override
-    public void setUp()
-        throws Exception
-    {
-        super.setUp();
-        RiakMapEntityStoreService es = serviceFinder.findService( RiakMapEntityStoreService.class ).get();
-        riakClient = es.riakClient();
-        bucketKey = es.bucket();
-    }
-
-    @Override
-    public void tearDown()
-        throws Exception
-    {
-        // Riak don't expose bucket deletion in its API so we empty the Zest Entities bucket.
-        Bucket bucket = riakClient.fetchBucket( bucketKey ).execute();
-        for( String key : bucket.keys() )
-        {
-            bucket.delete( key ).execute();
-        }
-        super.tearDown();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/efe76702/extensions/entitystore-riak/src/test/java/org/apache/zest/entitystore/riak/RiakMapEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/src/test/java/org/apache/zest/entitystore/riak/RiakMapEntityStoreTest.java b/extensions/entitystore-riak/src/test/java/org/apache/zest/entitystore/riak/RiakMapEntityStoreTest.java
new file mode 100644
index 0000000..078bf9e
--- /dev/null
+++ b/extensions/entitystore-riak/src/test/java/org/apache/zest/entitystore/riak/RiakMapEntityStoreTest.java
@@ -0,0 +1,70 @@
+package org.apache.zest.entitystore.riak;
+
+import com.basho.riak.client.api.RiakClient;
+import com.basho.riak.client.api.commands.kv.DeleteValue;
+import com.basho.riak.client.api.commands.kv.ListKeys;
+import com.basho.riak.client.core.query.Location;
+import com.basho.riak.client.core.query.Namespace;
+import org.apache.zest.api.common.Visibility;
+import org.apache.zest.bootstrap.AssemblyException;
+import org.apache.zest.bootstrap.ModuleAssembly;
+import org.apache.zest.entitystore.riak.assembly.RiakEntityStoreAssembler;
+import org.apache.zest.test.EntityTestAssembler;
+import org.apache.zest.test.entity.AbstractEntityStoreTest;
+import org.apache.zest.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
+import org.junit.BeforeClass;
+
+import static org.apache.zest.test.util.Assume.assumeConnectivity;
+
+public class RiakMapEntityStoreTest
+        extends AbstractEntityStoreTest
+{
+    @BeforeClass
+    public static void beforeRiakProtobufMapEntityStoreTests()
+    {
+        assumeConnectivity( "localhost", 8087 );
+    }
+    @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 );
+        new OrgJsonValueSerializationAssembler().assemble( module );
+        // START SNIPPET: assembly
+        new RiakEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
+    }
+    // END SNIPPET: assembly
+
+    private RiakClient riakClient;
+    private String bucketKey;
+
+    @Override
+    public void setUp()
+            throws Exception
+    {
+        super.setUp();
+        RiakMapEntityStoreService es = serviceFinder.findService( RiakMapEntityStoreService.class ).get();
+        riakClient = es.riakClient();
+        bucketKey = es.bucket();
+    }
+
+    @Override
+    public void tearDown()
+            throws Exception
+    {
+        // Riak don't expose bucket deletion in its API so we empty the Zest Entities bucket.
+        Namespace namespace = new Namespace( bucketKey );
+        ListKeys listKeys = new ListKeys.Builder( namespace ).build();
+        ListKeys.Response listKeysResponse = riakClient.execute( listKeys );
+        for( Location location : listKeysResponse )
+        {
+            DeleteValue delete = new DeleteValue.Builder( location ).build();
+            riakClient.execute( delete );
+        }
+        super.tearDown();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/efe76702/extensions/entitystore-riak/src/test/java/org/apache/zest/entitystore/riak/RiakMapEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/src/test/java/org/apache/zest/entitystore/riak/RiakMapEntityStoreWithCacheTest.java b/extensions/entitystore-riak/src/test/java/org/apache/zest/entitystore/riak/RiakMapEntityStoreWithCacheTest.java
index c6d3069..1ec53d8 100644
--- a/extensions/entitystore-riak/src/test/java/org/apache/zest/entitystore/riak/RiakMapEntityStoreWithCacheTest.java
+++ b/extensions/entitystore-riak/src/test/java/org/apache/zest/entitystore/riak/RiakMapEntityStoreWithCacheTest.java
@@ -19,16 +19,19 @@
  */
 package org.apache.zest.entitystore.riak;
 
-import com.basho.riak.client.IRiakClient;
-import com.basho.riak.client.bucket.Bucket;
-import org.apache.zest.entitystore.riak.assembly.RiakProtobufEntityStoreAssembler;
-import org.junit.BeforeClass;
+import com.basho.riak.client.api.RiakClient;
+import com.basho.riak.client.api.commands.kv.DeleteValue;
+import com.basho.riak.client.api.commands.kv.ListKeys;
+import com.basho.riak.client.core.query.Location;
+import com.basho.riak.client.core.query.Namespace;
 import org.apache.zest.api.common.Visibility;
 import org.apache.zest.bootstrap.AssemblyException;
 import org.apache.zest.bootstrap.ModuleAssembly;
+import org.apache.zest.entitystore.riak.assembly.RiakEntityStoreAssembler;
 import org.apache.zest.test.EntityTestAssembler;
 import org.apache.zest.test.cache.AbstractEntityStoreWithCacheTest;
 import org.apache.zest.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
+import org.junit.BeforeClass;
 
 import static org.apache.zest.test.util.Assume.assumeConnectivity;
 
@@ -36,7 +39,7 @@ public class RiakMapEntityStoreWithCacheTest
     extends AbstractEntityStoreWithCacheTest
 {
     @BeforeClass
-    public static void beforeRiakProtobufMapEntityStoreTests()
+    public static void beforeRiakMapEntityStoreTests()
     {
         assumeConnectivity( "localhost", 8087 );
     }
@@ -49,10 +52,10 @@ public class RiakMapEntityStoreWithCacheTest
         ModuleAssembly config = module.layer().module( "config" );
         new EntityTestAssembler().assemble( config );
         new OrgJsonValueSerializationAssembler().assemble( module );
-        new RiakProtobufEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
+        new RiakEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
     }
 
-    private IRiakClient riakClient;
+    private RiakClient riakClient;
     private String bucketKey;
 
     @Override
@@ -70,10 +73,13 @@ public class RiakMapEntityStoreWithCacheTest
         throws Exception
     {
         // Riak don't expose bucket deletion in its API so we empty the Zest Entities bucket.
-        Bucket bucket = riakClient.fetchBucket( bucketKey ).execute();
-        for( String key : bucket.keys() )
+        Namespace namespace = new Namespace( bucketKey );
+        ListKeys listKeys = new ListKeys.Builder( namespace ).build();
+        ListKeys.Response listKeysResponse = riakClient.execute( listKeys );
+        for( Location location : listKeysResponse )
         {
-            bucket.delete( key ).execute();
+            DeleteValue delete = new DeleteValue.Builder( location ).build();
+            riakClient.execute( delete );
         }
         super.tearDown();
     }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/efe76702/extensions/entitystore-riak/src/test/java/org/apache/zest/entitystore/riak/RiakProtobufMapEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/src/test/java/org/apache/zest/entitystore/riak/RiakProtobufMapEntityStoreTest.java b/extensions/entitystore-riak/src/test/java/org/apache/zest/entitystore/riak/RiakProtobufMapEntityStoreTest.java
deleted file mode 100644
index af88322..0000000
--- a/extensions/entitystore-riak/src/test/java/org/apache/zest/entitystore/riak/RiakProtobufMapEntityStoreTest.java
+++ /dev/null
@@ -1,83 +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.zest.entitystore.riak;
-
-import com.basho.riak.client.IRiakClient;
-import com.basho.riak.client.bucket.Bucket;
-import org.apache.zest.entitystore.riak.assembly.RiakProtobufEntityStoreAssembler;
-import org.junit.BeforeClass;
-import org.apache.zest.api.common.Visibility;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.test.EntityTestAssembler;
-import org.apache.zest.test.entity.AbstractEntityStoreTest;
-import org.apache.zest.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
-
-import static org.apache.zest.test.util.Assume.assumeConnectivity;
-
-public class RiakProtobufMapEntityStoreTest
-    extends AbstractEntityStoreTest
-{
-    @BeforeClass
-    public static void beforeRiakProtobufMapEntityStoreTests()
-    {
-        assumeConnectivity( "localhost", 8087 );
-    }
-
-    @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 );
-        new OrgJsonValueSerializationAssembler().assemble( module );
-        // START SNIPPET: assembly
-        new RiakProtobufEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
-    }
-    // END SNIPPET: assembly
-    private IRiakClient riakClient;
-    private String bucketKey;
-
-    @Override
-    public void setUp()
-        throws Exception
-    {
-        super.setUp();
-        RiakMapEntityStoreService es = serviceFinder.findService( RiakMapEntityStoreService.class ).get();
-        riakClient = es.riakClient();
-        bucketKey = es.bucket();
-    }
-
-    @Override
-    public void tearDown()
-        throws Exception
-    {
-        // Riak don't expose bucket deletion in its API so we empty the Zest Entities bucket.
-        Bucket bucket = riakClient.fetchBucket( bucketKey ).execute();
-        for( String key : bucket.keys() )
-        {
-            bucket.delete( key ).execute();
-        }
-        super.tearDown();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/efe76702/libraries.gradle
----------------------------------------------------------------------
diff --git a/libraries.gradle b/libraries.gradle
index 757236e..3f6dda7 100644
--- a/libraries.gradle
+++ b/libraries.gradle
@@ -57,7 +57,7 @@ def postgresqlVersion = '9.4.1210'
 def prefuseVersion = '1.0.1'
 def restletVersion = '2.3.7'
 def rdfVersion = '2.7.16' // 2.8.x change query results!! 4.x exists
-def riakVersion = '1.4.4' // 2.0.x Fails to compile!
+def riakVersion = '2.0.8'
 def scalaVersion = '2.11.8'
 def servletVersion = '3.1.0'
 def shiroVersion = '1.3.1'

http://git-wip-us.apache.org/repos/asf/zest-java/blob/efe76702/tools/generator-zest/app/index.js
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/index.js b/tools/generator-zest/app/index.js
index 10de705..01026bc 100644
--- a/tools/generator-zest/app/index.js
+++ b/tools/generator-zest/app/index.js
@@ -71,8 +71,7 @@ module.exports = generators.Base.extend(
                             'MongoDB',
                             'Preferences',
                             'Redis',
-                            'RiakHttp',
-                            'RiakProtobuf',
+                            'Riak',
                             'MySQL',
                             'PostgresSQL',
                             'SQLite',


Mime
View raw message