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:38:39 UTC

[02/62] Importing JBatch Reference Implementation from IBM. We'll fork it but this commit is to keep a track of what we forked.

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/src/com/ibm/jbatch/container/transaction/impl/DefaultNonTransactionalManager.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/container/transaction/impl/DefaultNonTransactionalManager.java b/JSR352.Runtime/src/com/ibm/jbatch/container/transaction/impl/DefaultNonTransactionalManager.java
new file mode 100755
index 0000000..d126d74
--- /dev/null
+++ b/JSR352.Runtime/src/com/ibm/jbatch/container/transaction/impl/DefaultNonTransactionalManager.java
@@ -0,0 +1,100 @@
+/*
+ * 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 com.ibm.jbatch.container.transaction.impl;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+
+import com.ibm.jbatch.container.exception.TransactionManagementException;
+import com.ibm.jbatch.spi.services.TransactionManagerAdapter;
+
+public class DefaultNonTransactionalManager implements TransactionManagerAdapter {
+	
+	private static final String CLASSNAME = DefaultNonTransactionalManager.class.getName();
+	
+	private static final Logger logger = Logger.getLogger(CLASSNAME);
+
+	/**
+	 * transaction status
+	 */
+	private int status = 6; // javax.transaction.Status.STATUS_NO_TRANSACTION
+	
+	/* (non-Javadoc)
+	 * @see javax.batch.spi.TransactionManagerSPI#begin()
+	 */
+	@Override
+	public void begin() throws TransactionManagementException {
+		logger.entering(CLASSNAME, "begin");
+		status = 0; // javax.transaction.Status.STATUS_ACTIVE
+		logger.log(Level.FINE, "javax.transaction.Status.ACTIVE: {0}", status);
+		logger.exiting(CLASSNAME, "begin");
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.batch.spi.TransactionManagerSPI#commit()
+	 */
+	@Override
+	public void commit() throws TransactionManagementException {
+		logger.entering(CLASSNAME, "commit");
+		status = 3; // javax.transaction.Status.STATUS_COMMITTED
+		logger.log(Level.FINE, "javax.transaction.Status.STATUS_COMMITTED: {0}", status);
+		logger.exiting(CLASSNAME, "commit");
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.batch.spi.TransactionManagerSPI#rollback()
+	 */
+	@Override
+	public void rollback() throws TransactionManagementException {
+		logger.entering(CLASSNAME, "rollback");
+		status = 4; // javax.transaction.Status.STATUS_ROLLEDBACK
+		logger.log(Level.FINE, "javax.transaction.Status.STATUS_ROLLEDBACK: {0}", status);
+		logger.exiting(CLASSNAME, "rollback");
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.batch.spi.TransactionManagerSPI#getStatus()
+	 */
+	@Override
+	public int getStatus() throws TransactionManagementException {
+		logger.entering(CLASSNAME, "getStatus");
+		logger.exiting(CLASSNAME, "getStatus", status);
+		return status;
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.batch.spi.TransactionManagerSPI#setRollbackOnly()
+	 */
+	@Override
+	public void setRollbackOnly() throws TransactionManagementException {
+		logger.entering(CLASSNAME, "setRollbackOnly");
+		status = 9;  // javax.transaction.Status.STATUS_ROLLING_BACK
+		logger.log(Level.FINE, "javax.transaction.Status.STATUS_ROLLING_BACK: {0}", status);
+		logger.exiting(CLASSNAME, "setRollbackOnly");
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.batch.spi.TransactionManagerSPI#setTransactionTimeout(int)
+	 */
+	@Override
+	public void setTransactionTimeout(int seconds) throws TransactionManagementException {
+		logger.entering(CLASSNAME, "setTransactionTimeout", seconds);
+		logger.fine("do nothing");
+		logger.exiting(CLASSNAME, "setTransactionTimeout");
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/src/com/ibm/jbatch/container/transaction/impl/JTAUserTransactionAdapter.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/container/transaction/impl/JTAUserTransactionAdapter.java b/JSR352.Runtime/src/com/ibm/jbatch/container/transaction/impl/JTAUserTransactionAdapter.java
new file mode 100755
index 0000000..a4c97d7
--- /dev/null
+++ b/JSR352.Runtime/src/com/ibm/jbatch/container/transaction/impl/JTAUserTransactionAdapter.java
@@ -0,0 +1,177 @@
+/*
+ * 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 com.ibm.jbatch.container.transaction.impl;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+import javax.transaction.UserTransaction;
+
+import com.ibm.jbatch.container.exception.TransactionManagementException;
+import com.ibm.jbatch.spi.services.TransactionManagerAdapter;
+
+/**
+ * The JTA Transaction Adapter is used in a J2EE environment where a JTA tran
+ * manager is available. *
+ */
+public class JTAUserTransactionAdapter implements TransactionManagerAdapter {
+	
+	private static final String CLASSNAME = JTAUserTransactionAdapter.class.getName();
+	
+	private static final Logger logger = Logger.getLogger(CLASSNAME);
+	
+	/**
+	 * JTA transaction manager
+	 */
+	protected UserTransaction userTran = null;
+	
+	/**
+	 * constructor
+	 */
+	public JTAUserTransactionAdapter(String jndiLookup) {
+		logger.entering(CLASSNAME, "init", jndiLookup);
+		InitialContext ctxt;
+		try {
+			ctxt = new InitialContext();
+			userTran = (UserTransaction) ctxt.lookup(jndiLookup);
+			logger.fine("JNDI user transaction manager found");
+		} catch (NamingException ne) {
+            logger.severe("Caught exception: " + ne.getMessage() + " looking up user transaction at JNDI location:  " + jndiLookup);
+			throw new TransactionManagementException(ne);
+		}
+		logger.exiting(CLASSNAME, "init");
+	}
+	
+
+	/* (non-Javadoc)
+	 * @see javax.batch.spi.TransactionManagerSPI#begin()
+	 */
+	@Override
+	public void begin() throws TransactionManagementException {
+		logger.entering(CLASSNAME, "begin");
+		try {
+			userTran.begin();
+			logger.log(Level.FINE, "javax.transaction.Status: {0}", userTran.getStatus());
+		} catch (NotSupportedException e) {
+			throw new TransactionManagementException(e);
+		} catch (SystemException e) {
+			throw new TransactionManagementException(e);
+		}
+		logger.exiting(CLASSNAME, "begin");
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.batch.spi.TransactionManagerSPI#commit()
+	 */
+	@Override
+	public void commit() throws TransactionManagementException {
+		logger.entering(CLASSNAME, "commit");
+		try {
+			userTran.commit();
+			logger.log(Level.FINE, "javax.transaction.Status: {0}", userTran.getStatus());
+		} catch (SecurityException e) {
+			throw new TransactionManagementException(e);
+		} catch (IllegalStateException e) {
+			throw new TransactionManagementException(e);
+		} catch (RollbackException e) {
+			throw new TransactionManagementException(e);
+		} catch (HeuristicMixedException e) {
+			throw new TransactionManagementException(e);
+		} catch (HeuristicRollbackException e) {
+			throw new TransactionManagementException(e);
+		} catch (SystemException e) {
+			throw new TransactionManagementException(e);
+		}
+		logger.exiting(CLASSNAME, "commit");
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.batch.spi.TransactionManagerSPI#rollback()
+	 */
+	@Override
+	public void rollback() throws TransactionManagementException {
+		logger.entering(CLASSNAME, "rollback");
+		try {
+			userTran.rollback();
+			logger.log(Level.FINE, "javax.transaction.Status: {0}", userTran.getStatus());
+		} catch (IllegalStateException e) {
+			throw new TransactionManagementException(e);
+		} catch (SecurityException e) {
+			throw new TransactionManagementException(e);
+		} catch (SystemException e) {
+			throw new TransactionManagementException(e);
+		}
+		logger.exiting(CLASSNAME, "rollback");
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.batch.spi.TransactionManagerSPI#getStatus()
+	 */
+	@Override
+	public int getStatus() throws TransactionManagementException {
+		logger.entering(CLASSNAME, "getStatus");
+		int status = 0;
+		
+		try {
+			status = userTran.getStatus();
+			logger.log(Level.FINE, "javax.transaction.Status: {0}", status);
+		} catch (SystemException e) {
+			throw new TransactionManagementException(e);
+		}
+		logger.exiting(CLASSNAME, "getStatus", status);
+		return status;
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.batch.spi.TransactionManagerSPI#setRollbackOnly()
+	 */
+	@Override
+	public void setRollbackOnly() throws TransactionManagementException {
+		logger.entering(CLASSNAME, "setRollbackOnly");
+		try {
+			userTran.setRollbackOnly();
+			logger.log(Level.FINE, "javax.transaction.Status: {0}", userTran.getStatus());
+		} catch (IllegalStateException e) {
+			throw new TransactionManagementException(e);
+		} catch (SystemException e) {
+			throw new TransactionManagementException(e);
+		}
+		logger.exiting(CLASSNAME, "setRollbackOnly");
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.batch.spi.TransactionManagerSPI#setTransactionTimeout(int)
+	 */
+	@Override
+	public void setTransactionTimeout(int seconds) throws TransactionManagementException {
+		logger.entering(CLASSNAME, "setTransactionTimeout", seconds);
+		try {
+			userTran.setTransactionTimeout(seconds);
+		} catch (SystemException e) {
+			throw new TransactionManagementException(e);
+		}
+		logger.exiting(CLASSNAME, "setTransactionTimeout");
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/src/com/ibm/jbatch/container/util/BatchContainerConstants.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/container/util/BatchContainerConstants.java b/JSR352.Runtime/src/com/ibm/jbatch/container/util/BatchContainerConstants.java
new file mode 100755
index 0000000..4ee1a93
--- /dev/null
+++ b/JSR352.Runtime/src/com/ibm/jbatch/container/util/BatchContainerConstants.java
@@ -0,0 +1,40 @@
+/*
+ * 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 com.ibm.jbatch.container.util;
+
+public interface BatchContainerConstants {
+
+	public static final String BATCH_ADMIN_CONFIG_FILE = "batch-config.properties";
+	public static final String BATCH_INTEGRATOR_CONFIG_FILE = "batch-services.properties";
+	
+	public static final String J2SE_MODE = "J2SE_MODE";
+	public static final String JNDI_NAME = "JNDI_NAME";
+		
+	public static final String BOUNDED_THREADPOOL_MAX_POOL_SIZE = "BOUNDED_THREADPOOL_MAX_POOL_SIZE";
+	public static final String THREADPOOL_JNDI_LOCATION = "THREADPOOL_JNDI_LOCATION";
+
+	public static final String JDBC_DRIVER = "JDBC_DRIVER";
+	public static final String JDBC_URL = "JDBC_URL";
+	public static final String DB_USER = "DB_USER";
+	public static final String DB_PASSWORD = "DB_PWD";
+	public static final String DB_SCHEMA = "DB_SCHEMA";
+	
+	public static final String DEFAULT_JDBC_JNDI_NAME = "jdbc/batch";
+	public static final String DEFAULT_JDBC_DRIVER = "org.apache.derby.jdbc.EmbeddedDriver";
+	public static final String DEFAULT_JDBC_URL = "jdbc:derby:RUNTIMEDB;create=true";
+	public static final String DEFAULT_DB_SCHEMA = "JBATCH";
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/src/com/ibm/jbatch/container/util/BatchFlowInSplitWorkUnit.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/container/util/BatchFlowInSplitWorkUnit.java b/JSR352.Runtime/src/com/ibm/jbatch/container/util/BatchFlowInSplitWorkUnit.java
new file mode 100755
index 0000000..9b1a469
--- /dev/null
+++ b/JSR352.Runtime/src/com/ibm/jbatch/container/util/BatchFlowInSplitWorkUnit.java
@@ -0,0 +1,53 @@
+/**
+ * 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 com.ibm.jbatch.container.util;
+
+import java.util.concurrent.BlockingQueue;
+
+import com.ibm.jbatch.container.impl.FlowInSplitThreadRootControllerImpl;
+import com.ibm.jbatch.container.jobinstance.RuntimeFlowInSplitExecution;
+import com.ibm.jbatch.container.services.IBatchKernelService;
+
+public class BatchFlowInSplitWorkUnit extends BatchParallelWorkUnit {
+
+	public BatchFlowInSplitWorkUnit(IBatchKernelService batchKernelService,
+			RuntimeFlowInSplitExecution jobExecution,
+			FlowInSplitBuilderConfig config) {
+		super(batchKernelService, jobExecution, true);
+		this.completedThreadQueue = config.getCompletedQueue();
+		this.controller = new FlowInSplitThreadRootControllerImpl(jobExecution, config);
+	}
+
+	protected BlockingQueue<BatchFlowInSplitWorkUnit> completedThreadQueue;
+
+	public BlockingQueue<BatchFlowInSplitWorkUnit> getCompletedThreadQueue() {
+		return completedThreadQueue;
+	}
+
+	@Override
+	protected void markThreadCompleted() {
+		if (this.completedThreadQueue != null) {
+			completedThreadQueue.add(this);
+		}
+	}
+	
+	@Override
+	public RuntimeFlowInSplitExecution getJobExecutionImpl() {
+		return (RuntimeFlowInSplitExecution)jobExecutionImpl;
+	}
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/src/com/ibm/jbatch/container/util/BatchParallelWorkUnit.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/container/util/BatchParallelWorkUnit.java b/JSR352.Runtime/src/com/ibm/jbatch/container/util/BatchParallelWorkUnit.java
new file mode 100755
index 0000000..c4dc60b
--- /dev/null
+++ b/JSR352.Runtime/src/com/ibm/jbatch/container/util/BatchParallelWorkUnit.java
@@ -0,0 +1,34 @@
+/**
+ * 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 com.ibm.jbatch.container.util;
+
+import com.ibm.jbatch.container.jobinstance.RuntimeJobExecution;
+import com.ibm.jbatch.container.services.IBatchKernelService;
+
+/*
+ * I took out the 'work type' constant since I don't see that we want to use
+ * the same thread pool for start requests as we'd use for stop requests.
+ * The stop seems like it should be synchronous from the JobOperator's
+ * perspective, as it returns a 'success' boolean.
+ */
+public abstract class BatchParallelWorkUnit extends BatchWorkUnit {
+
+	public BatchParallelWorkUnit(IBatchKernelService batchKernel, RuntimeJobExecution jobExecutionImpl,	boolean notifyCallbackWhenDone) {
+		super(batchKernel, jobExecutionImpl, notifyCallbackWhenDone);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/src/com/ibm/jbatch/container/util/BatchPartitionPlan.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/container/util/BatchPartitionPlan.java b/JSR352.Runtime/src/com/ibm/jbatch/container/util/BatchPartitionPlan.java
new file mode 100755
index 0000000..1afe4a2
--- /dev/null
+++ b/JSR352.Runtime/src/com/ibm/jbatch/container/util/BatchPartitionPlan.java
@@ -0,0 +1,64 @@
+/**
+ * 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 com.ibm.jbatch.container.util;
+
+import java.util.Properties;
+
+import javax.batch.api.partition.PartitionPlan;
+
+public class BatchPartitionPlan implements PartitionPlan  {
+
+	private int partitionCount;
+	private int threadCount;
+	private Properties[] partitionProperties;
+	private boolean partitionsOverride;
+	
+	public int getPartitions() {
+		return partitionCount;
+	}
+	
+	public void setPartitions(int partitionCount) {
+		this.partitionCount = partitionCount;
+	}
+	
+	public int getThreads() {
+		return threadCount;
+	}
+	
+	public void setThreads(int threadCount) {
+		this.threadCount = threadCount;
+	}
+	
+	public Properties[] getPartitionProperties() {
+		return partitionProperties;
+	}
+	
+	public void setPartitionProperties(Properties[] partitionProperties) {
+		this.partitionProperties = partitionProperties;
+	}
+
+	@Override
+	public void setPartitionsOverride(boolean override) {
+		this.partitionsOverride = override;
+	}
+
+	@Override
+	public boolean getPartitionsOverride() {
+	    return this.partitionsOverride;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/src/com/ibm/jbatch/container/util/BatchPartitionWorkUnit.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/container/util/BatchPartitionWorkUnit.java b/JSR352.Runtime/src/com/ibm/jbatch/container/util/BatchPartitionWorkUnit.java
new file mode 100755
index 0000000..6643b29
--- /dev/null
+++ b/JSR352.Runtime/src/com/ibm/jbatch/container/util/BatchPartitionWorkUnit.java
@@ -0,0 +1,47 @@
+/**
+ * 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 com.ibm.jbatch.container.util;
+
+import java.util.concurrent.BlockingQueue;
+
+import com.ibm.jbatch.container.impl.PartitionThreadRootControllerImpl;
+import com.ibm.jbatch.container.jobinstance.RuntimeJobExecution;
+import com.ibm.jbatch.container.services.IBatchKernelService;
+
+public class BatchPartitionWorkUnit extends BatchParallelWorkUnit {
+
+	public BatchPartitionWorkUnit(IBatchKernelService batchKernelService,
+			RuntimeJobExecution jobExecution,
+			PartitionsBuilderConfig config) {
+		super(batchKernelService, jobExecution, true);
+		this.completedThreadQueue = config.getCompletedQueue();
+		this.controller = new PartitionThreadRootControllerImpl(jobExecution, config);
+	}
+
+	protected BlockingQueue<BatchPartitionWorkUnit> completedThreadQueue;
+
+	public BlockingQueue<BatchPartitionWorkUnit> getCompletedThreadQueue() {
+		return completedThreadQueue;
+	}
+
+	@Override
+	protected void markThreadCompleted() {
+		if (this.completedThreadQueue != null) {
+			completedThreadQueue.add(this);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/src/com/ibm/jbatch/container/util/BatchWorkUnit.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/container/util/BatchWorkUnit.java b/JSR352.Runtime/src/com/ibm/jbatch/container/util/BatchWorkUnit.java
new file mode 100755
index 0000000..bd04b3f
--- /dev/null
+++ b/JSR352.Runtime/src/com/ibm/jbatch/container/util/BatchWorkUnit.java
@@ -0,0 +1,158 @@
+/**
+ * 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 com.ibm.jbatch.container.util;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.batch.runtime.BatchStatus;
+
+import com.ibm.jbatch.container.IThreadRootController;
+import com.ibm.jbatch.container.exception.BatchContainerRuntimeException;
+import com.ibm.jbatch.container.impl.JobControllerImpl;
+import com.ibm.jbatch.container.jobinstance.RuntimeJobExecution;
+import com.ibm.jbatch.container.services.IBatchKernelService;
+
+/*
+ * I took out the 'work type' constant since I don't see that we want to use
+ * the same thread pool for start requests as we'd use for stop requests.
+ * The stop seems like it should be synchronous from the JobOperator's
+ * perspective, as it returns a 'success' boolean.
+ */
+public class BatchWorkUnit implements Runnable {
+
+	private String CLASSNAME = BatchWorkUnit.class.getName();
+	private Logger logger = Logger.getLogger(BatchWorkUnit.class.getPackage().getName());
+
+	protected RuntimeJobExecution jobExecutionImpl = null;
+	protected IBatchKernelService batchKernel = null;
+	protected IThreadRootController controller;
+
+	protected boolean notifyCallbackWhenDone;
+
+	public BatchWorkUnit(IBatchKernelService batchKernel, RuntimeJobExecution jobExecutionImpl) {
+		this(batchKernel, jobExecutionImpl, true);
+	}
+
+	public BatchWorkUnit(IBatchKernelService batchKernel, RuntimeJobExecution jobExecutionImpl,
+			boolean notifyCallbackWhenDone) {
+		this.setBatchKernel(batchKernel);
+		this.setJobExecutionImpl(jobExecutionImpl);
+		this.setNotifyCallbackWhenDone(notifyCallbackWhenDone);
+		this.controller = new JobControllerImpl(jobExecutionImpl);
+	}
+
+	public IThreadRootController getController() {
+		return this.controller;
+	}
+
+	@Override
+	public void run() {
+		String method = "run";
+		if (logger.isLoggable(Level.FINER)) {
+			logger.entering(CLASSNAME, method);
+		}
+
+		if (logger.isLoggable(Level.FINE)) {
+			logger.fine("==========================================================");
+			logger.fine("Invoking executeJob on JobController; " + "JobInstance id=" + getJobExecutionImpl().getInstanceId()
+					+ ", executionId=" + getJobExecutionImpl().getExecutionId());
+			logger.fine("==========================================================");
+		}
+
+		try {
+			controller.originateExecutionOnThread();
+
+			if (isNotifyCallbackWhenDone()) {
+				getBatchKernel().jobExecutionDone(getJobExecutionImpl());
+			}
+
+			if (logger.isLoggable(Level.FINE)) {
+				logger.fine("==========================================================");
+				logger.fine("Done invoking executeJob on JobController; " + "JobInstance id=" + getJobExecutionImpl().getInstanceId()
+						+ ", executionId=" + getJobExecutionImpl().getExecutionId());
+				logger.fine("Job Batch Status = " + getBatchStatus() + ";  Job Exit Status = "
+						+ getExitStatus());
+				logger.fine("==========================================================");
+			}
+
+		} catch (Throwable t) {
+			StringWriter sw = new StringWriter();
+			PrintWriter pw = new PrintWriter(sw);
+			t.printStackTrace(pw);
+			logger.warning("Caught throwable from run().  Stack trace: " + sw.toString());
+
+			if (logger.isLoggable(Level.FINE)) {
+				logger.fine("Exception when invoking executeJob on JobController; " + "JobInstance id="
+						+ getJobExecutionImpl().getInstanceId() + ", executionId=" + getJobExecutionImpl().getExecutionId());
+				logger.fine("Job Batch Status = " + getBatchStatus() + ";  Job Exit Status = "
+						+ getExitStatus());
+			}
+
+			if (isNotifyCallbackWhenDone()) {
+				getBatchKernel().jobExecutionDone(getJobExecutionImpl());
+			}
+
+			throw new BatchContainerRuntimeException("This job failed unexpectedly.", t);
+		}  finally {
+			// Put this in finally to minimize chance of tying up threads.
+			markThreadCompleted();
+		}
+
+		if (logger.isLoggable(Level.FINER)) {
+			logger.exiting(CLASSNAME, method);
+		}
+	}
+
+	protected BatchStatus getBatchStatus() {
+		return jobExecutionImpl.getJobContext().getBatchStatus();
+	}
+
+	protected String getExitStatus() {
+		return jobExecutionImpl.getJobContext().getExitStatus();
+	}
+
+	public void setBatchKernel(IBatchKernelService batchKernel) {
+		this.batchKernel = batchKernel;
+	}
+
+	public IBatchKernelService getBatchKernel() {
+		return batchKernel;
+	}
+
+	public void setJobExecutionImpl(RuntimeJobExecution jobExecutionImpl) {
+		this.jobExecutionImpl = jobExecutionImpl;
+	}
+
+	public RuntimeJobExecution getJobExecutionImpl() {
+		return jobExecutionImpl;
+	}
+
+	public void setNotifyCallbackWhenDone(boolean notifyCallbackWhenDone) {
+		this.notifyCallbackWhenDone = notifyCallbackWhenDone;
+	}
+
+	public boolean isNotifyCallbackWhenDone() {
+		return notifyCallbackWhenDone;
+	}
+
+	protected void markThreadCompleted() {
+		// No-op
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/src/com/ibm/jbatch/container/util/DependencyInjectionUtility.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/container/util/DependencyInjectionUtility.java b/JSR352.Runtime/src/com/ibm/jbatch/container/util/DependencyInjectionUtility.java
new file mode 100755
index 0000000..fb60c93
--- /dev/null
+++ b/JSR352.Runtime/src/com/ibm/jbatch/container/util/DependencyInjectionUtility.java
@@ -0,0 +1,221 @@
+/**
+ * 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 com.ibm.jbatch.container.util;
+
+import java.lang.reflect.Field;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.batch.api.BatchProperty;
+import javax.batch.runtime.context.JobContext;
+import javax.batch.runtime.context.StepContext;
+import javax.inject.Inject;
+
+
+import com.ibm.jbatch.container.artifact.proxy.InjectionReferences;
+import com.ibm.jbatch.container.exception.BatchContainerRuntimeException;
+import com.ibm.jbatch.container.exception.IllegalBatchPropertyException;
+import com.ibm.jbatch.jsl.model.Property;
+
+public class DependencyInjectionUtility {
+
+    private final static String sourceClass = DependencyInjectionUtility.class.getName();
+    private final static Logger logger = Logger.getLogger(sourceClass);
+
+    
+    public static void injectReferences(Object artifact, InjectionReferences injectionRefs) {
+        if (logger.isLoggable(Level.FINE)) {
+            logger.fine("Injecting references into: " + artifact);
+            logger.fine("InjectionReferences = " + injectionRefs);
+        }
+
+        Map<String, Field> propertyMap = findPropertyFields(artifact);
+
+        if (injectionRefs.getProps() != null) {
+            injectProperties(artifact, injectionRefs.getProps(), propertyMap);
+        }
+
+        injectBatchContextFields(artifact, injectionRefs.getJobContext(), 
+                injectionRefs.getStepContext());
+        
+        if (logger.isLoggable(Level.FINE)) {
+            logger.exiting(sourceClass, "injectReferences");
+        }
+
+    }
+    
+
+    /**
+     * 
+     * @param props
+     *            The properties directly associated with this batch artifact.
+     */
+    private static void injectProperties(Object artifact , List<Property> props, Map<String, Field> propertyFieldMap) {
+
+        //check if jsl properties are null or if 
+        //the propertyMap is null. this means there are no annotated fields with @BatchProperty
+
+        if (props == null || propertyFieldMap == null) {
+            return;
+        }
+        
+        // go through each field marked with @BatchProperty
+        for (Entry<String, Field> batchProperty : propertyFieldMap.entrySet()) {
+            String propValue = getPropertyValue(props, batchProperty.getKey());
+
+            // if a property is supplied in the job xml inject the given value
+            // into
+            // the field otherwise the default value will remain
+            try {
+                if (!(propValue == null)) {
+                    batchProperty.getValue().set(artifact, propValue);
+                } else {
+                    //DO NOTHING so that the Java initialized value is used as the default for unresolved properties
+                }
+
+            } catch (IllegalArgumentException e) {
+                throw new IllegalBatchPropertyException("The given property value is not an instance of the declared field.", e);
+            } catch (IllegalAccessException e) {
+                throw new BatchContainerRuntimeException(e);
+            }
+
+        }
+
+    }
+
+    
+    /**
+     * 
+     * @param props list of properties from job xml
+     * @param name name of the property
+     * @return null if no matching property found 
+     */
+    public static String getPropertyValue(List<Property> props, String name) {
+        if (props == null) {
+            return null;
+        }
+        
+        for (Property prop : props) {
+            if (name.equals(prop.getName())) {
+                
+                String propValue = prop.getValue();             
+                if ("".equals(propValue)){
+                    return null;
+                } else {
+                    return propValue;
+                }
+                
+            }
+        }
+        
+        
+        return null;
+    }
+
+    /**
+     * 
+     * @param artifact
+     *            An instance of the batch artifact
+     * @return an ArrayList<Field> of fields annotated with @JobContext
+     */
+    private static void injectBatchContextFields(Object artifact, JobContext jobCtx, StepContext stepCtx) {
+
+        // Go through declared field annotations
+        for (final Field field : artifact.getClass().getDeclaredFields()) {
+            AccessController.doPrivileged(new PrivilegedAction<Object>() {
+                public Object run() {
+                    field.setAccessible(true); // ignore java accessibility
+                    return null;
+                }
+            });
+
+            Inject injectAnnotation = field.getAnnotation(Inject.class);
+            if (injectAnnotation != null) {
+
+                if (logger.isLoggable(Level.FINER)) {
+                    logger.log(Level.FINER, "Found Context on (Object, field)", new Object[] { artifact, field.getName() });
+                }
+
+                try {
+                    // check the field for the context type
+                    if (JobContext.class.isAssignableFrom(field.getType())) {
+                        field.set(artifact, jobCtx);
+                    } else if (StepContext.class.isAssignableFrom(field.getType())) {
+                        field.set(artifact, stepCtx);
+                    }
+                } catch (IllegalArgumentException e) {
+                    throw new BatchContainerRuntimeException(e);
+                } catch (IllegalAccessException e) {
+                    throw new BatchContainerRuntimeException(e);
+                }
+
+            }
+        }
+
+    }
+
+    /**
+     * 
+     * @param delegate
+     *            An instance of the batch artifact
+     * @return A map of Fields annotated with @BatchProperty.
+     */
+    private static Map<String, Field> findPropertyFields(Object delegate) {
+
+        HashMap<String, Field> propertyMap = null;
+        // Go through declared field annotations
+        for (final Field field : delegate.getClass().getDeclaredFields()) {
+            AccessController.doPrivileged(new PrivilegedAction<Object>() {
+                public Object run() {
+                    field.setAccessible(true); // ignore java accessibility
+                    return null;
+                }
+            });
+
+            BatchProperty batchPropertyAnnotation = field.getAnnotation(BatchProperty.class);
+            if (batchPropertyAnnotation != null) {
+                if (propertyMap == null) {
+                    propertyMap = new HashMap<String, Field>();
+                }
+                // If a name is not supplied the batch property name defaults to
+                // the field name
+                String batchPropName = null;
+                if (batchPropertyAnnotation.name().equals("")) {
+                    batchPropName = field.getName();
+                } else {
+                    batchPropName = batchPropertyAnnotation.name();
+                }
+
+                // Check if we have already used this name for a property.
+                if (propertyMap.containsKey(batchPropName)) {
+                    throw new IllegalBatchPropertyException("There is already a batch property with this name: " + batchPropName);
+                }
+
+                propertyMap.put(batchPropName, field);
+            }
+
+        }
+        return propertyMap;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/src/com/ibm/jbatch/container/util/FlowInSplitBuilderConfig.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/container/util/FlowInSplitBuilderConfig.java b/JSR352.Runtime/src/com/ibm/jbatch/container/util/FlowInSplitBuilderConfig.java
new file mode 100755
index 0000000..38e9323
--- /dev/null
+++ b/JSR352.Runtime/src/com/ibm/jbatch/container/util/FlowInSplitBuilderConfig.java
@@ -0,0 +1,59 @@
+/**
+ * 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 com.ibm.jbatch.container.util;
+
+import java.util.concurrent.BlockingQueue;
+
+import com.ibm.jbatch.jsl.model.JSLJob;
+
+public class FlowInSplitBuilderConfig {
+
+	private JSLJob jobModel;   
+    private BlockingQueue<BatchFlowInSplitWorkUnit> completedQueue;
+    private long rootJobExecutionId;
+    
+	public FlowInSplitBuilderConfig(JSLJob jobModel,
+			BlockingQueue<BatchFlowInSplitWorkUnit> completedQueue,
+			long rootJobExecutionId) {
+		super();
+		this.jobModel = jobModel;
+		this.completedQueue = completedQueue;
+		this.rootJobExecutionId = rootJobExecutionId;
+	}
+	
+	public JSLJob getJobModel() {
+		return jobModel;
+	}
+	public void setJobModel(JSLJob jobModel) {
+		this.jobModel = jobModel;
+	}
+	public BlockingQueue<BatchFlowInSplitWorkUnit> getCompletedQueue() {
+		return completedQueue;
+	}
+	public void setCompletedQueue(
+			BlockingQueue<BatchFlowInSplitWorkUnit> completedQueue) {
+		this.completedQueue = completedQueue;
+	}
+	public long getRootJobExecutionId() {
+		return rootJobExecutionId;
+	}
+	public void setRootJobExecutionId(long rootJobExecutionId) {
+		this.rootJobExecutionId = rootJobExecutionId;
+	}
+
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/src/com/ibm/jbatch/container/util/PartitionDataWrapper.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/container/util/PartitionDataWrapper.java b/JSR352.Runtime/src/com/ibm/jbatch/container/util/PartitionDataWrapper.java
new file mode 100755
index 0000000..0af3e47
--- /dev/null
+++ b/JSR352.Runtime/src/com/ibm/jbatch/container/util/PartitionDataWrapper.java
@@ -0,0 +1,67 @@
+/**
+ * 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 com.ibm.jbatch.container.util;
+
+import java.io.Serializable;
+
+import javax.batch.runtime.BatchStatus;
+
+public class PartitionDataWrapper {
+    
+    private Serializable collectorData;
+
+    private BatchStatus batchStatus;
+    
+    private String exitStatus;
+    
+    private PartitionEventType eventType;
+
+    public enum PartitionEventType { ANALYZE_COLLECTOR_DATA, ANALYZE_STATUS }
+    
+    public BatchStatus getBatchstatus() {
+        return batchStatus;
+    }
+
+    public void setBatchStatus(BatchStatus batchStatus) {
+        this.batchStatus = batchStatus;
+    }
+
+    public String getExitStatus() {
+        return exitStatus;
+    }
+
+    public void setExitStatus(String exitStatus) {
+        this.exitStatus = exitStatus;
+    }
+
+    public Serializable getCollectorData() {
+        return collectorData;
+    }
+
+    public void setCollectorData(Serializable collectorData) {
+        this.collectorData = collectorData;
+    }
+
+    public PartitionEventType getEventType() {
+        return eventType;
+    }
+
+    public void setEventType(PartitionEventType eventType) {
+        this.eventType = eventType;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/src/com/ibm/jbatch/container/util/PartitionsBuilderConfig.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/container/util/PartitionsBuilderConfig.java b/JSR352.Runtime/src/com/ibm/jbatch/container/util/PartitionsBuilderConfig.java
new file mode 100755
index 0000000..7dc2b18
--- /dev/null
+++ b/JSR352.Runtime/src/com/ibm/jbatch/container/util/PartitionsBuilderConfig.java
@@ -0,0 +1,79 @@
+/**
+ * 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 com.ibm.jbatch.container.util;
+
+import java.util.List;
+import java.util.Properties;
+import java.util.concurrent.BlockingQueue;
+
+import com.ibm.jbatch.jsl.model.JSLJob;
+
+public class PartitionsBuilderConfig {
+
+	private List<JSLJob> jobModels;
+    private Properties[] partitionProperties;
+    private BlockingQueue<PartitionDataWrapper> analyzerQueue;
+    private BlockingQueue<BatchPartitionWorkUnit> completedQueue;
+    private long rootJobExecutionId;
+    
+	public PartitionsBuilderConfig(List<JSLJob> jobModels,
+			Properties[] partitionProperties,
+			BlockingQueue<PartitionDataWrapper> analyzerQueue,
+			BlockingQueue<BatchPartitionWorkUnit> completedQueue, 
+			long rootJobExecutionId) {
+		super();
+		this.jobModels = jobModels;
+		this.partitionProperties = partitionProperties;
+		this.analyzerQueue = analyzerQueue;
+		this.completedQueue = completedQueue;
+		this.rootJobExecutionId = rootJobExecutionId;
+	}
+    
+	public long getRootJobExecutionId() {
+		return rootJobExecutionId;
+	}
+
+    public List<JSLJob> getJobModels() {
+		return jobModels;
+	}
+	public void setJobModels(List<JSLJob> jobModels) {
+		this.jobModels = jobModels;
+	}
+	public Properties[] getPartitionProperties() {
+		return partitionProperties;
+	}
+	public void setPartitionProperties(Properties[] partitionProperties) {
+		this.partitionProperties = partitionProperties;
+	}
+	public BlockingQueue<PartitionDataWrapper> getAnalyzerQueue() {
+		return analyzerQueue;
+	}
+	public void setAnalyzerQueue(BlockingQueue<PartitionDataWrapper> analyzerQueue) {
+		this.analyzerQueue = analyzerQueue;
+	}
+	public BlockingQueue<BatchPartitionWorkUnit> getCompletedQueue() {
+		return completedQueue;
+	}
+	public void setCompletedQueue(
+			BlockingQueue<BatchPartitionWorkUnit> completedQueue) {
+		this.completedQueue = completedQueue;
+	}
+
+
+	
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/src/com/ibm/jbatch/container/util/TCCLObjectInputStream.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/container/util/TCCLObjectInputStream.java b/JSR352.Runtime/src/com/ibm/jbatch/container/util/TCCLObjectInputStream.java
new file mode 100755
index 0000000..1ed181d
--- /dev/null
+++ b/JSR352.Runtime/src/com/ibm/jbatch/container/util/TCCLObjectInputStream.java
@@ -0,0 +1,46 @@
+/**
+ * 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 com.ibm.jbatch.container.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectStreamClass;
+
+import com.ibm.jbatch.container.exception.BatchContainerRuntimeException;
+
+public class TCCLObjectInputStream extends ObjectInputStream {
+
+
+	public TCCLObjectInputStream(InputStream in) throws IOException {
+		super(in);
+	}
+	
+	@Override
+	public Class<?> resolveClass(ObjectStreamClass desc) {
+		ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+
+		try {
+			return tccl.loadClass(desc.getName());
+		} catch (ClassNotFoundException e) {
+			throw new BatchContainerRuntimeException(e);
+		}
+
+	}
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/src/com/ibm/jbatch/container/validation/ArtifactValidationException.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/container/validation/ArtifactValidationException.java b/JSR352.Runtime/src/com/ibm/jbatch/container/validation/ArtifactValidationException.java
new file mode 100755
index 0000000..6036b4d
--- /dev/null
+++ b/JSR352.Runtime/src/com/ibm/jbatch/container/validation/ArtifactValidationException.java
@@ -0,0 +1,46 @@
+/*
+ * 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 com.ibm.jbatch.container.validation;
+
+public class ArtifactValidationException extends Exception {
+
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 1L;
+
+    public ArtifactValidationException() {
+        super();
+        // TODO Auto-generated constructor stub
+    }
+
+    public ArtifactValidationException(String message, Throwable cause) {
+        super(message, cause);
+        // TODO Auto-generated constructor stub
+    }
+
+    public ArtifactValidationException(String message) {
+        super(message);
+        // TODO Auto-generated constructor stub
+    }
+
+    public ArtifactValidationException(Throwable cause) {
+        super(cause);
+        // TODO Auto-generated constructor stub
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/src/com/ibm/jbatch/spi/services/IBatchArtifactFactory.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/spi/services/IBatchArtifactFactory.java b/JSR352.Runtime/src/com/ibm/jbatch/spi/services/IBatchArtifactFactory.java
new file mode 100755
index 0000000..3a596da
--- /dev/null
+++ b/JSR352.Runtime/src/com/ibm/jbatch/spi/services/IBatchArtifactFactory.java
@@ -0,0 +1,70 @@
+/**
+ * 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.
+ */
+/*
+
+ * 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.
+ */
+	/**
+	 * Loads an instance of a batch artifact referenced in a JSL job definition XML
+	 * document.   By "batch artifact", we mean an object implementing some aspect of the
+	 * batch programming model defined in JSR352, e.g. a batchlet, a job or step listener, etc.
+	 * 
+	 * <p> The artifacts will be reference in JSL, e.g.:
+	 * 
+	 * <pre>
+	 * 
+	 *  JSL document snippet:
+	 *  ---------------------
+	 *  {@literal <}batchlet ref="MyBatchlet"{@literal >} 
+	 *  
+	 *  Java code snippet: 
+	 *  ------------------
+	 *  {@literal @}Batchlet("MyBatchlet")
+	 *  public class MyBatchletImpl
+	 * 
+	 * </pre>
+	 * 
+	 * <p>  No particular classloader scope is assumed by the interface, as the different 
+	 * implementations will define behavior here. 
+	 * 
+	 */
+package com.ibm.jbatch.spi.services;
+
+
+
+public interface IBatchArtifactFactory extends IBatchServiceBase  {
+
+	    /**
+	     * @param batchId The value of a @ref attribute in a JSL element, e.g. 'batchlet' 
+	     * 
+	     * @return An object instance of the artifact. 
+	     */
+	    public Object load(String batchId);
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/src/com/ibm/jbatch/spi/services/IBatchConfig.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/spi/services/IBatchConfig.java b/JSR352.Runtime/src/com/ibm/jbatch/spi/services/IBatchConfig.java
new file mode 100755
index 0000000..8d1b322
--- /dev/null
+++ b/JSR352.Runtime/src/com/ibm/jbatch/spi/services/IBatchConfig.java
@@ -0,0 +1,34 @@
+/*
+ * 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 com.ibm.jbatch.spi.services;
+
+import java.util.Properties;
+
+import com.ibm.jbatch.spi.DatabaseConfigurationBean;
+
+//All configuration data related to the batch container
+
+
+/**
+ * Only getters are provided here since the fields will be set in 
+ * specially-defined ways.
+ */
+public interface IBatchConfig {
+	public boolean isJ2seMode();
+	public DatabaseConfigurationBean getDatabaseConfigurationBean();
+	public Properties getConfigProperties();
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/src/com/ibm/jbatch/spi/services/IBatchServiceBase.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/spi/services/IBatchServiceBase.java b/JSR352.Runtime/src/com/ibm/jbatch/spi/services/IBatchServiceBase.java
new file mode 100755
index 0000000..e258bb5
--- /dev/null
+++ b/JSR352.Runtime/src/com/ibm/jbatch/spi/services/IBatchServiceBase.java
@@ -0,0 +1,26 @@
+/*
+ * 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 com.ibm.jbatch.spi.services;
+
+
+public interface IBatchServiceBase {
+
+	public void init(IBatchConfig batchConfig) ;
+	
+	public void shutdown() ;
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/src/com/ibm/jbatch/spi/services/IBatchThreadPoolService.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/spi/services/IBatchThreadPoolService.java b/JSR352.Runtime/src/com/ibm/jbatch/spi/services/IBatchThreadPoolService.java
new file mode 100755
index 0000000..ff356ac
--- /dev/null
+++ b/JSR352.Runtime/src/com/ibm/jbatch/spi/services/IBatchThreadPoolService.java
@@ -0,0 +1,57 @@
+/*
+ * 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 com.ibm.jbatch.spi.services;
+
+/*
+ * The ExecutorService provides the capability to run tasks asynchronously.
+ * The instances of the Executor service are not managed by the ServicesManager cache
+ * each invocation of ServicesManager.getExecutorService() returns a new instance of this 
+ * service. The caller is responsible for shutting down the service when work is completed
+ * 
+ */
+public interface IBatchThreadPoolService extends IBatchServiceBase {
+
+    /**
+     * (Required) Runs the given task. A task is usually short lived
+     * 
+     * @param work
+     *            The task to execute
+     * @param config
+     *            Optional configuration to customize the execution. The
+     *            Container always passes a null value. Typically used when
+     *            other user plugins wish to use the ExecutorService to execute
+     *            tasks.
+     */
+
+    public void executeTask(Runnable work, Object config);
+
+    /**
+     * Runs the given task. A task is usually short lived
+     * 
+     * @param work
+     *            The task to execute
+     * @param config
+     *            Optional configuration to customize the execution. The
+     *            Container always passes a null value. Typically used when
+     *            other user plugins wish to use the ExecutorService to execute
+     *            tasks.
+     */
+
+    public ParallelTaskResult executeParallelTask(Runnable work, Object config);
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/src/com/ibm/jbatch/spi/services/IJobIdManagementService.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/spi/services/IJobIdManagementService.java b/JSR352.Runtime/src/com/ibm/jbatch/spi/services/IJobIdManagementService.java
new file mode 100755
index 0000000..b3f40f7
--- /dev/null
+++ b/JSR352.Runtime/src/com/ibm/jbatch/spi/services/IJobIdManagementService.java
@@ -0,0 +1,34 @@
+/*
+ * 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 com.ibm.jbatch.spi.services;
+
+
+/**
+ * Used to generate job instance, job execution and step execution id
+ *
+ * @deprecated use {@link com.ibm.jbatch.container.services.impl.JDBCPersistenceManagerImpl()} instead.  
+ */
+public interface IJobIdManagementService extends IBatchServiceBase {
+//
+//	public void init(IBatchConfig pgcConfig);
+//		
+//	public void shutdown() ;
+//
+//	public long getInstanceId();
+//	public long getExecutionId();
+//	public long getStepExecutionId();
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/src/com/ibm/jbatch/spi/services/IJobXMLLoaderService.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/spi/services/IJobXMLLoaderService.java b/JSR352.Runtime/src/com/ibm/jbatch/spi/services/IJobXMLLoaderService.java
new file mode 100755
index 0000000..fcbfd03
--- /dev/null
+++ b/JSR352.Runtime/src/com/ibm/jbatch/spi/services/IJobXMLLoaderService.java
@@ -0,0 +1,27 @@
+/*
+ * 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 com.ibm.jbatch.spi.services;
+
+public interface IJobXMLLoaderService extends IBatchServiceBase{
+
+
+    /*
+     * Load an XML document as a String given the JSL id.
+     */
+	String loadJSL(String id);
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/src/com/ibm/jbatch/spi/services/ITransactionManagementService.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/spi/services/ITransactionManagementService.java b/JSR352.Runtime/src/com/ibm/jbatch/spi/services/ITransactionManagementService.java
new file mode 100755
index 0000000..20068f9
--- /dev/null
+++ b/JSR352.Runtime/src/com/ibm/jbatch/spi/services/ITransactionManagementService.java
@@ -0,0 +1,25 @@
+/*
+ * 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 com.ibm.jbatch.spi.services;
+
+import javax.batch.runtime.context.StepContext;
+
+public interface ITransactionManagementService extends IBatchServiceBase {
+
+	public TransactionManagerAdapter getTransactionManager(StepContext stepContext) ;
+	
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/src/com/ibm/jbatch/spi/services/ParallelTaskResult.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/spi/services/ParallelTaskResult.java b/JSR352.Runtime/src/com/ibm/jbatch/spi/services/ParallelTaskResult.java
new file mode 100755
index 0000000..2d8ab24
--- /dev/null
+++ b/JSR352.Runtime/src/com/ibm/jbatch/spi/services/ParallelTaskResult.java
@@ -0,0 +1,29 @@
+/*
+ * 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 com.ibm.jbatch.spi.services;
+
+
+
+public interface ParallelTaskResult {
+
+    /*
+     * Waits if necessary for the computation to complete.
+     */
+    public void waitForResult();
+    
+   
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/src/com/ibm/jbatch/spi/services/TransactionManagerAdapter.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/spi/services/TransactionManagerAdapter.java b/JSR352.Runtime/src/com/ibm/jbatch/spi/services/TransactionManagerAdapter.java
new file mode 100755
index 0000000..c1a541d
--- /dev/null
+++ b/JSR352.Runtime/src/com/ibm/jbatch/spi/services/TransactionManagerAdapter.java
@@ -0,0 +1,62 @@
+/*
+ * 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 com.ibm.jbatch.spi.services;
+
+/**
+ * We have this interface so that we do not try to load the 
+ * Java EE UserTransaction in an SE environment
+ */
+public interface TransactionManagerAdapter {
+	/**
+	* Create a new transaction and associate it with
+	* the current thread.
+	*/
+	public void begin();
+	/**
+	* Complete the transaction associated with the
+	* current thread.
+	*/
+	public void commit();
+	/**
+	* Obtain the status of the transaction associated
+	* with the current thread.
+	* @return The transaction status.
+	*/
+	public int getStatus();
+	/**
+	* Roll back the transaction associated with the
+	* current thread. When this method completes,
+	* the thread becomes associated with no transaction.
+	*/
+	public void rollback();
+	/**
+	* Modify the transaction associated with the current
+	* thread such that the only possible outcome of the
+	* transaction is to roll back the transaction.
+	*/
+	public void setRollbackOnly();
+	/**
+	* Modify the value of the timeout value that is
+	* associated with the transactions started by the
+	* current thread with the begin method.
+	* @param arg0 seconds - The value of the timeout
+	* in seconds. If the value is zero, the transaction
+	* service restores the default value.
+	*/
+	public void setTransactionTimeout(int arg0);
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/src/com/ibm/jbatch/spi/services/package-info.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/spi/services/package-info.java b/JSR352.Runtime/src/com/ibm/jbatch/spi/services/package-info.java
new file mode 100755
index 0000000..92f5808
--- /dev/null
+++ b/JSR352.Runtime/src/com/ibm/jbatch/spi/services/package-info.java
@@ -0,0 +1,26 @@
+/*
+ * 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.
+*/
+/**
+ * The interfaces in this package reflect the fine-grained modularity of the
+ * batch runtime.   Though there is probably enough tight-coupling that 
+ * a third-party implementation of one of these "services" might not work 
+ * out of the box, there is at least enough of a well-defined interface here
+ * that we can point to this package as the starting point for extending/modifying
+ * the batch runtime implementation with different behaviors with perhaps different
+ * qualities of service.
+ */
+package com.ibm.jbatch.spi.services;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/testJunits/META-INF/batch-jobs/alwaysFails1.xml
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/testJunits/META-INF/batch-jobs/alwaysFails1.xml b/JSR352.Runtime/testJunits/META-INF/batch-jobs/alwaysFails1.xml
new file mode 100755
index 0000000..ad7e519
--- /dev/null
+++ b/JSR352.Runtime/testJunits/META-INF/batch-jobs/alwaysFails1.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<job id="runtimejunit.alwaysFails1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
+	<step id="step1" allow-start-if-complete="true">
+		<batchlet ref="test.artifacts.RTestBatchletImpl">
+		<properties>
+			<property name="sleepTime" value="#{jobParameters['sleepTime']}" />
+		</properties>
+		</batchlet>
+		<fail on="VERY GOOD INVOCATION" exit-status="TEST_FAIL"/>
+	</step>
+</job>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/testJunits/META-INF/batch-jobs/endOnStep1Failure.xml
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/testJunits/META-INF/batch-jobs/endOnStep1Failure.xml b/JSR352.Runtime/testJunits/META-INF/batch-jobs/endOnStep1Failure.xml
new file mode 100755
index 0000000..00cf89e
--- /dev/null
+++ b/JSR352.Runtime/testJunits/META-INF/batch-jobs/endOnStep1Failure.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<job id="runtimejunit.stopOnStep1Failure" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
+	version="1.0">
+	<step id="step1" allow-start-if-complete="true" next="step2">
+		<batchlet ref="test.artifacts.RTestBatchletImpl">
+			<properties>
+				<property name="sleepTime" value="#{jobParameters['sleepTime']}" />
+				<property name="forceFailure" value="#{jobParameters['forceFailure']}" />
+			</properties>
+		</batchlet>
+		<end on="FAILED" exit-status="ALL DONE" />
+	</step>
+	<step id="step2" allow-start-if-complete="true">
+		<batchlet ref="test.artifacts.RTestBatchletImpl">
+			<properties>
+				<property name="sleepTime" value="#{jobParameters['sleepTime']}" />
+			</properties>
+		</batchlet>
+	</step>
+</job>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/testJunits/META-INF/batch-jobs/failOnStep1Failure.xml
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/testJunits/META-INF/batch-jobs/failOnStep1Failure.xml b/JSR352.Runtime/testJunits/META-INF/batch-jobs/failOnStep1Failure.xml
new file mode 100755
index 0000000..9b9c982
--- /dev/null
+++ b/JSR352.Runtime/testJunits/META-INF/batch-jobs/failOnStep1Failure.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<job id="runtimejunit.nextOnStep1Failure" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
+	<step id="step1" allow-start-if-complete="true">
+		<batchlet ref="test.artifacts.RTestBatchletImpl">
+		<properties>
+			<property name="sleepTime" value="#{jobParameters['sleepTime']}" />
+			<property name="forceFailure" value="#{jobParameters['forceFailure']}" />
+		</properties>
+		</batchlet>
+		<fail on="FAILED" exit-status="WE FAILED"/>
+		<end on="*" exit-status="ALL DONE EARLY"/>
+	</step>
+	<step id="step2" allow-start-if-complete="true">
+		<batchlet ref="test.artifacts.RTestBatchletImpl">
+		<properties>
+			<property name="sleepTime" value="#{jobParameters['sleepTime']}" />
+		</properties>
+		</batchlet>
+	</step>
+</job>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/testJunits/META-INF/batch-jobs/nextOnStep1Failure.xml
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/testJunits/META-INF/batch-jobs/nextOnStep1Failure.xml b/JSR352.Runtime/testJunits/META-INF/batch-jobs/nextOnStep1Failure.xml
new file mode 100755
index 0000000..b75ce20
--- /dev/null
+++ b/JSR352.Runtime/testJunits/META-INF/batch-jobs/nextOnStep1Failure.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<job id="runtimejunit.nextOnStep1Failure" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
+	<step id="step1" allow-start-if-complete="true">
+		<batchlet ref="test.artifacts.RTestBatchletImpl">
+		<properties>
+			<property name="sleepTime" value="#{jobParameters['sleepTime']}" />
+			<property name="forceFailure" value="#{jobParameters['forceFailure']}" />
+		</properties>
+		</batchlet>
+		<next on="FAILED" to="step2"/>
+		<end on="*" exit-status="FINISH EARLY"/>
+	</step>
+	<step id="step2" allow-start-if-complete="true">
+		<batchlet ref="test.artifacts.RTestBatchletImpl">
+		<properties>
+			<property name="sleepTime" value="#{jobParameters['sleepTime']}" />
+		</properties>
+		</batchlet>
+	</step>
+</job>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/testJunits/META-INF/batch-jobs/stopOnStep1Failure.xml
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/testJunits/META-INF/batch-jobs/stopOnStep1Failure.xml b/JSR352.Runtime/testJunits/META-INF/batch-jobs/stopOnStep1Failure.xml
new file mode 100755
index 0000000..9e41c60
--- /dev/null
+++ b/JSR352.Runtime/testJunits/META-INF/batch-jobs/stopOnStep1Failure.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<job id="runtimejunit.stopOnStep1Failure" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
+	<step id="step1" allow-start-if-complete="true" next="step2">
+		<batchlet ref="test.artifacts.RTestBatchletImpl">
+		<properties>
+			<property name="sleepTime" value="#{jobParameters['sleepTime']}" />
+			<property name="forceFailure" value="#{jobParameters['forceFailure']}" />
+		</properties>
+		</batchlet>
+		<stop on="FAILED" exit-status="IT.STOPPED"/>
+	</step>
+	<step id="step2" allow-start-if-complete="true">
+		<batchlet ref="test.artifacts.RTestBatchletImpl">
+		<properties>
+			<property name="sleepTime" value="#{jobParameters['sleepTime']}" />
+		</properties>
+		</batchlet>
+	</step>
+</job>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/testJunits/META-INF/batch-jobs/stopOnStep1FailureDefaultExitStatus.xml
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/testJunits/META-INF/batch-jobs/stopOnStep1FailureDefaultExitStatus.xml b/JSR352.Runtime/testJunits/META-INF/batch-jobs/stopOnStep1FailureDefaultExitStatus.xml
new file mode 100755
index 0000000..70b8ac1
--- /dev/null
+++ b/JSR352.Runtime/testJunits/META-INF/batch-jobs/stopOnStep1FailureDefaultExitStatus.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<job id="runtimejunit.stopOnStep1Failure" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
+	<step id="step1" allow-start-if-complete="true" next="step2">
+		<batchlet ref="test.artifacts.RTestBatchletImpl">
+		<properties>
+			<property name="sleepTime" value="#{jobParameters['sleepTime']}" />
+			<property name="forceFailure" value="#{jobParameters['forceFailure']}" />
+		</properties>
+		</batchlet>
+		<stop on="FAILED"/>
+	</step>
+	<step id="step2" allow-start-if-complete="true">
+		<batchlet ref="test.artifacts.RTestBatchletImpl">
+		<properties>
+			<property name="sleepTime" value="#{jobParameters['sleepTime']}" />
+		</properties>
+		</batchlet>
+	</step>
+</job>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/testJunits/test/artifacts/RTestBatchletImpl.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/testJunits/test/artifacts/RTestBatchletImpl.java b/JSR352.Runtime/testJunits/test/artifacts/RTestBatchletImpl.java
new file mode 100755
index 0000000..c998b48
--- /dev/null
+++ b/JSR352.Runtime/testJunits/test/artifacts/RTestBatchletImpl.java
@@ -0,0 +1,68 @@
+/*
+ * 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 test.artifacts;
+
+import java.util.logging.Logger;
+
+import javax.batch.api.AbstractBatchlet;
+import javax.batch.api.BatchProperty;
+import javax.inject.Inject;
+
+public class RTestBatchletImpl extends AbstractBatchlet {
+	private final static Logger logger = Logger.getLogger(RTestBatchletImpl.class.getName());
+
+	private volatile static int count = 1;
+
+	public static String GOOD_EXIT_STATUS = "VERY GOOD INVOCATION";       
+
+	@Inject @BatchProperty
+	public String sleepTime;
+	int sleepVal = 0;
+
+	@Inject @BatchProperty
+	public String forceFailure = "false";
+	Boolean fail;
+
+	private void init() {
+		try {
+			fail = Boolean.parseBoolean(forceFailure);
+		} catch (Exception e) { 
+			fail = false;
+		}
+		try {
+			sleepVal = Integer.parseInt(sleepTime);
+		} catch (Exception e) { 
+			sleepVal = 0;
+		}
+	}
+	@Override
+	public String process() throws Exception {	
+		init();
+		if (fail) {
+			throw new IllegalArgumentException("Forcing failure");
+		}
+		if (sleepTime != null) {
+			Thread.sleep(sleepVal);
+		}
+		logger.fine("Running batchlet process(): " + count);
+		count++;
+		return GOOD_EXIT_STATUS;
+	}
+
+	@Override
+	public void stop() throws Exception { }
+}

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/f7740962/JSR352.Runtime/testJunits/test/junit/.jazzignore
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/testJunits/test/junit/.jazzignore b/JSR352.Runtime/testJunits/test/junit/.jazzignore
new file mode 100755
index 0000000..96e07ac
--- /dev/null
+++ b/JSR352.Runtime/testJunits/test/junit/.jazzignore
@@ -0,0 +1,21 @@
+### Jazz Ignore 0
+# The property core.ignore specifies a list of file patterns that will be
+# ignored in this directory. 
+#
+# The value of core.ignore.recursive will be ignored.
+#
+# Ignored files and folders will not be committed, but may be modified during
+# accept or update.
+# Ignore properties should contain a space separated list of filename patterns.
+# Each pattern is case sensitive and surrounded by braces ('{' and '}'). 
+# "*" matches zero or more characters, and "?" matches single characters. 
+#
+#   e.g: {*.sh} {\.*}    ignores shell scripts and hidden files
+
+# NOTE: modifying ignore files will not change the ignore status of derived 
+# resources.
+
+core.ignore.recursive= 
+
+core.ignore= \
+	{AA.java} 
\ No newline at end of file