You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2016/10/22 07:18:46 UTC

[1/7] zest-java git commit: ZEST-183 : Removing library-eventsourcing.

Repository: zest-java
Updated Branches:
  refs/heads/develop 90401ddf2 -> e030bd8a5


http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/memory/MemoryEventStoreService.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/memory/MemoryEventStoreService.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/memory/MemoryEventStoreService.java
deleted file mode 100644
index 4cdce46..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/memory/MemoryEventStoreService.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.source.memory;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.ListIterator;
-import org.apache.zest.api.activation.Activators;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.service.ServiceComposite;
-import org.apache.zest.io.Input;
-import org.apache.zest.io.Output;
-import org.apache.zest.io.Receiver;
-import org.apache.zest.io.Sender;
-import org.apache.zest.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
-import org.apache.zest.library.eventsourcing.domain.source.AbstractEventStoreMixin;
-import org.apache.zest.library.eventsourcing.domain.source.EventSource;
-import org.apache.zest.library.eventsourcing.domain.source.EventStore;
-import org.apache.zest.library.eventsourcing.domain.source.EventStoreActivation;
-import org.apache.zest.library.eventsourcing.domain.source.EventStream;
-
-/**
- * In-Memory EventStore. Mainly used for testing.
- */
-@Mixins(MemoryEventStoreService.MemoryEventStoreMixin.class)
-@Activators( EventStoreActivation.Activator.class )
-public interface MemoryEventStoreService
-        extends EventSource, EventStore, EventStream, EventStoreActivation, ServiceComposite
-{
-    abstract class MemoryEventStoreMixin
-            extends AbstractEventStoreMixin
-            implements EventSource, EventStoreActivation
-    {
-        // This list holds all transactions
-        private LinkedList<UnitOfWorkDomainEventsValue> store = new LinkedList<UnitOfWorkDomainEventsValue>();
-
-        private long currentCount = 0;
-
-        public Input<UnitOfWorkDomainEventsValue, IOException> events( final long offset, final long limit )
-        {
-            if (offset < 0 || offset > count())
-                throw new IllegalArgumentException( "Offset must be between 0 and current number of events in the store" );
-
-            if (limit <= 0 )
-                throw new IllegalArgumentException( "Limit must be above 0" );
-
-            return new Input<UnitOfWorkDomainEventsValue, IOException>()
-            {
-                @Override
-                public <ReceiverThrowableType extends Throwable> void transferTo( Output<? super UnitOfWorkDomainEventsValue, ReceiverThrowableType> output ) throws IOException, ReceiverThrowableType
-                {
-                    // Lock store first
-                    lock.lock();
-                    try
-                    {
-                        output.receiveFrom( new Sender<UnitOfWorkDomainEventsValue, IOException>()
-                        {
-                            @Override
-                            public <ReceiverThrowableType extends Throwable> void sendTo( Receiver<? super UnitOfWorkDomainEventsValue, ReceiverThrowableType> receiver ) throws ReceiverThrowableType, IOException
-                            {
-                                ListIterator<UnitOfWorkDomainEventsValue> iterator = store.listIterator( (int) offset );
-
-                                long count = 0;
-
-                                while( iterator.hasNext() && count < limit )
-                                {
-                                    UnitOfWorkDomainEventsValue next = iterator.next();
-                                    receiver.receive( next );
-                                    count++;
-                                }
-                            }
-                        } );
-                    } finally
-                    {
-                        lock.unlock();
-                    }
-                }
-            };
-        }
-
-        @Override
-        public long count()
-        {
-            return currentCount;
-        }
-
-        @Override
-        protected Output<UnitOfWorkDomainEventsValue, IOException> storeEvents0()
-        {
-            return new Output<UnitOfWorkDomainEventsValue, IOException>()
-            {
-                @Override
-                public <SenderThrowableType extends Throwable> void receiveFrom( Sender<? extends UnitOfWorkDomainEventsValue, SenderThrowableType> sender ) throws IOException, SenderThrowableType
-                {
-                    final List<UnitOfWorkDomainEventsValue> newEvents = new ArrayList<UnitOfWorkDomainEventsValue>(  );
-                    sender.sendTo( new Receiver<UnitOfWorkDomainEventsValue, IOException>()
-                    {
-                        @Override
-                        public void receive( UnitOfWorkDomainEventsValue item ) throws IOException
-                        {
-                            newEvents.add( item );
-                        }
-                    });
-                    store.addAll( newEvents );
-                    currentCount += newEvents.size();
-                }
-            };
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/memory/package.html
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/memory/package.html b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/memory/package.html
deleted file mode 100644
index b01e7e4..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/memory/package.html
+++ /dev/null
@@ -1,24 +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>In-Memory EventStore.</h2>
-    </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/package.html
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/package.html b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/package.html
deleted file mode 100644
index 86bc4cd..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/package.html
+++ /dev/null
@@ -1,24 +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>EventSourcing Domain Source.</h2>
-    </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/spi/CurrentUser.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/spi/CurrentUser.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/spi/CurrentUser.java
deleted file mode 100644
index 62287fc..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/spi/CurrentUser.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.spi;
-
-/**
- * Return username of current user. This needs to be implemented and provided
- * as a service so that the DomainEventFactory can associate events with a particular user.
- */
-public interface CurrentUser
-{
-    String getCurrentUser();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/spi/package.html
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/spi/package.html b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/spi/package.html
deleted file mode 100644
index a5ff3c0..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/spi/package.html
+++ /dev/null
@@ -1,24 +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>EventSourcing Domain SPI.</h2>
-    </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/application/ApplicationEventTest.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/application/ApplicationEventTest.java b/libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/application/ApplicationEventTest.java
deleted file mode 100644
index fd56c2b..0000000
--- a/libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/application/ApplicationEventTest.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.zest.library.eventsourcing.application;
-
-import org.junit.Test;
-import org.apache.zest.api.common.Optional;
-import org.apache.zest.api.common.UseDefaults;
-import org.apache.zest.api.composite.TransientComposite;
-import org.apache.zest.api.entity.EntityBuilder;
-import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.api.injection.scope.Service;
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.unitofwork.UnitOfWork;
-import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
-import org.apache.zest.api.usecase.UsecaseBuilder;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.io.Output;
-import org.apache.zest.io.Receiver;
-import org.apache.zest.io.Sender;
-import org.apache.zest.library.eventsourcing.application.api.ApplicationEvent;
-import org.apache.zest.library.eventsourcing.application.api.TransactionApplicationEvents;
-import org.apache.zest.library.eventsourcing.application.factory.ApplicationEventCreationConcern;
-import org.apache.zest.library.eventsourcing.application.source.ApplicationEventSource;
-import org.apache.zest.library.eventsourcing.application.source.helper.ApplicationEventParameters;
-import org.apache.zest.library.eventsourcing.application.source.memory.MemoryApplicationEventStoreService;
-import org.apache.zest.library.eventsourcing.bootstrap.EventsourcingAssembler;
-import org.apache.zest.test.AbstractZestTest;
-import org.apache.zest.test.EntityTestAssembler;
-
-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 AbstractZestTest
-{
-    @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 Exception
-    {
-        Users users = transientBuilderFactory.newTransient( Users.class );
-
-        Principal administratorPrincipal = new Principal()
-        {
-            @Override
-            public String getName()
-            {
-                return "administrator";
-            }
-        };
-
-        UnitOfWork uow1 = unitOfWorkFactory.newUnitOfWork( UsecaseBuilder.newUsecase( "User signup" ) );
-        uow1.setMetaInfo( administratorPrincipal );
-        users.signup( null, "user1", Arrays.asList( "news-a", "news-b" ) );
-        uow1.complete();
-
-        Thread.sleep( 1 ); // For UoWs not getting the same `currentTime`
-
-        UnitOfWork uow2 = unitOfWorkFactory.newUnitOfWork();
-        uow2.setMetaInfo( administratorPrincipal );
-        users.signup( null, "user2", Collections.EMPTY_LIST );
-        uow2.complete();
-
-        Thread.sleep( 1 ); // For UoWs not getting the same `currentTime`
-
-        UnitOfWork uow3 = unitOfWorkFactory.newUnitOfWork();
-        uow3.setMetaInfo( administratorPrincipal );
-        users.signup( null, "user3", Collections.singletonList( "news-c" ) );
-        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 );
-        ApplicationEvent signupEvent3 = afterInbox.getEvents().get( 1 ).events().get().get( 0 );
-
-        assertEquals( "signup", signupEvent2.name().get() );
-        assertEquals( "user2", ApplicationEventParameters.getParameter( signupEvent2, "param1" ) );
-        assertEquals( "[]", ApplicationEventParameters.getParameter( signupEvent2, "param2" ) );
-
-        assertEquals( "signup", signupEvent3.name().get() );
-        assertEquals( "user3", ApplicationEventParameters.getParameter( signupEvent3, "param1" ) );
-        assertEquals( "[\"news-c\"]", ApplicationEventParameters.getParameter( signupEvent3, "param2" ) );
-
-        // receive events from uow2 backwards
-        EventsInbox beforeInbox = new EventsInbox();
-        eventSource.transactionsBefore( uow3.currentTime(), Integer.MAX_VALUE ).transferTo( beforeInbox );
-
-        assertEquals( 2, beforeInbox.getEvents().size() );
-
-        signupEvent2 = beforeInbox.getEvents().get( 0 ).events().get().get( 0 );
-        ApplicationEvent signupEvent1 = beforeInbox.getEvents().get( 1 ).events().get().get( 0 );
-
-        assertEquals( "signup", signupEvent2.name().get() );
-        assertEquals( "user2", ApplicationEventParameters.getParameter( signupEvent2, "param1" ) );
-        assertEquals( "[]", ApplicationEventParameters.getParameter( signupEvent2, "param2" ) );
-
-        assertEquals( "signup", signupEvent1.name().get());
-        assertEquals( "user1", ApplicationEventParameters.getParameter( signupEvent1, "param1" ) );
-        assertEquals( "[\"news-a\",\"news-b\"]", 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;
-        }
-    }
-
-    // START SNIPPET: methodAE
-    @Mixins( Users.Mixin.class )
-    public interface Users extends TransientComposite
-    {
-        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 )
-            {
-                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-java/blob/d9569cd6/libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/domain/DomainEventTest.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/domain/DomainEventTest.java b/libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/domain/DomainEventTest.java
deleted file mode 100644
index 036a102..0000000
--- a/libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/domain/DomainEventTest.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain;
-
-import java.util.function.Function;
-import org.junit.Test;
-import org.apache.zest.api.common.UseDefaults;
-import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.unitofwork.UnitOfWork;
-import org.apache.zest.api.unitofwork.UnitOfWorkCompletionException;
-import org.apache.zest.api.usecase.UsecaseBuilder;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.io.Outputs;
-import org.apache.zest.io.Transforms;
-import org.apache.zest.library.eventsourcing.bootstrap.EventsourcingAssembler;
-import org.apache.zest.library.eventsourcing.domain.api.DomainEvent;
-import org.apache.zest.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
-import org.apache.zest.library.eventsourcing.domain.factory.DomainEventCreationConcern;
-import org.apache.zest.library.eventsourcing.domain.source.EventSource;
-import org.apache.zest.library.eventsourcing.domain.source.memory.MemoryEventStoreService;
-import org.apache.zest.test.AbstractZestTest;
-import org.apache.zest.test.EntityTestAssembler;
-
-import java.io.IOException;
-import java.security.Principal;
-
-/**
- * JAVADOC
- */
-public class DomainEventTest
-    extends AbstractZestTest
-{
-    public void assemble( ModuleAssembly module ) throws AssemblyException
-    {
-        new EntityTestAssembler(  ).assemble( module );
-
-        // START SNIPPET: assemblyDE
-        new EventsourcingAssembler()
-                .withDomainEvents()
-                .withCurrentUserFromUOWPrincipal()
-                .assemble(module);
-        // END SNIPPET: assemblyDE
-
-        // START SNIPPET: storeDE
-        module.services( MemoryEventStoreService.class );
-        // END SNIPPET: storeDE
-
-        // START SNIPPET: concernDE
-        module.entities( TestEntity.class ).withConcerns(DomainEventCreationConcern.class);
-        // END SNIPPET: concernDE
-    }
-
-    @Test
-    public void testDomainEvent() throws UnitOfWorkCompletionException, IOException
-    {
-        // Set principal for the UoW
-        Principal administratorPrincipal = new Principal()
-        {
-            public String getName()
-            {
-                return "administrator";
-            }
-        };
-
-        // Perform UoW with usecase defined
-        UnitOfWork uow = unitOfWorkFactory.newUnitOfWork( UsecaseBuilder.newUsecase( "Change description" ));
-        uow.setMetaInfo( administratorPrincipal );
-
-        TestEntity entity = uow.newEntity( TestEntity.class );
-        entity.changedDescription( "New description" );
-        uow.complete();
-
-        // Print events
-        EventSource source = serviceFinder.findService( EventSource.class ).get();
-
-        source.events( 0, Long.MAX_VALUE ).transferTo( Transforms.map( new Function<UnitOfWorkDomainEventsValue, String>()
-                {
-                    public String apply( UnitOfWorkDomainEventsValue unitOfWorkDomainEventsValue )
-                    {
-                        return unitOfWorkDomainEventsValue.toString();
-                    }
-                }, Outputs.systemOut() ));
-    }
-
-    // START SNIPPET: methodDE
-    @Mixins( TestEntity.Mixin.class )
-    public interface TestEntity
-        extends EntityComposite
-    {
-        @UseDefaults
-        Property<String> description();
-
-        @DomainEvent
-        void changedDescription( String newName );
-
-        abstract class Mixin
-            implements TestEntity
-        {
-            public void changedDescription( String newName )
-            {
-                description().set( newName );
-            }
-        }
-    }
-    // END SNIPPET: methodDE
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/domain/source/helper/DomainEventTrackerTest.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/domain/source/helper/DomainEventTrackerTest.java b/libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/domain/source/helper/DomainEventTrackerTest.java
deleted file mode 100644
index 822c814..0000000
--- a/libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/domain/source/helper/DomainEventTrackerTest.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.source.helper;
-
-import java.io.IOException;
-import java.security.Principal;
-import java.util.function.Function;
-import org.junit.Test;
-import org.apache.zest.api.activation.ActivatorAdapter;
-import org.apache.zest.api.activation.Activators;
-import org.apache.zest.api.common.UseDefaults;
-import org.apache.zest.api.configuration.Configuration;
-import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.api.injection.scope.Service;
-import org.apache.zest.api.injection.scope.This;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.service.ServiceComposite;
-import org.apache.zest.api.service.ServiceReference;
-import org.apache.zest.api.unitofwork.UnitOfWork;
-import org.apache.zest.api.unitofwork.UnitOfWorkCompletionException;
-import org.apache.zest.api.usecase.UsecaseBuilder;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ImportedServiceDeclaration;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.io.Output;
-import org.apache.zest.io.Outputs;
-import org.apache.zest.io.Transforms;
-import org.apache.zest.library.eventsourcing.domain.api.DomainEvent;
-import org.apache.zest.library.eventsourcing.domain.api.DomainEventValue;
-import org.apache.zest.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
-import org.apache.zest.library.eventsourcing.domain.factory.CurrentUserUoWPrincipal;
-import org.apache.zest.library.eventsourcing.domain.factory.DomainEventCreationConcern;
-import org.apache.zest.library.eventsourcing.domain.factory.DomainEventFactoryService;
-import org.apache.zest.library.eventsourcing.domain.source.EventSource;
-import org.apache.zest.library.eventsourcing.domain.source.EventStream;
-import org.apache.zest.library.eventsourcing.domain.source.memory.MemoryEventStoreService;
-import org.apache.zest.test.AbstractZestTest;
-import org.apache.zest.test.EntityTestAssembler;
-
-public class DomainEventTrackerTest
-    extends AbstractZestTest
-{
-    public void assemble( ModuleAssembly module ) throws AssemblyException
-    {
-        new EntityTestAssembler(  ).assemble( module );
-
-        module.values( DomainEventValue.class, UnitOfWorkDomainEventsValue.class );
-        module.services( MemoryEventStoreService.class );
-        module.services( DomainEventFactoryService.class );
-        module.importedServices( CurrentUserUoWPrincipal.class ).importedBy( ImportedServiceDeclaration.NEW_OBJECT );
-        module.objects( CurrentUserUoWPrincipal.class );
-
-        module.entities( TestEntity.class ).withConcerns( DomainEventCreationConcern.class );
-
-        module.services( EventLoggingService.class ).instantiateOnStartup();
-        module.entities( DomainEventTrackerConfiguration.class );
-    }
-
-    @Test
-    public void testDomainEvent() throws UnitOfWorkCompletionException, IOException
-    {
-        UnitOfWork uow = unitOfWorkFactory.newUnitOfWork( UsecaseBuilder.newUsecase( "Change description" ));
-        uow.setMetaInfo( new Principal()
-        {
-            public String getName()
-            {
-                return "administrator";
-            }
-        });
-
-        TestEntity entity = uow.newEntity( TestEntity.class );
-        entity.changeDescription( "New description" );
-        uow.complete();
-
-        try
-        {
-            Thread.sleep( 5000 );
-        } catch (InterruptedException e)
-        {
-            e.printStackTrace();
-        }
-    }
-
-    @Mixins( TestEntity.Mixin.class )
-    public interface TestEntity
-        extends EntityComposite
-    {
-        @UseDefaults
-        Property<String> description();
-
-        @DomainEvent
-        void changeDescription( String newName );
-
-        abstract class Mixin
-            implements TestEntity
-        {
-            public void changeDescription( String newName )
-            {
-                description().set( newName );
-            }
-        }
-    }
-
-    @Mixins(EventLoggingService.Mixin.class)
-    @Activators( EventLoggingService.Activator.class )
-    public interface EventLoggingService
-        extends ServiceComposite, Configuration<DomainEventTrackerConfiguration>
-    {
-        
-        void startTracker();
-        
-        void stopTracker();
-        
-        public class Activator
-                extends ActivatorAdapter<ServiceReference<EventLoggingService>>
-        {
-
-            @Override
-            public void afterActivation( ServiceReference<EventLoggingService> activated )
-                    throws Exception
-            {
-                activated.get().startTracker();
-            }
-
-            @Override
-            public void beforePassivation( ServiceReference<EventLoggingService> passivating )
-                    throws Exception
-            {
-                passivating.get().stopTracker();
-            }
-
-        }
-        
-        public abstract class Mixin implements EventLoggingService
-        {
-            DomainEventTracker tracker;
-
-            @This
-            Configuration<DomainEventTrackerConfiguration> config;
-
-            @Service
-            EventStream eventStream;
-
-            @Service
-            EventSource eventSource;
-
-            public void startTracker()
-            {
-                config.get().enabled().set( true );
-
-               Output<UnitOfWorkDomainEventsValue,RuntimeException> map = Transforms.map( new Function<UnitOfWorkDomainEventsValue, String>()
-                       {
-                           public String apply( UnitOfWorkDomainEventsValue unitOfWorkDomainEventsValue )
-                           {
-                               return unitOfWorkDomainEventsValue.toString();
-                           }
-                       }, Outputs.systemOut() );
-               tracker = new DomainEventTracker(eventStream, eventSource, config, map);
-
-                tracker.start();
-            }
-
-            public void stopTracker()
-            {
-                tracker.stop();
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/domain/source/helper/EventRouterTest.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/domain/source/helper/EventRouterTest.java b/libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/domain/source/helper/EventRouterTest.java
deleted file mode 100644
index e85b5a4..0000000
--- a/libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/domain/source/helper/EventRouterTest.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.zest.library.eventsourcing.domain.source.helper;
-
-import java.io.IOException;
-import java.time.Instant;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.zest.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
-import org.apache.zest.valueserialization.orgjson.OrgJsonValueSerializationService;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.junit.Before;
-import org.junit.Test;
-import org.apache.zest.api.activation.ActivationException;
-import org.apache.zest.api.value.ValueBuilder;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.bootstrap.SingletonAssembler;
-import org.apache.zest.io.Inputs;
-import org.apache.zest.io.Receiver;
-import org.apache.zest.library.eventsourcing.domain.api.DomainEventValue;
-import org.apache.zest.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
-
-import static org.junit.Assert.assertEquals;
-import static org.apache.zest.test.util.JSONAssert.jsonObjectsEquals;
-
-public class EventRouterTest
-{
-    private List<UnitOfWorkDomainEventsValue> list;
-
-    @Before
-    public void testData()
-        throws ActivationException, AssemblyException
-    {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module ) throws AssemblyException
-            {
-                module.services( OrgJsonValueSerializationService.class );
-                module.values( UnitOfWorkDomainEventsValue.class, DomainEventValue.class );
-                new DefaultUnitOfWorkAssembler().assemble( module );
-            }
-        };
-
-        list = new ArrayList<UnitOfWorkDomainEventsValue>(  );
-        {
-            ValueBuilder<UnitOfWorkDomainEventsValue> builder = assembler.module().newValueBuilder( UnitOfWorkDomainEventsValue.class );
-            builder.prototype().events().get().add( newDomainEvent( assembler, "Test1" ) );
-            builder.prototype().events().get().add( newDomainEvent( assembler, "Test2" ) );
-            builder.prototype().events().get().add( newDomainEvent( assembler, "Test3" ) );
-            builder.prototype().version().set( "1.0" );
-            builder.prototype().timestamp().set( Instant.now() );
-            builder.prototype().usecase().set( "Test" );
-            list.add( builder.newInstance() );
-        }
-        {
-            ValueBuilder<UnitOfWorkDomainEventsValue> builder = assembler.module().newValueBuilder( UnitOfWorkDomainEventsValue.class );
-            builder.prototype().events().get().add( newDomainEvent( assembler, "Test4" ) );
-            builder.prototype().events().get().add( newDomainEvent( assembler, "Test5" ) );
-            builder.prototype().events().get().add( newDomainEvent( assembler, "Test6" ) );
-            builder.prototype().version().set( "1.0" );
-            builder.prototype().timestamp().set( Instant.now() );
-            builder.prototype().usecase().set( "Test2" );
-            list.add( builder.newInstance() );
-        }
-    }
-
-    private DomainEventValue newDomainEvent( SingletonAssembler assembler, String name )
-    {
-        ValueBuilder<DomainEventValue> eventBuilder = assembler.module().newValueBuilder( DomainEventValue.class );
-        eventBuilder.prototype().entityId().set( "123" );
-        eventBuilder.prototype().entityType().set( "Foo" );
-        eventBuilder.prototype().parameters().set( "{}" );
-        eventBuilder.prototype().name().set( name );
-        return eventBuilder.newInstance();
-    }
-
-    @Test
-    public void testRouter() throws IOException, JSONException
-    {
-        final List<DomainEventValue> matched = new ArrayList<DomainEventValue>(  );
-        EventRouter<IOException> router = new EventRouter<IOException>();
-        router.route( Events.withNames( "Test1", "Test2" ), new Receiver<DomainEventValue,IOException>()
-        {
-            @Override
-            public void receive( DomainEventValue item ) throws IOException
-            {
-                matched.add(item);
-            }
-        });
-
-        Inputs.iterable( Events.events( list ) ).transferTo( router );
-
-        assertEquals( 2, matched.size() );
-        jsonObjectsEquals( new JSONObject( matched.get( 0 ).toString() ),
-                                      new JSONObject( "{\"name\":\"Test1\",\"entityType\":\"Foo\",\"entityId\":\"123\",\"parameters\":\"{}\"}" ) );
-        jsonObjectsEquals( new JSONObject( matched.get( 1 ).toString() ),
-                                      new JSONObject( "{\"name\":\"Test2\",\"entityType\":\"Foo\",\"entityId\":\"123\",\"parameters\":\"{}\"}" ) );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/domain/source/helper/EventsTest.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/domain/source/helper/EventsTest.java b/libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/domain/source/helper/EventsTest.java
deleted file mode 100644
index a466f83..0000000
--- a/libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/domain/source/helper/EventsTest.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.zest.library.eventsourcing.domain.source.helper;
-
-import java.time.Instant;
-import org.apache.zest.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
-import org.apache.zest.valueserialization.orgjson.OrgJsonValueSerializationService;
-import org.junit.Before;
-import org.junit.Test;
-import org.apache.zest.api.activation.ActivationException;
-import org.apache.zest.api.value.ValueBuilder;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.bootstrap.SingletonAssembler;
-import org.apache.zest.library.eventsourcing.domain.api.DomainEventValue;
-import org.apache.zest.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertThat;
-import static org.apache.zest.functional.Iterables.count;
-import static org.apache.zest.io.Inputs.iterable;
-import static org.apache.zest.io.Outputs.systemOut;
-import static org.apache.zest.library.eventsourcing.domain.source.helper.Events.events;
-
-/**
- * TODO
- */
-public class EventsTest
-{
-    private List<UnitOfWorkDomainEventsValue> list;
-
-    @Before
-    public void testData()
-        throws ActivationException, AssemblyException
-    {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module ) throws AssemblyException
-            {
-                module.services( OrgJsonValueSerializationService.class );
-                module.values( UnitOfWorkDomainEventsValue.class, DomainEventValue.class );
-                new DefaultUnitOfWorkAssembler().assemble( module );
-            }
-        };
-
-        list = new ArrayList<UnitOfWorkDomainEventsValue>(  );
-        {
-            ValueBuilder<UnitOfWorkDomainEventsValue> builder = assembler.module().newValueBuilder( UnitOfWorkDomainEventsValue.class );
-            builder.prototype().events().get().add( newDomainEvent( assembler, "Test1" ) );
-            builder.prototype().events().get().add( newDomainEvent( assembler, "Test2" ) );
-            builder.prototype().events().get().add( newDomainEvent( assembler, "Test3" ) );
-            builder.prototype().version().set( "1.0" );
-            builder.prototype().timestamp().set( Instant.now() );
-            builder.prototype().usecase().set( "Test" );
-            list.add( builder.newInstance() );
-        }
-        {
-            ValueBuilder<UnitOfWorkDomainEventsValue> builder = assembler.module().newValueBuilder( UnitOfWorkDomainEventsValue.class );
-            builder.prototype().events().get().add( newDomainEvent( assembler, "Test4" ) );
-            builder.prototype().events().get().add( newDomainEvent( assembler, "Test5" ) );
-            builder.prototype().events().get().add( newDomainEvent( assembler, "Test6" ) );
-            builder.prototype().version().set( "1.0" );
-            builder.prototype().timestamp().set( Instant.now() );
-            builder.prototype().usecase().set( "Test2" );
-            list.add( builder.newInstance() );
-        }
-    }
-
-    private DomainEventValue newDomainEvent( SingletonAssembler assembler, String name )
-    {
-        ValueBuilder<DomainEventValue> eventBuilder = assembler.module().newValueBuilder( DomainEventValue.class );
-        eventBuilder.prototype().entityId().set( "123" );
-        eventBuilder.prototype().entityType().set( "Foo" );
-        eventBuilder.prototype().parameters().set( "{}" );
-        eventBuilder.prototype().name().set( name );
-        return eventBuilder.newInstance();
-    }
-
-    @Test
-    public void testIterablesEvents()
-    {
-        assertThat( count( events( list ) ), equalTo( 6L ) );
-
-        iterable( events( list ) ).transferTo( systemOut() );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/domain/source/helper/UnitOfWorkRouterTest.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/domain/source/helper/UnitOfWorkRouterTest.java b/libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/domain/source/helper/UnitOfWorkRouterTest.java
deleted file mode 100644
index 2ade4ce..0000000
--- a/libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/domain/source/helper/UnitOfWorkRouterTest.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.zest.library.eventsourcing.domain.source.helper;
-
-import java.time.Instant;
-import org.apache.zest.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
-import org.apache.zest.valueserialization.orgjson.OrgJsonValueSerializationService;
-import org.hamcrest.CoreMatchers;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.apache.zest.api.activation.ActivationException;
-import org.apache.zest.api.value.ValueBuilder;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.bootstrap.SingletonAssembler;
-import org.apache.zest.io.Inputs;
-import org.apache.zest.io.Receiver;
-import org.apache.zest.library.eventsourcing.domain.api.DomainEventValue;
-import org.apache.zest.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * TODO
- */
-public class UnitOfWorkRouterTest
-{
-    private List<UnitOfWorkDomainEventsValue> list;
-
-    @Before
-    public void testData()
-        throws ActivationException, AssemblyException
-    {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module ) throws AssemblyException
-            {
-                module.services( OrgJsonValueSerializationService.class );
-                module.values( UnitOfWorkDomainEventsValue.class, DomainEventValue.class );
-                new DefaultUnitOfWorkAssembler().assemble( module );
-            }
-        };
-
-        list = new ArrayList<UnitOfWorkDomainEventsValue>(  );
-        {
-            ValueBuilder<UnitOfWorkDomainEventsValue> builder = assembler.module().newValueBuilder( UnitOfWorkDomainEventsValue.class );
-            builder.prototype().events().get().add( newDomainEvent( assembler, "Test1" ));
-            builder.prototype().events().get().add( newDomainEvent( assembler, "Test2" ));
-            builder.prototype().events().get().add( newDomainEvent( assembler, "Test3" ));
-            builder.prototype().version().set( "1.0" );
-            builder.prototype().timestamp().set( Instant.now() );
-            builder.prototype().usecase().set( "Test" );
-            list.add( builder.newInstance() );
-        }
-        {
-            ValueBuilder<UnitOfWorkDomainEventsValue> builder = assembler.module().newValueBuilder( UnitOfWorkDomainEventsValue.class );
-            builder.prototype().events().get().add( newDomainEvent( assembler, "Test4" ));
-            builder.prototype().events().get().add( newDomainEvent( assembler, "Test5" ));
-            builder.prototype().events().get().add( newDomainEvent( assembler, "Test6" ));
-            builder.prototype().version().set( "1.0" );
-            builder.prototype().timestamp().set( Instant.now() );
-            builder.prototype().usecase().set( "Test2" );
-            list.add( builder.newInstance() );
-        }
-    }
-
-    private DomainEventValue newDomainEvent( SingletonAssembler assembler, String name )
-    {
-        ValueBuilder<DomainEventValue> eventBuilder = assembler.module().newValueBuilder( DomainEventValue.class );
-        eventBuilder.prototype().entityId().set( "123" );
-        eventBuilder.prototype().entityType().set( "Foo" );
-        eventBuilder.prototype().parameters().set( "{}" );
-        eventBuilder.prototype().name().set( name );
-        return eventBuilder.newInstance();
-    }
-
-    @Test
-    public void testRouter() throws IOException
-    {
-        final List<String> matched = new ArrayList<String>(  );
-        UnitOfWorkRouter<IOException> router = new UnitOfWorkRouter<IOException>();
-        router.route( Events.withUsecases( "Test" ), new Receiver<UnitOfWorkDomainEventsValue,IOException>()
-        {
-            @Override
-            public void receive( UnitOfWorkDomainEventsValue item ) throws IOException
-            {
-                matched.add(item.usecase().get());
-            }
-        });
-
-        EventRouter<IOException> eventRouter = new EventRouter<IOException>();
-        eventRouter.defaultReceiver(new Receiver<DomainEventValue, IOException>()
-        {
-            @Override
-            public void receive( DomainEventValue item ) throws IOException
-            {
-                System.out.println(item);
-            }
-        });
-
-        router.defaultReceiver(eventRouter);
-
-        Inputs.iterable( list ).transferTo( router );
-
-        Assert.assertThat( matched.toString(), CoreMatchers.equalTo( "[Test]" ) );
-    }
-
-    @Test(expected = IOException.class)
-    public void testRouterException() throws IOException
-    {
-        final List<String> matched = new ArrayList<String>(  );
-        UnitOfWorkRouter<IOException> router = new UnitOfWorkRouter<IOException>();
-        router.route( Events.withUsecases( "Test2" ), new Receiver<UnitOfWorkDomainEventsValue,IOException>()
-        {
-            @Override
-            public void receive( UnitOfWorkDomainEventsValue item ) throws IOException
-            {
-                throw new IOException("Failed");
-            }
-        });
-
-        EventRouter<IOException> eventRouter = new EventRouter<IOException>();
-        eventRouter.defaultReceiver(new Receiver<DomainEventValue, IOException>()
-        {
-            @Override
-            public void receive( DomainEventValue item ) throws IOException
-            {
-                System.out.println(item);
-            }
-        });
-
-        router.defaultReceiver(eventRouter);
-
-        Inputs.iterable( list ).transferTo( router );
-
-        Assert.assertThat( matched.toString(), CoreMatchers.equalTo( "[Test]" ) );
-    }
-}


[2/7] zest-java git commit: ZEST-183 : Removing library-eventsourcing.

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/DomainEventCreationConcern.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/DomainEventCreationConcern.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/DomainEventCreationConcern.java
deleted file mode 100644
index 8490112..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/DomainEventCreationConcern.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.factory;
-
-import java.lang.reflect.Method;
-import org.apache.zest.api.common.AppliesTo;
-import org.apache.zest.api.concern.GenericConcern;
-import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.api.injection.scope.Service;
-import org.apache.zest.api.injection.scope.This;
-import org.apache.zest.library.eventsourcing.domain.api.DomainEvent;
-import org.apache.zest.library.eventsourcing.domain.api.DomainEventValue;
-import org.apache.zest.library.eventsourcing.domain.api.DomainEvents;
-
-/**
- * Generate event for event method
- */
-@AppliesTo(DomainEvent.class)
-public class DomainEventCreationConcern
-        extends GenericConcern
-{
-    @This
-    private EntityComposite entity;
-
-    @Service
-    private DomainEventFactory domainEventFactory;
-
-    @Override
-    public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable
-    {
-        if (DomainEvents.currentEvent() == null)
-        {
-            // Create eventValue
-            DomainEventValue eventValue = domainEventFactory.createEvent( entity, method.getName(), args );
-            DomainEvents.setCurrentEvent( eventValue );
-            try
-            {
-                return next.invoke( proxy, method, args );
-            } finally
-            {
-                DomainEvents.setCurrentEvent( null );
-            }
-
-        } else
-        {
-            // This is probably a replay call
-            return next.invoke( proxy, method, args );
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/DomainEventFactory.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/DomainEventFactory.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/DomainEventFactory.java
deleted file mode 100644
index 2b7be4a..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/DomainEventFactory.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.factory;
-
-import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.library.eventsourcing.domain.api.DomainEventValue;
-
-/**
- * Factory for DomainEvents
- */
-public interface DomainEventFactory
-{
-    DomainEventValue createEvent( EntityComposite entity, String name, Object[] args );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/DomainEventFactoryService.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/DomainEventFactoryService.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/DomainEventFactoryService.java
deleted file mode 100644
index cdfd1a6..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/DomainEventFactoryService.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.factory;
-
-import org.apache.zest.api.ZestAPI;
-import org.apache.zest.api.concern.Concerns;
-import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.service.ServiceComposite;
-import org.apache.zest.api.value.ValueBuilder;
-import org.apache.zest.api.value.ValueBuilderFactory;
-import org.apache.zest.library.eventsourcing.domain.api.DomainEventValue;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.json.JSONStringer;
-import org.json.JSONWriter;
-
-/**
- * DomainEventValue factory
- */
-@Concerns( UnitOfWorkNotificationConcern.class )
-@Mixins( DomainEventFactoryService.DomainEventFactoryMixin.class )
-public interface DomainEventFactoryService
-    extends DomainEventFactory, ServiceComposite
-{
-    class DomainEventFactoryMixin
-        implements DomainEventFactory
-    {
-        @Structure
-        private ValueBuilderFactory vbf;
-
-        @Override
-        public DomainEventValue createEvent( EntityComposite entity, String name, Object[] args )
-        {
-            ValueBuilder<DomainEventValue> builder = vbf.newValueBuilder( DomainEventValue.class );
-
-            DomainEventValue prototype = builder.prototype();
-            prototype.name().set( name );
-            prototype.entityType().set( ZestAPI.FUNCTION_DESCRIPTOR_FOR.apply( entity )
-                                            .types()
-                                            .findFirst()
-                                            .get()
-                                            .getName() );
-            prototype.entityId().set( entity.identity().get() );
-
-            // JSON-ify parameters
-            JSONStringer json = new JSONStringer();
-            try
-            {
-                JSONWriter params = json.object();
-                for( int i = 0; i < args.length; i++ )
-                {
-                    params.key( "param" + i );
-                    if( args[ i ] == null )
-                    {
-                        params.value( JSONObject.NULL );
-                    }
-                    else
-                    {
-                        params.value( args[ i ] );
-                    }
-                }
-                json.endObject();
-            }
-            catch( JSONException e )
-            {
-                throw new IllegalArgumentException( "Could not create eventValue", e );
-            }
-            prototype.parameters().set( json.toString() );
-            return builder.newInstance();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/UnitOfWorkEvents.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/UnitOfWorkEvents.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/UnitOfWorkEvents.java
deleted file mode 100644
index 70f0b37..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/UnitOfWorkEvents.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.factory;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.zest.library.eventsourcing.domain.api.DomainEventValue;
-
-/**
- * List of eventValues for the current UnitOfWork. This will be updated by the DomainEventFactory.
- */
-class UnitOfWorkEvents
-{
-    private List<DomainEventValue> eventValues = new ArrayList<DomainEventValue>();
-
-    public void add( DomainEventValue eventValue )
-    {
-        eventValues.add( eventValue );
-    }
-
-    public List<DomainEventValue> getEventValues()
-    {
-        return eventValues;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/UnitOfWorkNotificationConcern.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/UnitOfWorkNotificationConcern.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/UnitOfWorkNotificationConcern.java
deleted file mode 100644
index 7ac8f2a..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/UnitOfWorkNotificationConcern.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.factory;
-
-import java.io.IOException;
-import java.time.Instant;
-import org.apache.zest.api.ZestAPI;
-import org.apache.zest.api.concern.ConcernOf;
-import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.api.injection.scope.Service;
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.structure.Application;
-import org.apache.zest.api.unitofwork.UnitOfWork;
-import org.apache.zest.api.unitofwork.UnitOfWorkCallback;
-import org.apache.zest.api.unitofwork.UnitOfWorkCompletionException;
-import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
-import org.apache.zest.api.value.ValueBuilder;
-import org.apache.zest.api.value.ValueBuilderFactory;
-import org.apache.zest.functional.Iterables;
-import org.apache.zest.io.Inputs;
-import org.apache.zest.io.Output;
-import org.apache.zest.library.eventsourcing.domain.api.DomainEventValue;
-import org.apache.zest.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
-import org.apache.zest.library.eventsourcing.domain.source.EventStore;
-import org.apache.zest.library.eventsourcing.domain.source.UnitOfWorkEventsVisitor;
-import org.apache.zest.library.eventsourcing.domain.spi.CurrentUser;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Notify event listeners when a complete UoW of domain events is available.
- */
-public class UnitOfWorkNotificationConcern
-        extends ConcernOf<DomainEventFactory>
-        implements DomainEventFactory
-{
-    @Service
-    EventStore eventStore;
-
-    @Service
-    Iterable<UnitOfWorkEventsVisitor> transactionVisitors;
-
-    @Service
-    CurrentUser currentUser;
-
-    @Structure
-    ValueBuilderFactory vbf;
-
-    @Structure
-    UnitOfWorkFactory uowf;
-
-    @Structure
-    ZestAPI api;
-
-    String version;
-
-    Logger logger = LoggerFactory.getLogger( DomainEventFactory.class );
-
-    Output<UnitOfWorkDomainEventsValue, IOException> eventOutput;
-
-    public void init( @Structure Application application )
-    {
-        version = application.version();
-        eventOutput = eventStore.storeEvents();
-    }
-
-    @Override
-    public DomainEventValue createEvent( EntityComposite entity, String name, Object[] args )
-    {
-        final UnitOfWork unitOfWork = uowf.currentUnitOfWork();
-
-        DomainEventValue eventValue = next.createEvent( api.dereference( entity ), name, args );
-
-        // Add eventValue to list in UoW
-        UnitOfWorkEvents events = unitOfWork.metaInfo(UnitOfWorkEvents.class );
-        if (events == null)
-        {
-            events = new UnitOfWorkEvents();
-            unitOfWork.setMetaInfo( events );
-
-            unitOfWork.addUnitOfWorkCallback( new UnitOfWorkCallback()
-            {
-                String user;
-
-                @Override
-                public void beforeCompletion() throws UnitOfWorkCompletionException
-                {
-                    user = currentUser.getCurrentUser();
-                }
-
-                @Override
-                public void afterCompletion( UnitOfWorkStatus status )
-                {
-                    if (status.equals( UnitOfWorkStatus.COMPLETED ))
-                    {
-                        UnitOfWorkEvents events = unitOfWork.metaInfo( UnitOfWorkEvents.class );
-
-                        ValueBuilder<UnitOfWorkDomainEventsValue> builder = vbf.newValueBuilder( UnitOfWorkDomainEventsValue.class );
-                        builder.prototype().user().set( user );
-                        builder.prototype().timestamp().set( Instant.now() );
-                        builder.prototype().usecase().set( unitOfWork.usecase().name() );
-                        builder.prototype().version().set( version );
-                        builder.prototype().events().get().addAll( events.getEventValues() );
-
-                        try
-                        {
-                            final UnitOfWorkDomainEventsValue unitOfWorkDomainValue = builder.newInstance();
-                            Inputs.iterable( Iterables.iterable( unitOfWorkDomainValue ) ).transferTo( eventOutput );
-
-                            for (UnitOfWorkEventsVisitor unitOfWorkEventsVisitor : transactionVisitors)
-                            {
-                                try
-                                {
-                                    unitOfWorkEventsVisitor.visit( unitOfWorkDomainValue );
-                                } catch (Exception e)
-                                {
-                                    logger.warn( "Could not deliver events", e );
-
-                                }
-                            }
-                        } catch (IOException e)
-                        {
-                            logger.error( "Could not store events", e );
-                            // How do we handle this? This is a major error!
-                        }
-                    }
-                }
-            } );
-        }
-
-        events.add( eventValue );
-
-        return eventValue;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/package.html
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/package.html b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/package.html
deleted file mode 100644
index 8d7cf64..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/package.html
+++ /dev/null
@@ -1,24 +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>EventSourcing Domain Factory.</h2>
-    </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/replay/DomainEventPlayer.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/replay/DomainEventPlayer.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/replay/DomainEventPlayer.java
deleted file mode 100644
index d264b52..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/replay/DomainEventPlayer.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.replay;
-
-import org.apache.zest.library.eventsourcing.domain.api.DomainEventValue;
-import org.apache.zest.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
-
-/**
- * Service that can replay transactions and individual domain events.
- */
-public interface DomainEventPlayer
-{
-    public void playTransaction( UnitOfWorkDomainEventsValue unitOfWorkDomainValue )
-            throws EventReplayException;
-
-    /**
-     * Invoke a domain event on a particular object. The object could
-     * be the original object, but could also be a service that wants
-     * to be invoked to handle the event.
-     *
-     * @param domainEventValue Domain event value
-     * @param object target
-     * @throws EventReplayException if unable to play event
-     */
-    public void playEvent( DomainEventValue domainEventValue, Object object )
-            throws EventReplayException;
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/replay/DomainEventPlayerService.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/replay/DomainEventPlayerService.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/replay/DomainEventPlayerService.java
deleted file mode 100644
index 890fea9..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/replay/DomainEventPlayerService.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.replay;
-
-import java.lang.reflect.Method;
-import java.text.ParseException;
-import java.time.Instant;
-import java.time.format.DateTimeFormatter;
-import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.service.ServiceComposite;
-import org.apache.zest.api.structure.Module;
-import org.apache.zest.api.unitofwork.NoSuchEntityException;
-import org.apache.zest.api.unitofwork.UnitOfWork;
-import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
-import org.apache.zest.api.usecase.UsecaseBuilder;
-import org.apache.zest.api.value.ValueComposite;
-import org.apache.zest.library.eventsourcing.domain.api.DomainEventValue;
-import org.apache.zest.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
-import org.apache.zest.spi.ZestSPI;
-import org.apache.zest.spi.entity.EntityState;
-import org.json.JSONObject;
-import org.json.JSONTokener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * DomainEventValue player
- */
-@Mixins( DomainEventPlayerService.Mixin.class )
-public interface DomainEventPlayerService
-    extends DomainEventPlayer, ServiceComposite
-{
-    class Mixin
-        implements DomainEventPlayer
-    {
-        final Logger logger = LoggerFactory.getLogger( DomainEventPlayer.class );
-
-        @Structure
-        UnitOfWorkFactory uowf;
-
-        @Structure
-        Module module;
-
-        @Structure
-        ZestSPI spi;
-
-        DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern( "EEE MMM dd HH:mm:ss zzz yyyy" );
-
-        @Override
-        public void playTransaction( UnitOfWorkDomainEventsValue unitOfWorkDomainValue )
-            throws EventReplayException
-        {
-            UnitOfWork uow = uowf.newUnitOfWork( UsecaseBuilder.newUsecase( "Event replay" ) );
-            DomainEventValue currentEventValue = null;
-            try
-            {
-                for( DomainEventValue domainEventValue : unitOfWorkDomainValue.events().get() )
-                {
-                    currentEventValue = domainEventValue;
-                    // Get the entity
-                    Class entityType = module.descriptor()
-                        .classLoader()
-                        .loadClass( domainEventValue.entityType().get() );
-                    String id = domainEventValue.entityId().get();
-                    Object entity = null;
-                    try
-                    {
-                        entity = uow.get( entityType, id );
-                    }
-                    catch( NoSuchEntityException e )
-                    {
-                        // Event to play for an entity that doesn't yet exist - create a default instance
-                        entity = uow.newEntity( entityType, id );
-                    }
-
-                    // check if the event has already occured
-                    EntityState state = spi.entityStateOf( (EntityComposite) entity );
-                    if( state.lastModified() > unitOfWorkDomainValue.timestamp().get().toEpochMilli() )
-                    {
-                        break; // don't rerun event in this unitOfWorkDomainValue
-                    }
-
-                    playEvent( domainEventValue, entity );
-                }
-                uow.complete();
-            }
-            catch( Exception e )
-            {
-                uow.discard();
-                if( e instanceof EventReplayException )
-                {
-                    throw ( (EventReplayException) e );
-                }
-                else
-                {
-                    throw new EventReplayException( currentEventValue, e );
-                }
-            }
-        }
-
-        @Override
-        public void playEvent( DomainEventValue domainEventValue, Object object )
-            throws EventReplayException
-        {
-            UnitOfWork uow = uowf.currentUnitOfWork();
-            Class entityType = object.getClass();
-
-            // Get method
-            Method eventMethod = getEventMethod( entityType, domainEventValue.name().get() );
-
-            if( eventMethod == null )
-            {
-                logger.warn( "Could not find event method " + domainEventValue.name()
-                    .get() + " in entity of type " + entityType.getName() );
-                return;
-            }
-
-            // Build parameters
-            try
-            {
-                String jsonParameters = domainEventValue.parameters().get();
-                JSONObject parameters = (JSONObject) new JSONTokener( jsonParameters ).nextValue();
-                Object[] args = new Object[ eventMethod.getParameterTypes().length ];
-                for( int i = 1; i < eventMethod.getParameterTypes().length; i++ )
-                {
-                    Class<?> parameterType = eventMethod.getParameterTypes()[ i ];
-                    String paramName = "param" + i;
-                    Object value = parameters.get( paramName );
-                    args[ i ] = getParameterArgument( parameterType, value, uow );
-                }
-                args[ 0 ] = domainEventValue;
-
-                // Invoke method
-                logger.debug( "Replay:" + domainEventValue + " on:" + object );
-
-                eventMethod.invoke( object, args );
-            }
-            catch( Exception e )
-            {
-                throw new EventReplayException( domainEventValue, e );
-            }
-        }
-
-        private Object getParameterArgument( Class<?> parameterType, Object value, UnitOfWork uow )
-            throws ParseException
-        {
-            if( value.equals( JSONObject.NULL ) )
-            {
-                return null;
-            }
-
-            if( parameterType.equals( String.class ) )
-            {
-                return (String) value;
-            }
-            else if( parameterType.equals( Boolean.class ) || parameterType.equals( Boolean.TYPE ) )
-            {
-                return (Boolean) value;
-            }
-            else if( parameterType.equals( Long.class ) || parameterType.equals( Long.TYPE ) )
-            {
-                return ( (Number) value ).longValue();
-            }
-            else if( parameterType.equals( Integer.class ) || parameterType.equals( Integer.TYPE ) )
-            {
-                return ( (Number) value ).intValue();
-            }
-            else if( parameterType.equals( Instant.class ) )
-            {
-                return dateFormat.parse( (String) value );
-            }
-            else if( ValueComposite.class.isAssignableFrom( parameterType ) )
-            {
-                return module.newValueFromSerializedState( parameterType, (String) value );
-            }
-            else if( parameterType.isInterface() )
-            {
-                return uow.get( parameterType, (String) value );
-            }
-            else if( parameterType.isEnum() )
-            {
-                return Enum.valueOf( (Class<? extends Enum>) parameterType, value.toString() );
-            }
-            else
-            {
-                throw new IllegalArgumentException( "Unknown parameter type:" + parameterType.getName() );
-            }
-        }
-
-        private Method getEventMethod( Class<?> aClass, String eventName )
-        {
-            for( Method method : aClass.getMethods() )
-            {
-                if( method.getName().equals( eventName ) )
-                {
-                    Class[] parameterTypes = method.getParameterTypes();
-                    if( parameterTypes.length > 0 && parameterTypes[ 0 ].equals( DomainEventValue.class ) )
-                    {
-                        return method;
-                    }
-                }
-            }
-            return null;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/replay/EventReplayException.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/replay/EventReplayException.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/replay/EventReplayException.java
deleted file mode 100644
index ba36dfa..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/replay/EventReplayException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.replay;
-
-import org.apache.zest.library.eventsourcing.domain.api.DomainEventValue;
-
-/**
- * An eventValue replay failed.
- */
-public class EventReplayException
-        extends RuntimeException
-{
-    private DomainEventValue eventValue;
-
-    public EventReplayException( DomainEventValue eventValue, Throwable cause )
-    {
-        super( cause );
-        this.eventValue = eventValue;
-    }
-
-    @Override
-    public String getMessage()
-    {
-        return "Could not replay event:" + eventValue + ", caused by:" + getCause();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/replay/package.html
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/replay/package.html b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/replay/package.html
deleted file mode 100644
index 855d4b5..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/replay/package.html
+++ /dev/null
@@ -1,24 +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>EventSourcing Domain Replay.</h2>
-    </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/AbstractEventStoreMixin.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/AbstractEventStoreMixin.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/AbstractEventStoreMixin.java
deleted file mode 100644
index bc55d7b..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/AbstractEventStoreMixin.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.source;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-import org.apache.zest.api.entity.Identity;
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.injection.scope.This;
-import org.apache.zest.api.structure.Module;
-import org.apache.zest.api.structure.ModuleDescriptor;
-import org.apache.zest.api.type.ValueType;
-import org.apache.zest.io.Output;
-import org.apache.zest.io.Receiver;
-import org.apache.zest.io.Sender;
-import org.apache.zest.library.eventsourcing.domain.api.DomainEventValue;
-import org.apache.zest.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static java.util.Collections.synchronizedList;
-
-/**
- * Base implementation for EventStores.
- */
-public abstract class AbstractEventStoreMixin
-        implements EventStore, EventStream, EventStoreActivation
-{
-    @This
-    protected Identity identity;
-
-    protected Logger logger;
-    protected ValueType domainEventType;
-    protected ValueType eventsType;
-
-    protected Lock lock = new ReentrantLock();
-
-    @Structure
-    protected ModuleDescriptor module;
-
-    private ExecutorService transactionNotifier;
-
-    final private List<UnitOfWorkEventsListener> listeners = synchronizedList( new ArrayList<UnitOfWorkEventsListener>() );
-
-    @Override
-    public void activateEventStore() throws Exception
-    {
-        logger = LoggerFactory.getLogger( identity.identity().get() );
-
-        domainEventType = module.valueDescriptor( DomainEventValue.class.getName() ).valueType();
-        eventsType = module.valueDescriptor( UnitOfWorkDomainEventsValue.class.getName() ).valueType();
-
-        transactionNotifier = Executors.newSingleThreadExecutor();
-    }
-
-    @Override
-    public void passivateEventStore() throws Exception
-    {
-        transactionNotifier.shutdown();
-        transactionNotifier.awaitTermination( 10000, TimeUnit.MILLISECONDS );
-    }
-
-    // UnitOfWorkEventsVisitor implementation
-    // This is how transactions are put into the store
-
-
-    @Override
-    public Output<UnitOfWorkDomainEventsValue, IOException> storeEvents()
-    {
-        final Output<UnitOfWorkDomainEventsValue, IOException> storeOutput = storeEvents0();
-
-        return new Output<UnitOfWorkDomainEventsValue, IOException>()
-        {
-            @Override
-            public <SenderThrowableType extends Throwable> void receiveFrom( final Sender<? extends UnitOfWorkDomainEventsValue, SenderThrowableType> sender ) throws IOException, SenderThrowableType
-            {
-                final List<UnitOfWorkDomainEventsValue> events = new ArrayList<UnitOfWorkDomainEventsValue>(  );
-                lock();
-                try
-                {
-                    storeOutput.receiveFrom(new Sender<UnitOfWorkDomainEventsValue, SenderThrowableType>()
-                    {
-                        @Override
-                        public <ReceiverThrowableType extends Throwable> void sendTo( final Receiver<? super UnitOfWorkDomainEventsValue, ReceiverThrowableType> receiver ) throws ReceiverThrowableType, SenderThrowableType
-                        {
-                            sender.sendTo( new Receiver<UnitOfWorkDomainEventsValue, ReceiverThrowableType>()
-                            {
-                                @Override
-                                public void receive( UnitOfWorkDomainEventsValue item ) throws ReceiverThrowableType
-                                {
-                                    receiver.receive( item );
-                                    events.add( item );
-                                }
-                            });
-                        }
-                    });
-
-                } finally
-                {
-                    lock.unlock();
-                }
-
-                // Notify listeners
-                transactionNotifier.submit( new Runnable()
-                {
-                    @Override
-                    public void run()
-                    {
-                        synchronized(listeners)
-                        {
-                            for( UnitOfWorkEventsListener listener : listeners )
-                            {
-                                try
-                                {
-                                    listener.notifyTransactions( events );
-                                } catch( Exception e )
-                                {
-                                    logger.warn( "Could not notify event listener", e );
-                                }
-                            }
-                        }
-                    }
-                } );
-            }
-        };
-    }
-
-    // EventStream implementation
-    @Override
-    public void registerListener( UnitOfWorkEventsListener subscriber )
-    {
-        listeners.add( subscriber );
-    }
-
-    @Override
-    public void unregisterListener( UnitOfWorkEventsListener subscriber )
-    {
-        listeners.remove( subscriber );
-    }
-
-    abstract protected Output<UnitOfWorkDomainEventsValue, IOException> storeEvents0();
-
-    /**
-     * Fix for this bug:
-     * http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6822370
-     */
-    protected void lock()
-    {
-        while (true)
-        {
-            try
-            {
-                lock.tryLock( 1000, TimeUnit.MILLISECONDS );
-                break;
-            } catch (InterruptedException e)
-            {
-                // Try again
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/EventManagement.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/EventManagement.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/EventManagement.java
deleted file mode 100644
index ee4b456..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/EventManagement.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.source;
-
-import java.io.IOException;
-import org.apache.zest.io.Output;
-
-/**
- * Management interface for EventStores.
- */
-public interface EventManagement
-{
-    /**
-     * Output used to restore events from a backup
-     *
-     * @return The Output function to restore events from a backup.
-     */
-    Output<String, IOException> restore();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/EventSource.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/EventSource.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/EventSource.java
deleted file mode 100644
index b307359..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/EventSource.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.source;
-
-import java.io.IOException;
-import org.apache.zest.io.Input;
-import org.apache.zest.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
-
-/**
- * An EventSource is a source of events. Events are grouped in the UnitOfWork in which they were created.
- */
-public interface EventSource
-{
-    /**
-     * Get list of UnitOfWorkDomainEventsValue after the given offset.
-     * <p>
-     * To get the first set of events, use 0 as offset parameter to get events from the start.
-     * </p>
-     *
-     * @param offset where in the list of events to start
-     * @param limit maximum number of events returned
-     * @return list of UnitOfWorkDomainEventsValue after the given offset
-     */
-    Input<UnitOfWorkDomainEventsValue, IOException> events( long offset, long limit );
-
-    long count();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/EventStore.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/EventStore.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/EventStore.java
deleted file mode 100644
index a89bffb..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/EventStore.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.source;
-
-import java.io.IOException;
-import org.apache.zest.io.Output;
-import org.apache.zest.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
-
-/**
- * Store of domain-events.
- */
-public interface EventStore
-{
-    Output<UnitOfWorkDomainEventsValue, IOException> storeEvents();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/EventStoreActivation.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/EventStoreActivation.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/EventStoreActivation.java
deleted file mode 100644
index 07eeff5..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/EventStoreActivation.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.zest.library.eventsourcing.domain.source;
-
-import org.apache.zest.api.activation.ActivatorAdapter;
-import org.apache.zest.api.service.ServiceReference;
-
-public interface EventStoreActivation
-{
-
-    void activateEventStore()
-            throws Exception;
-
-    void passivateEventStore()
-            throws Exception;
-
-    public static class Activator
-            extends ActivatorAdapter<ServiceReference<EventStoreActivation>>
-    {
-
-        @Override
-        public void afterActivation( ServiceReference<EventStoreActivation> activated )
-                throws Exception
-        {
-            activated.get().activateEventStore();
-        }
-
-        @Override
-        public void beforePassivation( ServiceReference<EventStoreActivation> passivating )
-                throws Exception
-        {
-            passivating.get().passivateEventStore();
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/EventStream.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/EventStream.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/EventStream.java
deleted file mode 100644
index 59b9620..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/EventStream.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.source;
-
-/**
- * Stream of event transactions. Registering with a stream will
- * allow the subscriber to get callbacks when new transactions
- * are available. The callbacks are done asynchronously.
- */
-public interface EventStream
-{
-    void registerListener( UnitOfWorkEventsListener listener );
-
-    void unregisterListener( UnitOfWorkEventsListener listener );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/UnitOfWorkEventsListener.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/UnitOfWorkEventsListener.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/UnitOfWorkEventsListener.java
deleted file mode 100644
index 41ac8d3..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/UnitOfWorkEventsListener.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.source;
-
-import org.apache.zest.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
-
-/**
- * JAVADOC
- */
-public interface UnitOfWorkEventsListener
-{
-    void notifyTransactions( Iterable<UnitOfWorkDomainEventsValue> transactions );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/UnitOfWorkEventsVisitor.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/UnitOfWorkEventsVisitor.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/UnitOfWorkEventsVisitor.java
deleted file mode 100644
index 746362b..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/UnitOfWorkEventsVisitor.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.source;
-
-import org.apache.zest.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
-
-/**
- * JAVADOC
- */
-public interface UnitOfWorkEventsVisitor
-{
-    boolean visit( UnitOfWorkDomainEventsValue unitOfWorkDomainValue );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/helper/DomainEventTracker.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/helper/DomainEventTracker.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/helper/DomainEventTracker.java
deleted file mode 100644
index cb30911..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/helper/DomainEventTracker.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.source.helper;
-
-import org.apache.zest.api.configuration.Configuration;
-import org.apache.zest.io.Output;
-import org.apache.zest.io.Transforms;
-import org.apache.zest.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
-import org.apache.zest.library.eventsourcing.domain.source.EventSource;
-import org.apache.zest.library.eventsourcing.domain.source.EventStream;
-import org.apache.zest.library.eventsourcing.domain.source.UnitOfWorkEventsListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Helper that enables a service to easily track transactions.
- * <p>
- * Upon startup
- * the tracker will get all the transactions from the store since the last
- * check, and delegate them to the given Output. It will also register itself
- * with the store so that it can get continuous updates.
- * </p>
- * <p>
- * Then, as transactions come in from the store, they will be processed in real-time.
- * If a transaction is successfully handled the configuration of the service, which must
- * extend DomainEventTrackerConfiguration, will update the marker for the last successfully handled transaction.
- * </p>
- */
-public class DomainEventTracker
-        implements Runnable, UnitOfWorkEventsListener
-{
-    private Configuration<? extends DomainEventTrackerConfiguration> configuration;
-    private final Output<UnitOfWorkDomainEventsValue, ? extends Throwable> output;
-    private EventStream stream;
-    private EventSource source;
-    private boolean started = false;
-    private Logger logger;
-
-    public DomainEventTracker( EventStream stream, EventSource source,
-                               Configuration<? extends DomainEventTrackerConfiguration> configuration,
-                               Output<UnitOfWorkDomainEventsValue, ? extends Throwable> output )
-    {
-        this.stream = stream;
-        this.configuration = configuration;
-        this.output = output;
-        this.source = source;
-
-        logger = LoggerFactory.getLogger( configuration.get().identity().get() );
-    }
-
-    public synchronized void start()
-    {
-        if (!started)
-        {
-            started = true;
-
-            run();
-
-            stream.registerListener( this );
-        }
-    }
-
-    public synchronized void stop()
-    {
-        if (started)
-        {
-            started = false;
-            stream.unregisterListener( this );
-        }
-    }
-
-    @Override
-    public synchronized void run()
-    {
-        // TODO This should optionally use a CircuitBreaker
-        if (started && configuration.get().enabled().get())
-        {
-            Transforms.Counter counter = new Transforms.Counter();
-            try
-            {
-                long currentOffset = configuration.get().lastOffset().get();
-                source.events( currentOffset, Long.MAX_VALUE ).transferTo( Transforms.map( counter, output ) );
-
-                // Save new offset, to be used in next round
-                configuration.get().lastOffset().set( currentOffset+counter.count() );
-                configuration.save();
-            } catch (Throwable throwable)
-            {
-                logger.warn( "Event handling failed", throwable );
-            }
-        }
-    }
-
-    @Override
-    public void notifyTransactions( Iterable<UnitOfWorkDomainEventsValue> transactions )
-    {
-        run();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/helper/DomainEventTrackerConfiguration.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/helper/DomainEventTrackerConfiguration.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/helper/DomainEventTrackerConfiguration.java
deleted file mode 100644
index b10396c..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/helper/DomainEventTrackerConfiguration.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.source.helper;
-
-import org.apache.zest.api.common.UseDefaults;
-import org.apache.zest.api.configuration.ConfigurationComposite;
-import org.apache.zest.api.configuration.Enabled;
-import org.apache.zest.api.property.Property;
-
-/**
- * Configuration that a service doing event tracking must have. Let the configuration
- * of the service extend this one.
- */
-public interface DomainEventTrackerConfiguration
-        extends ConfigurationComposite, Enabled
-{
-    /**
-     * A count of how many events have been read already. Call EventStore.events(lastOffset,{limit}) to get
-     * the next set of events.
-     *
-     * @return count of how many events have been read already.
-     */
-    @UseDefaults
-    Property<Long> lastOffset();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/helper/EventParameters.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/helper/EventParameters.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/helper/EventParameters.java
deleted file mode 100644
index 678e829..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/helper/EventParameters.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.source.helper;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.apache.zest.library.eventsourcing.domain.api.DomainEventValue;
-
-/**
- * Utility class to pick out parameters by name or index as strings from a DomainEventValue
- */
-public class EventParameters
-{
-    /**
-     * Get the named parameter from an eventValue.
-     *
-     * @param eventValue eventValue with parameters
-     * @param name  name of parameter
-     * @return the parameter with the given name or null
-     */
-    public static String getParameter( DomainEventValue eventValue, String name )
-    {
-        String parametersJson = eventValue.parameters().get();
-        try
-        {
-            JSONObject jsonObject = new JSONObject( parametersJson );
-            return jsonObject.get( name ).toString();
-        } catch (JSONException e)
-        {
-            return null;
-        }
-    }
-
-    /**
-     * Get parameter with given index.
-     *
-     * @param eventValue eventValue with parameters
-     * @param idx   index of parameter
-     * @return the parameter with the given index or null
-     */
-    public static String getParameter( DomainEventValue eventValue, int idx )
-    {
-        try
-        {
-            String parametersJson = eventValue.parameters().get();
-            JSONObject jsonObject = new JSONObject( parametersJson );
-            return jsonObject.get( "param" + idx ).toString();
-        } catch (JSONException e)
-        {
-            return null;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/helper/EventRouter.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/helper/EventRouter.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/helper/EventRouter.java
deleted file mode 100644
index f7c20ff..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/helper/EventRouter.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.source.helper;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.function.Predicate;
-import org.apache.zest.io.Output;
-import org.apache.zest.io.Receiver;
-import org.apache.zest.io.Sender;
-import org.apache.zest.library.eventsourcing.domain.api.DomainEventValue;
-import org.apache.zest.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
-
-/**
- * Event handling router. Add specification-&gt;receiver routes. When an event comes in
- * the router will ask each specification if it matches, and if so, delegate to the
- * receiver and return whether it successfully handled it or not. If no routes match,
- * delegate to the default receiver
- */
-public class EventRouter<T extends Throwable>
-        implements Output<DomainEventValue, T>, Receiver<UnitOfWorkDomainEventsValue, T>
-{
-    private Map<Predicate<DomainEventValue>, Receiver<DomainEventValue, T>> routeEvent = new LinkedHashMap<Predicate<DomainEventValue>, Receiver<DomainEventValue, T>>();
-
-    private Receiver<DomainEventValue, T> defaultReceiver = new Receiver<DomainEventValue, T>()
-    {
-        @Override
-        public void receive( DomainEventValue item ) throws T
-        {
-            // Do nothing;
-        }
-    };
-
-    public EventRouter route( Predicate<DomainEventValue> specification, Receiver<DomainEventValue, T> receiver )
-    {
-        routeEvent.put( specification, receiver );
-
-        return this;
-    }
-
-    public EventRouter defaultReceiver( Receiver<DomainEventValue, T> defaultReceiver )
-    {
-        this.defaultReceiver = defaultReceiver;
-        return this;
-    }
-
-    @Override
-    public <SenderThrowableType extends Throwable> void receiveFrom( Sender<? extends DomainEventValue, SenderThrowableType> sender ) throws T, SenderThrowableType
-    {
-        sender.sendTo( new Receiver<DomainEventValue, T>()
-        {
-            @Override
-            public void receive( DomainEventValue item ) throws T
-            {
-                for( Map.Entry<Predicate<DomainEventValue>, Receiver<DomainEventValue, T>> specificationReceiverEntry : routeEvent.entrySet() )
-                {
-                    if( specificationReceiverEntry.getKey().test( item ) )
-                    {
-                        specificationReceiverEntry.getValue().receive( item );
-                        return;
-                    }
-                }
-
-                // No match, use default
-                defaultReceiver.receive( item );
-            }
-        } );
-    }
-
-    @Override
-    public void receive( final UnitOfWorkDomainEventsValue item ) throws T
-    {
-        receiveFrom( new Sender<DomainEventValue, T>()
-        {
-            @Override
-            public <ReceiverThrowableType extends Throwable> void sendTo( Receiver<? super DomainEventValue, ReceiverThrowableType> receiver ) throws ReceiverThrowableType, T
-            {
-
-                for( DomainEventValue domainEventValue : item.events().get() )
-                {
-                    receiver.receive( domainEventValue );
-                }
-            }
-        } );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/helper/Events.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/helper/Events.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/helper/Events.java
deleted file mode 100644
index 6662621..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/helper/Events.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.source.helper;
-
-import java.lang.reflect.Method;
-import java.util.function.Function;
-import java.util.function.Predicate;
-import org.apache.zest.api.util.Methods;
-import org.apache.zest.functional.Iterables;
-import org.apache.zest.library.eventsourcing.domain.api.DomainEventValue;
-import org.apache.zest.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
-
-/**
- * Helper methods for working with Iterables of DomainEvents and UnitOfWorkDomainEventsValue.
- */
-public class Events
-{
-    public static Iterable<DomainEventValue> events( Iterable<UnitOfWorkDomainEventsValue> transactions )
-    {
-        return Iterables.flattenIterables( Iterables.map( new Function<UnitOfWorkDomainEventsValue, Iterable<DomainEventValue>>()
-        {
-            @Override
-            public Iterable<DomainEventValue> apply( UnitOfWorkDomainEventsValue unitOfWorkDomainEventsValue )
-            {
-                return unitOfWorkDomainEventsValue.events().get();
-            }
-        }, transactions ) );
-    }
-
-    public static Iterable<DomainEventValue> events( UnitOfWorkDomainEventsValue... unitOfWorkDomainValues )
-    {
-        return events( Iterables.iterable( unitOfWorkDomainValues ) );
-    }
-
-    public static Predicate<UnitOfWorkDomainEventsValue> withUsecases( final String... names )
-    {
-        return eventValue -> {
-            for( String name : names )
-            {
-                if( eventValue.usecase().get().equals( name ) )
-                {
-                    return true;
-                }
-            }
-            return false;
-        };
-    }
-
-    public static Predicate<UnitOfWorkDomainEventsValue> byUser( final String... by )
-    {
-        return eventValue -> {
-            for( String user : by )
-            {
-                if( eventValue.user().get().equals( user ) )
-                {
-                    return true;
-                }
-            }
-            return false;
-        };
-    }
-
-    //    public static Predicate<DomainEventValue> withNames( final Iterable<String> names )
-//    {
-//        return new Predicate<DomainEventValue>()
-//        {
-//            @Override
-//            public boolean test( DomainEventValue eventValue )
-//            {
-//                for (String name : names)
-//                {
-//                    if (eventValue.name().get().equals( name ))
-//                        return true;
-//                }
-//                return false;
-//            }
-//        };
-//    }
-//
-    public static Predicate<DomainEventValue> withNames( final String... names )
-    {
-        return eventValue -> {
-            for( String name : names )
-            {
-                if( eventValue.name().get().equals( name ) )
-                {
-                    return true;
-                }
-            }
-            return false;
-        };
-    }
-
-    public static Predicate<DomainEventValue> withNames( final Class eventClass )
-    {
-        return new WithNamesPredicate( eventClass );
-//        return Events.withNames( map( new Function<Method, String>()
-//        {
-//            @Override
-//            public String apply( Method method )
-//            {
-//                return method.getName();
-//            }
-//        }, Iterables.toList( Methods.METHODS_OF.apply( eventClass ) ) ));
-    }
-
-    public static Predicate<DomainEventValue> onEntities( final String... entities )
-    {
-        return eventValue -> {
-            for( String entity : entities )
-            {
-                if( eventValue.entityId().get().equals( entity ) )
-                {
-                    return true;
-                }
-            }
-            return false;
-        };
-    }
-
-    public static Predicate<DomainEventValue> onEntityTypes( final String... entityTypes )
-    {
-        return eventValue -> {
-            for( String entityType : entityTypes )
-            {
-                if( eventValue.entityType().get().equals( entityType ) )
-                {
-                    return true;
-                }
-            }
-            return false;
-        };
-    }
-
-    public static Predicate<DomainEventValue> paramIs( final String name, final String value )
-    {
-        return eventValue -> EventParameters.getParameter( eventValue, name ).equals( value );
-    }
-
-    private static class WithNamesPredicate implements Predicate<DomainEventValue>
-    {
-        private final Class eventClass;
-
-        public WithNamesPredicate( Class eventClass )
-        {
-            this.eventClass = eventClass;
-        }
-
-        @Override
-        public boolean test( DomainEventValue event )
-        {
-            return Methods.METHODS_OF.apply( eventClass )
-                .map( Method::getName )
-                .anyMatch( name -> event.name().get().equals( name ) );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/helper/UnitOfWorkRouter.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/helper/UnitOfWorkRouter.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/helper/UnitOfWorkRouter.java
deleted file mode 100644
index 4aaaaeb..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/helper/UnitOfWorkRouter.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.source.helper;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.function.Predicate;
-import org.apache.zest.io.Output;
-import org.apache.zest.io.Receiver;
-import org.apache.zest.io.Sender;
-import org.apache.zest.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
-
-/**
- * UnitOfWork handling router. Add specification-&gt;receiver routes. When a UnitOfWorkEDomainEventsValue comes in
- * the router will ask each specification if it matches, and if so, delegate to the
- * receiver. If no routes match, delegate to the default receiver.
- */
-public class UnitOfWorkRouter<T extends Throwable>
-    implements Output<UnitOfWorkDomainEventsValue, T>
-{
-    private Map<Predicate<UnitOfWorkDomainEventsValue>, Receiver<UnitOfWorkDomainEventsValue, T>> routes = new LinkedHashMap<Predicate<UnitOfWorkDomainEventsValue>, Receiver<UnitOfWorkDomainEventsValue, T>>(  );
-
-    private Receiver<UnitOfWorkDomainEventsValue, T> defaultReceiver = new Receiver<UnitOfWorkDomainEventsValue, T>()
-    {
-        @Override
-        public void receive( UnitOfWorkDomainEventsValue item ) throws T
-        {
-            // Do nothing;
-        }
-    };
-
-    public UnitOfWorkRouter route( Predicate<UnitOfWorkDomainEventsValue> specification, Receiver<UnitOfWorkDomainEventsValue, T> receiver)
-    {
-        routes.put(specification, receiver);
-
-        return this;
-    }
-
-    public UnitOfWorkRouter defaultReceiver(Receiver<UnitOfWorkDomainEventsValue, T> defaultReceiver)
-    {
-        this.defaultReceiver = defaultReceiver;
-        return this;
-    }
-
-    @Override
-    public <SenderThrowableType extends Throwable> void receiveFrom( Sender<? extends UnitOfWorkDomainEventsValue, SenderThrowableType> sender ) throws T, SenderThrowableType
-    {
-        sender.sendTo( new Receiver<UnitOfWorkDomainEventsValue, T>()
-        {
-            @Override
-            public void receive( UnitOfWorkDomainEventsValue item ) throws T
-            {
-                for( Map.Entry<Predicate<UnitOfWorkDomainEventsValue>, Receiver<UnitOfWorkDomainEventsValue, T>> specificationReceiverEntry : routes.entrySet() )
-                {
-                    if (specificationReceiverEntry.getKey().test( item ))
-                    {
-                        specificationReceiverEntry.getValue().receive( item );
-                        return;
-                    }
-                }
-
-                // No match, use default
-                defaultReceiver.receive( item );
-            }
-        });
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/helper/package.html
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/helper/package.html b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/helper/package.html
deleted file mode 100644
index d603f61..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/source/helper/package.html
+++ /dev/null
@@ -1,24 +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>EventSourcing Domain Source Helpers.</h2>
-    </body>
-</html>
\ No newline at end of file


[4/7] zest-java git commit: ZEST-183 : Removing library-eventsourcing.

Posted by ni...@apache.org.
ZEST-183 : Removing library-eventsourcing.


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

Branch: refs/heads/develop
Commit: d9569cd6ca3a08b37e51d73f99be806e773e9f17
Parents: 90401dd
Author: Niclas Hedhman <ni...@hedhman.org>
Authored: Sat Oct 22 14:14:42 2016 +0800
Committer: Niclas Hedhman <ni...@hedhman.org>
Committed: Sat Oct 22 14:14:42 2016 +0800

----------------------------------------------------------------------
 libraries/eventsourcing-jdbm/build.gradle       |  36 ---
 libraries/eventsourcing-jdbm/dev-status.xml     |  38 ---
 .../source/jdbm/JdbmEventStoreService.java      | 260 ------------------
 .../domain/source/jdbm/package.html             |  24 --
 .../source/jdbm/JdbmEventStoreServiceTest.java  | 126 ---------
 libraries/eventsourcing-rest/build.gradle       |  34 ---
 libraries/eventsourcing-rest/dev-status.xml     |  38 ---
 .../rest/server/DomainEventSourceResource.java  | 262 -------------------
 .../domain/rest/server/package.html             |  24 --
 .../server/DomainEventSourceResourceSample.java | 191 --------------
 libraries/eventsourcing/build.gradle            |  33 ---
 libraries/eventsourcing/dev-status.xml          |  38 ---
 .../eventsourcing/src/docs/eventsourcing.txt    | 135 ----------
 .../application/api/ApplicationEvent.java       |  60 -----
 .../api/TransactionApplicationEvents.java       |  46 ----
 .../eventsourcing/application/api/package.html  |  24 --
 .../ApplicationEventCreationConcern.java        |  51 ----
 .../factory/ApplicationEventCreator.java        |  34 ---
 .../factory/ApplicationEventFactory.java        |  31 ---
 .../factory/ApplicationEventFactoryService.java | 113 --------
 .../factory/ApplicationEventMethodFilter.java   |  39 ---
 .../factory/TransactionNotificationConcern.java |  99 -------
 .../factory/UnitOfWorkApplicationEvents.java    |  43 ---
 .../application/factory/package.html            |  24 --
 .../replay/ApplicationEventPlayer.java          |  41 ---
 .../replay/ApplicationEventPlayerService.java   | 157 -----------
 .../replay/ApplicationEventReplayException.java |  44 ----
 .../application/replay/package.html             |  24 --
 .../AbstractApplicationEventStoreMixin.java     | 197 --------------
 .../source/ApplicationEventSource.java          |  59 -----
 .../source/ApplicationEventStore.java           |  33 ---
 .../source/ApplicationEventStoreActivation.java |  54 ----
 .../source/ApplicationEventStream.java          |  36 ---
 .../helper/ApplicationEventParameters.java      |  71 -----
 .../source/helper/ApplicationEvents.java        | 191 --------------
 .../helper/ApplicationTransactionTracker.java   | 155 -----------
 .../application/source/helper/package.html      |  24 --
 .../MemoryApplicationEventStoreService.java     | 142 ----------
 .../application/source/memory/package.html      |  24 --
 .../application/source/package.html             |  24 --
 .../bootstrap/EventsourcingAssembler.java       |  82 ------
 .../eventsourcing/bootstrap/package.html        |  24 --
 .../eventsourcing/domain/api/DomainEvent.java   |  41 ---
 .../domain/api/DomainEventValue.java            |  50 ----
 .../eventsourcing/domain/api/DomainEvents.java  |  46 ----
 .../domain/api/UnitOfWorkDomainEventsValue.java |  57 ----
 .../eventsourcing/domain/api/package.html       |  24 --
 .../domain/factory/CurrentUserSubject.java      |  44 ----
 .../domain/factory/CurrentUserUoWPrincipal.java |  48 ----
 .../factory/DomainEventCreationConcern.java     |  68 -----
 .../domain/factory/DomainEventFactory.java      |  32 ---
 .../factory/DomainEventFactoryService.java      |  92 -------
 .../domain/factory/UnitOfWorkEvents.java        |  43 ---
 .../factory/UnitOfWorkNotificationConcern.java  | 153 -----------
 .../eventsourcing/domain/factory/package.html   |  24 --
 .../domain/replay/DomainEventPlayer.java        |  45 ----
 .../domain/replay/DomainEventPlayerService.java | 226 ----------------
 .../domain/replay/EventReplayException.java     |  44 ----
 .../eventsourcing/domain/replay/package.html    |  24 --
 .../domain/source/AbstractEventStoreMixin.java  | 185 -------------
 .../domain/source/EventManagement.java          |  37 ---
 .../domain/source/EventSource.java              |  45 ----
 .../eventsourcing/domain/source/EventStore.java |  33 ---
 .../domain/source/EventStoreActivation.java     |  54 ----
 .../domain/source/EventStream.java              |  33 ---
 .../domain/source/UnitOfWorkEventsListener.java |  31 ---
 .../domain/source/UnitOfWorkEventsVisitor.java  |  31 ---
 .../source/helper/DomainEventTracker.java       | 117 ---------
 .../helper/DomainEventTrackerConfiguration.java |  43 ---
 .../domain/source/helper/EventParameters.java   |  71 -----
 .../domain/source/helper/EventRouter.java       | 104 --------
 .../domain/source/helper/Events.java            | 175 -------------
 .../domain/source/helper/UnitOfWorkRouter.java  |  85 ------
 .../domain/source/helper/package.html           |  24 --
 .../source/memory/MemoryEventStoreService.java  | 130 ---------
 .../domain/source/memory/package.html           |  24 --
 .../eventsourcing/domain/source/package.html    |  24 --
 .../eventsourcing/domain/spi/CurrentUser.java   |  30 ---
 .../eventsourcing/domain/spi/package.html       |  24 --
 .../application/ApplicationEventTest.java       | 226 ----------------
 .../eventsourcing/domain/DomainEventTest.java   | 127 ---------
 .../source/helper/DomainEventTrackerTest.java   | 188 -------------
 .../domain/source/helper/EventRouterTest.java   | 119 ---------
 .../domain/source/helper/EventsTest.java        | 107 --------
 .../source/helper/UnitOfWorkRouterTest.java     | 159 -----------
 85 files changed, 6472 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing-jdbm/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing-jdbm/build.gradle b/libraries/eventsourcing-jdbm/build.gradle
deleted file mode 100644
index b9949bf..0000000
--- a/libraries/eventsourcing-jdbm/build.gradle
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-description = "Extension to the Apache Zest\u2122 Event Sourcing Library for providing a JDBM based event store."
-
-jar { manifest { name = "Apache Zest\u2122 Library - Event Sourcing - JDBM" }}
-
-dependencies {
-  compile(project(":org.apache.zest.core:org.apache.zest.core.bootstrap"))
-  compile(project(":org.apache.zest.libraries:org.apache.zest.library.eventsourcing"))
-  compile(project(":org.apache.zest.libraries:org.apache.zest.library.fileconfig"))
-  compile(libraries.jdbm)
-
-  testCompile(project(":org.apache.zest.core:org.apache.zest.core.testsupport"))
-  testCompile project( ':org.apache.zest.extensions:org.apache.zest.extension.valueserialization-orgjson' )
-
-  testRuntime(project(":org.apache.zest.core:org.apache.zest.core.runtime"))
-  testRuntime(libraries.logback)
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing-jdbm/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing-jdbm/dev-status.xml b/libraries/eventsourcing-jdbm/dev-status.xml
deleted file mode 100644
index 0ae5138..0000000
--- a/libraries/eventsourcing-jdbm/dev-status.xml
+++ /dev/null
@@ -1,38 +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://zest.apache.org/schemas/2008/dev-status/1"
-        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
-  <status>
-    <!--none,early,beta,stable,mature-->
-    <codebase>beta</codebase>
-
-    <!-- none, brief, good, complete -->
-    <documentation>brief</documentation>
-
-    <!-- none, some, good, complete -->
-    <unittests>some</unittests>
-  </status>
-  <licenses>
-    <license>ALv2</license>
-  </licenses>
-</module>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing-jdbm/src/main/java/org/apache/zest/library/eventsourcing/domain/source/jdbm/JdbmEventStoreService.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing-jdbm/src/main/java/org/apache/zest/library/eventsourcing/domain/source/jdbm/JdbmEventStoreService.java b/libraries/eventsourcing-jdbm/src/main/java/org/apache/zest/library/eventsourcing/domain/source/jdbm/JdbmEventStoreService.java
deleted file mode 100644
index 695016a..0000000
--- a/libraries/eventsourcing-jdbm/src/main/java/org/apache/zest/library/eventsourcing/domain/source/jdbm/JdbmEventStoreService.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.source.jdbm;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.util.Properties;
-import java.util.function.Function;
-import jdbm.RecordManager;
-import jdbm.RecordManagerFactory;
-import jdbm.RecordManagerOptions;
-import jdbm.Serializer;
-import jdbm.btree.BTree;
-import jdbm.helper.ByteArrayComparator;
-import jdbm.helper.DefaultSerializer;
-import jdbm.helper.Tuple;
-import jdbm.helper.TupleBrowser;
-import jdbm.recman.CacheRecordManager;
-import org.apache.zest.api.activation.Activators;
-import org.apache.zest.api.injection.scope.Service;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.service.ServiceComposite;
-import org.apache.zest.api.service.qualifier.Tagged;
-import org.apache.zest.api.value.ValueSerialization;
-import org.apache.zest.io.Input;
-import org.apache.zest.io.Output;
-import org.apache.zest.io.Receiver;
-import org.apache.zest.io.Sender;
-import org.apache.zest.io.Transforms;
-import org.apache.zest.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
-import org.apache.zest.library.eventsourcing.domain.source.AbstractEventStoreMixin;
-import org.apache.zest.library.eventsourcing.domain.source.EventManagement;
-import org.apache.zest.library.eventsourcing.domain.source.EventSource;
-import org.apache.zest.library.eventsourcing.domain.source.EventStore;
-import org.apache.zest.library.eventsourcing.domain.source.EventStoreActivation;
-import org.apache.zest.library.eventsourcing.domain.source.EventStream;
-import org.apache.zest.library.fileconfig.FileConfiguration;
-
-/**
- * JAVADOC
- */
-@Mixins( JdbmEventStoreService.JdbmEventStoreMixin.class )
-@Activators( EventStoreActivation.Activator.class )
-public interface JdbmEventStoreService
-    extends EventSource, EventStore, EventStream, EventManagement, EventStoreActivation, ServiceComposite
-{
-
-    class JdbmEventStoreMixin
-        extends AbstractEventStoreMixin
-        implements EventManagement, EventSource
-    {
-        @Service
-        private FileConfiguration fileConfig;
-
-        @Service
-        @Tagged( ValueSerialization.Formats.JSON )
-        private ValueSerialization valueSerialization;
-
-        private RecordManager recordManager;
-        private BTree index;
-        private Serializer serializer;
-        private File dataFile;
-
-        private long currentCount;
-
-        @Override
-        public void activateEventStore()
-            throws Exception
-        {
-            super.activateEventStore();
-            dataFile = new File( fileConfig.dataDirectory(), identity.identity() + "/events" );
-            File directory = dataFile.getAbsoluteFile().getParentFile();
-            directory.mkdirs();
-            String name = dataFile.getAbsolutePath();
-            Properties properties = new Properties();
-            properties.put( RecordManagerOptions.AUTO_COMMIT, "false" );
-            properties.put( RecordManagerOptions.DISABLE_TRANSACTIONS, "false" );
-            initialize( name, properties );
-        }
-
-        @Override
-        public void passivateEventStore()
-                throws Exception
-        {
-            super.passivateEventStore();
-            recordManager.close();
-        }
-
-        @Override
-        public Output<String, IOException> restore()
-        {
-            // Commit every 1000 events, convert from string to value, and then store. Put a lock around the whole thing
-            Output<String, IOException> map = Transforms.map( new Transforms.ProgressLog<String>( 1000 )
-            {
-                @Override
-                protected void logProgress()
-                {
-                    try
-                    {
-                        recordManager.commit(); // Commit every 1000 transactions to avoid OutOfMemory issues
-                    }
-                    catch( IOException e )
-                    {
-                        throw new IllegalStateException( "Could not commit data", e );
-                    }
-                }
-            }, Transforms.map( new Function<String, UnitOfWorkDomainEventsValue>()
-            {
-                @Override
-                public UnitOfWorkDomainEventsValue apply( String item )
-                {
-                    return valueSerialization.<UnitOfWorkDomainEventsValue>deserialize( module, eventsType, item );
-                }
-            }, storeEvents0() ) );
-
-            return Transforms.lock( JdbmEventStoreMixin.this.lock,
-                                    map );
-        }
-
-        // EventStore implementation
-        @Override
-        public Input<UnitOfWorkDomainEventsValue, IOException> events( final long offset, long limit )
-        {
-            return new Input<UnitOfWorkDomainEventsValue, IOException>()
-            {
-                @Override
-                public <ReceiverThrowableType extends Throwable> void transferTo( Output<? super UnitOfWorkDomainEventsValue, ReceiverThrowableType> output )
-                    throws IOException, ReceiverThrowableType
-                {
-                    output.receiveFrom( new Sender<UnitOfWorkDomainEventsValue, IOException>()
-                    {
-                        @Override
-                        public <ReceiverThrowableType extends Throwable> void sendTo( Receiver<? super UnitOfWorkDomainEventsValue, ReceiverThrowableType> receiver )
-                            throws ReceiverThrowableType, IOException
-                        {
-                            // Lock datastore first
-                            lock();
-
-                            try
-                            {
-                                final TupleBrowser browser = index.browse( offset + 1 );
-
-                                Tuple tuple = new Tuple();
-
-                                while( browser.getNext( tuple ) )
-                                {
-                                    // Get next transaction
-                                    UnitOfWorkDomainEventsValue domainEvents = readTransactionEvents( tuple );
-
-                                    receiver.receive( domainEvents );
-                                }
-                            }
-                            catch( Exception e )
-                            {
-                                logger.warn( "Could not iterate events", e );
-                            }
-                            finally
-                            {
-                                lock.unlock();
-                            }
-                        }
-                    } );
-                }
-            };
-        }
-
-        @Override
-        public long count()
-        {
-            return currentCount;
-        }
-
-        @Override
-        protected Output<UnitOfWorkDomainEventsValue, IOException> storeEvents0()
-        {
-            return new Output<UnitOfWorkDomainEventsValue, IOException>()
-            {
-                @Override
-                public <SenderThrowableType extends Throwable> void receiveFrom( Sender<? extends UnitOfWorkDomainEventsValue, SenderThrowableType> sender )
-                    throws IOException, SenderThrowableType
-                {
-                    try
-                    {
-                        sender.sendTo( new Receiver<UnitOfWorkDomainEventsValue, IOException>()
-                        {
-                            @Override
-                            public void receive( UnitOfWorkDomainEventsValue item )
-                                throws IOException
-                            {
-                                String jsonString = valueSerialization.serialize( item );
-                                currentCount++;
-                                index.insert( currentCount, jsonString.getBytes( "UTF-8" ), false );
-                            }
-                        } );
-                        recordManager.commit();
-                    }
-                    catch( IOException e )
-                    {
-                        recordManager.rollback();
-                        throw e;
-                    }
-                    catch( Throwable e )
-                    {
-                        recordManager.rollback();
-                        throw (SenderThrowableType) e;
-                    }
-                }
-            };
-        }
-
-        private void initialize( String name, Properties properties )
-            throws IOException
-        {
-            recordManager = RecordManagerFactory.createRecordManager( name, properties );
-            serializer = DefaultSerializer.INSTANCE;
-            recordManager = new CacheRecordManager( recordManager, 1000, false );
-            long recid = recordManager.getNamedObject( "index" );
-            if( recid != 0 )
-            {
-                index = BTree.load( recordManager, recid );
-                currentCount = index.size();
-            }
-            else
-            {
-                ByteArrayComparator comparator = new ByteArrayComparator();
-                index = BTree.createInstance( recordManager, comparator, serializer, DefaultSerializer.INSTANCE, 16 );
-                recordManager.setNamedObject( "index", index.getRecid() );
-                currentCount = 0;
-            }
-            recordManager.commit();
-        }
-
-        private UnitOfWorkDomainEventsValue readTransactionEvents( Tuple tuple )
-            throws UnsupportedEncodingException
-        {
-            byte[] eventData = (byte[]) tuple.getValue();
-            String eventJson = new String( eventData, "UTF-8" );
-            return valueSerialization.<UnitOfWorkDomainEventsValue>deserialize( module, eventsType, eventJson );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing-jdbm/src/main/java/org/apache/zest/library/eventsourcing/domain/source/jdbm/package.html
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing-jdbm/src/main/java/org/apache/zest/library/eventsourcing/domain/source/jdbm/package.html b/libraries/eventsourcing-jdbm/src/main/java/org/apache/zest/library/eventsourcing/domain/source/jdbm/package.html
deleted file mode 100644
index 8f71efb..0000000
--- a/libraries/eventsourcing-jdbm/src/main/java/org/apache/zest/library/eventsourcing/domain/source/jdbm/package.html
+++ /dev/null
@@ -1,24 +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>JDBM EventStore.</h2>
-    </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing-jdbm/src/test/java/org/apache/zest/library/eventsourcing/domain/source/jdbm/JdbmEventStoreServiceTest.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing-jdbm/src/test/java/org/apache/zest/library/eventsourcing/domain/source/jdbm/JdbmEventStoreServiceTest.java b/libraries/eventsourcing-jdbm/src/test/java/org/apache/zest/library/eventsourcing/domain/source/jdbm/JdbmEventStoreServiceTest.java
deleted file mode 100644
index 962ef28..0000000
--- a/libraries/eventsourcing-jdbm/src/test/java/org/apache/zest/library/eventsourcing/domain/source/jdbm/JdbmEventStoreServiceTest.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.source.jdbm;
-
-import java.io.IOException;
-import java.security.Principal;
-import java.util.function.Function;
-import org.junit.Test;
-import org.apache.zest.api.common.UseDefaults;
-import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.unitofwork.UnitOfWork;
-import org.apache.zest.api.unitofwork.UnitOfWorkCompletionException;
-import org.apache.zest.api.usecase.UsecaseBuilder;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ImportedServiceDeclaration;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.io.Outputs;
-import org.apache.zest.io.Transforms;
-import org.apache.zest.library.eventsourcing.domain.api.DomainEvent;
-import org.apache.zest.library.eventsourcing.domain.api.DomainEventValue;
-import org.apache.zest.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
-import org.apache.zest.library.eventsourcing.domain.factory.CurrentUserUoWPrincipal;
-import org.apache.zest.library.eventsourcing.domain.factory.DomainEventCreationConcern;
-import org.apache.zest.library.eventsourcing.domain.factory.DomainEventFactoryService;
-import org.apache.zest.library.eventsourcing.domain.source.EventSource;
-import org.apache.zest.library.fileconfig.FileConfigurationService;
-import org.apache.zest.test.AbstractZestTest;
-import org.apache.zest.test.EntityTestAssembler;
-import org.apache.zest.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
-
-public class JdbmEventStoreServiceTest
-        extends AbstractZestTest
-    {
-        @Override
-        public void assemble( ModuleAssembly module ) throws AssemblyException
-        {
-            module.layer().application().setName( "JDBMEventStoreTest" );
-
-            new EntityTestAssembler(  ).assemble( module );
-
-            module.values( DomainEventValue.class, UnitOfWorkDomainEventsValue.class );
-            module.services( FileConfigurationService.class );
-            new OrgJsonValueSerializationAssembler().assemble( module );
-            module.services( JdbmEventStoreService.class );
-            module.services( DomainEventFactoryService.class );
-            module.importedServices( CurrentUserUoWPrincipal.class ).importedBy( ImportedServiceDeclaration.NEW_OBJECT );
-            module.objects( CurrentUserUoWPrincipal.class );
-
-            module.entities( TestEntity.class ).withConcerns(DomainEventCreationConcern.class);
-        }
-
-        @Test
-        public void testDomainEvent() throws UnitOfWorkCompletionException, IOException
-        {
-            UnitOfWork uow = unitOfWorkFactory.newUnitOfWork( UsecaseBuilder.newUsecase( "Create entity" ));
-            TestEntity entity = uow.newEntity( TestEntity.class );
-            uow.complete();
-
-            int count = 10;
-            for (int i = 0; i < count; i++)
-            {
-                uow = unitOfWorkFactory.newUnitOfWork( UsecaseBuilder.newUsecase( "Change description" ));
-                uow.setMetaInfo( new Principal()
-                {
-                    public String getName()
-                    {
-                        return "administrator";
-                    }
-                });
-
-                entity = uow.get( entity );
-                entity.changeDescription( "New description" );
-                uow.complete();
-            }
-
-            EventSource source = serviceFinder.findService( EventSource.class ).get();
-
-            source.events( 0, Long.MAX_VALUE ).transferTo( Transforms.map( new Function<UnitOfWorkDomainEventsValue, String>()
-                    {
-                        public String apply( UnitOfWorkDomainEventsValue unitOfWorkDomainEventsValue )
-                        {
-                            return unitOfWorkDomainEventsValue.toString();
-                        }
-                    }, Outputs.systemOut() ));
-        }
-
-        @Mixins( TestEntity.Mixin.class )
-        public interface TestEntity
-            extends EntityComposite
-        {
-            @UseDefaults
-            Property<String> description();
-
-            @DomainEvent
-            void changeDescription(String newName);
-
-            abstract class Mixin
-                implements TestEntity
-            {
-                public void changeDescription( String newName )
-                {
-                    description().set( newName );
-                }
-            }
-        }
-    }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing-rest/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing-rest/build.gradle b/libraries/eventsourcing-rest/build.gradle
deleted file mode 100644
index 6f6e89a..0000000
--- a/libraries/eventsourcing-rest/build.gradle
+++ /dev/null
@@ -1,34 +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\u2122 Event Sourcing Library for Restful applications."
-
-jar { manifest { name = "Apache Zest\u2122 Library - Event Sourcing - Rest" }}
-
-dependencies {
-  compile(project(":org.apache.zest.core:org.apache.zest.core.bootstrap"))
-  compile(project(":org.apache.zest.libraries:org.apache.zest.library.eventsourcing"))
-  compile(libraries.restlet)
-
-  testCompile(project(":org.apache.zest.core:org.apache.zest.core.testsupport"))
-
-  testRuntime(project(":org.apache.zest.core:org.apache.zest.core.runtime"))
-  testRuntime(libraries.logback)
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing-rest/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing-rest/dev-status.xml b/libraries/eventsourcing-rest/dev-status.xml
deleted file mode 100644
index 0ae5138..0000000
--- a/libraries/eventsourcing-rest/dev-status.xml
+++ /dev/null
@@ -1,38 +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://zest.apache.org/schemas/2008/dev-status/1"
-        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
-  <status>
-    <!--none,early,beta,stable,mature-->
-    <codebase>beta</codebase>
-
-    <!-- none, brief, good, complete -->
-    <documentation>brief</documentation>
-
-    <!-- none, some, good, complete -->
-    <unittests>some</unittests>
-  </status>
-  <licenses>
-    <license>ALv2</license>
-  </licenses>
-</module>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing-rest/src/main/java/org/apache/zest/library/eventsourcing/domain/rest/server/DomainEventSourceResource.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing-rest/src/main/java/org/apache/zest/library/eventsourcing/domain/rest/server/DomainEventSourceResource.java b/libraries/eventsourcing-rest/src/main/java/org/apache/zest/library/eventsourcing/domain/rest/server/DomainEventSourceResource.java
deleted file mode 100644
index cdd435e..0000000
--- a/libraries/eventsourcing-rest/src/main/java/org/apache/zest/library/eventsourcing/domain/rest/server/DomainEventSourceResource.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.rest.server;
-
-import java.io.IOException;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.zest.api.injection.scope.Service;
-import org.apache.zest.api.service.qualifier.Tagged;
-import org.apache.zest.functional.Iterables;
-import org.apache.zest.io.Outputs;
-import org.apache.zest.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
-import org.apache.zest.library.eventsourcing.domain.source.EventSource;
-import org.restlet.Request;
-import org.restlet.Response;
-import org.restlet.Restlet;
-import org.restlet.data.CharacterSet;
-import org.restlet.data.MediaType;
-import org.restlet.data.Reference;
-import org.restlet.data.Status;
-import org.restlet.ext.atom.Content;
-import org.restlet.ext.atom.Entry;
-import org.restlet.ext.atom.Feed;
-import org.restlet.ext.atom.Link;
-import org.restlet.ext.atom.Relation;
-import org.restlet.ext.atom.Text;
-import org.restlet.representation.StringRepresentation;
-import org.restlet.representation.WriterRepresentation;
-import org.restlet.resource.ResourceException;
-
-import static java.util.Date.from;
-import static org.apache.zest.functional.Iterables.iterable;
-
-/**
- * Get events in various formats.
- * <p>
- * The feed is paged, with one
- * current set page, one working set page, and the rest being archive pages that never change. The links "next", "previous",
- * "first" and "last" are used as expected per the Atom spec.
- * </p>
- * <pre><code>
- * / = current set of most recent events (event range: count-pagesize to count)
- * /n,m = events from index n to index m. These are archive pages.
- * /n = working set page, where n is the first event index to be presented
- * </code></pre>
- */
-public class DomainEventSourceResource
-        extends Restlet
-{
-    EventSource source;
-
-    public DomainEventSourceResource( @Service @Tagged("domain") EventSource source )
-    {
-        this.source = source;
-    }
-
-    @Override
-    public void handle( Request request, Response response )
-    {
-        long eventCount = source.count();
-        long pageSize = 10;
-        long startEvent = -1;
-        long endEvent = -1;
-        long limit = pageSize;
-
-        final List<UnitOfWorkDomainEventsValue> eventsValues = new ArrayList<UnitOfWorkDomainEventsValue>();
-
-        final Feed feed = new Feed();
-        feed.setBaseReference( request.getResourceRef().getParentRef() );
-        List<Link> links = feed.getLinks();
-
-        String remainingPart = request.getResourceRef().getRemainingPart();
-        if (remainingPart.equals( "/" ))
-        {
-            // Current set - always contains the last "pageSize" events
-            startEvent = Math.max( 0, eventCount - pageSize - 1 );
-
-            feed.setTitle( new Text( "Current set" ) );
-
-            if (startEvent > 0)
-            {
-                long previousStart = Math.max(0, startEvent-pageSize);
-                long previousEnd = startEvent-1;
-
-                Link link = new Link( new Reference( previousStart+","+previousEnd ), new Relation( "previous" ), MediaType.APPLICATION_ATOM );
-                link.setTitle( "Previous page" );
-                links.add( link );
-            }
-
-        } else
-        {
-            // Archive
-            String[] indices = remainingPart.substring(1).split( "," );
-
-            if (indices.length == 1)
-            {
-                // Working set
-                startEvent = Long.parseLong( indices[0] );
-                endEvent = startEvent + pageSize - 1;
-                limit = pageSize;
-                feed.setTitle( new Text("Working set") );
-            } else if (indices.length == 2)
-            {
-                feed.setTitle( new Text("Archive page") );
-                startEvent = Long.parseLong( indices[0] );
-                endEvent = Long.parseLong( indices[1] );
-                limit = 1+endEvent-startEvent;
-
-            } else
-                throw new ResourceException( Status.CLIENT_ERROR_NOT_FOUND );
-
-            if (startEvent > 0)
-            {
-                long previousStart = Math.max(0, startEvent-pageSize);
-                long previousEnd = startEvent-1;
-
-                Link link = new Link( new Reference( previousStart+","+previousEnd ), new Relation( "previous" ), MediaType.APPLICATION_ATOM );
-                link.setTitle( "Previous page" );
-                links.add( link );
-            }
-
-            long nextStart = endEvent+1;
-            long nextEnd = nextStart+pageSize-1;
-
-            if (nextStart < eventCount)
-                if (nextEnd >= eventCount)
-                {
-                    Link next = new Link( new Reference( nextStart+"" ), new Relation( "next" ), MediaType.APPLICATION_ATOM );
-                    next.setTitle( "Working set" );
-                    links.add( next );
-                } else
-                {
-                    Link next = new Link( new Reference( nextStart+","+nextEnd ), new Relation( "next" ), MediaType.APPLICATION_ATOM );
-                    next.setTitle( "Next page" );
-                    links.add( next );
-                }
-        }
-
-        try
-        {
-            source.events( startEvent, limit ).transferTo( Outputs.collection( eventsValues ) );
-        } catch (Throwable throwable)
-        {
-            throw new ResourceException( Status.SERVER_ERROR_INTERNAL, throwable );
-        }
-
-        Link last = new Link( new Reference( "0,"+(pageSize-1) ), new Relation( "last" ), MediaType.APPLICATION_ATOM );
-        last.setTitle( "Last archive page" );
-        links.add( last );
-
-        Link first = new Link( new Reference( "." ), new Relation( "first" ), MediaType.APPLICATION_ATOM );
-        first.setTitle( "Current set" );
-        links.add( first );
-
-/*
-        if (previousPage != -1)
-        {
-            Link link = new Link( new Reference( ""+previousPage ), new Relation( "prev-archive" ), MediaType.APPLICATION_ATOM );
-            link.setTitle( "Previous archive page" );
-            links.add( link );
-        }
-        if (nextPage != -1)
-        {
-            Link link = new Link( new Reference( "" + nextPage ), new Relation( "next-archive" ), MediaType.APPLICATION_ATOM );
-            link.setTitle( "Next archive page" );
-            links.add( link );
-        }
-        else if (startEvent != workingSetOffset)
-        {
-            Link next = new Link( new Reference( "" ), new Relation( "next" ), MediaType.APPLICATION_ATOM );
-            next.setTitle( "Next page" );
-            links.add( next );
-        }
-*/
-
-        java.util.Date lastModified = null;
-        for (UnitOfWorkDomainEventsValue eventsValue : eventsValues)
-        {
-            Entry entry = new Entry();
-            entry.setTitle( new Text( eventsValue.usecase().get() + "(" + eventsValue.user().get() + ")" ) );
-            entry.setPublished( from( eventsValue.timestamp().get() ) );
-            lastModified = from( eventsValue.timestamp().get() );
-            entry.setModificationDate( lastModified );
-            entry.setId( Long.toString( startEvent + 1 ) );
-            startEvent++;
-            Content content = new Content();
-            content.setInlineContent( new StringRepresentation( eventsValue.toString(), MediaType.APPLICATION_JSON ) );
-            entry.setContent( content );
-            feed.getEntries().add( entry );
-        }
-
-        feed.setModificationDate( lastModified );
-
-        MediaType mediaType = request.getClientInfo().getPreferredMediaType( Iterables.toList( iterable( MediaType.TEXT_HTML, MediaType.APPLICATION_ATOM ) ));
-
-        if (MediaType.APPLICATION_ATOM.equals( mediaType ))
-        {
-            WriterRepresentation representation = new WriterRepresentation( MediaType.APPLICATION_ATOM )
-            {
-                @Override
-                public void write( final Writer writer ) throws IOException
-                {
-                    feed.write( writer );
-                }
-            };
-            representation.setCharacterSet( CharacterSet.UTF_8 );
-            response.setEntity( representation );
-        } else
-        {
-            WriterRepresentation representation = new WriterRepresentation(MediaType.TEXT_HTML)
-            {
-                @Override
-                public void write( Writer writer ) throws IOException
-                {
-                    writer.append( "<html><head><title>Events</title></head><body>" );
-
-                    for( Link link : feed.getLinks() )
-                    {
-                        writer.append( "<a href=\"").append( link.getHref().getPath()).append( "\">" );
-                        writer.append( link.getTitle() );
-                        writer.append( "</a><br/>" );
-                    }
-
-                    writer.append( "<ol>" );
-                    for( Entry entry : feed.getEntries() )
-                    {
-                        writer.append( "<li>" ).append( entry.getTitle().toString() ).append( "</li>" );
-                    }
-                    writer.append( "</ol></body>" );
-                }
-            };
-            representation.setCharacterSet( CharacterSet.UTF_8 );
-            response.setEntity( representation );
-        }
-
-/*
-        } else
-        {
-            throw new ResourceException( Status.CLIENT_ERROR_UNSUPPORTED_MEDIA_TYPE );
-        }
-*/
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing-rest/src/main/java/org/apache/zest/library/eventsourcing/domain/rest/server/package.html
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing-rest/src/main/java/org/apache/zest/library/eventsourcing/domain/rest/server/package.html b/libraries/eventsourcing-rest/src/main/java/org/apache/zest/library/eventsourcing/domain/rest/server/package.html
deleted file mode 100644
index 9e9db25..0000000
--- a/libraries/eventsourcing-rest/src/main/java/org/apache/zest/library/eventsourcing/domain/rest/server/package.html
+++ /dev/null
@@ -1,24 +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>Restlet Resource exposing EventSourcing Events as Atom.</h2>
-    </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing-rest/src/test/java/org/apache/zest/library/eventsourcing/domain/rest/server/DomainEventSourceResourceSample.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing-rest/src/test/java/org/apache/zest/library/eventsourcing/domain/rest/server/DomainEventSourceResourceSample.java b/libraries/eventsourcing-rest/src/test/java/org/apache/zest/library/eventsourcing/domain/rest/server/DomainEventSourceResourceSample.java
deleted file mode 100644
index a44fe4c..0000000
--- a/libraries/eventsourcing-rest/src/test/java/org/apache/zest/library/eventsourcing/domain/rest/server/DomainEventSourceResourceSample.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.rest.server;
-
-import org.apache.zest.api.common.UseDefaults;
-import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.api.injection.scope.Service;
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.unitofwork.UnitOfWork;
-import org.apache.zest.api.unitofwork.UnitOfWorkCompletionException;
-import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
-import org.apache.zest.api.usecase.UsecaseBuilder;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ImportedServiceDeclaration;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.bootstrap.SingletonAssembler;
-import org.apache.zest.library.eventsourcing.domain.api.DomainEvent;
-import org.apache.zest.library.eventsourcing.domain.api.DomainEventValue;
-import org.apache.zest.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
-import org.apache.zest.library.eventsourcing.domain.factory.CurrentUserUoWPrincipal;
-import org.apache.zest.library.eventsourcing.domain.factory.DomainEventCreationConcern;
-import org.apache.zest.library.eventsourcing.domain.factory.DomainEventFactoryService;
-import org.apache.zest.library.eventsourcing.domain.source.EventSource;
-import org.apache.zest.library.eventsourcing.domain.source.memory.MemoryEventStoreService;
-import org.apache.zest.test.EntityTestAssembler;
-import org.restlet.*;
-import org.restlet.data.Protocol;
-import org.restlet.data.Status;
-import org.restlet.representation.StringRepresentation;
-import org.restlet.resource.ResourceException;
-
-import java.security.Principal;
-
-/**
- * Start simple web server that exposes the Restlet resource. Test through browser.
- */
-public class DomainEventSourceResourceSample
-{
-    public static void main( String[] args ) throws Exception
-    {
-        Component component = new Component();
-        component.getServers().add( Protocol.HTTP, 8080 );
-
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            public void assemble( ModuleAssembly module ) throws AssemblyException
-            {
-                new EntityTestAssembler().assemble( module );
-
-                module.values( DomainEventValue.class, UnitOfWorkDomainEventsValue.class );
-                module.services( MemoryEventStoreService.class ).taggedWith( "domain" );
-                module.services( DomainEventFactoryService.class );
-                module.importedServices( CurrentUserUoWPrincipal.class ).importedBy( ImportedServiceDeclaration.NEW_OBJECT );
-                module.objects( CurrentUserUoWPrincipal.class );
-
-                module.objects( DomainEventSourceResource.class, PingResource.class );
-
-                module.entities( TestEntity.class ).withConcerns( DomainEventCreationConcern.class );
-            }
-        };
-
-        component.getDefaultHost().attach( "/events", new TestApplication( assembler ) );
-        component.getDefaultHost().attach( "/ping", assembler.module().newObject( PingResource.class ) );
-        component.start();
-
-        generateTestData(assembler.module().unitOfWorkFactory());
-    }
-
-    private static void generateTestData(UnitOfWorkFactory unitOfWorkFactory) throws UnitOfWorkCompletionException
-    {
-        // Set principal for the UoW
-        Principal administratorPrincipal = new Principal()
-        {
-            public String getName()
-            {
-                return "administrator";
-            }
-        };
-
-        // Perform UoW with usecase defined
-        for (int i = 0; i < 43; i++)
-        {
-            UnitOfWork uow = unitOfWorkFactory.newUnitOfWork( UsecaseBuilder.newUsecase( "Change description "+(i+1) ));
-            uow.setMetaInfo( administratorPrincipal );
-
-            TestEntity entity = uow.newEntity( TestEntity.class );
-            entity.changedDescription( "New description" );
-            uow.complete();
-        }
-    }
-
-    static class TestApplication
-        extends Application
-    {
-        private final SingletonAssembler assembler;
-
-        TestApplication(SingletonAssembler assembler)
-        {
-            this.assembler = assembler;
-        }
-
-        @Override
-        public Restlet createInboundRoot()
-        {
-            getTunnelService().setExtensionsTunnel( true );
-            return assembler.module().newObject(DomainEventSourceResource.class  );
-        }
-    }
-
-
-    @Mixins(TestEntity.Mixin.class)
-    public interface TestEntity
-            extends EntityComposite
-    {
-        @UseDefaults
-        Property<String> description();
-
-        @DomainEvent
-        void changedDescription( String newName );
-
-        abstract class Mixin
-                implements TestEntity
-        {
-            public void changedDescription( String newName )
-            {
-                description().set( newName );
-            }
-        }
-    }
-
-    // Used to create more events
-    public static class PingResource
-        extends Restlet
-    {
-        @Structure
-        UnitOfWorkFactory unitOfWorkFactory;
-
-        @Service
-        EventSource eventSource;
-
-        @Override
-        public void handle( Request request, Response response )
-        {
-            // Set principal for the UoW
-            Principal administratorPrincipal = new Principal()
-            {
-                public String getName()
-                {
-                    return "administrator";
-                }
-            };
-
-            // Perform UoW with usecase defined
-            try
-            {
-                UnitOfWork uow = unitOfWorkFactory.newUnitOfWork( UsecaseBuilder.newUsecase( "Change description "+(eventSource.count()) ));
-                uow.setMetaInfo( administratorPrincipal );
-
-                TestEntity entity = uow.newEntity( TestEntity.class );
-                entity.changedDescription( "New description" );
-                uow.complete();
-
-                response.setEntity( new StringRepresentation( "Event created" ) );
-                response.setStatus( Status.SUCCESS_OK );
-            } catch (UnitOfWorkCompletionException e)
-            {
-                throw new ResourceException(e);
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/build.gradle b/libraries/eventsourcing/build.gradle
deleted file mode 100644
index 4f11410..0000000
--- a/libraries/eventsourcing/build.gradle
+++ /dev/null
@@ -1,33 +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\u2122 Event Sourcing Library."
-
-jar { manifest { name = "Apache Zest\u2122 Library - Event Sourcing" }}
-
-dependencies {
-  compile(project(":org.apache.zest.core:org.apache.zest.core.bootstrap"))
-  compile libraries.slf4j_api
-
-  testCompile(project(":org.apache.zest.core:org.apache.zest.core.testsupport"))
-
-  testRuntime(project(":org.apache.zest.core:org.apache.zest.core.runtime"))
-  testRuntime(libraries.logback)
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/dev-status.xml b/libraries/eventsourcing/dev-status.xml
deleted file mode 100644
index 0ae5138..0000000
--- a/libraries/eventsourcing/dev-status.xml
+++ /dev/null
@@ -1,38 +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://zest.apache.org/schemas/2008/dev-status/1"
-        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
-  <status>
-    <!--none,early,beta,stable,mature-->
-    <codebase>beta</codebase>
-
-    <!-- none, brief, good, complete -->
-    <documentation>brief</documentation>
-
-    <!-- none, some, good, complete -->
-    <unittests>some</unittests>
-  </status>
-  <licenses>
-    <license>ALv2</license>
-  </licenses>
-</module>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/docs/eventsourcing.txt
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/docs/eventsourcing.txt b/libraries/eventsourcing/src/docs/eventsourcing.txt
deleted file mode 100644
index 882eee1..0000000
--- a/libraries/eventsourcing/src/docs/eventsourcing.txt
+++ /dev/null
@@ -1,135 +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, Event Sourcing Library]]
-= Event Sourcing =
-
-[devstatus]
---------------
-source=libraries/eventsourcing/dev-status.xml
---------------
-
-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.
-
-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 `EventStore` after successfully completed `UnitOfWork` as collection together (see `UnitOfWorkDomainEventsValue` and `TransactionApplicationEvents`).
-
-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 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*
-
-EventStore supports indexed and streamed access to events feed.
-There is in-memory and JDBM backed implementations.
-
-[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/apache/zest/library/eventsourcing/application/ApplicationEventTest.java
-tag=assemblyAE
-----
-
-Configure application events store:
-[snippet,java]
-----
-source=libraries/eventsourcing/src/test/java/org/apache/zest/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/apache/zest/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/apache/zest/library/eventsourcing/application/ApplicationEventTest.java
-tag=concernAE
-----
-
-== Domain Events ==
-
-Assembly:
-
-[snippet,java]
-----
-source=libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/domain/DomainEventTest.java
-tag=assemblyDE
-----
-
-Configure domain events store:
-
-[snippet,java]
-----
-source=libraries/eventsourcing/src/test/java/org/apache/zest/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/apache/zest/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/apache/zest/library/eventsourcing/domain/DomainEventTest.java
-tag=concernDE
-----

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/api/ApplicationEvent.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/api/ApplicationEvent.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/api/ApplicationEvent.java
deleted file mode 100644
index 979761a..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/api/ApplicationEvent.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.application.api;
-
-import java.time.Instant;
-import org.apache.zest.api.entity.Identity;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.value.ValueComposite;
-
-/**
- * Representation of an application-event.
- * <p>
- * An application event is triggered by calling a method
- * that is of the form:
- * </p>
- * <pre><code>
- * void someName(ApplicationEvent event, SomeParam param);
- * </code></pre>
- * <p>
- * The "event" argument should be invoked with null, as it will be created during
- * the method call. If it is not null, then the method call is a replay of previously
- * created events.
- * </p>
- */
-public interface ApplicationEvent
-        extends ValueComposite, Identity
-{
-    // Usecase
-    Property<String> usecase();
-
-    // Name of method/event
-    Property<String> name();
-
-    // When the event was created
-    Property<Instant> on();
-
-    // Method parameters as JSON
-    Property<String> parameters();
-
-    // Version of the application that created this event
-    Property<String> version();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/api/TransactionApplicationEvents.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/api/TransactionApplicationEvents.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/api/TransactionApplicationEvents.java
deleted file mode 100644
index a5e8a23..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/api/TransactionApplicationEvents.java
+++ /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.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.application.api;
-
-import java.util.List;
-import org.apache.zest.api.common.UseDefaults;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.value.ValueComposite;
-
-/**
- * List of events for a single transaction. Events must always be consumed
- * in transaction units, in order to ensure that the result is consistent
- * with what happened in that transaction.
- */
-public interface TransactionApplicationEvents
-        extends ValueComposite
-{
-    // Timestamp when the events were stored in the EventStore
-    // Note that if events are sent from one store to another this timestamp
-    // is updated when it is re-stored
-
-    Property<Long> timestamp();
-
-    // List of events for this transaction
-
-    @UseDefaults
-    Property<List<ApplicationEvent>> events();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/api/package.html
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/api/package.html b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/api/package.html
deleted file mode 100644
index 1ba5a07..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/api/package.html
+++ /dev/null
@@ -1,24 +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>EventSourcing Application API.</h2>
-    </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/ApplicationEventCreationConcern.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/ApplicationEventCreationConcern.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/ApplicationEventCreationConcern.java
deleted file mode 100644
index c4a70f4..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/ApplicationEventCreationConcern.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.application.factory;
-
-import java.lang.reflect.Method;
-import org.apache.zest.api.common.AppliesTo;
-import org.apache.zest.api.concern.GenericConcern;
-import org.apache.zest.api.injection.scope.Service;
-import org.apache.zest.library.eventsourcing.application.api.ApplicationEvent;
-
-/**
- * Generate application event for event method
- */
-@AppliesTo(ApplicationEventMethodFilter.class)
-public class ApplicationEventCreationConcern
-        extends GenericConcern
-{
-    @Service
-    ApplicationEventFactory eventFactory;
-
-    @Override
-    public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable
-    {
-        if (args[0] == null)
-        {
-            // Create application event
-            ApplicationEvent event = eventFactory.createEvent( method.getName(), args );
-            args[0] = event;
-        }
-
-        return next.invoke( proxy, method, args );
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/ApplicationEventCreator.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/ApplicationEventCreator.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/ApplicationEventCreator.java
deleted file mode 100644
index 8b2f557..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/ApplicationEventCreator.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.application.factory;
-
-import org.apache.zest.api.concern.Concerns;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.mixin.NoopMixin;
-
-/**
- * JAVADOC
- */
-@Mixins(NoopMixin.class)
-@Concerns(ApplicationEventCreationConcern.class)
-public interface ApplicationEventCreator
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/ApplicationEventFactory.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/ApplicationEventFactory.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/ApplicationEventFactory.java
deleted file mode 100644
index e2972e0..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/ApplicationEventFactory.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.application.factory;
-
-import org.apache.zest.library.eventsourcing.application.api.ApplicationEvent;
-
-/**
- * Factory for ApplicationEvents
- */
-public interface ApplicationEventFactory
-{
-    ApplicationEvent createEvent( String name, Object[] args );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/ApplicationEventFactoryService.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/ApplicationEventFactoryService.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/ApplicationEventFactoryService.java
deleted file mode 100644
index ae83019..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/ApplicationEventFactoryService.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.application.factory;
-
-import java.time.Instant;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.json.JSONStringer;
-import org.json.JSONWriter;
-import org.apache.zest.api.concern.Concerns;
-import org.apache.zest.api.entity.IdentityGenerator;
-import org.apache.zest.api.injection.scope.Service;
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.service.ServiceComposite;
-import org.apache.zest.api.structure.Application;
-import org.apache.zest.api.unitofwork.UnitOfWork;
-import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
-import org.apache.zest.api.value.ValueBuilder;
-import org.apache.zest.api.value.ValueBuilderFactory;
-import org.apache.zest.library.eventsourcing.application.api.ApplicationEvent;
-import org.apache.zest.library.eventsourcing.domain.spi.CurrentUser;
-
-/**
- * DomainEventValue factory
- */
-@Concerns(TransactionNotificationConcern.class)
-@Mixins(ApplicationEventFactoryService.Mixin.class)
-public interface ApplicationEventFactoryService
-        extends ApplicationEventFactory, ServiceComposite
-{
-    class Mixin
-            implements ApplicationEventFactory
-    {
-        @Structure
-        UnitOfWorkFactory uowf;
-
-        @Structure
-        ValueBuilderFactory vbf;
-
-        @Service
-        IdentityGenerator idGenerator;
-
-        @Service
-        CurrentUser currentUser;
-
-        String version;
-
-        public void init( @Structure Application application )
-        {
-            version = application.version();
-        }
-
-        @Override
-        public ApplicationEvent createEvent( String name, Object[] args )
-        {
-            ValueBuilder<ApplicationEvent> builder = vbf.newValueBuilder( ApplicationEvent.class );
-
-            ApplicationEvent prototype = builder.prototype();
-            prototype.name().set( name );
-            prototype.on().set( Instant.now() );
-
-            prototype.identity().set( idGenerator.generate( ApplicationEvent.class ) );
-
-            UnitOfWork uow = uowf.currentUnitOfWork();
-            prototype.usecase().set( uow.usecase().name() );
-            prototype.version().set( version );
-
-            // JSON-ify parameters
-            JSONStringer json = new JSONStringer();
-            try
-            {
-                JSONWriter params = json.object();
-                for (int i = 1; i < args.length; i++)
-                {
-                    params.key( "param" + i );
-                    if (args[i] == null)
-                        params.value( JSONObject.NULL );
-                    else
-                        params.value( args[i] );
-                }
-                json.endObject();
-            } catch (JSONException e)
-            {
-                throw new IllegalArgumentException( "Could not create event", e );
-            }
-
-            prototype.parameters().set( json.toString() );
-
-            ApplicationEvent event = builder.newInstance();
-
-            return event;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/ApplicationEventMethodFilter.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/ApplicationEventMethodFilter.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/ApplicationEventMethodFilter.java
deleted file mode 100644
index 85dfd63..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/ApplicationEventMethodFilter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.application.factory;
-
-import java.lang.reflect.Method;
-import org.apache.zest.api.common.AppliesToFilter;
-import org.apache.zest.library.eventsourcing.application.api.ApplicationEvent;
-
-/**
- * Filter for Event methods. Event methods
- * have ApplicationEvent as their first method parameter.
- */
-public class ApplicationEventMethodFilter
-        implements AppliesToFilter
-{
-    @Override
-    public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> fragmentClass )
-    {
-        return method.getParameterTypes().length > 0 && method.getParameterTypes()[0].equals( ApplicationEvent.class );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/TransactionNotificationConcern.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/TransactionNotificationConcern.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/TransactionNotificationConcern.java
deleted file mode 100644
index 8a2c882..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/TransactionNotificationConcern.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.application.factory;
-
-import java.io.IOException;
-import org.apache.zest.api.concern.ConcernOf;
-import org.apache.zest.api.injection.scope.Service;
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.unitofwork.UnitOfWork;
-import org.apache.zest.api.unitofwork.UnitOfWorkCallback;
-import org.apache.zest.api.unitofwork.UnitOfWorkCompletionException;
-import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
-import org.apache.zest.library.eventsourcing.application.api.ApplicationEvent;
-import org.apache.zest.library.eventsourcing.application.source.ApplicationEventStore;
-import org.apache.zest.library.eventsourcing.domain.factory.DomainEventFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Notify transaction listeners when a complete transaction of domain events is available.
- */
-public class TransactionNotificationConcern
-    extends ConcernOf<ApplicationEventFactory>
-    implements ApplicationEventFactory
-{
-    @Service
-    ApplicationEventStore eventStore;
-
-    @Structure
-    UnitOfWorkFactory uowf;
-
-    Logger logger = LoggerFactory.getLogger( DomainEventFactory.class );
-
-    @Override
-    public ApplicationEvent createEvent( String name, Object[] args )
-    {
-        final UnitOfWork unitOfWork = uowf.currentUnitOfWork();
-
-        ApplicationEvent event = next.createEvent( name, args );
-
-        // Add event to list in UoW
-        UnitOfWorkApplicationEvents events = unitOfWork.metaInfo( UnitOfWorkApplicationEvents.class );
-        if( events == null )
-        {
-            events = new UnitOfWorkApplicationEvents();
-            unitOfWork.setMetaInfo( events );
-
-            unitOfWork.addUnitOfWorkCallback( new UnitOfWorkCallback()
-            {
-                @Override
-                public void beforeCompletion()
-                    throws UnitOfWorkCompletionException
-                {
-                }
-
-                @Override
-                public void afterCompletion( UnitOfWorkStatus status )
-                {
-                    if( status.equals( UnitOfWorkStatus.COMPLETED ) )
-                    {
-                        UnitOfWorkApplicationEvents events = unitOfWork.metaInfo( UnitOfWorkApplicationEvents.class );
-
-                        try
-                        {
-                            eventStore.storeEvents( events.getEvents() );
-                        }
-                        catch( IOException e )
-                        {
-                            logger.error( "Could not store events", e );
-                            // How do we handle this? This is a major error!
-                        }
-                    }
-                }
-            } );
-        }
-
-        events.add( event );
-
-        return event;
-    }
-}


[7/7] zest-java git commit: ZEST-181 : Replaced the use of 'long' as a time and using java.time.Instant instead.

Posted by ni...@apache.org.
ZEST-181 : Replaced the use of 'long' as a time and using java.time.Instant instead.


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

Branch: refs/heads/develop
Commit: e030bd8a586efb272ad030a4762e18b24feee4c0
Parents: f37a0a0
Author: Niclas Hedhman <ni...@hedhman.org>
Authored: Sat Oct 22 15:14:38 2016 +0800
Committer: Niclas Hedhman <ni...@hedhman.org>
Committed: Sat Oct 22 15:14:38 2016 +0800

----------------------------------------------------------------------
 .../zest/api/activation/ActivationEvent.java    |  7 ++-
 .../org/apache/zest/api/time/SystemTime.java    | 24 ++++++++++
 .../apache/zest/api/unitofwork/UnitOfWork.java  |  3 +-
 .../zest/api/unitofwork/UnitOfWorkFactory.java  | 10 ++--
 .../runtime/unitofwork/BuilderEntityState.java  |  5 +-
 .../runtime/unitofwork/ModuleUnitOfWork.java    |  3 +-
 .../unitofwork/UnitOfWorkFactoryMixin.java      |  8 ++--
 .../runtime/unitofwork/UnitOfWorkInstance.java  |  7 +--
 .../org/apache/zest/api/common/PluginTest.java  |  6 ++-
 .../org/apache/zest/spi/entity/EntityState.java |  5 +-
 .../ConcurrentModificationCheckConcern.java     |  9 ++--
 .../DefaultEntityStoreUnitOfWork.java           |  7 +--
 .../spi/entitystore/EntityStateVersions.java    |  7 ++-
 .../zest/spi/entitystore/EntityStore.java       |  3 +-
 .../spi/entitystore/EntityStoreUnitOfWork.java  |  3 +-
 .../entitystore/helpers/DefaultEntityState.java |  9 ++--
 .../entitystore/helpers/JSONEntityState.java    |  7 +--
 .../zest/spi/entitystore/helpers/JSONKeys.java  |  4 +-
 .../helpers/JSONMapEntityStoreMixin.java        | 16 ++++---
 .../helpers/MapEntityStoreMixin.java            |  9 ++--
 .../helpers/JSONManyAssociationStateTest.java   |  5 +-
 .../zest/spi/metrics/DefaultMetricsTest.java    |  8 ++--
 .../jclouds/JCloudsFilesystemTest.java          |  3 +-
 .../prefs/PreferencesEntityStoreMixin.java      | 14 +++---
 .../entitystore/sql/SQLEntityStoreMixin.java    |  7 +--
 .../sql/internal/DatabaseSQLService.java        |  5 +-
 .../DatabaseSQLServiceStatementsMixin.java      |  9 ++--
 .../sql/internal/SQLEntityState.java            |  9 ++--
 .../elasticsearch/ElasticSearchIndexer.java     |  6 ++-
 .../zest/index/rdf/RDFPerformanceTest.java      | 50 ++++++++++----------
 .../solr/internal/SolrEntityIndexerMixin.java   |  2 +-
 .../support/skeletons/AbstractSQLIndexing.java  |  4 +-
 .../skeletons/SQLCompatEntityStateWrapper.java  |  5 +-
 .../circuitbreaker/jmx/CircuitBreakerJMX.java   |  6 ++-
 .../fileconfig/FileConfigurationTest.java       |  2 +-
 .../logging/debug/records/DebugRecord.java      |  3 +-
 .../debug/service/DebuggingServiceMixin.java    |  3 +-
 .../library/logging/log/records/LogRecord.java  |  3 +-
 .../log/service/LoggingServiceMixin.java        |  3 +-
 .../logging/trace/AbstractTraceConcern.java     | 15 +++---
 .../logging/trace/TraceOnConsoleSideEffect.java | 14 +++---
 .../logging/trace/records/TraceRecord.java      |  6 ++-
 .../logging/trace/service/TraceService.java     |  6 ++-
 .../trace/service/TraceServiceMixin.java        | 30 ++++++------
 .../rdf/entity/EntitySerializerTest.java        |  4 +-
 .../rest/server/api/ResourceValidity.java       | 14 ++----
 .../zest/library/rest/admin/EntityResource.java | 14 +++---
 .../sample/forum/context/view/ViewPost.java     |  2 +-
 .../forum/domainevent/DomainEventValue.java     |  3 +-
 .../CompositeCreationPerformanceTest.java       |  3 ++
 50 files changed, 241 insertions(+), 169 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/core/api/src/main/java/org/apache/zest/api/activation/ActivationEvent.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/activation/ActivationEvent.java b/core/api/src/main/java/org/apache/zest/api/activation/ActivationEvent.java
index 3af6c93..553ede4 100644
--- a/core/api/src/main/java/org/apache/zest/api/activation/ActivationEvent.java
+++ b/core/api/src/main/java/org/apache/zest/api/activation/ActivationEvent.java
@@ -19,6 +19,9 @@
  */
 package org.apache.zest.api.activation;
 
+import java.time.Instant;
+import org.apache.zest.api.time.SystemTime;
+
 /**
  * ActivationEvents are fired during activation and passivation of instances in Zest.
  */
@@ -29,13 +32,13 @@ public final class ActivationEvent
         ACTIVATING, ACTIVATED, PASSIVATING, PASSIVATED
     }
 
-    private final long timestamp;
+    private final Instant timestamp;
     private final Object source;
     private final EventType type;
 
     public ActivationEvent( Object source, EventType type )
     {
-        this.timestamp = System.currentTimeMillis();
+        this.timestamp = SystemTime.now();
         this.source = source;
         this.type = type;
     }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/core/api/src/main/java/org/apache/zest/api/time/SystemTime.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/time/SystemTime.java b/core/api/src/main/java/org/apache/zest/api/time/SystemTime.java
new file mode 100644
index 0000000..4601551
--- /dev/null
+++ b/core/api/src/main/java/org/apache/zest/api/time/SystemTime.java
@@ -0,0 +1,24 @@
+package org.apache.zest.api.time;
+
+import java.time.Clock;
+import java.time.Instant;
+
+public class SystemTime
+{
+    private static Clock defaultClock = Clock.systemUTC();
+
+    public static Clock getDefaultClock()
+    {
+        return defaultClock;
+    }
+
+    public static void setDefaultClock(Clock defaultClock)
+    {
+        SystemTime.defaultClock = defaultClock;
+    }
+
+    public static Instant now()
+    {
+        return Instant.now(defaultClock);
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWork.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWork.java b/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWork.java
index 309ca58..e792b8b 100644
--- a/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWork.java
+++ b/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWork.java
@@ -19,6 +19,7 @@
  */
 package org.apache.zest.api.unitofwork;
 
+import java.time.Instant;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -104,7 +105,7 @@ public interface UnitOfWork extends MetaInfoHolder, AutoCloseable
      */
     UnitOfWorkFactory unitOfWorkFactory();
 
-    long currentTime();
+    Instant currentTime();
 
     /**
      * Get the Usecase for this UnitOfWork

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkFactory.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkFactory.java b/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkFactory.java
index 3a80115..3a1b00e 100644
--- a/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkFactory.java
+++ b/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkFactory.java
@@ -19,7 +19,9 @@
  */
 package org.apache.zest.api.unitofwork;
 
+import java.time.Instant;
 import org.apache.zest.api.entity.EntityComposite;
+import org.apache.zest.api.time.SystemTime;
 import org.apache.zest.api.usecase.Usecase;
 
 /**
@@ -33,7 +35,7 @@ public interface UnitOfWorkFactory
      * The UnitOfWork will use the default Usecase settings.
      * </p>
      * <p>
-     * Current time will be set to System.currentTimeMillis();
+     * Current time will be set to {@link SystemTime#now()}
      * </p>
      * @return a new UnitOfWork
      */
@@ -46,12 +48,12 @@ public interface UnitOfWorkFactory
      * </p>
      * @return a new UnitOfWork
      */
-    UnitOfWork newUnitOfWork( long currentTime );
+    UnitOfWork newUnitOfWork( Instant currentTime );
 
     /**
      * Create a new UnitOfWork for the given Usecase and associate it with the current thread.
      * <p>
-     * Current time will be set to System.currentTimeMillis();
+     * Current time will be set to {@link SystemTime#now()}
      * </p>
      * @param usecase the Usecase for this UnitOfWork
      *
@@ -66,7 +68,7 @@ public interface UnitOfWorkFactory
      *
      * @return a new UnitOfWork
      */
-    UnitOfWork newUnitOfWork( Usecase usecase, long currentTime );
+    UnitOfWork newUnitOfWork( Usecase usecase, Instant currentTime );
 
     /**
      * @return true if there is an active UnitOfWork associated with the executing thread

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/BuilderEntityState.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/BuilderEntityState.java b/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/BuilderEntityState.java
index 23ddf0c..6591c4c 100644
--- a/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/BuilderEntityState.java
+++ b/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/BuilderEntityState.java
@@ -19,6 +19,7 @@
  */
 package org.apache.zest.runtime.unitofwork;
 
+import java.time.Instant;
 import java.util.HashMap;
 import java.util.Map;
 import org.apache.zest.api.common.QualifiedName;
@@ -62,9 +63,9 @@ public final class BuilderEntityState
     }
 
     @Override
-    public long lastModified()
+    public Instant lastModified()
     {
-        return 0;
+        return Instant.MIN;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/ModuleUnitOfWork.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/ModuleUnitOfWork.java b/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/ModuleUnitOfWork.java
index d9a2d8a..222d959 100755
--- a/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/ModuleUnitOfWork.java
+++ b/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/ModuleUnitOfWork.java
@@ -20,6 +20,7 @@
 
 package org.apache.zest.runtime.unitofwork;
 
+import java.time.Instant;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -136,7 +137,7 @@ public class ModuleUnitOfWork
     }
 
     @Override
-    public long currentTime()
+    public Instant currentTime()
     {
         return uow.currentTime();
     }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/UnitOfWorkFactoryMixin.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/UnitOfWorkFactoryMixin.java b/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/UnitOfWorkFactoryMixin.java
index 828807f..b3a32fb 100644
--- a/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/UnitOfWorkFactoryMixin.java
+++ b/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/UnitOfWorkFactoryMixin.java
@@ -20,11 +20,13 @@
 
 package org.apache.zest.runtime.unitofwork;
 
+import java.time.Instant;
 import java.util.Stack;
 import org.apache.zest.api.composite.TransientBuilderFactory;
 import org.apache.zest.api.entity.EntityComposite;
 import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.metrics.MetricsProvider;
+import org.apache.zest.api.time.SystemTime;
 import org.apache.zest.api.unitofwork.UnitOfWork;
 import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
 import org.apache.zest.api.usecase.Usecase;
@@ -48,7 +50,7 @@ public class UnitOfWorkFactoryMixin
     }
 
     @Override
-    public UnitOfWork newUnitOfWork( long currentTime )
+    public UnitOfWork newUnitOfWork(Instant currentTime )
     {
         return newUnitOfWork( Usecase.DEFAULT, currentTime );
     }
@@ -56,11 +58,11 @@ public class UnitOfWorkFactoryMixin
     @Override
     public UnitOfWork newUnitOfWork( Usecase usecase )
     {
-        return newUnitOfWork( usecase == null ? Usecase.DEFAULT : usecase, System.currentTimeMillis() );
+        return newUnitOfWork( usecase == null ? Usecase.DEFAULT : usecase, SystemTime.now() );
     }
 
     @Override
-    public UnitOfWork newUnitOfWork( Usecase usecase, long currentTime )
+    public UnitOfWork newUnitOfWork( Usecase usecase, Instant currentTime )
     {
         UnitOfWorkInstance unitOfWorkInstance = new UnitOfWorkInstance( module, usecase, currentTime, metricsProvider() );
         return tbf.newTransient( UnitOfWork.class, unitOfWorkInstance );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/UnitOfWorkInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/UnitOfWorkInstance.java b/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/UnitOfWorkInstance.java
index bd125df..a294244 100755
--- a/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/UnitOfWorkInstance.java
+++ b/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/UnitOfWorkInstance.java
@@ -20,6 +20,7 @@
 
 package org.apache.zest.runtime.unitofwork;
 
+import java.time.Instant;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -82,7 +83,7 @@ public final class UnitOfWorkInstance
     private final HashMap<EntityStore, EntityStoreUnitOfWork> storeUnitOfWork = new HashMap<>();
     private final ModuleSpi module;
     private final Usecase usecase;
-    private final long currentTime;
+    private final Instant currentTime;
     private final MetricsProvider metrics;
 
     private boolean open;
@@ -92,7 +93,7 @@ public final class UnitOfWorkInstance
     private MetaInfo metaInfo;
     private List<UnitOfWorkCallback> callbacks;
 
-    public UnitOfWorkInstance( ModuleSpi module, Usecase usecase, long currentTime, MetricsProvider metrics )
+    public UnitOfWorkInstance(ModuleSpi module, Usecase usecase, Instant currentTime, MetricsProvider metrics )
     {
         this.module = module;
         this.usecase = usecase;
@@ -105,7 +106,7 @@ public final class UnitOfWorkInstance
         startCapture();
     }
 
-    public long currentTime()
+    public Instant currentTime()
     {
         return currentTime;
     }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/core/runtime/src/test/java/org/apache/zest/api/common/PluginTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/api/common/PluginTest.java b/core/runtime/src/test/java/org/apache/zest/api/common/PluginTest.java
index 7499c81..63c5a5d 100644
--- a/core/runtime/src/test/java/org/apache/zest/api/common/PluginTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/api/common/PluginTest.java
@@ -23,6 +23,7 @@ package org.apache.zest.api.common;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
+import java.time.Instant;
 import java.util.Collections;
 import java.util.List;
 import org.apache.zest.api.injection.scope.Service;
@@ -36,6 +37,7 @@ import org.apache.zest.api.service.ServiceImporter;
 import org.apache.zest.api.service.ServiceImporterException;
 import org.apache.zest.api.service.ServiceReference;
 import org.apache.zest.api.structure.Application;
+import org.apache.zest.api.time.SystemTime;
 import org.apache.zest.bootstrap.ApplicationAssembler;
 import org.apache.zest.bootstrap.ApplicationAssembly;
 import org.apache.zest.bootstrap.ApplicationAssemblyFactory;
@@ -352,11 +354,11 @@ public class PluginTest
         {
             @Service
             HelloWorld helloWorld;
-            private long time;
+            private Instant time;
 
             public SimonSaysMixin()
             {
-                time = System.currentTimeMillis();
+                time = SystemTime.now();
             }
 
             public String say( String phrase, String name )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/core/spi/src/main/java/org/apache/zest/spi/entity/EntityState.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/entity/EntityState.java b/core/spi/src/main/java/org/apache/zest/spi/entity/EntityState.java
index 95b13f2..734f5d5 100644
--- a/core/spi/src/main/java/org/apache/zest/spi/entity/EntityState.java
+++ b/core/spi/src/main/java/org/apache/zest/spi/entity/EntityState.java
@@ -23,6 +23,7 @@ import java.time.Instant;
 import org.apache.zest.api.common.QualifiedName;
 import org.apache.zest.api.entity.EntityDescriptor;
 import org.apache.zest.api.entity.EntityReference;
+import org.apache.zest.api.time.SystemTime;
 
 /**
  * State holder for Entities.
@@ -52,9 +53,9 @@ public interface EntityState
      * If the underlying EntityStore does not support timestamping, then last modified
      * must always be set to the current time.
      * </p>
-     * @return last modified timestamp of the entity, as defined by System.currentTimeMillis()
+     * @return last modified timestamp of the entity, as defined by {@link SystemTime#now()}
      */
-    long lastModified();
+    Instant lastModified();
 
     /**
      * Remove the entity represented by this EntityState when the unit of work is completed.

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/core/spi/src/main/java/org/apache/zest/spi/entitystore/ConcurrentModificationCheckConcern.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/entitystore/ConcurrentModificationCheckConcern.java b/core/spi/src/main/java/org/apache/zest/spi/entitystore/ConcurrentModificationCheckConcern.java
index e6f5be7..0729c68 100755
--- a/core/spi/src/main/java/org/apache/zest/spi/entitystore/ConcurrentModificationCheckConcern.java
+++ b/core/spi/src/main/java/org/apache/zest/spi/entitystore/ConcurrentModificationCheckConcern.java
@@ -20,6 +20,7 @@
 
 package org.apache.zest.spi.entitystore;
 
+import java.time.Instant;
 import java.util.HashSet;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 import org.apache.zest.api.ZestAPI;
@@ -53,7 +54,7 @@ public abstract class ConcurrentModificationCheckConcern
     private ZestAPI api;
 
     @Override
-    public EntityStoreUnitOfWork newUnitOfWork( ModuleDescriptor module, Usecase usecase, long currentTime )
+    public EntityStoreUnitOfWork newUnitOfWork( ModuleDescriptor module, Usecase usecase, Instant currentTime )
     {
         final EntityStoreUnitOfWork uow = next.newUnitOfWork( module, usecase, currentTime );
         return new ConcurrentCheckingEntityStoreUnitOfWork( uow, api.dereference( versions ), currentTime );
@@ -64,7 +65,7 @@ public abstract class ConcurrentModificationCheckConcern
     {
         private final EntityStoreUnitOfWork uow;
         private EntityStateVersions versions;
-        private long currentTime;
+        private Instant currentTime;
 
         private HashSet<EntityState> loaded = new HashSet<>();
 
@@ -72,7 +73,7 @@ public abstract class ConcurrentModificationCheckConcern
 
         public ConcurrentCheckingEntityStoreUnitOfWork( EntityStoreUnitOfWork uow,
                                                         EntityStateVersions versions,
-                                                        long currentTime
+                                                        Instant currentTime
         )
         {
             this.uow = uow;
@@ -87,7 +88,7 @@ public abstract class ConcurrentModificationCheckConcern
         }
 
         @Override
-        public long currentTime()
+        public Instant currentTime()
         {
             return uow.currentTime();
         }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/core/spi/src/main/java/org/apache/zest/spi/entitystore/DefaultEntityStoreUnitOfWork.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/entitystore/DefaultEntityStoreUnitOfWork.java b/core/spi/src/main/java/org/apache/zest/spi/entitystore/DefaultEntityStoreUnitOfWork.java
index a915465..96e4927 100755
--- a/core/spi/src/main/java/org/apache/zest/spi/entitystore/DefaultEntityStoreUnitOfWork.java
+++ b/core/spi/src/main/java/org/apache/zest/spi/entitystore/DefaultEntityStoreUnitOfWork.java
@@ -20,6 +20,7 @@
 
 package org.apache.zest.spi.entitystore;
 
+import java.time.Instant;
 import java.util.HashMap;
 import org.apache.zest.api.entity.EntityDescriptor;
 import org.apache.zest.api.entity.EntityReference;
@@ -38,13 +39,13 @@ public final class DefaultEntityStoreUnitOfWork
     private String identity;
     private HashMap<EntityReference, EntityState> states = new HashMap<>();
     private Usecase usecase;
-    private long currentTime;
+    private Instant currentTime;
 
     public DefaultEntityStoreUnitOfWork( ModuleDescriptor module,
                                          EntityStoreSPI entityStoreSPI,
                                          String identity,
                                          Usecase usecase,
-                                         long currentTime
+                                         Instant currentTime
     )
     {
         this.module = module;
@@ -61,7 +62,7 @@ public final class DefaultEntityStoreUnitOfWork
     }
 
     @Override
-    public long currentTime()
+    public Instant currentTime()
     {
         return currentTime;
     }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStateVersions.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStateVersions.java b/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStateVersions.java
index 790af5e..d1913b7 100755
--- a/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStateVersions.java
+++ b/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStateVersions.java
@@ -20,6 +20,7 @@
 
 package org.apache.zest.spi.entitystore;
 
+import java.time.Instant;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -27,11 +28,9 @@ import java.util.WeakHashMap;
 import org.apache.zest.api.entity.EntityReference;
 import org.apache.zest.api.injection.scope.This;
 import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.structure.ModuleDescriptor;
 import org.apache.zest.api.usecase.Usecase;
 import org.apache.zest.spi.entity.EntityState;
 import org.apache.zest.spi.entity.EntityStatus;
-import org.apache.zest.spi.module.ModuleSpi;
 
 /**
  * Entity versions state.
@@ -43,7 +42,7 @@ public interface EntityStateVersions
 
     void rememberVersion( EntityReference identity, String version );
 
-    void checkForConcurrentModification( Iterable<EntityState> loaded, long currentTime )
+    void checkForConcurrentModification( Iterable<EntityState> loaded, Instant currentTime )
         throws ConcurrentEntityStateModificationException;
 
     /**
@@ -74,7 +73,7 @@ public interface EntityStateVersions
 
         @Override
         public synchronized void checkForConcurrentModification( Iterable<EntityState> loaded,
-                                                                 long currentTime
+                                                                 Instant currentTime
         )
             throws ConcurrentEntityStateModificationException
         {

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStore.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStore.java b/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStore.java
index 7fbc4ee..71752b0 100755
--- a/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStore.java
+++ b/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStore.java
@@ -19,6 +19,7 @@
  */
 package org.apache.zest.spi.entitystore;
 
+import java.time.Instant;
 import org.apache.zest.api.structure.ModuleDescriptor;
 import org.apache.zest.api.usecase.Usecase;
 import org.apache.zest.io.Input;
@@ -29,7 +30,7 @@ import org.apache.zest.spi.entity.EntityState;
  */
 public interface EntityStore
 {
-    EntityStoreUnitOfWork newUnitOfWork( ModuleDescriptor module, Usecase usecase, long currentTime );
+    EntityStoreUnitOfWork newUnitOfWork( ModuleDescriptor module, Usecase usecase, Instant currentTime );
 
     Input<EntityState, EntityStoreException> entityStates( ModuleDescriptor module );
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStoreUnitOfWork.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStoreUnitOfWork.java b/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStoreUnitOfWork.java
index 712d86b..5342327 100755
--- a/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStoreUnitOfWork.java
+++ b/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStoreUnitOfWork.java
@@ -20,6 +20,7 @@
 
 package org.apache.zest.spi.entitystore;
 
+import java.time.Instant;
 import org.apache.zest.api.entity.EntityDescriptor;
 import org.apache.zest.api.entity.EntityReference;
 import org.apache.zest.api.structure.ModuleDescriptor;
@@ -33,7 +34,7 @@ public interface EntityStoreUnitOfWork
 {
     String identity();
 
-    long currentTime();
+    Instant currentTime();
 
     /**
      * Create new EntityState for a given identity.

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/DefaultEntityState.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/DefaultEntityState.java b/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/DefaultEntityState.java
index 3375670..2827a93 100644
--- a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/DefaultEntityState.java
+++ b/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/DefaultEntityState.java
@@ -19,6 +19,7 @@
  */
 package org.apache.zest.spi.entitystore.helpers;
 
+import java.time.Instant;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
@@ -42,7 +43,7 @@ public final class DefaultEntityState
     private EntityStatus status;
 
     private String version;
-    private long lastModified;
+    private Instant lastModified;
     private final EntityReference identity;
     private final EntityDescriptor entityDescriptor;
 
@@ -51,7 +52,7 @@ public final class DefaultEntityState
     private final Map<QualifiedName, List<EntityReference>> manyAssociations;
     private final Map<QualifiedName, Map<String, EntityReference>> namedAssociations;
 
-    public DefaultEntityState( long currentTime,
+    public DefaultEntityState( Instant currentTime,
                                EntityReference identity,
                                EntityDescriptor entityDescriptor
     )
@@ -68,7 +69,7 @@ public final class DefaultEntityState
     }
 
     public DefaultEntityState( String version,
-                               long lastModified,
+                               Instant lastModified,
                                EntityReference identity,
                                EntityStatus status,
                                EntityDescriptor entityDescriptor,
@@ -97,7 +98,7 @@ public final class DefaultEntityState
     }
 
     @Override
-    public long lastModified()
+    public Instant lastModified()
     {
         return lastModified;
     }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONEntityState.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONEntityState.java b/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONEntityState.java
index 5f351d0..2878b76 100644
--- a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONEntityState.java
+++ b/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONEntityState.java
@@ -19,6 +19,7 @@
  */
 package org.apache.zest.spi.entitystore.helpers;
 
+import java.time.Instant;
 import org.apache.zest.api.common.QualifiedName;
 import org.apache.zest.api.entity.EntityDescriptor;
 import org.apache.zest.api.entity.EntityReference;
@@ -59,13 +60,13 @@ public final class JSONEntityState
     private final EntityDescriptor entityDescriptor;
 
     private EntityStatus status;
-    private long lastModified;
+    private Instant lastModified;
     private JSONObject state;
 
     /* package */ JSONEntityState( ModuleDescriptor module,
                                    ValueSerialization valueSerialization,
                                    String version,
-                                   long lastModified,
+                                   Instant lastModified,
                                    EntityReference identity,
                                    EntityStatus status,
                                    EntityDescriptor entityDescriptor,
@@ -90,7 +91,7 @@ public final class JSONEntityState
     }
 
     @Override
-    public long lastModified()
+    public Instant lastModified()
     {
         return lastModified;
     }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONKeys.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONKeys.java b/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONKeys.java
index 86b5c37..6d3151a 100644
--- a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONKeys.java
+++ b/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONKeys.java
@@ -19,6 +19,8 @@
  */
 package org.apache.zest.spi.entitystore.helpers;
 
+import org.apache.zest.api.time.SystemTime;
+
 /**
  * JSON keys for values in the stored data.
  */
@@ -41,7 +43,7 @@ public interface JSONKeys
      */
     String VERSION = "version";
     /**
-     * When entity was last modified according to System.currentTimeMillis().
+     * When entity was last modified according to {@link SystemTime#now()}
      */
     String MODIFIED = "modified";
     /**

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONMapEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONMapEntityStoreMixin.java b/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONMapEntityStoreMixin.java
index 4ba7297..acfbeae 100755
--- a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONMapEntityStoreMixin.java
+++ b/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONMapEntityStoreMixin.java
@@ -25,6 +25,7 @@ import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.io.Reader;
 import java.io.Writer;
+import java.time.Instant;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.UUID;
@@ -138,7 +139,7 @@ public class JSONMapEntityStoreMixin
     // EntityStore
 
     @Override
-    public EntityStoreUnitOfWork newUnitOfWork( ModuleDescriptor module, Usecase usecaseMetaInfo, long currentTime )
+    public EntityStoreUnitOfWork newUnitOfWork( ModuleDescriptor module, Usecase usecaseMetaInfo, Instant currentTime )
     {
         return new DefaultEntityStoreUnitOfWork( module, entityStoreSpi, newUnitOfWorkId(), usecaseMetaInfo, currentTime );
     }
@@ -158,7 +159,7 @@ public class JSONMapEntityStoreMixin
             state.put( JSONKeys.APPLICATION_VERSION, application.version() );
             state.put( JSONKeys.TYPE, entityDescriptor.types().findFirst().get().getName() );
             state.put( JSONKeys.VERSION, unitOfWork.identity() );
-            state.put( JSONKeys.MODIFIED, unitOfWork.currentTime() );
+            state.put( JSONKeys.MODIFIED, unitOfWork.currentTime().toEpochMilli() );
             state.put( JSONKeys.PROPERTIES, new JSONObject() );
             state.put( JSONKeys.ASSOCIATIONS, new JSONObject() );
             state.put( JSONKeys.MANY_ASSOCIATIONS, new JSONObject() );
@@ -406,14 +407,14 @@ public class JSONMapEntityStoreMixin
         return uuid + Integer.toHexString( count++ );
     }
 
-    protected void writeEntityState( JSONEntityState state, Writer writer, String identity, long lastModified )
+    protected void writeEntityState( JSONEntityState state, Writer writer, String identity, Instant lastModified )
         throws EntityStoreException
     {
         try
         {
             JSONObject jsonState = state.state();
             jsonState.put( JSONKeys.VERSION, identity );
-            jsonState.put( JSONKeys.MODIFIED, lastModified );
+            jsonState.put( JSONKeys.MODIFIED, lastModified.toEpochMilli() );
             writer.append( jsonState.toString() );
         }
         catch( JSONException | IOException e )
@@ -431,7 +432,7 @@ public class JSONMapEntityStoreMixin
             EntityStatus status = EntityStatus.LOADED;
 
             String version = jsonObject.getString( JSONKeys.VERSION );
-            long modified = jsonObject.getLong( JSONKeys.MODIFIED );
+            Instant modified = Instant.ofEpochMilli(jsonObject.getLong( JSONKeys.MODIFIED ));
             String identity = jsonObject.getString( JSONKeys.IDENTITY );
 
             // Check if NamedAssociation is supported
@@ -495,7 +496,7 @@ public class JSONMapEntityStoreMixin
         }
     }
 
-    private EntityState fetchCachedState( EntityReference identity, ModuleDescriptor module, long currentTime )
+    private EntityState fetchCachedState( EntityReference identity, ModuleDescriptor module, Instant currentTime )
     {
         CacheState cacheState = cache.get( identity.identity() );
         if( cacheState != null )
@@ -505,7 +506,8 @@ public class JSONMapEntityStoreMixin
             {
                 String type = data.getString( JSONKeys.TYPE );
                 EntityDescriptor entityDescriptor = module.entityDescriptor( type );
-                return new JSONEntityState( module, valueSerialization, data.getString( JSONKeys.VERSION ), data.getLong( JSONKeys.MODIFIED ), identity, EntityStatus.LOADED, entityDescriptor, data );
+                Instant lastModified = Instant.ofEpochMilli(data.getLong(JSONKeys.MODIFIED));
+                return new JSONEntityState( module, valueSerialization, data.getString( JSONKeys.VERSION ), lastModified, identity, EntityStatus.LOADED, entityDescriptor, data );
             }
             catch( JSONException e )
             {

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/MapEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/MapEntityStoreMixin.java b/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/MapEntityStoreMixin.java
index adaa340..37b349e 100755
--- a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/MapEntityStoreMixin.java
+++ b/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/MapEntityStoreMixin.java
@@ -22,6 +22,7 @@ package org.apache.zest.spi.entitystore.helpers;
 import java.io.IOException;
 import java.io.Reader;
 import java.io.Writer;
+import java.time.Instant;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
@@ -108,7 +109,7 @@ public class MapEntityStoreMixin
 
     // EntityStore
     @Override
-    public EntityStoreUnitOfWork newUnitOfWork( ModuleDescriptor module, Usecase usecaseMetaInfo, long currentTime )
+    public EntityStoreUnitOfWork newUnitOfWork( ModuleDescriptor module, Usecase usecaseMetaInfo, Instant currentTime )
     {
         return new DefaultEntityStoreUnitOfWork( module, entityStoreSpi, newUnitOfWorkId(), usecaseMetaInfo, currentTime );
     }
@@ -292,7 +293,7 @@ public class MapEntityStoreMixin
         return uuid + Integer.toHexString( count++ );
     }
 
-    protected void writeEntityState( DefaultEntityState state, Writer writer, String version, long lastModified )
+    protected void writeEntityState( DefaultEntityState state, Writer writer, String version, Instant lastModified )
         throws EntityStoreException
     {
         try
@@ -303,7 +304,7 @@ public class MapEntityStoreMixin
                 key( JSONKeys.APPLICATION_VERSION ).value( application.version() ).
                 key( JSONKeys.TYPE ).value( state.entityDescriptor().types().findFirst().get().getName() ).
                 key( JSONKeys.VERSION ).value( version ).
-                key( JSONKeys.MODIFIED ).value( lastModified ).
+                key( JSONKeys.MODIFIED ).value( lastModified.toEpochMilli() ).
                 key( JSONKeys.PROPERTIES ).object();
             EntityDescriptor entityType = state.entityDescriptor();
             entityType.state().properties().forEach( persistentProperty -> {
@@ -387,7 +388,7 @@ public class MapEntityStoreMixin
             final EntityStatus[] status = { EntityStatus.LOADED };
 
             String version = jsonObject.getString( JSONKeys.VERSION );
-            long modified = jsonObject.getLong( JSONKeys.MODIFIED );
+            Instant modified = Instant.ofEpochMilli(jsonObject.getLong( JSONKeys.MODIFIED ));
             String identity = jsonObject.getString( JSONKeys.IDENTITY );
 
             // Check if version is correct

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/core/spi/src/test/java/org/apache/zest/spi/entitystore/helpers/JSONManyAssociationStateTest.java
----------------------------------------------------------------------
diff --git a/core/spi/src/test/java/org/apache/zest/spi/entitystore/helpers/JSONManyAssociationStateTest.java b/core/spi/src/test/java/org/apache/zest/spi/entitystore/helpers/JSONManyAssociationStateTest.java
index a0c2dd3..3699cf6 100644
--- a/core/spi/src/test/java/org/apache/zest/spi/entitystore/helpers/JSONManyAssociationStateTest.java
+++ b/core/spi/src/test/java/org/apache/zest/spi/entitystore/helpers/JSONManyAssociationStateTest.java
@@ -21,6 +21,7 @@ package org.apache.zest.spi.entitystore.helpers;
 
 import java.util.List;
 import java.util.function.Function;
+import org.apache.zest.api.time.SystemTime;
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
@@ -51,7 +52,7 @@ public class JSONManyAssociationStateTest
         JSONEntityState entityState = new JSONEntityState( null,
                                                            null,
                                                            "0",
-                                                           System.currentTimeMillis(),
+                                                           SystemTime.now(),
                                                            EntityReference.parseEntityReference( "123" ),
                                                            EntityStatus.NEW,
                                                            null,
@@ -77,7 +78,7 @@ public class JSONManyAssociationStateTest
         JSONEntityState entityState = new JSONEntityState( null,
                                                            null,
                                                            "0",
-                                                           System.currentTimeMillis(),
+                                                           SystemTime.now(),
                                                            EntityReference.parseEntityReference( "123" ),
                                                            EntityStatus.NEW,
                                                            null,

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/core/spi/src/test/java/org/apache/zest/spi/metrics/DefaultMetricsTest.java
----------------------------------------------------------------------
diff --git a/core/spi/src/test/java/org/apache/zest/spi/metrics/DefaultMetricsTest.java b/core/spi/src/test/java/org/apache/zest/spi/metrics/DefaultMetricsTest.java
index e22f76a..a92d526 100644
--- a/core/spi/src/test/java/org/apache/zest/spi/metrics/DefaultMetricsTest.java
+++ b/core/spi/src/test/java/org/apache/zest/spi/metrics/DefaultMetricsTest.java
@@ -20,7 +20,9 @@
 
 package org.apache.zest.spi.metrics;
 
+import java.time.Instant;
 import java.util.concurrent.TimeUnit;
+import org.apache.zest.api.time.SystemTime;
 import org.junit.Test;
 import org.apache.zest.api.metrics.MetricsCounter;
 import org.apache.zest.api.metrics.MetricsCounterFactory;
@@ -55,12 +57,12 @@ public class DefaultMetricsTest
     {
         MetricsProvider underTest = new MetricsProviderAdapter();
         MetricsGaugeFactory factory = underTest.createFactory( MetricsGaugeFactory.class );
-        MetricsGauge<Long> test = factory.registerGauge( getClass(), "test", new MetricsGauge<Long>()
+        MetricsGauge<Instant> test = factory.registerGauge( getClass(), "test", new MetricsGauge<Instant>()
         {
             @Override
-            public Long value()
+            public Instant value()
             {
-                return System.currentTimeMillis();
+                return SystemTime.now();
             }
         } );
         assertNull( test.value() );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/extensions/entitystore-jclouds/src/test/java/org/apache/zest/entitystore/jclouds/JCloudsFilesystemTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jclouds/src/test/java/org/apache/zest/entitystore/jclouds/JCloudsFilesystemTest.java b/extensions/entitystore-jclouds/src/test/java/org/apache/zest/entitystore/jclouds/JCloudsFilesystemTest.java
index 08a1499..584cb4a 100644
--- a/extensions/entitystore-jclouds/src/test/java/org/apache/zest/entitystore/jclouds/JCloudsFilesystemTest.java
+++ b/extensions/entitystore-jclouds/src/test/java/org/apache/zest/entitystore/jclouds/JCloudsFilesystemTest.java
@@ -22,6 +22,7 @@ package org.apache.zest.entitystore.jclouds;
 
 import java.util.HashMap;
 import java.util.Map;
+import org.apache.zest.api.time.SystemTime;
 import org.apache.zest.entitystore.jclouds.assembly.JCloudsEntityStoreAssembler;
 import org.jclouds.filesystem.reference.FilesystemConstants;
 import org.junit.AfterClass;
@@ -48,7 +49,7 @@ public class JCloudsFilesystemTest
         JCloudsMapEntityStoreConfiguration defaults = config.forMixin( JCloudsMapEntityStoreConfiguration.class ).declareDefaults();
         defaults.provider().set( "filesystem" );
         Map<String, String> props = new HashMap<String, String>();
-        props.put( FilesystemConstants.PROPERTY_BASEDIR, "build/tmp/" + getClass().getPackage().getName() + "/es-jclouds-" + System.currentTimeMillis() );
+        props.put( FilesystemConstants.PROPERTY_BASEDIR, "build/tmp/" + getClass().getPackage().getName() + "/es-jclouds-" + SystemTime.now().toEpochMilli() );
         defaults.properties().set( props );
     }
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/extensions/entitystore-preferences/src/main/java/org/apache/zest/entitystore/prefs/PreferencesEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-preferences/src/main/java/org/apache/zest/entitystore/prefs/PreferencesEntityStoreMixin.java b/extensions/entitystore-preferences/src/main/java/org/apache/zest/entitystore/prefs/PreferencesEntityStoreMixin.java
index 75ae80d..a540c1e 100755
--- a/extensions/entitystore-preferences/src/main/java/org/apache/zest/entitystore/prefs/PreferencesEntityStoreMixin.java
+++ b/extensions/entitystore-preferences/src/main/java/org/apache/zest/entitystore/prefs/PreferencesEntityStoreMixin.java
@@ -19,6 +19,7 @@
  */
 package org.apache.zest.entitystore.prefs;
 
+import java.time.Instant;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
@@ -43,13 +44,14 @@ import org.apache.zest.api.service.ServiceDescriptor;
 import org.apache.zest.api.service.qualifier.Tagged;
 import org.apache.zest.api.structure.Application;
 import org.apache.zest.api.structure.ModuleDescriptor;
+import org.apache.zest.api.time.SystemTime;
 import org.apache.zest.api.type.CollectionType;
 import org.apache.zest.api.type.EnumType;
 import org.apache.zest.api.type.MapType;
 import org.apache.zest.api.type.ValueCompositeType;
 import org.apache.zest.api.type.ValueType;
-import org.apache.zest.api.unitofwork.NoSuchEntityTypeException;
 import org.apache.zest.api.unitofwork.NoSuchEntityException;
+import org.apache.zest.api.unitofwork.NoSuchEntityTypeException;
 import org.apache.zest.api.usecase.Usecase;
 import org.apache.zest.api.usecase.UsecaseBuilder;
 import org.apache.zest.api.value.ValueSerialization;
@@ -168,7 +170,7 @@ public class PreferencesEntityStoreMixin
     }
 
     @Override
-    public EntityStoreUnitOfWork newUnitOfWork( ModuleDescriptor module, Usecase usecase, long currentTime )
+    public EntityStoreUnitOfWork newUnitOfWork( ModuleDescriptor module, Usecase usecase, Instant currentTime )
     {
         return new DefaultEntityStoreUnitOfWork( module, entityStoreSpi, newUnitOfWorkId(), usecase, currentTime );
     }
@@ -191,7 +193,7 @@ public class PreferencesEntityStoreMixin
                         UsecaseBuilder builder = UsecaseBuilder.buildUsecase( "zest.entitystore.preferences.visit" );
                         Usecase visitUsecase = builder.withMetaInfo( CacheOptions.NEVER ).newUsecase();
                         final EntityStoreUnitOfWork uow =
-                            newUnitOfWork( module, visitUsecase, System.currentTimeMillis() );
+                            newUnitOfWork( module, visitUsecase, SystemTime.now() );
 
                         try
                         {
@@ -414,7 +416,7 @@ public class PreferencesEntityStoreMixin
             } );
 
             return new DefaultEntityState( entityPrefs.get( "version", "" ),
-                                           entityPrefs.getLong( "modified", unitOfWork.currentTime() ),
+                                           Instant.ofEpochMilli(entityPrefs.getLong( "modified", unitOfWork.currentTime().toEpochMilli() )),
                                            identity,
                                            status,
                                            entityDescriptor,
@@ -499,7 +501,7 @@ public class PreferencesEntityStoreMixin
     protected void writeEntityState( DefaultEntityState state,
                                      Preferences entityPrefs,
                                      String identity,
-                                     long lastModified
+                                     Instant lastModified
     )
         throws EntityStoreException
     {
@@ -508,7 +510,7 @@ public class PreferencesEntityStoreMixin
             // Store into Preferences API
             entityPrefs.put( "type", state.entityDescriptor().types().findFirst().get().getName() );
             entityPrefs.put( "version", identity );
-            entityPrefs.putLong( "modified", lastModified );
+            entityPrefs.putLong( "modified", lastModified.toEpochMilli() );
 
             // Properties
             Preferences propsPrefs = entityPrefs.node( "properties" );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/extensions/entitystore-sql/src/main/java/org/apache/zest/entitystore/sql/SQLEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/zest/entitystore/sql/SQLEntityStoreMixin.java b/extensions/entitystore-sql/src/main/java/org/apache/zest/entitystore/sql/SQLEntityStoreMixin.java
index a39a4a8..c541621 100755
--- a/extensions/entitystore-sql/src/main/java/org/apache/zest/entitystore/sql/SQLEntityStoreMixin.java
+++ b/extensions/entitystore-sql/src/main/java/org/apache/zest/entitystore/sql/SQLEntityStoreMixin.java
@@ -28,6 +28,7 @@ import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.time.Instant;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
@@ -270,7 +271,7 @@ public class SQLEntityStoreMixin
     }
 
     @Override
-    public EntityStoreUnitOfWork newUnitOfWork( ModuleDescriptor module, Usecase usecase, long currentTime )
+    public EntityStoreUnitOfWork newUnitOfWork( ModuleDescriptor module, Usecase usecase, Instant currentTime )
     {
         return new DefaultEntityStoreUnitOfWork( module, entityStoreSPI, newUnitOfWorkId(), usecase, currentTime );
     }
@@ -358,7 +359,7 @@ public class SQLEntityStoreMixin
             final EntityStatus[] status = { EntityStatus.LOADED };
 
             String version = jsonObject.getString( JSONKeys.VERSION );
-            long modified = jsonObject.getLong( JSONKeys.MODIFIED );
+            Instant modified = Instant.ofEpochMilli(jsonObject.getLong( JSONKeys.MODIFIED ));
             String identity = jsonObject.getString( JSONKeys.IDENTITY );
 
             // Check if version is correct
@@ -552,7 +553,7 @@ public class SQLEntityStoreMixin
                 key( JSONKeys.APPLICATION_VERSION ).value( application.version() ).
                 key( JSONKeys.TYPE ).value( state.entityDescriptor().types().findFirst().get().getName() ).
                 key( JSONKeys.VERSION ).value( version ).
-                key( JSONKeys.MODIFIED ).value( state.lastModified() ).
+                key( JSONKeys.MODIFIED ).value( state.lastModified().toEpochMilli() ).
                 key( JSONKeys.PROPERTIES ).object();
 
             state.entityDescriptor().state().properties().forEach( persistentProperty -> {

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/extensions/entitystore-sql/src/main/java/org/apache/zest/entitystore/sql/internal/DatabaseSQLService.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/zest/entitystore/sql/internal/DatabaseSQLService.java b/extensions/entitystore-sql/src/main/java/org/apache/zest/entitystore/sql/internal/DatabaseSQLService.java
index 82bed93..1723e33 100644
--- a/extensions/entitystore-sql/src/main/java/org/apache/zest/entitystore/sql/internal/DatabaseSQLService.java
+++ b/extensions/entitystore-sql/src/main/java/org/apache/zest/entitystore/sql/internal/DatabaseSQLService.java
@@ -24,6 +24,7 @@ import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.time.Instant;
 import org.apache.zest.api.entity.EntityReference;
 import org.apache.zest.api.service.ServiceComposite;
 
@@ -108,10 +109,10 @@ public interface DatabaseSQLService
     void populateGetAllEntitiesStatement( PreparedStatement ps )
         throws SQLException;
 
-    void populateInsertEntityStatement( PreparedStatement ps, EntityReference ref, String entity, Long lastModified )
+    void populateInsertEntityStatement( PreparedStatement ps, EntityReference ref, String entity, Instant lastModified )
         throws SQLException;
 
-    void populateUpdateEntityStatement( PreparedStatement ps, Long entityPK, Long entityOptimisticLock, EntityReference ref, String entity, Long lastModified )
+    void populateUpdateEntityStatement( PreparedStatement ps, Long entityPK, Long entityOptimisticLock, EntityReference ref, String entity, Instant lastModified )
         throws SQLException;
 
     void populateRemoveEntityStatement( PreparedStatement ps, Long entityPK, EntityReference ref )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/extensions/entitystore-sql/src/main/java/org/apache/zest/entitystore/sql/internal/DatabaseSQLServiceStatementsMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/zest/entitystore/sql/internal/DatabaseSQLServiceStatementsMixin.java b/extensions/entitystore-sql/src/main/java/org/apache/zest/entitystore/sql/internal/DatabaseSQLServiceStatementsMixin.java
index 5765196..a755c19 100644
--- a/extensions/entitystore-sql/src/main/java/org/apache/zest/entitystore/sql/internal/DatabaseSQLServiceStatementsMixin.java
+++ b/extensions/entitystore-sql/src/main/java/org/apache/zest/entitystore/sql/internal/DatabaseSQLServiceStatementsMixin.java
@@ -22,6 +22,7 @@ package org.apache.zest.entitystore.sql.internal;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
+import java.time.Instant;
 import org.apache.zest.api.entity.EntityReference;
 import org.apache.zest.api.injection.scope.This;
 
@@ -88,12 +89,12 @@ public abstract class DatabaseSQLServiceStatementsMixin
     }
 
     @Override
-    public void populateInsertEntityStatement( PreparedStatement ps, EntityReference ref, String entity, Long lastModified )
+    public void populateInsertEntityStatement( PreparedStatement ps, EntityReference ref, String entity, Instant lastModified )
             throws SQLException
     {
         ps.setString( 1, ref.identity() );
         ps.setString( 2, entity );
-        ps.setLong( 3, lastModified );
+        ps.setLong( 3, lastModified.toEpochMilli() );
     }
 
     @Override
@@ -104,12 +105,12 @@ public abstract class DatabaseSQLServiceStatementsMixin
     }
 
     @Override
-    public void populateUpdateEntityStatement( PreparedStatement ps, Long entityPK, Long entityOptimisticLock, EntityReference ref, String entity, Long lastModified )
+    public void populateUpdateEntityStatement( PreparedStatement ps, Long entityPK, Long entityOptimisticLock, EntityReference ref, String entity, Instant lastModified )
             throws SQLException
     {
         ps.setLong( 1, entityOptimisticLock + 1 );
         ps.setString( 2, entity );
-        ps.setLong( 3, lastModified );
+        ps.setLong( 3, lastModified.toEpochMilli() );
         ps.setLong( 4, entityPK );
         ps.setLong( 5, entityOptimisticLock );
     }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/extensions/entitystore-sql/src/main/java/org/apache/zest/entitystore/sql/internal/SQLEntityState.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/zest/entitystore/sql/internal/SQLEntityState.java b/extensions/entitystore-sql/src/main/java/org/apache/zest/entitystore/sql/internal/SQLEntityState.java
index 4634b43..3466cbc 100644
--- a/extensions/entitystore-sql/src/main/java/org/apache/zest/entitystore/sql/internal/SQLEntityState.java
+++ b/extensions/entitystore-sql/src/main/java/org/apache/zest/entitystore/sql/internal/SQLEntityState.java
@@ -19,6 +19,7 @@
  */
 package org.apache.zest.entitystore.sql.internal;
 
+import java.time.Instant;
 import org.apache.zest.api.common.QualifiedName;
 import org.apache.zest.api.entity.EntityDescriptor;
 import org.apache.zest.api.entity.EntityReference;
@@ -33,11 +34,11 @@ public interface SQLEntityState
         extends EntityState
 {
 
-    public Long getEntityPK();
+    Long getEntityPK();
 
-    public Long getEntityOptimisticLock();
+    Long getEntityOptimisticLock();
 
-    public DefaultEntityState getDefaultEntityState();
+    DefaultEntityState getDefaultEntityState();
 
     @SuppressWarnings( "PublicInnerClass" )
     public final class DefaultSQLEntityState
@@ -129,7 +130,7 @@ public interface SQLEntityState
         }
 
         @Override
-        public long lastModified()
+        public Instant lastModified()
         {
             return state.lastModified();
         }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/ElasticSearchIndexer.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/ElasticSearchIndexer.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/ElasticSearchIndexer.java
index f51d512..e05081b 100755
--- a/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/ElasticSearchIndexer.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/ElasticSearchIndexer.java
@@ -31,6 +31,7 @@ import org.apache.zest.api.injection.scope.This;
 import org.apache.zest.api.mixin.Mixins;
 import org.apache.zest.api.service.qualifier.Tagged;
 import org.apache.zest.api.structure.ModuleDescriptor;
+import org.apache.zest.api.time.SystemTime;
 import org.apache.zest.api.type.ValueType;
 import org.apache.zest.api.usecase.UsecaseBuilder;
 import org.apache.zest.api.util.Classes;
@@ -100,8 +101,9 @@ public interface ElasticSearchIndexer
             }
 
             EntityStoreUnitOfWork uow = entityStore.newUnitOfWork(
-                module, UsecaseBuilder.newUsecase( "Load associations for indexing" ),
-                System.currentTimeMillis()
+                    module,
+                    UsecaseBuilder.newUsecase( "Load associations for indexing" ),
+                    SystemTime.now()
             );
 
             // Bulk index request builder

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RDFPerformanceTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RDFPerformanceTest.java b/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RDFPerformanceTest.java
index aef84ee..15a4d7a 100644
--- a/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RDFPerformanceTest.java
+++ b/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RDFPerformanceTest.java
@@ -25,15 +25,19 @@ package org.apache.zest.index.rdf;
  */
 
 import java.io.File;
-import org.junit.Ignore;
-import org.junit.Test;
+import java.time.Duration;
+import java.time.Instant;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.apache.zest.api.association.ManyAssociation;
 import org.apache.zest.api.common.UseDefaults;
 import org.apache.zest.api.common.Visibility;
 import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.api.association.ManyAssociation;
 import org.apache.zest.api.property.Property;
 import org.apache.zest.api.query.Query;
 import org.apache.zest.api.query.QueryExpressions;
+import org.apache.zest.api.time.SystemTime;
 import org.apache.zest.api.unitofwork.UnitOfWork;
 import org.apache.zest.bootstrap.Assembler;
 import org.apache.zest.bootstrap.AssemblyException;
@@ -44,15 +48,13 @@ import org.apache.zest.library.rdf.repository.NativeConfiguration;
 import org.apache.zest.spi.query.IndexExporter;
 import org.apache.zest.test.AbstractZestTest;
 import org.apache.zest.test.EntityTestAssembler;
+import org.apache.zest.test.util.DelTreeAfter;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.junit.Rule;
-import org.apache.zest.test.util.DelTreeAfter;
-
 public class RDFPerformanceTest extends AbstractZestTest
 {
     private static final Logger LOG = LoggerFactory.getLogger( RDFPerformanceTest.class );
@@ -163,21 +165,21 @@ public class RDFPerformanceTest extends AbstractZestTest
 
     private void performTest( int howMany ) throws Exception
     {
-        long startTest = System.currentTimeMillis();
+        Instant startTest = SystemTime.now();
 
         UnitOfWork creatingUOW = this.unitOfWorkFactory.newUnitOfWork();
-        Long startingTime = System.currentTimeMillis();
+        Instant startingTime = SystemTime.now();
         List<ExampleEntity> entities = this.doCreate( howMany );
-        LOG.info( "Time to create " + howMany + " entities (ms): " + (System.currentTimeMillis() - startingTime) );
+        LOG.info( "Time to create " + howMany + " entities: " + Duration.between(startingTime, SystemTime.now() ) );
 
-        startingTime = System.currentTimeMillis();
+        startingTime = SystemTime.now();
         creatingUOW.complete();
-        LOG.info( "Time to complete creation uow (ms): " + (System.currentTimeMillis() - startingTime) );
+        LOG.info( "Time to complete creation uow: " + Duration.between(startingTime, SystemTime.now() ) );
 
 
         List<ExampleEntity> entityList = this.doList( howMany );
 
-        startingTime = System.currentTimeMillis();
+        startingTime = SystemTime.now();
         UnitOfWork uow = this.unitOfWorkFactory.newUnitOfWork();
         for (int i = 0; i < 1000; i++)
         {
@@ -186,23 +188,21 @@ public class RDFPerformanceTest extends AbstractZestTest
             System.out.println(query.count());
         }
 
-        long endTest = System.currentTimeMillis();
-        LOG.info( "Time to query " + howMany + " entities (ms): " + (endTest - startingTime) );
+        Instant endTest = SystemTime.now();
+        LOG.info( "Time to query " + howMany + " entities: " + Duration.between(startTest, endTest) );
 
         UnitOfWork deletingUOW = this.unitOfWorkFactory.newUnitOfWork();
-        startingTime = System.currentTimeMillis();
+        startingTime = SystemTime.now();
         this.doRemoveAll( entityList );
 //      this.doRemove(200);
-        LOG.info( "Time to delete " + howMany + " entities (ms): " + (System.currentTimeMillis() - startingTime) );
+        LOG.info( "Time to delete " + howMany + " entities: " + Duration.between(startingTime, SystemTime.now() ) );
 
-        startingTime = System.currentTimeMillis();
+        startingTime = SystemTime.now();
         deletingUOW.complete();
 
-        endTest = System.currentTimeMillis();
-
-        LOG.info( "time to complete deletion uow (ms): " + (endTest - startingTime) );
-
-        LOG.info( "time to complete test (ms): " + (endTest - startTest) );
+        endTest = SystemTime.now();
+        LOG.info( "time to complete deletion uow: " + Duration.between(startingTime, endTest ) );
+        LOG.info( "time to complete test: " + Duration.between(startingTime, endTest ) );
 
     }
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/extensions/indexing-solr/src/main/java/org/apache/zest/index/solr/internal/SolrEntityIndexerMixin.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-solr/src/main/java/org/apache/zest/index/solr/internal/SolrEntityIndexerMixin.java b/extensions/indexing-solr/src/main/java/org/apache/zest/index/solr/internal/SolrEntityIndexerMixin.java
index 6f9d6f9..5eabfbc 100644
--- a/extensions/indexing-solr/src/main/java/org/apache/zest/index/solr/internal/SolrEntityIndexerMixin.java
+++ b/extensions/indexing-solr/src/main/java/org/apache/zest/index/solr/internal/SolrEntityIndexerMixin.java
@@ -159,7 +159,7 @@ public abstract class SolrEntityIndexerMixin
         SolrInputDocument input = new SolrInputDocument();
         input.addField( "id", entityState.identity().identity() );
         input.addField( "type", entityState.entityDescriptor().types().findFirst().get().getName() );
-        input.addField( "lastModified", new java.util.Date( entityState.lastModified() ) );
+        input.addField( "lastModified", java.util.Date.from( entityState.lastModified() ) );
 
         for( Statement statement : graph )
         {

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/AbstractSQLIndexing.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/AbstractSQLIndexing.java b/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/AbstractSQLIndexing.java
index faa9aad..d8b7253 100644
--- a/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/AbstractSQLIndexing.java
+++ b/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/AbstractSQLIndexing.java
@@ -331,7 +331,7 @@ public abstract class AbstractSQLIndexing
         throws SQLException
     {
         ps.setString( startingIndex, state.identity().identity() );
-        ps.setTimestamp( startingIndex + 1, new Timestamp( state.lastModified() ) );
+        ps.setTimestamp( startingIndex + 1, Timestamp.from( state.lastModified() ) );
         ps.setString( startingIndex + 2, state.version() );
         ps.setString( startingIndex + 3, this._app.version() );
     }
@@ -1006,7 +1006,7 @@ public abstract class AbstractSQLIndexing
 
         // Update state
         ps.setString( 1, state.identity().identity() );
-        ps.setTimestamp( 2, new Timestamp( state.lastModified() ) );
+        ps.setTimestamp( 2, Timestamp.from( state.lastModified() ) );
         ps.setString( 3, state.version() );
         ps.setString( 4, this._app.version() );
         ps.setLong( 5, entityPK );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/SQLCompatEntityStateWrapper.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/SQLCompatEntityStateWrapper.java b/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/SQLCompatEntityStateWrapper.java
index d35716c..3a42b55 100644
--- a/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/SQLCompatEntityStateWrapper.java
+++ b/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/SQLCompatEntityStateWrapper.java
@@ -19,6 +19,7 @@
  */
 package org.apache.zest.index.sql.support.skeletons;
 
+import java.time.Instant;
 import java.util.function.Function;
 import java.util.function.Predicate;
 import java.util.stream.Stream;
@@ -46,7 +47,7 @@ import org.slf4j.LoggerFactory;
  * <p>This allows to disable unsupported properties indexing to prevent failures in the SQL Index/Query engine.</p>
  * <p>When an unsupported Property is found it is logged at WARN level.</p>
  */
-/* package */ class SQLCompatEntityStateWrapper
+class SQLCompatEntityStateWrapper
     implements EntityState
 {
     private static final Logger LOGGER = LoggerFactory.getLogger( SQLCompatEntityStateWrapper.class.getName() );
@@ -108,7 +109,7 @@ import org.slf4j.LoggerFactory;
     }
 
     @Override
-    public long lastModified()
+    public Instant lastModified()
     {
         return wrappedEntityState.lastModified();
     }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/libraries/circuitbreaker/src/main/java/org/apache/zest/library/circuitbreaker/jmx/CircuitBreakerJMX.java
----------------------------------------------------------------------
diff --git a/libraries/circuitbreaker/src/main/java/org/apache/zest/library/circuitbreaker/jmx/CircuitBreakerJMX.java b/libraries/circuitbreaker/src/main/java/org/apache/zest/library/circuitbreaker/jmx/CircuitBreakerJMX.java
index 32d7473..084dfb7 100644
--- a/libraries/circuitbreaker/src/main/java/org/apache/zest/library/circuitbreaker/jmx/CircuitBreakerJMX.java
+++ b/libraries/circuitbreaker/src/main/java/org/apache/zest/library/circuitbreaker/jmx/CircuitBreakerJMX.java
@@ -28,6 +28,7 @@ import javax.management.MBeanNotificationInfo;
 import javax.management.Notification;
 import javax.management.NotificationBroadcasterSupport;
 import javax.management.ObjectName;
+import org.apache.zest.api.time.SystemTime;
 import org.apache.zest.library.circuitbreaker.CircuitBreaker;
 
 /**
@@ -46,12 +47,13 @@ public class CircuitBreakerJMX
       this.circuitBreaker = circuitBreaker;
       circuitBreaker.addPropertyChangeListener(new PropertyChangeListener()
       {
-         long sequenceNr = System.currentTimeMillis();
+         long sequenceNr = SystemTime.now().toEpochMilli();
 
          @Override
          public void propertyChange(PropertyChangeEvent evt)
          {
-            Notification notification = new Notification(evt.getPropertyName(), mbeanObjectName, sequenceNr++, System.currentTimeMillis(), evt.getNewValue().toString());
+            long now = SystemTime.now().toEpochMilli();
+            Notification notification = new Notification(evt.getPropertyName(), mbeanObjectName, sequenceNr++, now, evt.getNewValue().toString());
             sendNotification(notification);
          }
       });

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/libraries/fileconfig/src/test/java/org/apache/zest/library/fileconfig/FileConfigurationTest.java
----------------------------------------------------------------------
diff --git a/libraries/fileconfig/src/test/java/org/apache/zest/library/fileconfig/FileConfigurationTest.java b/libraries/fileconfig/src/test/java/org/apache/zest/library/fileconfig/FileConfigurationTest.java
index 70baf31..850bd83 100644
--- a/libraries/fileconfig/src/test/java/org/apache/zest/library/fileconfig/FileConfigurationTest.java
+++ b/libraries/fileconfig/src/test/java/org/apache/zest/library/fileconfig/FileConfigurationTest.java
@@ -57,7 +57,7 @@ public class FileConfigurationTest
     public void testFileConfigurationOverride()
         throws IOException, ActivationException, AssemblyException
     {
-        File testFile = File.createTempFile( FileConfigurationTest.class.getName(), "" + System.currentTimeMillis() );
+        File testFile = File.createTempFile( FileConfigurationTest.class.getName(), "tmp" );
         final File confDir = testFile;
         final File dataDir = testFile;
         final File tempDir = testFile;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/libraries/logging/src/main/java/org/apache/zest/library/logging/debug/records/DebugRecord.java
----------------------------------------------------------------------
diff --git a/libraries/logging/src/main/java/org/apache/zest/library/logging/debug/records/DebugRecord.java b/libraries/logging/src/main/java/org/apache/zest/library/logging/debug/records/DebugRecord.java
index f47c9a0..c412bc8 100644
--- a/libraries/logging/src/main/java/org/apache/zest/library/logging/debug/records/DebugRecord.java
+++ b/libraries/logging/src/main/java/org/apache/zest/library/logging/debug/records/DebugRecord.java
@@ -21,6 +21,7 @@
 package org.apache.zest.library.logging.debug.records;
 
 import java.io.Serializable;
+import java.time.Instant;
 import java.util.List;
 import org.apache.zest.api.property.Property;
 
@@ -32,7 +33,7 @@ public interface DebugRecord
 
     Property<String> threadName();
 
-    Property<Long> time();
+    Property<Instant> time();
 
     Property<List<Serializable>> parameters();
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/libraries/logging/src/main/java/org/apache/zest/library/logging/debug/service/DebuggingServiceMixin.java
----------------------------------------------------------------------
diff --git a/libraries/logging/src/main/java/org/apache/zest/library/logging/debug/service/DebuggingServiceMixin.java b/libraries/logging/src/main/java/org/apache/zest/library/logging/debug/service/DebuggingServiceMixin.java
index cfc9395..5d8fd9c 100644
--- a/libraries/logging/src/main/java/org/apache/zest/library/logging/debug/service/DebuggingServiceMixin.java
+++ b/libraries/logging/src/main/java/org/apache/zest/library/logging/debug/service/DebuggingServiceMixin.java
@@ -32,6 +32,7 @@ import org.apache.zest.api.entity.EntityComposite;
 import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.injection.scope.This;
 import org.apache.zest.api.service.ServiceComposite;
+import org.apache.zest.api.time.SystemTime;
 import org.apache.zest.api.unitofwork.ConcurrentEntityModificationException;
 import org.apache.zest.api.unitofwork.UnitOfWork;
 import org.apache.zest.api.unitofwork.UnitOfWorkCompletionException;
@@ -166,7 +167,7 @@ public class DebuggingServiceMixin
 
     private void setStandardStuff( Composite composite, String message, DebugRecord state, List<Serializable> params )
     {
-        state.time().set( System.currentTimeMillis() );
+        state.time().set( SystemTime.now() );
         state.message().set( message );
         state.compositeTypeName().set( getCompositeName( composite ) );
         state.threadName().set( Thread.currentThread().getName() );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/libraries/logging/src/main/java/org/apache/zest/library/logging/log/records/LogRecord.java
----------------------------------------------------------------------
diff --git a/libraries/logging/src/main/java/org/apache/zest/library/logging/log/records/LogRecord.java b/libraries/logging/src/main/java/org/apache/zest/library/logging/log/records/LogRecord.java
index 03706b6..3de0dde 100644
--- a/libraries/logging/src/main/java/org/apache/zest/library/logging/log/records/LogRecord.java
+++ b/libraries/logging/src/main/java/org/apache/zest/library/logging/log/records/LogRecord.java
@@ -20,6 +20,7 @@
 package org.apache.zest.library.logging.log.records;
 
 import java.io.Serializable;
+import java.time.Instant;
 import java.util.List;
 import org.apache.zest.api.property.Property;
 import org.apache.zest.library.logging.log.LogType;
@@ -36,7 +37,7 @@ public interface LogRecord
 
     Property<LogType> logtype();
 
-    Property<Long> time();
+    Property<Instant> time();
 
     Property<List<Serializable>> parameters();
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/libraries/logging/src/main/java/org/apache/zest/library/logging/log/service/LoggingServiceMixin.java
----------------------------------------------------------------------
diff --git a/libraries/logging/src/main/java/org/apache/zest/library/logging/log/service/LoggingServiceMixin.java b/libraries/logging/src/main/java/org/apache/zest/library/logging/log/service/LoggingServiceMixin.java
index df59579..4431865 100644
--- a/libraries/logging/src/main/java/org/apache/zest/library/logging/log/service/LoggingServiceMixin.java
+++ b/libraries/logging/src/main/java/org/apache/zest/library/logging/log/service/LoggingServiceMixin.java
@@ -30,6 +30,7 @@ import org.apache.zest.api.entity.EntityBuilder;
 import org.apache.zest.api.entity.EntityComposite;
 import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.service.ServiceComposite;
+import org.apache.zest.api.time.SystemTime;
 import org.apache.zest.api.unitofwork.ConcurrentEntityModificationException;
 import org.apache.zest.api.unitofwork.UnitOfWork;
 import org.apache.zest.api.unitofwork.UnitOfWorkCompletionException;
@@ -158,7 +159,7 @@ public abstract class LoggingServiceMixin
                                    LogRecord state, List<Serializable> params )
     {
         state.logtype().set( type );
-        state.time().set( System.currentTimeMillis() );
+        state.time().set( SystemTime.now() );
         state.category().set( category );
         state.message().set( message );
         state.compositeTypeName().set( getCompositeName( composite ) );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/libraries/logging/src/main/java/org/apache/zest/library/logging/trace/AbstractTraceConcern.java
----------------------------------------------------------------------
diff --git a/libraries/logging/src/main/java/org/apache/zest/library/logging/trace/AbstractTraceConcern.java b/libraries/logging/src/main/java/org/apache/zest/library/logging/trace/AbstractTraceConcern.java
index 1575ac8..c3860bf 100644
--- a/libraries/logging/src/main/java/org/apache/zest/library/logging/trace/AbstractTraceConcern.java
+++ b/libraries/logging/src/main/java/org/apache/zest/library/logging/trace/AbstractTraceConcern.java
@@ -22,12 +22,15 @@ package org.apache.zest.library.logging.trace;
 
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
+import java.time.Duration;
+import java.time.Instant;
 import org.apache.zest.api.ZestAPI;
 import org.apache.zest.api.common.Optional;
 import org.apache.zest.api.composite.Composite;
 import org.apache.zest.api.concern.ConcernOf;
 import org.apache.zest.api.injection.scope.Service;
 import org.apache.zest.api.injection.scope.Structure;
+import org.apache.zest.api.time.SystemTime;
 import org.apache.zest.library.logging.trace.service.TraceService;
 
 
@@ -51,19 +54,13 @@ public abstract class AbstractTraceConcern extends ConcernOf<InvocationHandler>
     {
         boolean doTrace = traceService != null && doTrace();
         Object result;
-        long entryTime = 0;
-        long timeStamp = 0;
+        Instant entryTime = SystemTime.now();;
         try
         {
-            if( doTrace )
-            {
-                entryTime = System.currentTimeMillis();
-                timeStamp = System.nanoTime();
-            }
             result = next.invoke( proxy, method, args );
             if( doTrace )
             {
-                long duration = System.nanoTime() - timeStamp;
+                Duration duration = Duration.between(entryTime, SystemTime.now() );
                 traceService.traceSuccess( compositeType, api.dereference( thisComposite ), method, args, result, entryTime, duration );
             }
         }
@@ -71,7 +68,7 @@ public abstract class AbstractTraceConcern extends ConcernOf<InvocationHandler>
         {
             if( doTrace )
             {
-                long duration = System.nanoTime() - timeStamp;
+                Duration duration = Duration.between(entryTime, SystemTime.now() );
                 Composite object = api.dereference( thisComposite );
                 traceService.traceException( compositeType, object, method, args, t, entryTime, duration );
             }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/libraries/logging/src/main/java/org/apache/zest/library/logging/trace/TraceOnConsoleSideEffect.java
----------------------------------------------------------------------
diff --git a/libraries/logging/src/main/java/org/apache/zest/library/logging/trace/TraceOnConsoleSideEffect.java b/libraries/logging/src/main/java/org/apache/zest/library/logging/trace/TraceOnConsoleSideEffect.java
index 0ed54e1..6497810 100644
--- a/libraries/logging/src/main/java/org/apache/zest/library/logging/trace/TraceOnConsoleSideEffect.java
+++ b/libraries/logging/src/main/java/org/apache/zest/library/logging/trace/TraceOnConsoleSideEffect.java
@@ -22,6 +22,8 @@ package org.apache.zest.library.logging.trace;
 
 import java.io.PrintStream;
 import java.lang.reflect.Method;
+import java.time.Duration;
+import java.time.Instant;
 import org.apache.zest.api.composite.Composite;
 import org.apache.zest.api.sideeffect.SideEffectOf;
 import org.apache.zest.library.logging.trace.service.TraceService;
@@ -36,23 +38,23 @@ public abstract class TraceOnConsoleSideEffect extends SideEffectOf<TraceService
     private static PrintStream OUT = System.err;
 
     @Override
-    public void traceSuccess( Class compositeType, Composite object, Method method, Object[] args, Object result, long entryTime, long durationNano )
+    public void traceSuccess(Class compositeType, Composite object, Method method, Object[] args, Object result, Instant entryTime, Duration duration )
     {
         StringBuffer buf = new StringBuffer();
-        buf.append( durationNano / 1000000 );
-        buf.append( " ms: " );
+        buf.append( duration );
+        buf.append( " : " );
         formatMethod( buf, object, compositeType, method, args );
         OUT.println( buf.toString() );
         OUT.println( result );
     }
 
     @Override
-    public void traceException( Class compositeType, Composite object, Method method, Object[] args, Throwable t, long entryTime, long durationNano )
+    public void traceException( Class compositeType, Composite object, Method method, Object[] args, Throwable t, Instant entryTime, Duration duration )
     {
         StringBuffer buf = new StringBuffer();
         buf.append( "Exception: " );
-        buf.append( durationNano / 1000000 );
-        buf.append( " ms: " );
+        buf.append( duration );
+        buf.append( " : " );
         OUT.println( buf.toString() );
         t.printStackTrace( OUT );
     }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/libraries/logging/src/main/java/org/apache/zest/library/logging/trace/records/TraceRecord.java
----------------------------------------------------------------------
diff --git a/libraries/logging/src/main/java/org/apache/zest/library/logging/trace/records/TraceRecord.java b/libraries/logging/src/main/java/org/apache/zest/library/logging/trace/records/TraceRecord.java
index f60f51f..bbf6f7d 100644
--- a/libraries/logging/src/main/java/org/apache/zest/library/logging/trace/records/TraceRecord.java
+++ b/libraries/logging/src/main/java/org/apache/zest/library/logging/trace/records/TraceRecord.java
@@ -20,6 +20,8 @@
 
 package org.apache.zest.library.logging.trace.records;
 
+import java.time.Duration;
+import java.time.Instant;
 import java.util.List;
 import org.apache.zest.api.common.Optional;
 import org.apache.zest.api.entity.Queryable;
@@ -33,9 +35,9 @@ public interface TraceRecord
 
     Property<String> threadName();
 
-    Property<Long> entryTime();
+    Property<Instant> entryTime();
 
-    Property<Long> duration();
+    Property<Duration> duration();
 
     @Optional Property<Throwable> exception();
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/libraries/logging/src/main/java/org/apache/zest/library/logging/trace/service/TraceService.java
----------------------------------------------------------------------
diff --git a/libraries/logging/src/main/java/org/apache/zest/library/logging/trace/service/TraceService.java b/libraries/logging/src/main/java/org/apache/zest/library/logging/trace/service/TraceService.java
index 4f222c9..03184d8 100644
--- a/libraries/logging/src/main/java/org/apache/zest/library/logging/trace/service/TraceService.java
+++ b/libraries/logging/src/main/java/org/apache/zest/library/logging/trace/service/TraceService.java
@@ -21,6 +21,8 @@
 package org.apache.zest.library.logging.trace.service;
 
 import java.lang.reflect.Method;
+import java.time.Duration;
+import java.time.Instant;
 import org.apache.zest.api.common.Optional;
 import org.apache.zest.api.composite.Composite;
 
@@ -28,8 +30,8 @@ public interface TraceService
 {
     int traceLevel();
 
-    void traceSuccess( Class compositeType, Composite object, Method method, @Optional Object[] args, Object result, long entryTime, long durationNano );
+    void traceSuccess(Class compositeType, Composite object, Method method, @Optional Object[] args, Object result, Instant entryTime, Duration duration );
 
-    void traceException( Class compositeType, Composite object, Method method, @Optional Object[] args, Throwable t, long entryTime, long durationNano );
+    void traceException( Class compositeType, Composite object, Method method, @Optional Object[] args, Throwable t, Instant entryTime, Duration duration );
 
 }


[6/7] zest-java git commit: ZEST-181 : Replaced the use of 'long' as a time and using java.time.Instant instead.

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/libraries/logging/src/main/java/org/apache/zest/library/logging/trace/service/TraceServiceMixin.java
----------------------------------------------------------------------
diff --git a/libraries/logging/src/main/java/org/apache/zest/library/logging/trace/service/TraceServiceMixin.java b/libraries/logging/src/main/java/org/apache/zest/library/logging/trace/service/TraceServiceMixin.java
index 39ad21a..9d1258b 100644
--- a/libraries/logging/src/main/java/org/apache/zest/library/logging/trace/service/TraceServiceMixin.java
+++ b/libraries/logging/src/main/java/org/apache/zest/library/logging/trace/service/TraceServiceMixin.java
@@ -21,6 +21,8 @@
 package org.apache.zest.library.logging.trace.service;
 
 import java.lang.reflect.Method;
+import java.time.Duration;
+import java.time.Instant;
 import java.util.ArrayList;
 import java.util.List;
 import org.apache.zest.api.ZestAPI;
@@ -67,14 +69,14 @@ public class TraceServiceMixin
                               Method method,
                               Object[] args,
                               Object result,
-                              long entryTime,
-                              long durationNano
+                              Instant entryTime,
+                              Duration duration
     )
     {
         UnitOfWork uow = uowf.newUnitOfWork();
         try
         {
-            createTraceRecord( uow, compositeType, object, method, args, entryTime, durationNano, null );
+            createTraceRecord( uow, compositeType, object, method, args, entryTime, duration, null );
             uow.complete();
         }
         catch( ConcurrentEntityModificationException e )
@@ -93,14 +95,14 @@ public class TraceServiceMixin
                                 Method method,
                                 Object[] args,
                                 Throwable t,
-                                long entryTime,
-                                long durationNano
+                                Instant entryTime,
+                                Duration duration
     )
     {
         UnitOfWork uow = uowf.newUnitOfWork();
         try
         {
-            createTraceRecord( uow, compositeType, object, method, args, entryTime, durationNano, t );
+            createTraceRecord( uow, compositeType, object, method, args, entryTime, duration, t );
             uow.complete();
         }
         catch( ConcurrentEntityModificationException e )
@@ -118,8 +120,8 @@ public class TraceServiceMixin
                                     Composite object,
                                     Method method,
                                     Object[] args,
-                                    long entryTime,
-                                    long durationNano,
+                                    Instant entryTime,
+                                    Duration duration,
                                     Throwable exception
     )
     {
@@ -134,7 +136,7 @@ public class TraceServiceMixin
                     .orElse( null ), identity );
             EntityBuilder<EntityTraceRecordEntity> builder = uow.newEntityBuilder( EntityTraceRecordEntity.class );
             EntityTraceRecordEntity state = builder.instance();
-            setStandardStuff( compositeType, method, args, entryTime, durationNano, state, exception );
+            setStandardStuff( compositeType, method, args, entryTime, duration, state, exception );
             state.source().set( source );
             EntityTraceRecordEntity etr = builder.newInstance();  // Record is created.
         }
@@ -143,7 +145,7 @@ public class TraceServiceMixin
             ServiceComposite service = (ServiceComposite) object;
             EntityBuilder<ServiceTraceRecordEntity> builder = uow.newEntityBuilder( ServiceTraceRecordEntity.class );
             ServiceTraceRecordEntity state = builder.instance();
-            setStandardStuff( compositeType, method, args, entryTime, durationNano, state, exception );
+            setStandardStuff( compositeType, method, args, entryTime, duration, state, exception );
             state.source().set( service.toString() );
             ServiceTraceRecordEntity str = builder.newInstance();  // Record is created.
         }
@@ -152,7 +154,7 @@ public class TraceServiceMixin
             EntityBuilder<CompositeTraceRecordEntity> builder = uow.newEntityBuilder( CompositeTraceRecordEntity.class );
             CompositeTraceRecordEntity state = builder.instance();
             state.source().set( object );
-            setStandardStuff( compositeType, method, args, entryTime, durationNano, state, exception );
+            setStandardStuff( compositeType, method, args, entryTime, duration, state, exception );
             CompositeTraceRecordEntity ctr = builder.newInstance();  // Record is created.
         }
     }
@@ -160,13 +162,13 @@ public class TraceServiceMixin
     private void setStandardStuff( Class compositeType,
                                    Method method,
                                    Object[] args,
-                                   long entryTime,
-                                   long durationNano,
+                                   Instant entryTime,
+                                   Duration duration,
                                    TraceRecord state,
                                    Throwable exception
     )
     {
-        state.duration().set( durationNano );
+        state.duration().set( duration );
         state.entryTime().set( entryTime );
         state.methodName().set( method.getName() );
         state.compositeTypeName().set( compositeType.getName() );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/libraries/rdf/src/test/java/org/apache/zest/library/rdf/entity/EntitySerializerTest.java
----------------------------------------------------------------------
diff --git a/libraries/rdf/src/test/java/org/apache/zest/library/rdf/entity/EntitySerializerTest.java b/libraries/rdf/src/test/java/org/apache/zest/library/rdf/entity/EntitySerializerTest.java
index a172171..5947683 100755
--- a/libraries/rdf/src/test/java/org/apache/zest/library/rdf/entity/EntitySerializerTest.java
+++ b/libraries/rdf/src/test/java/org/apache/zest/library/rdf/entity/EntitySerializerTest.java
@@ -21,6 +21,8 @@
 package org.apache.zest.library.rdf.entity;
 
 import java.io.PrintWriter;
+import java.time.Instant;
+import org.apache.zest.api.time.SystemTime;
 import org.junit.Before;
 import org.junit.Test;
 import org.openrdf.model.Statement;
@@ -83,7 +85,7 @@ public class EntitySerializerTest
     {
         EntityReference entityReference = new EntityReference( "test2" );
         Usecase usecase = UsecaseBuilder.newUsecase( "Test" );
-        long currentTime = System.currentTimeMillis();
+        Instant currentTime = SystemTime.now();
         EntityStoreUnitOfWork unitOfWork = entityStore.newUnitOfWork( module, usecase, currentTime );
         EntityState entityState = unitOfWork.entityStateOf( module, entityReference );
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/api/ResourceValidity.java
----------------------------------------------------------------------
diff --git a/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/api/ResourceValidity.java b/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/api/ResourceValidity.java
index e92338b..d8d43e0 100644
--- a/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/api/ResourceValidity.java
+++ b/libraries/rest-server/src/main/java/org/apache/zest/library/rest/server/api/ResourceValidity.java
@@ -21,6 +21,7 @@
 package org.apache.zest.library.rest.server.api;
 
 import java.time.Instant;
+import java.time.temporal.ChronoField;
 import org.apache.zest.api.entity.EntityComposite;
 import org.apache.zest.api.unitofwork.NoSuchEntityException;
 import org.apache.zest.api.unitofwork.UnitOfWork;
@@ -67,7 +68,7 @@ class ResourceValidity
         {
             EntityState state = spi.entityStateOf( entity );
             Tag tag = new Tag( state.identity().identity() + "/" + state.version() );
-            response.getEntity().setModificationDate( new java.util.Date( state.lastModified() ) );
+            response.getEntity().setModificationDate( java.util.Date.from( state.lastModified() ) );
             response.getEntity().setTag( tag );
         }
     }
@@ -78,10 +79,10 @@ class ResourceValidity
         // Check command rules
         Instant unmodifiedSince = request.getConditions().getUnmodifiedSince().toInstant();
         EntityState state = spi.entityStateOf( entity );
-        Instant lastModified = cutoffMillis( state.lastModified() );
+        Instant lastModifiedSeconds = state.lastModified().with(ChronoField.NANO_OF_SECOND, 0 );
         if( unmodifiedSince != null )
         {
-            if( lastModified.isAfter( unmodifiedSince ) )
+            if( lastModifiedSeconds.isAfter( unmodifiedSince ) )
             {
                 throw new ResourceException( Status.CLIENT_ERROR_CONFLICT );
             }
@@ -91,15 +92,10 @@ class ResourceValidity
         Instant modifiedSince = request.getConditions().getModifiedSince().toInstant();
         if( modifiedSince != null )
         {
-            if( !lastModified.isAfter( modifiedSince ) )
+            if( !lastModifiedSeconds.isAfter( modifiedSince ) )
             {
                 throw new ResourceException( Status.REDIRECTION_NOT_MODIFIED );
             }
         }
     }
-
-    private Instant cutoffMillis( long time )
-    {
-        return Instant.ofEpochMilli( time / 1000 * 1000 );
-    }
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/libraries/rest/src/main/java/org/apache/zest/library/rest/admin/EntityResource.java
----------------------------------------------------------------------
diff --git a/libraries/rest/src/main/java/org/apache/zest/library/rest/admin/EntityResource.java b/libraries/rest/src/main/java/org/apache/zest/library/rest/admin/EntityResource.java
index cff150b..212678c 100755
--- a/libraries/rest/src/main/java/org/apache/zest/library/rest/admin/EntityResource.java
+++ b/libraries/rest/src/main/java/org/apache/zest/library/rest/admin/EntityResource.java
@@ -25,7 +25,6 @@ import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.StringReader;
 import java.io.Writer;
-import java.time.Instant;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
@@ -37,6 +36,7 @@ import org.apache.zest.api.injection.scope.Service;
 import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.injection.scope.Uses;
 import org.apache.zest.api.structure.ModuleDescriptor;
+import org.apache.zest.api.time.SystemTime;
 import org.apache.zest.api.usecase.Usecase;
 import org.apache.zest.api.usecase.UsecaseBuilder;
 import org.apache.zest.api.value.ValueSerialization;
@@ -69,8 +69,6 @@ import org.restlet.representation.WriterRepresentation;
 import org.restlet.resource.ResourceException;
 import org.restlet.resource.ServerResource;
 
-import static java.time.Instant.ofEpochMilli;
-
 public class EntityResource
     extends ServerResource
 {
@@ -114,7 +112,7 @@ public class EntityResource
         throws ResourceException
     {
         Usecase usecase = UsecaseBuilder.newUsecase( "Remove entity" );
-        EntityStoreUnitOfWork uow = entityStore.newUnitOfWork( module, usecase, System.currentTimeMillis() );
+        EntityStoreUnitOfWork uow = entityStore.newUnitOfWork( module, usecase, SystemTime.now() );
         try
         {
             EntityReference identityRef = EntityReference.parseEntityReference( identity );
@@ -136,7 +134,7 @@ public class EntityResource
         throws ResourceException
     {
         EntityStoreUnitOfWork uow = entityStore.newUnitOfWork( module, UsecaseBuilder.newUsecase( "Get entity" ),
-                                                               System.currentTimeMillis() );
+                                                               SystemTime.now() );
 
         try
         {
@@ -146,7 +144,7 @@ public class EntityResource
             java.util.Date lastModified = getRequest().getConditions().getModifiedSince();
             if( lastModified != null )
             {
-                if( lastModified.toInstant().getEpochSecond() == ofEpochMilli( entityState.lastModified()).getEpochSecond() )
+                if( lastModified.toInstant().getEpochSecond() == entityState.lastModified().getEpochSecond() )
                 {
                     throw new ResourceException( Status.REDIRECTION_NOT_MODIFIED );
                 }
@@ -193,7 +191,7 @@ public class EntityResource
 
     private Representation entityHeaders( Representation representation, EntityState entityState )
     {
-        representation.setModificationDate( new java.util.Date( entityState.lastModified() ) );
+        representation.setModificationDate( java.util.Date.from( entityState.lastModified() ) );
         representation.setTag( new Tag( "" + entityState.version() ) );
         representation.setCharacterSet( CharacterSet.UTF_8 );
         representation.setLanguages( Collections.singletonList( Language.ENGLISH ) );
@@ -355,7 +353,7 @@ public class EntityResource
         throws ResourceException
     {
         Usecase usecase = UsecaseBuilder.newUsecase( "Update entity" );
-        EntityStoreUnitOfWork unitOfWork = entityStore.newUnitOfWork( module, usecase, System.currentTimeMillis() );
+        EntityStoreUnitOfWork unitOfWork = entityStore.newUnitOfWork( module, usecase, SystemTime.now() );
         EntityState entity = getEntityState( unitOfWork );
 
         Form form = new Form( entityRepresentation );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/samples/forum/src/main/java/org/apache/zest/sample/forum/context/view/ViewPost.java
----------------------------------------------------------------------
diff --git a/samples/forum/src/main/java/org/apache/zest/sample/forum/context/view/ViewPost.java b/samples/forum/src/main/java/org/apache/zest/sample/forum/context/view/ViewPost.java
index 7480607..f98c503 100644
--- a/samples/forum/src/main/java/org/apache/zest/sample/forum/context/view/ViewPost.java
+++ b/samples/forum/src/main/java/org/apache/zest/sample/forum/context/view/ViewPost.java
@@ -70,7 +70,7 @@ class ViewPost
             Post post = uowf.currentUnitOfWork().newEntity( Post.class );
             post.message().set( message );
             post.createdBy().set( poster.self() );
-            post.createdOn().set( Instant.ofEpochMilli( uowf.currentUnitOfWork().currentTime()) );
+            post.createdOn().set( uowf.currentUnitOfWork().currentTime() );
             post.replyTo().set( viewPost.self() );
 
             self().lastPost().set( post );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/samples/forum/src/main/java/org/apache/zest/sample/forum/domainevent/DomainEventValue.java
----------------------------------------------------------------------
diff --git a/samples/forum/src/main/java/org/apache/zest/sample/forum/domainevent/DomainEventValue.java b/samples/forum/src/main/java/org/apache/zest/sample/forum/domainevent/DomainEventValue.java
index 71a08c5..487f686 100644
--- a/samples/forum/src/main/java/org/apache/zest/sample/forum/domainevent/DomainEventValue.java
+++ b/samples/forum/src/main/java/org/apache/zest/sample/forum/domainevent/DomainEventValue.java
@@ -19,6 +19,7 @@
  */
 package org.apache.zest.sample.forum.domainevent;
 
+import java.time.Instant;
 import java.util.List;
 import org.apache.zest.api.common.UseDefaults;
 import org.apache.zest.api.property.Property;
@@ -34,7 +35,7 @@ public interface DomainEventValue
     Property<String> version();
 
     // When the event occurred
-    Property<Long> timestamp();
+    Property<Instant> timestamp();
 
     // Selected objects
     @UseDefaults

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e030bd8a/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/CompositeCreationPerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/CompositeCreationPerformanceTest.java b/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/CompositeCreationPerformanceTest.java
index da2b947..ad6c93a 100644
--- a/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/CompositeCreationPerformanceTest.java
+++ b/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/CompositeCreationPerformanceTest.java
@@ -17,6 +17,9 @@
  */
 package org.apache.zest.test.performance.runtime.composite;
 
+import java.time.Duration;
+import java.time.Instant;
+import org.apache.zest.api.time.SystemTime;
 import org.junit.Test;
 import org.apache.zest.api.activation.ActivationException;
 import org.apache.zest.api.composite.TransientBuilder;


[3/7] zest-java git commit: ZEST-183 : Removing library-eventsourcing.

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/UnitOfWorkApplicationEvents.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/UnitOfWorkApplicationEvents.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/UnitOfWorkApplicationEvents.java
deleted file mode 100644
index 642b911..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/UnitOfWorkApplicationEvents.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.application.factory;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.zest.library.eventsourcing.application.api.ApplicationEvent;
-
-/**
- * List of events for the current UnitOfWork. This will be updated by the DomainEventFactory.
- */
-public class UnitOfWorkApplicationEvents
-{
-    private List<ApplicationEvent> events = new ArrayList<ApplicationEvent>();
-
-    public void add( ApplicationEvent event )
-    {
-        events.add( event );
-    }
-
-    public List<ApplicationEvent> getEvents()
-    {
-        return events;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/package.html
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/package.html b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/package.html
deleted file mode 100644
index fd91648..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/factory/package.html
+++ /dev/null
@@ -1,24 +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>EventSourcing Application Factory.</h2>
-    </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/replay/ApplicationEventPlayer.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/replay/ApplicationEventPlayer.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/replay/ApplicationEventPlayer.java
deleted file mode 100644
index 6d33fd7..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/replay/ApplicationEventPlayer.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.application.replay;
-
-import org.apache.zest.library.eventsourcing.application.api.ApplicationEvent;
-
-/**
- * Service that can replay ApplicationEvents.
- */
-public interface ApplicationEventPlayer
-{
-    /**
-     * Invoke a domain event on a particular object. The object could
-     * be the original object, but could also be a service that wants
-     * to be invoked to handle the event.
-     *
-     * @param applicationEvent Application event
-     * @param object target
-     * @throws ApplicationEventReplayException if unable to play event
-     */
-    public void playEvent( ApplicationEvent applicationEvent, Object object )
-            throws ApplicationEventReplayException;
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/replay/ApplicationEventPlayerService.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/replay/ApplicationEventPlayerService.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/replay/ApplicationEventPlayerService.java
deleted file mode 100644
index cca1d01..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/replay/ApplicationEventPlayerService.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.application.replay;
-
-import java.lang.reflect.Method;
-import java.text.ParseException;
-import java.time.Instant;
-import java.time.format.DateTimeFormatter;
-import org.apache.zest.api.ZestAPI;
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.service.ServiceComposite;
-import org.apache.zest.api.structure.Module;
-import org.apache.zest.api.unitofwork.UnitOfWork;
-import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
-import org.apache.zest.api.value.ValueComposite;
-import org.apache.zest.library.eventsourcing.application.api.ApplicationEvent;
-import org.json.JSONObject;
-import org.json.JSONTokener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * ApplicationEvent player
- */
-@Mixins(ApplicationEventPlayerService.Mixin.class)
-public interface ApplicationEventPlayerService
-        extends ApplicationEventPlayer, ServiceComposite
-{
-    class Mixin
-            implements ApplicationEventPlayer
-    {
-        final Logger logger = LoggerFactory.getLogger( ApplicationEventPlayer.class );
-        @Structure
-        UnitOfWorkFactory uowf;
-
-        @Structure
-        Module module;
-
-        @Structure
-        ZestAPI api;
-
-        DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern( "EEE MMM dd HH:mm:ss zzz yyyy" );
-
-        @Override
-        public void playEvent( ApplicationEvent applicationEvent, Object object )
-                throws ApplicationEventReplayException
-        {
-            UnitOfWork uow = uowf.currentUnitOfWork();
-            Class handlerType = object.getClass();
-
-            // Get method
-            Method eventMethod = getEventMethod( handlerType, applicationEvent.name().get() );
-
-            if (eventMethod == null)
-            {
-                logger.warn( "Could not find event method " + applicationEvent.name().get() + " in entity of type " + handlerType.getName() );
-                return;
-            }
-
-            // Build parameters
-            try
-            {
-                String jsonParameters = applicationEvent.parameters().get();
-                JSONObject parameters = (JSONObject) new JSONTokener( jsonParameters ).nextValue();
-                Object[] args = new Object[eventMethod.getParameterTypes().length];
-                for (int i = 1; i < eventMethod.getParameterTypes().length; i++)
-                {
-                    Class<?> parameterType = eventMethod.getParameterTypes()[i];
-
-                    String paramName = "param" + i;
-
-                    Object value = parameters.get( paramName );
-
-                    args[i] = getParameterArgument( parameterType, value, uow );
-                }
-
-                args[0] = applicationEvent;
-
-                // Invoke method
-                logger.debug( "Replay:" + applicationEvent + " on:" + object );
-
-                eventMethod.invoke( object, args );
-            } catch (Exception e)
-            {
-                throw new ApplicationEventReplayException( applicationEvent, e );
-            }
-        }
-
-        private Object getParameterArgument( Class<?> parameterType, Object value, UnitOfWork uow ) throws ParseException
-        {
-            if (value.equals( JSONObject.NULL ))
-                return null;
-
-            if (parameterType.equals( String.class ))
-            {
-                return (String) value;
-            } else if (parameterType.equals( Boolean.class ) || parameterType.equals( Boolean.TYPE ))
-            {
-                return (Boolean) value;
-            } else if (parameterType.equals( Long.class ) || parameterType.equals( Long.TYPE ))
-            {
-                return ((Number) value).longValue();
-            } else if (parameterType.equals( Integer.class ) || parameterType.equals( Integer.TYPE ))
-            {
-                return ((Number) value).intValue();
-            } else if (parameterType.equals( Instant.class ))
-            {
-                return dateFormat.parse( (String) value );
-            } else if (ValueComposite.class.isAssignableFrom( parameterType ))
-            {
-                return module.newValueFromSerializedState( parameterType, (String) value );
-            } else if (parameterType.isInterface())
-            {
-                return uow.get( parameterType, (String) value );
-            } else if (parameterType.isEnum())
-            {
-                return Enum.valueOf( (Class<? extends Enum>) parameterType, value.toString() );
-            } else
-            {
-                throw new IllegalArgumentException( "Unknown parameter type:" + parameterType.getName() );
-            }
-        }
-
-        private Method getEventMethod( Class<?> aClass, String eventName )
-        {
-            for (Method method : aClass.getMethods())
-            {
-                if (method.getName().equals( eventName ))
-                {
-                    Class[] parameterTypes = method.getParameterTypes();
-                    if (parameterTypes.length > 0 && parameterTypes[0].equals( ApplicationEvent.class ))
-                        return method;
-                }
-            }
-            return null;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/replay/ApplicationEventReplayException.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/replay/ApplicationEventReplayException.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/replay/ApplicationEventReplayException.java
deleted file mode 100644
index 0eafa14..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/replay/ApplicationEventReplayException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.application.replay;
-
-import org.apache.zest.library.eventsourcing.application.api.ApplicationEvent;
-
-/**
- * An event replay failed.
- */
-public class ApplicationEventReplayException
-        extends RuntimeException
-{
-    private ApplicationEvent event;
-
-    public ApplicationEventReplayException( ApplicationEvent event, Throwable cause )
-    {
-        super( cause );
-        this.event = event;
-    }
-
-    @Override
-    public String getMessage()
-    {
-        return "Could not replay event:" + event + ", caused by:" + getCause();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/replay/package.html
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/replay/package.html b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/replay/package.html
deleted file mode 100644
index d8f137e..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/replay/package.html
+++ /dev/null
@@ -1,24 +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>EventSourcing Application Replay.</h2>
-    </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/AbstractApplicationEventStoreMixin.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/AbstractApplicationEventStoreMixin.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/AbstractApplicationEventStoreMixin.java
deleted file mode 100644
index c25bb5d..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/AbstractApplicationEventStoreMixin.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.application.source;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-import org.apache.zest.api.entity.Identity;
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.injection.scope.This;
-import org.apache.zest.api.structure.Module;
-import org.apache.zest.api.structure.ModuleDescriptor;
-import org.apache.zest.api.type.ValueType;
-import org.apache.zest.api.value.ValueBuilder;
-import org.apache.zest.api.value.ValueBuilderFactory;
-import org.apache.zest.functional.Iterables;
-import org.apache.zest.io.Input;
-import org.apache.zest.io.Inputs;
-import org.apache.zest.io.Output;
-import org.apache.zest.library.eventsourcing.application.api.ApplicationEvent;
-import org.apache.zest.library.eventsourcing.application.api.TransactionApplicationEvents;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static java.util.Collections.synchronizedList;
-
-/**
- * Base implementation for ApplicationEventStores.
- */
-public abstract class AbstractApplicationEventStoreMixin
-        implements ApplicationEventStore, ApplicationEventStream, ApplicationEventStoreActivation
-{
-    @This
-    protected Identity identity;
-
-    protected Logger logger;
-    protected ValueType domainEventType;
-    protected ValueType transactionEventsType;
-
-    protected Lock lock = new ReentrantLock();
-
-    @Structure
-    protected ModuleDescriptor module;
-
-    @Structure
-    private ValueBuilderFactory vbf;
-
-    private ExecutorService transactionNotifier;
-
-    final private List<Output<TransactionApplicationEvents, ? extends Throwable>> listeners = synchronizedList( new ArrayList<Output<TransactionApplicationEvents, ? extends Throwable>>() );
-
-    private long lastTimestamp = 0;
-
-    @Override
-    public void activateApplicationEventStore()
-            throws Exception
-    {
-        logger = LoggerFactory.getLogger( identity.identity().get() );
-
-        domainEventType = module.valueDescriptor( ApplicationEvent.class.getName() ).valueType();
-        transactionEventsType = module.valueDescriptor( TransactionApplicationEvents.class.getName() ).valueType();
-
-        transactionNotifier = Executors.newSingleThreadExecutor();
-    }
-
-    @Override
-    public void passivateApplicationEventStore()
-            throws Exception
-    {
-        transactionNotifier.shutdown();
-        transactionNotifier.awaitTermination( 10000, TimeUnit.MILLISECONDS );
-    }
-
-    // This is how transactions are put into the store
-    @Override
-    public TransactionApplicationEvents storeEvents( Iterable<ApplicationEvent> events ) throws IOException
-    {
-        // Create new TransactionApplicationEvents
-        ValueBuilder<TransactionApplicationEvents> builder = vbf.newValueBuilder( TransactionApplicationEvents.class );
-        Iterables.addAll( builder.prototype().events().get(), events );
-        builder.prototype().timestamp().set( getCurrentTimestamp() );
-
-        final TransactionApplicationEvents transactionDomain = builder.newInstance();
-
-        // Lock store so noone else can interrupt
-        lock();
-        try
-        {
-            storeEvents( transactionDomain );
-        } finally
-        {
-            lock.unlock();
-        }
-
-        // Notify listeners
-        transactionNotifier.submit( new Runnable()
-        {
-            @Override
-            public void run()
-            {
-                synchronized (listeners)
-                {
-                    Input<TransactionApplicationEvents, RuntimeException> input = Inputs.iterable( Collections.singleton( transactionDomain ) );
-                    for (Output<TransactionApplicationEvents, ? extends Throwable> listener : listeners)
-                    {
-                        try
-                        {
-                            input.transferTo( listener );
-                        } catch (Throwable e)
-                        {
-                            logger.warn( "Could not notify event listener", e );
-                        }
-                    }
-                }
-            }
-        } );
-
-        return transactionDomain;
-    }
-
-    // EventStream implementation
-
-
-    @Override
-    public void registerListener( Output<TransactionApplicationEvents, ? extends Throwable> listener )
-    {
-        listeners.add( listener );
-    }
-
-
-    @Override
-    public void unregisterListener( Output<TransactionApplicationEvents, ? extends Throwable> listener )
-    {
-        listeners.remove( listener );
-    }
-
-    abstract protected void rollback()
-            throws IOException;
-
-    abstract protected void commit()
-            throws IOException;
-
-    abstract protected void storeEvents( TransactionApplicationEvents transactionDomain )
-            throws IOException;
-
-    /**
-     * Fix for this bug:
-     * http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6822370
-     */
-    protected void lock()
-    {
-        while (true)
-        {
-            try
-            {
-                lock.tryLock( 1000, TimeUnit.MILLISECONDS );
-                break;
-            } catch (InterruptedException e)
-            {
-                // Try again
-            }
-        }
-    }
-
-    private synchronized long getCurrentTimestamp()
-    {
-        long timestamp = System.currentTimeMillis();
-        if (timestamp <= lastTimestamp)
-            timestamp = lastTimestamp + 1; // Increase by one to ensure uniqueness
-        lastTimestamp = timestamp;
-        return timestamp;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/ApplicationEventSource.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/ApplicationEventSource.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/ApplicationEventSource.java
deleted file mode 100644
index 275dfa0..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/ApplicationEventSource.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.application.source;
-
-import java.io.IOException;
-import org.apache.zest.io.Input;
-import org.apache.zest.library.eventsourcing.application.api.TransactionApplicationEvents;
-
-/**
- * An ApplicationEventSource is a source of application events that can be pulled in chunks. Events are grouped in the transactions in which they were created.
- */
-public interface ApplicationEventSource
-{
-    /**
-     * Get list of event transactions after the given timestamp.
-     * <p>
-     * If they are on the exact same timestamp, they will not be included.
-     * <p>
-     * The method uses the visitor pattern, so a visitor is sent in which is given each transaction, one at a time.
-     *
-     * @param afterTimestamp timestamp of transactions
-     * @param maxTransactions maximum transactions
-     * @return list of event transactions
-     */
-    Input<TransactionApplicationEvents, IOException> transactionsAfter( long afterTimestamp, long maxTransactions );
-
-    /**
-     * Get list of event transactions before the given timestamp.
-     * <p>
-     * If they are on the exact same timestamp, they will not be included.
-     * <p>
-     * The method uses the visitor pattern, so a visitor is sent in which is given each transaction, one at a time.
-     * <p>
-     * The transactions are sent to the visitor with the latest transaction first, i.e. walking backwards in the stream.
-     *
-     * @param beforeTimestamp timestamp of transactions
-     * @param maxTransactions maximum transactions
-     * @return list of event transactions
-     */
-    Input<TransactionApplicationEvents, IOException> transactionsBefore( long beforeTimestamp, long maxTransactions );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/ApplicationEventStore.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/ApplicationEventStore.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/ApplicationEventStore.java
deleted file mode 100644
index 3b74ac3..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/ApplicationEventStore.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.application.source;
-
-import java.io.IOException;
-import org.apache.zest.library.eventsourcing.application.api.ApplicationEvent;
-import org.apache.zest.library.eventsourcing.application.api.TransactionApplicationEvents;
-
-/**
- * Store of application-events.
- */
-public interface ApplicationEventStore
-{
-    TransactionApplicationEvents storeEvents( Iterable<ApplicationEvent> events ) throws IOException;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/ApplicationEventStoreActivation.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/ApplicationEventStoreActivation.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/ApplicationEventStoreActivation.java
deleted file mode 100644
index 7847a78..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/ApplicationEventStoreActivation.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.zest.library.eventsourcing.application.source;
-
-import org.apache.zest.api.activation.ActivatorAdapter;
-import org.apache.zest.api.service.ServiceReference;
-
-public interface ApplicationEventStoreActivation
-{
-
-    void activateApplicationEventStore()
-            throws Exception;
-
-    void passivateApplicationEventStore()
-            throws Exception;
-
-    public static class Activator
-            extends ActivatorAdapter<ServiceReference<ApplicationEventStoreActivation>>
-    {
-
-        @Override
-        public void afterActivation( ServiceReference<ApplicationEventStoreActivation> activated )
-                throws Exception
-        {
-            activated.get().activateApplicationEventStore();
-        }
-
-        @Override
-        public void beforePassivation( ServiceReference<ApplicationEventStoreActivation> passivating )
-                throws Exception
-        {
-            passivating.get().passivateApplicationEventStore();
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/ApplicationEventStream.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/ApplicationEventStream.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/ApplicationEventStream.java
deleted file mode 100644
index 0cd003d..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/ApplicationEventStream.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.application.source;
-
-import org.apache.zest.io.Output;
-import org.apache.zest.library.eventsourcing.application.api.TransactionApplicationEvents;
-
-/**
- * Stream of event transactions. Registering with a stream will
- * allow the subscriber to get callbacks when new transactions
- * are available. The callbacks are done asynchronously.
- */
-public interface ApplicationEventStream
-{
-    void registerListener( Output<TransactionApplicationEvents, ? extends Throwable> listener );
-
-    void unregisterListener( Output<TransactionApplicationEvents, ? extends Throwable> listener );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/helper/ApplicationEventParameters.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/helper/ApplicationEventParameters.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/helper/ApplicationEventParameters.java
deleted file mode 100644
index ad62582..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/helper/ApplicationEventParameters.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.application.source.helper;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.apache.zest.library.eventsourcing.application.api.ApplicationEvent;
-
-/**
- * Utility class to pick out parameters by name or index as strings from a ApplicationEvent
- */
-public class ApplicationEventParameters
-{
-    /**
-     * Get the named parameter from an event.
-     *
-     * @param event event with parameters
-     * @param name  name of parameter
-     * @return the parameter with the given name or null
-     */
-    public static String getParameter( ApplicationEvent event, String name )
-    {
-        String parametersJson = event.parameters().get();
-        try
-        {
-            JSONObject jsonObject = new JSONObject( parametersJson );
-            return jsonObject.get( name ).toString();
-        } catch (JSONException e)
-        {
-            return null;
-        }
-    }
-
-    /**
-     * Get parameter with given index.
-     *
-     * @param event event with parameters
-     * @param idx   index of parameter
-     * @return the parameter with the given index or null
-     */
-    public static String getParameter( ApplicationEvent event, int idx )
-    {
-        try
-        {
-            String parametersJson = event.parameters().get();
-            JSONObject jsonObject = new JSONObject( parametersJson );
-            return jsonObject.get( "param" + idx ).toString();
-        } catch (JSONException e)
-        {
-            return null;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/helper/ApplicationEvents.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/helper/ApplicationEvents.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/helper/ApplicationEvents.java
deleted file mode 100644
index edd5c8f..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/helper/ApplicationEvents.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.application.source.helper;
-
-import java.lang.reflect.Method;
-import java.time.Instant;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.function.Predicate;
-import org.apache.zest.api.util.Methods;
-import org.apache.zest.functional.Iterables;
-import org.apache.zest.io.Output;
-import org.apache.zest.io.Receiver;
-import org.apache.zest.io.Sender;
-import org.apache.zest.library.eventsourcing.application.api.ApplicationEvent;
-import org.apache.zest.library.eventsourcing.application.api.TransactionApplicationEvents;
-import org.apache.zest.library.eventsourcing.application.replay.ApplicationEventPlayer;
-import org.apache.zest.library.eventsourcing.application.replay.ApplicationEventReplayException;
-
-/**
- * Helper methods for working with Iterables of DomainEvents and UnitOfWorkDomainEventsValue.
- */
-public class ApplicationEvents
-{
-    public static Iterable<ApplicationEvent> events( Iterable<TransactionApplicationEvents> transactions )
-    {
-        List<Iterable<ApplicationEvent>> events = new ArrayList<>();
-        for (TransactionApplicationEvents transactionDomain : transactions)
-        {
-            events.add( transactionDomain.events().get() );
-        }
-
-        Iterable<ApplicationEvent>[] iterables = (Iterable<ApplicationEvent>[]) new Iterable[events.size()];
-        return Iterables.flatten( events.toArray( iterables ) );
-    }
-
-    public static Iterable<ApplicationEvent> events( TransactionApplicationEvents... transactionDomains )
-    {
-        List<Iterable<ApplicationEvent>> events = new ArrayList<Iterable<ApplicationEvent>>();
-        for (TransactionApplicationEvents transactionDomain : transactionDomains)
-        {
-            events.add( transactionDomain.events().get() );
-        }
-
-        Iterable<ApplicationEvent>[] iterables = (Iterable<ApplicationEvent>[]) new Iterable[events.size()];
-        return Iterables.flatten( events.<Iterable<ApplicationEvent>>toArray( iterables ) );
-    }
-
-    public static boolean matches( Predicate<ApplicationEvent> specification, Iterable<TransactionApplicationEvents> transactions )
-    {
-        return Iterables.filter( specification, events( transactions ) ).iterator().hasNext();
-    }
-
-    // Common specifications
-
-//    public static Predicate<ApplicationEvent> withNames( final Iterable<String> names )
-//    {
-//        return new Predicate<ApplicationEvent>()
-//        {
-//            @Override
-//            public boolean test( ApplicationEvent event )
-//            {
-//                for (String name : names)
-//                {
-//                    if (event.name().get().equals( name ))
-//                        return true;
-//                }
-//                return false;
-//            }
-//        };
-//    }
-//
-//    public static Predicate<ApplicationEvent> withNames( final String... names )
-//    {
-//        return new Predicate<ApplicationEvent>()
-//        {
-//            @Override
-//            public boolean test( ApplicationEvent event )
-//            {
-//                for (String name : names)
-//                {
-//                    if (event.name().get().equals( name ))
-//                        return true;
-//                }
-//                return false;
-//            }
-//        };
-//    }
-//
-    public static Predicate<ApplicationEvent> withNames( final Class eventClass )
-    {
-        return new WithNamesPredicate(eventClass );
-
-//        ApplicationEvents.withNames( Iterables.map( new Function<Method, String>()
-//        {
-//            @Override
-//            public String apply( Method method )
-//            {
-//                return method.getName();
-//            }
-//        }, Iterables.toList( Methods.METHODS_OF.apply( eventClass ) ) ));
-    }
-
-    public static Predicate<ApplicationEvent> afterDate( final Instant afterDate )
-    {
-        return event -> event.on().get().isAfter( afterDate );
-    }
-
-    public static Predicate<ApplicationEvent> beforeDate( final Instant beforeDate )
-    {
-        return event -> event.on().get().isBefore( beforeDate );
-    }
-
-    public static Predicate<ApplicationEvent> withUsecases( final String... names )
-    {
-        return event -> {
-            for (String name : names)
-            {
-                if (event.usecase().get().equals( name ))
-                    return true;
-            }
-            return false;
-        };
-    }
-
-    public static Predicate<ApplicationEvent> paramIs( final String name, final String value )
-    {
-        return event -> ApplicationEventParameters.getParameter( event, name ).equals( value );
-    }
-
-    public static Output<TransactionApplicationEvents, ApplicationEventReplayException> playEvents( final ApplicationEventPlayer player, final Object eventHandler )
-    {
-        final Predicate<ApplicationEvent> specification = ApplicationEvents.withNames( eventHandler.getClass() );
-
-        return new Output<TransactionApplicationEvents, ApplicationEventReplayException>()
-        {
-           @Override
-           public <SenderThrowableType extends Throwable> void receiveFrom(Sender<? extends TransactionApplicationEvents, SenderThrowableType> sender) throws ApplicationEventReplayException, SenderThrowableType
-           {
-                sender.sendTo( new Receiver<TransactionApplicationEvents, ApplicationEventReplayException>()
-                {
-                    @Override
-                    public void receive( TransactionApplicationEvents item ) throws ApplicationEventReplayException
-                    {
-                        for (ApplicationEvent applicationEvent : events( item ))
-                        {
-                            if (specification.test( applicationEvent ))
-                                player.playEvent( applicationEvent, eventHandler );
-                        }
-                    }
-                } );
-            }
-        };
-    }
-
-    private static class WithNamesPredicate implements Predicate<ApplicationEvent>
-    {
-        private final Class eventClass;
-
-        public WithNamesPredicate( Class eventClass )
-        {
-            this.eventClass = eventClass;
-        }
-
-        @Override
-        public boolean test( ApplicationEvent event )
-        {
-            return Methods.METHODS_OF.apply( eventClass )
-                .map( Method::getName )
-                .anyMatch( name -> event.name().get().equals( name ) );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/helper/ApplicationTransactionTracker.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/helper/ApplicationTransactionTracker.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/helper/ApplicationTransactionTracker.java
deleted file mode 100644
index 112a62a..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/helper/ApplicationTransactionTracker.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.application.source.helper;
-
-import org.apache.zest.api.configuration.Configuration;
-import org.apache.zest.io.Output;
-import org.apache.zest.io.Receiver;
-import org.apache.zest.io.Sender;
-import org.apache.zest.library.eventsourcing.application.api.TransactionApplicationEvents;
-import org.apache.zest.library.eventsourcing.application.source.ApplicationEventSource;
-import org.apache.zest.library.eventsourcing.application.source.ApplicationEventStream;
-import org.apache.zest.library.eventsourcing.domain.source.helper.DomainEventTrackerConfiguration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Helper that enables a service to easily track transactions.
- * <p>
- * Upon startup the tracker will get all the transactions from the store since the last
- * check, and delegate them to the given Output. It will also register itself
- * with the store so that it can get continuous updates.
- * </p>
- * <p>
- * Then, as transactions come in from the store, they will be processed in real-time.
- * If a transaction is successfully handled the configuration of the service, which must
- * extend DomainEventTrackerConfiguration, will update the marker for the last successfully handled transaction.
- * </p>
- */
-public class ApplicationTransactionTracker<ReceiverThrowableType extends Throwable>
-{
-    private Configuration<? extends DomainEventTrackerConfiguration> configuration;
-    private Output<TransactionApplicationEvents, ReceiverThrowableType> output;
-    private ApplicationEventStream stream;
-    private ApplicationEventSource source;
-    private boolean started = false;
-    private boolean upToSpeed = false;
-    private Logger logger;
-    private Output<TransactionApplicationEvents, ReceiverThrowableType> trackerOutput;
-
-    public ApplicationTransactionTracker( ApplicationEventStream stream, ApplicationEventSource source,
-                                          Configuration<? extends DomainEventTrackerConfiguration> configuration,
-                                          Output<TransactionApplicationEvents, ReceiverThrowableType> output )
-    {
-        this.stream = stream;
-        this.configuration = configuration;
-        this.source = source;
-        this.output = output;
-
-        logger = LoggerFactory.getLogger( output.getClass() );
-    }
-
-    public void start()
-    {
-        if (!started)
-        {
-            started = true;
-
-            // Get events since last check
-            upToSpeed = true; // Pretend that we are up to speed from now on
-            trackerOutput = output();
-            try
-            {
-                source.transactionsAfter( configuration.get().lastOffset().get(), Long.MAX_VALUE ).transferTo( trackerOutput );
-            } catch (Throwable receiverThrowableType)
-            {
-                upToSpeed = false;
-            }
-
-            stream.registerListener( trackerOutput );
-        }
-    }
-
-    public void stop()
-    {
-        if (started)
-        {
-            started = false;
-            stream.unregisterListener( trackerOutput );
-            upToSpeed = false;
-        }
-    }
-
-    private Output<TransactionApplicationEvents, ReceiverThrowableType> output()
-    {
-        return new Output<TransactionApplicationEvents, ReceiverThrowableType>()
-        {
-           @Override
-           public <SenderThrowableType extends Throwable> void receiveFrom(final Sender<? extends TransactionApplicationEvents, SenderThrowableType> sender) throws ReceiverThrowableType, SenderThrowableType
-           {
-                if (!upToSpeed)
-                {
-                    // The tracker has not handled successfully all transactions before,
-                    // so it needs to get the backlog first
-
-                    upToSpeed = true; // Pretend that we are up to speed from now on
-
-                    // Get all transactions from last timestamp, including the one in this call
-                    try
-                    {
-                        source.transactionsAfter( configuration.get().lastOffset().get(), Long.MAX_VALUE ).transferTo( trackerOutput );
-                    } catch (Throwable e)
-                    {
-                        upToSpeed = false;
-                        throw (SenderThrowableType) e;
-                    }
-                }
-
-                try
-                {
-                    output.receiveFrom( new Sender<TransactionApplicationEvents, SenderThrowableType>()
-                    {
-                       @Override
-                       public <ReceiverThrowableType extends Throwable> void sendTo(final Receiver<? super TransactionApplicationEvents, ReceiverThrowableType> receiver) throws ReceiverThrowableType, SenderThrowableType
-                       {
-                            sender.sendTo( new Receiver<TransactionApplicationEvents, ReceiverThrowableType>()
-                            {
-                                @Override
-                                public void receive( TransactionApplicationEvents item ) throws ReceiverThrowableType
-                                {
-                                    receiver.receive( item );
-
-                                    // Events in this transactionDomain were handled successfully so store new marker
-                                    configuration.get().lastOffset().set( item.timestamp().get() );
-                                    configuration.save();
-                                }
-                            } );
-                        }
-                    } );
-                } catch (Throwable receiverThrowableType)
-                {
-                    upToSpeed = false;
-                    throw (ReceiverThrowableType) receiverThrowableType;
-                }
-            }
-        };
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/helper/package.html
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/helper/package.html b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/helper/package.html
deleted file mode 100644
index 931b401..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/helper/package.html
+++ /dev/null
@@ -1,24 +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>EventSourcing Application Source Helpers.</h2>
-    </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/memory/MemoryApplicationEventStoreService.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/memory/MemoryApplicationEventStoreService.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/memory/MemoryApplicationEventStoreService.java
deleted file mode 100644
index cde4af5..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/memory/MemoryApplicationEventStoreService.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.zest.library.eventsourcing.application.source.memory;
-
-import org.apache.zest.api.activation.Activators;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.service.ServiceComposite;
-import org.apache.zest.io.Input;
-import org.apache.zest.io.Output;
-import org.apache.zest.io.Receiver;
-import org.apache.zest.io.Sender;
-import org.apache.zest.library.eventsourcing.application.api.TransactionApplicationEvents;
-import org.apache.zest.library.eventsourcing.application.source.*;
-
-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
-                            {
-                                Iterator<TransactionApplicationEvents> iterator = store.descendingIterator();
-
-                                long count = 0;
-
-                                while( iterator.hasNext() && count < maxTransactions )
-                                {
-                                    TransactionApplicationEvents next = iterator.next();
-                                    if( next.timestamp().get() < beforeTimestamp )
-                                    {
-                                        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-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/memory/package.html
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/memory/package.html b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/memory/package.html
deleted file mode 100644
index 0b74afe..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/memory/package.html
+++ /dev/null
@@ -1,24 +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>EventSourcing in-memory EventStore.</h2>
-    </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/package.html
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/package.html b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/package.html
deleted file mode 100644
index 6ac248d..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/application/source/package.html
+++ /dev/null
@@ -1,24 +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>EventSourcing Application Source.</h2>
-    </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/bootstrap/EventsourcingAssembler.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/bootstrap/EventsourcingAssembler.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/bootstrap/EventsourcingAssembler.java
deleted file mode 100644
index 7976d4b..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/bootstrap/EventsourcingAssembler.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.zest.library.eventsourcing.bootstrap;
-
-import org.apache.zest.bootstrap.Assemblers;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ImportedServiceDeclaration;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.library.eventsourcing.application.api.ApplicationEvent;
-import org.apache.zest.library.eventsourcing.application.api.TransactionApplicationEvents;
-import org.apache.zest.library.eventsourcing.application.factory.ApplicationEventFactoryService;
-import org.apache.zest.library.eventsourcing.domain.api.DomainEventValue;
-import org.apache.zest.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
-import org.apache.zest.library.eventsourcing.domain.factory.CurrentUserUoWPrincipal;
-import org.apache.zest.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-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/bootstrap/package.html
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/bootstrap/package.html b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/bootstrap/package.html
deleted file mode 100644
index 89a0dce..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/bootstrap/package.html
+++ /dev/null
@@ -1,24 +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>EventSourcing Assembly.</h2>
-    </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/api/DomainEvent.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/api/DomainEvent.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/api/DomainEvent.java
deleted file mode 100644
index d6813f8..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/api/DomainEvent.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.api;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * Annotate methods that should trigger domain events with this annotation. Example:
- * <pre>
- * &#64;DomainEvent
- * void changedDescription(String newDescription);
- * </pre>
- * Event methods may only change state. They may not fail or thrown exceptions. The name of the
- * method should be in past tense, as in something HAS already occurred, and the method is merely
- * reacting to it.
- */
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-public @interface DomainEvent
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/api/DomainEventValue.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/api/DomainEventValue.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/api/DomainEventValue.java
deleted file mode 100644
index 9f52ae1..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/api/DomainEventValue.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.api;
-
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.value.ValueComposite;
-
-/**
- * Representation of a domain-event.
- * <p>An event is triggered by calling a method that is of the form:
- * </p>
- * <pre><code>
- * &#64;DomainEvent
- * void someName(SomeParam param, AnotherParam param2);
- * </code></pre>
- *
- */
-public interface DomainEventValue
-        extends ValueComposite
-{
-    // Type of the entity being invoked
-    Property<String> entityType();
-
-    // Id of the entity that generated the event
-    Property<String> entityId();
-
-    // Name of method/event
-    Property<String> name();
-
-    // Method parameters as JSON
-    Property<String> parameters();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/api/DomainEvents.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/api/DomainEvents.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/api/DomainEvents.java
deleted file mode 100644
index 14af4c6..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/api/DomainEvents.java
+++ /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.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.api;
-
-/**
- * This gives access to the current domain event. This is only usable within methods
- * marked with &#64;DomainEvent annotation.
- */
-public class DomainEvents
-{
-    private static ThreadLocal<DomainEventValue> event = new ThreadLocal<DomainEventValue>();
-
-    public static DomainEventValue currentEvent()
-    {
-        return event.get();
-    }
-
-    /**
-     * This is called by the EventSourcing library, either during creation or replay.
-     * Don't use in application code.
-     *
-     * @param currentEvent new current event
-     */
-    public static void setCurrentEvent(DomainEventValue currentEvent)
-    {
-        event.set( currentEvent );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/api/UnitOfWorkDomainEventsValue.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/api/UnitOfWorkDomainEventsValue.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/api/UnitOfWorkDomainEventsValue.java
deleted file mode 100644
index 4cec265..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/api/UnitOfWorkDomainEventsValue.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.api;
-
-import java.time.Instant;
-import java.util.List;
-import org.apache.zest.api.common.Optional;
-import org.apache.zest.api.common.UseDefaults;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.value.ValueComposite;
-
-/**
- * List of events for a single UnitOfWork. Events must always be consumed
- * in UoW units, in order to ensure that the result is consistent
- * with what happened in that UoW.
- *
- * Context that is common to all events in the UoW is stored here rather than
- * in the individual event.
- */
-public interface UnitOfWorkDomainEventsValue
-        extends ValueComposite
-{
-    // Version of the application that created these events
-    Property<String> version();
-
-    // Usecase name
-    Property<String> usecase();
-
-    // When the event occurred
-    Property<Instant> timestamp();
-
-    // Who performed the event. Taken from CurrentUser service.
-    @Optional
-    Property<String> user();
-
-    // List of events for this transaction
-    @UseDefaults
-    Property<List<DomainEventValue>> events();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/api/package.html
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/api/package.html b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/api/package.html
deleted file mode 100644
index f54ea77..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/api/package.html
+++ /dev/null
@@ -1,24 +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>EventSourcing Domain API.</h2>
-    </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/CurrentUserSubject.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/CurrentUserSubject.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/CurrentUserSubject.java
deleted file mode 100644
index a35dbf9..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/CurrentUserSubject.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.factory;
-
-import java.security.AccessController;
-import javax.security.auth.Subject;
-import org.apache.zest.library.eventsourcing.domain.spi.CurrentUser;
-
-/**
- * Uses thread-associated Subject to get the current user name. Default to "unknown".
- */
-public class CurrentUserSubject
-    implements CurrentUser
-{
-    @Override
-    public String getCurrentUser()
-    {
-        try
-        {
-            return Subject.getSubject( AccessController.getContext() ).getPrincipals().iterator().next().getName();
-        } catch (Exception e)
-        {
-            return "unknown";
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d9569cd6/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/CurrentUserUoWPrincipal.java
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/CurrentUserUoWPrincipal.java b/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/CurrentUserUoWPrincipal.java
deleted file mode 100644
index a21a626..0000000
--- a/libraries/eventsourcing/src/main/java/org/apache/zest/library/eventsourcing/domain/factory/CurrentUserUoWPrincipal.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.apache.zest.library.eventsourcing.domain.factory;
-
-import java.security.Principal;
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
-import org.apache.zest.library.eventsourcing.domain.spi.CurrentUser;
-
-/**
- * CurrentUser implementation that gets a Principal object from the meta-info of the current UnitOfWork. Default to "unknown".
- */
-public class CurrentUserUoWPrincipal
-    implements CurrentUser
-{
-    @Structure
-    private UnitOfWorkFactory uowf;
-
-    @Override
-    public String getCurrentUser()
-    {
-        try
-        {
-            return uowf.currentUnitOfWork().metaInfo( Principal.class ).getName();
-        } catch (Exception e)
-        {
-            return "unknown";
-        }
-    }
-}


[5/7] zest-java git commit: ZEST-183 : Removing library-eventsourcing.

Posted by ni...@apache.org.
ZEST-183 : Removing library-eventsourcing.


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

Branch: refs/heads/develop
Commit: f37a0a02996d9675328ff85c2d5e5eef23b35277
Parents: d9569cd
Author: Niclas Hedhman <ni...@hedhman.org>
Authored: Sat Oct 22 14:25:17 2016 +0800
Committer: Niclas Hedhman <ni...@hedhman.org>
Committed: Sat Oct 22 14:25:17 2016 +0800

----------------------------------------------------------------------
 settings.gradle | 3 ---
 1 file changed, 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/f37a0a02/settings.gradle
----------------------------------------------------------------------
diff --git a/settings.gradle b/settings.gradle
index ddc9698..564e461 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -28,9 +28,6 @@ include 'core:functional',
         'libraries:alarm',
         'libraries:circuitbreaker',
         'libraries:constraints',
-        'libraries:eventsourcing',
-        'libraries:eventsourcing-jdbm',
-        'libraries:eventsourcing-rest',
         'libraries:fileconfig',
         'libraries:http',
         'libraries:invocation-cache',