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 <niclas@hedhman.org>
Authored: Sat Oct 22 14:14:42 2016 +0800
Committer: Niclas Hedhman <niclas@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™ Event Sourcing Library for providing a JDBM based event store."
-
-jar { manifest { name = "Apache Zest™ 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™ Event Sourcing Library for Restful applications."
-
-jar { manifest { name = "Apache Zest™ 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™ Event Sourcing Library."
-
-jar { manifest { name = "Apache Zest™ 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;
- }
-}
|