polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paulmer...@apache.org
Subject zest-java git commit: ZEST-155 Introduce Geode EntityStore
Date Mon, 13 Jun 2016 07:53:02 GMT
Repository: zest-java
Updated Branches:
  refs/heads/develop f718d3993 -> d900c623f


ZEST-155 Introduce Geode EntityStore


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

Branch: refs/heads/develop
Commit: d900c623f198d6874e11fb9bb58472d6b01836b4
Parents: f718d39
Author: Paul Merlin <paulmerlin@apache.org>
Authored: Mon Jun 13 09:52:45 2016 +0200
Committer: Paul Merlin <paulmerlin@apache.org>
Committed: Mon Jun 13 09:52:45 2016 +0200

----------------------------------------------------------------------
 build.gradle                                    |   1 +
 extensions/entitystore-geode/build.gradle       |  39 ++++
 extensions/entitystore-geode/dev-status.xml     |  38 ++++
 .../entitystore-geode/src/docs/es-geode.txt     |  51 +++++
 .../entitystore/geode/GeodeConfiguration.java   |  81 +++++++
 .../geode/GeodeEntityStoreMixin.java            | 223 +++++++++++++++++++
 .../geode/GeodeEntityStoreService.java          |  50 +++++
 .../zest/entitystore/geode/GeodeTopology.java   |  29 +++
 .../assembly/GeodeEntityStoreAssembler.java     |  51 +++++
 .../entitystore/geode/assembly/package.html     |  24 ++
 .../apache/zest/entitystore/geode/package.html  |  24 ++
 .../entitystore/geode/GeodeEntityStoreTest.java |  47 ++++
 .../geode/GeodeEntityStoreWithCacheTest.java    |  43 ++++
 libraries.gradle                                |   2 +
 manual/src/docs/userguide/extensions.txt        |   4 +
 settings.gradle                                 |   1 +
 16 files changed, 708 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/d900c623/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 0591ba7..8ebebe3 100644
--- a/build.gradle
+++ b/build.gradle
@@ -265,6 +265,7 @@ allprojects {
         candidate.license = 'BSD 3-Clause'
       }
       if( candidate.group == 'org.apache.httpcomponents'
+          || candidate.group == 'net.java.dev.jna'
           || candidate.group == 'jdbm'
           || candidate.group == 'org.osgi'
           || candidate.group.startsWith( 'org.restlet' ) ) {

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d900c623/extensions/entitystore-geode/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/entitystore-geode/build.gradle b/extensions/entitystore-geode/build.gradle
new file mode 100644
index 0000000..1b17e6c
--- /dev/null
+++ b/extensions/entitystore-geode/build.gradle
@@ -0,0 +1,39 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+
+description = "Apache Zestâ„¢ Geode EntityStore Extension"
+
+jar { manifest { name = "Apache Zestâ„¢ Extension - EntityStore - Geode" }}
+
+dependencies {
+
+    compile(project(":org.apache.zest.core:org.apache.zest.core.api"))
+    compile(project(":org.apache.zest.core:org.apache.zest.core.spi"))
+    compile(project(":org.apache.zest.core:org.apache.zest.core.bootstrap"))
+    compile(project(":org.apache.zest.libraries:org.apache.zest.library.locking"))
+    compile(libraries.geode)
+
+    testCompile(project(":org.apache.zest.core:org.apache.zest.core.testsupport"))
+    testCompile(project(":org.apache.zest.extensions:org.apache.zest.extension.valueserialization-orgjson"))
+
+    testRuntime(project(":org.apache.zest.core:org.apache.zest.core.runtime"))
+    testRuntime(libraries.logback)
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d900c623/extensions/entitystore-geode/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-geode/dev-status.xml b/extensions/entitystore-geode/dev-status.xml
new file mode 100644
index 0000000..331defe
--- /dev/null
+++ b/extensions/entitystore-geode/dev-status.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you under the Apache License, Version 2.0 (the
+  ~  "License"); you may not use this file except in compliance
+  ~  with the License.  You may obtain a copy of the License at
+  ~
+  ~       http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~  Unless required by applicable law or agreed to in writing, software
+  ~  distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~  See the License for the specific language governing permissions and
+  ~  limitations under the License.
+  ~
+  ~
+  -->
+<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
+        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+  <status>
+        <!--none,early,beta,stable,mature-->
+        <codebase>beta</codebase>
+
+        <!-- none, brief, good, complete -->
+        <documentation>brief</documentation>
+
+        <!-- none, some, good, complete -->
+        <unittests>good</unittests>
+    </status>
+    <licenses>
+        <license>ALv2</license>
+    </licenses>
+</module>

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

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d900c623/extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/GeodeConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/GeodeConfiguration.java
b/extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/GeodeConfiguration.java
new file mode 100644
index 0000000..08ad752
--- /dev/null
+++ b/extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/GeodeConfiguration.java
@@ -0,0 +1,81 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.zest.entitystore.geode;
+
+import org.apache.zest.api.common.Optional;
+import org.apache.zest.api.common.UseDefaults;
+import org.apache.zest.api.configuration.ConfigurationComposite;
+import org.apache.zest.api.property.Property;
+
+/**
+ * Geode Configuration.
+ */
+// START SNIPPET: config
+public interface GeodeConfiguration
+        extends ConfigurationComposite
+{
+    /**
+     * Geode Topology.
+     * Defaults to {@literal EMBEDDED}, see {@link GeodeTopology}.
+     *
+     * @return Geode Topology
+     */
+    @UseDefaults
+    Property<GeodeTopology> topology();
+
+    /**
+     * Geode Cache Name.
+     *
+     * @return Geode Cache Name
+     */
+    @UseDefaults( "zest:cache" )
+    Property<String> cacheName();
+
+    /**
+     * Cache properties path, loaded from the classpath.
+     *
+     * @return Cache properties path
+     */
+    @Optional
+    Property<String> cachePropertiesPath();
+
+    /**
+     * Cache Region Shortcut.
+     *
+     * In {@literal EMBEDDED} {@link #topology()}, defaults to  {@literal LOCAL},
+     * see {@link com.gemstone.gemfire.cache.RegionShortcut}.
+     *
+     * In {@literal CLIENT_SERVER} {@link #topology()}, defaults to {@literal PROXY},
+     * see {@link com.gemstone.gemfire.cache.client.ClientRegionShortcut}.
+     *
+     * @return Cache Region Shortcut
+     */
+    @Optional
+    Property<String> regionShortcut();
+
+    /**
+     * Geode Region Name.
+     *
+     * @return Geode Region Name
+     */
+    @UseDefaults( "zest:entitystore:region" )
+    Property<String> regionName();
+}
+// END SNIPPET: config

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d900c623/extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/GeodeEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/GeodeEntityStoreMixin.java
b/extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/GeodeEntityStoreMixin.java
new file mode 100644
index 0000000..0f26db2
--- /dev/null
+++ b/extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/GeodeEntityStoreMixin.java
@@ -0,0 +1,223 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.zest.entitystore.geode;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionFactory;
+import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.cache.client.ClientCache;
+import com.gemstone.gemfire.cache.client.ClientCacheFactory;
+import com.gemstone.gemfire.cache.client.ClientRegionFactory;
+import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.Map;
+import java.util.Properties;
+import org.apache.zest.api.configuration.Configuration;
+import org.apache.zest.api.entity.EntityDescriptor;
+import org.apache.zest.api.entity.EntityReference;
+import org.apache.zest.api.injection.scope.This;
+import org.apache.zest.api.service.ServiceActivation;
+import org.apache.zest.io.Input;
+import org.apache.zest.io.Output;
+import org.apache.zest.io.Receiver;
+import org.apache.zest.io.Sender;
+import org.apache.zest.spi.entitystore.EntityNotFoundException;
+import org.apache.zest.spi.entitystore.EntityStoreException;
+import org.apache.zest.spi.entitystore.helpers.MapEntityStore;
+
+/**
+ * Geode EntityStore Mixin.
+ */
+public class GeodeEntityStoreMixin
+        implements ServiceActivation, MapEntityStore
+{
+    @This
+    private Configuration<GeodeConfiguration> config;
+
+    private AutoCloseable closeable;
+    private Region<String, String> region;
+
+    @Override
+    public void activateService()
+            throws Exception
+    {
+        config.refresh();
+        GeodeConfiguration configuration = config.get();
+        switch( configuration.topology().get() )
+        {
+            case EMBEDDED:
+                activateEmbedded( configuration );
+                break;
+            case CLIENT_SERVER:
+                activateClientServer( configuration );
+                break;
+            default:
+                throw new IllegalStateException( "Invalid/Unsupported Geode Topology: "
+                                                 + configuration.topology().get() );
+        }
+    }
+
+    private void activateEmbedded( GeodeConfiguration configuration )
+            throws IOException
+    {
+        Properties cacheProperties = buildCacheProperties( configuration );
+        String regionShortcutName = configuration.regionShortcut().get();
+        RegionShortcut regionShortcut = regionShortcutName == null
+                                        ? RegionShortcut.LOCAL
+                                        : RegionShortcut.valueOf( regionShortcutName );
+        String regionName = configuration.regionName().get();
+
+        CacheFactory cacheFactory = new CacheFactory( cacheProperties );
+        Cache cache = cacheFactory.create();
+        RegionFactory<String, String> regionFactory = cache.createRegionFactory( regionShortcut
);
+        region = regionFactory.create( regionName );
+        closeable = cache;
+    }
+
+    private void activateClientServer( GeodeConfiguration configuration )
+            throws IOException
+    {
+        Properties cacheProperties = buildCacheProperties( configuration );
+        String regionShortcutName = configuration.regionShortcut().get();
+        ClientRegionShortcut regionShortcut = regionShortcutName == null
+                                              ? ClientRegionShortcut.PROXY
+                                              : ClientRegionShortcut.valueOf( regionShortcutName
);
+        String regionName = configuration.regionName().get();
+
+        ClientCacheFactory cacheFactory = new ClientCacheFactory( cacheProperties );
+        ClientCache cache = cacheFactory.create();
+        ClientRegionFactory<String, String> regionFactory = cache.createClientRegionFactory(
regionShortcut );
+        region = regionFactory.create( regionName );
+        closeable = cache;
+    }
+
+    private Properties buildCacheProperties( GeodeConfiguration config )
+            throws IOException
+    {
+        Properties properties = new Properties();
+        String cachePropertiesPath = config.cachePropertiesPath().get();
+        if( cachePropertiesPath != null )
+        {
+            try( InputStream input = getClass().getResourceAsStream( cachePropertiesPath
) )
+            {
+                if( input == null )
+                {
+                    throw new IllegalStateException( "Geode Cache Properties could not be
found: "
+                                                     + cachePropertiesPath );
+                }
+                properties.load( input );
+            }
+        }
+        properties.setProperty( "name", config.cacheName().get() );
+        return properties;
+    }
+
+    @Override
+    public void passivateService()
+            throws Exception
+    {
+        region = null;
+        if( closeable != null )
+        {
+            closeable.close();
+            closeable = null;
+        }
+    }
+
+    @Override
+    public Reader get( EntityReference entityReference ) throws EntityStoreException
+    {
+        String serializedState = region.get( entityReference.identity() );
+        if( serializedState == null )
+        {
+            throw new EntityNotFoundException( entityReference );
+        }
+        return new StringReader( serializedState );
+    }
+
+    @Override
+    public void applyChanges( MapChanges changes ) throws IOException
+    {
+        changes.visitMap( new MapChanger()
+        {
+
+            @Override
+            public Writer newEntity( final EntityReference ref, EntityDescriptor entityDescriptor
)
+                    throws IOException
+            {
+                return new StringWriter( 1000 )
+                {
+
+                    @Override
+                    public void close()
+                            throws IOException
+                    {
+                        super.close();
+                        region.put( ref.identity(), toString() );
+                    }
+                };
+            }
+
+            @Override
+            public Writer updateEntity( EntityReference ref, EntityDescriptor entityDescriptor
)
+                    throws IOException
+            {
+                return newEntity( ref, entityDescriptor );
+            }
+
+            @Override
+            public void removeEntity( EntityReference ref, EntityDescriptor entityDescriptor
)
+                    throws EntityNotFoundException
+            {
+                region.remove( ref.identity() );
+            }
+        } );
+    }
+
+    @Override
+    public Input<Reader, IOException> entityStates()
+    {
+        return new Input<Reader, IOException>()
+        {
+            @Override
+            public <ReceiverThrowableType extends Throwable> void transferTo( Output<?
super Reader, ReceiverThrowableType> output )
+                    throws IOException, ReceiverThrowableType
+            {
+                output.receiveFrom( new Sender<Reader, IOException>()
+                {
+                    @Override
+                    public <RTT extends Throwable> void sendTo( Receiver<? super
Reader, RTT> receiver )
+                            throws RTT, IOException
+                    {
+                        for( Map.Entry<String, String> eachEntry : region.entrySet()
)
+                        {
+                            receiver.receive( new StringReader( eachEntry.getValue() ) );
+                        }
+                    }
+                } );
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d900c623/extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/GeodeEntityStoreService.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/GeodeEntityStoreService.java
b/extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/GeodeEntityStoreService.java
new file mode 100644
index 0000000..e289ded
--- /dev/null
+++ b/extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/GeodeEntityStoreService.java
@@ -0,0 +1,50 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.zest.entitystore.geode;
+
+import org.apache.zest.api.concern.Concerns;
+import org.apache.zest.api.configuration.Configuration;
+import org.apache.zest.api.mixin.Mixins;
+import org.apache.zest.api.service.ServiceActivation;
+import org.apache.zest.api.service.ServiceComposite;
+import org.apache.zest.library.locking.LockingAbstractComposite;
+import org.apache.zest.spi.entitystore.ConcurrentModificationCheckConcern;
+import org.apache.zest.spi.entitystore.EntityStateVersions;
+import org.apache.zest.spi.entitystore.EntityStore;
+import org.apache.zest.spi.entitystore.StateChangeNotificationConcern;
+import org.apache.zest.spi.entitystore.helpers.JSONMapEntityStoreActivation;
+import org.apache.zest.spi.entitystore.helpers.JSONMapEntityStoreMixin;
+
+/**
+ * Geode EntityStore service.
+ * <p>Based on @{@link JSONMapEntityStoreMixin}.</p>
+ */
+@Concerns( { StateChangeNotificationConcern.class, ConcurrentModificationCheckConcern.class
} )
+@Mixins( { JSONMapEntityStoreMixin.class, GeodeEntityStoreMixin.class } )
+public interface GeodeEntityStoreService
+    extends ServiceActivation,
+            JSONMapEntityStoreActivation,
+            EntityStore,
+            EntityStateVersions,
+            ServiceComposite,
+            LockingAbstractComposite,
+            Configuration
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d900c623/extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/GeodeTopology.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/GeodeTopology.java
b/extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/GeodeTopology.java
new file mode 100644
index 0000000..8d0c112
--- /dev/null
+++ b/extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/GeodeTopology.java
@@ -0,0 +1,29 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.zest.entitystore.geode;
+
+/**
+ * Geode Topology.
+ */
+public enum GeodeTopology
+{
+    EMBEDDED,
+    CLIENT_SERVER;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d900c623/extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/assembly/GeodeEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/assembly/GeodeEntityStoreAssembler.java
b/extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/assembly/GeodeEntityStoreAssembler.java
new file mode 100644
index 0000000..8478657
--- /dev/null
+++ b/extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/assembly/GeodeEntityStoreAssembler.java
@@ -0,0 +1,51 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.zest.entitystore.geode.assembly;
+
+import org.apache.zest.bootstrap.Assemblers;
+import org.apache.zest.bootstrap.AssemblyException;
+import org.apache.zest.bootstrap.ModuleAssembly;
+import org.apache.zest.bootstrap.ServiceDeclaration;
+import org.apache.zest.entitystore.geode.GeodeConfiguration;
+import org.apache.zest.entitystore.geode.GeodeEntityStoreService;
+import org.apache.zest.spi.uuid.UuidIdentityGeneratorService;
+
+/**
+ * Assembler for the Geode EntityStore.
+ */
+public class GeodeEntityStoreAssembler
+    extends Assemblers.VisibilityIdentityConfig<GeodeEntityStoreAssembler>
+{
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        module.services( UuidIdentityGeneratorService.class ).visibleIn( visibility() );
+        ServiceDeclaration service = module.services( GeodeEntityStoreService.class ).visibleIn(
visibility() );
+        if( hasIdentity() )
+        {
+            service.identifiedBy( identity() );
+        }
+        if( hasConfig() )
+        {
+            configModule().entities( GeodeConfiguration.class ).visibleIn( configVisibility()
);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d900c623/extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/assembly/package.html
----------------------------------------------------------------------
diff --git a/extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/assembly/package.html
b/extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/assembly/package.html
new file mode 100644
index 0000000..2372b1c
--- /dev/null
+++ b/extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/assembly/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you under the Apache License, Version 2.0 (the
+  ~  "License"); you may not use this file except in compliance
+  ~  with the License.  You may obtain a copy of the License at
+  ~
+  ~       http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~  Unless required by applicable law or agreed to in writing, software
+  ~  distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~  See the License for the specific language governing permissions and
+  ~  limitations under the License.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Geode EntityStore Assembly.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d900c623/extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/package.html
----------------------------------------------------------------------
diff --git a/extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/package.html
b/extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/package.html
new file mode 100644
index 0000000..e73b7b4
--- /dev/null
+++ b/extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you under the Apache License, Version 2.0 (the
+  ~  "License"); you may not use this file except in compliance
+  ~  with the License.  You may obtain a copy of the License at
+  ~
+  ~       http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~  Unless required by applicable law or agreed to in writing, software
+  ~  distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~  See the License for the specific language governing permissions and
+  ~  limitations under the License.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Geode EntityStore.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d900c623/extensions/entitystore-geode/src/test/java/org/apache/zest/entitystore/geode/GeodeEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-geode/src/test/java/org/apache/zest/entitystore/geode/GeodeEntityStoreTest.java
b/extensions/entitystore-geode/src/test/java/org/apache/zest/entitystore/geode/GeodeEntityStoreTest.java
new file mode 100644
index 0000000..788f560
--- /dev/null
+++ b/extensions/entitystore-geode/src/test/java/org/apache/zest/entitystore/geode/GeodeEntityStoreTest.java
@@ -0,0 +1,47 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.zest.entitystore.geode;
+
+import org.apache.zest.api.common.Visibility;
+import org.apache.zest.bootstrap.AssemblyException;
+import org.apache.zest.bootstrap.ModuleAssembly;
+import org.apache.zest.entitystore.geode.assembly.GeodeEntityStoreAssembler;
+import org.apache.zest.test.EntityTestAssembler;
+import org.apache.zest.test.entity.AbstractEntityStoreTest;
+import org.apache.zest.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
+
+public class GeodeEntityStoreTest
+    extends AbstractEntityStoreTest
+{
+    @Override
+    // START SNIPPET: assembly
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        // END SNIPPET: assembly
+        super.assemble( module );
+        ModuleAssembly config = module.layer().module( "config" );
+        new EntityTestAssembler().assemble( config );
+        new OrgJsonValueSerializationAssembler().assemble( module );
+        // START SNIPPET: assembly
+        new GeodeEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble(
module );
+    }
+    // END SNIPPET: assembly
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d900c623/extensions/entitystore-geode/src/test/java/org/apache/zest/entitystore/geode/GeodeEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-geode/src/test/java/org/apache/zest/entitystore/geode/GeodeEntityStoreWithCacheTest.java
b/extensions/entitystore-geode/src/test/java/org/apache/zest/entitystore/geode/GeodeEntityStoreWithCacheTest.java
new file mode 100644
index 0000000..286585b
--- /dev/null
+++ b/extensions/entitystore-geode/src/test/java/org/apache/zest/entitystore/geode/GeodeEntityStoreWithCacheTest.java
@@ -0,0 +1,43 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.zest.entitystore.geode;
+
+import org.apache.zest.api.common.Visibility;
+import org.apache.zest.bootstrap.AssemblyException;
+import org.apache.zest.bootstrap.ModuleAssembly;
+import org.apache.zest.entitystore.geode.assembly.GeodeEntityStoreAssembler;
+import org.apache.zest.test.EntityTestAssembler;
+import org.apache.zest.test.cache.AbstractEntityStoreWithCacheTest;
+import org.apache.zest.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
+
+public class GeodeEntityStoreWithCacheTest
+        extends AbstractEntityStoreWithCacheTest
+{
+    @Override
+    public void assemble( ModuleAssembly module )
+            throws AssemblyException
+    {
+        super.assemble( module );
+        ModuleAssembly config = module.layer().module( "config" );
+        new EntityTestAssembler().assemble( config );
+        new OrgJsonValueSerializationAssembler().assemble( module );
+        new GeodeEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble(
module );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d900c623/libraries.gradle
----------------------------------------------------------------------
diff --git a/libraries.gradle b/libraries.gradle
index a185e61..cd89bb2 100644
--- a/libraries.gradle
+++ b/libraries.gradle
@@ -29,6 +29,7 @@ def dnsJavaVersion = '2.1.7'
 def ehcacheVersion = '2.10.0'
 def elasticsearchVersion = '1.6.0'
 def freemarkerVersion = '2.3.22'
+def geodeVersion = '1.0.0-incubating.M2'
 def groovyVersion = '2.4.3'
 def h2Version = '1.4.187'
 def hazelcastVersion = '3.5'
@@ -193,6 +194,7 @@ rootProject.ext {
           jodamoney: "org.joda:joda-money:$jodaMoneyVersion",
           ehcache: "net.sf.ehcache:ehcache:$ehcacheVersion",
           elasticsearch: "org.elasticsearch:elasticsearch:$elasticsearchVersion",
+          geode: "org.apache.geode:geode-core:$geodeVersion",
           h2: "com.h2database:h2:$h2Version",
           hazelcast: "com.hazelcast:hazelcast:$hazelcastVersion",
           jclouds_core: "org.apache.jclouds:jclouds-core:$jcloudsVersion",

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d900c623/manual/src/docs/userguide/extensions.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/userguide/extensions.txt b/manual/src/docs/userguide/extensions.txt
index 511578f..9d95997 100644
--- a/manual/src/docs/userguide/extensions.txt
+++ b/manual/src/docs/userguide/extensions.txt
@@ -73,6 +73,10 @@ include::../../../../extensions/entitystore-file/src/docs/es-file.txt[]
 
 :leveloffset: 2
 
+include::../../../../extensions/entitystore-geode/src/docs/es-geode.txt[]
+
+:leveloffset: 2
+
 include::../../../../extensions/entitystore-hazelcast/src/docs/es-hazelcast.txt[]
 
 :leveloffset: 2

http://git-wip-us.apache.org/repos/asf/zest-java/blob/d900c623/settings.gradle
----------------------------------------------------------------------
diff --git a/settings.gradle b/settings.gradle
index 058f616..c865591 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -64,6 +64,7 @@ include 'core:functional',
         'extensions:cache-memcache',
         'extensions:entitystore-memory',
         'extensions:entitystore-file',
+        'extensions:entitystore-geode',
         'extensions:entitystore-hazelcast',
         'extensions:entitystore-jclouds',
         'extensions:entitystore-jdbm',


Mime
View raw message