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:09 UTC

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

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/servlet/src/main/resources/META-INF/resources/internal/batchee/js/start.js
----------------------------------------------------------------------
diff --git a/gui/servlet/src/main/resources/META-INF/resources/internal/batchee/js/start.js b/gui/servlet/src/main/resources/META-INF/resources/internal/batchee/js/start.js
new file mode 100644
index 0000000..2f5e37d
--- /dev/null
+++ b/gui/servlet/src/main/resources/META-INF/resources/internal/batchee/js/start.js
@@ -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.
+ */
+$(function () {
+    $('#add-param').click(function () {
+        var keyEntry = $('#key');
+        var valueEntry = $('#value');
+
+        var key = keyEntry.val();
+        var value = valueEntry.val();
+
+        $('#values').append('' +
+            '<div id="cg_' + key + '" class="control-group">' +
+            '  <div class="controls" id="c_' + key + '">' +
+            '    <input type="text" name="k_' + key + '" value="' + key + '">' +
+            '    <input type="text" name="v_' + key + '" value="' + value + '">' +
+            '    <button class="btn btn-small" type="button">Remove</button>' +
+            '  </div>' +
+            '</div>');
+
+        keyEntry.val('');
+        valueEntry.val('');
+
+        var blockId = '#cg_' + key;
+        $(blockId).on('click', function(event) {
+            event.preventDefault();
+            $(blockId).remove();
+        });
+    });
+
+    $('#set-job-name').on('click', function(event) {
+        event.preventDefault();
+        $('#job-name').val($('#job-name-input').val());
+    });
+
+    $('#start-job').submit(function (event) {
+        var jobNameInput = $('#job-name-input');
+        if (jobNameInput.length) {
+            $('#job-name').val(jobNameInput.val());
+        }
+    });
+});

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/servlet/src/main/resources/META-INF/resources/internal/batchee/layout.jsp
----------------------------------------------------------------------
diff --git a/gui/servlet/src/main/resources/META-INF/resources/internal/batchee/layout.jsp b/gui/servlet/src/main/resources/META-INF/resources/internal/batchee/layout.jsp
new file mode 100644
index 0000000..fdbf9b5
--- /dev/null
+++ b/gui/servlet/src/main/resources/META-INF/resources/internal/batchee/layout.jsp
@@ -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.
+--%>
+<%@ page session="false" %>
+<% final String mapping = (String) request.getAttribute("mapping"); %>
+<html lang="en">
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <meta name="description" content="Apache JBatch GUI">
+
+    <link href="<%= request.getAttribute("context") %>/internal/batchee/css/bootstrap.min.3.0.0.css" rel="stylesheet" media="screen">
+
+    <title>Apache JBatch GUI</title>
+</head>
+
+<body>
+
+<div class="container">
+    <div class="header">
+        <ul class="nav nav-pills pull-right">
+            <li><a href="<%= mapping %>/start/">New Batch</a></li>
+            <li><a href="<%= mapping %>/">Home</a></li>
+        </ul>
+        <h3 class="text-muted">Apache JBatch GUI</h3>
+    </div>
+
+    <div id="content" class="row">
+        <jsp:include page="/internal/batchee/${requestScope.view}.jsp" />
+    </div>
+
+    <div class="footer">
+        <p>Apache &copy; Company 2013</p>
+    </div>
+</div>
+
+<script src="<%= request.getAttribute("context") %>/internal/batchee/js/jquery-2.0.3.min.js"></script>
+<script src="<%= request.getAttribute("context") %>/internal/batchee/js/bootstrap.min.3.0.0.js"></script>
+<%
+    final String pageJs = (String) request.getAttribute("pageJs");
+    if (pageJs != null) {
+        for (final String js : pageJs.split(",")) {
+%>
+<script src="<%= request.getAttribute("context") %>/internal/batchee/js/<%= js %>"></script>
+<%
+        }
+    }
+%>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/servlet/src/main/resources/META-INF/resources/internal/batchee/start.jsp
----------------------------------------------------------------------
diff --git a/gui/servlet/src/main/resources/META-INF/resources/internal/batchee/start.jsp b/gui/servlet/src/main/resources/META-INF/resources/internal/batchee/start.jsp
new file mode 100644
index 0000000..7cffa98
--- /dev/null
+++ b/gui/servlet/src/main/resources/META-INF/resources/internal/batchee/start.jsp
@@ -0,0 +1,59 @@
+<%--
+    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.
+--%>
+<%@ page import="java.net.URLEncoder" %>
+<%@ page import="org.apache.batchee.servlet.JBatchController" %>
+<%@ page session="false" %>
+
+<%
+    request.setAttribute("pageJs", "start.js");
+
+    final String name = (String) request.getAttribute("name");
+    final boolean newJob = name == null || name.isEmpty();
+    if (newJob) {
+%>
+<div>
+    Add needed job parameters and name for the new job then click on submit:
+</div>
+<% } else { %>
+<div>
+    Add needed job parameters for job <b><%= name %></b> then click on submit:
+</div>
+<% } %>
+
+<% if (newJob) { %>
+<div class="control-group">
+    <div class="controls" id="c_' + key + '">
+        <input type="text" id="job-name-input" placeholder="type job name...">
+        <button id="set-job-name" class="btn btn-small" type="button">Set Job Name</button>
+    </div>
+</div>
+<% } %>
+
+<div class="control-group">
+  <div class="controls">
+      <input type="text" id="key" placeholder="type a key...">
+      <input type="text" id="value" placeholder="type a value...">
+      <button id="add-param" class="btn btn-small" type="button">Add</button>
+  </div>
+</div>
+
+<form action="<%= request.getAttribute("mapping") %>/doStart/<%= URLEncoder.encode(name, "UTF-8") %>" method="POST"
+      class="form-horizontal">
+    <div id="values"></div>
+    <input id="job-name" type="hidden" name="<%= JBatchController.FORM_JOB_NAME %>" value="<%= name %>">
+    <button id="start-job" type="submit" class="btn">Submit</button>
+</form>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/servlet/src/main/resources/META-INF/resources/internal/batchee/step-executions.jsp
----------------------------------------------------------------------
diff --git a/gui/servlet/src/main/resources/META-INF/resources/internal/batchee/step-executions.jsp b/gui/servlet/src/main/resources/META-INF/resources/internal/batchee/step-executions.jsp
new file mode 100644
index 0000000..84dbe6c
--- /dev/null
+++ b/gui/servlet/src/main/resources/META-INF/resources/internal/batchee/step-executions.jsp
@@ -0,0 +1,51 @@
+<%--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+--%>
+<%@ page session="false" %>
+<%@ page import="org.apache.batchee.servlet.MetricsHelper" %>
+<%@ page import="javax.batch.runtime.StepExecution" %>
+<%@ page import="java.util.List" %>
+<%@ page import="org.apache.batchee.servlet.StatusHelper" %>
+
+<% final String name = (String) request.getAttribute("name"); %>
+<h4>Step executions for execution #<%= request.getAttribute("executionId") %> of <%= name %></h4>
+
+<table class="table tabl-hover">
+    <thead>
+    <tr>
+        <th>#</th>
+        <th>Step name</th>
+        <th>Batch status</th>
+        <th>Exit status</th>
+        <th>Start time</th>
+        <th>End time</th>
+        <th>Metrics</th>
+    </tr>
+    </thead>
+    <tbody>
+<% for ( final StepExecution step : (List<StepExecution>) request.getAttribute("steps") ) { %>
+    <tr class="<%= StatusHelper.statusClass(step.getBatchStatus()) %>">
+        <td><%= step.getStepExecutionId() %></td>
+        <td><%= step.getStepName() %></td>
+        <td><%= step.getBatchStatus().name() %></td>
+        <td><%= step.getExitStatus() %></td>
+        <td><%= step.getStartTime() %></td>
+        <td><%= step.getEndTime() %></td>
+        <td><%= MetricsHelper.toString(step.getMetrics()) %></td>
+    </tr>
+<% } %>
+    </tbody>
+</table>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/servlet/src/main/resources/META-INF/resources/internal/batchee/view.jsp
----------------------------------------------------------------------
diff --git a/gui/servlet/src/main/resources/META-INF/resources/internal/batchee/view.jsp b/gui/servlet/src/main/resources/META-INF/resources/internal/batchee/view.jsp
new file mode 100644
index 0000000..f6ff9f7
--- /dev/null
+++ b/gui/servlet/src/main/resources/META-INF/resources/internal/batchee/view.jsp
@@ -0,0 +1,22 @@
+<%--
+    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.
+--%>
+<%@ page session="false" %>
+
+<p>Batch <%= request.getAttribute("name") %></p>
+<pre>
+    <%= request.getAttribute("content") %>
+</pre>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/servlet/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer
----------------------------------------------------------------------
diff --git a/gui/servlet/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer b/gui/servlet/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer
new file mode 100644
index 0000000..29382ab
--- /dev/null
+++ b/gui/servlet/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer
@@ -0,0 +1 @@
+org.apache.batchee.servlet.JBatchServletInitializer

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/servlet/src/test/java/org/apache/batchee/servlet/ServletTest.java
----------------------------------------------------------------------
diff --git a/gui/servlet/src/test/java/org/apache/batchee/servlet/ServletTest.java b/gui/servlet/src/test/java/org/apache/batchee/servlet/ServletTest.java
new file mode 100644
index 0000000..122b270
--- /dev/null
+++ b/gui/servlet/src/test/java/org/apache/batchee/servlet/ServletTest.java
@@ -0,0 +1,133 @@
+/*
+ * 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.servlet;
+
+import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.DomNode;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import org.apache.batchee.servlet.util.CreateSomeJobs;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.descriptor.api.Descriptors;
+import org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.batch.runtime.BatchStatus;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+
+@RunWith(Arquillian.class)
+public class ServletTest {
+    @ArquillianResource
+    private URL base;
+
+    @Test
+    public void home() throws IOException {
+        assertEquals("init", extractContent("", "/ul/li/a[1]/text()"));
+    }
+
+    @Test
+    public void instances() throws IOException {
+        assertEquals(BatchStatus.COMPLETED.name(), extractContent("executions/init", "/table/tbody/tr/td[2]"));
+    }
+
+    @Test
+    public void steps() throws IOException {
+        assertEquals("step1", extractContent("step-executions/0", "/table/tbody/tr/td[2]"));
+    }
+
+    @Test(expected = FailingHttpStatusCodeException.class)
+    public void privateUrl() throws IOException {
+        final WebClient client = newWebClient();
+        client.getPage(base.toExternalForm() + "jbatch/internal/batchee/jobs.jsp");
+    }
+
+    private String extractContent(final String endUrl, final String xpath) throws IOException {
+        final String url = base.toExternalForm() + "jbatch/" + endUrl;
+        final WebClient webClient = newWebClient();
+
+        final HtmlPage page = webClient.getPage(url);
+        final List<?> byXPath = page.getByXPath("//div[@id=\"content\"]" + xpath);
+        assertEquals(1, byXPath.size());
+
+        final Object next = byXPath.iterator().next();
+        if (!DomNode.class.isInstance(next)) {
+            throw new IllegalArgumentException("Can't find text for " + next);
+        }
+        return DomNode.class.cast(next).asText();
+    }
+
+    private WebClient newWebClient() {
+        final WebClient webClient = new WebClient();
+        webClient.getOptions().setJavaScriptEnabled(false);
+        webClient.getOptions().setCssEnabled(false);
+        webClient.getOptions().setAppletEnabled(false);
+        return webClient;
+    }
+
+    @Deployment(testable = false)
+    public static Archive<?> war() {
+        final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "batchee-gui.war")
+            .addAsWebInfResource(new StringAsset(
+                Descriptors.create(WebAppDescriptor.class)
+                    .metadataComplete(true)
+                    .createListener()
+                        .listenerClass(CreateSomeJobs.class.getName())
+                    .up()
+                    .createFilter()
+                        .filterName("JBatch Private Filter")
+                        .filterClass(JBatchServletInitializer.PrivateFilter.class.getName())
+                    .up()
+                    .createServlet()
+                        .servletName("JBatch")
+                        .servletClass(JBatchController.class.getName())
+                        .loadOnStartup(1)
+                    .up()
+                    .createFilterMapping()
+                        .filterName("JBatch Private Filter")
+                        .urlPattern("/*")
+                    .up()
+                    .createServletMapping()
+                        .servletName("JBatch")
+                        .urlPattern("/jbatch/*")
+                    .up()
+                    .exportAsString()), "web.xml")
+            // GUI
+            .addPackages(true, JBatchController.class.getPackage())
+            // test data to create some job things to do this test
+            .addPackage(CreateSomeJobs.class.getPackage())
+            .addAsWebInfResource("META-INF/batch-jobs/init.xml", "classes/META-INF/batch-jobs/init.xml");
+
+        for (final String resource : Arrays.asList("layout.jsp", "jobs.jsp", "job-instances.jsp", "step-executions.jsp",
+                                                    "css/bootstrap.min.3.0.0.css", "js/bootstrap.min.3.0.0.js")) {
+            webArchive.addAsWebResource("META-INF/resources/internal/batchee/" + resource, "internal/batchee/" + resource);
+        }
+
+        return webArchive;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/servlet/src/test/java/org/apache/batchee/servlet/util/CreateSomeJobs.java
----------------------------------------------------------------------
diff --git a/gui/servlet/src/test/java/org/apache/batchee/servlet/util/CreateSomeJobs.java b/gui/servlet/src/test/java/org/apache/batchee/servlet/util/CreateSomeJobs.java
new file mode 100644
index 0000000..3896e4a
--- /dev/null
+++ b/gui/servlet/src/test/java/org/apache/batchee/servlet/util/CreateSomeJobs.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.servlet.util;
+
+import org.apache.batchee.util.Batches;
+
+import javax.batch.operations.JobOperator;
+import javax.batch.operations.NoSuchJobException;
+import javax.batch.runtime.BatchRuntime;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import javax.servlet.annotation.WebListener;
+import java.util.Properties;
+
+@WebListener
+public class CreateSomeJobs implements ServletContextListener {
+    @Override
+    public void contextInitialized(final ServletContextEvent sce) {
+        final JobOperator operator = BatchRuntime.getJobOperator();
+
+        try { // initialize only once to ensure we can use in tests ids
+            operator.getJobInstances("init", 0, 10);
+        } catch (final NoSuchJobException nsje) {
+            final Properties jobParameters = new Properties();
+            jobParameters.setProperty("test", "jbatch");
+            final long id = operator.start("init", jobParameters);
+            Batches.waitForEnd(operator, id);
+        }
+    }
+
+    @Override
+    public void contextDestroyed(final ServletContextEvent sce) {
+        // no-op
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/servlet/src/test/java/org/apache/batchee/servlet/util/SimpleBatchlet.java
----------------------------------------------------------------------
diff --git a/gui/servlet/src/test/java/org/apache/batchee/servlet/util/SimpleBatchlet.java b/gui/servlet/src/test/java/org/apache/batchee/servlet/util/SimpleBatchlet.java
new file mode 100644
index 0000000..afe3ddb
--- /dev/null
+++ b/gui/servlet/src/test/java/org/apache/batchee/servlet/util/SimpleBatchlet.java
@@ -0,0 +1,54 @@
+/*
+ * 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.servlet.util;
+
+import javax.batch.api.BatchProperty;
+import javax.batch.api.Batchlet;
+import javax.inject.Inject;
+
+public class SimpleBatchlet implements Batchlet {
+    @Inject
+    @BatchProperty
+    private String value;
+
+    @Inject
+    @BatchProperty
+    private String sleep;
+
+    private volatile boolean stopped = false;
+
+    @Override
+    public String process() throws Exception {
+        if (value == null) {
+            value = "OK";
+        }
+        if (sleep != null) {
+            long done = 0;
+            final long max = Long.parseLong(sleep);
+            while (done < max && !stopped) {
+                Thread.sleep(1000);
+                done += 1000;
+            }
+        }
+        return value;
+    }
+
+    @Override
+    public void stop() throws Exception {
+        stopped = true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/servlet/src/test/resources/META-INF/batch-jobs/another-job.xml
----------------------------------------------------------------------
diff --git a/gui/servlet/src/test/resources/META-INF/batch-jobs/another-job.xml b/gui/servlet/src/test/resources/META-INF/batch-jobs/another-job.xml
new file mode 100644
index 0000000..7d447ea
--- /dev/null
+++ b/gui/servlet/src/test/resources/META-INF/batch-jobs/another-job.xml
@@ -0,0 +1,25 @@
+<?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="another-job" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
+  <step id="single-step">
+    <batchlet ref="org.apache.batchee.servlet.util.SimpleBatchlet">
+      <properties>
+        <property name="value" value="#{jobParameters['value']}"/>
+        <property name="sleep" value="#{jobParameters['sleep']}"/>
+      </properties>
+    </batchlet>
+  </step>
+</job>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/servlet/src/test/resources/META-INF/batch-jobs/init.xml
----------------------------------------------------------------------
diff --git a/gui/servlet/src/test/resources/META-INF/batch-jobs/init.xml b/gui/servlet/src/test/resources/META-INF/batch-jobs/init.xml
new file mode 100644
index 0000000..3e1140f
--- /dev/null
+++ b/gui/servlet/src/test/resources/META-INF/batch-jobs/init.xml
@@ -0,0 +1,25 @@
+<?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="init" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
+  <step id="step1">
+    <batchlet ref="org.apache.batchee.servlet.util.SimpleBatchlet">
+      <properties>
+        <property name="value" value="#{jobParameters['value']}"/>
+        <property name="sleep" value="#{jobParameters['sleep']}"/>
+      </properties>
+    </batchlet>
+  </step>
+</job>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/servlet/src/test/resources/arquillian.xml
----------------------------------------------------------------------
diff --git a/gui/servlet/src/test/resources/arquillian.xml b/gui/servlet/src/test/resources/arquillian.xml
new file mode 100644
index 0000000..96514c8
--- /dev/null
+++ b/gui/servlet/src/test/resources/arquillian.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+    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.
+-->
+<arquillian xmlns="http://jboss.org/schema/arquillian"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="http://jboss.org/schema/arquillian
+                                http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
+  <container qualifier="tomcat7" default="true">
+    <configuration>
+      <property name="tomcatHome">target/tomcat7</property>
+      <property name="workDir">target/arquillian-work</property>
+      <property name="unpackArchive">true</property>
+      <property name="bindHttpPort">1234</property>
+    </configuration>
+  </container>
+</arquillian>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/pom.xml
----------------------------------------------------------------------
diff --git a/jbatch/pom.xml b/jbatch/pom.xml
new file mode 100644
index 0000000..b657ec3
--- /dev/null
+++ b/jbatch/pom.xml
@@ -0,0 +1,239 @@
+<?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-parent</artifactId>
+    <groupId>org.apache.batchee</groupId>
+    <version>0.0.1-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>batchee-jbatch</artifactId>
+  <name>BatchEE :: JBatch</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>javax.batch</groupId>
+      <artifactId>javax.batch-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-atinject_1.0_spec</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.components</groupId>
+      <artifactId>geronimo-transaction</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-servlet_3.0_spec</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-jpa_2.0_spec</artifactId>
+      <version>1.1</version>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.testng</groupId>
+      <artifactId>testng</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.derby</groupId>
+      <artifactId>derby</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>openejb-core</artifactId>
+      <version>4.6.0-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
+
+    <!--
+    To debug having TCK at classpath (to be able to debug in TCK classes and/or to get completion in dev-suite.xml):
+    1) mvn process-test-classes
+    2) cp -r target/tck/jsr352-tck-1.0/artifacts/ /tmp
+    3) activate the following dependencies
+    <dependency>
+      <groupId>tck</groupId>
+      <artifactId>tck-impl</artifactId>
+      <version>1.0</version>
+      <systemPath>/tmp/artifacts/jsr352-tck-impl.jar</systemPath>
+      <scope>system</scope>
+    </dependency>
+    <dependency>
+      <groupId>tck</groupId>
+      <artifactId>tck-SPI</artifactId>
+      <version>1.0</version>
+      <systemPath>/tmp/artifacts/jsr352-tck-SPI.jar</systemPath>
+      <scope>system</scope>
+    </dependency>
+    -->
+  </dependencies>
+
+  <build>
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+      </resource>
+      <resource>
+        <directory>src/main/xsd</directory>
+        <targetPath>xsd</targetPath>
+      </resource>
+    </resources>
+    <plugins>
+      <!-- download tcks since i didn't find the maven artifact with tests -->
+      <plugin>
+        <groupId>com.googlecode.maven-download-plugin</groupId>
+        <artifactId>maven-download-plugin</artifactId>
+        <version>1.1.0</version>
+        <executions>
+          <execution>
+            <id>get-tck</id>
+            <phase>process-test-classes</phase>
+            <goals>
+              <goal>wget</goal>
+            </goals>
+            <configuration>
+              <url>https://java.net/projects/jbatch/downloads/download/jsr352-tck-1.0.zip</url>
+              <unpack>true</unpack>
+              <outputDirectory>${tck.unpack.dir}</outputDirectory>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>2.16</version>
+        <executions>
+          <execution>
+            <id>in-memory</id>
+            <goals>
+              <goal>test</goal>
+            </goals>
+            <configuration>
+              <skip>${maven.test.skip}</skip>
+              <systemProperties>
+                <PersistenceManagerService>org.apache.batchee.container.services.persistence.MemoryPersistenceManager</PersistenceManagerService>
+              </systemProperties>
+            </configuration>
+          </execution>
+          <execution>
+            <id>jdbc</id>
+            <goals>
+              <goal>test</goal>
+            </goals>
+            <configuration>
+              <skip>${maven.test.skip}</skip>
+              <systemProperties>
+                <PersistenceManagerService>org.apache.batchee.container.services.persistence.JDBCPersistenceManager</PersistenceManagerService>
+              </systemProperties>
+            </configuration>
+          </execution>
+          <execution>
+            <id>jpa</id>
+            <goals>
+              <goal>test</goal>
+            </goals>
+            <configuration>
+              <skip>${maven.test.skip}</skip>
+              <systemProperties>
+                <PersistenceManagerService>org.apache.batchee.container.services.persistence.JPAPersistenceService</PersistenceManagerService>
+              </systemProperties>
+            </configuration>
+          </execution>
+        </executions>
+        <configuration>
+          <skip>true</skip>
+
+          <systemProperties>
+            <batchee.service-manager.log>true</batchee.service-manager.log>
+
+            <!-- replace properties file -->
+            <tck.execution.waiter.timeout>900000</tck.execution.waiter.timeout>
+            <ExecutionTests.testInvokeJobWithUserStop.sleep>1000</ExecutionTests.testInvokeJobWithUserStop.sleep>
+            <JobOperatorTests.testInvokeJobWithUserStop.sleep>1000</JobOperatorTests.testInvokeJobWithUserStop.sleep>
+            <JobOperatorTests.testJobOperatorGetRunningJobExecutions.sleep>1000</JobOperatorTests.testJobOperatorGetRunningJobExecutions.sleep>
+            <JobOperatorTests.testJobOperatorGetRunningJobExecutions.app.timeinterval>10000</JobOperatorTests.testJobOperatorGetRunningJobExecutions.app.timeinterval>
+            <JobOperatorTests.testJobOperatorGetRunningJobInstancesException.app.timeinterval>10000</JobOperatorTests.testJobOperatorGetRunningJobInstancesException.app.timeinterval>
+            <ParallelExecutionTests.testStopRunningPartitionedStep.sleep>1900</ParallelExecutionTests.testStopRunningPartitionedStep.sleep>
+            <ParallelExecutionTests.testStopRestartRunningPartitionedStep.sleep>1900</ParallelExecutionTests.testStopRestartRunningPartitionedStep.sleep>
+            <ParallelExecutionTests.testInvokeJobWithOnePartitionedStepExitStatus.sleep>2000</ParallelExecutionTests.testInvokeJobWithOnePartitionedStepExitStatus.sleep>
+            <StopOrFailOnExitStatusWithRestartTests.testInvokeJobWithUserStop.sleep>500</StopOrFailOnExitStatusWithRestartTests.testInvokeJobWithUserStop.sleep>
+            <TransactionTests.testGlobalTranNoExceptions.sleep>0</TransactionTests.testGlobalTranNoExceptions.sleep>
+            <TransactionTests.testGlobalTranForcedExceptionWithRollback.sleep>0</TransactionTests.testGlobalTranForcedExceptionWithRollback.sleep>
+            <TransactionTests.testGlobalTranForcedExceptionCheckpointRestart.sleep>0</TransactionTests.testGlobalTranForcedExceptionCheckpointRestart.sleep>
+            <TransactionTests.testGlobalTranNoDelayLongTimeout.sleep>0</TransactionTests.testGlobalTranNoDelayLongTimeout.sleep>
+            <TransactionTests.testGlobalTranLongDelayShortTimeoutThenNoDelayShortTimeout.sleep.1>10000</TransactionTests.testGlobalTranLongDelayShortTimeoutThenNoDelayShortTimeout.sleep.1>
+            <TransactionTests.testGlobalTranLongDelayShortTimeoutThenNoDelayShortTimeout.sleep.2>0</TransactionTests.testGlobalTranLongDelayShortTimeoutThenNoDelayShortTimeout.sleep.2>
+            <TransactionTests.testGlobalTranLongDelayMixOfLongTimeoutStepsAndShortTimeoutSteps.sleep>10000</TransactionTests.testGlobalTranLongDelayMixOfLongTimeoutStepsAndShortTimeoutSteps.sleep>
+            <TransactionTests.testGlobalTranLongDelayMixOfLongTimeoutStepsAndShortTimeoutStepsCustomCheckpointAlgorithm.sleep>10000</TransactionTests.testGlobalTranLongDelayMixOfLongTimeoutStepsAndShortTimeoutStepsCustomCheckpointAlgorithm.sleep>
+            <TransactionTests.testGlobalTranForcedTimeoutCheckpointRestart.sleep.1>10000</TransactionTests.testGlobalTranForcedTimeoutCheckpointRestart.sleep.1>
+            <TransactionTests.testGlobalTranForcedTimeoutCheckpointRestart.sleep.2>0</TransactionTests.testGlobalTranForcedTimeoutCheckpointRestart.sleep.2>
+            <ChunkTests.testChunkTimeBased10Seconds.sleep>500</ChunkTests.testChunkTimeBased10Seconds.sleep>
+            <ChunkTests.testChunkRestartTimeBasedCheckpoint.sleep>500</ChunkTests.testChunkRestartTimeBasedCheckpoint.sleep>
+            <ChunkTests.testChunkTimeBasedTimeLimit0.sleep>500</ChunkTests.testChunkTimeBasedTimeLimit0.sleep>
+            <ChunkTests.testChunkRestartTimeBasedDefaultCheckpoint.sleep>500</ChunkTests.testChunkRestartTimeBasedDefaultCheckpoint.sleep>
+          </systemProperties>
+
+          <additionalClasspathElements>
+            <additionalClasspathElement>${tck.dir}/jsr352-tck-impl.jar</additionalClasspathElement>
+            <additionalClasspathElement>${tck.dir}/jsr352-tck-SPI.jar</additionalClasspathElement>
+          </additionalClasspathElements>
+
+          <suiteXmlFiles>
+            <suiteXmlFile>src/test/resources/suites/tck.xml</suiteXmlFile>
+          </suiteXmlFiles>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>templating-maven-plugin</artifactId>
+        <version>1.0-alpha-3</version>
+        <executions>
+          <execution>
+            <id>filter-src</id>
+            <goals>
+              <goal>filter-sources</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+  <properties>
+    <tck.unpack.dir>${project.build.directory}/tck</tck.unpack.dir>
+    <tck.dir>${tck.unpack.dir}/jsr352-tck-1.0/artifacts</tck.dir>
+  </properties>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java-templates/org/apache/batchee/container/Init.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java-templates/org/apache/batchee/container/Init.java b/jbatch/src/main/java-templates/org/apache/batchee/container/Init.java
new file mode 100644
index 0000000..eb79068
--- /dev/null
+++ b/jbatch/src/main/java-templates/org/apache/batchee/container/Init.java
@@ -0,0 +1,46 @@
+/*
+ * 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.container;
+
+import org.apache.batchee.container.services.ServicesManager;
+
+import java.util.logging.Logger;
+
+public final class Init {
+    private final static Logger LOGGER = Logger.getLogger(Init.class.getName());
+    private final static String LOGO = "\n" +
+        " ____        _       _     ______ ______ \n" +
+        "|  _ \\      | |     | |   |  ____|  ____|\n" +
+        "| |_) | __ _| |_ ___| |__ | |__  | |__   \n" +
+        "|  _ < / _` | __/ __| '_ \\|  __| |  __|  \n" +
+        "| |_) | (_| | || (__| | | | |____| |____ \n" +
+        "|____/ \\__,_|\\__\\___|_| |_|______|______|${project.version}";
+
+    public static void doInit() {
+        if (Boolean.parseBoolean(ServicesManager.value("org.apache.batchee.init.verbose", "true"))) {
+            if (!Boolean.parseBoolean(ServicesManager.value("org.apache.batchee.init.verbose.sysout", "false"))) {
+                LOGGER.info(LOGO);
+            } else {
+                System.out.println(LOGO);
+            }
+        }
+    }
+
+    private Init() {
+        // no-op
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/Controller.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/Controller.java b/jbatch/src/main/java/org/apache/batchee/container/Controller.java
new file mode 100755
index 0000000..5e3ecb9
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/Controller.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2012 International Business Machines Corp.
+ * 
+ * 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.
+*/
+package org.apache.batchee.container;
+
+import java.util.List;
+
+public interface Controller {
+    void stop();
+    List<Long> getLastRunStepExecutions();
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/ExecutionElementController.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/ExecutionElementController.java b/jbatch/src/main/java/org/apache/batchee/container/ExecutionElementController.java
new file mode 100755
index 0000000..d572717
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/ExecutionElementController.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2012 International Business Machines Corp.
+ * 
+ * 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.
+*/
+package org.apache.batchee.container;
+
+import org.apache.batchee.container.status.ExecutionStatus;
+
+public interface ExecutionElementController extends Controller {
+    ExecutionStatus execute();
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/ThreadRootController.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/ThreadRootController.java b/jbatch/src/main/java/org/apache/batchee/container/ThreadRootController.java
new file mode 100755
index 0000000..d45241f
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/ThreadRootController.java
@@ -0,0 +1,23 @@
+/**
+ * Copyright 2012 International Business Machines Corp.
+ *
+ * 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.
+ */
+package org.apache.batchee.container;
+
+import org.apache.batchee.container.status.ExecutionStatus;
+
+public interface ThreadRootController extends Controller {
+    ExecutionStatus originateExecutionOnThread();
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/cdi/BatchCDIInjectionExtension.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/cdi/BatchCDIInjectionExtension.java b/jbatch/src/main/java/org/apache/batchee/container/cdi/BatchCDIInjectionExtension.java
new file mode 100755
index 0000000..1d10991
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/cdi/BatchCDIInjectionExtension.java
@@ -0,0 +1,116 @@
+/**
+ * Copyright 2013 International Business Machines Corp.
+ *
+ * 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.
+ */
+package org.apache.batchee.container.cdi;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.AfterDeploymentValidation;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.BeforeShutdown;
+import javax.enterprise.inject.spi.Extension;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+// excepted beforeBeanDiscovery() all is forked from DeltaSpike - we don't want to depend from it here
+public class BatchCDIInjectionExtension implements Extension {
+    private static BatchCDIInjectionExtension bmpSingleton = null;
+    private volatile Map<ClassLoader, BeanManagerInfo> bmInfos = new ConcurrentHashMap<ClassLoader, BeanManagerInfo>();
+
+    void beforeBeanDiscovery(final @Observes BeforeBeanDiscovery bbd, BeanManager bm) {
+        bbd.addAnnotatedType(bm.createAnnotatedType(BatchProducerBean.class));
+    }
+
+    public void setBeanManager(final @Observes AfterBeanDiscovery afterBeanDiscovery, final BeanManager beanManager) {
+        // bean manager holder
+        if (bmpSingleton == null) {
+            bmpSingleton = this;
+        }
+        final BeanManagerInfo bmi = getBeanManagerInfo(loader());
+        bmi.loadTimeBm = beanManager;
+    }
+
+    public void cleanupFinalBeanManagers(final @Observes AfterDeploymentValidation adv) {
+        for (final BeanManagerInfo bmi : bmpSingleton.bmInfos.values()) {
+            bmi.finalBm = null;
+        }
+    }
+
+    public void cleanupStoredBeanManagerOnShutdown(final @Observes BeforeShutdown beforeShutdown) {
+        bmpSingleton.bmInfos.remove(loader());
+    }
+
+    private static ClassLoader loader() {
+        return Thread.currentThread().getContextClassLoader();
+    }
+
+    public static BatchCDIInjectionExtension getInstance() {
+        return bmpSingleton;
+    }
+
+    public BeanManager getBeanManager() {
+        final BeanManagerInfo bmi = getBeanManagerInfo(loader());
+
+        BeanManager result = bmi.finalBm;
+        if (result == null && bmi.cdi == null) {
+            synchronized (this) {
+                result = resolveBeanManagerViaJndi();
+                if (result == null) {
+                    result = bmi.loadTimeBm;
+                }
+                if (result == null) {
+                    bmi.cdi = false;
+                    return null;
+                }
+                bmi.cdi = true;
+                bmi.finalBm = result;
+            }
+        }
+
+        return result;
+    }
+
+    private static BeanManager resolveBeanManagerViaJndi() {
+        try {
+            return BeanManager.class.cast(new InitialContext().lookup("java:comp/BeanManager"));
+        } catch (final NamingException e) {
+            return null;
+        }
+    }
+
+    private BeanManagerInfo getBeanManagerInfo(final ClassLoader cl) {
+        BeanManagerInfo bmi = bmpSingleton.bmInfos.get(cl);
+        if (bmi == null) {
+            synchronized (this) {
+                bmi = bmpSingleton.bmInfos.get(cl);
+                if (bmi == null) {
+                    bmi = new BeanManagerInfo();
+                    bmpSingleton.bmInfos.put(cl, bmi);
+                }
+            }
+        }
+        return bmi;
+    }
+
+    private static class BeanManagerInfo {
+        private BeanManager loadTimeBm = null;
+        private BeanManager finalBm = null;
+        private Boolean cdi = null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/cdi/BatchProducerBean.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/cdi/BatchProducerBean.java b/jbatch/src/main/java/org/apache/batchee/container/cdi/BatchProducerBean.java
new file mode 100755
index 0000000..a877c32
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/cdi/BatchProducerBean.java
@@ -0,0 +1,62 @@
+/**
+ * Copyright 2013 International Business Machines Corp.
+ *
+ * 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.
+ */
+package org.apache.batchee.container.cdi;
+
+import org.apache.batchee.container.proxy.ProxyFactory;
+import org.apache.batchee.container.util.DependencyInjections;
+
+import javax.batch.api.BatchProperty;
+import javax.batch.runtime.context.JobContext;
+import javax.batch.runtime.context.StepContext;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+public class BatchProducerBean {
+    @Produces
+    @BatchProperty
+    public String produceProperty(final InjectionPoint injectionPoint) {
+        if (injectionPoint != null && ProxyFactory.getInjectionReferences() != null) {
+            final BatchProperty batchPropAnnotation = injectionPoint.getAnnotated().getAnnotation(BatchProperty.class);
+            final String batchPropName;
+            if (batchPropAnnotation.name().equals("")) {
+                batchPropName = injectionPoint.getMember().getName();
+            } else {
+                batchPropName = batchPropAnnotation.name();
+            }
+
+            return DependencyInjections.getPropertyValue(ProxyFactory.getInjectionReferences().getProps(), batchPropName);
+        }
+        return null;
+
+    }
+
+    @Produces
+    public JobContext getJobContext() {
+        if (ProxyFactory.getInjectionReferences() != null) {
+            return ProxyFactory.getInjectionReferences().getJobContext();
+        }
+        return null;
+    }
+
+    @Produces
+    public StepContext getStepContext() {
+        if (ProxyFactory.getInjectionReferences() != null) {
+            return ProxyFactory.getInjectionReferences().getStepContext();
+        }
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/exception/BatchContainerRuntimeException.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/exception/BatchContainerRuntimeException.java b/jbatch/src/main/java/org/apache/batchee/container/exception/BatchContainerRuntimeException.java
new file mode 100755
index 0000000..ecc78b2
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/exception/BatchContainerRuntimeException.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2012 International Business Machines Corp.
+ * 
+ * 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.
+*/
+package org.apache.batchee.container.exception;
+
+public class BatchContainerRuntimeException extends RuntimeException {
+    private static final long serialVersionUID = 1L;
+
+    public BatchContainerRuntimeException() {
+        // no-op
+    }
+
+    public BatchContainerRuntimeException(final String message) {
+        super(message);
+    }
+
+    public BatchContainerRuntimeException(final Throwable cause) {
+        super(cause);
+    }
+
+    public BatchContainerRuntimeException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/exception/BatchContainerServiceException.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/exception/BatchContainerServiceException.java b/jbatch/src/main/java/org/apache/batchee/container/exception/BatchContainerServiceException.java
new file mode 100755
index 0000000..ea5f1d1
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/exception/BatchContainerServiceException.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2012 International Business Machines Corp.
+ * 
+ * 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.
+*/
+package org.apache.batchee.container.exception;
+
+public class BatchContainerServiceException extends BatchContainerRuntimeException {
+    private static final long serialVersionUID = 1L;
+
+    public BatchContainerServiceException() {
+        // no-op
+    }
+
+    public BatchContainerServiceException(final String message) {
+        super(message);
+    }
+
+    public BatchContainerServiceException(final Throwable cause) {
+        super(cause);
+    }
+
+    public BatchContainerServiceException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/exception/IllegalBatchPropertyException.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/exception/IllegalBatchPropertyException.java b/jbatch/src/main/java/org/apache/batchee/container/exception/IllegalBatchPropertyException.java
new file mode 100755
index 0000000..6b31c3d
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/exception/IllegalBatchPropertyException.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2012 International Business Machines Corp.
+ * 
+ * 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.
+*/
+package org.apache.batchee.container.exception;
+
+public class IllegalBatchPropertyException extends BatchContainerRuntimeException {
+
+    private static final long serialVersionUID = 1L;
+
+    public IllegalBatchPropertyException() {
+        // no-op
+    }
+
+    public IllegalBatchPropertyException(final String message) {
+        super(message);
+    }
+
+    public IllegalBatchPropertyException(final Throwable cause) {
+        super(cause);
+    }
+
+    public IllegalBatchPropertyException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/exception/PersistenceException.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/exception/PersistenceException.java b/jbatch/src/main/java/org/apache/batchee/container/exception/PersistenceException.java
new file mode 100755
index 0000000..8e21707
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/exception/PersistenceException.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2012 International Business Machines Corp.
+ * 
+ * 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.
+*/
+package org.apache.batchee.container.exception;
+
+public class PersistenceException extends BatchContainerRuntimeException {
+    private static final long serialVersionUID = 1L;
+
+    public PersistenceException() {
+        // no-op
+    }
+
+    public PersistenceException(final String message) {
+        super(message);
+    }
+
+    public PersistenceException(final Throwable cause) {
+        super(cause);
+    }
+
+    public PersistenceException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/exception/TransactionManagementException.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/exception/TransactionManagementException.java b/jbatch/src/main/java/org/apache/batchee/container/exception/TransactionManagementException.java
new file mode 100755
index 0000000..2be6d23
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/exception/TransactionManagementException.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2012 International Business Machines Corp.
+ * 
+ * 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.
+*/
+package org.apache.batchee.container.exception;
+
+public class TransactionManagementException extends BatchContainerRuntimeException {
+    private static final long serialVersionUID = 1L;
+
+    public TransactionManagementException() {
+        // no-op
+    }
+
+    public TransactionManagementException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    public TransactionManagementException(final String message) {
+        super(message);
+    }
+
+    public TransactionManagementException(final Throwable cause) {
+        super(cause);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/impl/JobContextImpl.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/impl/JobContextImpl.java b/jbatch/src/main/java/org/apache/batchee/container/impl/JobContextImpl.java
new file mode 100755
index 0000000..e1cbcbe
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/impl/JobContextImpl.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2012 International Business Machines Corp.
+ * 
+ * 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.
+ */
+package org.apache.batchee.container.impl;
+
+import org.apache.batchee.container.navigator.ModelNavigator;
+import org.apache.batchee.jaxb.JSLJob;
+import org.apache.batchee.jaxb.JSLProperties;
+import org.apache.batchee.jaxb.Property;
+
+import javax.batch.runtime.BatchStatus;
+import javax.batch.runtime.context.JobContext;
+import java.util.Properties;
+
+
+public class JobContextImpl implements JobContext {
+    private BatchStatus batchStatus = null;
+    private String exitStatus = null;
+
+    private Object transientUserData = null;
+    private ModelNavigator<JSLJob> navigator = null;
+
+    private String id;  // Name
+    private Properties properties = new Properties();
+
+    private long executionId;
+    private long instanceId;
+    protected String restartOn;
+
+    public JobContextImpl(final ModelNavigator<JSLJob> navigator, final JSLProperties jslProperties) {
+        this.navigator = navigator;
+        this.id = navigator.getRootModelElement().getId();
+        this.batchStatus = BatchStatus.STARTING;
+        this.properties = convertJSProperties(jslProperties);
+    }
+
+    private Properties convertJSProperties(final JSLProperties jslProperties) {
+        final Properties jobProperties = new Properties();
+        if (jslProperties != null) { // null if not job properties defined.
+            for (Property property : jslProperties.getPropertyList()) {
+                jobProperties.setProperty(property.getName(), property.getValue());
+            }
+        }
+        return jobProperties;
+    }
+
+    public ModelNavigator<JSLJob> getNavigator() {
+        return navigator;
+    }
+
+    public String getExitStatus() {
+        return exitStatus;
+    }
+
+
+    public void setExitStatus(String exitStatus) {
+        this.exitStatus = exitStatus;
+    }
+
+    public String getJobName() {
+        return id;
+    }
+
+    public BatchStatus getBatchStatus() {
+        return batchStatus;
+    }
+
+    public void setBatchStatus(BatchStatus batchStatus) {
+        this.batchStatus = batchStatus;
+    }
+
+    public Object getTransientUserData() {
+        return transientUserData;
+    }
+
+    public Properties getProperties() {
+        return properties;
+    }
+
+    public void setTransientUserData(Object data) {
+        this.transientUserData = data;
+    }
+
+    @Override
+    public long getExecutionId() {
+        return this.executionId;
+    }
+
+    @Override
+    public long getInstanceId() {
+        return this.instanceId;
+    }
+
+    public void setExecutionId(long executionId) {
+        this.executionId = executionId;
+    }
+
+    public void setInstanceId(long instanceId) {
+        this.instanceId = instanceId;
+    }
+
+    public String getRestartOn() {
+        return restartOn;
+    }
+
+    public void setRestartOn(String restartOn) {
+        this.restartOn = restartOn;
+    }
+
+    @Override
+    public String toString() {
+        return ("batchStatus = " + batchStatus) + " , exitStatus = " + exitStatus + " , id = "
+            + id + " , executionId = " + executionId + " , instanceId = " + instanceId + " , restartOn = " + restartOn;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/impl/JobExecutionImpl.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/impl/JobExecutionImpl.java b/jbatch/src/main/java/org/apache/batchee/container/impl/JobExecutionImpl.java
new file mode 100755
index 0000000..0767168
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/impl/JobExecutionImpl.java
@@ -0,0 +1,206 @@
+/**
+ * Copyright 2012 International Business Machines Corp.
+ *
+ * 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.
+ */
+package org.apache.batchee.container.impl;
+
+import org.apache.batchee.container.services.InternalJobExecution;
+import org.apache.batchee.spi.PersistenceManagerService;
+import org.apache.batchee.spi.PersistenceManagerService.TimestampType;
+import org.apache.batchee.container.services.ServicesManager;
+
+import javax.batch.runtime.BatchStatus;
+import java.sql.Timestamp;
+import java.util.Date;
+import java.util.Properties;
+
+public class JobExecutionImpl implements InternalJobExecution {
+    private static final PersistenceManagerService PERSISTENCE_MANAGER_SERVICE = ServicesManager.service(PersistenceManagerService.class);
+
+    private long executionID = 0L;
+    private long instanceID = 0L;
+
+    private Timestamp createTime;
+    private Timestamp startTime;
+    private Timestamp endTime;
+    private Timestamp updateTime;
+    private String batchStatus;
+    private String exitStatus;
+    private Properties jobProperties = null;
+    private String jobName = null;
+    private JobContextImpl jobContext = null;
+
+    public void setJobName(String jobName) {
+        this.jobName = jobName;
+    }
+
+    public void setJobContext(JobContextImpl jobContext) {
+        this.jobContext = jobContext;
+    }
+
+    public JobExecutionImpl(long executionId, long instanceId) {
+        this.executionID = executionId;
+        this.instanceID = instanceId;
+    }
+
+    @Override
+    public BatchStatus getBatchStatus() {
+        if (this.jobContext != null) {
+            return this.jobContext.getBatchStatus();
+        } else {
+            // old job, retrieve from the backend
+            final String name = PERSISTENCE_MANAGER_SERVICE.jobOperatorQueryJobExecutionBatchStatus(executionID);
+            if (name != null) {
+                return BatchStatus.valueOf(name);
+            }
+        }
+        return BatchStatus.valueOf(batchStatus);
+    }
+
+    @Override
+    public Date getCreateTime() {
+        final Timestamp ts = PERSISTENCE_MANAGER_SERVICE.jobOperatorQueryJobExecutionTimestamp(executionID, TimestampType.CREATE);
+        if (ts != null) {
+            createTime = ts;
+        }
+
+        if (createTime != null) {
+            return new Date(createTime.getTime());
+        }
+        return null;
+    }
+
+    @Override
+    public Date getEndTime() {
+        final Timestamp ts = PERSISTENCE_MANAGER_SERVICE.jobOperatorQueryJobExecutionTimestamp(executionID, TimestampType.END);
+        if (ts != null) {
+            endTime = ts;
+        }
+
+        if (endTime != null) {
+            return new Date(endTime.getTime());
+        }
+        return null;
+    }
+
+    @Override
+    public long getExecutionId() {
+        return executionID;
+    }
+
+    @Override
+    public String getExitStatus() {
+        if (this.jobContext != null) {
+            return this.jobContext.getExitStatus();
+        }
+
+        final String persistenceExitStatus = PERSISTENCE_MANAGER_SERVICE.jobOperatorQueryJobExecutionExitStatus(executionID);
+        if (persistenceExitStatus != null) {
+            exitStatus = persistenceExitStatus;
+        }
+
+        return this.exitStatus;
+    }
+
+    @Override
+    public Date getLastUpdatedTime() {
+        final Timestamp ts = PERSISTENCE_MANAGER_SERVICE.jobOperatorQueryJobExecutionTimestamp(executionID, TimestampType.LAST_UPDATED);
+        if (ts != null) {
+            this.updateTime = ts;
+        }
+
+        if (updateTime != null) {
+            return new Date(this.updateTime.getTime());
+        }
+        return null;
+    }
+
+    @Override
+    public Date getStartTime() {
+        final Timestamp ts = PERSISTENCE_MANAGER_SERVICE.jobOperatorQueryJobExecutionTimestamp(executionID, TimestampType.STARTED);
+        if (ts != null) {
+            startTime = ts;
+        }
+
+        if (startTime != null) {
+            return new Date(startTime.getTime());
+        }
+        return null;
+    }
+
+    @Override
+    public Properties getJobParameters() {
+        return jobProperties;
+    }
+
+    // IMPL specific setters
+
+    public void setBatchStatus(String status) {
+        batchStatus = status;
+    }
+
+    public void setCreateTime(Timestamp ts) {
+        createTime = ts;
+    }
+
+    public void setEndTime(Timestamp ts) {
+        endTime = ts;
+    }
+
+    public void setExecutionId(long id) {
+        executionID = id;
+    }
+
+    public void setJobInstanceId(long jobInstanceID) {
+        instanceID = jobInstanceID;
+    }
+
+    public void setExitStatus(String status) {
+        exitStatus = status;
+    }
+
+    public void setInstanceId(long id) {
+        instanceID = id;
+    }
+
+    public void setLastUpdateTime(Timestamp ts) {
+        updateTime = ts;
+    }
+
+    public void setStartTime(Timestamp ts) {
+        startTime = ts;
+    }
+
+    public void setJobParameters(Properties jProps) {
+        jobProperties = jProps;
+    }
+
+    @Override
+    public String getJobName() {
+        return jobName;
+    }
+
+    @Override
+    public long getInstanceId() {
+        return instanceID;
+    }
+
+    @Override
+    public String toString() {
+        return ("createTime=" + createTime) + ",batchStatus=" + batchStatus + ",exitStatus="
+            + exitStatus + ",jobName=" + jobName + ",instanceId=" + instanceID + ",executionId=" + executionID;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/impl/JobInstanceImpl.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/impl/JobInstanceImpl.java b/jbatch/src/main/java/org/apache/batchee/container/impl/JobInstanceImpl.java
new file mode 100755
index 0000000..7b87212
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/impl/JobInstanceImpl.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2012 International Business Machines Corp.
+ * 
+ * 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.
+*/
+package org.apache.batchee.container.impl;
+
+import javax.batch.runtime.JobInstance;
+import java.io.Serializable;
+
+public class JobInstanceImpl implements JobInstance, Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private long jobInstanceId = 0L;
+    private String jobName = null;
+    private String jobXML = null;
+
+    private JobInstanceImpl() {
+        // no-op
+    }
+
+    public JobInstanceImpl(long instanceId) {
+        this.jobInstanceId = instanceId;
+    }
+
+    public JobInstanceImpl(long instanceId, String jobXML) {
+        this.jobXML = jobXML;
+        this.jobInstanceId = instanceId;
+    }
+
+    @Override
+    public long getInstanceId() {
+        return jobInstanceId;
+    }
+
+    public void setJobName(String jobName) {
+        this.jobName = jobName;
+    }
+
+    public String getJobName() {
+        return jobName;
+    }
+
+    public String getJobXML() {
+        return jobXML;
+    }
+
+
+    @Override
+    public String toString() {
+
+        StringBuffer buf = new StringBuffer();
+        buf.append(" jobName: " + jobName);
+        buf.append(" jobInstance id: " + jobInstanceId);
+        if (jobXML != null) {
+            int concatLen = jobXML.length() > 300 ? 300 : jobXML.length();
+            buf.append(" jobXML: " + jobXML.subSequence(0, concatLen) + "...truncated ...\n");
+        } else {
+            buf.append(" jobXML = null");
+        }
+        return buf.toString();
+
+    }
+
+}