You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by pa...@apache.org on 2015/07/19 18:40:27 UTC

[1/6] zest-qi4j git commit: ZEST-104 Remove Voldemort EntityStore

Repository: zest-qi4j
Updated Branches:
  refs/heads/develop 2daf2be41 -> 3a2f6c948


ZEST-104 Remove Voldemort EntityStore


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

Branch: refs/heads/develop
Commit: 294aa1d2b9fb7197f26886a9daad177ec035f1a9
Parents: 2daf2be
Author: Paul Merlin <pa...@apache.org>
Authored: Sat Jul 18 16:43:08 2015 +0200
Committer: Paul Merlin <pa...@apache.org>
Committed: Sat Jul 18 17:31:31 2015 +0200

----------------------------------------------------------------------
 extensions/entitystore-voldemort/build.gradle   |  46 ---
 extensions/entitystore-voldemort/dev-status.xml |  35 --
 .../src/docs/es-voldemort.txt                   |  50 ---
 .../voldemort/VoldemortConfiguration.java       | 147 --------
 .../voldemort/VoldemortEntityStoreMixin.java    | 344 -------------------
 .../voldemort/VoldemortEntityStoreService.java  |  50 ---
 .../voldemort/assembly/VoldemortAssembler.java  |  48 ---
 .../entitystore/voldemort/assembly/package.html |  21 --
 .../org/qi4j/entitystore/voldemort/package.html |  21 --
 .../entitystore/voldemort/VoldemortTest.java    | 129 -------
 .../org/qi4j/entitystore/voldemort/cluster.xml  |  38 --
 .../qi4j/entitystore/voldemort/node0.properties | 207 -----------
 .../qi4j/entitystore/voldemort/node1.properties | 207 -----------
 .../org/qi4j/entitystore/voldemort/stores.xml   |  37 --
 libraries.gradle                                |  14 -
 manual/src/docs/userguide/extensions.txt        |   4 -
 settings.gradle                                 |   1 -
 17 files changed, 1399 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/294aa1d2/extensions/entitystore-voldemort/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/entitystore-voldemort/build.gradle b/extensions/entitystore-voldemort/build.gradle
deleted file mode 100644
index 385bd62..0000000
--- a/extensions/entitystore-voldemort/build.gradle
+++ /dev/null
@@ -1,46 +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.
- */
-
-description = "Apache Zest™ Voldemort EntityStore Extension"
-
-jar { manifest { name = "Apache Zest™ Extension - EntityStore - Voldemort" }}
-
-dependencies {
-
-    compile project(":org.qi4j.core:org.qi4j.core.bootstrap")
-    compile project(":org.qi4j.libraries:org.qi4j.library.locking")
-    compile libraries.voldemort
-    compile libraries.guava
-
-    testCompile project(":org.qi4j.core:org.qi4j.core.testsupport")
-    testCompile(project(":org.qi4j.extensions:org.qi4j.extension.valueserialization-orgjson"))
-
-    testRuntime project(":org.qi4j.core:org.qi4j.core.runtime")
-    testRuntime libraries.logback
-    testRuntime libraries.sleepycat
-    testRuntime libraries.log4j
-    testRuntime libraries.jdom
-    testRuntime libraries.velocity
-    testRuntime libraries.commons_codec
-    testRuntime libraries.commons_dbcp
-    testRuntime libraries.commons_io
-    testRuntime libraries.commons_lang
-
-}
-

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/294aa1d2/extensions/entitystore-voldemort/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-voldemort/dev-status.xml b/extensions/entitystore-voldemort/dev-status.xml
deleted file mode 100644
index 169068f..0000000
--- a/extensions/entitystore-voldemort/dev-status.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
-  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.
--->
-<module xmlns="http://www.qi4j.org/schemas/2008/dev-status/1"
-        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://www.qi4j.org/schemas/2008/dev-status/1
-        http://www.qi4j.org/schemas/2008/dev-status/1/dev-status.xsd">
-  <status>
-        <!--none,early,beta,stable,mature-->
-        <codebase>beta</codebase>
-
-        <!-- none, brief, good, complete -->
-        <documentation>good</documentation>
-
-        <!-- none, some, good, complete -->
-        <unittests>good</unittests>
-    </status>
-    <licenses>
-        <license>ALv2</license>
-    </licenses>
-</module>

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/294aa1d2/extensions/entitystore-voldemort/src/docs/es-voldemort.txt
----------------------------------------------------------------------
diff --git a/extensions/entitystore-voldemort/src/docs/es-voldemort.txt b/extensions/entitystore-voldemort/src/docs/es-voldemort.txt
deleted file mode 100644
index 9d6d7b3..0000000
--- a/extensions/entitystore-voldemort/src/docs/es-voldemort.txt
+++ /dev/null
@@ -1,50 +0,0 @@
-///////////////////////////////////////////////////////////////
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
-///////////////////////////////////////////////////////////////
-
-[[extension-es-voldemort, Voldemort EntityStore]]
-= Voldemort EntityStore =
-
-[devstatus]
---------------
-source=extensions/entitystore-voldemort/dev-status.xml
---------------
-
-EntityStore service backed by http://www.project-voldemort.com/voldemort/[Voldemort].
-
-include::../../build/docs/buildinfo/artifact.txt[]
-
-== Assembly ==
-
-Assembly is done using the provided Assembler.
-
-[snippet,java]
-----
-source=extensions/entitystore-voldemort/src/test/java/org/qi4j/entitystore/voldemort/VoldemortTest.java
-tag=assembly
-----
-
-== Configuration ==
-
-Most of the configuration of Voldemort is available in the Zest™ Configuration Entity.
-
-[snippet,java]
-----
-source=extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortConfiguration.java
-tag=config
-----

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/294aa1d2/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortConfiguration.java b/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortConfiguration.java
deleted file mode 100644
index a59b342..0000000
--- a/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortConfiguration.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2010 Niclas Hedhman <ni...@hedhman.org>.
- *
- * Licensed  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.qi4j.entitystore.voldemort;
-
-import java.util.List;
-import org.qi4j.api.common.Optional;
-import org.qi4j.api.configuration.ConfigurationComposite;
-import org.qi4j.api.property.Property;
-
-/**
- * The configuration entity for the Voldemort EntityStore.
- * <p>
- *     Most of these properties are used to call the corresponding setters in the
- *     {@code voldemort.client.ClientConfig} object passed to Voldemort runtime upon start.
- *     The {@code voldemort.client.ClientConfig} is instantiated by the default constructor.
- *
- * </p>
- */
-public interface VoldemortConfiguration extends ConfigurationComposite
-{
-    // START SNIPPET: config
-    @Optional
-    Property<String> storeName();
-
-    // END SNIPPET: config
-    //    @Optional
-//    Property<Integer> clientZoneId();
-//
-    // START SNIPPET: config
-    @Optional
-    Property<Integer> connectionTimeout();
-
-    /**
-     * The Bootstrap URL for Voldemort runtime to use.
-     * <p>
-     * The configuration property is optional. Default: "tcp://localhost:8581"
-     * </p>
-     * <p>
-     * This value is used to call voldemort.client.ClientConfig#setBootstrapUrls(java.util.List)
-     * </p>
-     *
-     * @return The property containing the bootstrap URL configuration.
-     */
-    @Optional
-    Property<List<String>> bootstrapUrl();
-
-    @Optional
-    Property<Boolean> enableJmx();
-
-    // END SNIPPET: config
-//    @Optional
-//    Property<Boolean> enablePipelineRoutedStore();
-
-    // START SNIPPET: config
-    @Optional
-    Property<Long> failureDetectorAsyncRecoveryInterval();
-
-    @Optional
-    Property<Long> failureDetectorBannagePeriod();
-
-    @Optional
-    Property<List<String>> failureDetectorCatastrophicErrorType();
-
-    @Optional
-    Property<String> failureDetectorImplementation();
-
-    @Optional
-    Property<Long> failureDetectoreRequestLengthThreshold();
-
-    @Optional
-    Property<Integer> failureDetectorThreshold();
-
-    @Optional
-    Property<Integer> failureDetectorThresholdCountMinimum();
-
-    @Optional
-    Property<Long> failureDetectorThreasholdInterval();
-
-    @Optional
-    Property<Integer> maxBootstrapRetries();
-
-    @Optional
-    Property<Integer> setMaxConnectionsPerNode();
-
-    @Optional
-    Property<Integer> maxQueueRequests();
-
-    @Optional
-    Property<Integer> maxThreads();
-
-    @Optional
-    Property<Integer> maxTotalConnections();
-
-    /** Voldemort has avolved the format over time, and this property sets which request format to use.
-     * See {@code voldemort.client.protocol.RequestFormatType} in Voldemort for further details.
-     *
-     * @return The configuration property that contains the request type formet used in Voldemort.
-     */
-    @Optional
-    Property<String> requestFormatType();
-
-    /** Sets the routing tier of this Voldemort runtime.
-     * <p>
-     *     Possible values are 'client' and 'server'. See {@code voldemort.client.RoutingTier} in
-     *     Voldemort for details.
-     * </p>
-     * @return the confirguration property that contains the Routing Tier setting for Voldemort.
-     */
-    @Optional
-    Property<String> routingTier();
-
-    @Optional
-    Property<Integer> routingTimeout();
-
-    // END SNIPPET: config
-//    @Optional
-//    Property<Integer> selectors();
-
-    // START SNIPPET: config
-    @Optional
-    Property<Integer> socketBufferSize();
-
-    @Optional
-    Property<Boolean> socketKeepAlive();
-
-    @Optional
-    Property<Integer> socketTimeout();
-
-    @Optional
-    Property<Integer> threadIdleTime();
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/294aa1d2/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortEntityStoreMixin.java b/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortEntityStoreMixin.java
deleted file mode 100644
index b11d161..0000000
--- a/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortEntityStoreMixin.java
+++ /dev/null
@@ -1,344 +0,0 @@
-/*  Copyright 2010 Niclas Hedhman.
- *
- * Licensed 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.qi4j.entitystore.voldemort;
-
-import java.io.*;
-import java.util.ConcurrentModificationException;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.ReadWriteLock;
-import org.qi4j.api.configuration.Configuration;
-import org.qi4j.api.entity.EntityDescriptor;
-import org.qi4j.api.entity.EntityReference;
-import org.qi4j.api.injection.scope.This;
-import org.qi4j.api.service.ServiceActivation;
-import org.qi4j.io.Input;
-import org.qi4j.io.Output;
-import org.qi4j.spi.entitystore.EntityNotFoundException;
-import org.qi4j.spi.entitystore.EntityStoreException;
-import org.qi4j.spi.entitystore.helpers.MapEntityStore;
-import voldemort.client.*;
-import voldemort.client.protocol.RequestFormatType;
-import voldemort.versioning.ObsoleteVersionException;
-import voldemort.versioning.Versioned;
-
-/**
- * JDBM implementation of SerializationStore
- */
-public class VoldemortEntityStoreMixin
-        implements ServiceActivation, MapEntityStore
-{
-   @This
-   private ReadWriteLock lock;
-
-   @This
-   private Configuration<VoldemortConfiguration> config;
-
-   private StoreClient<String, byte[]> client;
-   private StoreClientFactory factory;
-
-   @Override
-   public void activateService()
-           throws Exception
-   {
-      VoldemortConfiguration conf = config.get();
-      ClientConfig config = new ClientConfig();
-      {
-         List<String> value = conf.bootstrapUrl().get();
-         if (value != null)
-         {
-            config.setBootstrapUrls(value);
-         } else
-         {
-            config.setBootstrapUrls("tcp://localhost:8581");
-         }
-      }
-      {
-         Integer connectionTimeout = conf.connectionTimeout().get();
-         if (connectionTimeout != null)
-         {
-            config.setConnectionTimeout(connectionTimeout, TimeUnit.MILLISECONDS);
-         }
-      }
-      {
-         Boolean enable = conf.enableJmx().get();
-         if (enable != null)
-         {
-            config.setEnableJmx(enable);
-         }
-      }
-      {
-         Long recoveryInterval = conf.failureDetectorAsyncRecoveryInterval().get();
-         if (recoveryInterval != null)
-         {
-            config.setFailureDetectorAsyncRecoveryInterval(recoveryInterval);
-         }
-      }
-      {
-         Long bannagePeriod = conf.failureDetectorBannagePeriod().get();
-         if (bannagePeriod != null)
-         {
-            config.setFailureDetectorBannagePeriod(bannagePeriod);
-         }
-      }
-      {
-         List<String> failureDetectorCatastrophicErrorTypes = conf.failureDetectorCatastrophicErrorType().get();
-         if (failureDetectorCatastrophicErrorTypes != null)
-         {
-            config.setFailureDetectorCatastrophicErrorTypes(failureDetectorCatastrophicErrorTypes);
-         }
-      }
-      {
-         String failureDetectorImplementation = conf.failureDetectorImplementation().get();
-         if (failureDetectorImplementation != null)
-         {
-            config.setFailureDetectorImplementation(failureDetectorImplementation);
-         }
-      }
-      {
-         Long failureDetectorRequestLengthThreshold = conf.failureDetectoreRequestLengthThreshold().get();
-         if (failureDetectorRequestLengthThreshold != null)
-         {
-            config.setFailureDetectorRequestLengthThreshold(failureDetectorRequestLengthThreshold);
-         }
-      }
-      {
-         Integer failureDetectorThreshold = conf.failureDetectorThreshold().get();
-         if (failureDetectorThreshold != null)
-         {
-            config.setFailureDetectorThreshold(failureDetectorThreshold);
-         }
-      }
-      {
-         Integer detectorThresholdCountMinimum = conf.failureDetectorThresholdCountMinimum().get();
-         if (detectorThresholdCountMinimum != null)
-         {
-            config.setFailureDetectorThresholdCountMinimum(detectorThresholdCountMinimum);
-         }
-      }
-      {
-         Long failureDetectorThresholdInterval = conf.failureDetectorThreasholdInterval().get();
-         if (failureDetectorThresholdInterval != null)
-         {
-            config.setFailureDetectorThresholdInterval(failureDetectorThresholdInterval);
-         }
-      }
-      {
-         Integer maxBootstrapRetries = conf.maxBootstrapRetries().get();
-         if (maxBootstrapRetries != null)
-         {
-            config.setMaxBootstrapRetries(maxBootstrapRetries);
-         }
-      }
-      {
-         Integer maxConnectionsPerNode = conf.setMaxConnectionsPerNode().get();
-         if (maxConnectionsPerNode != null)
-         {
-            config.setMaxConnectionsPerNode(maxConnectionsPerNode);
-         }
-      }
-      {
-         Integer maxQueueRequests = conf.maxQueueRequests().get();
-         if (maxQueueRequests != null)
-         {
-            config.setMaxQueuedRequests(maxQueueRequests);
-         }
-      }
-      {
-         Integer maxThreads = conf.maxThreads().get();
-         if (maxThreads != null)
-         {
-            config.setMaxThreads(maxThreads);
-         }
-      }
-      {
-         Integer maxTotalConnections = conf.maxTotalConnections().get();
-         if (maxTotalConnections != null)
-         {
-            config.setMaxTotalConnections(maxTotalConnections);
-         }
-      }
-      {
-         String formatTypeCode = conf.requestFormatType().get();
-         if (formatTypeCode != null)
-         {
-            RequestFormatType formatType = RequestFormatType.fromCode(formatTypeCode);
-            config.setRequestFormatType(formatType);
-         }
-      }
-      {
-         String routingTierString = conf.routingTier().get();
-         if (routingTierString != null)
-         {
-            RoutingTier routingTier = RoutingTier.fromDisplay(routingTierString);
-            config.setRoutingTier(routingTier);
-         }
-      }
-      {
-         Integer routingTimeout = conf.routingTimeout().get();
-         if (routingTimeout != null)
-         {
-            config.setRoutingTimeout(routingTimeout, TimeUnit.MILLISECONDS);
-         }
-      }
-      {
-         Integer bufferSize = conf.socketBufferSize().get();
-         if (bufferSize != null)
-         {
-            config.setSocketBufferSize(bufferSize);
-         }
-      }
-      {
-         Boolean socketKeepAlive = conf.socketKeepAlive().get();
-         if (socketKeepAlive != null)
-         {
-            config.setSocketKeepAlive(socketKeepAlive);
-         }
-      }
-      {
-         Integer socketTimeout = conf.socketTimeout().get();
-         if (socketTimeout != null)
-         {
-            config.setSocketTimeout(socketTimeout, TimeUnit.MILLISECONDS);
-         }
-      }
-      {
-         Integer idleTime = conf.threadIdleTime().get();
-         if (idleTime != null)
-         {
-            config.setThreadIdleTime(idleTime, TimeUnit.MILLISECONDS);
-         }
-      }
-      factory = new SocketStoreClientFactory(config);
-      // create a client that executes operations on a single store
-      String storeName = conf.storeName().get();
-      if (storeName == null)
-         storeName = "qi4j-entities";
-      client = factory.getStoreClient(storeName);
-
-   }
-
-   @Override
-   public void passivateService()
-           throws Exception
-   {
-      factory.close();
-   }
-
-    @Override
-   public Reader get(EntityReference entityReference)
-           throws EntityStoreException
-   {
-      try
-      {
-         Versioned<byte[]> versioned = client.get(entityReference.identity());
-         if (versioned == null)
-         {
-            throw new EntityNotFoundException(entityReference);
-         }
-         byte[] serializedState = versioned.getValue();
-         return new StringReader(new String(serializedState, "UTF-8"));
-      } catch (IOException e)
-      {
-         throw new EntityStoreException(e);
-      }
-   }
-
-    @Override
-   public void applyChanges(MapChanges changes)
-           throws IOException
-   {
-      try
-      {
-         changes.visitMap(new MapChanger()
-         {
-            @Override
-            public Writer newEntity(final EntityReference ref, EntityDescriptor descriptor )
-                    throws IOException
-            {
-               return new StringWriter(1000)
-               {
-                  @Override
-                  public void close()
-                          throws IOException
-                  {
-                     super.close();
-                     byte[] stateArray = toString().getBytes("UTF-8");
-                     client.put(ref.identity(), stateArray);
-                  }
-               };
-            }
-
-            @Override
-            public Writer updateEntity(final EntityReference ref, EntityDescriptor descriptor)
-                    throws IOException
-            {
-               return new StringWriter(1000)
-               {
-                  @Override
-                  public void close()
-                          throws IOException
-                  {
-                     super.close();
-                     byte[] stateArray = toString().getBytes("UTF-8");
-                     try
-                     {
-                        client.put(ref.identity(), stateArray);
-                     } catch (ObsoleteVersionException e)
-                     {
-                        throw new ConcurrentModificationException(
-                                "Concurrent modification attempted for " + ref.identity());
-                     }
-                  }
-               };
-            }
-
-            @Override
-            public void removeEntity(EntityReference ref, EntityDescriptor descriptor)
-                    throws EntityNotFoundException
-            {
-               client.delete(ref.identity());
-            }
-         });
-      } catch (Exception e)
-      {
-         if (e instanceof IOException)
-         {
-            throw (IOException) e;
-         } else if (e instanceof EntityStoreException)
-         {
-            throw (EntityStoreException) e;
-         } else
-         {
-            throw new IOException( e );
-         }
-      }
-   }
-
-    @Override
-   public Input<Reader, IOException> entityStates()
-   {
-      return new Input<Reader, IOException>()
-      {
-         @Override
-         public <ReceiverThrowableType extends Throwable> void transferTo(Output<? super Reader, ReceiverThrowableType> receiverThrowableTypeOutput) throws IOException, ReceiverThrowableType
-         {
-            // TODO: Can't get hold of all entities, unless storing all the keys separately, which is enormously expensive
-         }
-      };
-   }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/294aa1d2/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortEntityStoreService.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortEntityStoreService.java b/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortEntityStoreService.java
deleted file mode 100644
index fcaff41..0000000
--- a/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortEntityStoreService.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*  Copyright 2010 Niclas Hedhman.
- *
- * Licensed 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.qi4j.entitystore.voldemort;
-
-import org.qi4j.api.concern.Concerns;
-import org.qi4j.api.configuration.Configuration;
-import org.qi4j.api.mixin.Mixins;
-import org.qi4j.api.service.ServiceActivation;
-import org.qi4j.api.service.ServiceComposite;
-import org.qi4j.library.locking.LockingAbstractComposite;
-import org.qi4j.spi.entitystore.ConcurrentModificationCheckConcern;
-import org.qi4j.spi.entitystore.EntityStateVersions;
-import org.qi4j.spi.entitystore.EntityStore;
-import org.qi4j.spi.entitystore.StateChangeNotificationConcern;
-import org.qi4j.spi.entitystore.helpers.JSONMapEntityStoreActivation;
-import org.qi4j.spi.entitystore.helpers.JSONMapEntityStoreMixin;
-import org.qi4j.spi.entitystore.helpers.StateStore;
-
-/**
- * EntityStore service backed by Voldemort.
- */
-
-@Concerns( { StateChangeNotificationConcern.class, ConcurrentModificationCheckConcern.class } )
-@Mixins( { JSONMapEntityStoreMixin.class, VoldemortEntityStoreMixin.class } )
-public interface VoldemortEntityStoreService
-    extends EntityStore,
-            EntityStateVersions,
-            StateStore,
-            ServiceComposite,
-            ServiceActivation,
-            JSONMapEntityStoreActivation,
-            LockingAbstractComposite,
-            Configuration
-
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/294aa1d2/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/assembly/VoldemortAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/assembly/VoldemortAssembler.java b/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/assembly/VoldemortAssembler.java
deleted file mode 100644
index 9efff11..0000000
--- a/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/assembly/VoldemortAssembler.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2010 Niclas Hedhman <ni...@hedhman.org>.
- *
- * Licensed  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.qi4j.entitystore.voldemort.assembly;
-
-import org.qi4j.bootstrap.Assemblers;
-import org.qi4j.bootstrap.AssemblyException;
-import org.qi4j.bootstrap.ModuleAssembly;
-import org.qi4j.bootstrap.ServiceDeclaration;
-import org.qi4j.entitystore.voldemort.VoldemortConfiguration;
-import org.qi4j.entitystore.voldemort.VoldemortEntityStoreService;
-import org.qi4j.spi.uuid.UuidIdentityGeneratorService;
-
-public class VoldemortAssembler
-    extends Assemblers.VisibilityIdentityConfig<VoldemortAssembler>
-{
-    @Override
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        module.services( UuidIdentityGeneratorService.class ).visibleIn( visibility() );
-        ServiceDeclaration service = module.services( VoldemortEntityStoreService.class ).
-            visibleIn( visibility() ).
-            instantiateOnStartup();
-        if( hasIdentity() )
-        {
-            service.identifiedBy( identity() );
-        }
-        if( hasConfig() )
-        {
-            configModule().entities( VoldemortConfiguration.class ).visibleIn( configVisibility() );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/294aa1d2/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/assembly/package.html
----------------------------------------------------------------------
diff --git a/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/assembly/package.html b/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/assembly/package.html
deleted file mode 100644
index 6c76d75..0000000
--- a/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/assembly/package.html
+++ /dev/null
@@ -1,21 +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.
--->
-<html>
-    <body>
-        <h2>Voldemort EntityStore Assembly.</h2>
-    </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/294aa1d2/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/package.html
----------------------------------------------------------------------
diff --git a/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/package.html b/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/package.html
deleted file mode 100644
index dd1a0b1..0000000
--- a/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/package.html
+++ /dev/null
@@ -1,21 +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.
--->
-<html>
-    <body>
-        <h2>Voldemort EntityStore.</h2>
-    </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/294aa1d2/extensions/entitystore-voldemort/src/test/java/org/qi4j/entitystore/voldemort/VoldemortTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-voldemort/src/test/java/org/qi4j/entitystore/voldemort/VoldemortTest.java b/extensions/entitystore-voldemort/src/test/java/org/qi4j/entitystore/voldemort/VoldemortTest.java
deleted file mode 100644
index 05eaa6b..0000000
--- a/extensions/entitystore-voldemort/src/test/java/org/qi4j/entitystore/voldemort/VoldemortTest.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (c) 2010 Niclas Hedhman <ni...@hedhman.org>.
- *
- * Licensed  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.qi4j.entitystore.voldemort;
-
-import org.junit.Ignore;
-import org.qi4j.api.common.Visibility;
-import org.qi4j.bootstrap.AssemblyException;
-import org.qi4j.bootstrap.ModuleAssembly;
-import org.qi4j.entitystore.voldemort.assembly.VoldemortAssembler;
-import org.qi4j.test.entity.AbstractEntityStoreTest;
-import voldemort.server.VoldemortConfig;
-import voldemort.server.VoldemortServer;
-
-import java.io.*;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-import java.util.Random;
-import org.qi4j.test.EntityTestAssembler;
-import org.qi4j.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
-
-@Ignore( "This version of Voldemort is still using Jetty 6. If we can not upgrade, we should drop support for this ES." )
-public class VoldemortTest
-    extends AbstractEntityStoreTest
-{
-
-    private List<VoldemortServer> servers = new ArrayList<VoldemortServer>();
-
-    @Override
-    public void setUp()
-        throws Exception
-    {
-        Thread.sleep( 200 );
-        File voldemortHome1 = setupVoldemortHome();
-        startServer( voldemortHome1, "node0.properties" );
-        File voldemortHome2 = setupVoldemortHome();
-        startServer( voldemortHome2, "node1.properties" );
-        super.setUp();
-    }
-
-    @Override
-    public void tearDown()
-        throws Exception
-    {
-        super.tearDown();
-        for( VoldemortServer server : servers )
-        {
-            server.stop();
-        }
-    }
-
-    // START SNIPPET: assembly
-    @Override
-    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 VoldemortAssembler().
-            visibleIn( Visibility.layer ).
-            withConfig( config, Visibility.layer ).
-            assemble( module );
-        // END SNIPPET: assembly
-    }
-
-    private File setupVoldemortHome()
-        throws IOException
-    {
-        File tmp = File.createTempFile( "qi4j", "" );
-        File dir = tmp.getParentFile();
-        File voldemortHome = new File( dir, "qi4j-voldemort" + new Random().nextInt( 10000 ) );
-        boolean created = voldemortHome.mkdir();
-        File configDir = new File( voldemortHome, "config" );
-        created = configDir.mkdir();
-        copyFile( "cluster.xml", configDir );
-        copyFile( "stores.xml", configDir );
-        return voldemortHome;
-    }
-
-    private void startServer( File voldemortHome, String serverProps )
-        throws IOException
-    {
-        Properties props = new Properties();
-        InputStream in = getClass().getResourceAsStream( serverProps );
-        props.load( in );
-        props.setProperty( "voldemort.home", voldemortHome.getCanonicalPath() );
-        VoldemortConfig config = new VoldemortConfig( props );
-        config.setEnableJmx( false );
-        VoldemortServer server = new VoldemortServer( config );
-        server.start();
-        this.servers.add( server );
-    }
-
-    private void copyFile( String source, File voldemortHome )
-        throws IOException
-    {
-        InputStream in = getClass().getResourceAsStream( source );
-        FileOutputStream out = new FileOutputStream( new File( voldemortHome, source ) );
-        BufferedOutputStream stream = new BufferedOutputStream( out );
-        int data = in.read();
-        while( data != -1 )
-        {
-            stream.write( data );
-            data = in.read();
-        }
-        in.close();
-        stream.close();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/294aa1d2/extensions/entitystore-voldemort/src/test/resources/org/qi4j/entitystore/voldemort/cluster.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-voldemort/src/test/resources/org/qi4j/entitystore/voldemort/cluster.xml b/extensions/entitystore-voldemort/src/test/resources/org/qi4j/entitystore/voldemort/cluster.xml
deleted file mode 100644
index cafc886..0000000
--- a/extensions/entitystore-voldemort/src/test/resources/org/qi4j/entitystore/voldemort/cluster.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<!--
-  ~ Copyright (c) 2010 Niclas Hedhman <ni...@hedhman.org>.
-  ~
-  ~ Licensed  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.
-  -->
-
-<cluster>
-    <!-- The name is just to help users identify this cluster from the gui -->
-    <name>qi4j-test-cluster</name>
-    <server>
-        <!-- The node id is a unique, sequential id beginning with 0 that identifies each server in the cluster-->
-        <id>0</id>
-        <host>localhost</host>
-        <http-port>8481</http-port>
-        <socket-port>8581</socket-port>
-        <!-- A list of data partitions assigned to this server -->
-        <partitions>0,1,2,3</partitions>
-    </server>
-    <server>
-        <id>1</id>
-        <host>localhost</host>
-        <http-port>8681</http-port>
-        <socket-port>8781</socket-port>
-        <partitions>4,5,6,7</partitions>
-    </server>
-</cluster>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/294aa1d2/extensions/entitystore-voldemort/src/test/resources/org/qi4j/entitystore/voldemort/node0.properties
----------------------------------------------------------------------
diff --git a/extensions/entitystore-voldemort/src/test/resources/org/qi4j/entitystore/voldemort/node0.properties b/extensions/entitystore-voldemort/src/test/resources/org/qi4j/entitystore/voldemort/node0.properties
deleted file mode 100644
index f2b3a3b..0000000
--- a/extensions/entitystore-voldemort/src/test/resources/org/qi4j/entitystore/voldemort/node0.properties
+++ /dev/null
@@ -1,207 +0,0 @@
-#
-# Copyright (c) 2010 Niclas Hedhman <ni...@hedhman.org>.
-#
-# Licensed  under the  Apache License,  Version 2.0  (the "License");
-# you may not use  this file  except in  compliance with the License.
-# You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed  under the  License is distributed on an "AS IS" BASIS,
-# WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
-# implied.
-#
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-#  The unique, sequential identifier for this server in the cluster (starts with 0)
-#  default: none, must be specfified
-node.id=0
-
-# The base directory for voldemort. Can also be specified via the environment variable VOLDEMORT_HOME or
-# via a command line option.
-# default: none	
-# voldemort.home=
-
-# The directory where voldemort data is stored
-# default: ${voldemort.home}/data
-# data.directory=
-
-
-# The directory where voldemort configuration is stored
-# default: ${voldemort.home}/config
-# metadata.directory=
-
-# Should the BDB engine be enabled?
-# default: true
-# enable.bdb.engine=
-
-
-# The BDB cache that is shared by all BDB tables. Bigger is better.
-# default: 200MB (make it bigger!!!)
-bdb.cache.size=50000000
-
-
-# Should transactions be immediately written to disk?
-# default: false
-# bdb.write.transactions=
-
-# When the transaction has been written to disk should we force the disk to flush the OS cache. This is a fairly expensive operation.
-# default: false
-# bdb.flush.transactions=
-
-
-# The directory where the BDB environment is located
-# default: ${data.directory}/bdb
-# bdb.data.directory=
-
-
-# The size of an individual log file
-# default: 1GB
-# bdb.max.logfile.size=
-
-
-# The fanout size for the btree. Bigger fanout more effienciently supports larger btrees.
-# default: 512
-# bdb.btree.fanout=
-
-
-# How often (in bytes) should we checkpoint the transaction log? Checkpoints make startup and shutdown faster.
-# default: 20 * 1024 * 1024
-# bdb.checkpoint.interval.bytes=
-
-
-# How often in ms should we checkpoint the transaction log
-# default: 30000
-# bdb.checkpoint.interval.ms=
-
-
-# Should we enabled the mysql storage engine? Doing so will create a connection pool that will be used for the mysql instance
-# default: false
-# enable.mysql.engine=
-
-
-# The mysql username to user
-# default: root
-# mysql.user=
-
-
-# The mysql password to user
-# mysql.password=
-
-
-# The host of the mysql instance
-# default: localhost
-# mysql.host=
-
-
-# The port of the mysql instance
-# default: 3306
-# mysql.port=
-
-
-# The name of the mysql database
-# default: voldemort
-# mysql.database=
-
-
-#Should we enable the memory storage engine? Might as well this takes no resources and is just here for consistency.
-# default: true
-# enable.memory.engine=
-
-
-# Should we enable the cache storage engine? Might as well this takes no resources and is just here for consistency.
-# default: true
-# enable.cache.engine=
-
-
-# Should we enable the readonly storage engine?
-# default: false
-# enable.readonly.engine=
-
-
-# The maximum time to wait to acquire a filehandle to perform reads.
-# default: 4000
-# readonly.file.wait.timeout.ms=
-
-
-# The number of backup copies of the data to keep around for rollback.
-# default: 1
-# readonly.backups=
-
-
-# The number of file descriptors to pool per store.
-# default: 5
-# readonly.file.handles=
-
-
-# The directory in which to store readonly data files.
-# default: ${data.directory}/read-only
-# readonly.data.directory=
-
-
-# What storage engine should we use for storing misdelivered messages that need to be rerouted?
-# default: bdb
-# slop.store.engine=
-
-
-# The maximum number of threads the server can use.
-# default: 100
-# max.threads=
-
-
-# The number of threads to keep alive even when idle.
-# default: max(1, ${max.threads} / 2)
-# core.threads=
-
-
-# The socket SO_TIMEOUT. Essentially the amount of time to block on a low-level network operation before throwing an error.
-# default: 4000
-# socket.timeout.ms=
-
-
-# The total amount of time to wait for adequate responses from all nodes before throwing an error.
-# default: 5000
-# routing.timeout.ms=
-
-
-# Enable the HTTP data server?
-# default: true
-# http.enable=
-
-
-# Enable the socket data server?
-# default: true
-# socket.enable=
-
-
-# Enable JMX monitoring?
-# default: true
-# jmx.enable=
-
-
-# Enable detection of misdelivered messages for persistence and redelivery.
-# default: false
-# slop.detection.enable=
-
-
-# Log every operation on all stores.
-# default: true
-# enable.verbose.logging=
-
-
-# Track load statistics on the stores.
-# default: true
-# enable.stat.tracking=
-
-
-# How often should misdelivered "slop" data be pushed out to nodes?
-# default: 2 * 60 * 1000
-# pusher.poll.ms=
-
-
-# The number of threads to use for scheduling periodic jobs
-# default: 3
-# scheduler.threads=

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/294aa1d2/extensions/entitystore-voldemort/src/test/resources/org/qi4j/entitystore/voldemort/node1.properties
----------------------------------------------------------------------
diff --git a/extensions/entitystore-voldemort/src/test/resources/org/qi4j/entitystore/voldemort/node1.properties b/extensions/entitystore-voldemort/src/test/resources/org/qi4j/entitystore/voldemort/node1.properties
deleted file mode 100644
index a2081dd..0000000
--- a/extensions/entitystore-voldemort/src/test/resources/org/qi4j/entitystore/voldemort/node1.properties
+++ /dev/null
@@ -1,207 +0,0 @@
-#
-# Copyright (c) 2010 Niclas Hedhman <ni...@hedhman.org>.
-#
-# Licensed  under the  Apache License,  Version 2.0  (the "License");
-# you may not use  this file  except in  compliance with the License.
-# You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed  under the  License is distributed on an "AS IS" BASIS,
-# WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
-# implied.
-#
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-#  The unique, sequential identifier for this server in the cluster (starts with 0)
-#  default: none, must be specfified
-node.id=1
-
-# The base directory for voldemort. Can also be specified via the environment variable VOLDEMORT_HOME or
-# via a command line option.
-# default: none
-# voldemort.home=
-
-# The directory where voldemort data is stored
-# default: ${voldemort.home}/data
-# data.directory=
-
-
-# The directory where voldemort configuration is stored
-# default: ${voldemort.home}/config
-# metadata.directory=
-
-# Should the BDB engine be enabled?
-# default: true
-# enable.bdb.engine=
-
-
-# The BDB cache that is shared by all BDB tables. Bigger is better.
-# default: 200MB (make it bigger!!!)
-bdb.cache.size=50000000
-
-
-# Should transactions be immediately written to disk?
-# default: false
-# bdb.write.transactions=
-
-# When the transaction has been written to disk should we force the disk to flush the OS cache. This is a fairly expensive operation.
-# default: false
-# bdb.flush.transactions=
-
-
-# The directory where the BDB environment is located
-# default: ${data.directory}/bdb
-# bdb.data.directory=
-
-
-# The size of an individual log file
-# default: 1GB
-# bdb.max.logfile.size=
-
-
-# The fanout size for the btree. Bigger fanout more effienciently supports larger btrees.
-# default: 512
-# bdb.btree.fanout=
-
-
-# How often (in bytes) should we checkpoint the transaction log? Checkpoints make startup and shutdown faster.
-# default: 20 * 1024 * 1024
-# bdb.checkpoint.interval.bytes=
-
-
-# How often in ms should we checkpoint the transaction log
-# default: 30000
-# bdb.checkpoint.interval.ms=
-
-
-# Should we enabled the mysql storage engine? Doing so will create a connection pool that will be used for the mysql instance
-# default: false
-# enable.mysql.engine=
-
-
-# The mysql username to user
-# default: root
-# mysql.user=
-
-
-# The mysql password to user
-# mysql.password=
-
-
-# The host of the mysql instance
-# default: localhost
-# mysql.host=
-
-
-# The port of the mysql instance
-# default: 3306
-# mysql.port=
-
-
-# The name of the mysql database
-# default: voldemort
-# mysql.database=
-
-
-#Should we enable the memory storage engine? Might as well this takes no resources and is just here for consistency.
-# default: true
-# enable.memory.engine=
-
-
-# Should we enable the cache storage engine? Might as well this takes no resources and is just here for consistency.
-# default: true
-# enable.cache.engine=
-
-
-# Should we enable the readonly storage engine?
-# default: false
-# enable.readonly.engine=
-
-
-# The maximum time to wait to acquire a filehandle to perform reads.
-# default: 4000
-# readonly.file.wait.timeout.ms=
-
-
-# The number of backup copies of the data to keep around for rollback.
-# default: 1
-# readonly.backups=
-
-
-# The number of file descriptors to pool per store.
-# default: 5
-# readonly.file.handles=
-
-
-# The directory in which to store readonly data files.
-# default: ${data.directory}/read-only
-# readonly.data.directory=
-
-
-# What storage engine should we use for storing misdelivered messages that need to be rerouted?
-# default: bdb
-# slop.store.engine=
-
-
-# The maximum number of threads the server can use.
-# default: 100
-# max.threads=
-
-
-# The number of threads to keep alive even when idle.
-# default: max(1, ${max.threads} / 2)
-# core.threads=
-
-
-# The socket SO_TIMEOUT. Essentially the amount of time to block on a low-level network operation before throwing an error.
-# default: 4000
-# socket.timeout.ms=
-
-
-# The total amount of time to wait for adequate responses from all nodes before throwing an error.
-# default: 5000
-# routing.timeout.ms=
-
-
-# Enable the HTTP data server?
-# default: true
-# http.enable=
-
-
-# Enable the socket data server?
-# default: true
-# socket.enable=
-
-
-# Enable JMX monitoring?
-# default: true
-# jmx.enable=
-
-
-# Enable detection of misdelivered messages for persistence and redelivery.
-# default: false
-# slop.detection.enable=
-
-
-# Log every operation on all stores.
-# default: true
-# enable.verbose.logging=
-
-
-# Track load statistics on the stores.
-# default: true
-# enable.stat.tracking=
-
-
-# How often should misdelivered "slop" data be pushed out to nodes?
-# default: 2 * 60 * 1000
-# pusher.poll.ms=
-
-
-# The number of threads to use for scheduling periodic jobs
-# default: 3
-# scheduler.threads=

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/294aa1d2/extensions/entitystore-voldemort/src/test/resources/org/qi4j/entitystore/voldemort/stores.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-voldemort/src/test/resources/org/qi4j/entitystore/voldemort/stores.xml b/extensions/entitystore-voldemort/src/test/resources/org/qi4j/entitystore/voldemort/stores.xml
deleted file mode 100644
index a401733..0000000
--- a/extensions/entitystore-voldemort/src/test/resources/org/qi4j/entitystore/voldemort/stores.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<!--
-  ~ Copyright (c) 2010 Niclas Hedhman <ni...@hedhman.org>.
-  ~
-  ~ Licensed  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.
-  -->
-
-<stores>
-    <store>
-        <name>qi4j-entities</name>
-        <replication-factor>1</replication-factor>
-        <preferred-reads>1</preferred-reads>
-        <required-reads>1</required-reads>
-        <preferred-writes>1</preferred-writes>
-        <required-writes>1</required-writes>
-        <persistence>bdb</persistence>
-        <routing>client</routing>
-        <key-serializer>
-            <type>string</type>
-            <schema-info>utf8</schema-info>
-        </key-serializer>
-        <value-serializer>
-            <type>identity</type>
-        </value-serializer>
-    </store>
-</stores>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/294aa1d2/libraries.gradle
----------------------------------------------------------------------
diff --git a/libraries.gradle b/libraries.gradle
index 86ad6e4..100213a 100644
--- a/libraries.gradle
+++ b/libraries.gradle
@@ -21,9 +21,7 @@
 def asmVersion = '5.0.4'
 def bonecpVersion = '0.8.0.RELEASE'
 def bouncyVersion = '1.52'
-def commonsCodecVersion = '1.10'
 def commonsDbcpVersion = '1.4' // Should be moved to commons-dbcp2
-def commonsIoVersion = '2.4'
 def commonsLangVersion = '2.6' // Should be moved to commons-lang3
 def derbyVersion = '10.11.1.1'
 def dnsJavaVersion = '2.1.7'
@@ -31,7 +29,6 @@ def ehcacheVersion = '2.10.0'
 def elasticsearchVersion = '1.6.0'
 def freemarkerVersion = '2.3.22'
 def groovyVersion = '2.4.3'
-def guavaVersion = '18.0'
 def h2Version = '1.4.187'
 def hazelcastVersion = '3.5'
 def httpClientVersion = '4.2.2' // 4.3.4 exists
@@ -40,7 +37,6 @@ def javascriptVersion = '1.7.7'
 def javasqlgeneratorVersion = '0.3.2'
 def jcloudsVersion = '1.9.0'
 def jdbmVersion = '2.4'
-def jdomVersion = '2.0.2'
 def jedisVersion = '2.7.2'
 def jettyVersion = '9.2.11.v20150529' // 9.3.x Tests fail!
 def jgoodiesLooksVersion = '2.5.3'
@@ -50,7 +46,6 @@ def jtaVersion = '1.1'
 def leveldbVersion = '0.7'
 def leveldbJniVersion = '1.8'
 def liquibaseVersion = '3.4.0'
-def log4jVersion = '1.2.17'
 def logbackVersion = '1.1.3'
 def mongodbVersion = '2.13.2' // 3.0.x Fails to compile!
 def mysqlVersion = '5.1.35'
@@ -66,14 +61,12 @@ def scalaVersion = '2.11.6'
 def servletVersion = '3.1.0'
 def shiroVersion = '1.2.3'
 def skedVersion = '2.1'
-def sleepycatVersion = '5.0.73'
 def slf4jVersion = '1.7.12'
 def solrVersion = "1.4.1" // 4.8.1 Fails to compile!
 def springVersion = '4.1.7.RELEASE'
 def spymemcachedVersion = '2.12.0'
 def sqliteVersion = '3.8.10.1'
 def velocityVersion = '1.7'
-def voldemortVersion = '1.3.0'
 def wicketVersion = '1.5.8' // 6.15.0 Samples fails to compile!
 def wicketStatelessVersion = '1.5.0'
 def woodstoxVersion = '4.4.1'
@@ -111,7 +104,6 @@ rootProject.ext {
           // logging
           slf4j_api: "org.slf4j:slf4j-api:$slf4jVersion",
           slf4j_simple: "org.slf4j:slf4j-simple:$slf4jVersion",
-          log4j: 'log4j:log4j:' + log4jVersion,
           logback: 'ch.qos.logback:logback-classic:' + logbackVersion,
           jcl_slf4j: "org.slf4j:jcl-over-slf4j:$slf4jVersion",
           jcl_api: 'commons-logging:commons-logging-api:99.0-does-not-exist',  //ensure it is never used.
@@ -218,14 +210,8 @@ rootProject.ext {
           jta: "javax.transaction:jta:$jtaVersion",
           javaSqlGenerator: "org.java-sql-generator:org.java-sql-generator.api:$javasqlgeneratorVersion",
           javaSqlGeneratorImpl: "org.java-sql-generator:org.java-sql-generator.implementation:$javasqlgeneratorVersion",
-          voldemort: "org.immunogenomics.gl.voldemort:voldemort:$voldemortVersion",
-          guava: "com.google.guava:guava:$guavaVersion",
-          sleepycat: "com.sleepycat:je:$sleepycatVersion",
-          jdom: "org.jdom:jdom:$jdomVersion",
           velocity: "org.apache.velocity:velocity:$velocityVersion",
-          commons_codec: "commons-codec:commons-codec:$commonsCodecVersion",
           commons_dbcp: "commons-dbcp:commons-dbcp:$commonsDbcpVersion",
-          commons_io: "commons-io:commons-io:$commonsIoVersion",
           commons_lang: "commons-lang:commons-lang:$commonsLangVersion",
           servlet_api: "javax.servlet:javax.servlet-api:$servletVersion",
           http_client: "org.apache.httpcomponents:httpclient:$httpClientVersion",

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/294aa1d2/manual/src/docs/userguide/extensions.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/userguide/extensions.txt b/manual/src/docs/userguide/extensions.txt
index 7866ff5..511578f 100644
--- a/manual/src/docs/userguide/extensions.txt
+++ b/manual/src/docs/userguide/extensions.txt
@@ -109,10 +109,6 @@ include::../../../../extensions/entitystore-sql/src/docs/es-sql.txt[]
 
 :leveloffset: 2
 
-include::../../../../extensions/entitystore-voldemort/src/docs/es-voldemort.txt[]
-
-:leveloffset: 2
-
 include::../../../../extensions/indexing-elasticsearch/src/docs/index-elasticsearch.txt[]
 
 :leveloffset: 2

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/294aa1d2/settings.gradle
----------------------------------------------------------------------
diff --git a/settings.gradle b/settings.gradle
index da84170..a66fd66 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -72,7 +72,6 @@ include 'core:functional',
         'extensions:entitystore-redis',
         'extensions:entitystore-riak',
         'extensions:entitystore-sql',
-        'extensions:entitystore-voldemort',
         'extensions:indexing-elasticsearch',
         'extensions:indexing-rdf',
         'extensions:indexing-solr',


[5/6] zest-qi4j git commit: Merge Tibor Mlynarik work on EventSourcing documentation from Github pull-request

Posted by pa...@apache.org.
Merge Tibor Mlynarik work on EventSourcing documentation from Github pull-request

See https://github.com/apache/zest-qi4j/pull/1


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

Branch: refs/heads/develop
Commit: 80c2895448866a191f3f21e8c92eb5513465b704
Parents: 294aa1d 6c0e59f
Author: Paul Merlin <pa...@apache.org>
Authored: Sun Jul 19 18:04:41 2015 +0200
Committer: Paul Merlin <pa...@apache.org>
Committed: Sun Jul 19 18:04:41 2015 +0200

----------------------------------------------------------------------
 .../src/docs/eventsourcing-jdbm.txt             |  31 ---
 .../src/docs/eventsourcing-rest.txt             |  32 ---
 .../eventsourcing/src/docs/eventsourcing.txt    | 104 +++++++++-
 .../factory/ApplicationEventFactoryService.java |   6 +-
 .../MemoryApplicationEventStoreService.java     | 132 ++++++++++++
 .../bootstrap/EventsourcingAssembler.java       |  68 ++++++
 .../application/ApplicationEventTest.java       | 206 +++++++++++++++++++
 .../eventsourcing/domain/DomainEventTest.java   |  18 +-
 8 files changed, 525 insertions(+), 72 deletions(-)
----------------------------------------------------------------------



[2/6] zest-qi4j git commit: eventsourcing: added assembly; bad concern fix; application events test

Posted by pa...@apache.org.
eventsourcing: added assembly; bad concern fix; application events test


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

Branch: refs/heads/develop
Commit: ae8b4700bec8960def18a45864ad75e3b8ff434f
Parents: 2daf2be
Author: tbml <ti...@adleritech.com>
Authored: Sun Jul 19 06:38:37 2015 +0200
Committer: tbml <ti...@adleritech.com>
Committed: Sun Jul 19 06:38:37 2015 +0200

----------------------------------------------------------------------
 .../factory/ApplicationEventFactoryService.java |   6 +-
 .../MemoryApplicationEventStoreService.java     | 124 ++++++++++++
 .../bootstrap/EventsourcingAssembler.java       |  60 ++++++
 .../application/ApplicationEventTest.java       | 188 +++++++++++++++++++
 .../eventsourcing/domain/DomainEventTest.java   |  18 +-
 5 files changed, 389 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/ae8b4700/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/factory/ApplicationEventFactoryService.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/factory/ApplicationEventFactoryService.java b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/factory/ApplicationEventFactoryService.java
index 675f6ba..e5c4e4f 100644
--- a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/factory/ApplicationEventFactoryService.java
+++ b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/factory/ApplicationEventFactoryService.java
@@ -16,7 +16,6 @@
 
 package org.qi4j.library.eventsourcing.application.factory;
 
-import java.util.Date;
 import org.json.JSONException;
 import org.json.JSONObject;
 import org.json.JSONStringer;
@@ -33,13 +32,14 @@ import org.qi4j.api.unitofwork.UnitOfWorkFactory;
 import org.qi4j.api.value.ValueBuilder;
 import org.qi4j.api.value.ValueBuilderFactory;
 import org.qi4j.library.eventsourcing.application.api.ApplicationEvent;
-import org.qi4j.library.eventsourcing.domain.factory.UnitOfWorkNotificationConcern;
 import org.qi4j.library.eventsourcing.domain.spi.CurrentUser;
 
+import java.util.Date;
+
 /**
  * DomainEventValue factory
  */
-@Concerns(UnitOfWorkNotificationConcern.class)
+@Concerns(TransactionNotificationConcern.class)
 @Mixins(ApplicationEventFactoryService.Mixin.class)
 public interface ApplicationEventFactoryService
         extends ApplicationEventFactory, ServiceComposite

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/ae8b4700/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/source/memory/MemoryApplicationEventStoreService.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/source/memory/MemoryApplicationEventStoreService.java b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/source/memory/MemoryApplicationEventStoreService.java
new file mode 100644
index 0000000..df24e7a
--- /dev/null
+++ b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/source/memory/MemoryApplicationEventStoreService.java
@@ -0,0 +1,124 @@
+package org.qi4j.library.eventsourcing.application.source.memory;
+
+import org.qi4j.api.activation.Activators;
+import org.qi4j.api.mixin.Mixins;
+import org.qi4j.api.service.ServiceComposite;
+import org.qi4j.io.Input;
+import org.qi4j.io.Output;
+import org.qi4j.io.Receiver;
+import org.qi4j.io.Sender;
+import org.qi4j.library.eventsourcing.application.api.TransactionApplicationEvents;
+import org.qi4j.library.eventsourcing.application.source.*;
+import org.qi4j.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
+
+import java.io.IOException;
+import java.util.*;
+
+
+/**
+ * In-Memory ApplicationEventStore. Mainly used for testing.
+ */
+@Mixins(MemoryApplicationEventStoreService.MemoryStoreMixin.class)
+@Activators( ApplicationEventStoreActivation.Activator.class )
+public interface MemoryApplicationEventStoreService
+        extends ApplicationEventSource, ApplicationEventStore, ApplicationEventStream, ApplicationEventStoreActivation, ServiceComposite {
+
+    abstract class MemoryStoreMixin
+            extends AbstractApplicationEventStoreMixin
+            implements ApplicationEventSource, ApplicationEventStoreActivation
+    {
+
+        // This list holds all transactions
+        private LinkedList<TransactionApplicationEvents> store = new LinkedList<TransactionApplicationEvents>();
+
+        @Override
+        public Input<TransactionApplicationEvents, IOException> transactionsAfter(final long afterTimestamp, final long maxTransactions) {
+            return new Input<TransactionApplicationEvents, IOException>()
+            {
+                @Override
+                public <ReceiverThrowableType extends Throwable> void transferTo( Output<? super TransactionApplicationEvents, ReceiverThrowableType> output ) throws IOException, ReceiverThrowableType
+                {
+                    // Lock store first
+                    lock.lock();
+                    try
+                    {
+                        output.receiveFrom( new Sender<TransactionApplicationEvents, IOException>()
+                        {
+                            @Override
+                            public <ReceiverThrowableType extends Throwable> void sendTo( Receiver<? super TransactionApplicationEvents, ReceiverThrowableType> receiver ) throws ReceiverThrowableType, IOException
+                            {
+                                Iterator<TransactionApplicationEvents> iterator = store.iterator();
+
+                                long count = 0;
+
+                                while( iterator.hasNext() && count < maxTransactions )
+                                {
+                                    TransactionApplicationEvents next = iterator.next();
+                                    if( next.timestamp().get() > afterTimestamp) {
+                                        receiver.receive(next);
+                                        count++;
+                                    }
+                                }
+                            }
+                        } );
+                    } finally
+                    {
+                        lock.unlock();
+                    }
+                }
+            };
+
+        }
+
+        @Override
+        public Input<TransactionApplicationEvents, IOException> transactionsBefore(final long beforeTimestamp, final long maxTransactions) {
+            return new Input<TransactionApplicationEvents, IOException>()
+            {
+                @Override
+                public <ReceiverThrowableType extends Throwable> void transferTo( Output<? super TransactionApplicationEvents, ReceiverThrowableType> output ) throws IOException, ReceiverThrowableType
+                {
+                    // Lock store first
+                    lock.lock();
+                    try
+                    {
+                        output.receiveFrom( new Sender<TransactionApplicationEvents, IOException>()
+                        {
+                            @Override
+                            public <ReceiverThrowableType extends Throwable> void sendTo( Receiver<? super TransactionApplicationEvents, ReceiverThrowableType> receiver ) throws ReceiverThrowableType, IOException {
+
+                                ListIterator<TransactionApplicationEvents> iterator = store.listIterator();
+
+                                while (iterator.hasNext() ){
+                                    TransactionApplicationEvents next = iterator.next();
+                                    if( next.timestamp().get() >= beforeTimestamp) {
+                                        break;
+                                    }
+                                }
+
+                                long count = 0;
+
+                                while( iterator.hasPrevious() && count < maxTransactions )
+                                {
+                                    TransactionApplicationEvents next = iterator.previous();
+                                    receiver.receive(next);
+                                    count++;
+                                }
+                            }
+                        } );
+                    } finally
+                    {
+                        lock.unlock();
+                    }
+                }
+            };
+
+        }
+
+        @Override
+        protected void storeEvents(TransactionApplicationEvents transactionDomain) throws IOException {
+            store.add(transactionDomain);
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/ae8b4700/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/bootstrap/EventsourcingAssembler.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/bootstrap/EventsourcingAssembler.java b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/bootstrap/EventsourcingAssembler.java
new file mode 100644
index 0000000..4d76f9c
--- /dev/null
+++ b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/bootstrap/EventsourcingAssembler.java
@@ -0,0 +1,60 @@
+package org.qi4j.library.eventsourcing.bootstrap;
+
+import org.qi4j.bootstrap.Assemblers;
+import org.qi4j.bootstrap.AssemblyException;
+import org.qi4j.bootstrap.ImportedServiceDeclaration;
+import org.qi4j.bootstrap.ModuleAssembly;
+import org.qi4j.library.eventsourcing.application.api.ApplicationEvent;
+import org.qi4j.library.eventsourcing.application.api.TransactionApplicationEvents;
+import org.qi4j.library.eventsourcing.application.factory.ApplicationEventFactoryService;
+import org.qi4j.library.eventsourcing.domain.api.DomainEventValue;
+import org.qi4j.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
+import org.qi4j.library.eventsourcing.domain.factory.CurrentUserUoWPrincipal;
+import org.qi4j.library.eventsourcing.domain.factory.DomainEventFactoryService;
+
+
+public class EventsourcingAssembler
+        extends Assemblers.Visibility<EventsourcingAssembler> {
+
+
+    private boolean domainEvents;
+    private boolean applicationEvents;
+
+    private boolean uowPrincipal;
+
+    public EventsourcingAssembler withDomainEvents() {
+        domainEvents = true;
+        return this;
+    }
+
+    public EventsourcingAssembler withApplicationEvents() {
+        applicationEvents = true;
+        return this;
+    }
+
+    public EventsourcingAssembler withCurrentUserFromUOWPrincipal() {
+        uowPrincipal = true;
+        return this;
+    }
+
+
+    @Override
+    public void assemble(ModuleAssembly module) throws AssemblyException {
+
+        if (domainEvents) {
+            module.values(DomainEventValue.class, UnitOfWorkDomainEventsValue.class);
+            module.services(DomainEventFactoryService.class).visibleIn(visibility());
+        }
+
+        if (applicationEvents) {
+            module.values(ApplicationEvent.class, TransactionApplicationEvents.class);
+            module.services(ApplicationEventFactoryService.class).visibleIn(visibility());
+        }
+
+        if (uowPrincipal) {
+            module.importedServices(CurrentUserUoWPrincipal.class).importedBy(ImportedServiceDeclaration.NEW_OBJECT);
+            module.objects(CurrentUserUoWPrincipal.class);
+        }
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/ae8b4700/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java b/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java
new file mode 100644
index 0000000..5aa36dc
--- /dev/null
+++ b/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java
@@ -0,0 +1,188 @@
+package org.qi4j.library.eventsourcing.application;
+
+import org.junit.Test;
+import org.qi4j.api.common.Optional;
+import org.qi4j.api.common.UseDefaults;
+import org.qi4j.api.composite.TransientComposite;
+import org.qi4j.api.entity.EntityBuilder;
+import org.qi4j.api.entity.EntityComposite;
+import org.qi4j.api.injection.scope.Service;
+import org.qi4j.api.injection.scope.Structure;
+import org.qi4j.api.mixin.Mixins;
+import org.qi4j.api.property.Property;
+import org.qi4j.api.unitofwork.UnitOfWork;
+import org.qi4j.api.unitofwork.UnitOfWorkCompletionException;
+import org.qi4j.api.unitofwork.UnitOfWorkFactory;
+import org.qi4j.api.usecase.UsecaseBuilder;
+import org.qi4j.bootstrap.AssemblyException;
+import org.qi4j.bootstrap.ModuleAssembly;
+import org.qi4j.io.Output;
+import org.qi4j.io.Receiver;
+import org.qi4j.io.Sender;
+import org.qi4j.library.eventsourcing.application.api.ApplicationEvent;
+import org.qi4j.library.eventsourcing.application.api.TransactionApplicationEvents;
+import org.qi4j.library.eventsourcing.application.factory.ApplicationEventCreationConcern;
+import org.qi4j.library.eventsourcing.application.source.ApplicationEventSource;
+import org.qi4j.library.eventsourcing.application.source.helper.ApplicationEventParameters;
+import org.qi4j.library.eventsourcing.application.source.memory.MemoryApplicationEventStoreService;
+import org.qi4j.library.eventsourcing.bootstrap.EventsourcingAssembler;
+import org.qi4j.test.AbstractQi4jTest;
+import org.qi4j.test.EntityTestAssembler;
+
+import java.io.IOException;
+import java.security.Principal;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * User signup usecase with optional mailing list subscription.
+ * Subscription is not stored in domain model but is available via application events feed.
+ */
+public class ApplicationEventTest extends AbstractQi4jTest {
+
+    @Service
+    ApplicationEventSource eventSource;
+
+
+    @Override
+    public void assemble(ModuleAssembly module) throws AssemblyException {
+
+        // START SNIPPET: assemblyAE
+        new EventsourcingAssembler()
+                .withApplicationEvents()
+                .withCurrentUserFromUOWPrincipal()
+                .assemble(module);
+        // END SNIPPET: assemblyAE
+
+        // START SNIPPET: storeAE
+        module.services(MemoryApplicationEventStoreService.class);
+        // END SNIPPET: storeAE
+
+        new EntityTestAssembler().assemble(module);
+
+        // START SNIPPET: concernAE
+        module.transients(Users.class).withConcerns(ApplicationEventCreationConcern.class);
+        // END SNIPPET: concernAE
+
+        module.entities(UserEntity.class);
+
+    }
+
+
+    @Test
+    public void testApplicationEvent() throws UnitOfWorkCompletionException, IOException {
+        Users users = module.newTransient(Users.class);
+
+        Principal administratorPrincipal = new Principal() {
+            public String getName() {
+                return "administrator";
+            }
+        };
+
+        UnitOfWork uow1 = module.newUnitOfWork(UsecaseBuilder.newUsecase("User signup"));
+        uow1.setMetaInfo(administratorPrincipal);
+        users.signup(null, "user1", Arrays.asList("news1", "news2"));
+        uow1.complete();
+
+        UnitOfWork uow2 = module.newUnitOfWork();
+        uow2.setMetaInfo(administratorPrincipal);
+        users.signup(null, "user2", Collections.EMPTY_LIST);
+        uow2.complete();
+
+        UnitOfWork uow3 = module.newUnitOfWork();
+        uow3.setMetaInfo(administratorPrincipal);
+        users.signup(null, "user3", Collections.singletonList("news1"));
+        uow3.complete();
+
+
+        // receive events from uow2 and later forwards
+        EventsInbox afterInbox = new EventsInbox();
+        eventSource.transactionsAfter(uow2.currentTime() - 1, Integer.MAX_VALUE).transferTo(afterInbox);
+
+        assertEquals(2, afterInbox.getEvents().size());
+
+        ApplicationEvent signupEvent2 = afterInbox.getEvents().get(0).events().get().get(0);
+
+        assertEquals("signup", signupEvent2.name().get());
+        assertEquals("user2", ApplicationEventParameters.getParameter(signupEvent2, "param1"));
+        assertEquals("[]", ApplicationEventParameters.getParameter(signupEvent2, "param2"));
+
+        // receive events from uow2 backwards
+        EventsInbox beforeInbox = new EventsInbox();
+        eventSource.transactionsBefore(uow3.currentTime(), Integer.MAX_VALUE).transferTo(beforeInbox);
+
+        assertEquals(2, beforeInbox.getEvents().size());
+
+        ApplicationEvent signupEvent1 = beforeInbox.getEvents().get(1).events().get().get(0);
+
+        assertEquals("signup", signupEvent1.name().get());
+        assertEquals("user1", ApplicationEventParameters.getParameter(signupEvent1, "param1"));
+        assertEquals("[\"news1\",\"news2\"]", ApplicationEventParameters.getParameter(signupEvent1, "param2"));
+
+
+    }
+
+    static class EventsInbox implements Output<TransactionApplicationEvents, RuntimeException> {
+
+        private List<TransactionApplicationEvents> events = new LinkedList<>();
+
+        @Override
+        public <SenderThrowableType extends Throwable> void receiveFrom(Sender<? extends TransactionApplicationEvents, SenderThrowableType> sender) throws RuntimeException, SenderThrowableType {
+            try {
+                sender.sendTo(new Receiver<TransactionApplicationEvents, Throwable>() {
+                    @Override
+                    public void receive(TransactionApplicationEvents item) throws Throwable {
+                        events.add(item);
+                    }
+                });
+
+            } catch (Throwable throwable) {
+                throwable.printStackTrace();
+            }
+
+        }
+
+        public List<TransactionApplicationEvents> getEvents() {
+            return events;
+        }
+    }
+
+    @Mixins(Users.Mixin.class)
+    public interface Users extends TransientComposite {
+
+        // START SNIPPET: methodAE
+        void signup(@Optional ApplicationEvent evt, String username, List<String> mailinglists);
+        // END SNIPPET: methodAR
+
+        abstract class Mixin implements Users {
+
+            @Structure
+            UnitOfWorkFactory uowFactory;
+
+            @Override
+            public void signup(ApplicationEvent evt, String username, List<String> mailinglists) {
+                if (evt == null) {
+                    UnitOfWork uow = uowFactory.currentUnitOfWork();
+
+                    EntityBuilder<UserEntity> builder = uow.newEntityBuilder(UserEntity.class);
+                    builder.instance().username().set(username);
+                    builder.newInstance();
+
+                }
+            }
+        }
+    }
+
+    public interface UserEntity
+            extends EntityComposite {
+
+        @UseDefaults
+        Property<String> username();
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/ae8b4700/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/DomainEventTest.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/DomainEventTest.java b/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/DomainEventTest.java
index 7a84999..9d6cdc1 100644
--- a/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/DomainEventTest.java
+++ b/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/DomainEventTest.java
@@ -28,6 +28,7 @@ import org.qi4j.bootstrap.ModuleAssembly;
 import org.qi4j.functional.Function;
 import org.qi4j.io.Outputs;
 import org.qi4j.io.Transforms;
+import org.qi4j.library.eventsourcing.bootstrap.EventsourcingAssembler;
 import org.qi4j.library.eventsourcing.domain.api.DomainEvent;
 import org.qi4j.library.eventsourcing.domain.api.DomainEventValue;
 import org.qi4j.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
@@ -52,13 +53,20 @@ public class DomainEventTest
     {
         new EntityTestAssembler(  ).assemble( module );
 
-        module.values( DomainEventValue.class, UnitOfWorkDomainEventsValue.class );
+        // START SNIPPET: assemblyDE
+        new EventsourcingAssembler()
+                .withDomainEvents()
+                .withCurrentUserFromUOWPrincipal()
+                .assemble(module);
+        // START SNIPPET: assemblyDE
+
+        // START SNIPPET: storeDE
         module.services( MemoryEventStoreService.class );
-        module.services( DomainEventFactoryService.class );
-        module.importedServices( CurrentUserUoWPrincipal.class ).importedBy( ImportedServiceDeclaration.NEW_OBJECT );
-        module.objects( CurrentUserUoWPrincipal.class );
+        // START SNIPPET: storeDE
 
+        // START SNIPPET: concernDE
         module.entities( TestEntity.class ).withConcerns(DomainEventCreationConcern.class);
+        // END SNIPPET: concernDE
     }
 
     @Test
@@ -93,6 +101,7 @@ public class DomainEventTest
                 }, Outputs.systemOut() ));
     }
 
+    // START SNIPPET: methodDE
     @Mixins( TestEntity.Mixin.class )
     public interface TestEntity
         extends EntityComposite
@@ -112,4 +121,5 @@ public class DomainEventTest
             }
         }
     }
+    // END SNIPPET: methodDE
 }


[6/6] zest-qi4j git commit: EventSourcing: licensing, formatting, some fixes in documentation

Posted by pa...@apache.org.
EventSourcing: licensing, formatting, some fixes in documentation


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

Branch: refs/heads/develop
Commit: 3a2f6c948faf2c1a10b9f4d8c20b18578a7d99be
Parents: 80c2895
Author: Paul Merlin <pa...@apache.org>
Authored: Sun Jul 19 18:38:33 2015 +0200
Committer: Paul Merlin <pa...@apache.org>
Committed: Sun Jul 19 18:38:33 2015 +0200

----------------------------------------------------------------------
 libraries/eventsourcing-jdbm/dev-status.xml     |   2 +-
 libraries/eventsourcing-rest/dev-status.xml     |   2 +-
 libraries/eventsourcing/dev-status.xml          |   2 +-
 .../eventsourcing/src/docs/eventsourcing.txt    |  41 ++++----
 .../MemoryApplicationEventStoreService.java     |  78 ++++++++------
 .../bootstrap/EventsourcingAssembler.java       |  45 +++++---
 .../application/ApplicationEventTest.java       | 102 ++++++++++---------
 .../src/docs/tutorials/howto-build-system.txt   |   4 +-
 manual/src/docs/userguide/libraries.txt         |   8 --
 9 files changed, 159 insertions(+), 125 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/3a2f6c94/libraries/eventsourcing-jdbm/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing-jdbm/dev-status.xml b/libraries/eventsourcing-jdbm/dev-status.xml
index 73eb6db..5adebd7 100644
--- a/libraries/eventsourcing-jdbm/dev-status.xml
+++ b/libraries/eventsourcing-jdbm/dev-status.xml
@@ -24,7 +24,7 @@
     <codebase>beta</codebase>
 
     <!-- none, brief, good, complete -->
-    <documentation>none</documentation>
+    <documentation>brief</documentation>
 
     <!-- none, some, good, complete -->
     <unittests>some</unittests>

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/3a2f6c94/libraries/eventsourcing-rest/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing-rest/dev-status.xml b/libraries/eventsourcing-rest/dev-status.xml
index 73eb6db..5adebd7 100644
--- a/libraries/eventsourcing-rest/dev-status.xml
+++ b/libraries/eventsourcing-rest/dev-status.xml
@@ -24,7 +24,7 @@
     <codebase>beta</codebase>
 
     <!-- none, brief, good, complete -->
-    <documentation>none</documentation>
+    <documentation>brief</documentation>
 
     <!-- none, some, good, complete -->
     <unittests>some</unittests>

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/3a2f6c94/libraries/eventsourcing/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/dev-status.xml b/libraries/eventsourcing/dev-status.xml
index 73eb6db..5adebd7 100644
--- a/libraries/eventsourcing/dev-status.xml
+++ b/libraries/eventsourcing/dev-status.xml
@@ -24,7 +24,7 @@
     <codebase>beta</codebase>
 
     <!-- none, brief, good, complete -->
-    <documentation>none</documentation>
+    <documentation>brief</documentation>
 
     <!-- none, some, good, complete -->
     <unittests>some</unittests>

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/3a2f6c94/libraries/eventsourcing/src/docs/eventsourcing.txt
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/docs/eventsourcing.txt b/libraries/eventsourcing/src/docs/eventsourcing.txt
index d6a6263..6936ea5 100644
--- a/libraries/eventsourcing/src/docs/eventsourcing.txt
+++ b/libraries/eventsourcing/src/docs/eventsourcing.txt
@@ -25,26 +25,27 @@
 source=libraries/eventsourcing/dev-status.xml
 --------------
 
-The Event Sourcing Library supports generating, storing and replying two types of events: application-events and domain-events.
+The Event Sourcing Library supports generating, storing and replaying two types of events: application-events and domain-events.
 
-Application events are bound to usecase and are produced by execution of specific methods (ones with ApplicationEvent as their first parameter).
-Each application event holds information about usecase, method name and json serialized values of method parameters.
+Application events are bound to Usecase and are produced by execution of specific methods (ones with `ApplicationEvent` as their first parameter).
+Each application event holds information about Usecase, method name and JSON serialized values of method parameters.
 
-Domain events are bound to entity instances and are produced by execution of annotated (see @DomainEvent) method that belongs to EntityComposite.
-Each domain event (see DomainEventValue) holds information about entity type, identity, method name and json serialized values of method parameters.
+Domain events are bound to entity instances and are produced by execution of annotated (see `@DomainEvent`) methods that belongs to `EntityComposite`.
+Each domain event (see `DomainEventValue`) holds information about entity type, identity, method name and JSON serialized values of method parameters.
 
-Both application and domain events are captured during UnitOfWork lifetime and are stored in event store after successfully completed UnitOfWork as collection together (see UnitOfWorkDomainEventsValue and TransactionApplicationEvents).
+Both application and domain events are captured during `UnitOfWork` lifetime and are stored in `EventStore` after successfully completed `UnitOfWork` as collection together (see `UnitOfWorkDomainEventsValue` and `TransactionApplicationEvents`).
 
-There is support for replying events. When events are replied the same code is executed but no new events are generated.
+There is support for replaying events.
+When events are replayed the same code is executed but no new events are generated.
 
-There are helper classes that enables a service to easily track event feed, and
-for domain events there is event router that allow specify specification->receiver routes.
+There are helper classes that enables a service to easily track events feed, and for domain events there is `EventRouter` that allow to specify specification->receiver routes.
 
 include::../../build/docs/buildinfo/artifact.txt[]
 
 *JDBM backed store*
 
-Event store supports indexed and streamed access to events feed. There is in-memory and JDBM backed implementation.
+EventStore supports indexed and streamed access to events feed.
+There is in-memory and JDBM backed implementations.
 
 [devstatus]
 --------------
@@ -55,7 +56,7 @@ include::../../../eventsourcing-jdbm/build/docs/buildinfo/artifact.txt[]
 
 *REST access*
 
-For remote access to feed there is eventsourcing-rest library that exposes events as Atom feeds.
+For remote access to feed there is `eventsourcing-rest` library that exposes events as Atom feeds.
 
 [devstatus]
 --------------
@@ -75,21 +76,23 @@ source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/appl
 tag=assemblyAE
 ----
 
-configure application events store:
+Configure application events store:
 [snippet,java]
 ----
 source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java
 tag=storeAE
 ----
 
-Actual method on composite which execution emits application event. First parameter is null on "normal" execution. If it is not null, then the method call is a replay of previously created events.
+Actual method on composite which execution emits application event.
+First parameter is `null` on "normal" execution.
+If it is not `null`, then the method call is a replay of previously created events.
 [snippet,java]
 ----
 source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java
 tag=methodAE
 ----
 
-to enable execution capturing, you have to configure composite with concern:
+To enable execution capturing, you have to configure composite with concern:
 [snippet,java]
 ----
 source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java
@@ -106,7 +109,7 @@ source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/doma
 tag=assemblyDE
 ----
 
-configure domain events store:
+Configure domain events store:
 
 [snippet,java]
 ----
@@ -114,19 +117,19 @@ source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/doma
 tag=storeDE
 ----
 
-annotate your entity state changing methods. Event methods may only change state. They may not fail or thrown exceptions:
+Annotate your entity state changing methods.
+Event methods may only change state.
+They may not fail or thrown exceptions:
 [snippet,java]
 ----
 source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/DomainEventTest.java
 tag=methodDE
 ----
 
-to enable method execution capturing, you have to configure entity with concern:
+To enable method execution capturing, you have to configure entity with concern:
 
 [snippet,java]
 ----
 source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/DomainEventTest.java
 tag=concernDE
 ----
-
-

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/3a2f6c94/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/source/memory/MemoryApplicationEventStoreService.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/source/memory/MemoryApplicationEventStoreService.java b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/source/memory/MemoryApplicationEventStoreService.java
index 698607f..cce6cf4 100644
--- a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/source/memory/MemoryApplicationEventStoreService.java
+++ b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/source/memory/MemoryApplicationEventStoreService.java
@@ -1,3 +1,21 @@
+/*
+ * 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.qi4j.library.eventsourcing.application.source.memory;
 
 import org.qi4j.api.activation.Activators;
@@ -14,89 +32,89 @@ import org.qi4j.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
 import java.io.IOException;
 import java.util.*;
 
-
 /**
  * In-Memory ApplicationEventStore. Mainly used for testing.
  */
-@Mixins(MemoryApplicationEventStoreService.MemoryStoreMixin.class)
-@Activators(ApplicationEventStoreActivation.Activator.class)
+@Mixins( MemoryApplicationEventStoreService.MemoryStoreMixin.class )
+@Activators( ApplicationEventStoreActivation.Activator.class )
 public interface MemoryApplicationEventStoreService
-        extends ApplicationEventSource, ApplicationEventStore, ApplicationEventStream, ApplicationEventStoreActivation, ServiceComposite
+    extends ApplicationEventSource, ApplicationEventStore, ApplicationEventStream, ApplicationEventStoreActivation, ServiceComposite
 {
-
     abstract class MemoryStoreMixin
-            extends AbstractApplicationEventStoreMixin
-            implements ApplicationEventSource, ApplicationEventStoreActivation
+        extends AbstractApplicationEventStoreMixin
+        implements ApplicationEventSource, ApplicationEventStoreActivation
     {
-
         // This list holds all transactions
         private LinkedList<TransactionApplicationEvents> store = new LinkedList<TransactionApplicationEvents>();
 
         @Override
-        public Input<TransactionApplicationEvents, IOException> transactionsAfter(final long afterTimestamp, final long maxTransactions)
+        public Input<TransactionApplicationEvents, IOException> transactionsAfter( final long afterTimestamp, final long maxTransactions )
         {
             return new Input<TransactionApplicationEvents, IOException>()
             {
                 @Override
-                public <ReceiverThrowableType extends Throwable> void transferTo(Output<? super TransactionApplicationEvents, ReceiverThrowableType> output) throws IOException, ReceiverThrowableType
+                public <ReceiverThrowableType extends Throwable> void transferTo( Output<? super TransactionApplicationEvents, ReceiverThrowableType> output )
+                    throws IOException, ReceiverThrowableType
                 {
                     // Lock store first
                     lock.lock();
                     try
                     {
-                        output.receiveFrom(new Sender<TransactionApplicationEvents, IOException>()
+                        output.receiveFrom( new Sender<TransactionApplicationEvents, IOException>()
                         {
                             @Override
-                            public <ReceiverThrowableType extends Throwable> void sendTo(Receiver<? super TransactionApplicationEvents, ReceiverThrowableType> receiver) throws ReceiverThrowableType, IOException
+                            public <ReceiverThrowableType extends Throwable> void sendTo( Receiver<? super TransactionApplicationEvents, ReceiverThrowableType> receiver )
+                                throws ReceiverThrowableType, IOException
                             {
                                 Iterator<TransactionApplicationEvents> iterator = store.iterator();
 
                                 long count = 0;
 
-                                while (iterator.hasNext() && count < maxTransactions)
+                                while( iterator.hasNext() && count < maxTransactions )
                                 {
                                     TransactionApplicationEvents next = iterator.next();
-                                    if (next.timestamp().get() > afterTimestamp)
+                                    if( next.timestamp().get() > afterTimestamp )
                                     {
-                                        receiver.receive(next);
+                                        receiver.receive( next );
                                         count++;
                                     }
                                 }
                             }
                         });
-                    } finally
+                    }
+                    finally
                     {
                         lock.unlock();
                     }
                 }
             };
-
         }
 
         @Override
-        public Input<TransactionApplicationEvents, IOException> transactionsBefore(final long beforeTimestamp, final long maxTransactions)
+        public Input<TransactionApplicationEvents, IOException> transactionsBefore( final long beforeTimestamp, final long maxTransactions )
         {
             return new Input<TransactionApplicationEvents, IOException>()
             {
                 @Override
-                public <ReceiverThrowableType extends Throwable> void transferTo(Output<? super TransactionApplicationEvents, ReceiverThrowableType> output) throws IOException, ReceiverThrowableType
+                public <ReceiverThrowableType extends Throwable> void transferTo( Output<? super TransactionApplicationEvents, ReceiverThrowableType> output )
+                    throws IOException, ReceiverThrowableType
                 {
                     // Lock store first
                     lock.lock();
                     try
                     {
-                        output.receiveFrom(new Sender<TransactionApplicationEvents, IOException>()
+                        output.receiveFrom( new Sender<TransactionApplicationEvents, IOException>()
                         {
                             @Override
-                            public <ReceiverThrowableType extends Throwable> void sendTo(Receiver<? super TransactionApplicationEvents, ReceiverThrowableType> receiver) throws ReceiverThrowableType, IOException
+                            public <ReceiverThrowableType extends Throwable> void sendTo( Receiver<? super TransactionApplicationEvents, ReceiverThrowableType> receiver )
+                                throws ReceiverThrowableType, IOException
                             {
-
                                 ListIterator<TransactionApplicationEvents> iterator = store.listIterator();
 
-                                while (iterator.hasNext())
+                                while( iterator.hasNext() )
                                 {
                                     TransactionApplicationEvents next = iterator.next();
-                                    if (next.timestamp().get() >= beforeTimestamp)
+                                    if( next.timestamp().get() >= beforeTimestamp )
                                     {
                                         break;
                                     }
@@ -104,29 +122,27 @@ public interface MemoryApplicationEventStoreService
 
                                 long count = 0;
 
-                                while (iterator.hasPrevious() && count < maxTransactions)
+                                while( iterator.hasPrevious() && count < maxTransactions )
                                 {
                                     TransactionApplicationEvents next = iterator.previous();
-                                    receiver.receive(next);
+                                    receiver.receive( next );
                                     count++;
                                 }
                             }
                         });
-                    } finally
+                    }
+                    finally
                     {
                         lock.unlock();
                     }
                 }
             };
-
         }
 
         @Override
-        protected void storeEvents(TransactionApplicationEvents transactionDomain) throws IOException
+        protected void storeEvents( TransactionApplicationEvents transactionDomain ) throws IOException
         {
             store.add(transactionDomain);
         }
-
     }
-
 }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/3a2f6c94/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/bootstrap/EventsourcingAssembler.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/bootstrap/EventsourcingAssembler.java b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/bootstrap/EventsourcingAssembler.java
index 26d1af0..228d6de 100644
--- a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/bootstrap/EventsourcingAssembler.java
+++ b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/bootstrap/EventsourcingAssembler.java
@@ -1,3 +1,21 @@
+/*
+ * 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.qi4j.library.eventsourcing.bootstrap;
 
 import org.qi4j.bootstrap.Assemblers;
@@ -12,12 +30,9 @@ import org.qi4j.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
 import org.qi4j.library.eventsourcing.domain.factory.CurrentUserUoWPrincipal;
 import org.qi4j.library.eventsourcing.domain.factory.DomainEventFactoryService;
 
-
 public class EventsourcingAssembler
-        extends Assemblers.Visibility<EventsourcingAssembler>
+    extends Assemblers.Visibility<EventsourcingAssembler>
 {
-
-
     private boolean domainEvents;
     private boolean applicationEvents;
 
@@ -41,28 +56,26 @@ public class EventsourcingAssembler
         return this;
     }
 
-
     @Override
     public void assemble(ModuleAssembly module) throws AssemblyException
     {
-
-        if (domainEvents)
+        if( domainEvents )
         {
-            module.values(DomainEventValue.class, UnitOfWorkDomainEventsValue.class);
-            module.services(DomainEventFactoryService.class).visibleIn(visibility());
+            module.values( DomainEventValue.class, UnitOfWorkDomainEventsValue.class );
+            module.services( DomainEventFactoryService.class).visibleIn(visibility() );
         }
 
-        if (applicationEvents)
+        if( applicationEvents )
         {
-            module.values(ApplicationEvent.class, TransactionApplicationEvents.class);
-            module.services(ApplicationEventFactoryService.class).visibleIn(visibility());
+            module.values( ApplicationEvent.class, TransactionApplicationEvents.class );
+            module.services( ApplicationEventFactoryService.class ).visibleIn( visibility() );
         }
 
-        if (uowPrincipal)
+        if( uowPrincipal )
         {
-            module.importedServices(CurrentUserUoWPrincipal.class).importedBy(ImportedServiceDeclaration.NEW_OBJECT);
-            module.objects(CurrentUserUoWPrincipal.class);
+            module.importedServices( CurrentUserUoWPrincipal.class )
+                .importedBy( ImportedServiceDeclaration.NEW_OBJECT );
+            module.objects( CurrentUserUoWPrincipal.class );
         }
-
     }
 }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/3a2f6c94/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java b/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java
index 480b7f3..f566db8 100644
--- a/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java
+++ b/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java
@@ -1,3 +1,21 @@
+/*
+ * 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.qi4j.library.eventsourcing.application;
 
 import org.junit.Test;
@@ -43,17 +61,14 @@ import static org.junit.Assert.assertEquals;
  * Subscription is not stored in domain model but is available via application events feed.
  */
 public class ApplicationEventTest
-        extends AbstractQi4jTest
+    extends AbstractQi4jTest
 {
-
     @Service
     ApplicationEventSource eventSource;
 
-
     @Override
-    public void assemble(ModuleAssembly module) throws AssemblyException
+    public void assemble( ModuleAssembly module ) throws AssemblyException
     {
-
         // START SNIPPET: assemblyAE
         new EventsourcingAssembler()
                 .withApplicationEvents()
@@ -62,16 +77,16 @@ public class ApplicationEventTest
         // END SNIPPET: assemblyAE
 
         // START SNIPPET: storeAE
-        module.services(MemoryApplicationEventStoreService.class);
+        module.services( MemoryApplicationEventStoreService.class );
         // END SNIPPET: storeAE
 
-        new EntityTestAssembler().assemble(module);
+        new EntityTestAssembler().assemble( module );
 
         // START SNIPPET: concernAE
-        module.transients(Users.class).withConcerns(ApplicationEventCreationConcern.class);
+        module.transients( Users.class ).withConcerns( ApplicationEventCreationConcern.class );
         // END SNIPPET: concernAE
 
-        module.entities(UserEntity.class);
+        module.entities( UserEntity.class );
 
     }
 
@@ -79,83 +94,84 @@ public class ApplicationEventTest
     @Test
     public void testApplicationEvent() throws UnitOfWorkCompletionException, IOException
     {
-        Users users = module.newTransient(Users.class);
+        Users users = module.newTransient( Users.class );
 
         Principal administratorPrincipal = new Principal()
         {
+            @Override
             public String getName()
             {
                 return "administrator";
             }
         };
 
-        UnitOfWork uow1 = module.newUnitOfWork(UsecaseBuilder.newUsecase("User signup"));
-        uow1.setMetaInfo(administratorPrincipal);
-        users.signup(null, "user1", Arrays.asList("news1", "news2"));
+        UnitOfWork uow1 = module.newUnitOfWork( UsecaseBuilder.newUsecase( "User signup" ) );
+        uow1.setMetaInfo( administratorPrincipal );
+        users.signup( null, "user1", Arrays.asList( "news1", "news2" ) );
         uow1.complete();
 
         UnitOfWork uow2 = module.newUnitOfWork();
-        uow2.setMetaInfo(administratorPrincipal);
-        users.signup(null, "user2", Collections.EMPTY_LIST);
+        uow2.setMetaInfo( administratorPrincipal );
+        users.signup( null, "user2", Collections.EMPTY_LIST );
         uow2.complete();
 
         UnitOfWork uow3 = module.newUnitOfWork();
-        uow3.setMetaInfo(administratorPrincipal);
-        users.signup(null, "user3", Collections.singletonList("news1"));
+        uow3.setMetaInfo( administratorPrincipal );
+        users.signup( null, "user3", Collections.singletonList( "news1" ) );
         uow3.complete();
 
 
         // receive events from uow2 and later forwards
         EventsInbox afterInbox = new EventsInbox();
-        eventSource.transactionsAfter(uow2.currentTime() - 1, Integer.MAX_VALUE).transferTo(afterInbox);
+        eventSource.transactionsAfter( uow2.currentTime() - 1, Integer.MAX_VALUE ).transferTo( afterInbox );
 
-        assertEquals(2, afterInbox.getEvents().size());
+        assertEquals( 2, afterInbox.getEvents().size() );
 
-        ApplicationEvent signupEvent2 = afterInbox.getEvents().get(0).events().get().get(0);
+        ApplicationEvent signupEvent2 = afterInbox.getEvents().get( 0 ).events().get().get( 0 );
 
-        assertEquals("signup", signupEvent2.name().get());
-        assertEquals("user2", ApplicationEventParameters.getParameter(signupEvent2, "param1"));
-        assertEquals("[]", ApplicationEventParameters.getParameter(signupEvent2, "param2"));
+        assertEquals( "signup", signupEvent2.name().get() );
+        assertEquals( "user2", ApplicationEventParameters.getParameter( signupEvent2, "param1" ) );
+        assertEquals( "[]", ApplicationEventParameters.getParameter( signupEvent2, "param2" ) );
 
         // receive events from uow2 backwards
         EventsInbox beforeInbox = new EventsInbox();
-        eventSource.transactionsBefore(uow3.currentTime(), Integer.MAX_VALUE).transferTo(beforeInbox);
+        eventSource.transactionsBefore( uow3.currentTime(), Integer.MAX_VALUE ).transferTo( beforeInbox );
 
-        assertEquals(2, beforeInbox.getEvents().size());
+        assertEquals( 2, beforeInbox.getEvents().size() );
 
-        ApplicationEvent signupEvent1 = beforeInbox.getEvents().get(1).events().get().get(0);
+        ApplicationEvent signupEvent1 = beforeInbox.getEvents().get( 1 ).events().get().get( 0 );
 
-        assertEquals("signup", signupEvent1.name().get());
-        assertEquals("user1", ApplicationEventParameters.getParameter(signupEvent1, "param1"));
-        assertEquals("[\"news1\",\"news2\"]", ApplicationEventParameters.getParameter(signupEvent1, "param2"));
+        assertEquals( "signup", signupEvent1.name().get());
+        assertEquals( "user1", ApplicationEventParameters.getParameter( signupEvent1, "param1" ) );
+        assertEquals( "[\"news1\",\"news2\"]", ApplicationEventParameters.getParameter( signupEvent1, "param2" ) );
 
 
     }
 
     static class EventsInbox implements Output<TransactionApplicationEvents, RuntimeException>
     {
-
         private List<TransactionApplicationEvents> events = new LinkedList<>();
 
         @Override
-        public <SenderThrowableType extends Throwable> void receiveFrom(Sender<? extends TransactionApplicationEvents, SenderThrowableType> sender) throws RuntimeException, SenderThrowableType
+        public <SenderThrowableType extends Throwable> void receiveFrom( Sender<? extends TransactionApplicationEvents, SenderThrowableType> sender )
+            throws RuntimeException, SenderThrowableType
         {
             try
             {
-                sender.sendTo(new Receiver<TransactionApplicationEvents, Throwable>()
+                sender.sendTo( new Receiver<TransactionApplicationEvents, Throwable>()
                 {
                     @Override
-                    public void receive(TransactionApplicationEvents item) throws Throwable
+                    public void receive( TransactionApplicationEvents item ) throws Throwable
                     {
                         events.add(item);
                     }
                 });
 
-            } catch (Throwable throwable)
+            }
+            catch( Throwable throwable )
             {
                 throwable.printStackTrace();
             }
-
         }
 
         public List<TransactionApplicationEvents> getEvents()
@@ -165,30 +181,27 @@ public class ApplicationEventTest
     }
 
     // START SNIPPET: methodAE
-    @Mixins(Users.Mixin.class)
+    @Mixins( Users.Mixin.class )
     public interface Users extends TransientComposite
     {
-
-        void signup(@Optional ApplicationEvent evt, String username, List<String> mailinglists);
+        void signup( @Optional ApplicationEvent evt, String username, List<String> mailinglists );
         // END SNIPPET: methodAE
 
         abstract class Mixin implements Users
         {
-
             @Structure
             UnitOfWorkFactory uowFactory;
 
             @Override
-            public void signup(ApplicationEvent evt, String username, List<String> mailinglists)
+            public void signup( ApplicationEvent evt, String username, List<String> mailinglists )
             {
                 if (evt == null)
                 {
                     UnitOfWork uow = uowFactory.currentUnitOfWork();
 
-                    EntityBuilder<UserEntity> builder = uow.newEntityBuilder(UserEntity.class);
-                    builder.instance().username().set(username);
+                    EntityBuilder<UserEntity> builder = uow.newEntityBuilder( UserEntity.class );
+                    builder.instance().username().set( username );
                     builder.newInstance();
-
                 }
             }
         }
@@ -197,10 +210,7 @@ public class ApplicationEventTest
     public interface UserEntity
             extends EntityComposite
     {
-
         @UseDefaults
         Property<String> username();
-
     }
-
 }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/3a2f6c94/manual/src/docs/tutorials/howto-build-system.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/tutorials/howto-build-system.txt b/manual/src/docs/tutorials/howto-build-system.txt
index 2fa78b5..f5e3a2b 100644
--- a/manual/src/docs/tutorials/howto-build-system.txt
+++ b/manual/src/docs/tutorials/howto-build-system.txt
@@ -131,11 +131,11 @@ If a +version+ property is not defined, the build system will refuse to make a r
 
 == Tests ==
 
+NOTE: See the https://builds.apache.org/view/S-Z/view/Zest/[Zest™ Continuous Integration] for current tests results
+
 Unit and integration tests are located near the code under test.
 You'll find theses tests across the whole SDK.
 
-NOTE: See the https://builds.apache.org/view/S-Z/view/Zest/[Zest™ Continuous Integration] for current tests results
-
 === Unit tests requiring external services ===
 
 Among unit tests, some require an external service to be run.

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/3a2f6c94/manual/src/docs/userguide/libraries.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/userguide/libraries.txt b/manual/src/docs/userguide/libraries.txt
index 7157e37..b13ac39 100644
--- a/manual/src/docs/userguide/libraries.txt
+++ b/manual/src/docs/userguide/libraries.txt
@@ -63,14 +63,6 @@ include::../../../../libraries/eventsourcing/src/docs/eventsourcing.txt[]
 
 :leveloffset: 2
 
-include::../../../../libraries/eventsourcing-jdbm/src/docs/eventsourcing-jdbm.txt[]
-
-:leveloffset: 2
-
-include::../../../../libraries/eventsourcing-rest/src/docs/eventsourcing-rest.txt[]
-
-:leveloffset: 2
-
 include::../../../../libraries/fileconfig/src/docs/fileconfig.txt[]
 
 :leveloffset: 2


[4/6] zest-qi4j git commit: eventsourcing docs

Posted by pa...@apache.org.
eventsourcing docs


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

Branch: refs/heads/develop
Commit: 6c0e59f368c1cf1186dca76ee50272dae718b024
Parents: 96c58b6
Author: tbml <ti...@adleritech.com>
Authored: Sun Jul 19 08:31:47 2015 +0200
Committer: tbml <ti...@adleritech.com>
Committed: Sun Jul 19 08:31:47 2015 +0200

----------------------------------------------------------------------
 .../src/docs/eventsourcing-jdbm.txt             |  31 ------
 .../src/docs/eventsourcing-rest.txt             |  32 ------
 .../eventsourcing/src/docs/eventsourcing.txt    | 104 ++++++++++++++++++-
 3 files changed, 102 insertions(+), 65 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/6c0e59f3/libraries/eventsourcing-jdbm/src/docs/eventsourcing-jdbm.txt
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing-jdbm/src/docs/eventsourcing-jdbm.txt b/libraries/eventsourcing-jdbm/src/docs/eventsourcing-jdbm.txt
deleted file mode 100644
index a2ead6e..0000000
--- a/libraries/eventsourcing-jdbm/src/docs/eventsourcing-jdbm.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-///////////////////////////////////////////////////////////////
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
-///////////////////////////////////////////////////////////////
-
-[[library-eventsourcing-jdbm, Event Sourcing JDBM Library]]
-= Event Sourcing - JDBM =
-
-[devstatus]
---------------
-source=libraries/eventsourcing-jdbm/dev-status.xml
---------------
-
-
-NOTE: This Library has no documentation yet. Learn how to contribute in <<community-docs>>.
-
-include::../../build/docs/buildinfo/artifact.txt[]

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/6c0e59f3/libraries/eventsourcing-rest/src/docs/eventsourcing-rest.txt
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing-rest/src/docs/eventsourcing-rest.txt b/libraries/eventsourcing-rest/src/docs/eventsourcing-rest.txt
deleted file mode 100644
index c748cbc..0000000
--- a/libraries/eventsourcing-rest/src/docs/eventsourcing-rest.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-///////////////////////////////////////////////////////////////
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
-///////////////////////////////////////////////////////////////
-
-[[library-eventsourcing-rest, Event Sourcing ReST Library]]
-= Event Sourcing - ReST =
-
-[devstatus]
---------------
-source=libraries/eventsourcing-rest/dev-status.xml
---------------
-
-Event Sourcing - ReST Library
-
-NOTE: This Library has no documentation yet. Learn how to contribute in <<community-docs>>.
-
-include::../../build/docs/buildinfo/artifact.txt[]

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/6c0e59f3/libraries/eventsourcing/src/docs/eventsourcing.txt
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/docs/eventsourcing.txt b/libraries/eventsourcing/src/docs/eventsourcing.txt
index 0aedb66..d6a6263 100644
--- a/libraries/eventsourcing/src/docs/eventsourcing.txt
+++ b/libraries/eventsourcing/src/docs/eventsourcing.txt
@@ -25,8 +25,108 @@
 source=libraries/eventsourcing/dev-status.xml
 --------------
 
-Event Sourcing Library
+The Event Sourcing Library supports generating, storing and replying two types of events: application-events and domain-events.
 
-NOTE: This Library has no documentation yet. Learn how to contribute in <<community-docs>>.
+Application events are bound to usecase and are produced by execution of specific methods (ones with ApplicationEvent as their first parameter).
+Each application event holds information about usecase, method name and json serialized values of method parameters.
+
+Domain events are bound to entity instances and are produced by execution of annotated (see @DomainEvent) method that belongs to EntityComposite.
+Each domain event (see DomainEventValue) holds information about entity type, identity, method name and json serialized values of method parameters.
+
+Both application and domain events are captured during UnitOfWork lifetime and are stored in event store after successfully completed UnitOfWork as collection together (see UnitOfWorkDomainEventsValue and TransactionApplicationEvents).
+
+There is support for replying events. When events are replied the same code is executed but no new events are generated.
+
+There are helper classes that enables a service to easily track event feed, and
+for domain events there is event router that allow specify specification->receiver routes.
 
 include::../../build/docs/buildinfo/artifact.txt[]
+
+*JDBM backed store*
+
+Event store supports indexed and streamed access to events feed. There is in-memory and JDBM backed implementation.
+
+[devstatus]
+--------------
+source=libraries/eventsourcing-jdbm/dev-status.xml
+--------------
+
+include::../../../eventsourcing-jdbm/build/docs/buildinfo/artifact.txt[]
+
+*REST access*
+
+For remote access to feed there is eventsourcing-rest library that exposes events as Atom feeds.
+
+[devstatus]
+--------------
+source=libraries/eventsourcing-rest/dev-status.xml
+--------------
+
+include::../../../eventsourcing-rest/build/docs/buildinfo/artifact.txt[]
+
+
+== Application Events ==
+
+Assembly is done as follows:
+
+[snippet,java]
+----
+source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java
+tag=assemblyAE
+----
+
+configure application events store:
+[snippet,java]
+----
+source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java
+tag=storeAE
+----
+
+Actual method on composite which execution emits application event. First parameter is null on "normal" execution. If it is not null, then the method call is a replay of previously created events.
+[snippet,java]
+----
+source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java
+tag=methodAE
+----
+
+to enable execution capturing, you have to configure composite with concern:
+[snippet,java]
+----
+source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java
+tag=concernAE
+----
+
+== Domain Events ==
+
+Assembly:
+
+[snippet,java]
+----
+source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/DomainEventTest.java
+tag=assemblyDE
+----
+
+configure domain events store:
+
+[snippet,java]
+----
+source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/DomainEventTest.java
+tag=storeDE
+----
+
+annotate your entity state changing methods. Event methods may only change state. They may not fail or thrown exceptions:
+[snippet,java]
+----
+source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/DomainEventTest.java
+tag=methodDE
+----
+
+to enable method execution capturing, you have to configure entity with concern:
+
+[snippet,java]
+----
+source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/DomainEventTest.java
+tag=concernDE
+----
+
+


[3/6] zest-qi4j git commit: docs snippets fixes; code formatting

Posted by pa...@apache.org.
docs snippets fixes; code formatting


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

Branch: refs/heads/develop
Commit: 96c58b66d151fc06949594a3f4e2815a612020f3
Parents: ae8b470
Author: tbml <ti...@adleritech.com>
Authored: Sun Jul 19 08:28:04 2015 +0200
Committer: tbml <ti...@adleritech.com>
Committed: Sun Jul 19 08:28:04 2015 +0200

----------------------------------------------------------------------
 .../MemoryApplicationEventStoreService.java     | 44 ++++++++-------
 .../bootstrap/EventsourcingAssembler.java       | 24 ++++++---
 .../application/ApplicationEventTest.java       | 56 +++++++++++++-------
 .../eventsourcing/domain/DomainEventTest.java   |  4 +-
 4 files changed, 81 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/96c58b66/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/source/memory/MemoryApplicationEventStoreService.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/source/memory/MemoryApplicationEventStoreService.java b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/source/memory/MemoryApplicationEventStoreService.java
index df24e7a..698607f 100644
--- a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/source/memory/MemoryApplicationEventStoreService.java
+++ b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/source/memory/MemoryApplicationEventStoreService.java
@@ -19,9 +19,10 @@ import java.util.*;
  * In-Memory ApplicationEventStore. Mainly used for testing.
  */
 @Mixins(MemoryApplicationEventStoreService.MemoryStoreMixin.class)
-@Activators( ApplicationEventStoreActivation.Activator.class )
+@Activators(ApplicationEventStoreActivation.Activator.class)
 public interface MemoryApplicationEventStoreService
-        extends ApplicationEventSource, ApplicationEventStore, ApplicationEventStream, ApplicationEventStoreActivation, ServiceComposite {
+        extends ApplicationEventSource, ApplicationEventStore, ApplicationEventStream, ApplicationEventStoreActivation, ServiceComposite
+{
 
     abstract class MemoryStoreMixin
             extends AbstractApplicationEventStoreMixin
@@ -32,35 +33,37 @@ public interface MemoryApplicationEventStoreService
         private LinkedList<TransactionApplicationEvents> store = new LinkedList<TransactionApplicationEvents>();
 
         @Override
-        public Input<TransactionApplicationEvents, IOException> transactionsAfter(final long afterTimestamp, final long maxTransactions) {
+        public Input<TransactionApplicationEvents, IOException> transactionsAfter(final long afterTimestamp, final long maxTransactions)
+        {
             return new Input<TransactionApplicationEvents, IOException>()
             {
                 @Override
-                public <ReceiverThrowableType extends Throwable> void transferTo( Output<? super TransactionApplicationEvents, ReceiverThrowableType> output ) throws IOException, ReceiverThrowableType
+                public <ReceiverThrowableType extends Throwable> void transferTo(Output<? super TransactionApplicationEvents, ReceiverThrowableType> output) throws IOException, ReceiverThrowableType
                 {
                     // Lock store first
                     lock.lock();
                     try
                     {
-                        output.receiveFrom( new Sender<TransactionApplicationEvents, IOException>()
+                        output.receiveFrom(new Sender<TransactionApplicationEvents, IOException>()
                         {
                             @Override
-                            public <ReceiverThrowableType extends Throwable> void sendTo( Receiver<? super TransactionApplicationEvents, ReceiverThrowableType> receiver ) throws ReceiverThrowableType, IOException
+                            public <ReceiverThrowableType extends Throwable> void sendTo(Receiver<? super TransactionApplicationEvents, ReceiverThrowableType> receiver) throws ReceiverThrowableType, IOException
                             {
                                 Iterator<TransactionApplicationEvents> iterator = store.iterator();
 
                                 long count = 0;
 
-                                while( iterator.hasNext() && count < maxTransactions )
+                                while (iterator.hasNext() && count < maxTransactions)
                                 {
                                     TransactionApplicationEvents next = iterator.next();
-                                    if( next.timestamp().get() > afterTimestamp) {
+                                    if (next.timestamp().get() > afterTimestamp)
+                                    {
                                         receiver.receive(next);
                                         count++;
                                     }
                                 }
                             }
-                        } );
+                        });
                     } finally
                     {
                         lock.unlock();
@@ -71,40 +74,44 @@ public interface MemoryApplicationEventStoreService
         }
 
         @Override
-        public Input<TransactionApplicationEvents, IOException> transactionsBefore(final long beforeTimestamp, final long maxTransactions) {
+        public Input<TransactionApplicationEvents, IOException> transactionsBefore(final long beforeTimestamp, final long maxTransactions)
+        {
             return new Input<TransactionApplicationEvents, IOException>()
             {
                 @Override
-                public <ReceiverThrowableType extends Throwable> void transferTo( Output<? super TransactionApplicationEvents, ReceiverThrowableType> output ) throws IOException, ReceiverThrowableType
+                public <ReceiverThrowableType extends Throwable> void transferTo(Output<? super TransactionApplicationEvents, ReceiverThrowableType> output) throws IOException, ReceiverThrowableType
                 {
                     // Lock store first
                     lock.lock();
                     try
                     {
-                        output.receiveFrom( new Sender<TransactionApplicationEvents, IOException>()
+                        output.receiveFrom(new Sender<TransactionApplicationEvents, IOException>()
                         {
                             @Override
-                            public <ReceiverThrowableType extends Throwable> void sendTo( Receiver<? super TransactionApplicationEvents, ReceiverThrowableType> receiver ) throws ReceiverThrowableType, IOException {
+                            public <ReceiverThrowableType extends Throwable> void sendTo(Receiver<? super TransactionApplicationEvents, ReceiverThrowableType> receiver) throws ReceiverThrowableType, IOException
+                            {
 
                                 ListIterator<TransactionApplicationEvents> iterator = store.listIterator();
 
-                                while (iterator.hasNext() ){
+                                while (iterator.hasNext())
+                                {
                                     TransactionApplicationEvents next = iterator.next();
-                                    if( next.timestamp().get() >= beforeTimestamp) {
+                                    if (next.timestamp().get() >= beforeTimestamp)
+                                    {
                                         break;
                                     }
                                 }
 
                                 long count = 0;
 
-                                while( iterator.hasPrevious() && count < maxTransactions )
+                                while (iterator.hasPrevious() && count < maxTransactions)
                                 {
                                     TransactionApplicationEvents next = iterator.previous();
                                     receiver.receive(next);
                                     count++;
                                 }
                             }
-                        } );
+                        });
                     } finally
                     {
                         lock.unlock();
@@ -115,7 +122,8 @@ public interface MemoryApplicationEventStoreService
         }
 
         @Override
-        protected void storeEvents(TransactionApplicationEvents transactionDomain) throws IOException {
+        protected void storeEvents(TransactionApplicationEvents transactionDomain) throws IOException
+        {
             store.add(transactionDomain);
         }
 

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/96c58b66/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/bootstrap/EventsourcingAssembler.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/bootstrap/EventsourcingAssembler.java b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/bootstrap/EventsourcingAssembler.java
index 4d76f9c..26d1af0 100644
--- a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/bootstrap/EventsourcingAssembler.java
+++ b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/bootstrap/EventsourcingAssembler.java
@@ -14,7 +14,8 @@ import org.qi4j.library.eventsourcing.domain.factory.DomainEventFactoryService;
 
 
 public class EventsourcingAssembler
-        extends Assemblers.Visibility<EventsourcingAssembler> {
+        extends Assemblers.Visibility<EventsourcingAssembler>
+{
 
 
     private boolean domainEvents;
@@ -22,36 +23,43 @@ public class EventsourcingAssembler
 
     private boolean uowPrincipal;
 
-    public EventsourcingAssembler withDomainEvents() {
+    public EventsourcingAssembler withDomainEvents()
+    {
         domainEvents = true;
         return this;
     }
 
-    public EventsourcingAssembler withApplicationEvents() {
+    public EventsourcingAssembler withApplicationEvents()
+    {
         applicationEvents = true;
         return this;
     }
 
-    public EventsourcingAssembler withCurrentUserFromUOWPrincipal() {
+    public EventsourcingAssembler withCurrentUserFromUOWPrincipal()
+    {
         uowPrincipal = true;
         return this;
     }
 
 
     @Override
-    public void assemble(ModuleAssembly module) throws AssemblyException {
+    public void assemble(ModuleAssembly module) throws AssemblyException
+    {
 
-        if (domainEvents) {
+        if (domainEvents)
+        {
             module.values(DomainEventValue.class, UnitOfWorkDomainEventsValue.class);
             module.services(DomainEventFactoryService.class).visibleIn(visibility());
         }
 
-        if (applicationEvents) {
+        if (applicationEvents)
+        {
             module.values(ApplicationEvent.class, TransactionApplicationEvents.class);
             module.services(ApplicationEventFactoryService.class).visibleIn(visibility());
         }
 
-        if (uowPrincipal) {
+        if (uowPrincipal)
+        {
             module.importedServices(CurrentUserUoWPrincipal.class).importedBy(ImportedServiceDeclaration.NEW_OBJECT);
             module.objects(CurrentUserUoWPrincipal.class);
         }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/96c58b66/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java b/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java
index 5aa36dc..480b7f3 100644
--- a/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java
+++ b/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java
@@ -42,14 +42,17 @@ import static org.junit.Assert.assertEquals;
  * User signup usecase with optional mailing list subscription.
  * Subscription is not stored in domain model but is available via application events feed.
  */
-public class ApplicationEventTest extends AbstractQi4jTest {
+public class ApplicationEventTest
+        extends AbstractQi4jTest
+{
 
     @Service
     ApplicationEventSource eventSource;
 
 
     @Override
-    public void assemble(ModuleAssembly module) throws AssemblyException {
+    public void assemble(ModuleAssembly module) throws AssemblyException
+    {
 
         // START SNIPPET: assemblyAE
         new EventsourcingAssembler()
@@ -74,11 +77,14 @@ public class ApplicationEventTest extends AbstractQi4jTest {
 
 
     @Test
-    public void testApplicationEvent() throws UnitOfWorkCompletionException, IOException {
+    public void testApplicationEvent() throws UnitOfWorkCompletionException, IOException
+    {
         Users users = module.newTransient(Users.class);
 
-        Principal administratorPrincipal = new Principal() {
-            public String getName() {
+        Principal administratorPrincipal = new Principal()
+        {
+            public String getName()
+            {
                 return "administrator";
             }
         };
@@ -126,46 +132,57 @@ public class ApplicationEventTest extends AbstractQi4jTest {
 
     }
 
-    static class EventsInbox implements Output<TransactionApplicationEvents, RuntimeException> {
+    static class EventsInbox implements Output<TransactionApplicationEvents, RuntimeException>
+    {
 
         private List<TransactionApplicationEvents> events = new LinkedList<>();
 
         @Override
-        public <SenderThrowableType extends Throwable> void receiveFrom(Sender<? extends TransactionApplicationEvents, SenderThrowableType> sender) throws RuntimeException, SenderThrowableType {
-            try {
-                sender.sendTo(new Receiver<TransactionApplicationEvents, Throwable>() {
+        public <SenderThrowableType extends Throwable> void receiveFrom(Sender<? extends TransactionApplicationEvents, SenderThrowableType> sender) throws RuntimeException, SenderThrowableType
+        {
+            try
+            {
+                sender.sendTo(new Receiver<TransactionApplicationEvents, Throwable>()
+                {
                     @Override
-                    public void receive(TransactionApplicationEvents item) throws Throwable {
+                    public void receive(TransactionApplicationEvents item) throws Throwable
+                    {
                         events.add(item);
                     }
                 });
 
-            } catch (Throwable throwable) {
+            } catch (Throwable throwable)
+            {
                 throwable.printStackTrace();
             }
 
         }
 
-        public List<TransactionApplicationEvents> getEvents() {
+        public List<TransactionApplicationEvents> getEvents()
+        {
             return events;
         }
     }
 
+    // START SNIPPET: methodAE
     @Mixins(Users.Mixin.class)
-    public interface Users extends TransientComposite {
+    public interface Users extends TransientComposite
+    {
 
-        // START SNIPPET: methodAE
         void signup(@Optional ApplicationEvent evt, String username, List<String> mailinglists);
-        // END SNIPPET: methodAR
+        // END SNIPPET: methodAE
 
-        abstract class Mixin implements Users {
+        abstract class Mixin implements Users
+        {
 
             @Structure
             UnitOfWorkFactory uowFactory;
 
             @Override
-            public void signup(ApplicationEvent evt, String username, List<String> mailinglists) {
-                if (evt == null) {
+            public void signup(ApplicationEvent evt, String username, List<String> mailinglists)
+            {
+                if (evt == null)
+                {
                     UnitOfWork uow = uowFactory.currentUnitOfWork();
 
                     EntityBuilder<UserEntity> builder = uow.newEntityBuilder(UserEntity.class);
@@ -178,7 +195,8 @@ public class ApplicationEventTest extends AbstractQi4jTest {
     }
 
     public interface UserEntity
-            extends EntityComposite {
+            extends EntityComposite
+    {
 
         @UseDefaults
         Property<String> username();

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/96c58b66/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/DomainEventTest.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/DomainEventTest.java b/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/DomainEventTest.java
index 9d6cdc1..0d30d9e 100644
--- a/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/DomainEventTest.java
+++ b/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/DomainEventTest.java
@@ -58,11 +58,11 @@ public class DomainEventTest
                 .withDomainEvents()
                 .withCurrentUserFromUOWPrincipal()
                 .assemble(module);
-        // START SNIPPET: assemblyDE
+        // END SNIPPET: assemblyDE
 
         // START SNIPPET: storeDE
         module.services( MemoryEventStoreService.class );
-        // START SNIPPET: storeDE
+        // END SNIPPET: storeDE
 
         // START SNIPPET: concernDE
         module.entities( TestEntity.class ).withConcerns(DomainEventCreationConcern.class);