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:58 UTC
[21/62] importing batchee from github - a fork from the IBm RI
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/services/transaction/JTAUserTransactionAdapter.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/services/transaction/JTAUserTransactionAdapter.java b/jbatch/src/main/java/org/apache/batchee/container/services/transaction/JTAUserTransactionAdapter.java
new file mode 100755
index 0000000..9b31f98
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/services/transaction/JTAUserTransactionAdapter.java
@@ -0,0 +1,151 @@
+/*
+ * 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.services.transaction;
+
+import org.apache.batchee.container.exception.TransactionManagementException;
+import org.apache.batchee.spi.TransactionManagerAdapter;
+
+import javax.naming.InitialContext;
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+import javax.transaction.TransactionManager;
+
+public class JTAUserTransactionAdapter implements TransactionManagerAdapter {
+ private static final String [] JNDI_LOCS = new String[] { // taken from OpenJPA ManagedRuntime
+ "java:comp/TransactionManager", // generic, TomEE
+ "javax.transaction.TransactionManager", // weblogic
+ "java:/TransactionManager", // jboss, jrun, Geronimo
+ "java:/DefaultDomain/TransactionManager", // jrun too
+ "java:comp/pm/TransactionManager", // orion & oracle
+ "java:appserver/TransactionManager", // GlassFish
+ "java:pm/TransactionManager", // borland
+ "aries:services/javax.transaction.TransactionManager", // Apache Aries
+ };
+ private static final String [] METHODS = new String[] { // taken from OpenJPA ManagedRuntime
+ "org.openejb.OpenEJB.getTransactionManager",
+ "com.arjuna.jta.JTA_TransactionManager.transactionManager", // hp
+ "com.bluestone.jta.SaTransactionManagerFactory.SaGetTransactionManager",
+ "com.sun.jts.jta.TransactionManagerImpl.getTransactionManagerImpl",
+ "com.inprise.visitransact.jta.TransactionManagerImpl."
+ + "getTransactionManagerImpl", // borland
+ };
+
+ protected TransactionManager mgr = null;
+
+ public JTAUserTransactionAdapter() {
+ for (final String JNDI_LOC : JNDI_LOCS) {
+ try {
+ mgr = TransactionManager.class.cast(new InitialContext().lookup(JNDI_LOC));
+ } catch (final Throwable t) {
+ // no-op
+ }
+ if (mgr != null) {
+ break;
+ }
+ }
+ if (mgr == null) {
+ for (final String METHOD : METHODS) {
+ final String clazz = METHOD.substring(0, METHOD.lastIndexOf('.'));
+ final String methodName = METHOD.substring(METHOD.lastIndexOf('.') + 1);
+ try {
+ mgr = TransactionManager.class.cast(
+ Thread.currentThread().getContextClassLoader().loadClass(clazz).getMethod(methodName).invoke(null));
+ } catch (final Throwable e) {
+ // no-op
+ }
+ }
+ }
+ if (mgr == null) {
+ throw new TransactionManagementException("no transaction manager found");
+ }
+ }
+
+ @Override
+ public void begin() throws TransactionManagementException {
+ try {
+ mgr.begin();
+ } catch (final NotSupportedException e) {
+ throw new TransactionManagementException(e);
+ } catch (final SystemException e) {
+ throw new TransactionManagementException(e);
+ }
+ }
+
+ @Override
+ public void commit() throws TransactionManagementException {
+ try {
+ mgr.commit();
+ } catch (final SecurityException e) {
+ throw new TransactionManagementException(e);
+ } catch (final IllegalStateException e) {
+ throw new TransactionManagementException(e);
+ } catch (final RollbackException e) {
+ throw new TransactionManagementException(e);
+ } catch (final HeuristicMixedException e) {
+ throw new TransactionManagementException(e);
+ } catch (final HeuristicRollbackException e) {
+ throw new TransactionManagementException(e);
+ } catch (final SystemException e) {
+ throw new TransactionManagementException(e);
+ }
+ }
+
+ @Override
+ public void rollback() throws TransactionManagementException {
+ try {
+ mgr.rollback();
+ } catch (final IllegalStateException e) {
+ throw new TransactionManagementException(e);
+ } catch (final SecurityException e) {
+ throw new TransactionManagementException(e);
+ } catch (final SystemException e) {
+ throw new TransactionManagementException(e);
+ }
+ }
+
+ @Override
+ public int getStatus() throws TransactionManagementException {
+ try {
+ return mgr.getStatus();
+ } catch (final SystemException e) {
+ throw new TransactionManagementException(e);
+ }
+ }
+
+ @Override
+ public void setRollbackOnly() throws TransactionManagementException {
+ try {
+ mgr.setRollbackOnly();
+ } catch (final IllegalStateException e) {
+ throw new TransactionManagementException(e);
+ } catch (final SystemException e) {
+ throw new TransactionManagementException(e);
+ }
+ }
+
+ @Override
+ public void setTransactionTimeout(final int seconds) throws TransactionManagementException {
+ try {
+ mgr.setTransactionTimeout(seconds);
+ } catch (final SystemException e) {
+ throw new TransactionManagementException(e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/status/ExecutionStatus.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/status/ExecutionStatus.java b/jbatch/src/main/java/org/apache/batchee/container/status/ExecutionStatus.java
new file mode 100755
index 0000000..eaa19bc
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/status/ExecutionStatus.java
@@ -0,0 +1,78 @@
+/*
+ * 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.status;
+
+public class ExecutionStatus {
+ boolean batchStatusOnly;
+ private ExtendedBatchStatus extendedBatchStatus;
+ private String exitStatus;
+ private String restartOn;
+
+ // Makes it more explicit that this is not holding an exit status rather than the idea
+ // that there should logically be an exit status whose value happens to be 'null'.
+ public boolean isBatchStatusOnly() {
+ return batchStatusOnly;
+ }
+
+ public ExecutionStatus() {
+ this.batchStatusOnly = true;
+ }
+
+ public ExecutionStatus(ExtendedBatchStatus extendedBatchStatus) {
+ this();
+ this.extendedBatchStatus = extendedBatchStatus;
+ }
+
+ public ExecutionStatus(ExtendedBatchStatus extendedBatchStatus, String exitStatus) {
+ super();
+ this.extendedBatchStatus = extendedBatchStatus;
+ this.exitStatus = exitStatus;
+ this.batchStatusOnly = false;
+ }
+
+ public ExtendedBatchStatus getExtendedBatchStatus() {
+ return extendedBatchStatus;
+ }
+
+ public void setExtendedBatchStatus(ExtendedBatchStatus extendedBatchStatus) {
+ this.extendedBatchStatus = extendedBatchStatus;
+ }
+
+ public String getExitStatus() {
+ return exitStatus;
+ }
+
+ public void setExitStatus(String exitStatus) {
+ this.exitStatus = exitStatus;
+ this.batchStatusOnly = false;
+ }
+
+ public String getRestartOn() {
+ return restartOn;
+ }
+
+ public void setRestartOn(String restartOn) {
+ this.restartOn = restartOn;
+ }
+
+ @Override
+ public String toString() {
+ return "BatchStatusOnly?: " + batchStatusOnly + ", extendedBatchStatus = " + extendedBatchStatus.name() +
+ ", exitStatus = " + exitStatus +
+ ", restartOn = " + restartOn;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/status/ExtendedBatchStatus.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/status/ExtendedBatchStatus.java b/jbatch/src/main/java/org/apache/batchee/container/status/ExtendedBatchStatus.java
new file mode 100755
index 0000000..6cd1c5a
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/status/ExtendedBatchStatus.java
@@ -0,0 +1,21 @@
+/*
+ * 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.status;
+
+public enum ExtendedBatchStatus {
+ JSL_END, JSL_FAIL, JSL_STOP, NORMAL_COMPLETION, EXCEPTION_THROWN, JOB_OPERATOR_STOPPING, DO_NOT_RUN
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/status/JobStatus.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/status/JobStatus.java b/jbatch/src/main/java/org/apache/batchee/container/status/JobStatus.java
new file mode 100755
index 0000000..2b8b037
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/status/JobStatus.java
@@ -0,0 +1,138 @@
+/*
+ * 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.status;
+
+import org.apache.batchee.container.impl.JobInstanceImpl;
+
+import javax.batch.runtime.BatchStatus;
+import javax.batch.runtime.JobInstance;
+import java.io.Serializable;
+
+public class JobStatus implements Serializable, Cloneable {
+
+ private static final long serialVersionUID = 1L;
+
+ private JobInstance jobInstance;
+
+ private long jobInstanceId;
+
+ private String currentStepId;
+
+ private BatchStatus batchStatus; // Might be nice to know.
+
+ private String exitStatus;
+
+ // Assume this will be needed.
+ private long latestExecutionId;
+
+ // How many times the status has been updated.
+
+ //TODO - reset to 0?
+ //private int updateCount;
+
+ // TODO - Maybe a job operator would use this?
+ //private int restartCount;
+
+ private String restartOn;
+
+ public JobStatus(long jobInstanceId) {
+ this.jobInstanceId = jobInstanceId;
+ }
+
+ public JobStatus(JobInstance jobInstance) {
+ this.batchStatus = BatchStatus.STARTING;
+ //this.restartCount = 0;
+ // this.updateCount = 0;
+ this.jobInstance = jobInstance;
+ this.jobInstanceId = jobInstance.getInstanceId();
+ }
+
+ public long getJobInstanceId() {
+ return this.jobInstanceId;
+ }
+
+ public void setJobInstance(JobInstance jobInstance) {
+ this.jobInstance = jobInstance;
+ }
+
+ public JobInstanceImpl getJobInstance() {
+ return (JobInstanceImpl) jobInstance;
+ }
+
+ public String getCurrentStepId() {
+ return currentStepId;
+ }
+
+ public void setCurrentStepId(String currentStepId) {
+ this.currentStepId = currentStepId;
+ }
+
+ public BatchStatus getBatchStatus() {
+ return batchStatus;
+ }
+
+ public void setBatchStatus(BatchStatus batchStatus) {
+ this.batchStatus = batchStatus;
+ }
+
+ public long getLatestExecutionId() {
+ return latestExecutionId;
+ }
+
+ public void setLatestExecutionId(long latestExecutionId) {
+ this.latestExecutionId = latestExecutionId;
+ }
+
+ /*
+ public int getUpdateCount() {
+ return updateCount;
+ }
+
+ public void setUpdateCount(int updateCount) {
+ this.updateCount = updateCount;
+ }
+
+ public int getRestartCount() {
+ return restartCount;
+ }
+
+ public void setRestartCount(int restartCount) {
+ this.restartCount = restartCount;
+ }
+ */
+
+ @Override
+ public String toString() {
+ return (",currentStepId: " + currentStepId) + ",batchStatus: " + batchStatus + ",latestExecutionId: " + latestExecutionId + ",restartOn: " + restartOn;
+ }
+
+ public void setExitStatus(String exitStatus) {
+ this.exitStatus = exitStatus;
+ }
+
+ public String getExitStatus() {
+ return exitStatus;
+ }
+
+ public String getRestartOn() {
+ return restartOn;
+ }
+
+ public void setRestartOn(String restartOn) {
+ this.restartOn = restartOn;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/status/JobStatusKey.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/status/JobStatusKey.java b/jbatch/src/main/java/org/apache/batchee/container/status/JobStatusKey.java
new file mode 100755
index 0000000..4fa39c3
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/status/JobStatusKey.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 org.apache.batchee.container.status;
+
+public class JobStatusKey {
+
+ private long jobInstanceId;
+
+ public JobStatusKey(long jobInstanceId) {
+ this.jobInstanceId = jobInstanceId;
+ }
+
+ /**
+ * Note this is the only getter method, to enforce consistency
+ * in getting the instance ID as key.
+ *
+ * @return jobInstanceId
+ */
+ public long getDatabaseKey() {
+ return jobInstanceId;
+ }
+
+ public String toString() {
+ return "jobInstanceId: " + jobInstanceId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/status/SplitExecutionStatus.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/status/SplitExecutionStatus.java b/jbatch/src/main/java/org/apache/batchee/container/status/SplitExecutionStatus.java
new file mode 100755
index 0000000..e16ab0e
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/status/SplitExecutionStatus.java
@@ -0,0 +1,52 @@
+/**
+ * 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.status;
+
+public class SplitExecutionStatus extends ExecutionStatus {
+
+ boolean couldMoreThanOneFlowHaveTerminatedJob = false;
+
+ public SplitExecutionStatus() {
+ super();
+ }
+
+ public SplitExecutionStatus(ExtendedBatchStatus extendedBatchStatus) {
+ super(extendedBatchStatus);
+ }
+
+ public boolean couldMoreThanOneFlowHaveTerminatedJob() {
+ return couldMoreThanOneFlowHaveTerminatedJob;
+ }
+
+ public void setCouldMoreThanOneFlowHaveTerminatedJob(boolean flag) {
+ this.couldMoreThanOneFlowHaveTerminatedJob = flag;
+ }
+
+ @Override
+ /* Splits don't have a meaningful exit status at the split level, since we don't elevate
+ * one flow's exit status above another.
+ */
+ public String getExitStatus() {
+ return null;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + ", couldMoreThanOneFlowHaveTerminatedJob = " + couldMoreThanOneFlowHaveTerminatedJob;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/status/StepStatus.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/status/StepStatus.java b/jbatch/src/main/java/org/apache/batchee/container/status/StepStatus.java
new file mode 100755
index 0000000..9807eff
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/status/StepStatus.java
@@ -0,0 +1,141 @@
+/*
+ * 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.status;
+
+import org.apache.batchee.container.exception.BatchContainerRuntimeException;
+import org.apache.batchee.container.impl.controller.chunk.PersistentDataWrapper;
+import org.apache.batchee.container.util.TCCLObjectInputStream;
+
+import javax.batch.runtime.BatchStatus;
+import java.io.ByteArrayInputStream;
+import java.io.Serializable;
+
+public class StepStatus implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private long stepExecutionId;
+ private BatchStatus batchStatus;
+ private String exitStatus;
+ private int startCount;
+ private PersistentDataWrapper persistentUserData;
+ private Integer numPartitions;
+
+ private long lastRunStepExecutionId;
+
+ public StepStatus(final long stepExecutionId, final int startCount) {
+ this.startCount = startCount;
+ this.stepExecutionId = stepExecutionId;
+ this.lastRunStepExecutionId = stepExecutionId;
+ this.batchStatus = BatchStatus.STARTING;
+ }
+
+ public StepStatus(final long stepExecutionId) {
+ this(stepExecutionId, 1);
+ }
+
+ public void setBatchStatus(BatchStatus batchStatus) {
+ this.batchStatus = batchStatus;
+ }
+
+ public BatchStatus getBatchStatus() {
+ return batchStatus;
+ }
+
+ @Override
+ public String toString() {
+ return ("stepExecutionId: " + stepExecutionId)
+ + ",batchStatus: " + batchStatus
+ + ",exitStatus: " + exitStatus
+ + ",startCount: " + startCount
+ + ",persistentUserData: " + persistentUserData
+ + ",numPartitions: " + numPartitions;
+ }
+
+ public long getStepExecutionId() {
+ return stepExecutionId;
+ }
+
+ public int getStartCount() {
+ return startCount;
+ }
+
+ public void incrementStartCount() {
+ startCount++;
+ }
+
+ public void setExitStatus(String exitStatus) {
+ this.exitStatus = exitStatus;
+ }
+
+ public String getExitStatus() {
+ return exitStatus;
+ }
+
+ public void setPersistentUserData(final PersistentDataWrapper persistentUserData) {
+ this.persistentUserData = persistentUserData;
+ }
+
+ public byte[] getRawPersistentUserData() {
+ if (this.persistentUserData != null) {
+ return persistentUserData.getPersistentDataBytes();
+ }
+ return null;
+ }
+
+ public Serializable getPersistentUserData() {
+ if (this.persistentUserData != null) {
+ final byte[] persistentToken = this.persistentUserData.getPersistentDataBytes();
+ final ByteArrayInputStream persistentByteArrayInputStream = new ByteArrayInputStream(persistentToken);
+ TCCLObjectInputStream persistentOIS;
+ Serializable persistentObject;
+ try {
+ persistentOIS = new TCCLObjectInputStream(persistentByteArrayInputStream);
+ persistentObject = Serializable.class.cast(persistentOIS.readObject());
+ } catch (final Exception e) {
+ throw new BatchContainerRuntimeException(e);
+ }
+ return persistentObject;
+ }
+ return null;
+ }
+
+ public Integer getNumPartitions() {
+ return numPartitions;
+ }
+
+ public void setNumPartitions(Integer numPartitions) {
+ this.numPartitions = numPartitions;
+ }
+
+ public void setStepExecutionId(long stepExecutionId) {
+ this.stepExecutionId = stepExecutionId;
+ this.lastRunStepExecutionId = this.stepExecutionId;
+ }
+
+ public long getLastRunStepExecutionId() {
+ return lastRunStepExecutionId;
+ }
+
+ public void setLastRunStepExecutionId(long lastRunStepExecutionId) {
+ this.lastRunStepExecutionId = lastRunStepExecutionId;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/status/StepStatusKey.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/status/StepStatusKey.java b/jbatch/src/main/java/org/apache/batchee/container/status/StepStatusKey.java
new file mode 100755
index 0000000..5d7b0da
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/status/StepStatusKey.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 org.apache.batchee.container.status;
+
+public class StepStatusKey {
+
+ private long _jobInstanceId;
+
+ /**
+ * Not public since we don't want the instance id getter public,
+ * Only for use in trace.
+ *
+ * @return
+ */
+ private String getStepId() {
+ return _stepId;
+ }
+
+ private String _stepId;
+
+ public StepStatusKey(long jobInstanceId, String stepId) {
+ _jobInstanceId = jobInstanceId;
+ _stepId = stepId;
+ }
+
+ /**
+ * Note this is the only getter method, to enforce consistency
+ * in getting the instance ID as key.
+ *
+ * @return jobInstanceId
+ */
+ public long getDatabaseKey() {
+ return _jobInstanceId;
+ }
+
+ public String toString() {
+ return Long.toString(_jobInstanceId) + ":" + getStepId();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/util/BatchContainerConstants.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/util/BatchContainerConstants.java b/jbatch/src/main/java/org/apache/batchee/container/util/BatchContainerConstants.java
new file mode 100755
index 0000000..d9abb8d
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/util/BatchContainerConstants.java
@@ -0,0 +1,21 @@
+/*
+ * 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.util;
+
+public interface BatchContainerConstants {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/util/BatchFlowInSplitWorkUnit.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/util/BatchFlowInSplitWorkUnit.java b/jbatch/src/main/java/org/apache/batchee/container/util/BatchFlowInSplitWorkUnit.java
new file mode 100755
index 0000000..2f2bd7c
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/util/BatchFlowInSplitWorkUnit.java
@@ -0,0 +1,48 @@
+/**
+ * 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.util;
+
+import org.apache.batchee.container.impl.controller.FlowInSplitThreadRootController;
+import org.apache.batchee.container.impl.jobinstance.RuntimeFlowInSplitExecution;
+import org.apache.batchee.container.services.BatchKernelService;
+
+import java.util.concurrent.BlockingQueue;
+
+public class BatchFlowInSplitWorkUnit extends BatchParallelWorkUnit {
+ protected final BlockingQueue<BatchFlowInSplitWorkUnit> completedThreadQueue;
+
+ public BatchFlowInSplitWorkUnit(final BatchKernelService batchKernelService,
+ final RuntimeFlowInSplitExecution jobExecution,
+ final FlowInSplitBuilderConfig config) {
+ super(batchKernelService, jobExecution, true);
+ this.completedThreadQueue = config.getCompletedQueue();
+ this.controller = new FlowInSplitThreadRootController(jobExecution, config);
+ }
+
+ @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/efa64877/jbatch/src/main/java/org/apache/batchee/container/util/BatchParallelWorkUnit.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/util/BatchParallelWorkUnit.java b/jbatch/src/main/java/org/apache/batchee/container/util/BatchParallelWorkUnit.java
new file mode 100755
index 0000000..f25a4c7
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/util/BatchParallelWorkUnit.java
@@ -0,0 +1,32 @@
+/**
+ * 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.util;
+
+import org.apache.batchee.container.impl.jobinstance.RuntimeJobExecution;
+import org.apache.batchee.container.services.BatchKernelService;
+
+/*
+ * 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(final BatchKernelService batchKernel, final RuntimeJobExecution jobExecutionImpl, final boolean notifyCallbackWhenDone) {
+ super(batchKernel, jobExecutionImpl, notifyCallbackWhenDone);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/util/BatchPartitionPlan.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/util/BatchPartitionPlan.java b/jbatch/src/main/java/org/apache/batchee/container/util/BatchPartitionPlan.java
new file mode 100755
index 0000000..85aceb4
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/util/BatchPartitionPlan.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 org.apache.batchee.container.util;
+
+import javax.batch.api.partition.PartitionPlan;
+import java.util.Properties;
+
+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/efa64877/jbatch/src/main/java/org/apache/batchee/container/util/BatchPartitionWorkUnit.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/util/BatchPartitionWorkUnit.java b/jbatch/src/main/java/org/apache/batchee/container/util/BatchPartitionWorkUnit.java
new file mode 100755
index 0000000..f139c08
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/util/BatchPartitionWorkUnit.java
@@ -0,0 +1,42 @@
+/**
+ * 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.util;
+
+import org.apache.batchee.container.impl.controller.PartitionThreadRootController;
+import org.apache.batchee.container.impl.jobinstance.RuntimeJobExecution;
+import org.apache.batchee.container.services.BatchKernelService;
+
+import java.util.concurrent.BlockingQueue;
+
+public class BatchPartitionWorkUnit extends BatchParallelWorkUnit {
+ protected final BlockingQueue<BatchPartitionWorkUnit> completedThreadQueue;
+
+ public BatchPartitionWorkUnit(BatchKernelService batchKernelService,
+ RuntimeJobExecution jobExecution,
+ PartitionsBuilderConfig config) {
+ super(batchKernelService, jobExecution, true);
+ this.completedThreadQueue = config.getCompletedQueue();
+ this.controller = new PartitionThreadRootController(jobExecution, config);
+ }
+
+ @Override
+ protected void markThreadCompleted() {
+ if (this.completedThreadQueue != null) {
+ completedThreadQueue.add(this);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/util/BatchWorkUnit.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/util/BatchWorkUnit.java b/jbatch/src/main/java/org/apache/batchee/container/util/BatchWorkUnit.java
new file mode 100755
index 0000000..3ddf59b
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/util/BatchWorkUnit.java
@@ -0,0 +1,117 @@
+/**
+ * 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.util;
+
+import org.apache.batchee.container.ThreadRootController;
+import org.apache.batchee.container.exception.BatchContainerRuntimeException;
+import org.apache.batchee.container.impl.controller.JobController;
+import org.apache.batchee.container.impl.jobinstance.RuntimeJobExecution;
+import org.apache.batchee.container.services.BatchKernelService;
+
+import javax.batch.runtime.BatchStatus;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+/*
+ * 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 {
+ protected RuntimeJobExecution jobExecutionImpl = null;
+ protected BatchKernelService batchKernel = null;
+ protected ThreadRootController controller;
+
+ protected boolean notifyCallbackWhenDone;
+
+ public BatchWorkUnit(final BatchKernelService batchKernel, final RuntimeJobExecution jobExecutionImpl) {
+ this(batchKernel, jobExecutionImpl, true);
+ }
+
+ public BatchWorkUnit(final BatchKernelService batchKernel, final RuntimeJobExecution jobExecutionImpl,
+ final boolean notifyCallbackWhenDone) {
+ this.setBatchKernel(batchKernel);
+ this.setJobExecutionImpl(jobExecutionImpl);
+ this.setNotifyCallbackWhenDone(notifyCallbackWhenDone);
+ this.controller = new JobController(jobExecutionImpl);
+ }
+
+ public ThreadRootController getController() {
+ return this.controller;
+ }
+
+ @Override
+ public void run() {
+ try {
+ controller.originateExecutionOnThread();
+
+ if (isNotifyCallbackWhenDone()) {
+ getBatchKernel().jobExecutionDone(getJobExecutionImpl());
+ }
+ } catch (final Throwable t) {
+ final StringWriter sw = new StringWriter();
+ final PrintWriter pw = new PrintWriter(sw);
+ t.printStackTrace(pw);
+
+ 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();
+ }
+ }
+
+ protected BatchStatus getBatchStatus() {
+ return jobExecutionImpl.getJobContext().getBatchStatus();
+ }
+
+ protected String getExitStatus() {
+ return jobExecutionImpl.getJobContext().getExitStatus();
+ }
+
+ public void setBatchKernel(BatchKernelService batchKernel) {
+ this.batchKernel = batchKernel;
+ }
+
+ public BatchKernelService 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/efa64877/jbatch/src/main/java/org/apache/batchee/container/util/ClassLoaderAwareHandler.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/util/ClassLoaderAwareHandler.java b/jbatch/src/main/java/org/apache/batchee/container/util/ClassLoaderAwareHandler.java
new file mode 100644
index 0000000..8055106
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/util/ClassLoaderAwareHandler.java
@@ -0,0 +1,54 @@
+/**
+ * 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.util;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+public class ClassLoaderAwareHandler implements InvocationHandler {
+ private static final Class<?>[] RUNNABLE_API = new Class<?>[]{Runnable.class};
+
+ private final ClassLoader loader;
+ private final Object delegate;
+
+ public ClassLoaderAwareHandler(final ClassLoader contextClassLoader, final Object instance) {
+ loader = contextClassLoader;
+ delegate = instance;
+ }
+
+ @Override
+ public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
+ final ClassLoader current = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(loader);
+ try {
+ return method.invoke(delegate, args);
+ } finally {
+ Thread.currentThread().setContextClassLoader(current);
+ }
+ }
+
+ public static <T> T makeLoaderAware(final Class<T> mainApi, final Class<?>[] clazz, final Object instance) {
+ final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ return mainApi.cast(Proxy.newProxyInstance(contextClassLoader, clazz, new ClassLoaderAwareHandler(contextClassLoader, instance)));
+ }
+
+ public static Runnable runnableLoaderAware(final Object instance) { // too common to not get a shortcut
+ final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ return Runnable.class.cast(Proxy.newProxyInstance(contextClassLoader, RUNNABLE_API, new ClassLoaderAwareHandler(contextClassLoader, instance)));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/util/DependencyInjections.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/util/DependencyInjections.java b/jbatch/src/main/java/org/apache/batchee/container/util/DependencyInjections.java
new file mode 100755
index 0000000..c2fd7e1
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/util/DependencyInjections.java
@@ -0,0 +1,191 @@
+/**
+ * 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.util;
+
+import org.apache.batchee.container.exception.BatchContainerRuntimeException;
+import org.apache.batchee.container.exception.IllegalBatchPropertyException;
+import org.apache.batchee.container.proxy.InjectionReferences;
+import org.apache.batchee.jaxb.Property;
+
+import javax.batch.api.BatchProperty;
+import javax.batch.runtime.context.JobContext;
+import javax.batch.runtime.context.StepContext;
+import javax.inject.Inject;
+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;
+
+public class DependencyInjections {
+ public static void injectReferences(final Object artifact, final InjectionReferences injectionRefs) {
+ final Map<String, Field> propertyMap = findPropertyFields(artifact);
+ if (injectionRefs.getProps() != null) {
+ injectProperties(artifact, injectionRefs.getProps(), propertyMap);
+ }
+ injectBatchContextFields(artifact, injectionRefs.getJobContext(), injectionRefs.getStepContext());
+ }
+
+
+ /**
+ * @param props The properties directly associated with this batch artifact.
+ */
+ private static void injectProperties(final Object artifact, final List<Property> props, final 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 (final 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);
+ }
+ } 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(final List<Property> props, final String name) {
+ if (props == null) {
+ return null;
+ }
+
+ for (final 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(final Object artifact, final JobContext jobCtx, final StepContext stepCtx) {
+ // Go through declared field annotations
+ for (final Field field : artifact.getClass().getDeclaredFields()) {
+ setAccessible(field);
+
+ final Inject injectAnnotation = field.getAnnotation(Inject.class);
+ if (injectAnnotation != null) {
+ try {
+ // check the field for the context type
+ if (JobContext.class.isAssignableFrom(field.getType()) && field.get(artifact) == null) {
+ field.set(artifact, jobCtx);
+ } else if (StepContext.class.isAssignableFrom(field.getType()) && field.get(artifact) == null) {
+ field.set(artifact, stepCtx);
+ }
+ } catch (final IllegalArgumentException e) {
+ throw new BatchContainerRuntimeException(e);
+ } catch (final 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(final Object delegate) {
+ Map<String, Field> propertyMap = null;
+
+ Class<?> current = delegate.getClass();
+ while (current.getName().contains("$$")) { // remove common proxies
+ current = current.getSuperclass();
+ }
+
+ while (current != null && current != Object.class) {
+ for (final Field field : current.getDeclaredFields()) {
+ setAccessible(field);
+
+ final 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);
+ }
+
+ }
+ current = current.getSuperclass();
+ }
+ return propertyMap;
+ }
+
+ private static void setAccessible(final Field field) {
+ if (System.getSecurityManager() == null) {
+ field.setAccessible(true);
+ } else {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ field.setAccessible(true); // ignore java accessibility
+ return null;
+ }
+ });
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/util/FlowInSplitBuilderConfig.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/util/FlowInSplitBuilderConfig.java b/jbatch/src/main/java/org/apache/batchee/container/util/FlowInSplitBuilderConfig.java
new file mode 100755
index 0000000..fd87a25
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/util/FlowInSplitBuilderConfig.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 org.apache.batchee.container.util;
+
+import org.apache.batchee.jaxb.JSLJob;
+
+import java.util.concurrent.BlockingQueue;
+
+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 BlockingQueue<BatchFlowInSplitWorkUnit> getCompletedQueue() {
+ return 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/efa64877/jbatch/src/main/java/org/apache/batchee/container/util/PartitionDataWrapper.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/util/PartitionDataWrapper.java b/jbatch/src/main/java/org/apache/batchee/container/util/PartitionDataWrapper.java
new file mode 100755
index 0000000..49562ec
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/util/PartitionDataWrapper.java
@@ -0,0 +1,66 @@
+/**
+ * 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.util;
+
+import javax.batch.runtime.BatchStatus;
+import java.io.Serializable;
+
+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/efa64877/jbatch/src/main/java/org/apache/batchee/container/util/PartitionsBuilderConfig.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/util/PartitionsBuilderConfig.java b/jbatch/src/main/java/org/apache/batchee/container/util/PartitionsBuilderConfig.java
new file mode 100755
index 0000000..d46f459
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/util/PartitionsBuilderConfig.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 org.apache.batchee.container.util;
+
+import org.apache.batchee.jaxb.JSLJob;
+
+import java.util.List;
+import java.util.Properties;
+import java.util.concurrent.BlockingQueue;
+
+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) {
+ 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 Properties[] getPartitionProperties() {
+ return partitionProperties;
+ }
+
+ public BlockingQueue<PartitionDataWrapper> getAnalyzerQueue() {
+ return analyzerQueue;
+ }
+
+ public BlockingQueue<BatchPartitionWorkUnit> getCompletedQueue() {
+ return completedQueue;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/util/Serializations.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/util/Serializations.java b/jbatch/src/main/java/org/apache/batchee/container/util/Serializations.java
new file mode 100644
index 0000000..c60ac82
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/util/Serializations.java
@@ -0,0 +1,65 @@
+/*
+ * 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.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+
+public final class Serializations {
+ /**
+ * This method is used to serialized an object saved into a table BLOB field.
+ *
+ * @param theObject the object to be serialized
+ * @return a object byte array
+ * @throws java.io.IOException
+ */
+ public static byte[] serialize(final Serializable theObject) throws IOException {
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ final ObjectOutputStream oout = new ObjectOutputStream(baos);
+ oout.writeObject(theObject);
+ final byte[] data = baos.toByteArray();
+ baos.close();
+ oout.close();
+ return data;
+ }
+
+ /**
+ * This method is used to de-serialized a table BLOB field to its original object form.
+ *
+ * @param buffer the byte array save a BLOB
+ * @return the object saved as byte array
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ public static Serializable deserialize(final byte[] buffer) throws IOException, ClassNotFoundException {
+ Serializable theObject = null;
+ if (buffer != null) {
+ final ObjectInputStream objectIn = new TCCLObjectInputStream(new ByteArrayInputStream(buffer));
+ theObject = Serializable.class.cast(objectIn.readObject());
+ objectIn.close();
+ }
+ return theObject;
+ }
+
+ private Serializations() {
+ // no-op
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/container/util/TCCLObjectInputStream.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/util/TCCLObjectInputStream.java b/jbatch/src/main/java/org/apache/batchee/container/util/TCCLObjectInputStream.java
new file mode 100755
index 0000000..b88bc6f
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/container/util/TCCLObjectInputStream.java
@@ -0,0 +1,51 @@
+/**
+ * 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.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectStreamClass;
+import java.lang.reflect.Proxy;
+
+public class TCCLObjectInputStream extends ObjectInputStream {
+ private final ClassLoader tccl;
+
+ public TCCLObjectInputStream(final InputStream in) throws IOException {
+ super(in);
+ tccl = Thread.currentThread().getContextClassLoader();
+ }
+
+ @Override
+ protected Class<?> resolveClass(final ObjectStreamClass desc) throws ClassNotFoundException {
+ return Class.forName(desc.getName(), false, tccl);
+ }
+
+ @Override
+ protected Class resolveProxyClass(final String[] interfaces) throws IOException, ClassNotFoundException {
+ final Class[] cinterfaces = new Class[interfaces.length];
+ for (int i = 0; i < interfaces.length; i++) {
+ cinterfaces[i] = Class.forName(interfaces[i], false, tccl);
+ }
+
+ try {
+ return Proxy.getProxyClass(tccl, cinterfaces);
+ } catch (IllegalArgumentException e) {
+ throw new ClassNotFoundException(null, e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/jaxb/Analyzer.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/jaxb/Analyzer.java b/jbatch/src/main/java/org/apache/batchee/jaxb/Analyzer.java
new file mode 100644
index 0000000..7b69d93
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/jaxb/Analyzer.java
@@ -0,0 +1,85 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2013.08.27 at 09:45:12 AM CEST
+//
+
+
+package org.apache.batchee.jaxb;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for Analyzer complex type.
+ * <p/>
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p/>
+ * <pre>
+ * <complexType name="Analyzer">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="properties" type="{http://xmlns.jcp.org/xml/ns/javaee}Properties" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="ref" use="required" type="{http://xmlns.jcp.org/xml/ns/javaee}artifactRef" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "Analyzer", propOrder = {
+ "properties"
+})
+public class Analyzer {
+
+ protected JSLProperties properties;
+ @XmlAttribute(name = "ref", required = true)
+ protected String ref;
+
+ /**
+ * Gets the value of the properties property.
+ *
+ * @return possible object is
+ * {@link JSLProperties }
+ */
+ public JSLProperties getProperties() {
+ return properties;
+ }
+
+ /**
+ * Sets the value of the properties property.
+ *
+ * @param value allowed object is
+ * {@link JSLProperties }
+ */
+ public void setProperties(JSLProperties value) {
+ this.properties = value;
+ }
+
+ /**
+ * Gets the value of the ref property.
+ *
+ * @return possible object is
+ * {@link String }
+ */
+ public String getRef() {
+ return ref;
+ }
+
+ /**
+ * Sets the value of the ref property.
+ *
+ * @param value allowed object is
+ * {@link String }
+ */
+ public void setRef(String value) {
+ this.ref = value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/jaxb/BatchArtifactRef.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/jaxb/BatchArtifactRef.java b/jbatch/src/main/java/org/apache/batchee/jaxb/BatchArtifactRef.java
new file mode 100644
index 0000000..f35e330
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/jaxb/BatchArtifactRef.java
@@ -0,0 +1,82 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2013.08.27 at 09:45:12 AM CEST
+//
+
+
+package org.apache.batchee.jaxb;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for BatchArtifactRef complex type.
+ * <p/>
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p/>
+ * <pre>
+ * <complexType name="BatchArtifactRef">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="id" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="class" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "BatchArtifactRef")
+public class BatchArtifactRef {
+
+ @XmlAttribute(name = "id", required = true)
+ protected String id;
+ @XmlAttribute(name = "class", required = true)
+ protected String clazz;
+
+ /**
+ * Gets the value of the id property.
+ *
+ * @return possible object is
+ * {@link String }
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Sets the value of the id property.
+ *
+ * @param value allowed object is
+ * {@link String }
+ */
+ public void setId(String value) {
+ this.id = value;
+ }
+
+ /**
+ * Gets the value of the clazz property.
+ *
+ * @return possible object is
+ * {@link String }
+ */
+ public String getClazz() {
+ return clazz;
+ }
+
+ /**
+ * Sets the value of the clazz property.
+ *
+ * @param value allowed object is
+ * {@link String }
+ */
+ public void setClazz(String value) {
+ this.clazz = value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/jaxb/BatchArtifacts.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/jaxb/BatchArtifacts.java b/jbatch/src/main/java/org/apache/batchee/jaxb/BatchArtifacts.java
new file mode 100644
index 0000000..7750baf
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/jaxb/BatchArtifacts.java
@@ -0,0 +1,70 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2013.08.27 at 09:45:12 AM CEST
+//
+
+
+package org.apache.batchee.jaxb;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * <p>Java class for BatchArtifacts complex type.
+ * <p/>
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p/>
+ * <pre>
+ * <complexType name="BatchArtifacts">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="ref" type="{http://xmlns.jcp.org/xml/ns/javaee}BatchArtifactRef" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "BatchArtifacts", propOrder = {
+ "ref"
+})
+public class BatchArtifacts {
+
+ protected List<BatchArtifactRef> ref;
+
+ /**
+ * Gets the value of the ref property.
+ * <p/>
+ * <p/>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the ref property.
+ * <p/>
+ * <p/>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getRef().add(newItem);
+ * </pre>
+ * <p/>
+ * <p/>
+ * <p/>
+ * Objects of the following type(s) are allowed in the list
+ * {@link BatchArtifactRef }
+ */
+ public List<BatchArtifactRef> getRef() {
+ if (ref == null) {
+ ref = new ArrayList<BatchArtifactRef>();
+ }
+ return this.ref;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/jaxb/Batchlet.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/jaxb/Batchlet.java b/jbatch/src/main/java/org/apache/batchee/jaxb/Batchlet.java
new file mode 100644
index 0000000..406cb64
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/jaxb/Batchlet.java
@@ -0,0 +1,85 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2013.08.27 at 09:45:12 AM CEST
+//
+
+
+package org.apache.batchee.jaxb;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for Batchlet complex type.
+ * <p/>
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p/>
+ * <pre>
+ * <complexType name="Batchlet">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="properties" type="{http://xmlns.jcp.org/xml/ns/javaee}Properties" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="ref" use="required" type="{http://xmlns.jcp.org/xml/ns/javaee}artifactRef" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "Batchlet", propOrder = {
+ "properties"
+})
+public class Batchlet {
+
+ protected JSLProperties properties;
+ @XmlAttribute(name = "ref", required = true)
+ protected String ref;
+
+ /**
+ * Gets the value of the properties property.
+ *
+ * @return possible object is
+ * {@link JSLProperties }
+ */
+ public JSLProperties getProperties() {
+ return properties;
+ }
+
+ /**
+ * Sets the value of the properties property.
+ *
+ * @param value allowed object is
+ * {@link JSLProperties }
+ */
+ public void setProperties(JSLProperties value) {
+ this.properties = value;
+ }
+
+ /**
+ * Gets the value of the ref property.
+ *
+ * @return possible object is
+ * {@link String }
+ */
+ public String getRef() {
+ return ref;
+ }
+
+ /**
+ * Sets the value of the ref property.
+ *
+ * @param value allowed object is
+ * {@link String }
+ */
+ public void setRef(String value) {
+ this.ref = value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/jbatch/src/main/java/org/apache/batchee/jaxb/CheckpointAlgorithm.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/jaxb/CheckpointAlgorithm.java b/jbatch/src/main/java/org/apache/batchee/jaxb/CheckpointAlgorithm.java
new file mode 100644
index 0000000..97716b2
--- /dev/null
+++ b/jbatch/src/main/java/org/apache/batchee/jaxb/CheckpointAlgorithm.java
@@ -0,0 +1,85 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2013.08.27 at 09:45:12 AM CEST
+//
+
+
+package org.apache.batchee.jaxb;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for CheckpointAlgorithm complex type.
+ * <p/>
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p/>
+ * <pre>
+ * <complexType name="CheckpointAlgorithm">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="properties" type="{http://xmlns.jcp.org/xml/ns/javaee}Properties" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="ref" use="required" type="{http://xmlns.jcp.org/xml/ns/javaee}artifactRef" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "CheckpointAlgorithm", propOrder = {
+ "properties"
+})
+public class CheckpointAlgorithm {
+
+ protected JSLProperties properties;
+ @XmlAttribute(name = "ref", required = true)
+ protected String ref;
+
+ /**
+ * Gets the value of the properties property.
+ *
+ * @return possible object is
+ * {@link JSLProperties }
+ */
+ public JSLProperties getProperties() {
+ return properties;
+ }
+
+ /**
+ * Sets the value of the properties property.
+ *
+ * @param value allowed object is
+ * {@link JSLProperties }
+ */
+ public void setProperties(JSLProperties value) {
+ this.properties = value;
+ }
+
+ /**
+ * Gets the value of the ref property.
+ *
+ * @return possible object is
+ * {@link String }
+ */
+ public String getRef() {
+ return ref;
+ }
+
+ /**
+ * Sets the value of the ref property.
+ *
+ * @param value allowed object is
+ * {@link String }
+ */
+ public void setRef(String value) {
+ this.ref = value;
+ }
+
+}