polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [2/2] zest-sandbox git commit: Gigaspaces entitystore was laying around on my disk from somewhere. committing it, to not loose it, but it is probably for pre-1.0
Date Fri, 17 Apr 2015 16:15:15 GMT
Gigaspaces entitystore was laying around on my disk from somewhere. committing it, to not loose it, but it is probably for pre-1.0


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

Branch: refs/heads/develop
Commit: c5da67d3b7cb7bc87fb06dd4f423444d7db68f50
Parents: b74044f
Author: Niclas Hedhman <niclas@hedhman.org>
Authored: Sat Apr 18 00:11:15 2015 +0800
Committer: Niclas Hedhman <niclas@hedhman.org>
Committed: Sat Apr 18 00:11:15 2015 +0800

----------------------------------------------------------------------
 .../qi4j-entitystore-gs-sample/common/pom.xml   |  25 ++++
 .../entitystore/gigaspaces/common/Data.java     | 122 +++++++++++++++++++
 .../feeder/Feeder.launch                        |  13 ++
 .../qi4j-entitystore-gs-sample/feeder/pom.xml   |  50 ++++++++
 .../feeder/src/main/assembly/assembly.xml       |  37 ++++++
 .../entitystore/gigaspaces/feeder/Feeder.java   | 101 +++++++++++++++
 .../src/main/resources/META-INF/spring/pu.xml   |  50 ++++++++
 .../qi4j-entitystore-gs-sample/pom.xml          |  69 +++++++++++
 .../processor/Processor.launch                  |  12 ++
 .../processor/Processor_2_1.launch              |  13 ++
 .../processor/pom.xml                           |  50 ++++++++
 .../processor/src/main/assembly/assembly.xml    |  37 ++++++
 .../gigaspaces/processor/Processor.java         |  44 +++++++
 .../src/main/resources/META-INF/spring/pu.xml   |  64 ++++++++++
 .../src/main/resources/META-INF/spring/sla.xml  |  20 +++
 .../ProcessorIntegrationTest-context.xml        |  58 +++++++++
 .../processor/ProcessorIntegrationTest.java     |  55 +++++++++
 .../gigaspaces/processor/ProcessorTest.java     |  25 ++++
 .../qi4j-entitystore-gs-sample/readme.txt       | 106 ++++++++++++++++
 19 files changed, 951 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/c5da67d3/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/common/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/common/pom.xml b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/common/pom.xml
new file mode 100644
index 0000000..e32f4e5
--- /dev/null
+++ b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/common/pom.xml
@@ -0,0 +1,25 @@
+<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>
+    <groupId>org.qi4j.entitystore.gigaspaces</groupId>
+    <artifactId>common</artifactId>
+    <packaging>jar</packaging>
+    <version>1.0-SNAPSHOT</version>
+    <name>common</name>
+    <parent>
+        <groupId>org.qi4j.entitystore.gigaspaces</groupId>
+        <artifactId>qi4j-entitystore-gs-sample</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <build>
+        <finalName>qi4j-entitystore-gs-sample-common</finalName>
+        <resources>
+            <resource>
+                <directory>src/main/java</directory>
+                <includes>
+                    <include>**/*.xml</include>
+                </includes>
+            </resource>
+        </resources>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/c5da67d3/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/common/src/main/java/org/qi4j/entitystore/gigaspaces/common/Data.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/common/src/main/java/org/qi4j/entitystore/gigaspaces/common/Data.java b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/common/src/main/java/org/qi4j/entitystore/gigaspaces/common/Data.java
new file mode 100644
index 0000000..b8b5838
--- /dev/null
+++ b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/common/src/main/java/org/qi4j/entitystore/gigaspaces/common/Data.java
@@ -0,0 +1,122 @@
+package org.qi4j.entitystore.gigaspaces.common;
+
+import com.gigaspaces.annotation.pojo.SpaceClass;
+import com.gigaspaces.annotation.pojo.SpaceId;
+import com.gigaspaces.annotation.pojo.SpaceRouting;
+
+
+/**
+ * A simple object used to work with the Space. Important properties include the id
+ * of the object, a type (used to perform routing when working with partitioned space),
+ * the raw data and processed data, and a boolean flag indicating if this Data object
+ * was processed or not.
+ */
+@SpaceClass
+public class Data {
+
+    private String id;
+
+    private Long type;
+
+    private String rawData;
+
+    private String data;
+
+    private Boolean processed;
+
+    /**
+     * Constructs a new Data object.
+     */
+    public Data() {
+
+    }
+
+    /**
+     * Constructs a new Data object with the given type
+     * and raw data.
+     */
+    public Data(long type, String rawData) {
+        this.type = type;
+        this.rawData = rawData;
+        this.processed = false;
+    }
+
+    /**
+     * The id of this object.
+     */
+    @SpaceId(autoGenerate=true)
+    public String getId() {
+        return id;
+    }
+
+    /**
+     * The id of this object. Its value will be auto generated when it is written
+     * to the space.
+     */
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    /**
+     * The type of the data object. Used as the routing field when working with
+     * a partitioned space.
+     */
+    @SpaceRouting
+    public Long getType() {
+        return type;
+    }
+
+    /**
+     * The type of the data object. Used as the routing field when working with
+     * a partitioned space.
+     */
+    public void setType(Long type) {
+        this.type = type;
+    }
+
+    /**
+     * The raw data this object holds.
+     */
+    public String getRawData() {
+        return rawData;
+    }
+
+    /**
+     * The raw data this object holds.
+     */
+    public void setRawData(String rawData) {
+        this.rawData = rawData;
+    }
+
+    /**
+     * The processed data this object holds.
+     */
+    public String getData() {
+        return data;
+    }
+
+    /**
+     * The processed data this object holds.
+     */
+    public void setData(String data) {
+        this.data = data;
+    }
+
+    /**
+     * A boolean flag indicating if the data object was processed or not.
+     */
+    public Boolean isProcessed() {
+        return processed;
+    }
+
+    /**
+     * A boolean flag indicating if the data object was processed or not.
+     */
+    public void setProcessed(Boolean processed) {
+        this.processed = processed;
+    }
+
+    public String toString() {
+        return "id[" + id + "] type[" + type + "] rawData[" + rawData + "] data[" + data + "] processed[" + processed + "]";
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/c5da67d3/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/feeder/Feeder.launch
----------------------------------------------------------------------
diff --git a/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/feeder/Feeder.launch b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/feeder/Feeder.launch
new file mode 100644
index 0000000..75d453e
--- /dev/null
+++ b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/feeder/Feeder.launch
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+    <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+        <listEntry value="/feeder"/>
+    </listAttribute>
+    <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+        <listEntry value="4"/>
+    </listAttribute>
+    <booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+    <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE"
+                     value="org.openspaces.pu.container.integrated.IntegratedProcessingUnitContainer"/>
+    <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="feeder"/>
+</launchConfiguration>

http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/c5da67d3/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/feeder/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/feeder/pom.xml b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/feeder/pom.xml
new file mode 100644
index 0000000..7e6c90d
--- /dev/null
+++ b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/feeder/pom.xml
@@ -0,0 +1,50 @@
+<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>
+    <groupId>org.qi4j.entitystore.gigaspaces</groupId>
+    <artifactId>feeder</artifactId>
+    <packaging>jar</packaging>
+    <version>1.0-SNAPSHOT</version>
+    <name>feeder</name>
+    <parent>
+        <groupId>org.qi4j.entitystore.gigaspaces</groupId>
+        <artifactId>qi4j-entitystore-gs-sample</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <properties>
+        <gsType>PU</gsType>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.qi4j.entitystore.gigaspaces</groupId>
+            <artifactId>common</artifactId>
+            <version>1.0-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
+    <build>
+        <finalName>qi4j-entitystore-gs-sample-feeder</finalName>
+        <plugins>
+            <plugin>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <configuration>
+                    <appendAssemblyId>false</appendAssemblyId>
+                    <attach>false</attach>
+                    <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
+                    <descriptors>
+                        <descriptor>src/main/assembly/assembly.xml</descriptor>
+                    </descriptors>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>assembly</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/c5da67d3/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/feeder/src/main/assembly/assembly.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/feeder/src/main/assembly/assembly.xml b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/feeder/src/main/assembly/assembly.xml
new file mode 100644
index 0000000..aac9f1f
--- /dev/null
+++ b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/feeder/src/main/assembly/assembly.xml
@@ -0,0 +1,37 @@
+<assembly>
+  <id>assemble-pu</id>
+  <formats>
+    <format>jar</format>
+    <format>dir</format>
+  </formats>
+  <includeBaseDirectory>false</includeBaseDirectory>
+  <fileSets>
+    <fileSet>
+      <directory>target/classes</directory>
+      <lineEnding>keep</lineEnding>
+      <outputDirectory>/</outputDirectory>
+      <includes>
+        <include>**/**</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+  <dependencySets>
+    <dependencySet>
+      <useProjectArtifact>false</useProjectArtifact>
+      <useTransitiveDependencies>false</useTransitiveDependencies>
+      <outputDirectory>lib</outputDirectory>
+      <excludes>
+        <exclude>org.qi4j.entitystore.gigaspaces:common</exclude>
+      </excludes>
+    </dependencySet>
+    <dependencySet>
+      <useProjectArtifact>false</useProjectArtifact>
+      <useTransitiveDependencies>true</useTransitiveDependencies>
+      <useTransitiveFiltering>true</useTransitiveFiltering>
+      <outputDirectory>lib</outputDirectory>
+      <includes>
+        <include>org.qi4j.entitystore.gigaspaces:common</include>
+      </includes>
+    </dependencySet>
+  </dependencySets>
+</assembly>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/c5da67d3/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/feeder/src/main/java/org/qi4j/entitystore/gigaspaces/feeder/Feeder.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/feeder/src/main/java/org/qi4j/entitystore/gigaspaces/feeder/Feeder.java b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/feeder/src/main/java/org/qi4j/entitystore/gigaspaces/feeder/Feeder.java
new file mode 100644
index 0000000..6622d96
--- /dev/null
+++ b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/feeder/src/main/java/org/qi4j/entitystore/gigaspaces/feeder/Feeder.java
@@ -0,0 +1,101 @@
+package org.qi4j.entitystore.gigaspaces.feeder;
+
+import org.qi4j.entitystore.gigaspaces.common.Data;
+
+import org.openspaces.core.GigaSpace;
+import org.openspaces.core.SpaceInterruptedException;
+import org.openspaces.core.context.GigaSpaceContext;
+
+import org.springframework.beans.factory.DisposableBean;
+import org.springframework.beans.factory.InitializingBean;
+
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeUnit;
+
+
+/**
+ * A feeder bean starts a scheduled task that writes a new Data objects to the space
+ * (in an unprocessed state).
+ *
+ * <p>The space is injected into this bean using OpenSpaces support for @GigaSpaceContext
+ * annotation.
+ *
+ * <p>The scheduling uses the java.util.concurrent Scheduled Executor Service. It
+ * is started and stopped based on Spring life cycle events.
+ *
+ * @author kimchy
+ */
+public class Feeder implements InitializingBean, DisposableBean {
+
+    private ScheduledExecutorService executorService;
+
+    private ScheduledFuture<?> sf;
+
+    private long numberOfTypes = 10;
+
+    private long defaultDelay = 1000;
+
+    private FeederTask feederTask;
+
+    @GigaSpaceContext
+    private GigaSpace gigaSpace;
+
+    /**
+     * Sets the number of types that will be used to set {@link org.openspaces.example.data.common.Data#setType(Long)}.
+     *
+     * <p>The type is used as the routing index for partitioned space. This will affect the distribution of Data
+     * objects over a partitioned space.
+     */
+    public void setNumberOfTypes(long numberOfTypes) {
+        this.numberOfTypes = numberOfTypes;
+    }
+
+    public void setDefaultDelay(long defaultDelay) {
+        this.defaultDelay = defaultDelay;
+    }
+
+    public void afterPropertiesSet() throws Exception {
+        System.out.println("--- STARTING FEEDER WITH CYCLE [" + defaultDelay + "]");
+        executorService = Executors.newScheduledThreadPool(1);
+        feederTask = new FeederTask();
+        sf = executorService.scheduleAtFixedRate(feederTask, defaultDelay, defaultDelay,
+                TimeUnit.MILLISECONDS);
+    }
+
+    public void destroy() throws Exception {
+        sf.cancel(false);
+        sf = null;
+        executorService.shutdown();
+    }
+    
+    public long getFeedCount() {
+        return feederTask.getCounter();
+    }
+
+    
+    public class FeederTask implements Runnable {
+
+        private long counter = 1;
+
+        public void run() {
+            try {
+                long time = System.currentTimeMillis();
+                Data data = new Data((counter++ % numberOfTypes), "FEEDER " + Long.toString(time));
+                gigaSpace.write(data);
+                System.out.println("--- FEEDER WROTE " + data);
+            } catch (SpaceInterruptedException e) {
+                // ignore, we are being shutdown
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+
+        public long getCounter() {
+            return counter;
+        }
+    }
+
+    
+}

http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/c5da67d3/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/feeder/src/main/resources/META-INF/spring/pu.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/feeder/src/main/resources/META-INF/spring/pu.xml b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/feeder/src/main/resources/META-INF/spring/pu.xml
new file mode 100644
index 0000000..3813bf3
--- /dev/null
+++ b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/feeder/src/main/resources/META-INF/spring/pu.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:os-core="http://www.openspaces.org/schema/core"
+       xmlns:os-events="http://www.openspaces.org/schema/events"
+       xmlns:os-remoting="http://www.openspaces.org/schema/remoting"
+       xmlns:os-sla="http://www.openspaces.org/schema/sla"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://www.openspaces.org/schema/core http://www.openspaces.org/schema/core/openspaces-core.xsd
+       http://www.openspaces.org/schema/events http://www.openspaces.org/schema/events/openspaces-events.xsd
+       http://www.openspaces.org/schema/remoting http://www.openspaces.org/schema/remoting/openspaces-remoting.xsd
+       http://www.openspaces.org/schema/sla http://www.openspaces.org/schema/sla/openspaces-sla.xsd">
+
+
+    <!--
+        Spring propery configurer which allows us to use system properties (such as user.name).
+    -->
+    <bean id="propertiesConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+        <property name="properties">
+            <props>
+                <prop key="numberOfTypes">100</prop>
+            </props>
+        </property>
+    </bean>
+
+    <!--
+        Enables the usage of @GigaSpaceContext annotation based injection.
+    -->
+    <os-core:giga-space-context/>
+
+    <!--
+        A bean representing a space (an IJSpace implementation).
+
+        Note, we perform a lookup on the space since we are working against a remote space.
+    -->
+    <os-core:space id="space" url="jini://*/*/space" />
+
+    <!--
+        OpenSpaces simplified space API built on top of IJSpace/JavaSpace.
+    -->
+    <os-core:giga-space id="gigaSpace" space="space"/>
+
+    <!--
+        The Data feeder bean, writing new Data objects to the space in a constant interval.
+    -->
+    <bean id="dataFeeder" class="org.qi4j.entitystore.gigaspaces.feeder.Feeder" depends-on="gigaSpace">
+        <property name="numberOfTypes" value="${numberOfTypes}" />
+    </bean>
+    
+</beans>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/c5da67d3/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/pom.xml b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/pom.xml
new file mode 100644
index 0000000..0b0da1d
--- /dev/null
+++ b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/pom.xml
@@ -0,0 +1,69 @@
+<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>
+    <groupId>org.qi4j.entitystore.gigaspaces</groupId>
+    <artifactId>qi4j-entitystore-gs-sample</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <name>qi4j-entitystore-gs-sample</name>
+    <packaging>pom</packaging>
+    <properties>
+        <gsVersion>7.1.2</gsVersion>
+	<springVersion>3.0.3.RELEASE</springVersion>
+    </properties>
+    <modules>
+        <module>common</module>
+        <module>processor</module>
+        <module>feeder</module>
+    </modules>
+    <dependencies>
+        <dependency>
+            <groupId>com.gigaspaces</groupId>
+            <artifactId>gs-openspaces</artifactId>
+            <version>${gsVersion}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.8.1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-test</artifactId>
+            <version>${springVersion}</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+    <build>
+        <defaultGoal>package</defaultGoal>
+        <testResources>
+            <testResource>
+                <directory>src/test/java</directory>
+                <includes>
+                    <include>**/*.xml</include>
+                </includes>
+            </testResource>
+        </testResources>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.5</source>
+                    <target>1.5</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <version>2.2-beta-2</version>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-openspaces-plugin</artifactId>
+                <version>${gsVersion}</version>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/c5da67d3/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/Processor.launch
----------------------------------------------------------------------
diff --git a/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/Processor.launch b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/Processor.launch
new file mode 100644
index 0000000..c659d29
--- /dev/null
+++ b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/Processor.launch
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/processor"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.openspaces.pu.container.integrated.IntegratedProcessingUnitContainer"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="processor"/>
+</launchConfiguration>

http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/c5da67d3/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/Processor_2_1.launch
----------------------------------------------------------------------
diff --git a/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/Processor_2_1.launch b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/Processor_2_1.launch
new file mode 100644
index 0000000..074b360
--- /dev/null
+++ b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/Processor_2_1.launch
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/processor"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.openspaces.pu.container.integrated.IntegratedProcessingUnitContainer"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-cluster total_members=2,1"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="processor"/>
+</launchConfiguration>

http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/c5da67d3/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/pom.xml b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/pom.xml
new file mode 100644
index 0000000..7a2f223
--- /dev/null
+++ b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/pom.xml
@@ -0,0 +1,50 @@
+<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>
+    <groupId>org.qi4j.entitystore.gigaspaces</groupId>
+    <artifactId>processor</artifactId>
+    <packaging>jar</packaging>
+    <version>1.0-SNAPSHOT</version>
+    <name>processor</name>
+    <parent>
+        <groupId>org.qi4j.entitystore.gigaspaces</groupId>
+        <artifactId>qi4j-entitystore-gs-sample</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <properties>
+        <gsType>PU</gsType>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.qi4j.entitystore.gigaspaces</groupId>
+            <artifactId>common</artifactId>
+            <version>1.0-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
+    <build>
+        <finalName>qi4j-entitystore-gs-sample-processor</finalName>
+        <plugins>
+            <plugin>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <configuration>
+                    <appendAssemblyId>false</appendAssemblyId>
+                    <attach>false</attach>
+                    <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
+                    <descriptors>
+                        <descriptor>src/main/assembly/assembly.xml</descriptor>
+                    </descriptors>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>assembly</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/c5da67d3/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/src/main/assembly/assembly.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/src/main/assembly/assembly.xml b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/src/main/assembly/assembly.xml
new file mode 100644
index 0000000..aac9f1f
--- /dev/null
+++ b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/src/main/assembly/assembly.xml
@@ -0,0 +1,37 @@
+<assembly>
+  <id>assemble-pu</id>
+  <formats>
+    <format>jar</format>
+    <format>dir</format>
+  </formats>
+  <includeBaseDirectory>false</includeBaseDirectory>
+  <fileSets>
+    <fileSet>
+      <directory>target/classes</directory>
+      <lineEnding>keep</lineEnding>
+      <outputDirectory>/</outputDirectory>
+      <includes>
+        <include>**/**</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+  <dependencySets>
+    <dependencySet>
+      <useProjectArtifact>false</useProjectArtifact>
+      <useTransitiveDependencies>false</useTransitiveDependencies>
+      <outputDirectory>lib</outputDirectory>
+      <excludes>
+        <exclude>org.qi4j.entitystore.gigaspaces:common</exclude>
+      </excludes>
+    </dependencySet>
+    <dependencySet>
+      <useProjectArtifact>false</useProjectArtifact>
+      <useTransitiveDependencies>true</useTransitiveDependencies>
+      <useTransitiveFiltering>true</useTransitiveFiltering>
+      <outputDirectory>lib</outputDirectory>
+      <includes>
+        <include>org.qi4j.entitystore.gigaspaces:common</include>
+      </includes>
+    </dependencySet>
+  </dependencySets>
+</assembly>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/c5da67d3/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/src/main/java/org/qi4j/entitystore/gigaspaces/processor/Processor.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/src/main/java/org/qi4j/entitystore/gigaspaces/processor/Processor.java b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/src/main/java/org/qi4j/entitystore/gigaspaces/processor/Processor.java
new file mode 100644
index 0000000..5ffdf7b
--- /dev/null
+++ b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/src/main/java/org/qi4j/entitystore/gigaspaces/processor/Processor.java
@@ -0,0 +1,44 @@
+package org.qi4j.entitystore.gigaspaces.processor;
+
+import org.qi4j.entitystore.gigaspaces.common.Data;
+
+import org.openspaces.events.adapter.SpaceDataEvent;
+
+
+/**
+ * The processor simulates work done no un-processed Data object. The processData
+ * accepts a Data object, simulate work by sleeping, and then sets the processed
+ * flag to true and returns the processed Data.
+ */
+public class Processor {
+
+    private long workDuration = 100;
+
+    /**
+     * Sets the simulated work duration (in milliseconds). Default to 100.
+     */
+    public void setWorkDuration(long workDuration) {
+        this.workDuration = workDuration;
+    }
+
+    /**
+     * Process the given Data object and returning the processed Data.
+     *
+     * Can be invoked using OpenSpaces Events when a matching event
+     * occurs.
+     */
+    @SpaceDataEvent
+    public Data processData(Data data) {
+        // sleep to simulate some work
+        try {
+            Thread.sleep(workDuration);
+        } catch (InterruptedException e) {
+            // do nothing
+        }
+        data.setProcessed(true);
+        data.setData("PROCESSED : " + data.getRawData());
+        System.out.println(" ------ PROCESSED : " + data);
+        return data;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/c5da67d3/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/src/main/resources/META-INF/spring/pu.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/src/main/resources/META-INF/spring/pu.xml b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/src/main/resources/META-INF/spring/pu.xml
new file mode 100644
index 0000000..d7e98cb
--- /dev/null
+++ b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/src/main/resources/META-INF/spring/pu.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:os-core="http://www.openspaces.org/schema/core"
+       xmlns:os-events="http://www.openspaces.org/schema/events"
+       xmlns:os-remoting="http://www.openspaces.org/schema/remoting"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://www.openspaces.org/schema/core http://www.openspaces.org/schema/core/openspaces-core.xsd
+       http://www.openspaces.org/schema/events http://www.openspaces.org/schema/events/openspaces-events.xsd
+       http://www.openspaces.org/schema/remoting http://www.openspaces.org/schema/remoting/openspaces-remoting.xsd">
+
+    <!--
+        Spring property configurer which allows us to use system properties (such as user.name).
+    -->
+    <bean id="propertiesConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+
+    <!--
+        Enables the usage of @GigaSpaceContext annotation based injection.
+    -->
+    <os-core:giga-space-context/>
+ 
+    <!--
+        A bean representing a space (an IJSpace implementation).
+
+        Note, we do not specify here the cluster topology of the space. It is declated outside of
+        the processing unit or within the SLA bean.
+    -->
+    <os-core:space id="space" url="/./space" />
+ 
+    <!--
+        Defines a local Jini transaction manager.
+    -->
+    <os-core:local-tx-manager id="transactionManager" space="space"/>
+
+    <!--
+        OpenSpaces simplified space API built on top of IJSpace/JavaSpace.
+    -->
+    <os-core:giga-space id="gigaSpace" space="space" tx-manager="transactionManager"/>
+
+    <!--
+        The data processor bean
+    -->
+    <bean id="dataProcessor" class="org.qi4j.entitystore.gigaspaces.processor.Processor"/>
+
+    <!--
+        A polling event container that perfoms (by default) polling take operations against
+        the space using the provided template (in our case, and the non processed data objects).
+        Once a match is found, the data processor bean event listener is triggered using the
+        annotation adapter.
+    -->
+    <os-events:polling-container id="dataProcessorPollingEventContainer" giga-space="gigaSpace">
+        <os-events:tx-support tx-manager="transactionManager"/>
+        <os-core:template>
+            <bean class="org.qi4j.entitystore.gigaspaces.common.Data">
+                <property name="processed" value="false"/>
+            </bean>
+        </os-core:template>
+        <os-events:listener>
+            <os-events:annotation-adapter>
+                <os-events:delegate ref="dataProcessor"/>
+            </os-events:annotation-adapter>
+        </os-events:listener>
+    </os-events:polling-container>
+</beans>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/c5da67d3/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/src/main/resources/META-INF/spring/sla.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/src/main/resources/META-INF/spring/sla.xml b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/src/main/resources/META-INF/spring/sla.xml
new file mode 100644
index 0000000..83931d1
--- /dev/null
+++ b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/src/main/resources/META-INF/spring/sla.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:os-sla="http://www.openspaces.org/schema/sla"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://www.openspaces.org/schema/sla http://www.openspaces.org/schema/sla/openspaces-sla.xsd">
+
+    <!--
+        The SLA bean used when deploying this processing unit to the Service Grid.
+
+        The SLA uses a partitioned schema with primary and backup. It will create 2
+        partitions each with a single backup.
+
+        The SLA bean also mandates that a primary and a backup won't run under the same
+        GSC by setting the maxInstancesPerVM to 1.
+    -->
+    <os-sla:sla cluster-schema="partitioned-sync2backup" number-of-instances="2" number-of-backups="1"
+                max-instances-per-vm="1">
+    </os-sla:sla>
+</beans>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/c5da67d3/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/src/test/java/org/qi4j/entitystore/gigaspaces/processor/ProcessorIntegrationTest-context.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/src/test/java/org/qi4j/entitystore/gigaspaces/processor/ProcessorIntegrationTest-context.xml b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/src/test/java/org/qi4j/entitystore/gigaspaces/processor/ProcessorIntegrationTest-context.xml
new file mode 100644
index 0000000..15df896
--- /dev/null
+++ b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/src/test/java/org/qi4j/entitystore/gigaspaces/processor/ProcessorIntegrationTest-context.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:os-core="http://www.openspaces.org/schema/core"
+       xmlns:os-events="http://www.openspaces.org/schema/events"
+       xmlns:os-remoting="http://www.openspaces.org/schema/remoting"
+       xmlns:os-sla="http://www.openspaces.org/schema/sla"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://www.openspaces.org/schema/core http://www.openspaces.org/schema/core/openspaces-core.xsd
+       http://www.openspaces.org/schema/events http://www.openspaces.org/schema/events/openspaces-events.xsd
+       http://www.openspaces.org/schema/remoting http://www.openspaces.org/schema/remoting/openspaces-remoting.xsd
+       http://www.openspaces.org/schema/sla http://www.openspaces.org/schema/sla/openspaces-sla.xsd">
+
+    <!--
+        Spring property configurer which allows us to use system properties (such as user.name).
+    -->
+    <bean id="propertiesConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+
+    <!--
+        A bean representing a space (an IJSpace implementation).
+    -->
+    <os-core:space id="space" url="/./processorSpace" lookup-groups="processor-integrartion-tests" />
+
+    <!--
+        Defines a local Jini transaction manager.
+    -->
+    <os-core:local-tx-manager id="transactionManager" space="space"/>
+
+    <!--
+        OpenSpaces simplified space API built on top of IJSpace/JavaSpace.
+    -->
+    <os-core:giga-space id="gigaSpace" space="space" tx-manager="transactionManager"/>
+
+    <!--
+        The data processor bean
+    -->
+    <bean id="dataProcessor" class="org.qi4j.entitystore.gigaspaces.processor.Processor"/>
+
+    <!--
+        A polling event container that perfoms (by default) polling take operations against
+        the space using the provided template (in our case, and the non processed data objects).
+        Once a match is found, the data processor bean event listener is triggered using the
+        annotation adapter.
+    -->
+    <os-events:polling-container id="dataProcessorPollingEventContainer" giga-space="gigaSpace">
+        <os-events:tx-support tx-manager="transactionManager"/>
+        <os-core:template>
+            <bean class="org.qi4j.entitystore.gigaspaces.common.Data">
+                <property name="processed" value="false"/>
+            </bean>
+        </os-core:template>
+        <os-events:listener>
+            <os-events:annotation-adapter>
+                <os-events:delegate ref="dataProcessor"/>
+            </os-events:annotation-adapter>
+        </os-events:listener>
+    </os-events:polling-container>
+</beans>

http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/c5da67d3/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/src/test/java/org/qi4j/entitystore/gigaspaces/processor/ProcessorIntegrationTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/src/test/java/org/qi4j/entitystore/gigaspaces/processor/ProcessorIntegrationTest.java b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/src/test/java/org/qi4j/entitystore/gigaspaces/processor/ProcessorIntegrationTest.java
new file mode 100644
index 0000000..ee9aabe
--- /dev/null
+++ b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/src/test/java/org/qi4j/entitystore/gigaspaces/processor/ProcessorIntegrationTest.java
@@ -0,0 +1,55 @@
+package org.qi4j.entitystore.gigaspaces.processor;
+
+import org.qi4j.entitystore.gigaspaces.common.Data;
+
+import org.junit.runner.RunWith;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import org.openspaces.core.GigaSpace;
+
+
+/**
+ * Integration test for the Processor. Uses similar xml definition file (ProcessorIntegrationTest-context.xml)
+ * to the actual pu.xml. Writs an unprocessed Data to the Space, and verifies that it has been processed by
+ * taking a processed one from the space.
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration
+public class ProcessorIntegrationTest {
+
+    @Autowired
+    GigaSpace gigaSpace;
+
+    @Before
+    @After
+    public void clearSpace() {
+        gigaSpace.clear(null);
+    }
+
+    @Test
+    public void verifyProcessing() throws Exception {
+        // write the data to be processed to the Space
+        Data data = new Data(1, "test");
+        gigaSpace.write(data);
+
+        // create a template of the processed data (processed)
+        Data template = new Data();
+        template.setType(1l);
+        template.setProcessed(true);
+
+        // wait for the result
+        Data result = gigaSpace.take(template, 500);
+        // verify it
+        assertNotNull("No data object was processed", result);
+        assertEquals("Processed Flag is false, data was not processed", true, result.isProcessed());
+        assertEquals("Processed text mismatch", "PROCESSED : " + data.getRawData(), result.getData());
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/c5da67d3/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/src/test/java/org/qi4j/entitystore/gigaspaces/processor/ProcessorTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/src/test/java/org/qi4j/entitystore/gigaspaces/processor/ProcessorTest.java b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/src/test/java/org/qi4j/entitystore/gigaspaces/processor/ProcessorTest.java
new file mode 100644
index 0000000..f815204
--- /dev/null
+++ b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/processor/src/test/java/org/qi4j/entitystore/gigaspaces/processor/ProcessorTest.java
@@ -0,0 +1,25 @@
+package org.qi4j.entitystore.gigaspaces.processor;
+
+import org.qi4j.entitystore.gigaspaces.common.Data;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+
+/**
+ * A simple unit test that verifies the Processor processData method actually processes
+ * the Data object.
+ */
+public class ProcessorTest {
+
+    @Test
+    public void verifyProcessedFlag() {
+        Processor processor = new Processor();
+        Data data = new Data(1, "test");
+
+        Data result = processor.processData(data);
+        assertEquals("verify that the data object was processed", true, result.isProcessed());
+        assertEquals("verify the data was processed", "PROCESSED : " + data.getRawData(), result.getData());
+        assertEquals("verify the type was not changed", data.getType(), result.getType());
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/c5da67d3/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/readme.txt
----------------------------------------------------------------------
diff --git a/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/readme.txt b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/readme.txt
new file mode 100644
index 0000000..75b3019
--- /dev/null
+++ b/extensions/entitystore-gigaspaces/qi4j-entitystore-gs-sample/readme.txt
@@ -0,0 +1,106 @@
+Creates a basic SBA application with two processing units. The Feeder
+processing unit sends Data objects through the Space to a Processor.
+The Space and the Processor are collocated in the same processing unit.
+JVM: >= 5.
+
+GENERAL DESCRIPTION:
+--------------------
+
+  The project consists of three modules: common, processor and feeder. The common
+module includes all the shared resources and classes between both the processor
+and the feeder. In our case, the common module includes the "Data" class which
+is written and taken from the Space.
+
+  The processor module, which is a processing unit, starts up a Space and on top of
+it starts a polling container that performs a take from the Space of unprocessed Data
+entries. The take operation results in an "event" that will end up executing the 
+"Processor" class. The Processor "processes" the Data object (by setting its processed
+flag to true) and returns it. The return value is automatically written back to the Space.
+  The processor also comes with both a unit test and integration test that verifies its behavior.
+
+  The feeder module, which is also a processing unit, connects to a Space remotely and
+writes unprocessed Data objects to the Space (resulting in events firing up within
+the processor processing unit).
+
+BUILDING, PACKAGING, RUNNING, DEPLOYING
+---------------------------------------
+
+Quick list:
+
+* mvn compile: Compiles the project.
+* mvn os:run: Runs the project.
+* mvn test: Runs the tests in the project.
+* mvn package: Compiles and packages the project.
+* mvn os:run-standalone: Runs a packaged application (from the jars).
+* mvn os:deploy: Deploys the project onto the Service Grid.
+* mvn os:undeploy: Removes the project from the Service Grid.
+
+  In order to build the example, a simple "mvn compile" executed from the root of the 
+project will compile all the different modules.
+
+  Packaging the application can be done using "mvn package" (note, by default, it also
+runs the tests, in order to disable it, use -DskipTests). The packaging process jars up 
+the common module. The feeder and processor modules packaging process creates a 
+"processing unit structure" directory within the target directory called [app-name]-[module].
+It also creates a jar from the mentioned directory called [app-name]-[module].jar.
+
+  In order to simply run both the processor and the feeder (after compiling), "mvn os:run" can be used.
+This will run a single instance of the processor and a single instance of the feeder within
+the same JVM using the compilation level classpath (no need for packaging). 
+  A specific module can also be executed by itself, which in this case, executing more than 
+one instance of the processing unit can be done. For example, running the processor module with 
+a cluster topology of 2 partitions, each with one backup, the following command can be used:
+mvn os:run -Dmodule=processor -Dcluster="total_members=2,1".
+
+  In order to run a packaged processing unit, "mvn package os:run-standalone" can be used (if
+"mvn package" was already executed, it can be omitted). This operation will run the processing units
+using the packaged jar files. Running a specific module with a cluster topology can be executed using:
+mvn package os:run-standalone -Dmodule=processor -Dcluster="total_members=2,1".
+
+  Deploying the application requires starting up a GSM and at least 2 GSCs (scripts located under
+the bin directory within the GigaSpaces installation). Once started, running "mvn package os:deploy"
+will deploy the two processing units. 
+  When deploying, the SLA elements within each processing unit descriptor (pu.xml) are taken into 
+account. This means that by default when deploying the application, 2 partitions, each with 
+one backup will be created for the processor, and a single instance of the feeder will be created.
+  A special note regarding groups and deployment: If the GSM and GSCs were started under a specific 
+group, the -Dgroups=[group-name] will need to be used in the deploy command.
+
+WORKING WITH ECLIPSE
+--------------------
+
+  In order to generate eclipse project the following command need to be executed from the root of
+the application: "mvn eclipse:eclipse". Pointing the Eclipse import existing project wizard
+to the application root directory will result in importing the three modules.
+If this is a fresh Eclipse installation, the M2_REPO needs be defined and pointed to the local 
+maven repository (which resides under USER_HOME/.m2/repository).
+
+  The application itself comes with built in launch targets allowing to run the processor and the 
+feeder using Eclipse run (or debug) targets.
+
+A NOTE OF CLUSTERING
+--------------------
+
+  This application focus on showing how SBA is used. The processor starts up an embedded Space and 
+works directly on it. When deploying 2 partitions of the processor, two embedded spaces (within the
+same cluster) will be created, with each polling container working only on the cluster member it 
+started in an in memory and transactional manner. This is the power of such an architecture, where
+the processing of the Data happens in a collocated manner with the Data. If we want to add High
+Availability to the processor, we can deploy 2 partitions, each with one backup (2,1). In this 
+case, the processor instances that ends up starting a cluster member Space which is the backup
+will not perform any processing since the polling container identifies the Space state and won't
+perform the take operation. If one of the processor primaries instances will fail, the backup
+instance will become primary (with an up to date data), and its polling container will start
+processing all the relevant Data. Note, when deploying on top of the Service Grid, the Service
+Grid will also identify that one instance failed, and will automatically start it over in another
+container (GSC).
+
+  The feeder works with a clustered view of the Space (the 2,1 cluster topology looking as one), and 
+simply writes unprocessed Data objects to the Space. The routing (@SpaceRouting) controls to which
+partition the unprocessed Data will be written and consequently which instance will process it.
+
+MAVEN PLUGIN WIKI PAGE
+---------------------------------
+
+  For more information about the Maven Plugin please refer to:
+http://www.gigaspaces.com/wiki/display/XAP71/Maven+Plugin
\ No newline at end of file


Mime
View raw message