You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@batchee.apache.org by rm...@apache.org on 2013/11/05 08:39:18 UTC

[41/62] importing batchee from github - a fork from the IBm RI

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/extras/src/test/resources/META-INF/batch-jobs/flat-file-writer.xml
----------------------------------------------------------------------
diff --git a/extensions/extras/src/test/resources/META-INF/batch-jobs/flat-file-writer.xml b/extensions/extras/src/test/resources/META-INF/batch-jobs/flat-file-writer.xml
new file mode 100644
index 0000000..5851698
--- /dev/null
+++ b/extensions/extras/src/test/resources/META-INF/batch-jobs/flat-file-writer.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  See the NOTICE file distributed with this work for additional information
+  regarding copyright ownership. 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.
+-->
+<job id="flat-writer" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
+  <step id="step1">
+    <chunk>
+      <reader ref="org.apache.batchee.extras.FlatFileItemWriterTest$TwoItemsReader"/>
+      <writer ref="flatWriter">
+        <properties>
+          <property name="output" value="#{jobParameters['output']}"/>
+        </properties>
+      </writer>
+    </chunk>
+  </step>
+</job>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/extras/src/test/resources/META-INF/batch-jobs/jdbc-batchlet.xml
----------------------------------------------------------------------
diff --git a/extensions/extras/src/test/resources/META-INF/batch-jobs/jdbc-batchlet.xml b/extensions/extras/src/test/resources/META-INF/batch-jobs/jdbc-batchlet.xml
new file mode 100644
index 0000000..ee760b3
--- /dev/null
+++ b/extensions/extras/src/test/resources/META-INF/batch-jobs/jdbc-batchlet.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  See the NOTICE file distributed with this work for additional information
+  regarding copyright ownership. 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.
+-->
+<job id="jdbcbatchlet" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
+  <step id="step1">
+    <batchlet ref="jdbcBatchlet">
+      <properties>
+        <property name="sql" value="delete from FOO f where f.name = 'titi'" />
+        <property name="driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
+        <property name="url" value="jdbc:derby:memory:jdbcbatchlet;create=true" />
+        <property name="user" value="app" />
+        <property name="password" value="app" />
+      </properties>
+    </batchlet>
+  </step>
+</job>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/extras/src/test/resources/META-INF/batch-jobs/jdbc-reader.xml
----------------------------------------------------------------------
diff --git a/extensions/extras/src/test/resources/META-INF/batch-jobs/jdbc-reader.xml b/extensions/extras/src/test/resources/META-INF/batch-jobs/jdbc-reader.xml
new file mode 100644
index 0000000..23f970c
--- /dev/null
+++ b/extensions/extras/src/test/resources/META-INF/batch-jobs/jdbc-reader.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  See the NOTICE file distributed with this work for additional information
+  regarding copyright ownership. 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.
+-->
+<job id="flat-reader" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
+  <step id="step1">
+    <chunk>
+      <reader ref="jdbcReader">
+        <properties>
+          <property name="mapper" value="org.apache.batchee.extras.JdbcReaderTest$SimpleMapper" />
+          <property name="query" value="select * from FOO where name like 't%'" />
+          <property name="driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
+          <property name="url" value="jdbc:derby:memory:jdbcreader;create=true" />
+          <property name="user" value="app" />
+          <property name="password" value="app" />
+        </properties>
+      </reader>
+      <processor ref="org.apache.batchee.extras.JdbcReaderTest$StoreItems" />
+      <writer ref="org.apache.batchee.extras.noop.NoopItemWriter" />
+    </chunk>
+  </step>
+</job>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/extras/src/test/resources/META-INF/batch-jobs/jdbc-writer.xml
----------------------------------------------------------------------
diff --git a/extensions/extras/src/test/resources/META-INF/batch-jobs/jdbc-writer.xml b/extensions/extras/src/test/resources/META-INF/batch-jobs/jdbc-writer.xml
new file mode 100644
index 0000000..325cf2b
--- /dev/null
+++ b/extensions/extras/src/test/resources/META-INF/batch-jobs/jdbc-writer.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  See the NOTICE file distributed with this work for additional information
+  regarding copyright ownership. 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.
+-->
+<job id="flat-reader" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
+  <step id="step1">
+    <chunk>
+      <reader ref="org.apache.batchee.extras.JdbcWriterTest$TwoItemsReader" />
+      <writer ref="jdbcWriter">
+        <properties>
+          <property name="mapper" value="org.apache.batchee.extras.JdbcWriterTest$SimpleMapper" />
+          <property name="sql" value="insert into FOO (name) values(?)" />
+          <property name="driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
+          <property name="url" value="jdbc:derby:memory:jdbcwriter;create=true" />
+          <property name="user" value="app" />
+          <property name="password" value="app" />
+        </properties>
+      </writer>
+    </chunk>
+  </step>
+</job>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/extras/src/test/resources/META-INF/batch-jobs/jpa-reader.xml
----------------------------------------------------------------------
diff --git a/extensions/extras/src/test/resources/META-INF/batch-jobs/jpa-reader.xml b/extensions/extras/src/test/resources/META-INF/batch-jobs/jpa-reader.xml
new file mode 100644
index 0000000..b0a9b2b
--- /dev/null
+++ b/extensions/extras/src/test/resources/META-INF/batch-jobs/jpa-reader.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  See the NOTICE file distributed with this work for additional information
+  regarding copyright ownership. 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.
+-->
+<job id="flat-reader" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
+  <step id="step1">
+    <chunk>
+      <reader ref="jpaReader">
+        <properties>
+          <property name="entityManagerProvider" value="org.apache.batchee.extras.util.MyProvider" />
+          <property name="query" value="select e from Person e" />
+        </properties>
+      </reader>
+      <processor ref="org.apache.batchee.extras.JpaReaderTest$StoreItems" />
+      <writer ref="org.apache.batchee.extras.noop.NoopItemWriter" />
+    </chunk>
+  </step>
+</job>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/extras/src/test/resources/META-INF/batch-jobs/jpa-writer.xml
----------------------------------------------------------------------
diff --git a/extensions/extras/src/test/resources/META-INF/batch-jobs/jpa-writer.xml b/extensions/extras/src/test/resources/META-INF/batch-jobs/jpa-writer.xml
new file mode 100644
index 0000000..64ae1fe
--- /dev/null
+++ b/extensions/extras/src/test/resources/META-INF/batch-jobs/jpa-writer.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  See the NOTICE file distributed with this work for additional information
+  regarding copyright ownership. 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.
+-->
+<job id="flat-reader" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
+  <step id="step1">
+    <chunk>
+      <reader ref="org.apache.batchee.extras.JpaWriterTest$TwoItemsReader" />
+      <writer ref="jpaWriter">
+        <properties>
+          <property name="entityManagerProvider" value="org.apache.batchee.extras.util.MyProvider" />
+          <property name="jpaTransaction" value="true" />
+        </properties>
+      </writer>
+    </chunk>
+  </step>
+</job>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/extras/src/test/resources/META-INF/batch-jobs/stax-reader.xml
----------------------------------------------------------------------
diff --git a/extensions/extras/src/test/resources/META-INF/batch-jobs/stax-reader.xml b/extensions/extras/src/test/resources/META-INF/batch-jobs/stax-reader.xml
new file mode 100644
index 0000000..9ea6ccc
--- /dev/null
+++ b/extensions/extras/src/test/resources/META-INF/batch-jobs/stax-reader.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  See the NOTICE file distributed with this work for additional information
+  regarding copyright ownership. 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.
+-->
+<job id="stax-reader" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
+  <step id="step1">
+    <chunk>
+      <reader ref="staxReader">
+        <properties>
+          <property name="input" value="#{jobParameters['input']}"/>
+          <property name="marshallingClasses" value="org.apache.batchee.extras.StaxItemReaderTest$Bar"/>
+          <property name="tag" value="bar"/>
+        </properties>
+      </reader>
+      <processor ref="org.apache.batchee.extras.StaxItemReaderTest$StoreItems" />
+      <writer ref="org.apache.batchee.extras.noop.NoopItemWriter" />
+    </chunk>
+  </step>
+</job>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/extras/src/test/resources/META-INF/batch-jobs/stax-writer.xml
----------------------------------------------------------------------
diff --git a/extensions/extras/src/test/resources/META-INF/batch-jobs/stax-writer.xml b/extensions/extras/src/test/resources/META-INF/batch-jobs/stax-writer.xml
new file mode 100644
index 0000000..9f01c2f
--- /dev/null
+++ b/extensions/extras/src/test/resources/META-INF/batch-jobs/stax-writer.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  See the NOTICE file distributed with this work for additional information
+  regarding copyright ownership. 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.
+-->
+<job id="stax-writer" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
+  <step id="step1">
+    <chunk>
+      <reader ref="org.apache.batchee.extras.StaxItemWriterTest$TwoItemsReader" />
+      <writer ref="staxWriter">
+        <properties>
+          <property name="output" value="#{jobParameters['output']}"/>
+          <property name="marshallingClasses" value="org.apache.batchee.extras.StaxItemWriterTest$Foo"/>
+        </properties>
+      </writer>
+    </chunk>
+  </step>
+</job>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/extras/src/test/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/extensions/extras/src/test/resources/META-INF/persistence.xml b/extensions/extras/src/test/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..9ade3ab
--- /dev/null
+++ b/extensions/extras/src/test/resources/META-INF/persistence.xml
@@ -0,0 +1,35 @@
+<?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.
+  -->
+<persistence version="2.0"
+             xmlns="http://java.sun.com/xml/ns/persistence"
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
+                       http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
+  <persistence-unit name="test">
+    <class>org.apache.batchee.extras.util.Person</class>
+    <properties>
+      <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+      <property name="openjpa.ConnectionURL" value="jdbc:derby:memory:jpa;create=true"/>
+      <property name="openjpa.ConnectionDriverName" value="org.apache.derby.jdbc.EmbeddedDriver"/>
+      <property name="openjpa.ConnectionUserName" value="app"/>
+      <property name="openjpa.ConnectionPassword" value="app"/>
+      <property name="openjpa.RuntimeUnenhancedClasses" value="supported"/>
+      <property name="openjpa.Log" value="DefaultLevel=WARN, Tool=INFO, SQL=INFO"/>
+    </properties>
+  </persistence-unit>
+</persistence>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/groovy/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/groovy/pom.xml b/extensions/groovy/pom.xml
new file mode 100644
index 0000000..a2252ae
--- /dev/null
+++ b/extensions/groovy/pom.xml
@@ -0,0 +1,39 @@
+<?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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <artifactId>batchee-extensions</artifactId>
+    <groupId>org.apache.batchee</groupId>
+    <version>0.0.1-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>batchee-groovy</artifactId>
+  <name>BatchEE :: Extensions :: Groovy</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.codehaus.groovy</groupId>
+      <artifactId>groovy</artifactId>
+      <version>2.1.6</version>
+    </dependency>
+  </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/groovy/src/main/java/org/apache/batchee/groovy/GroovyBatchlet.java
----------------------------------------------------------------------
diff --git a/extensions/groovy/src/main/java/org/apache/batchee/groovy/GroovyBatchlet.java b/extensions/groovy/src/main/java/org/apache/batchee/groovy/GroovyBatchlet.java
new file mode 100644
index 0000000..0a3928d
--- /dev/null
+++ b/extensions/groovy/src/main/java/org/apache/batchee/groovy/GroovyBatchlet.java
@@ -0,0 +1,55 @@
+/*
+ * 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.batchee.groovy;
+
+import javax.batch.api.BatchProperty;
+import javax.batch.api.Batchlet;
+import javax.batch.runtime.context.JobContext;
+import javax.batch.runtime.context.StepContext;
+import javax.inject.Inject;
+
+public class GroovyBatchlet implements Batchlet {
+    @Inject
+    @BatchProperty
+    private String scriptPath;
+
+    @Inject
+    private JobContext jobContext;
+
+    @Inject
+    private StepContext stepContext;
+
+    private Groovys.GroovyInstance<Batchlet> groovyInstance;
+    private Batchlet delegate = null;
+
+    @Override
+    public String process() throws Exception {
+        synchronized (this) {
+            groovyInstance = Groovys.newInstance(Batchlet.class, scriptPath, jobContext, stepContext);
+            delegate = groovyInstance.getInstance();
+        }
+
+        return delegate.process();
+    }
+
+    @Override
+    public synchronized void stop() throws Exception {
+        if (delegate != null) {
+            delegate.stop();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/groovy/src/main/java/org/apache/batchee/groovy/GroovyItemProcessor.java
----------------------------------------------------------------------
diff --git a/extensions/groovy/src/main/java/org/apache/batchee/groovy/GroovyItemProcessor.java b/extensions/groovy/src/main/java/org/apache/batchee/groovy/GroovyItemProcessor.java
new file mode 100644
index 0000000..921e171
--- /dev/null
+++ b/extensions/groovy/src/main/java/org/apache/batchee/groovy/GroovyItemProcessor.java
@@ -0,0 +1,49 @@
+/*
+ * 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.batchee.groovy;
+
+import javax.batch.api.BatchProperty;
+import javax.batch.api.chunk.ItemProcessor;
+import javax.batch.runtime.context.JobContext;
+import javax.batch.runtime.context.StepContext;
+import javax.inject.Inject;
+
+public class GroovyItemProcessor implements ItemProcessor {
+    @Inject
+    @BatchProperty
+    private String scriptPath;
+
+    @Inject
+    private JobContext jobContext;
+
+    @Inject
+    private StepContext stepContext;
+
+    private ItemProcessor delegate;
+    private Groovys.GroovyInstance<ItemProcessor> groovyInstance;
+
+    @Override
+    public Object processItem(final Object item) throws Exception {
+        groovyInstance = Groovys.newInstance(ItemProcessor.class, scriptPath, jobContext, stepContext);
+        delegate = groovyInstance.getInstance();
+        try {
+            return delegate.processItem(item);
+        } finally {
+            groovyInstance.release();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/groovy/src/main/java/org/apache/batchee/groovy/GroovyItemReader.java
----------------------------------------------------------------------
diff --git a/extensions/groovy/src/main/java/org/apache/batchee/groovy/GroovyItemReader.java b/extensions/groovy/src/main/java/org/apache/batchee/groovy/GroovyItemReader.java
new file mode 100644
index 0000000..692352f
--- /dev/null
+++ b/extensions/groovy/src/main/java/org/apache/batchee/groovy/GroovyItemReader.java
@@ -0,0 +1,71 @@
+/*
+ * 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.batchee.groovy;
+
+import javax.batch.api.BatchProperty;
+import javax.batch.api.chunk.ItemReader;
+import javax.batch.runtime.context.JobContext;
+import javax.batch.runtime.context.StepContext;
+import javax.inject.Inject;
+import java.io.Serializable;
+
+public class GroovyItemReader implements ItemReader {
+    @Inject
+    @BatchProperty
+    private String scriptPath;
+
+    @Inject
+    private JobContext jobContext;
+
+    @Inject
+    private StepContext stepContext;
+
+    private ItemReader delegate;
+    private Groovys.GroovyInstance<ItemReader> groovyInstance;
+
+    @Override
+    public void open(final Serializable checkpoint) throws Exception {
+        groovyInstance = Groovys.newInstance(ItemReader.class, scriptPath, jobContext, stepContext);
+        delegate = groovyInstance.getInstance();
+        delegate.open(checkpoint);
+    }
+
+    @Override
+    public void close() throws Exception {
+        if (delegate == null) {
+            return;
+        }
+        delegate.close();
+        groovyInstance.release();
+    }
+
+    @Override
+    public Object readItem() throws Exception {
+        if (delegate == null) {
+            return null;
+        }
+        return delegate.readItem();
+    }
+
+    @Override
+    public Serializable checkpointInfo() throws Exception {
+        if (delegate == null) {
+            return null;
+        }
+        return delegate.checkpointInfo();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/groovy/src/main/java/org/apache/batchee/groovy/GroovyItemWriter.java
----------------------------------------------------------------------
diff --git a/extensions/groovy/src/main/java/org/apache/batchee/groovy/GroovyItemWriter.java b/extensions/groovy/src/main/java/org/apache/batchee/groovy/GroovyItemWriter.java
new file mode 100644
index 0000000..173d7a9
--- /dev/null
+++ b/extensions/groovy/src/main/java/org/apache/batchee/groovy/GroovyItemWriter.java
@@ -0,0 +1,63 @@
+/*
+ * 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.batchee.groovy;
+
+import javax.batch.api.BatchProperty;
+import javax.batch.api.chunk.ItemWriter;
+import javax.batch.runtime.context.JobContext;
+import javax.batch.runtime.context.StepContext;
+import javax.inject.Inject;
+import java.io.Serializable;
+import java.util.List;
+
+public class GroovyItemWriter implements ItemWriter {
+    @Inject
+    @BatchProperty
+    private String scriptPath;
+
+    @Inject
+    private JobContext jobContext;
+
+    @Inject
+    private StepContext stepContext;
+
+    private ItemWriter delegate;
+    private Groovys.GroovyInstance<ItemWriter> groovyInstance;
+
+    @Override
+    public void open(final Serializable checkpoint) throws Exception {
+        groovyInstance = Groovys.newInstance(ItemWriter.class, scriptPath, jobContext, stepContext);
+        delegate = groovyInstance.getInstance();
+        delegate.open(checkpoint);
+    }
+
+    @Override
+    public void close() throws Exception {
+        delegate.close();
+        groovyInstance.release();
+    }
+
+    @Override
+    public void writeItems(final List<Object> items) throws Exception {
+        delegate.writeItems(items);
+    }
+
+    @Override
+    public Serializable checkpointInfo() throws Exception {
+        return delegate.checkpointInfo();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/groovy/src/main/java/org/apache/batchee/groovy/Groovys.java
----------------------------------------------------------------------
diff --git a/extensions/groovy/src/main/java/org/apache/batchee/groovy/Groovys.java b/extensions/groovy/src/main/java/org/apache/batchee/groovy/Groovys.java
new file mode 100644
index 0000000..b0c8176
--- /dev/null
+++ b/extensions/groovy/src/main/java/org/apache/batchee/groovy/Groovys.java
@@ -0,0 +1,88 @@
+/*
+ * 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.batchee.groovy;
+
+import groovy.lang.GroovyClassLoader;
+
+import javax.batch.operations.BatchRuntimeException;
+import javax.batch.runtime.context.JobContext;
+import javax.batch.runtime.context.StepContext;
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+public final class Groovys {
+    public static <T> GroovyInstance<T> newInstance(final Class<T> expected, final String path, final JobContext jobContext, final StepContext stepContext) throws IllegalAccessException, InstantiationException {
+        if (path == null) {
+            throw new BatchRuntimeException("no script configured expected");
+        }
+        final File script = new File(path);
+        if (!script.exists()) {
+            throw new BatchRuntimeException("Can't find script: " + path);
+        }
+
+        final ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+        final GroovyClassLoader loader = new GroovyClassLoader(tccl);
+
+        final Class<?> clazz;
+        try {
+            clazz = loader.parseClass(script);
+        } catch (final IOException e) {
+            throw new BatchRuntimeException(e);
+        }
+
+        final T delegate = expected.cast(clazz.newInstance());
+        injectIfBatcheeIfAvailable(tccl, delegate, jobContext, stepContext);
+        return new GroovyInstance<T>(loader, delegate);
+    }
+
+    private static <T> void injectIfBatcheeIfAvailable(final ClassLoader tccl, final T delegate, final JobContext jobContext, final StepContext stepContext) {
+        try {
+            final Class<?> dependencyInjections = tccl.loadClass("org.apache.batchee.container.util.DependencyInjections");
+            final Class<?> injectionReferences = tccl.loadClass("org.apache.batchee.container.proxy.InjectionReferences");
+            final Method inject = dependencyInjections.getMethod("injectReferences", Object.class, injectionReferences);
+            final Constructor<?> injectionReferencesConstructor = injectionReferences.getConstructors()[0]; // there is a unique constructor
+            inject.invoke(null, delegate, injectionReferencesConstructor.newInstance(jobContext, stepContext, null));
+        } catch (final Throwable th) {
+            // no-op: BatchEE is not available, injections will not be available
+        }
+    }
+
+    public static class GroovyInstance<T> {
+        private final GroovyClassLoader loader;
+        private final T instance;
+
+        public GroovyInstance(final GroovyClassLoader loader, final T instance) {
+            this.loader = loader;
+            this.instance = instance;
+        }
+
+        public void release() throws IOException {
+            loader.clearCache();
+            loader.close();
+        }
+
+        public T getInstance() {
+            return instance;
+        }
+    }
+
+    private Groovys() {
+        // no-op
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/groovy/src/main/resources/META-INF/batchee.xml
----------------------------------------------------------------------
diff --git a/extensions/groovy/src/main/resources/META-INF/batchee.xml b/extensions/groovy/src/main/resources/META-INF/batchee.xml
new file mode 100644
index 0000000..86088ea
--- /dev/null
+++ b/extensions/groovy/src/main/resources/META-INF/batchee.xml
@@ -0,0 +1,23 @@
+<?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.
+-->
+<batch-artifacts xmlns="http://xmlns.jcp.org/xml/ns/javaee">
+  <ref id="groovyReader" class="org.apache.batchee.groovy.GroovyItemReader" />
+  <ref id="groovyProcessor" class="org.apache.batchee.groovy.GroovyItemProcessor" />
+  <ref id="groovyWriter" class="org.apache.batchee.groovy.GroovyItemWriter" />
+  <ref id="groovyBatchlet" class="org.apache.batchee.groovy.GroovyBatchlet" />
+</batch-artifacts>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/groovy/src/test/java/org/apache/batchee/groovy/GroovyBatchletTest.java
----------------------------------------------------------------------
diff --git a/extensions/groovy/src/test/java/org/apache/batchee/groovy/GroovyBatchletTest.java b/extensions/groovy/src/test/java/org/apache/batchee/groovy/GroovyBatchletTest.java
new file mode 100644
index 0000000..831ec89
--- /dev/null
+++ b/extensions/groovy/src/test/java/org/apache/batchee/groovy/GroovyBatchletTest.java
@@ -0,0 +1,58 @@
+/*
+ * 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.batchee.groovy;
+
+import org.apache.batchee.groovy.util.IOs;
+import org.apache.batchee.util.Batches;
+import org.testng.annotations.Test;
+
+import javax.batch.operations.JobOperator;
+import javax.batch.runtime.BatchRuntime;
+import java.util.Properties;
+
+import static org.testng.Assert.assertEquals;
+
+public class GroovyBatchletTest {
+    @Test
+    public void read() {
+        IOs.write("target/work/batchlet.groovy", "package org.apache.batchee.groovy\n" +
+            "\n" +
+            "import javax.batch.api.Batchlet\n" +
+            "import javax.batch.runtime.context.JobContext\n" +
+            "import javax.inject.Inject\n" +
+            "\n" +
+            "class GBatchlet implements Batchlet {\n" +
+            "    @Inject\n" +
+            "    JobContext ctx\n" +
+            "\n" +
+            "    @Override\n" +
+            "    String process() throws Exception {\n" +
+            "        ctx.setExitStatus(\"G\")\n" +
+            "        null\n" +
+            "    }\n" +
+            "\n" +
+            "    @Override\n" +
+            "    void stop() throws Exception {\n" +
+            "        //no-op\n" +
+            "    }\n" +
+            "}\n");
+        final JobOperator operator = BatchRuntime.getJobOperator();
+        final long id = operator.start("groovy-batchlet", new Properties());
+        Batches.waitForEnd(operator, id);
+        assertEquals(operator.getJobExecution(id).getExitStatus(), "G");
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/groovy/src/test/java/org/apache/batchee/groovy/GroovyProcessorTest.java
----------------------------------------------------------------------
diff --git a/extensions/groovy/src/test/java/org/apache/batchee/groovy/GroovyProcessorTest.java b/extensions/groovy/src/test/java/org/apache/batchee/groovy/GroovyProcessorTest.java
new file mode 100644
index 0000000..9c53cc7
--- /dev/null
+++ b/extensions/groovy/src/test/java/org/apache/batchee/groovy/GroovyProcessorTest.java
@@ -0,0 +1,105 @@
+/*
+ * 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.batchee.groovy;
+
+import org.apache.batchee.groovy.util.IOs;
+import org.apache.batchee.util.Batches;
+import org.testng.annotations.Test;
+
+import javax.batch.api.chunk.ItemReader;
+import javax.batch.api.chunk.ItemWriter;
+import javax.batch.operations.JobOperator;
+import javax.batch.runtime.BatchRuntime;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.testng.Assert.assertEquals;
+
+public class GroovyProcessorTest {
+    public static final List<Object> ITEMS = new ArrayList<Object>(2);
+
+    @Test
+    public void process() {
+        IOs.write("target/work/processor.groovy", "package org.apache.batchee.groovy\n" +
+            "\n" +
+            "import javax.batch.api.chunk.ItemProcessor\n" +
+            "\n" +
+            "class GProcessor implements ItemProcessor {\n" +
+            "    @Override\n" +
+            "    Object processItem(final Object item) throws Exception {\n" +
+            "        GroovyProcessorTest.ITEMS << item\n" +
+            "        item\n" +
+            "    }\n" +
+            "}\n");
+        final JobOperator operator = BatchRuntime.getJobOperator();
+        Batches.waitForEnd(operator, operator.start("groovy-processor", new Properties()));
+        assertEquals(ITEMS.size(), 2);
+        assertEquals("g_1", ITEMS.get(0));
+        assertEquals("g_2", ITEMS.get(1));
+    }
+
+    public static class Writer implements ItemWriter {
+        @Override
+        public void open(final Serializable checkpoint) throws Exception {
+            // no-op
+        }
+
+        @Override
+        public void close() throws Exception {
+            // no-op
+        }
+
+        @Override
+        public void writeItems(final List<Object> items) throws Exception {
+            // no-op
+        }
+
+        @Override
+        public Serializable checkpointInfo() throws Exception {
+            return null;
+        }
+    }
+
+    public static class Reader implements ItemReader {
+        private int count = 0;
+
+        @Override
+        public void open(final Serializable checkpoint) throws Exception {
+            // no-op
+        }
+
+        @Override
+        public void close() throws Exception {
+            // no-op
+        }
+
+        @Override
+        public Object readItem() throws Exception {
+            if (count++ < 2) {
+                return "g_" + count;
+            }
+            return null;
+        }
+
+        @Override
+        public Serializable checkpointInfo() throws Exception {
+            return null;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/groovy/src/test/java/org/apache/batchee/groovy/GroovyReaderTest.java
----------------------------------------------------------------------
diff --git a/extensions/groovy/src/test/java/org/apache/batchee/groovy/GroovyReaderTest.java b/extensions/groovy/src/test/java/org/apache/batchee/groovy/GroovyReaderTest.java
new file mode 100644
index 0000000..7bd2a3a
--- /dev/null
+++ b/extensions/groovy/src/test/java/org/apache/batchee/groovy/GroovyReaderTest.java
@@ -0,0 +1,97 @@
+/*
+ * 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.batchee.groovy;
+
+import org.apache.batchee.groovy.util.IOs;
+import org.apache.batchee.util.Batches;
+import org.testng.annotations.Test;
+
+import javax.batch.api.chunk.ItemWriter;
+import javax.batch.operations.JobOperator;
+import javax.batch.runtime.BatchRuntime;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.testng.Assert.assertEquals;
+
+public class GroovyReaderTest {
+    @Test
+    public void read() {
+        IOs.write("target/work/reader.groovy", "package org.apache.batchee.groovy\n" +
+            "\n" +
+            "import javax.batch.api.chunk.ItemReader\n" +
+            "\n" +
+            "class GReader implements ItemReader {\n" +
+            "    def count = 0\n" +
+            "\n" +
+            "    @Override\n" +
+            "    void open(Serializable checkpoint) throws Exception {\n" +
+            "\n" +
+            "    }\n" +
+            "\n" +
+            "    @Override\n" +
+            "    void close() throws Exception {\n" +
+            "\n" +
+            "    }\n" +
+            "\n" +
+            "    @Override\n" +
+            "    Object readItem() throws Exception {\n" +
+            "        if (count++ < 2) {\n" +
+            "            \"groovy_\" + count\n" +
+            "        } else {\n" +
+            "            null\n" +
+            "        }\n" +
+            "    }\n" +
+            "\n" +
+            "    @Override\n" +
+            "    Serializable checkpointInfo() throws Exception {\n" +
+            "        return null\n" +
+            "    }\n" +
+            "}\n");
+        final JobOperator operator = BatchRuntime.getJobOperator();
+        Batches.waitForEnd(operator, operator.start("groovy-reader", new Properties()));
+        assertEquals(Writer.ITEMS.size(), 2);
+        assertEquals("groovy_1", Writer.ITEMS.get(0));
+        assertEquals("groovy_2", Writer.ITEMS.get(1));
+    }
+
+    public static class Writer implements ItemWriter {
+        public static List<Object> ITEMS = new ArrayList<Object>(2);
+
+        @Override
+        public void open(final Serializable checkpoint) throws Exception {
+            // no-op
+        }
+
+        @Override
+        public void close() throws Exception {
+            // no-op
+        }
+
+        @Override
+        public void writeItems(final List<Object> items) throws Exception {
+            ITEMS.addAll(items);
+        }
+
+        @Override
+        public Serializable checkpointInfo() throws Exception {
+            return null;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/groovy/src/test/java/org/apache/batchee/groovy/GroovyWriterTest.java
----------------------------------------------------------------------
diff --git a/extensions/groovy/src/test/java/org/apache/batchee/groovy/GroovyWriterTest.java b/extensions/groovy/src/test/java/org/apache/batchee/groovy/GroovyWriterTest.java
new file mode 100644
index 0000000..eb73be0
--- /dev/null
+++ b/extensions/groovy/src/test/java/org/apache/batchee/groovy/GroovyWriterTest.java
@@ -0,0 +1,126 @@
+/*
+ * 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.batchee.groovy;
+
+import org.apache.batchee.groovy.util.IOs;
+import org.apache.batchee.util.Batches;
+import org.testng.annotations.Test;
+
+import javax.batch.api.chunk.ItemReader;
+import javax.batch.operations.JobOperator;
+import javax.batch.runtime.BatchRuntime;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.testng.Assert.assertEquals;
+
+public class GroovyWriterTest {
+    public static final List<Object> ITEMS = new ArrayList<Object>(2);
+
+    @Test
+    public void write() {
+        // put items in ITEMS
+        IOs.write("target/work/writer.groovy", "package org.apache.batchee.groovy\n" +
+            "\n" +
+            "import javax.batch.api.chunk.ItemWriter\n" +
+            "\n" +
+            "class GWriter implements ItemWriter {\n" +
+            "    @Override\n" +
+            "    void open(Serializable checkpoint) throws Exception {\n" +
+            "\n" +
+            "    }\n" +
+            "\n" +
+            "    @Override\n" +
+            "    void close() throws Exception {\n" +
+            "\n" +
+            "    }\n" +
+            "\n" +
+            "    @Override\n" +
+            "    void writeItems(List<Object> items) throws Exception {\n" +
+            "        GroovyWriterTest.ITEMS.addAll(items)\n" +
+            "    }\n" +
+            "\n" +
+            "    @Override\n" +
+            "    Serializable checkpointInfo() throws Exception {\n" +
+            "        return null\n" +
+            "    }\n" +
+            "}");
+        final JobOperator operator = BatchRuntime.getJobOperator();
+        Batches.waitForEnd(operator, operator.start("groovy-writer", new Properties()));
+        assertEquals(ITEMS.size(), 2);
+        assertEquals("g_1", ITEMS.get(0));
+        assertEquals("g_2", ITEMS.get(1));
+
+        // clear ITEMS
+        IOs.write("target/work/writer.groovy", "package org.apache.batchee.groovy\n" +
+            "\n" +
+            "import javax.batch.api.chunk.ItemWriter\n" +
+            "\n" +
+            "class GWriter implements ItemWriter {\n" +
+            "    @Override\n" +
+            "    void open(Serializable checkpoint) throws Exception {\n" +
+            "\n" +
+            "    }\n" +
+            "\n" +
+            "    @Override\n" +
+            "    void close() throws Exception {\n" +
+            "\n" +
+            "    }\n" +
+            "\n" +
+            "    @Override\n" +
+            "    void writeItems(List<Object> items) throws Exception {\n" +
+            "        GroovyWriterTest.ITEMS.clear()\n" +
+            "    }\n" +
+            "\n" +
+            "    @Override\n" +
+            "    Serializable checkpointInfo() throws Exception {\n" +
+            "        return null\n" +
+            "    }\n" +
+            "}");
+        Batches.waitForEnd(operator, operator.start("groovy-writer", new Properties()));
+        assertEquals(ITEMS.size(), 0);
+    }
+
+    public static class Reader implements ItemReader {
+        private int count = 0;
+
+        @Override
+        public void open(final Serializable checkpoint) throws Exception {
+            // no-op
+        }
+
+        @Override
+        public void close() throws Exception {
+            // no-op
+        }
+
+        @Override
+        public Object readItem() throws Exception {
+            if (count++ < 2) {
+                return "g_" + count;
+            }
+            return null;
+        }
+
+        @Override
+        public Serializable checkpointInfo() throws Exception {
+            return null;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/groovy/src/test/java/org/apache/batchee/groovy/util/IOs.java
----------------------------------------------------------------------
diff --git a/extensions/groovy/src/test/java/org/apache/batchee/groovy/util/IOs.java b/extensions/groovy/src/test/java/org/apache/batchee/groovy/util/IOs.java
new file mode 100644
index 0000000..92b3e4a
--- /dev/null
+++ b/extensions/groovy/src/test/java/org/apache/batchee/groovy/util/IOs.java
@@ -0,0 +1,42 @@
+/*
+ * 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.batchee.groovy.util;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+public class IOs {
+    public static void write(final String path, final String content) {
+        final File file = new File(path);
+        if (!file.getParentFile().exists() && !file.getParentFile().mkdirs()) {
+            throw new RuntimeException("Can't create " + path);
+        }
+
+        try {
+            final FileWriter writer = new FileWriter(file);
+            writer.write(content);
+            writer.close();
+        } catch (final IOException e) {
+            // no-op
+        }
+    }
+
+    private IOs() {
+        // no-op
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/groovy/src/test/resources/META-INF/batch-jobs/groovy-batchlet.xml
----------------------------------------------------------------------
diff --git a/extensions/groovy/src/test/resources/META-INF/batch-jobs/groovy-batchlet.xml b/extensions/groovy/src/test/resources/META-INF/batch-jobs/groovy-batchlet.xml
new file mode 100644
index 0000000..b375dc8
--- /dev/null
+++ b/extensions/groovy/src/test/resources/META-INF/batch-jobs/groovy-batchlet.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  See the NOTICE file distributed with this work for additional information
+  regarding copyright ownership. 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.
+-->
+<job id="flat-reader" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
+  <step id="step1">
+    <batchlet ref="groovyBatchlet">
+      <properties>
+        <property name="scriptPath" value="target/work/batchlet.groovy"/>
+      </properties>
+    </batchlet>
+  </step>
+</job>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/groovy/src/test/resources/META-INF/batch-jobs/groovy-processor.xml
----------------------------------------------------------------------
diff --git a/extensions/groovy/src/test/resources/META-INF/batch-jobs/groovy-processor.xml b/extensions/groovy/src/test/resources/META-INF/batch-jobs/groovy-processor.xml
new file mode 100644
index 0000000..150edf4
--- /dev/null
+++ b/extensions/groovy/src/test/resources/META-INF/batch-jobs/groovy-processor.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  See the NOTICE file distributed with this work for additional information
+  regarding copyright ownership. 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.
+-->
+<job id="flat-reader" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
+  <step id="step1">
+    <chunk>
+      <reader ref="org.apache.batchee.groovy.GroovyProcessorTest$Reader" />
+      <processor ref="groovyProcessor">
+        <properties>
+          <property name="scriptPath" value="target/work/processor.groovy"/>
+        </properties>
+      </processor>
+      <writer ref="org.apache.batchee.groovy.GroovyProcessorTest$Writer" />
+    </chunk>
+  </step>
+</job>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/groovy/src/test/resources/META-INF/batch-jobs/groovy-reader.xml
----------------------------------------------------------------------
diff --git a/extensions/groovy/src/test/resources/META-INF/batch-jobs/groovy-reader.xml b/extensions/groovy/src/test/resources/META-INF/batch-jobs/groovy-reader.xml
new file mode 100644
index 0000000..20b107a
--- /dev/null
+++ b/extensions/groovy/src/test/resources/META-INF/batch-jobs/groovy-reader.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  See the NOTICE file distributed with this work for additional information
+  regarding copyright ownership. 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.
+-->
+<job id="flat-reader" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
+  <step id="step1">
+    <chunk>
+      <reader ref="groovyReader">
+        <properties>
+          <property name="scriptPath" value="target/work/reader.groovy"/>
+        </properties>
+      </reader>
+      <writer ref="org.apache.batchee.groovy.GroovyReaderTest$Writer" />
+    </chunk>
+  </step>
+</job>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/groovy/src/test/resources/META-INF/batch-jobs/groovy-writer.xml
----------------------------------------------------------------------
diff --git a/extensions/groovy/src/test/resources/META-INF/batch-jobs/groovy-writer.xml b/extensions/groovy/src/test/resources/META-INF/batch-jobs/groovy-writer.xml
new file mode 100644
index 0000000..888165e
--- /dev/null
+++ b/extensions/groovy/src/test/resources/META-INF/batch-jobs/groovy-writer.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  See the NOTICE file distributed with this work for additional information
+  regarding copyright ownership. 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.
+-->
+<job id="flat-reader" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
+  <step id="step1">
+    <chunk>
+      <reader ref="org.apache.batchee.groovy.GroovyWriterTest$Reader" />
+      <writer ref="groovyWriter">
+        <properties>
+          <property name="scriptPath" value="target/work/writer.groovy"/>
+        </properties>
+      </writer>
+    </chunk>
+  </step>
+</job>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/hazelcast/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/hazelcast/pom.xml b/extensions/hazelcast/pom.xml
new file mode 100644
index 0000000..a8428bb
--- /dev/null
+++ b/extensions/hazelcast/pom.xml
@@ -0,0 +1,54 @@
+<?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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <artifactId>batchee-extensions</artifactId>
+    <groupId>org.apache.batchee</groupId>
+    <version>0.0.1-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>batchee-hazelcast</artifactId>
+  <name>BatchEE :: Extensions :: Hazelcast</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>com.hazelcast</groupId>
+      <artifactId>hazelcast</artifactId>
+      <version>${hazelcast.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>com.hazelcast</groupId>
+      <artifactId>hazelcast-client</artifactId>
+      <version>${hazelcast.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.testng</groupId>
+      <artifactId>testng</artifactId>
+    </dependency>
+  </dependencies>
+
+  <properties>
+    <hazelcast.version>3.1</hazelcast.version>
+  </properties>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/hazelcast/src/main/java/org/apache/batchee/hazelcast/HazelcastClientFactory.java
----------------------------------------------------------------------
diff --git a/extensions/hazelcast/src/main/java/org/apache/batchee/hazelcast/HazelcastClientFactory.java b/extensions/hazelcast/src/main/java/org/apache/batchee/hazelcast/HazelcastClientFactory.java
new file mode 100644
index 0000000..dd6caf5
--- /dev/null
+++ b/extensions/hazelcast/src/main/java/org/apache/batchee/hazelcast/HazelcastClientFactory.java
@@ -0,0 +1,35 @@
+/*
+ * 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.batchee.hazelcast;
+
+import com.hazelcast.client.HazelcastClient;
+import com.hazelcast.client.config.XmlClientConfigBuilder;
+import com.hazelcast.core.HazelcastInstance;
+
+import java.io.IOException;
+
+// just an indirection to avoid the need of hazelcast-client in the classloader
+final class HazelcastClientFactory {
+    public static HazelcastInstance newClient(final String xmlConfiguration) throws IOException {
+        return HazelcastClient.newHazelcastClient(
+            new XmlClientConfigBuilder(IOs.findConfiguration(xmlConfiguration)).build());
+    }
+
+    private HazelcastClientFactory() {
+        // no-op
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/hazelcast/src/main/java/org/apache/batchee/hazelcast/HazelcastLockBatchlet.java
----------------------------------------------------------------------
diff --git a/extensions/hazelcast/src/main/java/org/apache/batchee/hazelcast/HazelcastLockBatchlet.java b/extensions/hazelcast/src/main/java/org/apache/batchee/hazelcast/HazelcastLockBatchlet.java
new file mode 100644
index 0000000..a27c50f
--- /dev/null
+++ b/extensions/hazelcast/src/main/java/org/apache/batchee/hazelcast/HazelcastLockBatchlet.java
@@ -0,0 +1,53 @@
+/*
+ * 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.batchee.hazelcast;
+
+import javax.batch.api.BatchProperty;
+import javax.batch.api.Batchlet;
+import javax.inject.Inject;
+import java.util.concurrent.TimeUnit;
+
+public class HazelcastLockBatchlet extends HazelcastSynchroInstanceAware implements Batchlet {
+    @Inject
+    @BatchProperty
+    protected String tryDuration;
+
+    @Inject
+    @BatchProperty
+    protected String tryDurationUnit;
+
+    @Override
+    public String process() throws Exception {
+        if (tryDuration != null) {
+            findLock().lock(Long.parseLong(tryDuration), TimeUnit.valueOf(tryDurationUnit()));
+        }
+        findLock().lock();
+        return "locked";
+    }
+
+    protected String tryDurationUnit() {
+        if (tryDurationUnit == null) {
+            tryDurationUnit = TimeUnit.SECONDS.name();
+        }
+        return tryDurationUnit;
+    }
+
+    @Override
+    public void stop() throws Exception {
+        // no-op
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/hazelcast/src/main/java/org/apache/batchee/hazelcast/HazelcastMemberFactory.java
----------------------------------------------------------------------
diff --git a/extensions/hazelcast/src/main/java/org/apache/batchee/hazelcast/HazelcastMemberFactory.java b/extensions/hazelcast/src/main/java/org/apache/batchee/hazelcast/HazelcastMemberFactory.java
new file mode 100644
index 0000000..f75c9a7
--- /dev/null
+++ b/extensions/hazelcast/src/main/java/org/apache/batchee/hazelcast/HazelcastMemberFactory.java
@@ -0,0 +1,48 @@
+/*
+ * 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.batchee.hazelcast;
+
+import com.hazelcast.config.Config;
+import com.hazelcast.config.XmlConfigBuilder;
+import com.hazelcast.core.Hazelcast;
+import com.hazelcast.core.HazelcastInstance;
+
+import java.io.IOException;
+
+final class HazelcastMemberFactory {
+    public static HazelcastInstance findOrCreateMember(final String xmlConfiguration, String instanceName) throws IOException {
+        final HazelcastInstance found = Hazelcast.getHazelcastInstanceByName(instanceName);
+        if (found != null) {
+            return found;
+        }
+
+        final Config config;
+        if (xmlConfiguration != null) {
+            config =  new XmlConfigBuilder(IOs.findConfiguration(xmlConfiguration)).build();
+        } else {
+            config =  new XmlConfigBuilder().build();
+        }
+        if (instanceName != null) {
+            config.setInstanceName(instanceName);
+        }
+        return Hazelcast.newHazelcastInstance(config);
+    }
+
+    private HazelcastMemberFactory() {
+        // no-op
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/hazelcast/src/main/java/org/apache/batchee/hazelcast/HazelcastSynchroInstanceAware.java
----------------------------------------------------------------------
diff --git a/extensions/hazelcast/src/main/java/org/apache/batchee/hazelcast/HazelcastSynchroInstanceAware.java b/extensions/hazelcast/src/main/java/org/apache/batchee/hazelcast/HazelcastSynchroInstanceAware.java
new file mode 100644
index 0000000..3fbed63
--- /dev/null
+++ b/extensions/hazelcast/src/main/java/org/apache/batchee/hazelcast/HazelcastSynchroInstanceAware.java
@@ -0,0 +1,67 @@
+/*
+ * 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.batchee.hazelcast;
+
+import com.hazelcast.core.HazelcastInstance;
+import com.hazelcast.core.ILock;
+
+import javax.batch.api.BatchProperty;
+import javax.inject.Inject;
+import java.io.IOException;
+
+public class HazelcastSynchroInstanceAware {
+    @Inject
+    @BatchProperty
+    protected String instanceName;
+
+    @Inject
+    @BatchProperty
+    protected String xmlConfiguration;
+
+    @Inject
+    @BatchProperty
+    protected String local;
+
+    @Inject
+    @BatchProperty
+    protected String lockName;
+
+    protected HazelcastInstance instance() throws IOException {
+        if (local == null || "true".equalsIgnoreCase(local)) {
+            return HazelcastMemberFactory.findOrCreateMember(xmlConfiguration, instanceName());
+        }
+        return HazelcastClientFactory.newClient(xmlConfiguration);
+    }
+
+    protected String instanceName() {
+        if (instanceName == null) {
+            instanceName = "hazelcast";
+        }
+        return instanceName;
+    }
+
+    protected String lockName() {
+        if (lockName == null) {
+            lockName = getClass().getSimpleName();
+        }
+        return lockName;
+    }
+
+    protected ILock findLock() throws IOException {
+        return instance().getLock(lockName());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/hazelcast/src/main/java/org/apache/batchee/hazelcast/HazelcastUnlockBatchlet.java
----------------------------------------------------------------------
diff --git a/extensions/hazelcast/src/main/java/org/apache/batchee/hazelcast/HazelcastUnlockBatchlet.java b/extensions/hazelcast/src/main/java/org/apache/batchee/hazelcast/HazelcastUnlockBatchlet.java
new file mode 100644
index 0000000..e060591
--- /dev/null
+++ b/extensions/hazelcast/src/main/java/org/apache/batchee/hazelcast/HazelcastUnlockBatchlet.java
@@ -0,0 +1,32 @@
+/*
+ * 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.batchee.hazelcast;
+
+import javax.batch.api.Batchlet;
+
+public class HazelcastUnlockBatchlet extends HazelcastSynchroInstanceAware implements Batchlet {
+    @Override
+    public String process() throws Exception {
+        findLock().unlock();
+        return "unlocked";
+    }
+
+    @Override
+    public void stop() throws Exception {
+        // no-op
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/hazelcast/src/main/java/org/apache/batchee/hazelcast/IOs.java
----------------------------------------------------------------------
diff --git a/extensions/hazelcast/src/main/java/org/apache/batchee/hazelcast/IOs.java b/extensions/hazelcast/src/main/java/org/apache/batchee/hazelcast/IOs.java
new file mode 100644
index 0000000..0f20057
--- /dev/null
+++ b/extensions/hazelcast/src/main/java/org/apache/batchee/hazelcast/IOs.java
@@ -0,0 +1,31 @@
+/*
+ * 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.batchee.hazelcast;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+final class IOs {
+    public static InputStream findConfiguration(final String path) throws IOException {
+        if (new File(path).exists()) {
+            return new FileInputStream(path);
+        }
+        return Thread.currentThread().getContextClassLoader().getResourceAsStream(path);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/hazelcast/src/main/resources/META-INF/batchee.xml
----------------------------------------------------------------------
diff --git a/extensions/hazelcast/src/main/resources/META-INF/batchee.xml b/extensions/hazelcast/src/main/resources/META-INF/batchee.xml
new file mode 100644
index 0000000..3f09e85
--- /dev/null
+++ b/extensions/hazelcast/src/main/resources/META-INF/batchee.xml
@@ -0,0 +1,21 @@
+<?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.
+-->
+<batch-artifacts xmlns="http://xmlns.jcp.org/xml/ns/javaee">
+  <ref id="hazelcastLock" class="org.apache.batchee.hazelcast.HazelcastLockBatchlet" />
+  <ref id="hazelcastUnlock" class="org.apache.batchee.hazelcast.HazelcastUnlockBatchlet" />
+</batch-artifacts>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/hazelcast/src/test/java/org/apache/batchee/hazelcast/LockTest.java
----------------------------------------------------------------------
diff --git a/extensions/hazelcast/src/test/java/org/apache/batchee/hazelcast/LockTest.java b/extensions/hazelcast/src/test/java/org/apache/batchee/hazelcast/LockTest.java
new file mode 100644
index 0000000..d55b3ff
--- /dev/null
+++ b/extensions/hazelcast/src/test/java/org/apache/batchee/hazelcast/LockTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.batchee.hazelcast;
+
+import com.hazelcast.core.Hazelcast;
+import org.apache.batchee.util.Batches;
+import org.testng.annotations.Test;
+
+import javax.batch.api.AbstractBatchlet;
+import javax.batch.operations.JobOperator;
+import javax.batch.runtime.BatchRuntime;
+import javax.batch.runtime.BatchStatus;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+public class LockTest {
+    @Test
+    public void test() {
+        final JobOperator op = BatchRuntime.getJobOperator();
+        final long id = op.start("lock", null);
+        Batches.waitForEnd(op, id);
+        assertEquals(BatchStatus.COMPLETED, op.getJobExecution(id).getBatchStatus());
+    }
+
+    private static boolean isLocked() {
+        return Hazelcast.getHazelcastInstanceByName("batchee-test").getLock("batchee-lock").isLocked();
+    }
+
+    public static class EnsureLockIsHold extends AbstractBatchlet {
+        @Override
+        public String process() throws Exception {
+            assertTrue(isLocked());
+            return "OK";
+        }
+    }
+
+    public static class EnsureLockIsReleased extends AbstractBatchlet {
+        @Override
+        public String process() throws Exception {
+            assertFalse(isLocked());
+            return "OK";
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/hazelcast/src/test/resources/META-INF/batch-jobs/lock.xml
----------------------------------------------------------------------
diff --git a/extensions/hazelcast/src/test/resources/META-INF/batch-jobs/lock.xml b/extensions/hazelcast/src/test/resources/META-INF/batch-jobs/lock.xml
new file mode 100644
index 0000000..7216157
--- /dev/null
+++ b/extensions/hazelcast/src/test/resources/META-INF/batch-jobs/lock.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  See the NOTICE file distributed with this work for additional information
+  regarding copyright ownership. 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.
+-->
+<job id="hazelcast-lock" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
+  <step id="lock" next="check-lock">
+    <batchlet ref="hazelcastLock">
+      <properties>
+        <property name="instanceName" value="batchee-test"/>
+        <property name="lockName" value="batchee-lock"/>
+      </properties>
+    </batchlet>
+  </step>
+  <step id="check-lock" next="unlock">
+    <batchlet ref="org.apache.batchee.hazelcast.LockTest$EnsureLockIsHold" />
+  </step>
+  <step id="unlock" next="check-unlock">
+    <batchlet ref="hazelcastUnlock">
+      <properties>
+        <property name="instanceName" value="batchee-test"/>
+        <property name="lockName" value="batchee-lock"/>
+      </properties>
+    </batchlet>
+  </step>
+  <step id="check-unlock">
+    <batchlet ref="org.apache.batchee.hazelcast.LockTest$EnsureLockIsReleased" />
+  </step>
+</job>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/jackson/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/jackson/pom.xml b/extensions/jackson/pom.xml
new file mode 100644
index 0000000..1a65aac
--- /dev/null
+++ b/extensions/jackson/pom.xml
@@ -0,0 +1,48 @@
+<?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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <artifactId>batchee-extensions</artifactId>
+    <groupId>org.apache.batchee</groupId>
+    <version>0.0.1-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>batchee-jackson</artifactId>
+  <name>BatchEE :: Extensions :: Jackson</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+      <version>${jackson.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.batchee</groupId>
+      <artifactId>batchee-extras</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+
+  <properties>
+    <jackson.version>2.2.3</jackson.version>
+  </properties>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/jackson/src/main/java/org/apache/batchee/jackson/DefaultFieldNameGenerator.java
----------------------------------------------------------------------
diff --git a/extensions/jackson/src/main/java/org/apache/batchee/jackson/DefaultFieldNameGenerator.java b/extensions/jackson/src/main/java/org/apache/batchee/jackson/DefaultFieldNameGenerator.java
new file mode 100644
index 0000000..0e4cd19
--- /dev/null
+++ b/extensions/jackson/src/main/java/org/apache/batchee/jackson/DefaultFieldNameGenerator.java
@@ -0,0 +1,26 @@
+/*
+ * 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.batchee.jackson;
+
+public class DefaultFieldNameGenerator implements FieldNameGenerator {
+    private int count = 0;
+
+    @Override
+    public String nextName() {
+        return "item" + ++count;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/extensions/jackson/src/main/java/org/apache/batchee/jackson/FieldNameGenerator.java
----------------------------------------------------------------------
diff --git a/extensions/jackson/src/main/java/org/apache/batchee/jackson/FieldNameGenerator.java b/extensions/jackson/src/main/java/org/apache/batchee/jackson/FieldNameGenerator.java
new file mode 100644
index 0000000..840f524
--- /dev/null
+++ b/extensions/jackson/src/main/java/org/apache/batchee/jackson/FieldNameGenerator.java
@@ -0,0 +1,21 @@
+/*
+ * 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.batchee.jackson;
+
+public interface FieldNameGenerator {
+    String nextName();
+}