http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/thread/src/main/java/org/qi4j/library/thread/assembly/NewThreadServiceAssembler.java ---------------------------------------------------------------------- diff --git a/libraries/thread/src/main/java/org/qi4j/library/thread/assembly/NewThreadServiceAssembler.java b/libraries/thread/src/main/java/org/qi4j/library/thread/assembly/NewThreadServiceAssembler.java deleted file mode 100644 index e969a86..0000000 --- a/libraries/thread/src/main/java/org/qi4j/library/thread/assembly/NewThreadServiceAssembler.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2008 Niclas Hedhman. All rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.qi4j.library.thread.assembly; - -import org.qi4j.bootstrap.Assembler; -import org.qi4j.bootstrap.AssemblyException; -import org.qi4j.bootstrap.ModuleAssembly; -import org.qi4j.library.thread.NewThreadServiceComposite; -import org.qi4j.library.thread.ThreadGroupConfigurationEntity; -import org.qi4j.library.thread.ThreadGroupServiceComposite; -import org.qi4j.library.thread.ThreadServiceConfigurationEntity; -import org.qi4j.library.uid.sequence.assembly.TransientSequencingAssembler; - -public class NewThreadServiceAssembler - implements Assembler -{ - public void assemble( ModuleAssembly module ) throws AssemblyException - { - module.services( NewThreadServiceComposite.class ); - module.services( ThreadGroupServiceComposite.class ); - module.entities( ThreadServiceConfigurationEntity.class ); - module.entities( ThreadGroupConfigurationEntity.class ); - new TransientSequencingAssembler().assemble( module ); - } -}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/thread/src/main/java/org/qi4j/library/thread/assembly/PooledThreadServiceAssembler.java ---------------------------------------------------------------------- diff --git a/libraries/thread/src/main/java/org/qi4j/library/thread/assembly/PooledThreadServiceAssembler.java b/libraries/thread/src/main/java/org/qi4j/library/thread/assembly/PooledThreadServiceAssembler.java deleted file mode 100644 index 07131eb..0000000 --- a/libraries/thread/src/main/java/org/qi4j/library/thread/assembly/PooledThreadServiceAssembler.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2008 Niclas Hedhman. All rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.qi4j.library.thread.assembly; - -import org.qi4j.bootstrap.Assembler; -import org.qi4j.bootstrap.AssemblyException; -import org.qi4j.bootstrap.ModuleAssembly; -import org.qi4j.library.thread.PooledThreadServiceComposite; -import org.qi4j.library.thread.ThreadGroupConfigurationEntity; -import org.qi4j.library.thread.ThreadGroupServiceComposite; -import org.qi4j.library.thread.ThreadServiceConfigurationEntity; -import org.qi4j.library.uid.sequence.assembly.TransientSequencingAssembler; - -public class PooledThreadServiceAssembler - implements Assembler -{ - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.services( PooledThreadServiceComposite.class ); - module.services( ThreadGroupServiceComposite.class ); - module.entities( ThreadServiceConfigurationEntity.class ); - module.entities( ThreadGroupConfigurationEntity.class ); - new TransientSequencingAssembler().assemble( module ); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/thread/src/main/resources/org/qi4j/library/thread/NewThreadServiceComposite.properties ---------------------------------------------------------------------- diff --git a/libraries/thread/src/main/resources/org/qi4j/library/thread/NewThreadServiceComposite.properties b/libraries/thread/src/main/resources/org/qi4j/library/thread/NewThreadServiceComposite.properties deleted file mode 100644 index e6da438..0000000 --- a/libraries/thread/src/main/resources/org/qi4j/library/thread/NewThreadServiceComposite.properties +++ /dev/null @@ -1,10 +0,0 @@ -#Default Values for the NewThreadService in the Qi4j Thread Library - -threadGroupName=org.qi4j - -threadBaseName=org.qi4j.thread - -maxThreads=50 - -# Following is not used. -preferedNumberOfThreads=2 http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/thread/src/main/resources/org/qi4j/library/thread/PooledThreadServiceComposite.properties ---------------------------------------------------------------------- diff --git a/libraries/thread/src/main/resources/org/qi4j/library/thread/PooledThreadServiceComposite.properties b/libraries/thread/src/main/resources/org/qi4j/library/thread/PooledThreadServiceComposite.properties deleted file mode 100644 index 056ad3a..0000000 --- a/libraries/thread/src/main/resources/org/qi4j/library/thread/PooledThreadServiceComposite.properties +++ /dev/null @@ -1,9 +0,0 @@ -#Default Values for the PooledThreadService in the Qi4j Thread Library - -threadGroupName=org.qi4j - -threadBaseName=org.qi4j.thread.pooled - -maxThreads=20 - -preferedNumberOfThreads=2 http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/thread/src/main/resources/org/qi4j/library/thread/ThreadGroupServiceComposite.properties ---------------------------------------------------------------------- diff --git a/libraries/thread/src/main/resources/org/qi4j/library/thread/ThreadGroupServiceComposite.properties b/libraries/thread/src/main/resources/org/qi4j/library/thread/ThreadGroupServiceComposite.properties deleted file mode 100644 index 22fb455..0000000 --- a/libraries/thread/src/main/resources/org/qi4j/library/thread/ThreadGroupServiceComposite.properties +++ /dev/null @@ -1,2 +0,0 @@ - -rootGroupName=org.qi4j \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/thread/src/test/java/org/qi4j/library/thread/NewThreadServiceTest.java ---------------------------------------------------------------------- diff --git a/libraries/thread/src/test/java/org/qi4j/library/thread/NewThreadServiceTest.java b/libraries/thread/src/test/java/org/qi4j/library/thread/NewThreadServiceTest.java deleted file mode 100644 index 52bd44b..0000000 --- a/libraries/thread/src/test/java/org/qi4j/library/thread/NewThreadServiceTest.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2008 Niclas Hedhman. All rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.qi4j.library.thread; - -import static org.junit.Assert.assertFalse; - -import org.junit.Test; -import org.qi4j.api.composite.TransientComposite; -import org.qi4j.api.injection.scope.Service; -import org.qi4j.api.mixin.Mixins; -import org.qi4j.bootstrap.AssemblyException; -import org.qi4j.bootstrap.ModuleAssembly; -import org.qi4j.library.thread.assembly.NewThreadServiceAssembler; -import org.qi4j.test.AbstractQi4jTest; -import org.qi4j.test.EntityTestAssembler; - -public class NewThreadServiceTest extends AbstractQi4jTest -{ - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.transients( UnderTestComposite.class ); - new EntityTestAssembler().assemble( module ); - new NewThreadServiceAssembler().assemble( module ); - } - - @Test - public void whenUsingNewThreadProviderThenNewThreadsAreHandedBack() - throws Exception - { - TestRunnable r1 = new TestRunnable(); - TestRunnable r2 = new TestRunnable(); - UnderTest underTest = module.newTransient( UnderTest.class ); - Thread t1 = underTest.fetchThread( r1 ); - Thread t2 = underTest.fetchThread( r2 ); - assertFalse( t1.equals( t2 ) ); - t1.start(); - t2.start(); - Thread.sleep( 20 ); - // Clean up - r1.run = false; - r2.run = false; - t1.interrupt(); - t2.interrupt(); - } - - public interface UnderTest - { - Thread fetchThread( Runnable runnable ); - } - - @Mixins( UnderTestMixin.class ) - public interface UnderTestComposite extends UnderTest, TransientComposite - { - } - - public static class UnderTestMixin - implements UnderTest - { - @Service private ThreadService service; - - public Thread fetchThread( Runnable runnable ) - { - return service.newThread( runnable ); - } - } - - public static class TestRunnable - implements Runnable - { - private Thread thread; - private boolean run; - - public Thread getThread() - { - return thread; - } - - public void stop() - { - run = false; - } - - public void run() - { - run = true; - thread = Thread.currentThread(); - while( run ) - { - try - { - Thread.sleep( 10 ); - } - catch( InterruptedException e ) - { - } - } - } - } -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/thread/src/test/java/org/qi4j/library/thread/PooledThreadServiceTest.java ---------------------------------------------------------------------- diff --git a/libraries/thread/src/test/java/org/qi4j/library/thread/PooledThreadServiceTest.java b/libraries/thread/src/test/java/org/qi4j/library/thread/PooledThreadServiceTest.java deleted file mode 100644 index 5637671..0000000 --- a/libraries/thread/src/test/java/org/qi4j/library/thread/PooledThreadServiceTest.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright 2008 Niclas Hedhman. All rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.qi4j.library.thread; - -import org.junit.Assert; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; - -import org.junit.Test; -import org.qi4j.api.composite.TransientComposite; -import org.qi4j.api.injection.scope.Service; -import org.qi4j.api.mixin.Mixins; -import org.qi4j.bootstrap.AssemblyException; -import org.qi4j.bootstrap.ModuleAssembly; -import org.qi4j.library.thread.assembly.PooledThreadServiceAssembler; -import org.qi4j.test.AbstractQi4jTest; - -import java.util.ArrayList; -import org.qi4j.test.EntityTestAssembler; - -public class PooledThreadServiceTest extends AbstractQi4jTest -{ - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.transients( UnderTestComposite.class ); - new EntityTestAssembler().assemble( module ); - new PooledThreadServiceAssembler().assemble( module ); - } - - @Test - public void whenUsingPooledThreadProviderThenSameThreadsAreHandedBack() - throws Exception - { - UnderTest underTest = module.newTransient( UnderTest.class ); - ArrayList<Thread> threads = new ArrayList<Thread>(); - int poolsize = underTest.maxThreads(); - TestRunnable r1 = new TestRunnable(); - threads.add( underTest.fetchThread( r1 ) ); - for( int i = 1; i < poolsize; i++ ) - { - TestRunnable r2 = new TestRunnable(); - threads.add( underTest.fetchThread( r2 ) ); - } - try - { - TestRunnable r2 = new TestRunnable(); - underTest.fetchThread( r2 ); - Assert.fail( "Should have thrown a MaxixmumThreadsException." ); - } - catch( MaximumThreadsException e ) - { // ignore - } - for( int i = 0; i < poolsize; i++ ) - { - Thread t1 = threads.get( i ); - - for( int j = 0; j < poolsize; j++ ) - { - Thread t2 = threads.get( j ); - assertFalse( ( i != j ) && t1.equals( t2 ) ); - } - t1.start(); - } - Thread.sleep( 100 ); - Thread t1 = threads.get( 0 ); - r1.stop(); - Thread.sleep( 100 ); - TestRunnable r3 = new TestRunnable(); - Thread t3 = underTest.fetchThread( r3 ); - assertEquals( t1, t3 ); - } - - public interface UnderTest - { - Thread fetchThread( Runnable runnable ); - - int maxThreads(); - } - - @Mixins( UnderTestMixin.class ) - public interface UnderTestComposite extends UnderTest, TransientComposite - { - } - - public static class UnderTestMixin - implements UnderTest - { - @Service private ThreadService service; - - public Thread fetchThread( Runnable runnable ) - { - return service.newThread( runnable ); - } - - public int maxThreads() - { - return service.configuration().maxThreads().get(); - } - } - - public static class TestRunnable - implements Runnable - { - private Thread thread; - private boolean run; - - public Thread getThread() - { - return thread; - } - - public void stop() - { - run = false; - } - - public void run() - { - run = true; - thread = Thread.currentThread(); - int count = 0; - while( run ) - { - try - { - Thread.sleep( 10 ); - } - catch( InterruptedException e ) - { - } - count++; - } - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/unitofwork/dev-status.xml ---------------------------------------------------------------------- diff --git a/libraries/unitofwork/dev-status.xml b/libraries/unitofwork/dev-status.xml deleted file mode 100644 index dc92d29..0000000 --- a/libraries/unitofwork/dev-status.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<module xmlns="http://www.qi4j.org/schemas/2008/dev-status/1"> - <status> - <codebase>early</codebase> - <!--none,early,beta,stable,mature--> - <documentation>brief</documentation> - <!-- none, brief, good, complete --> - <unittests>some</unittests> - <!-- none, some, good, complete --> - </status> - <licenses> - <license>ALv2</license> - </licenses> -</module> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/unitofwork/pom.xml ---------------------------------------------------------------------- diff --git a/libraries/unitofwork/pom.xml b/libraries/unitofwork/pom.xml deleted file mode 100644 index 9749a0b..0000000 --- a/libraries/unitofwork/pom.xml +++ /dev/null @@ -1,23 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.qi4j.sandbox</groupId> - <artifactId>qi4j-sandbox-libraries</artifactId> - <version>0-SNAPSHOT</version> - </parent> - <groupId>org.qi4j.library</groupId> - <artifactId>org.qi4j.library.unitofwork</artifactId> - <name>Qi4j Library - UnitOfWork</name> - - <dependencies> - <dependency> - <groupId>org.qi4j.core</groupId> - <artifactId>org.qi4j.core.api</artifactId> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </dependency> - </dependencies> -</project> http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/unitofwork/src/main/java/org/qi4j/library/unitofwork/UnitOfWorkConcern.java ---------------------------------------------------------------------- diff --git a/libraries/unitofwork/src/main/java/org/qi4j/library/unitofwork/UnitOfWorkConcern.java b/libraries/unitofwork/src/main/java/org/qi4j/library/unitofwork/UnitOfWorkConcern.java deleted file mode 100644 index 771644b..0000000 --- a/libraries/unitofwork/src/main/java/org/qi4j/library/unitofwork/UnitOfWorkConcern.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright 2008 Edward Yakop. - * Copyright 2009 Niclas Hedhman. - * Copyright 2009 Michael Hunger. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.qi4j.library.unitofwork; - -import java.lang.reflect.Method; -import org.qi4j.api.common.AppliesTo; -import org.qi4j.api.concern.GenericConcern; -import org.qi4j.api.injection.scope.Invocation; -import org.qi4j.api.injection.scope.Structure; -import org.qi4j.api.unitofwork.UnitOfWork; -import org.qi4j.api.unitofwork.UnitOfWorkCompletionException; -import org.qi4j.api.unitofwork.UnitOfWorkFactory; - -/** - * {@code UnitOfWorkConcern} manages the unit of work complete and discard policy. - * - * @see org.qi4j.api.unitofwork.UnitOfWorkPropagation - * @see org.qi4j.api.unitofwork.UnitOfWorkDiscardOn - */ -@AppliesTo( UnitOfWorkPropagation.class ) -public class UnitOfWorkConcern - extends GenericConcern -{ - @Structure - private UnitOfWorkFactory uowf; - @Invocation - private UnitOfWorkPropagation propagation; - - /** - * Handles method with {@code UnitOfWorkPropagation} annotation. - * - * @param proxy The object. - * @param method The invoked method. - * @param args The method arguments. - * - * @return The returned value of method invocation. - * - * @throws Throwable Thrown if the method invocation throw exception. - */ - public Object invoke( Object proxy, Method method, Object[] args ) - throws Throwable - { - UnitOfWorkPropagation.Propagation propagationPolicy = propagation.value(); - if( propagationPolicy == UnitOfWorkPropagation.Propagation.REQUIRED ) - { - return requiredStrategy( proxy, method, args ); - } - else if( propagationPolicy == UnitOfWorkPropagation.Propagation.MANDATORY ) - { - return mandatoryStrategy( proxy, method, args ); - } - else if( propagationPolicy == UnitOfWorkPropagation.Propagation.REQUIRES_NEW ) - { - return requiresNewRequires( proxy, method, args ); - } - throw new UnitOfWorkPropagationException( "'null' is not allowed as propagation strategy." ); - } - - /** - * Discard unit of work if the discard policy match. - * - * @param aMethod The invoked method. This argument must not be {@code null}. - * @param aUnitOfWork The current unit of work. This argument must not be {@code null}. - * @param exceptionThrown The exception thrown. This argument must not be {@code null}. - * - * @throws org.qi4j.api.unitofwork.UnitOfWorkCompletionException - * If the complete() method fails. - */ - private void discardIfRequired( Method aMethod, UnitOfWork aUnitOfWork, Throwable exceptionThrown ) - throws UnitOfWorkCompletionException - { - UnitOfWorkDiscardOn discardPolicy = aMethod.getAnnotation( UnitOfWorkDiscardOn.class ); - UnitOfWorkNoDiscardOn noDiscardPolicy = aMethod.getAnnotation( UnitOfWorkNoDiscardOn.class ); - if( null == discardPolicy && noDiscardPolicy == null ) - { - aUnitOfWork.discard(); - return; - } - Class<?>[] discardClasses; - if( discardPolicy == null ) - { - discardClasses = new Class[]{ Throwable.class }; - } - else - { - discardClasses = discardPolicy.value(); - } - Class<?>[] noDiscardClasses; - if( noDiscardPolicy == null ) - { - noDiscardClasses = new Class[0]; - } - else - { - noDiscardClasses = noDiscardPolicy.value(); - } - - Class<? extends Throwable> thrownClass = exceptionThrown.getClass(); - - next: - for( Class<?> discardClass : discardClasses ) - { - if( discardClass.isAssignableFrom( thrownClass ) ) - { - for( Class<?> noDiscardClass : noDiscardClasses ) - { - if( noDiscardClass.isAssignableFrom( thrownClass ) ) - { - continue next; - } - } - aUnitOfWork.discard(); - return; - } - } - aUnitOfWork.complete(); - } - - private UnitOfWork createNewUnitOfWork() - { - return uowf.newUnitOfWork(); - } - - private Object requiresNewRequires( Object proxy, Method method, Object[] args ) - throws Throwable - { - UnitOfWork currentUnitOfWork = createNewUnitOfWork(); - try - { - Object result = next.invoke( proxy, method, args ); - currentUnitOfWork.complete(); - return result; - } - catch( Throwable throwable ) - { - discardIfRequired( method, currentUnitOfWork, throwable ); - throw throwable; - } - } - - private Object mandatoryStrategy( Object proxy, Method method, Object[] args ) - throws Throwable - { - UnitOfWork currentUnitOfWork = uowf.currentUnitOfWork(); - if( currentUnitOfWork == null ) - { - throw new UnitOfWorkPropagationException( "[UnitOfWork] was required but there is no available unit of work." ); - } - return next.invoke( proxy, method, args ); - } - - private Object requiredStrategy( Object proxy, Method method, Object[] args ) - throws Throwable - { - UnitOfWork currentUnitOfWork = uowf.currentUnitOfWork(); - boolean created = false; - if( currentUnitOfWork == null ) - { - currentUnitOfWork = createNewUnitOfWork(); - created = true; - } - - try - { - Object result = next.invoke( proxy, method, args ); - if( created ) - { - currentUnitOfWork.complete(); - } - return result; - } - catch( Throwable throwable ) - { - // Discard only if this concern create a unit of work - if( created ) - { - discardIfRequired( method, currentUnitOfWork, throwable ); - } - throw throwable; - } - } -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/unitofwork/src/main/java/org/qi4j/library/unitofwork/UnitOfWorkDiscardOn.java ---------------------------------------------------------------------- diff --git a/libraries/unitofwork/src/main/java/org/qi4j/library/unitofwork/UnitOfWorkDiscardOn.java b/libraries/unitofwork/src/main/java/org/qi4j/library/unitofwork/UnitOfWorkDiscardOn.java deleted file mode 100644 index 6d759bf..0000000 --- a/libraries/unitofwork/src/main/java/org/qi4j/library/unitofwork/UnitOfWorkDiscardOn.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2008, Edward Yakop. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -package org.qi4j.library.unitofwork; - -/** - * Annotation to denote the unit of work discard policy. - * By default, discard is applied on any method that has {@link UnitOfWorkPropagation} and any exception is thrown. - * <p/> - * Apply {@code UnitOfWorkDiscardOn} to override the default settings. - * - * <p/> - * Usage example: - * <pre> - * <code> - * - * @Concerns( UnitOfWorkConcern.class ) - * public class MyBusinessServiceMixin implements BusinessService - * { - * @Structure UnitOfWorkFactory uowf; - * - * @UnitOfWorkDiscardOn( MyBusinessException.class ) - * public void myBusinessMethod() - * { - * // Must invoke current unit of work. - * UnitOfWork uow = uowf.currentUnitOfWork(); - * - * // Perform business logic - * } - * } - * </code> - * </pre> - * - * <p/> - * The unit of work will be discarded iff {@code MyBusinessException} exceptions or its subclass is thrown from within - * {@code myBusinessMethod} method. - * - * @author [email protected] - * @since 0.2.0 - */ -public @interface UnitOfWorkDiscardOn -{ - Class<? extends Throwable>[] value() default { Throwable.class }; -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/unitofwork/src/main/java/org/qi4j/library/unitofwork/UnitOfWorkNoDiscardOn.java ---------------------------------------------------------------------- diff --git a/libraries/unitofwork/src/main/java/org/qi4j/library/unitofwork/UnitOfWorkNoDiscardOn.java b/libraries/unitofwork/src/main/java/org/qi4j/library/unitofwork/UnitOfWorkNoDiscardOn.java deleted file mode 100644 index 2710f65..0000000 --- a/libraries/unitofwork/src/main/java/org/qi4j/library/unitofwork/UnitOfWorkNoDiscardOn.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2009 Niclas Hedhman. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.qi4j.library.unitofwork; - -/** - * Annotation to denote the unit of work discard policy. - * By default, discard is applied on any method that has {@link UnitOfWorkPropagation} and any exception is thrown. - * <p/> - * Apply {@code UnitOfWorkDiscardOn} to override the default settings. - * - * <p/> - * Usage example: - * <pre> - * <code> - * - * @Concerns( UnitOfWorkConcern.class ) - * public class MyBusinessServiceMixin implements BusinessService - * { - * @Structure UnitOfWorkFactory uowf; - * - * @UnitOfWorkPropagation - * @UnitOfWorkNoDiscardOn( MyBusinessException.class ) - * public void myBusinessMethod() - * { - * // Must invoke current unit of work. - * UnitOfWork uow = uowf.currentUnitOfWork(); - * - * // Perform business logic - * } - * } - * </code> - * </pre> - * - * <p/> - * The unit of work will be discarded iff {@code MyBusinessException} exceptions or its subclass is NOT thrown from - * within {@code myBusinessMethod} method. - * - * @author [email protected] - * @since 0.2.0 - */ -public @interface UnitOfWorkNoDiscardOn -{ - Class<? extends Throwable>[] value(); -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/unitofwork/src/main/java/org/qi4j/library/unitofwork/UnitOfWorkPropagation.java ---------------------------------------------------------------------- diff --git a/libraries/unitofwork/src/main/java/org/qi4j/library/unitofwork/UnitOfWorkPropagation.java b/libraries/unitofwork/src/main/java/org/qi4j/library/unitofwork/UnitOfWorkPropagation.java deleted file mode 100644 index 332b510..0000000 --- a/libraries/unitofwork/src/main/java/org/qi4j/library/unitofwork/UnitOfWorkPropagation.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2008, Edward Yakop. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -package org.qi4j.library.unitofwork; - -import java.lang.annotation.Documented; -import static java.lang.annotation.ElementType.METHOD; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import java.lang.annotation.Target; - -/** - * Annotation to denote the unit of work propagation. - * - * <p/> - * Usage example: - * <pre> - * <code> - * - * @Concerns( UnitOfWorkConcern.class ) - * public class MyBusinessServiceMixin implements BusinessService - * { - * @Structure UnitOfWorkFactory uowf; - * - * @UnitOfWorkPropagation - * public void myBusinessMethod() - * { - * // Must invoke current unit of work. - * UnitOfWork uow = uowf.currentUnitOfWork(); - * - * // Perform business logic - * } - * } - * </code> - * </pre> - * - * @author [email protected] - * @since 0.2.0 - */ -@Retention( RUNTIME ) -@Target( METHOD ) -@Inherited -@Documented -public @interface UnitOfWorkPropagation -{ - Propagation value() default Propagation.REQUIRED; - - UsecasePropagation usecasePropagation() default UsecasePropagation.PROPAGATE; - - enum UsecasePropagation - { - PROPAGATE, - DEFAULT - } - - enum Propagation - { - /** - * Default propagation behavior. - * Behavior: <br> - * If no current transaction: creates a new transaction <br> - * If there is a current transaction: use the current transaction. - */ - REQUIRED, - - /** - * Behavior: <br> - * If no current transaction: throw an exception <br> - * If there is a current transaction: use the current transaction. - */ - MANDATORY, - - /** - * Behavior: <br> - * If no current transaction: creates a new transaction <br> - * If there is a current transaction: suspend the current transaction and create a new transaction. - */ - REQUIRES_NEW, - - /** - * Behavior: <br> - * If no current transaction: creates a new transaction <br> - * If there is a current transaction: create a nested transaction. - */ - REQUIRES_NESTED, - } -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/unitofwork/src/main/java/org/qi4j/library/unitofwork/UnitOfWorkPropagationException.java ---------------------------------------------------------------------- diff --git a/libraries/unitofwork/src/main/java/org/qi4j/library/unitofwork/UnitOfWorkPropagationException.java b/libraries/unitofwork/src/main/java/org/qi4j/library/unitofwork/UnitOfWorkPropagationException.java deleted file mode 100644 index f81b82f..0000000 --- a/libraries/unitofwork/src/main/java/org/qi4j/library/unitofwork/UnitOfWorkPropagationException.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2009 Niclas Hedhman. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.qi4j.library.unitofwork; - -public class UnitOfWorkPropagationException extends RuntimeException -{ - public UnitOfWorkPropagationException( String message ) - { - super( message ); - } -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/unitofwork/src/test/java/org/qi4j/library/unitofwork/PropagationTest.java ---------------------------------------------------------------------- diff --git a/libraries/unitofwork/src/test/java/org/qi4j/library/unitofwork/PropagationTest.java b/libraries/unitofwork/src/test/java/org/qi4j/library/unitofwork/PropagationTest.java deleted file mode 100644 index 4a2fe82..0000000 --- a/libraries/unitofwork/src/test/java/org/qi4j/library/unitofwork/PropagationTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2009 Niclas Hedhman. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package org.qi4j.library.unitofwork; - -import org.junit.Assert; -import org.junit.Test; - -public class PropagationTest -{ - - @Test - public void ensurePublicApi() - { - // if an enum value is changed or removed the test wont compile - // if a value is added will fail - for( UnitOfWorkPropagation.Propagation propagation : UnitOfWorkPropagation.Propagation.values() ) - { - switch( propagation ) - { - case MANDATORY: - case REQUIRED: - case REQUIRES_NEW: - case REQUIRES_NESTED: - break; - default: - Assert.fail( "unsupported type: " + propagation ); - } - } - } - -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/unitofwork/src/test/java/org/qi4j/library/unitofwork/TransactionalTest.java ---------------------------------------------------------------------- diff --git a/libraries/unitofwork/src/test/java/org/qi4j/library/unitofwork/TransactionalTest.java b/libraries/unitofwork/src/test/java/org/qi4j/library/unitofwork/TransactionalTest.java deleted file mode 100644 index 640b04f..0000000 --- a/libraries/unitofwork/src/test/java/org/qi4j/library/unitofwork/TransactionalTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2007 Alin Dreghiciu. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package org.qi4j.library.unitofwork; - -import static org.junit.Assert.assertEquals; -import org.junit.Test; - -import java.lang.reflect.Method; - -public class TransactionalTest -{ - - @Test - public void defaultValue() throws NoSuchMethodException - { - Method method = TransactionalTest.class.getMethod( "transactionalMethod" ); - assertEquals( "default value", - UnitOfWorkPropagation.Propagation.REQUIRED, - method.getAnnotation( UnitOfWorkPropagation.class ).value() ); - } - - @UnitOfWorkPropagation - public void transactionalMethod() - { - - } - -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/validation/dev-status.xml ---------------------------------------------------------------------- diff --git a/libraries/validation/dev-status.xml b/libraries/validation/dev-status.xml deleted file mode 100644 index 1e523b4..0000000 --- a/libraries/validation/dev-status.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<module xmlns="http://www.qi4j.org/schemas/2008/dev-status/1"> - <status> - <codebase>early</codebase> - <!--none,early,beta,stable,mature--> - <documentation>none</documentation> - <!-- none, brief, good, complete --> - <unittests>none</unittests> - <!-- none, some, good, complete --> - </status> - <licenses> - <license>ALv2</license> - </licenses> -</module> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/validation/pom.xml ---------------------------------------------------------------------- diff --git a/libraries/validation/pom.xml b/libraries/validation/pom.xml deleted file mode 100644 index 0b0b3da..0000000 --- a/libraries/validation/pom.xml +++ /dev/null @@ -1,19 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.qi4j.sandbox</groupId> - <artifactId>qi4j-sandbox-libraries</artifactId> - <version>0-SNAPSHOT</version> - </parent> - <groupId>org.qi4j.library</groupId> - <artifactId>org.qi4j.library.validation</artifactId> - <name>Qi4j Library - Validation</name> - - <dependencies> - <dependency> - <groupId>org.qi4j.core</groupId> - <artifactId>org.qi4j.core.api</artifactId> - </dependency> - </dependencies> -</project> http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/validation/src/main/java/org/qi4j/library/validation/AbstractValidatableConcern.java ---------------------------------------------------------------------- diff --git a/libraries/validation/src/main/java/org/qi4j/library/validation/AbstractValidatableConcern.java b/libraries/validation/src/main/java/org/qi4j/library/validation/AbstractValidatableConcern.java deleted file mode 100644 index 4e7297b..0000000 --- a/libraries/validation/src/main/java/org/qi4j/library/validation/AbstractValidatableConcern.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.qi4j.library.validation; - -import org.qi4j.api.concern.ConcernOf; - -import java.util.List; - -/** - * Base class for validation concerns. - */ -public class AbstractValidatableConcern extends ConcernOf<Validatable> - implements Validatable -{ - public List<ValidationMessage> validate() - { - List<ValidationMessage> messages = next.validate(); - Validator validator = new Validator( messages, getResourceBundle() ); - isValid( validator ); - return messages; - } - - public void checkValid() throws ValidationException - { - next.checkValid(); - } - - /** - * Override this method to do your own validations - * - * @param validator used to simplify checks - */ - protected void isValid( Validator validator ) - { - } - - protected String getResourceBundle() - { - return this.getClass().getPackage().getName() + ".package"; - } -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/validation/src/main/java/org/qi4j/library/validation/AppliesToAnnotation.java ---------------------------------------------------------------------- diff --git a/libraries/validation/src/main/java/org/qi4j/library/validation/AppliesToAnnotation.java b/libraries/validation/src/main/java/org/qi4j/library/validation/AppliesToAnnotation.java deleted file mode 100644 index 2d8126e..0000000 --- a/libraries/validation/src/main/java/org/qi4j/library/validation/AppliesToAnnotation.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.qi4j.library.validation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention( RetentionPolicy.RUNTIME ) -@Target( { ElementType.TYPE } ) -public @interface AppliesToAnnotation -{ - Class value(); -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/validation/src/main/java/org/qi4j/library/validation/ChangeValidationConcern.java ---------------------------------------------------------------------- diff --git a/libraries/validation/src/main/java/org/qi4j/library/validation/ChangeValidationConcern.java b/libraries/validation/src/main/java/org/qi4j/library/validation/ChangeValidationConcern.java deleted file mode 100644 index 003d8b6..0000000 --- a/libraries/validation/src/main/java/org/qi4j/library/validation/ChangeValidationConcern.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.qi4j.library.validation; - -import org.qi4j.api.common.AppliesTo; -import org.qi4j.api.common.AppliesToFilter; -import org.qi4j.api.concern.ConcernOf; -import org.qi4j.api.injection.scope.This; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; - -/** - * After invocation, ensure that the validation rules pass. - * <p/> - * This applies to all methods which throws ValidationException - */ -@AppliesTo( ChangeValidationConcern.AppliesTo.class ) -public class ChangeValidationConcern extends ConcernOf<InvocationHandler> - implements InvocationHandler -{ - public static class AppliesTo - implements AppliesToFilter - { - private final Method checkValidMethod; - - public AppliesTo() - { - try - { - checkValidMethod = Validatable.class.getMethod( "checkValid" ); - } - catch( NoSuchMethodException e ) - { - throw new Error( "Invalid interface", e ); - } - } - - public boolean appliesTo( Method method, Class mixin, Class compositeType, Class modelClass ) - { - if( method.equals( checkValidMethod ) ) - { - return false; - } - - Class[] exceptionClasses = method.getExceptionTypes(); - for( Class exceptionClass : exceptionClasses ) - { - if( ValidationException.class.isAssignableFrom( exceptionClass ) ) - { - return true; - } - } - - return false; - } - } - - @This Validatable validatable; - - public Object invoke( Object object, Method method, Object[] objects ) throws Throwable - { - try - { - return next.invoke( object, method, objects ); - } - finally - { - // Ensure that object is still in a valid state - validatable.checkValid(); - } - } -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/validation/src/main/java/org/qi4j/library/validation/LifecycleValidationConcern.java ---------------------------------------------------------------------- diff --git a/libraries/validation/src/main/java/org/qi4j/library/validation/LifecycleValidationConcern.java b/libraries/validation/src/main/java/org/qi4j/library/validation/LifecycleValidationConcern.java deleted file mode 100755 index ad63929..0000000 --- a/libraries/validation/src/main/java/org/qi4j/library/validation/LifecycleValidationConcern.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2007, Lan Boon Ping. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.qi4j.library.validation; - -import org.qi4j.api.concern.ConcernOf; -import org.qi4j.api.entity.Lifecycle; -import org.qi4j.api.injection.scope.This; - -/** - * This modifier is invoked on Lifecycle mixin invocation. - * Before the next target invocation, this modifier invokes - * {@link Validatable#validate()}. - * <p/> - * JAVADOC: We need to distinguish between Validatable on create, delete and update. - */ -public class LifecycleValidationConcern extends ConcernOf<Lifecycle> - implements Lifecycle -{ - @This Validatable validation; - - public void create() - { - validation.validate(); - - next.create(); - } - - public void remove() - { - next.remove(); - } -} - http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/validation/src/main/java/org/qi4j/library/validation/UoWCallbackValidatableMixin.java ---------------------------------------------------------------------- diff --git a/libraries/validation/src/main/java/org/qi4j/library/validation/UoWCallbackValidatableMixin.java b/libraries/validation/src/main/java/org/qi4j/library/validation/UoWCallbackValidatableMixin.java deleted file mode 100644 index bbbd71a..0000000 --- a/libraries/validation/src/main/java/org/qi4j/library/validation/UoWCallbackValidatableMixin.java +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright 2009 Rickard Ãberg. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.qi4j.library.validation; - -import org.qi4j.api.injection.scope.This; -import org.qi4j.api.unitofwork.UnitOfWorkCallback; -import org.qi4j.api.unitofwork.UnitOfWorkCompletionException; - -public class UoWCallbackValidatableMixin - implements UnitOfWorkCallback -{ - @This private Validatable validatable; - - public void beforeCompletion() throws UnitOfWorkCompletionException - { - try - { - validatable.checkValid(); - } - catch( ValidationException e ) - { - throw (UnitOfWorkCompletionException) new UnitOfWorkCompletionException( "Validation failed" ).initCause( e ); - } - } - - public void afterCompletion( UnitOfWorkStatus status ) - { - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/validation/src/main/java/org/qi4j/library/validation/Validatable.java ---------------------------------------------------------------------- diff --git a/libraries/validation/src/main/java/org/qi4j/library/validation/Validatable.java b/libraries/validation/src/main/java/org/qi4j/library/validation/Validatable.java deleted file mode 100644 index b6e5bfc..0000000 --- a/libraries/validation/src/main/java/org/qi4j/library/validation/Validatable.java +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright 2007 Niclas Hedhman. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.qi4j.library.validation; - -import org.qi4j.api.mixin.Mixins; - -import java.util.List; - -@Mixins( ValidatableMixin.class ) -public interface Validatable -{ - List<ValidationMessage> validate(); - - void checkValid() - throws ValidationException; -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/validation/src/main/java/org/qi4j/library/validation/ValidatableAbstractComposite.java ---------------------------------------------------------------------- diff --git a/libraries/validation/src/main/java/org/qi4j/library/validation/ValidatableAbstractComposite.java b/libraries/validation/src/main/java/org/qi4j/library/validation/ValidatableAbstractComposite.java deleted file mode 100644 index 58c0463..0000000 --- a/libraries/validation/src/main/java/org/qi4j/library/validation/ValidatableAbstractComposite.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.qi4j.library.validation; - -import org.qi4j.api.concern.Concerns; -import org.qi4j.api.mixin.Mixins; -import org.qi4j.api.unitofwork.UnitOfWorkCallback; - -/** - * JAVADOC - */ -@Concerns( { ValidatableMessagesConcern.class, ChangeValidationConcern.class } ) -@Mixins( { ValidatableMixin.class, UoWCallbackValidatableMixin.class, ValidationMessagesMixin.class } ) -public interface ValidatableAbstractComposite - extends Validatable, UnitOfWorkCallback -{ -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/validation/src/main/java/org/qi4j/library/validation/ValidatableMessagesConcern.java ---------------------------------------------------------------------- diff --git a/libraries/validation/src/main/java/org/qi4j/library/validation/ValidatableMessagesConcern.java b/libraries/validation/src/main/java/org/qi4j/library/validation/ValidatableMessagesConcern.java deleted file mode 100644 index f44705b..0000000 --- a/libraries/validation/src/main/java/org/qi4j/library/validation/ValidatableMessagesConcern.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.qi4j.library.validation; - -import org.qi4j.api.common.AppliesTo; -import org.qi4j.api.concern.ConcernOf; -import org.qi4j.api.injection.scope.This; - -import java.util.List; - -/** - * JAVADOC - */ -@AppliesTo( Validatable.class ) -public abstract class ValidatableMessagesConcern extends ConcernOf<Validatable> - implements Validatable -{ - @This ValidationMessages messages; - - public List<ValidationMessage> validate() - { - List<ValidationMessage> messageList = next.validate(); - messageList.addAll( messages.getValidationMessages() ); - return messageList; - } -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/validation/src/main/java/org/qi4j/library/validation/ValidatableMixin.java ---------------------------------------------------------------------- diff --git a/libraries/validation/src/main/java/org/qi4j/library/validation/ValidatableMixin.java b/libraries/validation/src/main/java/org/qi4j/library/validation/ValidatableMixin.java deleted file mode 100644 index 0bc4cad..0000000 --- a/libraries/validation/src/main/java/org/qi4j/library/validation/ValidatableMixin.java +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright 2007 Niclas Hedhman. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.qi4j.library.validation; - -import org.qi4j.api.injection.scope.This; - -import java.util.ArrayList; -import java.util.List; - -public class ValidatableMixin - implements Validatable -{ - @This Validatable validatable; - - public List<ValidationMessage> validate() - { - return new ArrayList<ValidationMessage>(); - } - - public void checkValid() throws ValidationException - { - List<ValidationMessage> messages = validatable.validate(); - if( messages.size() > 0 ) - { - throw new ValidationException( messages ); - } - } -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/validation/src/main/java/org/qi4j/library/validation/ValidationException.java ---------------------------------------------------------------------- diff --git a/libraries/validation/src/main/java/org/qi4j/library/validation/ValidationException.java b/libraries/validation/src/main/java/org/qi4j/library/validation/ValidationException.java deleted file mode 100755 index cc2a600..0000000 --- a/libraries/validation/src/main/java/org/qi4j/library/validation/ValidationException.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2007, Lan Boon Ping. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.qi4j.library.validation; - -import java.util.ArrayList; -import java.util.List; - -/** - * Default exception for validation error - */ -public class ValidationException - extends RuntimeException -{ - List<ValidationMessage> messages; - - public ValidationException( String string ) - { - messages = new ArrayList<ValidationMessage>(); - messages.add( new ValidationMessage( string, ValidationMessage.Severity.ERROR ) ); - } - - public ValidationException( List<ValidationMessage> messages ) - { - this.messages = messages; - } - - public List<ValidationMessage> getMessages() - { - return messages; - } - - @Override public String getMessage() - { - return getLocalizedMessage(); - } - - - @Override public String getLocalizedMessage() - { - StringBuffer buf = new StringBuffer(); - for( ValidationMessage message : messages ) - { - if( buf.length() != 0 ) - { - buf.append( "\n" ); - } - buf.append( message.getMessage() ); - } - - return buf.toString(); - } -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/validation/src/main/java/org/qi4j/library/validation/ValidationMessage.java ---------------------------------------------------------------------- diff --git a/libraries/validation/src/main/java/org/qi4j/library/validation/ValidationMessage.java b/libraries/validation/src/main/java/org/qi4j/library/validation/ValidationMessage.java deleted file mode 100644 index bced651..0000000 --- a/libraries/validation/src/main/java/org/qi4j/library/validation/ValidationMessage.java +++ /dev/null @@ -1,106 +0,0 @@ -/* Copyright 2007 Niclas Hedhman. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.qi4j.library.validation; - -import java.io.Serializable; -import java.text.MessageFormat; -import java.util.Locale; -import java.util.ResourceBundle; - -public class ValidationMessage - implements Serializable -{ - private String resourceKey; - private Object[] arguments; - - private String resourceBundle; - private Severity severity; - - public ValidationMessage( String resourceKey, Severity severity ) - { - this( resourceKey, null, severity ); - } - - public ValidationMessage( String resourceKey, String resourceBundle, Severity severity, Object... arguments ) - { - this.resourceKey = resourceKey; - this.arguments = arguments; - this.resourceBundle = resourceBundle; - this.severity = severity; - } - - public String getResourceKey() - { - return resourceKey; - } - - public Object[] getArguments() - { - return arguments; - } - - public String getResourceBundle() - { - return resourceBundle; - } - - public Severity getSeverity() - { - return severity; - } - - public String getMessage() - { - return getMessage( Locale.getDefault() ); - } - - public String getMessage( Locale aLocale ) - { - String resource; - if( resourceBundle != null ) - { - // Look up the message from a bundle - ResourceBundle bundle = ResourceBundle.getBundle( resourceBundle, aLocale ); - resource = bundle.getString( resourceKey ); - } - else - { - // Don't use i18n - resource = resourceKey; - } - - if( arguments == null ) - { - return resource; - } - else - { - return MessageFormat.format( resource, arguments ); - } - } - - - @Override public String toString() - { - return getMessage(); - } - - public enum Severity - { - INFO, WARNING, ERROR - } -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/validation/src/main/java/org/qi4j/library/validation/ValidationMessages.java ---------------------------------------------------------------------- diff --git a/libraries/validation/src/main/java/org/qi4j/library/validation/ValidationMessages.java b/libraries/validation/src/main/java/org/qi4j/library/validation/ValidationMessages.java deleted file mode 100644 index 5c0c3b1..0000000 --- a/libraries/validation/src/main/java/org/qi4j/library/validation/ValidationMessages.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.qi4j.library.validation; - -import java.util.Collection; - -/** - * JAVADOC - */ -public interface ValidationMessages -{ - void addValidationMessage( ValidationMessage validationMessage ); - - void removeValidationMessage( String message ); - - Collection<ValidationMessage> getValidationMessages(); - - void clearValidationMessages(); -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/validation/src/main/java/org/qi4j/library/validation/ValidationMessagesMixin.java ---------------------------------------------------------------------- diff --git a/libraries/validation/src/main/java/org/qi4j/library/validation/ValidationMessagesMixin.java b/libraries/validation/src/main/java/org/qi4j/library/validation/ValidationMessagesMixin.java deleted file mode 100644 index 09964f9..0000000 --- a/libraries/validation/src/main/java/org/qi4j/library/validation/ValidationMessagesMixin.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.qi4j.library.validation; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -/** - * JAVADOC - */ -public class ValidationMessagesMixin - implements ValidationMessages -{ - Map<String, ValidationMessage> messages = new HashMap<String, ValidationMessage>(); - - public void addValidationMessage( ValidationMessage validationMessage ) - { - messages.put( validationMessage.getResourceKey(), validationMessage ); - } - - public void removeValidationMessage( String message ) - { - messages.remove( message ); - } - - public Collection<ValidationMessage> getValidationMessages() - { - return messages.values(); - } - - public void clearValidationMessages() - { - messages.clear(); - } -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/validation/src/main/java/org/qi4j/library/validation/Validator.java ---------------------------------------------------------------------- diff --git a/libraries/validation/src/main/java/org/qi4j/library/validation/Validator.java b/libraries/validation/src/main/java/org/qi4j/library/validation/Validator.java deleted file mode 100644 index d9ebf28..0000000 --- a/libraries/validation/src/main/java/org/qi4j/library/validation/Validator.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.qi4j.library.validation; - -import java.util.List; - -/** - * JAVADOC - */ -public class Validator -{ - List<ValidationMessage> messages; - String resourceBundle; - - public Validator( List<ValidationMessage> messages, String resourceBundle ) - { - this.messages = messages; - this.resourceBundle = resourceBundle; - } - - public void error( boolean test, String resourceKey, Object... arguments ) - { - if( test ) - { - messages.add( new ValidationMessage( resourceKey, resourceBundle, ValidationMessage.Severity.ERROR, arguments ) ); - } - } - - public void warn( boolean test, String resourceKey, Object... arguments ) - { - if( test ) - { - messages.add( new ValidationMessage( resourceKey, resourceBundle, ValidationMessage.Severity.WARNING, arguments ) ); - } - } - - public void info( boolean test, String resourceKey, Object... arguments ) - { - if( test ) - { - messages.add( new ValidationMessage( resourceKey, resourceBundle, ValidationMessage.Severity.INFO, arguments ) ); - } - } -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 3bce8a4..0000000 --- a/pom.xml +++ /dev/null @@ -1,87 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>org.qi4j.sandbox</groupId> - <artifactId>qi4j-sandbox</artifactId> - <packaging>pom</packaging> - <version>0-SNAPSHOT</version> - <name>Qi4j Sandbox - Build POM</name> - - <modules> - <module>libraries</module> - <module>extensions</module> - </modules> - - <repositories> - <repository> - <id>qi4j-releases</id> - <url>https://repository-qi4j.forge.cloudbees.com/release/</url> - </repository> - <repository> - <id>qi4j-snapshots</id> - <url>https://repository-qi4j.forge.cloudbees.com/snapshot/</url> - <releases><enabled>false</enabled></releases> - <snapshots><enabled>true</enabled></snapshots> - </repository> - </repositories> - - <properties> - <version.qi4j>2.0</version.qi4j> - </properties> - - <dependencyManagement> - <dependencies> - - <dependency> - <groupId>org.qi4j.core</groupId> - <artifactId>org.qi4j.core.api</artifactId> - <version>${version.qi4j}</version> - </dependency> - <dependency> - <groupId>org.qi4j.core</groupId> - <artifactId>org.qi4j.core.spi</artifactId> - <version>${version.qi4j}</version> - </dependency> - <dependency> - <groupId>org.qi4j.core</groupId> - <artifactId>org.qi4j.core.bootstrap</artifactId> - <version>${version.qi4j}</version> - </dependency> - - <dependency> - <groupId>org.qi4j.library</groupId> - <artifactId>org.qi4j.library.locking</artifactId> - <version>${version.qi4j}</version> - </dependency> - - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <version>1.6.1</version> - </dependency> - - <dependency> - <groupId>org.qi4j.core</groupId> - <artifactId>org.qi4j.core.runtime</artifactId> - <scope>runtime</scope> - <version>${version.qi4j}</version> - </dependency> - - <dependency> - <groupId>org.qi4j.core</groupId> - <artifactId>org.qi4j.core.testsupport</artifactId> - <version>${version.qi4j}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.8.1</version> - <scope>test</scope> - </dependency> - - </dependencies> - </dependencyManagement> - -</project> http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/qi4j/etc/codestyle-idea.jar ---------------------------------------------------------------------- diff --git a/qi4j/etc/codestyle-idea.jar b/qi4j/etc/codestyle-idea.jar new file mode 100644 index 0000000..2211df1 Binary files /dev/null and b/qi4j/etc/codestyle-idea.jar differ http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/qi4j/extensions/entitystore-cassandra/LICENSE ---------------------------------------------------------------------- diff --git a/qi4j/extensions/entitystore-cassandra/LICENSE b/qi4j/extensions/entitystore-cassandra/LICENSE new file mode 100644 index 0000000..f433b1a --- /dev/null +++ b/qi4j/extensions/entitystore-cassandra/LICENSE @@ -0,0 +1,177 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/qi4j/extensions/entitystore-cassandra/NOTICE ---------------------------------------------------------------------- diff --git a/qi4j/extensions/entitystore-cassandra/NOTICE b/qi4j/extensions/entitystore-cassandra/NOTICE new file mode 100644 index 0000000..42bca47 --- /dev/null +++ b/qi4j/extensions/entitystore-cassandra/NOTICE @@ -0,0 +1,19 @@ +Qi4j Cassandra Entity Store +Copyright 2007-2010, The Qi4j Development Team of individuals. + +See http://www.qi4j.org/contributors.html for list of of individuals. +Also see each file for additional information of Copyright claims. + +Qi4j is a community aggregated works under Copyright law. +All parts of the original works at Qi4j is licensed under the +Apache License ver 2.0 http://www.apache.org/licenses + +Below follows a list of binary dependencies and their licenses; +---------------------------------------------------------------- + +<TODO> + +<NONE> + + +END OF NOTICE \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/qi4j/extensions/entitystore-cassandra/dev-status.xml ---------------------------------------------------------------------- diff --git a/qi4j/extensions/entitystore-cassandra/dev-status.xml b/qi4j/extensions/entitystore-cassandra/dev-status.xml new file mode 100644 index 0000000..5b74162 --- /dev/null +++ b/qi4j/extensions/entitystore-cassandra/dev-status.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<module xmlns="http://www.qi4j.org/schemas/2008/dev-status/1"> + <status> + <!--none,early,beta,stable,mature--> + <codebase>early</codebase> + + <!-- none, brief, good, complete --> + <documentation>none</documentation> + + <!-- none, some, good, complete --> + <unittests>some</unittests> + </status> + <licenses> + <license>ALv2</license> + </licenses> +</module> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/qi4j/extensions/entitystore-cassandra/pom.xml ---------------------------------------------------------------------- diff --git a/qi4j/extensions/entitystore-cassandra/pom.xml b/qi4j/extensions/entitystore-cassandra/pom.xml new file mode 100644 index 0000000..e017f29 --- /dev/null +++ b/qi4j/extensions/entitystore-cassandra/pom.xml @@ -0,0 +1,111 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>org.qi4j.sandbox</groupId> + <artifactId>qi4j-sandbox-extensions</artifactId> + <version>0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <groupId>org.qi4j.extension</groupId> + <artifactId>qi4j-entitystore-cassandra</artifactId> + <name>Qi4j Extension - EntityStore - Cassandra</name> + <packaging>jar</packaging> + + <repositories> + <repository> + <id>riptano</id> + <name>riptano</name> + <url>http://mvn.riptano.com/content/repositories/public/</url> + </repository> + </repositories> + + + <dependencies> + <dependency> + <groupId>org.qi4j.core</groupId> + <artifactId>org.qi4j.core.spi</artifactId> + </dependency> + <dependency> + <groupId>org.qi4j.core</groupId> + <artifactId>org.qi4j.core.bootstrap</artifactId> + </dependency> + <dependency> + <groupId>org.qi4j.library</groupId> + <artifactId>org.qi4j.library.locking</artifactId> + </dependency> + <dependency> + <groupId>org.qi4j.core</groupId> + <artifactId>org.qi4j.core.runtime</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.qi4j.core</groupId> + <artifactId>org.qi4j.core.testsupport</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <artifactId>slf4j-log4j12</artifactId> + <groupId>org.slf4j</groupId> + <version>1.6.1</version> + </dependency> + <dependency> + <artifactId>slf4j-api</artifactId> + <groupId>org.slf4j</groupId> + </dependency> + + <dependency> + <groupId>org.apache.cassandra</groupId> + <artifactId>apache-cassandra</artifactId> + <version>0.6.8</version> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-compress</artifactId> + <version>1.1</version> + </dependency> + + <dependency> + <groupId>commons-collections</groupId> + <artifactId>commons-collections</artifactId> + <version>3.2.1</version> + </dependency> + + <dependency> + <groupId>org.cliffc.high_scale_lib</groupId> + <artifactId>high-scale-lib</artifactId> + <version>1.0</version> + </dependency> + + <dependency> + <groupId>com.reardencommerce</groupId> + <artifactId>clhm-production</artifactId> + <version>1.0</version> + </dependency> + + + <dependency> + <groupId>me.prettyprint</groupId> + <artifactId>hector</artifactId> + <version>0.6.0-20</version> + <exclusions> + <exclusion> + <artifactId>properties-maven-plugin</artifactId> + <groupId>org.codehaus.mojo</groupId> + </exclusion> + <exclusion> + <artifactId>apache-cassandra</artifactId> + <groupId>org.apache.cassandra</groupId> + </exclusion> + <exclusion> + <artifactId>slf4j-api</artifactId> + <groupId>org.slf4j</groupId> + </exclusion> + <exclusion> + <artifactId>slf4j-log4j12</artifactId> + <groupId>org.slf4j</groupId> + </exclusion> + + </exclusions> + </dependency> + </dependencies> +</project> http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/qi4j/extensions/entitystore-cassandra/src/main/java/org/qi4j/entitystore/cassandra/CassandraConfiguration.java ---------------------------------------------------------------------- diff --git a/qi4j/extensions/entitystore-cassandra/src/main/java/org/qi4j/entitystore/cassandra/CassandraConfiguration.java b/qi4j/extensions/entitystore-cassandra/src/main/java/org/qi4j/entitystore/cassandra/CassandraConfiguration.java new file mode 100644 index 0000000..7aecba5 --- /dev/null +++ b/qi4j/extensions/entitystore-cassandra/src/main/java/org/qi4j/entitystore/cassandra/CassandraConfiguration.java @@ -0,0 +1,23 @@ +package org.qi4j.entitystore.cassandra; + + +public interface CassandraConfiguration { + boolean gzipCompress(); + + boolean checkAbsentBeforeCreate(); + + boolean checkPresentBeforeDelete(); + + boolean checkPresentBeforeUpdate(); + + boolean readOnly(); + + + String getHost(); + + String getLogin(); + + String getPassword(); + + int getPort(); +} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/qi4j/extensions/entitystore-cassandra/src/main/java/org/qi4j/entitystore/cassandra/CassandraEntityStoreService.java ---------------------------------------------------------------------- diff --git a/qi4j/extensions/entitystore-cassandra/src/main/java/org/qi4j/entitystore/cassandra/CassandraEntityStoreService.java b/qi4j/extensions/entitystore-cassandra/src/main/java/org/qi4j/entitystore/cassandra/CassandraEntityStoreService.java new file mode 100644 index 0000000..b183d75 --- /dev/null +++ b/qi4j/extensions/entitystore-cassandra/src/main/java/org/qi4j/entitystore/cassandra/CassandraEntityStoreService.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2007, Rickard Ãberg. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.qi4j.entitystore.cassandra; + +import org.qi4j.api.concern.Concerns; +import org.qi4j.api.mixin.Mixins; +import org.qi4j.api.service.ServiceActivation; +import org.qi4j.spi.entitystore.ConcurrentModificationCheckConcern; +import org.qi4j.spi.entitystore.EntityStateVersions; +import org.qi4j.spi.entitystore.EntityStore; +import org.qi4j.spi.entitystore.StateChangeNotificationConcern; +import org.qi4j.spi.entitystore.helpers.MapEntityStoreMixin; + +@Concerns({StateChangeNotificationConcern.class, + ConcurrentModificationCheckConcern.class}) +@Mixins({MapEntityStoreMixin.class, CassandraMapEntityStoreMixin.class}) +public interface CassandraEntityStoreService extends EntityStateVersions, + EntityStore, ServiceActivation { + +}
