Cleanup Zest Sandbox - First steps - Fix maven build - Use Qi4j 1.3 - Remove JClouds and Voldemort EntityStores, promoted to SDK before 2.0 - Exclude non-working projects Details in libraries/pom.xml & extensions/pom.xml
Project: http://git-wip-us.apache.org/repos/asf/zest-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/zest-sandbox/commit/23b1f5d9 Tree: http://git-wip-us.apache.org/repos/asf/zest-sandbox/tree/23b1f5d9 Diff: http://git-wip-us.apache.org/repos/asf/zest-sandbox/diff/23b1f5d9 Branch: refs/heads/develop Commit: 23b1f5d95aace40c842081b0e693df6e231e6fef Parents: c5da67d Author: Paul Merlin <[email protected]> Authored: Sun Apr 19 15:28:19 2015 +0200 Committer: Paul Merlin <[email protected]> Committed: Sun Apr 19 16:44:04 2015 +0200 ---------------------------------------------------------------------- extensions/entitystore-cassandra/pom.xml | 21 +- extensions/entitystore-coherence/pom.xml | 20 +- .../CoherenceEntityStoreAssembler.java | 2 +- .../coherence/CoherenceEntityStoreMixin.java | 38 +- .../coherence/CoherenceEntityStoreTest.java | 2 +- extensions/entitystore-javaspaces/pom.xml | 34 +- extensions/entitystore-jclouds/dev-status.xml | 14 - extensions/entitystore-jclouds/pom.xml | 75 ---- .../jclouds/JCloudsMapEntityStoreMixin.java | 176 --------- .../jclouds/JCloudsMapEntityStoreService.java | 38 -- .../qi4j/entitystore/jclouds/JCloudsTest.java | 55 --- extensions/entitystore-jgroups/pom.xml | 22 +- .../jgroups/JGroupsEntityStoreMixin.java | 18 +- extensions/entitystore-jndi/pom.xml | 29 +- .../jndi/JndiEntityStoreAssembler.java | 6 +- .../entitystore/jndi/JndiEntityStoreMixin.java | 4 +- .../jndi/JndiReadEntityStoreTest.java | 9 +- extensions/entitystore-rmi/pom.xml | 26 +- .../rmi/ClientRmiEntityStoreMixin.java | 4 +- extensions/entitystore-s3/pom.xml | 22 +- .../s3/S3SerializationStoreMixin.java | 4 +- .../qi4j/entitystore/s3/S3EntityStoreTest.java | 2 +- extensions/entitystore-swift/pom.xml | 32 +- .../org/qi4j/entitystore/swift/DataStore.java | 25 +- .../swift/SwiftEntityStoreAssembler.java | 2 +- .../entitystore/swift/SwiftEntityStoreTest.java | 2 +- .../swift/SwiftStorePerformanceTest.java | 8 +- extensions/entitystore-voldemort/pom.xml | 70 ---- .../voldemort/VoldemortAssembler.java | 49 --- .../voldemort/VoldemortConfiguration.java | 110 ------ .../voldemort/VoldemortEntityStoreMixin.java | 372 ------------------- .../voldemort/VoldemortEntityStoreService.java | 50 --- .../entitystore/voldemort/VoldemortTest.java | 114 ------ .../org/qi4j/entitystore/voldemort/cluster.xml | 38 -- .../qi4j/entitystore/voldemort/node0.properties | 207 ----------- .../qi4j/entitystore/voldemort/node1.properties | 207 ----------- .../org/qi4j/entitystore/voldemort/stores.xml | 37 -- extensions/osgi/bootstrap/pom.xml | 17 +- extensions/osgi/example/pom.xml | 17 +- extensions/osgi/integrationTests/pom.xml | 10 +- .../java/org/qi4j/osgi/test/AbstractTest.java | 2 +- extensions/osgi/pom.xml | 12 +- extensions/osgi/testBootstrap/pom.xml | 9 +- extensions/pom.xml | 24 +- libraries/beans/pom.xml | 16 +- libraries/entityproxy/pom.xml | 16 +- libraries/exception/pom.xml | 16 +- libraries/executor/pom.xml | 16 +- libraries/jini/common/pom.xml | 8 +- libraries/jini/importer/pom.xml | 20 +- .../importer/ImportExternalJiniServiceTest.java | 2 +- libraries/jini/javaspaces/pom.xml | 32 +- libraries/jini/lookup/pom.xml | 24 +- libraries/jini/pom.xml | 8 +- libraries/jini/transaction/pom.xml | 28 +- libraries/ldap/client/pom.xml | 10 +- libraries/ldap/pom.xml | 10 +- libraries/ldap/server/pom.xml | 14 +- libraries/observations/pom.xml | 14 +- libraries/pom.xml | 11 +- libraries/registry/pom.xml | 14 +- libraries/rmi/pom.xml | 20 +- libraries/thread/pom.xml | 24 +- libraries/unitofwork/pom.xml | 10 +- libraries/validation/pom.xml | 10 +- pom.xml | 75 +++- 66 files changed, 470 insertions(+), 1963 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-cassandra/pom.xml ---------------------------------------------------------------------- diff --git a/extensions/entitystore-cassandra/pom.xml b/extensions/entitystore-cassandra/pom.xml index 73aff88..e017f29 100644 --- a/extensions/entitystore-cassandra/pom.xml +++ b/extensions/entitystore-cassandra/pom.xml @@ -1,16 +1,15 @@ <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</groupId> - <artifactId>qi4j-extensions</artifactId> - <version>1.3-SNAPSHOT</version> + <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> - <version>1.4-SNAPSHOT</version> - <name>Qi4j Extension - Entity Store - Cassandra</name> - <packaging>bundle</packaging> + <name>Qi4j Extension - EntityStore - Cassandra</name> + <packaging>jar</packaging> <repositories> <repository> @@ -24,24 +23,24 @@ <dependencies> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-spi</artifactId> + <artifactId>org.qi4j.core.spi</artifactId> </dependency> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-bootstrap</artifactId> + <artifactId>org.qi4j.core.bootstrap</artifactId> </dependency> <dependency> <groupId>org.qi4j.library</groupId> - <artifactId>qi4j-lib-locking</artifactId> + <artifactId>org.qi4j.library.locking</artifactId> </dependency> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-runtime</artifactId> + <artifactId>org.qi4j.core.runtime</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-testsupport</artifactId> + <artifactId>org.qi4j.core.testsupport</artifactId> <scope>test</scope> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-coherence/pom.xml ---------------------------------------------------------------------- diff --git a/extensions/entitystore-coherence/pom.xml b/extensions/entitystore-coherence/pom.xml index da54e5a..ded2a8e 100644 --- a/extensions/entitystore-coherence/pom.xml +++ b/extensions/entitystore-coherence/pom.xml @@ -1,11 +1,11 @@ <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</groupId> - <artifactId>qi4j-extensions</artifactId> - <version>1.3-SNAPSHOT</version> - </parent> + <parent> + <groupId>org.qi4j.sandbox</groupId> + <artifactId>qi4j-sandbox-extensions</artifactId> + <version>0-SNAPSHOT</version> + </parent> <groupId>org.qi4j.extension</groupId> <artifactId>qi4j-entitystore-coherence</artifactId> <name>Qi4j Extension - Entity Store - Coherence</name> @@ -14,15 +14,15 @@ <dependencies> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-spi</artifactId> + <artifactId>org.qi4j.core.spi</artifactId> </dependency> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-bootstrap</artifactId> + <artifactId>org.qi4j.core.bootstrap</artifactId> </dependency> <dependency> <groupId>org.qi4j.library</groupId> - <artifactId>qi4j-lib-locking</artifactId> + <artifactId>org.qi4j.library.locking</artifactId> </dependency> <dependency> <groupId>com.tangosol</groupId> @@ -33,12 +33,12 @@ <!-- For Tests --> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-testsupport</artifactId> + <artifactId>org.qi4j.core.testsupport</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-runtime</artifactId> + <artifactId>org.qi4j.core.runtime</artifactId> <scope>test</scope> </dependency> </dependencies> http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-coherence/src/main/java/org/qi4j/entitystore/coherence/CoherenceEntityStoreAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-coherence/src/main/java/org/qi4j/entitystore/coherence/CoherenceEntityStoreAssembler.java b/extensions/entitystore-coherence/src/main/java/org/qi4j/entitystore/coherence/CoherenceEntityStoreAssembler.java index 6ffb126..1efc3d1 100644 --- a/extensions/entitystore-coherence/src/main/java/org/qi4j/entitystore/coherence/CoherenceEntityStoreAssembler.java +++ b/extensions/entitystore-coherence/src/main/java/org/qi4j/entitystore/coherence/CoherenceEntityStoreAssembler.java @@ -38,7 +38,7 @@ public class CoherenceEntityStoreAssembler throws AssemblyException { module.addServices( CoherenceEntityStoreService.class, UuidIdentityGeneratorService.class ); - ModuleAssembly config = module.layerAssembly().moduleAssembly( configurationModule ); + ModuleAssembly config = module.layer().module( configurationModule ); config.addEntities( CoherenceConfiguration.class ).visibleIn( Visibility.layer ); config.addServices( MemoryEntityStoreService.class ); } http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-coherence/src/main/java/org/qi4j/entitystore/coherence/CoherenceEntityStoreMixin.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-coherence/src/main/java/org/qi4j/entitystore/coherence/CoherenceEntityStoreMixin.java b/extensions/entitystore-coherence/src/main/java/org/qi4j/entitystore/coherence/CoherenceEntityStoreMixin.java index 576348a..a341d9e 100644 --- a/extensions/entitystore-coherence/src/main/java/org/qi4j/entitystore/coherence/CoherenceEntityStoreMixin.java +++ b/extensions/entitystore-coherence/src/main/java/org/qi4j/entitystore/coherence/CoherenceEntityStoreMixin.java @@ -34,6 +34,10 @@ import org.qi4j.api.configuration.Configuration; import org.qi4j.api.entity.EntityReference; import org.qi4j.api.injection.scope.This; import org.qi4j.api.injection.scope.Uses; +import org.qi4j.api.io.Input; +import org.qi4j.api.io.Output; +import org.qi4j.api.io.Receiver; +import org.qi4j.api.io.Sender; import org.qi4j.api.service.Activatable; import org.qi4j.entitystore.map.MapEntityStore; import org.qi4j.spi.entity.EntityType; @@ -155,23 +159,31 @@ public class CoherenceEntityStoreMixin } } - public void visitMap( MapEntityStoreVisitor visitor ) + public Input<Reader, IOException> entityStates() { - Iterator<Map.Entry<String, byte[]>> list = cache.entrySet().iterator(); - while( list.hasNext() ) + return new Input<Reader, IOException>() { - Map.Entry<String, byte[]> entry = list.next(); - String id = entry.getKey(); - byte[] data = entry.getValue(); - try - { - visitor.visitEntity( new StringReader( new String( data, "UTF-8" ) ) ); - } - catch( UnsupportedEncodingException e ) + public <ReceiverThrowableType extends Throwable> void transferTo( Output<? super Reader, ReceiverThrowableType> output ) + throws IOException, ReceiverThrowableType { - // Can not happen! + output.receiveFrom( + new Sender<Reader, IOException>() + { + public <ReceiverThrowableType extends Throwable> void sendTo( Receiver<? super Reader, ReceiverThrowableType> receiver ) + throws ReceiverThrowableType, IOException + { + Iterator<Map.Entry<String, byte[]>> list = cache.entrySet().iterator(); + while( list.hasNext() ) + { + Map.Entry<String, byte[]> entry = list.next(); + byte[] data = entry.getValue(); + receiver.receive( new StringReader( new String( data, "UTF-8" ) ) ); + } + } + } + ); } - } + }; } public void exportTo( Writer out ) http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-coherence/src/test/java/org/qi4j/entitystore/coherence/CoherenceEntityStoreTest.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-coherence/src/test/java/org/qi4j/entitystore/coherence/CoherenceEntityStoreTest.java b/extensions/entitystore-coherence/src/test/java/org/qi4j/entitystore/coherence/CoherenceEntityStoreTest.java index 72bc23f..83334a3 100644 --- a/extensions/entitystore-coherence/src/test/java/org/qi4j/entitystore/coherence/CoherenceEntityStoreTest.java +++ b/extensions/entitystore-coherence/src/test/java/org/qi4j/entitystore/coherence/CoherenceEntityStoreTest.java @@ -36,7 +36,7 @@ public class CoherenceEntityStoreTest extends AbstractEntityStoreTest super.assemble( module ); module.addServices( CoherenceEntityStoreService.class, UuidIdentityGeneratorService.class ); - ModuleAssembly config = module.layerAssembly().moduleAssembly( "config" ); + ModuleAssembly config = module.layer().module( "config" ); config.addEntities( CoherenceConfiguration.class ).visibleIn( Visibility.layer ); config.addServices( MemoryEntityStoreService.class ); } http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-javaspaces/pom.xml ---------------------------------------------------------------------- diff --git a/extensions/entitystore-javaspaces/pom.xml b/extensions/entitystore-javaspaces/pom.xml index 8c61a03..09f3d0d 100644 --- a/extensions/entitystore-javaspaces/pom.xml +++ b/extensions/entitystore-javaspaces/pom.xml @@ -1,11 +1,11 @@ <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</groupId> - <artifactId>qi4j-extensions</artifactId> - <version>1.3-SNAPSHOT</version> - </parent> + <parent> + <groupId>org.qi4j.sandbox</groupId> + <artifactId>qi4j-sandbox-extensions</artifactId> + <version>0-SNAPSHOT</version> + </parent> <groupId>org.qi4j.extension</groupId> <artifactId>qi4j-entitystore-javaspaces</artifactId> <packaging>jar</packaging> @@ -14,29 +14,29 @@ <dependencies> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-api</artifactId> + <artifactId>org.qi4j.core.api</artifactId> </dependency> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-spi</artifactId> + <artifactId>org.qi4j.core.spi</artifactId> </dependency> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-runtime</artifactId> + <artifactId>org.qi4j.core.runtime</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-bootstrap</artifactId> + <artifactId>org.qi4j.core.bootstrap</artifactId> </dependency> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-testsupport</artifactId> + <artifactId>org.qi4j.core.testsupport</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.qi4j.library</groupId> - <artifactId>qi4j-lib-locking</artifactId> + <artifactId>org.qi4j.library.locking</artifactId> </dependency> <dependency> <groupId>org.apache.river</groupId> @@ -50,20 +50,20 @@ </dependency> <dependency> <groupId>org.qi4j.library.jini</groupId> - <artifactId>qi4j-lib-jini-javaspaces</artifactId> - <version>1.3-SNAPSHOT</version> + <artifactId>org.qi4j.library.jini-javaspaces</artifactId> + <version>${project.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.qi4j.library.jini</groupId> - <artifactId>qi4j-lib-jini-lookup</artifactId> - <version>1.3-SNAPSHOT</version> + <artifactId>org.qi4j.library.jini-lookup</artifactId> + <version>${project.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.qi4j.library.jini</groupId> - <artifactId>qi4j-lib-jini-transaction</artifactId> - <version>1.3-SNAPSHOT</version> + <artifactId>org.qi4j.library.jini-transaction</artifactId> + <version>${project.version}</version> <scope>test</scope> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-jclouds/dev-status.xml ---------------------------------------------------------------------- diff --git a/extensions/entitystore-jclouds/dev-status.xml b/extensions/entitystore-jclouds/dev-status.xml deleted file mode 100644 index 9a26d1f..0000000 --- a/extensions/entitystore-jclouds/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>brief</unittests> - <!-- none, some, good, complete --> - </status> - <licenses> - <license>ALv2</license> - </licenses> -</module> http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-jclouds/pom.xml ---------------------------------------------------------------------- diff --git a/extensions/entitystore-jclouds/pom.xml b/extensions/entitystore-jclouds/pom.xml deleted file mode 100644 index 12278e9..0000000 --- a/extensions/entitystore-jclouds/pom.xml +++ /dev/null @@ -1,75 +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</groupId> - <artifactId>qi4j-extensions</artifactId> - <version>1.3-SNAPSHOT</version> - </parent> - <groupId>org.qi4j.extension</groupId> - <artifactId>qi4j-entitystore-jclouds</artifactId> - <name>Qi4j Extension - Entity Store - JClouds</name> - <packaging>bundle</packaging> - - <dependencies> - - <dependency> - <groupId>org.jclouds</groupId> - <artifactId>jclouds-blobstore</artifactId> - <version>1.0-beta-6</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <version>1.6.0</version> - </dependency> - - <!-- Qi4j Core --> - <dependency> - <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-bootstrap</artifactId> - </dependency> - - <!-- Qi4j Libraries --> - <dependency> - <groupId>org.qi4j.library</groupId> - <artifactId>qi4j-lib-locking</artifactId> - </dependency> - <dependency> - <groupId>org.qi4j.library</groupId> - <artifactId>qi4j-lib-sql-api</artifactId> - </dependency> - - <!-- Unit tests --> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>0.9.21</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-runtime</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.qi4j.tests</groupId> - <artifactId>qi4j-tests-performance</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-testsupport</artifactId> - <scope>test</scope> - </dependency> - - </dependencies> - <repositories> - <repository> - <id>jclouds</id> - <url>http://jclouds.googlecode.com/svn/repo</url> - </repository> - </repositories> -</project> http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-jclouds/src/main/java/org/qi4j/entitystore/jclouds/JCloudsMapEntityStoreMixin.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-jclouds/src/main/java/org/qi4j/entitystore/jclouds/JCloudsMapEntityStoreMixin.java b/extensions/entitystore-jclouds/src/main/java/org/qi4j/entitystore/jclouds/JCloudsMapEntityStoreMixin.java deleted file mode 100644 index aebb994..0000000 --- a/extensions/entitystore-jclouds/src/main/java/org/qi4j/entitystore/jclouds/JCloudsMapEntityStoreMixin.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (c) 2010, Paul Merlin. 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.jclouds; - -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.io.StringReader; -import java.io.StringWriter; -import java.io.Writer; -import java.util.Map; - -import org.jclouds.blobstore.BlobStoreContext; -import org.jclouds.blobstore.BlobStoreContextFactory; -import org.jclouds.blobstore.InputStreamMap; - -import org.qi4j.api.entity.EntityReference; -import org.qi4j.api.service.Activatable; -import org.qi4j.api.unitofwork.NoSuchEntityException; -import org.qi4j.entitystore.map.MapEntityStore; -import org.qi4j.spi.entity.EntityType; -import org.qi4j.spi.entitystore.EntityNotFoundException; -import org.qi4j.spi.entitystore.EntityStoreException; - -public class JCloudsMapEntityStoreMixin - implements Activatable, MapEntityStore -{ - - private static final String CONTAINER_NAME = "qi4j-data"; - - private BlobStoreContext blobStoreContext; - - private InputStreamMap map; - - public void activate() - throws Exception - { - blobStoreContext = new BlobStoreContextFactory().createContext( "transient", "", "" ); - if ( !blobStoreContext.getBlobStore().createContainerInLocation( null, CONTAINER_NAME ) ) { - throw new EntityStoreException( "Container '" + CONTAINER_NAME + "' did not exists in BlobStore and could not be created." ); - } - map = blobStoreContext.createInputStreamMap( CONTAINER_NAME ); - } - - public void passivate() - throws Exception - { - blobStoreContext.close(); - } - - public Reader get( EntityReference er ) - throws EntityStoreException - { - InputStream is = null; - try { - is = map.get( er.identity() ); - if ( is == null ) { - throw new NoSuchEntityException( er ); - } - return new StringReader( readInputStream( is ).toString() ); - } finally { - if ( is != null ) { - try { - is.close(); - } catch ( IOException ignored ) { - } - } - } - } - - public void visitMap( MapEntityStoreVisitor visitor ) - { - for ( Map.Entry<String, InputStream> eachEntry : map.entrySet() ) { - InputStream is = eachEntry.getValue(); - try { - visitor.visitEntity( new StringReader( readInputStream( is ).toString() ) ); - } finally { - if ( is != null ) { - try { - is.close(); - } catch ( IOException ignored ) { - } - } - } - } - } - - public void applyChanges( MapChanges changes ) - throws IOException - { - changes.visitMap( new MapChanger() - { - - public Writer newEntity( final EntityReference ref, EntityType entityType ) - throws IOException - { - return new StringWriter( 1000 ) - { - - @Override - public void close() - throws IOException - { - super.close(); - map.putString( ref.identity(), toString() ); - } - - }; - } - - public Writer updateEntity( final EntityReference ref, EntityType entityType ) - throws IOException - { - return new StringWriter( 1000 ) - { - - @Override - public void close() - throws IOException - { - super.close(); - map.putString( ref.identity(), toString() ); - } - - }; - } - - public void removeEntity( EntityReference ref, EntityType entityType ) - throws EntityNotFoundException - { - map.remove( ref.identity() ); - } - - } ); - } - - private CharSequence readInputStream( InputStream is ) - { - Reader in = null; - try { - final char[] buffer = new char[ 0x10000 ]; // 64K Blocks - StringBuilder out = new StringBuilder(); - in = new InputStreamReader( is, "UTF-8" ); - int read; - do { - read = in.read( buffer, 0, buffer.length ); - if ( read > 0 ) { - out.append( buffer, 0, read ); - } - } while ( read >= 0 ); - return out; - } catch ( IOException ex ) { - throw new EntityStoreException( "Unable to read data from BlobStore", ex ); - } finally { - try { - if ( in != null ) { - in.close(); - } - } catch ( IOException ignored ) { - } - } - } - -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-jclouds/src/main/java/org/qi4j/entitystore/jclouds/JCloudsMapEntityStoreService.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-jclouds/src/main/java/org/qi4j/entitystore/jclouds/JCloudsMapEntityStoreService.java b/extensions/entitystore-jclouds/src/main/java/org/qi4j/entitystore/jclouds/JCloudsMapEntityStoreService.java deleted file mode 100644 index f63fe45..0000000 --- a/extensions/entitystore-jclouds/src/main/java/org/qi4j/entitystore/jclouds/JCloudsMapEntityStoreService.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2010, Paul Merlin. 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.jclouds; - -import org.qi4j.api.concern.Concerns; -import org.qi4j.api.configuration.Configuration; -import org.qi4j.api.mixin.Mixins; -import org.qi4j.api.service.Activatable; -import org.qi4j.api.service.ServiceComposite; -import org.qi4j.entitystore.map.MapEntityStoreMixin; -import org.qi4j.library.locking.LockingAbstractComposite; -import org.qi4j.spi.entitystore.ConcurrentModificationCheckConcern; -import org.qi4j.spi.entitystore.EntityStateVersions; -import org.qi4j.spi.entitystore.EntityStore; -import org.qi4j.spi.entitystore.StateChangeNotificationConcern; - -@Concerns( { StateChangeNotificationConcern.class, ConcurrentModificationCheckConcern.class } ) -@Mixins( { MapEntityStoreMixin.class, JCloudsMapEntityStoreMixin.class } ) -public interface JCloudsMapEntityStoreService - extends EntityStore, - EntityStateVersions, - ServiceComposite, - Activatable, - LockingAbstractComposite, - Configuration -{ -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-jclouds/src/test/java/org/qi4j/entitystore/jclouds/JCloudsTest.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-jclouds/src/test/java/org/qi4j/entitystore/jclouds/JCloudsTest.java b/extensions/entitystore-jclouds/src/test/java/org/qi4j/entitystore/jclouds/JCloudsTest.java deleted file mode 100644 index 7c048fe..0000000 --- a/extensions/entitystore-jclouds/src/test/java/org/qi4j/entitystore/jclouds/JCloudsTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2010, Paul Merlin. 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.jclouds; - -import org.junit.After; -import org.junit.Test; -import org.qi4j.api.unitofwork.UnitOfWorkCompletionException; -import org.qi4j.bootstrap.AssemblyException; -import org.qi4j.bootstrap.ModuleAssembly; -import org.qi4j.spi.uuid.UuidIdentityGeneratorService; -import org.qi4j.test.entity.AbstractEntityStoreTest; - -public class JCloudsTest - extends AbstractEntityStoreTest -{ - - @Override - @SuppressWarnings( "unchecked" ) - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - super.assemble( module ); - module.addServices( JCloudsMapEntityStoreService.class ).instantiateOnStartup(); - module.addServices( UuidIdentityGeneratorService.class ); - } - - @Test - @Override - public void givenConcurrentUnitOfWorksWhenUoWCompletesThenCheckConcurrentModification() - throws UnitOfWorkCompletionException - { - super.givenConcurrentUnitOfWorksWhenUoWCompletesThenCheckConcurrentModification(); - } - - @After - @Override - public void tearDown() - throws Exception - { - super.tearDown(); - // TODO : delete test data - } - -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-jgroups/pom.xml ---------------------------------------------------------------------- diff --git a/extensions/entitystore-jgroups/pom.xml b/extensions/entitystore-jgroups/pom.xml index 74ca09d..8e4c22a 100644 --- a/extensions/entitystore-jgroups/pom.xml +++ b/extensions/entitystore-jgroups/pom.xml @@ -1,15 +1,15 @@ <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</groupId> - <artifactId>qi4j-extensions</artifactId> - <version>1.3-SNAPSHOT</version> - </parent> + <parent> + <groupId>org.qi4j.sandbox</groupId> + <artifactId>qi4j-sandbox-extensions</artifactId> + <version>0-SNAPSHOT</version> + </parent> <groupId>org.qi4j.extension</groupId> <artifactId>qi4j-entitystore-jgroups</artifactId> - <name>Qi4j Extension - JGroups Store</name> - <packaging>bundle</packaging> + <name>Qi4j Extension - EntityStore - JGroups</name> + <packaging>jar</packaging> <build> <plugins> @@ -25,21 +25,21 @@ <dependencies> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-spi</artifactId> + <artifactId>org.qi4j.core.spi</artifactId> </dependency> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-testsupport</artifactId> + <artifactId>org.qi4j.core.testsupport</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-runtime</artifactId> + <artifactId>org.qi4j.core.runtime</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.qi4j.library</groupId> - <artifactId>qi4j-lib-locking</artifactId> + <artifactId>org.qi4j.library.locking</artifactId> </dependency> <dependency> <groupId>jgroups</groupId> http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-jgroups/src/main/java/org/qi4j/entitystore/jgroups/JGroupsEntityStoreMixin.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-jgroups/src/main/java/org/qi4j/entitystore/jgroups/JGroupsEntityStoreMixin.java b/extensions/entitystore-jgroups/src/main/java/org/qi4j/entitystore/jgroups/JGroupsEntityStoreMixin.java index c1bfcff..9c721c6 100644 --- a/extensions/entitystore-jgroups/src/main/java/org/qi4j/entitystore/jgroups/JGroupsEntityStoreMixin.java +++ b/extensions/entitystore-jgroups/src/main/java/org/qi4j/entitystore/jgroups/JGroupsEntityStoreMixin.java @@ -76,18 +76,22 @@ public class JGroupsEntityStoreMixin { return new Input<Reader, IOException>() { - public <ReceiverThrowableType extends Throwable> void transferTo( Output<Reader, ReceiverThrowableType> output ) throws IOException, ReceiverThrowableType + public <ReceiverThrowableType extends Throwable> void transferTo( Output<? super Reader, ReceiverThrowableType> output ) + throws IOException, ReceiverThrowableType { - output.receiveFrom( new Sender<Reader, IOException>() - { - public <ReceiverThrowableType extends Throwable> void sendTo( Receiver<Reader, ReceiverThrowableType> receiver ) throws ReceiverThrowableType, IOException + output.receiveFrom( + new Sender<Reader, IOException>() { - for (String json : replicatedMap.values()) + public <ReceiverThrowableType extends Throwable> void sendTo( Receiver<? super Reader, ReceiverThrowableType> receiver ) + throws ReceiverThrowableType, IOException { - receiver.receive( new StringReader(json) ); + for( String json : replicatedMap.values() ) + { + receiver.receive( new StringReader( json ) ); + } } } - } ); + ); } }; } http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-jndi/pom.xml ---------------------------------------------------------------------- diff --git a/extensions/entitystore-jndi/pom.xml b/extensions/entitystore-jndi/pom.xml index 5d59a2a..c4ce324 100644 --- a/extensions/entitystore-jndi/pom.xml +++ b/extensions/entitystore-jndi/pom.xml @@ -1,49 +1,48 @@ <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</groupId> - <artifactId>qi4j-extensions</artifactId> - <version>1.3-SNAPSHOT</version> - </parent> + <parent> + <groupId>org.qi4j.sandbox</groupId> + <artifactId>qi4j-sandbox-extensions</artifactId> + <version>0-SNAPSHOT</version> + </parent> <groupId>org.qi4j.extension</groupId> <artifactId>qi4j-entitystore-jndi</artifactId> - <name>Qi4j Extension - Entity Store - JNDI</name> - <packaging>bundle</packaging> + <name>Qi4j Extension - EntityStore - JNDI</name> <dependencies> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-api</artifactId> + <artifactId>org.qi4j.core.api</artifactId> </dependency> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-spi</artifactId> + <artifactId>org.qi4j.core.spi</artifactId> </dependency> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-bootstrap</artifactId> + <artifactId>org.qi4j.core.bootstrap</artifactId> </dependency> <dependency> <groupId>org.qi4j.library</groupId> - <artifactId>qi4j-lib-locking</artifactId> + <artifactId>org.qi4j.library.locking</artifactId> </dependency> <!-- Tests --> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-testsupport</artifactId> + <artifactId>org.qi4j.core.testsupport</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-runtime</artifactId> + <artifactId>org.qi4j.core.runtime</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.qi4j.library</groupId> - <artifactId>qi4j-lib-ldap-server</artifactId> - <version>1.3-SNAPSHOT</version> + <artifactId>org.qi4j.library.ldap-server</artifactId> + <version>${project.version}</version> <scope>test</scope> </dependency> http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-jndi/src/main/java/org/qi4j/entitystore/jndi/JndiEntityStoreAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-jndi/src/main/java/org/qi4j/entitystore/jndi/JndiEntityStoreAssembler.java b/extensions/entitystore-jndi/src/main/java/org/qi4j/entitystore/jndi/JndiEntityStoreAssembler.java index 784ba67..0117834 100644 --- a/extensions/entitystore-jndi/src/main/java/org/qi4j/entitystore/jndi/JndiEntityStoreAssembler.java +++ b/extensions/entitystore-jndi/src/main/java/org/qi4j/entitystore/jndi/JndiEntityStoreAssembler.java @@ -37,8 +37,8 @@ public class JndiEntityStoreAssembler public void assemble( ModuleAssembly module ) throws AssemblyException { module.addServices( JndiEntityStoreService.class, UuidIdentityGeneratorService.class ); - ModuleAssembly config = module.layerAssembly().moduleAssembly( configurationModuleName ); - config.addEntities( JndiConfiguration.class ).visibleIn( Visibility.layer ); - config.addServices( MemoryEntityStoreService.class ); + ModuleAssembly config = module.layer().module( configurationModuleName ); + config.entities( JndiConfiguration.class ).visibleIn( Visibility.layer ); + config.services( MemoryEntityStoreService.class ); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-jndi/src/main/java/org/qi4j/entitystore/jndi/JndiEntityStoreMixin.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-jndi/src/main/java/org/qi4j/entitystore/jndi/JndiEntityStoreMixin.java b/extensions/entitystore-jndi/src/main/java/org/qi4j/entitystore/jndi/JndiEntityStoreMixin.java index 6a124e4..2bf2f74 100644 --- a/extensions/entitystore-jndi/src/main/java/org/qi4j/entitystore/jndi/JndiEntityStoreMixin.java +++ b/extensions/entitystore-jndi/src/main/java/org/qi4j/entitystore/jndi/JndiEntityStoreMixin.java @@ -118,9 +118,11 @@ public class JndiEntityStoreMixin { return new Input<EntityState, EntityStoreException>() { - public <ReceiverThrowableType extends Throwable> void transferTo( Output<EntityState, ReceiverThrowableType> entityStateReceiverThrowableTypeOutput ) throws EntityStoreException, ReceiverThrowableType + public <ReceiverThrowableType extends Throwable> void transferTo( Output<? super EntityState, ReceiverThrowableType> output ) + throws EntityStoreException, ReceiverThrowableType { // TODO Actual iteration + throw new UnsupportedOperationException( "Not implemented yet!" ); } }; } http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-jndi/src/test/java/org/qi4j/entitystore/jndi/JndiReadEntityStoreTest.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-jndi/src/test/java/org/qi4j/entitystore/jndi/JndiReadEntityStoreTest.java b/extensions/entitystore-jndi/src/test/java/org/qi4j/entitystore/jndi/JndiReadEntityStoreTest.java index 29da5d9..84ddf8d 100644 --- a/extensions/entitystore-jndi/src/test/java/org/qi4j/entitystore/jndi/JndiReadEntityStoreTest.java +++ b/extensions/entitystore-jndi/src/test/java/org/qi4j/entitystore/jndi/JndiReadEntityStoreTest.java @@ -37,14 +37,15 @@ public class JndiReadEntityStoreTest extends AbstractQi4jTest public void assemble( ModuleAssembly module ) throws AssemblyException { module.addServices( JndiEntityStoreService.class, UuidIdentityGeneratorService.class ); - ModuleAssembly config = module.layerAssembly().moduleAssembly( "config" ); - config.addEntities( JndiConfiguration.class ).visibleIn( Visibility.layer ); - config.addServices( MemoryEntityStoreService.class ); + ModuleAssembly config = module.layer().module( "config" ); + config.entities( JndiConfiguration.class ).visibleIn( Visibility.layer ); + config.services( MemoryEntityStoreService.class ); - module.addEntities( UserEntity.class, GroupEntity.class ); + module.entities( UserEntity.class, GroupEntity.class ); } @Test + @Ignore( "Requires connection to LDAP server on OPS4J that is now unavailable" ) public void findSaslSupportTypes() throws Exception { http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-rmi/pom.xml ---------------------------------------------------------------------- diff --git a/extensions/entitystore-rmi/pom.xml b/extensions/entitystore-rmi/pom.xml index e8c72f4..1a5640b 100644 --- a/extensions/entitystore-rmi/pom.xml +++ b/extensions/entitystore-rmi/pom.xml @@ -1,43 +1,43 @@ <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</groupId> - <artifactId>qi4j-extensions</artifactId> - <version>1.3-SNAPSHOT</version> - </parent> + <parent> + <groupId>org.qi4j.sandbox</groupId> + <artifactId>qi4j-sandbox-extensions</artifactId> + <version>0-SNAPSHOT</version> + </parent> <groupId>org.qi4j.extension</groupId> <artifactId>qi4j-entitystore-rmi</artifactId> - <name>Qi4j Extension - RMI Entity Store</name> - <packaging>bundle</packaging> + <name>Qi4j Extension - EntityStore - RMI</name> + <packaging>jar</packaging> <dependencies> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-api</artifactId> + <artifactId>org.qi4j.core.api</artifactId> </dependency> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-spi</artifactId> + <artifactId>org.qi4j.core.spi</artifactId> </dependency> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-bootstrap</artifactId> + <artifactId>org.qi4j.core.bootstrap</artifactId> </dependency> <dependency> <groupId>org.qi4j.library</groupId> - <artifactId>qi4j-lib-locking</artifactId> + <artifactId>org.qi4j.library.locking</artifactId> </dependency> <!-- For tests --> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-testsupport</artifactId> + <artifactId>org.qi4j.core.testsupport</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-runtime</artifactId> + <artifactId>org.qi4j.core.runtime</artifactId> <scope>test</scope> </dependency> </dependencies> http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-rmi/src/main/java/org/qi4j/entitystore/rmi/ClientRmiEntityStoreMixin.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-rmi/src/main/java/org/qi4j/entitystore/rmi/ClientRmiEntityStoreMixin.java b/extensions/entitystore-rmi/src/main/java/org/qi4j/entitystore/rmi/ClientRmiEntityStoreMixin.java index 450a56c..6508491 100644 --- a/extensions/entitystore-rmi/src/main/java/org/qi4j/entitystore/rmi/ClientRmiEntityStoreMixin.java +++ b/extensions/entitystore-rmi/src/main/java/org/qi4j/entitystore/rmi/ClientRmiEntityStoreMixin.java @@ -60,9 +60,11 @@ public class ClientRmiEntityStoreMixin { return new Input<Reader, IOException>() { - public <ReceiverThrowableType extends Throwable> void transferTo( Output<Reader, ReceiverThrowableType> readerReceiverThrowableTypeOutput ) throws IOException, ReceiverThrowableType + public <ReceiverThrowableType extends Throwable> void transferTo( Output<? super Reader, ReceiverThrowableType> output ) + throws IOException, ReceiverThrowableType { // TODO Implement this + throw new UnsupportedOperationException( "Not supported yet." ); } }; } http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-s3/pom.xml ---------------------------------------------------------------------- diff --git a/extensions/entitystore-s3/pom.xml b/extensions/entitystore-s3/pom.xml index 996485c..e5506ed 100644 --- a/extensions/entitystore-s3/pom.xml +++ b/extensions/entitystore-s3/pom.xml @@ -1,28 +1,28 @@ <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</groupId> - <artifactId>qi4j-extensions</artifactId> - <version>1.3-SNAPSHOT</version> - </parent> + <parent> + <groupId>org.qi4j.sandbox</groupId> + <artifactId>qi4j-sandbox-extensions</artifactId> + <version>0-SNAPSHOT</version> + </parent> <groupId>org.qi4j.extension</groupId> <artifactId>qi4j-entitystore-s3</artifactId> - <name>Qi4j Extension - Entity Store - Amazon S3</name> - <packaging>bundle</packaging> + <name>Qi4j Extension - EntityStore - Amazon S3</name> + <packaging>jar</packaging> <dependencies> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-api</artifactId> + <artifactId>org.qi4j.core.api</artifactId> </dependency> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-spi</artifactId> + <artifactId>org.qi4j.core.spi</artifactId> </dependency> <dependency> <groupId>org.qi4j.library</groupId> - <artifactId>qi4j-lib-locking</artifactId> + <artifactId>org.qi4j.library.locking</artifactId> </dependency> <dependency> <groupId>net.java.dev.jets3t</groupId> @@ -38,7 +38,7 @@ <!-- For Tests --> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-testsupport</artifactId> + <artifactId>org.qi4j.core.testsupport</artifactId> <scope>test</scope> </dependency> </dependencies> http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-s3/src/main/java/org/qi4j/entitystore/s3/S3SerializationStoreMixin.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-s3/src/main/java/org/qi4j/entitystore/s3/S3SerializationStoreMixin.java b/extensions/entitystore-s3/src/main/java/org/qi4j/entitystore/s3/S3SerializationStoreMixin.java index ae2547d..1278f76 100644 --- a/extensions/entitystore-s3/src/main/java/org/qi4j/entitystore/s3/S3SerializationStoreMixin.java +++ b/extensions/entitystore-s3/src/main/java/org/qi4j/entitystore/s3/S3SerializationStoreMixin.java @@ -92,9 +92,11 @@ public class S3SerializationStoreMixin { return new Input<Reader, IOException>() { - public <ReceiverThrowableType extends Throwable> void transferTo( Output<Reader, ReceiverThrowableType> readerReceiverThrowableTypeOutput ) throws IOException, ReceiverThrowableType + public <ReceiverThrowableType extends Throwable> void transferTo( Output<? super Reader, ReceiverThrowableType> output ) + throws IOException, ReceiverThrowableType { // TODO Implement this + throw new UnsupportedOperationException( "Not supported yet." ); } }; } http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-s3/src/test/java/org/qi4j/entitystore/s3/S3EntityStoreTest.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-s3/src/test/java/org/qi4j/entitystore/s3/S3EntityStoreTest.java b/extensions/entitystore-s3/src/test/java/org/qi4j/entitystore/s3/S3EntityStoreTest.java index d0cdc54..57d6fe8 100644 --- a/extensions/entitystore-s3/src/test/java/org/qi4j/entitystore/s3/S3EntityStoreTest.java +++ b/extensions/entitystore-s3/src/test/java/org/qi4j/entitystore/s3/S3EntityStoreTest.java @@ -34,7 +34,7 @@ public abstract class S3EntityStoreTest super.assemble( module ); module.addServices( S3EntityStoreService.class ).instantiateOnStartup(); - ModuleAssembly config = module.layerAssembly().moduleAssembly( "config" ); + ModuleAssembly config = module.layer().module( "config" ); config.addEntities( S3Configuration.class ).visibleIn( Visibility.layer ); config.addServices( MemoryEntityStoreService.class ); } http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-swift/pom.xml ---------------------------------------------------------------------- diff --git a/extensions/entitystore-swift/pom.xml b/extensions/entitystore-swift/pom.xml index cef5e13..95a6cbf 100644 --- a/extensions/entitystore-swift/pom.xml +++ b/extensions/entitystore-swift/pom.xml @@ -1,47 +1,47 @@ <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</groupId> - <artifactId>qi4j-extensions</artifactId> - <version>1.3-SNAPSHOT</version> - </parent> + <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-swift</artifactId> - <name>Qi4j Extension - Entity Store - Swift</name> - <packaging>bundle</packaging> + <name>Qi4j Extension - EntityStore - Swift</name> + <packaging>jar</packaging> <properties> - <version.qi4j-tests>1.3-SNAPSHOT</version.qi4j-tests> + <version.qi4j-tests>1.3</version.qi4j-tests> </properties> <dependencies> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-spi</artifactId> + <artifactId>org.qi4j.core.spi</artifactId> </dependency> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-bootstrap</artifactId> + <artifactId>org.qi4j.core.bootstrap</artifactId> </dependency> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-testsupport</artifactId> + <artifactId>org.qi4j.core.testsupport</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.qi4j.library</groupId> - <artifactId>qi4j-lib-locking</artifactId> + <artifactId>org.qi4j.library.locking</artifactId> </dependency> <dependency> <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-runtime</artifactId> + <artifactId>org.qi4j.core.runtime</artifactId> <scope>test</scope> </dependency> <dependency> - <groupId>org.qi4j.tests</groupId> - <artifactId>qi4j-tests-performance</artifactId> - <version>${version.qi4j-tests}</version> + <groupId>org.qi4j.test</groupId> + <artifactId>org.qi4j.test.performance</artifactId> + <version>1.3.0.RC1</version> <scope>test</scope> </dependency> </dependencies> http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-swift/src/main/java/org/qi4j/entitystore/swift/DataStore.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-swift/src/main/java/org/qi4j/entitystore/swift/DataStore.java b/extensions/entitystore-swift/src/main/java/org/qi4j/entitystore/swift/DataStore.java index 7568b80..85563f7 100644 --- a/extensions/entitystore-swift/src/main/java/org/qi4j/entitystore/swift/DataStore.java +++ b/extensions/entitystore-swift/src/main/java/org/qi4j/entitystore/swift/DataStore.java @@ -390,42 +390,39 @@ public class DataStore { return new Input<Reader, IOException>() { - public <ReceiverThrowableType extends Throwable> void transferTo( Output<Reader, ReceiverThrowableType> output ) throws IOException, ReceiverThrowableType + public <ReceiverThrowableType extends Throwable> void transferTo( Output<? super Reader, ReceiverThrowableType> output ) + throws IOException, ReceiverThrowableType { - output.receiveFrom( new Sender<Reader, IOException>() - { - public <ReceiverThrowableType extends Throwable> void sendTo( Receiver<Reader, ReceiverThrowableType> receiver ) throws ReceiverThrowableType, IOException + output.receiveFrom( + new Sender<Reader, IOException>() { - try + public <ReceiverThrowableType extends Throwable> void sendTo( Receiver<? super Reader, ReceiverThrowableType> receiver ) + throws ReceiverThrowableType, IOException { long position = DATA_AREA_OFFSET; - while (position < dataFile.length()) + while( position < dataFile.length() ) { dataFile.seek( position ); int blockSize = dataFile.readInt(); - if (blockSize == -1) // EOF marker + if( blockSize == -1 ) // EOF marker { return; } - if (blockSize == 0) + if( blockSize == 0 ) { // TODO This is a bug. Why does it occur?? throw new InternalError(); } position = position + blockSize; // position for next round... DataBlock block = readDataBlock( null ); - if (block != null) + if( block != null ) { receiver.receive( new StringReader( new String( block.data, "UTF-8" ) ) ); } } } - catch (IOException e) - { - throw new EntityStoreException( e ); - } } - }); + ); } }; } http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-swift/src/main/java/org/qi4j/entitystore/swift/SwiftEntityStoreAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-swift/src/main/java/org/qi4j/entitystore/swift/SwiftEntityStoreAssembler.java b/extensions/entitystore-swift/src/main/java/org/qi4j/entitystore/swift/SwiftEntityStoreAssembler.java index d81f821..43a9a66 100644 --- a/extensions/entitystore-swift/src/main/java/org/qi4j/entitystore/swift/SwiftEntityStoreAssembler.java +++ b/extensions/entitystore-swift/src/main/java/org/qi4j/entitystore/swift/SwiftEntityStoreAssembler.java @@ -37,7 +37,7 @@ public class SwiftEntityStoreAssembler public void assemble( ModuleAssembly module ) throws AssemblyException { module.addServices( SwiftEntityStoreService.class, UuidIdentityGeneratorService.class ); - ModuleAssembly config = module.layerAssembly().moduleAssembly( configurationModuleName ); + ModuleAssembly config = module.layer().module( configurationModuleName ); config.addEntities( SwiftConfiguration.class ).visibleIn( Visibility.layer ); config.addServices( MemoryEntityStoreService.class ); } http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-swift/src/test/java/org/qi4j/entitystore/swift/SwiftEntityStoreTest.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-swift/src/test/java/org/qi4j/entitystore/swift/SwiftEntityStoreTest.java b/extensions/entitystore-swift/src/test/java/org/qi4j/entitystore/swift/SwiftEntityStoreTest.java index 83f0254..e9e91df 100644 --- a/extensions/entitystore-swift/src/test/java/org/qi4j/entitystore/swift/SwiftEntityStoreTest.java +++ b/extensions/entitystore-swift/src/test/java/org/qi4j/entitystore/swift/SwiftEntityStoreTest.java @@ -33,7 +33,7 @@ public class SwiftEntityStoreTest extends AbstractEntityStoreTest super.assemble( module ); module.addServices( SwiftEntityStoreService.class, UuidIdentityGeneratorService.class ); - ModuleAssembly config = module.layerAssembly().moduleAssembly( "config" ); + ModuleAssembly config = module.layer().module( "config" ); config.addEntities( SwiftConfiguration.class ).visibleIn( Visibility.layer ); config.addServices( MemoryEntityStoreService.class ); } http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-swift/src/test/java/org/qi4j/entitystore/swift/SwiftStorePerformanceTest.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-swift/src/test/java/org/qi4j/entitystore/swift/SwiftStorePerformanceTest.java b/extensions/entitystore-swift/src/test/java/org/qi4j/entitystore/swift/SwiftStorePerformanceTest.java index 603b42e..affae56 100644 --- a/extensions/entitystore-swift/src/test/java/org/qi4j/entitystore/swift/SwiftStorePerformanceTest.java +++ b/extensions/entitystore-swift/src/test/java/org/qi4j/entitystore/swift/SwiftStorePerformanceTest.java @@ -18,14 +18,16 @@ package org.qi4j.entitystore.swift; -import org.qi4j.test.entity.performance.AbstractEntityStorePerformanceTest; +// import org.qi4j.test.entity.performance.AbstractEntityStorePerformanceTest; +import org.junit.Ignore; import org.qi4j.bootstrap.Assembler; -public class SwiftStorePerformanceTest extends AbstractEntityStorePerformanceTest +@Ignore( "Needs org.qi4j.test.performance dependency" ) +public class SwiftStorePerformanceTest // extends AbstractEntityStorePerformanceTest { public SwiftStorePerformanceTest() { - super( "SwiftEntityStore", createAssembler() ); + // super( "SwiftEntityStore", createAssembler() ); } private static Assembler createAssembler() http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-voldemort/pom.xml ---------------------------------------------------------------------- diff --git a/extensions/entitystore-voldemort/pom.xml b/extensions/entitystore-voldemort/pom.xml deleted file mode 100644 index 79a33c1..0000000 --- a/extensions/entitystore-voldemort/pom.xml +++ /dev/null @@ -1,70 +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"> - <parent> - <groupId>org.qi4j</groupId> - <artifactId>qi4j-extensions</artifactId> - <version>1.3-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <groupId>org.qi4j.extension</groupId> - <artifactId>qi4j-entitystore-voldemort</artifactId> - <name>Qi4j Extension - Entity Store - Voldemort</name> - <packaging>bundle</packaging> - - <dependencies> - <dependency> - <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-spi</artifactId> - </dependency> - <dependency> - <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-bootstrap</artifactId> - </dependency> - <dependency> - <groupId>org.qi4j.library</groupId> - <artifactId>qi4j-lib-locking</artifactId> - </dependency> - <dependency> - <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-runtime</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.qi4j.core</groupId> - <artifactId>qi4j-core-testsupport</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>voldemort</groupId> - <artifactId>voldemort</artifactId> - <version>0.81</version> - </dependency> - <dependency> - <groupId>com.google</groupId> - <artifactId>google-collect</artifactId> - <version>1.0</version> - </dependency> - <dependency> - <groupId>org.jdom</groupId> - <artifactId>jdom</artifactId> - <version>1.0</version> - </dependency> - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <version>1.2.15</version> - </dependency> - <dependency> - <groupId>commons-codec</groupId> - <artifactId>commons-codec</artifactId> - <version>1.3</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.4</version> - <scope>test</scope> - </dependency> - </dependencies> -</project> http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortAssembler.java b/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortAssembler.java deleted file mode 100644 index e28220b..0000000 --- a/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortAssembler.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2010 Niclas Hedhman <[email protected]>. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.qi4j.entitystore.voldemort; - -import org.qi4j.api.common.Visibility; -import org.qi4j.bootstrap.Assembler; -import org.qi4j.bootstrap.AssemblyException; -import org.qi4j.bootstrap.ModuleAssembly; -import org.qi4j.entitystore.memory.MemoryEntityStoreService; -import org.qi4j.spi.uuid.UuidIdentityGeneratorService; - -public class VoldemortAssembler - implements Assembler -{ - private Visibility visibility; - - public VoldemortAssembler( Visibility visibility ) - { - this.visibility = visibility; - } - - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.addServices( VoldemortEntityStoreService.class ).visibleIn( visibility ).instantiateOnStartup(); - module.addServices( UuidIdentityGeneratorService.class ).visibleIn( visibility ); - // FIXME Remove from here and update documentation accordingly - ModuleAssembly config = module.layerAssembly().moduleAssembly( "config" ); - config.addEntities( VoldemortConfiguration.class ).visibleIn( Visibility.layer ); - config.addServices( MemoryEntityStoreService.class ); - - } -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortConfiguration.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortConfiguration.java b/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortConfiguration.java deleted file mode 100644 index 0d6bf00..0000000 --- a/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortConfiguration.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2010 Niclas Hedhman <[email protected]>. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.qi4j.entitystore.voldemort; - -import java.util.List; -import org.qi4j.api.common.Optional; -import org.qi4j.api.configuration.ConfigurationComposite; -import org.qi4j.api.property.Property; -import sun.misc.JavaSecurityProtectionDomainAccess; - -public interface VoldemortConfiguration extends ConfigurationComposite -{ - @Optional - Property<String> storeName(); - - @Optional - Property<Integer> clientZoneId(); - - @Optional - Property<Integer> connectionTimeout(); - - @Optional - Property<List<String>> bootstrapUrl(); - - @Optional - Property<Boolean> enableJmx(); - - @Optional - Property<Boolean> enablePipelineRoutedStore(); - - @Optional - Property<Long> failureDetectorAsyncRecoveryInterval(); - - @Optional - Property<Long> failureDetectorBannagePeriod(); - - @Optional - Property<List<String>> failureDetectorCatastrophicErrorType(); - - @Optional - Property<String> failureDetectorImplementation(); - - @Optional - Property<Long> failureDetectoreRequestLengthThreshold(); - - @Optional - Property<Integer> failureDetectorThreshold(); - - @Optional - Property<Integer> failureDetectorThresholdCountMinimum(); - - @Optional - Property<Long> failureDetectorThreasholdInterval(); - - @Optional - Property<Integer> maxBootstrapRetries(); - - @Optional - Property<Integer> setMaxConnectionsPerNode(); - - @Optional - Property<Integer> maxQueueRequests(); - - @Optional - Property<Integer> maxThreads(); - - @Optional - Property<Integer> maxTotalConnections(); - - @Optional - Property<String> requestFormatType(); - - @Optional - Property<String> routingTier(); - - @Optional - Property<Integer> routingTimeout(); - - @Optional - Property<Integer> selectors(); - - @Optional - Property<Integer> socketBufferSize(); - - @Optional - Property<Boolean> socketKeepAlive(); - - @Optional - Property<Integer> socketTimeout(); - - @Optional - Property<Integer> threadIdleTime(); - -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortEntityStoreMixin.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortEntityStoreMixin.java b/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortEntityStoreMixin.java deleted file mode 100644 index c6d5b3b..0000000 --- a/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortEntityStoreMixin.java +++ /dev/null @@ -1,372 +0,0 @@ -/* Copyright 2010 Niclas Hedhman. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.qi4j.entitystore.voldemort; - -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.io.StringWriter; -import java.io.Writer; -import java.util.ConcurrentModificationException; -import java.util.List; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.locks.ReadWriteLock; -import org.qi4j.api.configuration.Configuration; -import org.qi4j.api.entity.EntityReference; -import org.qi4j.api.injection.scope.This; -import org.qi4j.api.injection.scope.Uses; -import org.qi4j.api.service.Activatable; -import org.qi4j.entitystore.map.MapEntityStore; -import org.qi4j.spi.entity.EntityType; -import org.qi4j.spi.entitystore.EntityNotFoundException; -import org.qi4j.spi.entitystore.EntityStoreException; -import org.qi4j.spi.service.ServiceDescriptor; -import voldemort.client.ClientConfig; -import voldemort.client.RoutingTier; -import voldemort.client.SocketStoreClientFactory; -import voldemort.client.StoreClient; -import voldemort.client.StoreClientFactory; -import voldemort.client.protocol.RequestFormatType; -import voldemort.versioning.ObsoleteVersionException; -import voldemort.versioning.Versioned; - -/** - * JDBM implementation of SerializationStore - */ -public class VoldemortEntityStoreMixin - implements Activatable, MapEntityStore -{ - @This - private ReadWriteLock lock; - - @This - private Configuration<VoldemortConfiguration> config; - - @Uses - private ServiceDescriptor descriptor; - private StoreClient<String, byte[]> client; - private StoreClientFactory factory; - - // Activatable implementation - - public void activate() - throws Exception - { - VoldemortConfiguration conf = config.configuration(); - ClientConfig config = new ClientConfig(); - { - List<String> value = conf.bootstrapUrl().get(); - if( value != null ) - { - config.setBootstrapUrls( value ); - } - else - { - config.setBootstrapUrls( "tcp://localhost:8581" ); - } - } - { - Integer id = conf.clientZoneId().get(); - if( id != null ) - { - config.setClientZoneId( id ); - } - } - { - Integer connectionTimeout = conf.connectionTimeout().get(); - if( connectionTimeout != null ) - { - config.setConnectionTimeout( connectionTimeout, TimeUnit.MILLISECONDS ); - } - } - { - Boolean enable = conf.enableJmx().get(); - if( enable != null ) - { - config.setEnableJmx( enable ); - } - } - { - Boolean enable = conf.enablePipelineRoutedStore().get(); - if( enable != null ) - { - config.setEnablePipelineRoutedStore( enable ); - } - } - { - Long recoveryInterval = conf.failureDetectorAsyncRecoveryInterval().get(); - if( recoveryInterval != null ) - { - config.setFailureDetectorAsyncRecoveryInterval( recoveryInterval ); - } - } - { - Long bannagePeriod = conf.failureDetectorBannagePeriod().get(); - if( bannagePeriod != null ) - { - config.setFailureDetectorBannagePeriod( bannagePeriod ); - } - } - { - List<String> failureDetectorCatastrophicErrorTypes = conf.failureDetectorCatastrophicErrorType().get(); - if( failureDetectorCatastrophicErrorTypes != null ) - { - config.setFailureDetectorCatastrophicErrorTypes( failureDetectorCatastrophicErrorTypes ); - } - } - { - String failureDetectorImplementation = conf.failureDetectorImplementation().get(); - if( failureDetectorImplementation != null ) - { - config.setFailureDetectorImplementation( failureDetectorImplementation ); - } - } - { - Long failureDetectorRequestLengthThreshold = conf.failureDetectoreRequestLengthThreshold().get(); - if( failureDetectorRequestLengthThreshold != null ) - { - config.setFailureDetectorRequestLengthThreshold( failureDetectorRequestLengthThreshold ); - } - } - { - Integer failureDetectorThreshold = conf.failureDetectorThreshold().get(); - if( failureDetectorThreshold != null ) - { - config.setFailureDetectorThreshold( failureDetectorThreshold ); - } - } - { - Integer detectorThresholdCountMinimum = conf.failureDetectorThresholdCountMinimum().get(); - if( detectorThresholdCountMinimum != null ) - { - config.setFailureDetectorThresholdCountMinimum( detectorThresholdCountMinimum ); - } - } - { - Long failureDetectorThresholdInterval = conf.failureDetectorThreasholdInterval().get(); - if( failureDetectorThresholdInterval != null ) - { - config.setFailureDetectorThresholdInterval( failureDetectorThresholdInterval ); - } - } - { - Integer maxBootstrapRetries = conf.maxBootstrapRetries().get(); - if( maxBootstrapRetries != null ) - { - config.setMaxBootstrapRetries( maxBootstrapRetries ); - } - } - { - Integer maxConnectionsPerNode = conf.setMaxConnectionsPerNode().get(); - if( maxConnectionsPerNode != null ) - { - config.setMaxConnectionsPerNode( maxConnectionsPerNode ); - } - } - { - Integer maxQueueRequests = conf.maxQueueRequests().get(); - if( maxQueueRequests != null ) - { - config.setMaxQueuedRequests( maxQueueRequests ); - } - } - { - Integer maxThreads = conf.maxThreads().get(); - if( maxThreads != null ) - { - config.setMaxThreads( maxThreads ); - } - } - { - Integer maxTotalConnections = conf.maxTotalConnections().get(); - if( maxTotalConnections != null ) - { - config.setMaxTotalConnections( maxTotalConnections ); - } - } - { - String formatTypeCode = conf.requestFormatType().get(); - if( formatTypeCode != null ) - { - RequestFormatType formatType = RequestFormatType.fromCode( formatTypeCode ); - config.setRequestFormatType( formatType ); - } - } - { - String routingTierString = conf.routingTier().get(); - if( routingTierString != null ) - { - RoutingTier routingTier = RoutingTier.fromDisplay( routingTierString ); - config.setRoutingTier( routingTier ); - } - } - { - Integer routingTimeout = conf.routingTimeout().get(); - if( routingTimeout != null ) - { - config.setRoutingTimeout( routingTimeout, TimeUnit.MILLISECONDS ); - } - } - { - Integer selectors = conf.selectors().get(); - if( selectors != null ) - { - config.setSelectors( selectors ); - } - } - { - Integer bufferSize = conf.socketBufferSize().get(); - if( bufferSize != null ) - { - config.setSocketBufferSize( bufferSize ); - } - } - { - Boolean socketKeepAlive = conf.socketKeepAlive().get(); - if( socketKeepAlive != null ) - { - config.setSocketKeepAlive( socketKeepAlive ); - } - } - { - Integer socketTimeout = conf.socketTimeout().get(); - if( socketTimeout != null ) - { - config.setSocketTimeout( socketTimeout, TimeUnit.MILLISECONDS ); - } - } - { - Integer idleTime = conf.threadIdleTime().get(); - if( idleTime != null ) - { - config.setThreadIdleTime( idleTime, TimeUnit.MILLISECONDS ); - } - } - factory = new SocketStoreClientFactory( config ); - // create a client that executes operations on a single store - String storeName = conf.storeName().get(); - if( storeName == null) - storeName = "qi4j-entities"; - client = factory.getStoreClient( storeName ); - - } - - public void passivate() - throws Exception - { - factory.close(); - } - - public Reader get( EntityReference entityReference ) - throws EntityStoreException - { - try - { - Versioned<byte[]> versioned = client.get( entityReference.identity() ); - if( versioned == null ) - { - throw new EntityNotFoundException( entityReference ); - } - byte[] serializedState = versioned.getValue(); - return new StringReader( new String( serializedState, "UTF-8" ) ); - } - catch( IOException e ) - { - throw new EntityStoreException( e ); - } - } - - public void applyChanges( MapChanges changes ) - throws IOException - { - try - { - changes.visitMap( new MapChanger() - { - public Writer newEntity( final EntityReference ref, EntityType entityType ) - throws IOException - { - return new StringWriter( 1000 ) - { - @Override - public void close() - throws IOException - { - super.close(); - byte[] stateArray = toString().getBytes( "UTF-8" ); - client.put( ref.identity(), stateArray ); - } - }; - } - - public Writer updateEntity( final EntityReference ref, EntityType entityType ) - throws IOException - { - return new StringWriter( 1000 ) - { - @Override - public void close() - throws IOException - { - super.close(); - byte[] stateArray = toString().getBytes( "UTF-8" ); - try - { - client.put( ref.identity(), stateArray ); - } - catch( ObsoleteVersionException e ) - { - throw new ConcurrentModificationException( - "Concurrent modification attempted for " + ref.identity() ); - } - } - } - - ; - } - - public void removeEntity( EntityReference ref, EntityType entityType ) - throws EntityNotFoundException - { - client.delete( ref.identity() ); - } - } ); - } - catch( Exception e ) - { - if( e instanceof IOException ) - { - throw (IOException) e; - } - else if( e instanceof EntityStoreException ) - { - throw (EntityStoreException) e; - } - else - { - IOException exception = new IOException(); - exception.initCause( e ); - throw exception; - } - } - } - - public void visitMap( MapEntityStoreVisitor visitor ) - { - // TODO: Can't get hold of all entities, unless storing all the keys separately, which is enormously expensive - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/23b1f5d9/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortEntityStoreService.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortEntityStoreService.java b/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortEntityStoreService.java deleted file mode 100644 index 568579a..0000000 --- a/extensions/entitystore-voldemort/src/main/java/org/qi4j/entitystore/voldemort/VoldemortEntityStoreService.java +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright 2010 Niclas Hedhman. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.qi4j.entitystore.voldemort; - -import org.qi4j.api.concern.Concerns; -import org.qi4j.api.configuration.Configuration; -import org.qi4j.api.mixin.Mixins; -import org.qi4j.api.service.Activatable; -import org.qi4j.api.service.ServiceComposite; -import org.qi4j.entitystore.map.MapEntityStoreMixin; -import org.qi4j.entitystore.map.StateStore; -import org.qi4j.library.locking.LockingAbstractComposite; -import org.qi4j.spi.entitystore.ConcurrentModificationCheckConcern; -import org.qi4j.spi.entitystore.EntityStateVersions; -import org.qi4j.spi.entitystore.EntityStore; -import org.qi4j.spi.entitystore.ExportSupport; -import org.qi4j.spi.entitystore.ImportSupport; -import org.qi4j.spi.entitystore.StateChangeNotificationConcern; - -/** - * EntityStore service backed by Voldemort. - */ - -@Concerns( { StateChangeNotificationConcern.class, ConcurrentModificationCheckConcern.class } ) -@Mixins( { MapEntityStoreMixin.class, VoldemortEntityStoreMixin.class } ) -public interface VoldemortEntityStoreService - extends EntityStore, - EntityStateVersions, - StateStore, - ServiceComposite, - Activatable, - LockingAbstractComposite, - Configuration - -{ -}
