You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@batchee.apache.org by rm...@apache.org on 2013/11/05 08:39:27 UTC
[50/62] importing batchee from github - a fork from the IBm RI
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/JSR352.Runtime/src/com/ibm/jbatch/container/services/IBatchKernelService.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/container/services/IBatchKernelService.java b/JSR352.Runtime/src/com/ibm/jbatch/container/services/IBatchKernelService.java
deleted file mode 100755
index ab9b161..0000000
--- a/JSR352.Runtime/src/com/ibm/jbatch/container/services/IBatchKernelService.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.services;
-
-import java.util.List;
-import java.util.Properties;
-
-import javax.batch.operations.JobExecutionAlreadyCompleteException;
-import javax.batch.operations.JobExecutionNotMostRecentException;
-import javax.batch.operations.JobExecutionNotRunningException;
-import javax.batch.operations.JobRestartException;
-import javax.batch.operations.JobStartException;
-import javax.batch.operations.NoSuchJobExecutionException;
-import javax.batch.runtime.JobInstance;
-
-import com.ibm.jbatch.container.jobinstance.RuntimeJobExecution;
-import com.ibm.jbatch.container.util.BatchFlowInSplitWorkUnit;
-import com.ibm.jbatch.container.util.BatchPartitionWorkUnit;
-import com.ibm.jbatch.container.util.BatchWorkUnit;
-import com.ibm.jbatch.container.util.FlowInSplitBuilderConfig;
-import com.ibm.jbatch.container.util.PartitionsBuilderConfig;
-import com.ibm.jbatch.spi.BatchSecurityHelper;
-import com.ibm.jbatch.spi.services.IBatchServiceBase;
-
-public interface IBatchKernelService extends IBatchServiceBase {
-
- IJobExecution getJobExecution(long executionId) throws NoSuchJobExecutionException;
-
- IJobExecution restartJob(long executionID) throws JobRestartException, JobExecutionAlreadyCompleteException, JobExecutionNotMostRecentException, NoSuchJobExecutionException;
-
- IJobExecution restartJob(long executionID, Properties overrideJobParameters) throws JobRestartException, JobExecutionAlreadyCompleteException, JobExecutionNotMostRecentException, NoSuchJobExecutionException;
-
- IJobExecution startJob(String jobXML) throws JobStartException;
-
- IJobExecution startJob(String jobXML, Properties jobParameters) throws JobStartException;
-
- void stopJob(long executionID) throws NoSuchJobExecutionException, JobExecutionNotRunningException;
-
- void jobExecutionDone(RuntimeJobExecution jobExecution);
-
- int getJobInstanceCount(String jobName);
-
- JobInstance getJobInstance(long instanceId);
-
- BatchSecurityHelper getBatchSecurityHelper();
-
- List<BatchPartitionWorkUnit> buildNewParallelPartitions(PartitionsBuilderConfig config) throws JobRestartException, JobStartException;
-
- List<BatchPartitionWorkUnit> buildOnRestartParallelPartitions(PartitionsBuilderConfig config) throws JobRestartException, JobExecutionAlreadyCompleteException, JobExecutionNotMostRecentException;
-
- void startGeneratedJob(BatchWorkUnit batchWork);
-
- void restartGeneratedJob(BatchWorkUnit batchWork) throws JobRestartException;
-
- boolean isExecutionRunning(long executionId);
-
- BatchFlowInSplitWorkUnit buildNewFlowInSplitWorkUnit(
- FlowInSplitBuilderConfig config);
-
- BatchFlowInSplitWorkUnit buildOnRestartFlowInSplitWorkUnit(
- FlowInSplitBuilderConfig config);
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/JSR352.Runtime/src/com/ibm/jbatch/container/services/IJobExecution.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/container/services/IJobExecution.java b/JSR352.Runtime/src/com/ibm/jbatch/container/services/IJobExecution.java
deleted file mode 100755
index a8313ef..0000000
--- a/JSR352.Runtime/src/com/ibm/jbatch/container/services/IJobExecution.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * 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.services;
-
-import java.sql.Timestamp;
-import java.util.Properties;
-
-import javax.batch.runtime.JobExecution;
-
-import com.ibm.jbatch.container.context.impl.JobContextImpl;
-
-public interface IJobExecution extends JobExecution {
-
- public void setBatchStatus(String status);
-
- public void setCreateTime(Timestamp ts);
-
- public void setEndTime(Timestamp ts);
-
- public void setExitStatus(String status);
-
- public void setLastUpdateTime(Timestamp ts);
-
- public void setStartTime(Timestamp ts);
-
- public void setJobParameters(Properties jProps);
-
- public long getInstanceId();
-
- public void setJobContext(JobContextImpl jobContext);
-}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/JSR352.Runtime/src/com/ibm/jbatch/container/services/IJobStatusManagerService.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/container/services/IJobStatusManagerService.java b/JSR352.Runtime/src/com/ibm/jbatch/container/services/IJobStatusManagerService.java
deleted file mode 100755
index fca7843..0000000
--- a/JSR352.Runtime/src/com/ibm/jbatch/container/services/IJobStatusManagerService.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.services;
-
-import javax.batch.runtime.BatchStatus;
-
-import com.ibm.jbatch.container.exception.BatchContainerServiceException;
-import com.ibm.jbatch.container.status.JobStatus;
-import com.ibm.jbatch.container.status.StepStatus;
-import com.ibm.jbatch.spi.services.IBatchServiceBase;
-
-public interface IJobStatusManagerService extends IBatchServiceBase {
-
- /**
- * This method creates an entry for a new job instance
- *
- */
- public JobStatus createJobStatus(long jobInstanceId) throws BatchContainerServiceException;
-
- public void updateJobStatus(JobStatus jobStatus);
-
- /**
- * Returns the JobStatus for a given jobInstance id
- * @param jobId
- * @return
- * @throws BatchContainerServiceException
- */
- public abstract JobStatus getJobStatus(long jobInstanceId) throws BatchContainerServiceException;
-
- public abstract JobStatus getJobStatusFromExecutionId(long executionId) throws BatchContainerServiceException;
-
- public void updateJobBatchStatus(long jobInstanceId, BatchStatus batchStatus) throws BatchContainerServiceException;
- public void updateJobExecutionStatus(long jobInstanceId, BatchStatus batchStatus, String exitStatus) throws BatchContainerServiceException;
- public void updateJobStatusFromJSLStop(long jobInstanceId, String restartOn) throws BatchContainerServiceException;
-
- /*
- * A side effect of this method is that it nulls out the 'restartOn' value from the previous execution gets zeroed out.
- *
- * Also sets BatchStatus to STARTING
- */
- public void updateJobStatusWithNewExecution(long jobInstanceId, long newExecutionId) throws BatchContainerServiceException;
-
-
- public abstract void updateJobCurrentStep(long jobInstanceId, String currentStepName) throws BatchContainerServiceException;
-
- /**
- * Creates an entry for the step in the stepstatus table during jobsetup
- * @param stepId
- * @throws BatchContainerServiceException
- */
- public abstract StepStatus createStepStatus(long stepExecutionId) throws BatchContainerServiceException;
-
- public abstract void updateStepStatus(long stepExecutionId, StepStatus newStepStatus) throws BatchContainerServiceException;
-
-
- public abstract StepStatus getStepStatus(long jobInstanceId, String stepId) throws BatchContainerServiceException ;
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/JSR352.Runtime/src/com/ibm/jbatch/container/services/IPersistenceManagerService.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/container/services/IPersistenceManagerService.java b/JSR352.Runtime/src/com/ibm/jbatch/container/services/IPersistenceManagerService.java
deleted file mode 100755
index 96e3398..0000000
--- a/JSR352.Runtime/src/com/ibm/jbatch/container/services/IPersistenceManagerService.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * 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.services;
-
-import java.sql.Timestamp;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import javax.batch.operations.NoSuchJobExecutionException;
-import javax.batch.runtime.BatchStatus;
-import javax.batch.runtime.JobInstance;
-import javax.batch.runtime.StepExecution;
-
-import com.ibm.jbatch.container.context.impl.StepContextImpl;
-import com.ibm.jbatch.container.jobinstance.RuntimeFlowInSplitExecution;
-import com.ibm.jbatch.container.jobinstance.RuntimeJobExecution;
-import com.ibm.jbatch.container.jobinstance.StepExecutionImpl;
-import com.ibm.jbatch.container.persistence.CheckpointData;
-import com.ibm.jbatch.container.persistence.CheckpointDataKey;
-import com.ibm.jbatch.container.status.JobStatus;
-import com.ibm.jbatch.container.status.StepStatus;
-import com.ibm.jbatch.spi.services.IBatchServiceBase;
-
-public interface IPersistenceManagerService extends IBatchServiceBase {
-
- public enum TimestampType { CREATE, END, LAST_UPDATED, STARTED };
-
- /**
- * JOB OPERATOR ONLY METHODS
- */
-
- public int jobOperatorGetJobInstanceCount(String jobName);
-
- public int jobOperatorGetJobInstanceCount(String jobName, String appTag);
-
- public Map<Long, String> jobOperatorGetExternalJobInstanceData();
-
- public List<Long> jobOperatorGetJobInstanceIds(String jobName, int start, int count);
-
- public List<Long> jobOperatorGetJobInstanceIds(String jobName, String appTag, int start, int count);
-
- public Timestamp jobOperatorQueryJobExecutionTimestamp(long key, TimestampType timetype);
-
- public String jobOperatorQueryJobExecutionBatchStatus(long key);
-
- public String jobOperatorQueryJobExecutionExitStatus(long key);
-
- public long jobOperatorQueryJobExecutionJobInstanceId(long executionID) throws NoSuchJobExecutionException;
-
- public List<StepExecution> getStepExecutionsForJobExecution(long execid);
-
- public Map<String, StepExecution> getMostRecentStepExecutionsForJobInstance(long instanceId);
-
- public void updateBatchStatusOnly(long executionId, BatchStatus batchStatus, Timestamp timestamp);
-
- public void markJobStarted(long key, Timestamp startTS);
-
- public void updateWithFinalExecutionStatusesAndTimestamps(long key, BatchStatus batchStatus, String exitStatus, Timestamp updatets);
-
- public IJobExecution jobOperatorGetJobExecution(long jobExecutionId);
-
- public Properties getParameters(long executionId) throws NoSuchJobExecutionException;
-
- public List<IJobExecution> jobOperatorGetJobExecutions(long jobInstanceId);
-
- public Set<Long> jobOperatorGetRunningExecutions(String jobName);
-
- public String getJobCurrentTag(long jobInstanceId);
-
- public void purge(String apptag);
-
- public JobStatus getJobStatusFromExecution(long executionId);
-
- public long getJobInstanceIdByExecutionId(long executionId) throws NoSuchJobExecutionException;
-
- // JOBINSTANCEDATA
- /**
- * Creates a JobIntance
- *
- * @param name the job id from job.xml
- * @param apptag the application tag that owns this job
- * @param jobXml the resolved job xml
- * @param jobParameters parameters used for this job
- * @return the job instance
- */
- public JobInstance createJobInstance(String name, String apptag, String jobXml);
-
- // EXECUTIONINSTANCEDATA
- /**
- * Create a JobExecution
- *
- * @param jobInstance the parent job instance
- * @param jobParameters the parent job instance parameters
- * @param batchStatus the current BatchStatus
- * @return the RuntimeJobExecution class for this JobExecution
- */
- RuntimeJobExecution createJobExecution(JobInstance jobInstance, Properties jobParameters, BatchStatus batchStatus);
-
- // STEPEXECUTIONINSTANCEDATA
- /**
- * Create a StepExecution
- *
- * @param jobExecId the parent JobExecution id
- * @param stepContext the step context for this step execution
- * @return the StepExecution
- */
- public StepExecutionImpl createStepExecution(long jobExecId, StepContextImpl stepContext);
-
- /**
- * Update a StepExecution
- *
- * @param jobExecId the parent JobExecution id
- * @param stepContext the step context for this step execution
- */
- public void updateStepExecution(long jobExecId, StepContextImpl stepContext);
-
-
-
- // JOB_STATUS
- /**
- * Create a JobStatus
- *
- * @param jobInstanceId the parent job instance id
- * @return the JobStatus
- */
- public JobStatus createJobStatus(long jobInstanceId);
-
- /**
- * Get a JobStatus
- *
- * @param instanceId the parent job instance id
- * @return the JobStatus
- */
- public JobStatus getJobStatus(long instanceId);
-
- /**
- * Update a JobStatus
- *
- * @param instanceId the parent job instance id
- * @param jobStatus the job status to be updated
- */
- public void updateJobStatus(long instanceId, JobStatus jobStatus);
-
- // STEP_STATUS
- /**
- * Create a StepStatus
- *
- * @param stepExecId the parent step execution id
- * @return the StepStatus
- */
- public StepStatus createStepStatus(long stepExecId);
-
- /**
- * Get a StepStatus
- *
- * The parent job instance id and this step name from the job xml
- * are used to determine if the current step execution have previously run.
- *
- * @param instanceId the parent job instance id
- * @param stepName the step name
- * @return the StepStatus
- */
- public StepStatus getStepStatus(long instanceId, String stepName);
-
- /**
- * Update a StepStatus
- *
- * @param stepExecutionId the parent step execution id
- * @param stepStatus the step status to be updated
- */
- public void updateStepStatus(long stepExecutionId, StepStatus stepStatus);
-
-
- /**
- * Get the application name from an execution id.
- *
- * @param jobExecutionId the job execution id
- * @return the application name
- */
- public String getTagName(long jobExecutionId);
-
-
- public void updateCheckpointData(CheckpointDataKey key, CheckpointData value);
-
- CheckpointData getCheckpointData(CheckpointDataKey key);
-
- void createCheckpointData(CheckpointDataKey key, CheckpointData value);
-
- long getMostRecentExecutionId(long jobInstanceId);
-
- JobInstance createSubJobInstance(String name, String apptag);
-
- public RuntimeFlowInSplitExecution createFlowInSplitExecution(JobInstance jobInstance, BatchStatus batchStatus);
-
- public StepExecution getStepExecutionByStepExecutionId(long stepExecId);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/AbstractThreadPoolServiceImpl.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/AbstractThreadPoolServiceImpl.java b/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/AbstractThreadPoolServiceImpl.java
deleted file mode 100755
index d055d83..0000000
--- a/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/AbstractThreadPoolServiceImpl.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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.services.impl;
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import com.ibm.jbatch.container.exception.BatchContainerServiceException;
-import com.ibm.jbatch.spi.services.IBatchConfig;
-import com.ibm.jbatch.spi.services.IBatchThreadPoolService;
-import com.ibm.jbatch.spi.services.ParallelTaskResult;
-
-public abstract class AbstractThreadPoolServiceImpl implements IBatchThreadPoolService {
-
- private final static String sourceClass = AbstractThreadPoolServiceImpl.class.getName();
- private final static Logger logger = Logger.getLogger(sourceClass);
-
- protected ExecutorService executorService;
-
- public AbstractThreadPoolServiceImpl() {
- if(logger.isLoggable(Level.FINE)) {
- logger.fine("Instantiating instance of thread pool impl: " + this.getClass().getCanonicalName());
- }
- }
-
- public abstract void init(IBatchConfig pgcConfig) throws BatchContainerServiceException;
-
- public void shutdown() throws BatchContainerServiceException {
- String method = "shutdown";
- if(logger.isLoggable(Level.FINER)) { logger.entering(sourceClass, method); }
-
- executorService.shutdownNow();
- executorService = null;
-
- if(logger.isLoggable(Level.FINER)) { logger.exiting(sourceClass, method); }
-
- }
-
- public void executeTask(Runnable work, Object config) {
- String method = "executeTask";
- if(logger.isLoggable(Level.FINER)) { logger.entering(sourceClass, method); }
-
- executorService.execute(work);
-
- if(logger.isLoggable(Level.FINER)) { logger.exiting(sourceClass, method); }
-
- }
-
- public ParallelTaskResult executeParallelTask(Runnable work, Object config) {
- String method = "executeParallelTask";
- if(logger.isLoggable(Level.FINER)) { logger.entering(sourceClass, method); }
-
- Future result = executorService.submit(work);
- ParallelTaskResult taskResult = new JSEResultAdapter(result);
-
- if(logger.isLoggable(Level.FINER)) { logger.exiting(sourceClass, method); }
-
- return taskResult;
- }
-
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/BatchTransactionServiceImpl.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/BatchTransactionServiceImpl.java b/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/BatchTransactionServiceImpl.java
deleted file mode 100755
index ae72004..0000000
--- a/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/BatchTransactionServiceImpl.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * 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.services.impl;
-
-import java.util.Properties;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.batch.runtime.context.StepContext;
-
-import com.ibm.jbatch.container.exception.BatchContainerServiceException;
-import com.ibm.jbatch.container.exception.TransactionManagementException;
-import com.ibm.jbatch.container.transaction.impl.DefaultNonTransactionalManager;
-import com.ibm.jbatch.container.transaction.impl.JTAUserTransactionAdapter;
-import com.ibm.jbatch.spi.services.IBatchConfig;
-import com.ibm.jbatch.spi.services.ITransactionManagementService;
-import com.ibm.jbatch.spi.services.TransactionManagerAdapter;
-
-public class BatchTransactionServiceImpl implements ITransactionManagementService {
-
- private static final String CLASSNAME = BatchTransactionServiceImpl.class.getName();
- private static final Logger logger = Logger.getLogger(CLASSNAME);
-
- private static final int DEFAULT_TRAN_TIMEOUT = 180; // seconds
-
- /**
- * batch configuration properties.
- */
- private IBatchConfig batchConfig = null;
-
- /**
- * constructor
- */
- public BatchTransactionServiceImpl() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * com.ibm.jbatch.container.services.IBatchServiceBase#init(com.ibm.batch
- * .container.IBatchConfig)
- */
- @Override
- public void init(IBatchConfig batchConfig) throws BatchContainerServiceException {
- logger.entering(CLASSNAME, "init", batchConfig);
- this.batchConfig = batchConfig;
- logger.exiting(CLASSNAME, "init");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ibm.jbatch.container.services.IBatchServiceBase#shutdown()
- */
- @Override
- public void shutdown() throws BatchContainerServiceException {
- logger.entering(CLASSNAME, "shutdown");
- logger.fine("do nothing");
- logger.exiting(CLASSNAME, "shutdown");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ibm.jbatch.container.services.ITransactionManagementService#
- * getTransactionManager(javax.batch.runtime.context.StepContext)
- */
- @Override
- public TransactionManagerAdapter getTransactionManager(StepContext stepContext) throws TransactionManagementException {
- logger.entering(CLASSNAME, "getTransactionManager", stepContext);
-
- TransactionManagerAdapter transactionManager = null;
-
- // get the JTA tran manager if we are in Java EE
- if (! this.batchConfig.isJ2seMode()) {
- // use the container JNDI java:comp/UserTransaction
- logger.fine("getting transaction object from JNDI java:comp/UserTransaction");
- transactionManager = new JTAUserTransactionAdapter("java:comp/UserTransaction");
- }
- else if (this.batchConfig.isJ2seMode()) {
- // If we are in J2SE mode use the non-transactional manager
-
- // java environment is Java SE
- // NoOp transaction manager
- logger.fine("J2SE mode non-transactional manager");
- transactionManager = new DefaultNonTransactionalManager();
- }
-
-
- int timeout = getTransactionTimeout(stepContext);
- logger.log(Level.FINE, "transaction timeout {0}", timeout);
- try {
- transactionManager.setTransactionTimeout(timeout);
- } catch (Exception e) {
- throw new TransactionManagementException(e);
- }
-
- logger.exiting(CLASSNAME, "getTransactionManager", transactionManager);
- return transactionManager;
- }
-
-
- /**
- * @param stepContext
- * @return global transaction timeout defined in step properties. default
- * timeout value is 180
- *
- */
- private int getTransactionTimeout(final StepContext stepContext) {
- logger.entering(CLASSNAME, "getTransactionTimeout", stepContext);
- Properties p = stepContext.getProperties();
- int timeout = DEFAULT_TRAN_TIMEOUT; // default as per spec.
- if (p != null && !p.isEmpty()) {
-
- String propertyTimeOut = p.getProperty("javax.transaction.global.timeout");
- if (logger.isLoggable(Level.FINE)) {
- logger.log(Level.FINE, "javax.transaction.global.timeout = {0}", propertyTimeOut==null ? "<null>" : propertyTimeOut);
- }
- if (propertyTimeOut != null && !propertyTimeOut.isEmpty()) {
- timeout = Integer.parseInt(propertyTimeOut, 10);
- }
- }
- logger.exiting(CLASSNAME, "getTransactionTimeout", timeout);
- return timeout;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/BoundedThreadPoolServiceImpl.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/BoundedThreadPoolServiceImpl.java b/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/BoundedThreadPoolServiceImpl.java
deleted file mode 100755
index 6f050f7..0000000
--- a/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/BoundedThreadPoolServiceImpl.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.services.impl;
-
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import com.ibm.jbatch.container.exception.BatchContainerServiceException;
-import com.ibm.jbatch.container.util.BatchContainerConstants;
-import com.ibm.jbatch.spi.services.IBatchConfig;
-
-public class BoundedThreadPoolServiceImpl extends AbstractThreadPoolServiceImpl implements BatchContainerConstants {
-
- private final static String sourceClass = BoundedThreadPoolServiceImpl.class.getName();
- private final static Logger logger = Logger.getLogger(sourceClass);
-
- public BoundedThreadPoolServiceImpl() {
- super();
- }
-
- private String defaultMaxThreadPoolSize = "5";
- int idleThreadTimeout = 900; //threadPoolConfig.getIdleThreadTimeout();
- int maxQueueSize = 4096; //threadPoolConfig.getMaxQueueSize();
- int minThreadPoolSize = 3; // threadPoolConfig.getMinThreadPoolSize();
-
- @Override
- public void init(IBatchConfig batchConfig)
- throws BatchContainerServiceException {
-
- String method = "init";
- if(logger.isLoggable(Level.FINER)) { logger.entering(sourceClass, method); }
-
- String maxThreadPoolSizeStr = batchConfig.getConfigProperties().
- getProperty(BOUNDED_THREADPOOL_MAX_POOL_SIZE, defaultMaxThreadPoolSize);
-
- int maxThreadPoolSize = Integer.parseInt(maxThreadPoolSizeStr);
-
- if(logger.isLoggable(Level.FINE)) {
- logger.fine("Glassfish thread pool settings: (" + minThreadPoolSize + "," + maxThreadPoolSize + ","
- + idleThreadTimeout + "," + TimeUnit.SECONDS + "," + maxQueueSize + ")");
- }
-
- BlockingQueue<Runnable> queue = null;
- if (maxQueueSize == -1) {
- queue = new LinkedBlockingQueue<Runnable>();
- } else {
- queue = new LinkedBlockingQueue<Runnable>(maxQueueSize);
- }
-
- executorService = new ThreadPoolExecutor(minThreadPoolSize, maxThreadPoolSize, idleThreadTimeout, TimeUnit.SECONDS, queue);
-
- if(logger.isLoggable(Level.FINER)) { logger.exiting(sourceClass, method); }
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/CDIBatchArtifactFactoryImpl.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/CDIBatchArtifactFactoryImpl.java b/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/CDIBatchArtifactFactoryImpl.java
deleted file mode 100755
index 37ac674..0000000
--- a/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/CDIBatchArtifactFactoryImpl.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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.services.impl;
-
-import java.util.logging.Logger;
-
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.naming.InitialContext;
-
-import com.ibm.jbatch.container.exception.BatchContainerServiceException;
-import com.ibm.jbatch.spi.services.IBatchArtifactFactory;
-import com.ibm.jbatch.spi.services.IBatchConfig;
-
-public class CDIBatchArtifactFactoryImpl implements IBatchArtifactFactory {
-
- private final static Logger logger = Logger.getLogger(CDIBatchArtifactFactoryImpl.class.getName());
- private final static String CLASSNAME = CDIBatchArtifactFactoryImpl.class.getName();
-
- @Override
- public Object load(String batchId) {
- String methodName = "load";
-
- logger.entering(CLASSNAME, methodName, "Loading batch artifact id = " + batchId);
-
- Object loadedArtifact = getArtifactById(batchId);
-
- if (loadedArtifact != null) {
- logger.exiting(CLASSNAME, methodName, "For batch artifact id = " + batchId + ", loaded artifact instance: " + loadedArtifact
- + " of type: " + loadedArtifact.getClass().getCanonicalName());
- } else {
- logger.exiting(CLASSNAME, methodName, "For batch artifact id = " + batchId + ", FAILED to load artifact instance");
- }
- return loadedArtifact;
- }
-
- private Object getArtifactById(String id) {
-
- Object artifactInstance = null;
-
- try {
- InitialContext initialContext = new InitialContext();
- BeanManager bm = (BeanManager) initialContext.lookup("java:comp/BeanManager");
- Bean bean = bm.getBeans(id).iterator().next();
- Class clazz = bean.getBeanClass();
- artifactInstance = bm.getReference(bean, clazz, bm.createCreationalContext(bean));
- } catch (Exception e) {
- // Don't throw an exception but simply return null;
- logger.fine("Tried but failed to load artifact with id: " + id + ", Exception = " + e);
- }
-
- return artifactInstance;
- }
-
- @Override
- public void init(IBatchConfig batchConfig) throws BatchContainerServiceException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void shutdown() throws BatchContainerServiceException {
- // TODO Auto-generated method stub
-
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/DelegatingBatchArtifactFactoryImpl.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/DelegatingBatchArtifactFactoryImpl.java b/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/DelegatingBatchArtifactFactoryImpl.java
deleted file mode 100755
index 36d4180..0000000
--- a/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/DelegatingBatchArtifactFactoryImpl.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * 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.services.impl;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamReader;
-
-import com.ibm.jbatch.container.artifact.proxy.ProxyFactory;
-import com.ibm.jbatch.container.exception.BatchContainerRuntimeException;
-import com.ibm.jbatch.container.exception.BatchContainerServiceException;
-import com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl;
-import com.ibm.jbatch.container.util.DependencyInjectionUtility;
-import com.ibm.jbatch.spi.services.IBatchArtifactFactory;
-import com.ibm.jbatch.spi.services.IBatchConfig;
-
-public class DelegatingBatchArtifactFactoryImpl implements IBatchArtifactFactory, XMLStreamConstants {
-
- private final static Logger logger = Logger.getLogger(DelegatingBatchArtifactFactoryImpl.class.getName());
- private final static String CLASSNAME = DelegatingBatchArtifactFactoryImpl.class.getName();
-
- protected static IBatchArtifactFactory preferredArtifactFactory = ServicesManagerImpl.getInstance().getPreferredArtifactFactory();
-
-
- // TODO - surface constants
- private final static String BATCH_XML = "META-INF/batch.xml";
- private final static QName BATCH_ROOT_ELEM = new QName("http://xmlns.jcp.org/xml/ns/javaee", "batch-artifacts");
-
- // Uses TCCL
- @Override
- public Object load(String batchId) {
- String methodName = "load";
-
- if (logger.isLoggable(Level.FINER)) {
- logger.entering(CLASSNAME, methodName, "Loading batch artifact id = " + batchId);
- }
-
- if (logger.isLoggable(Level.FINER)) {
- logger.log(Level.FINER, "Delegating to preferred artifact factory" + preferredArtifactFactory);
- }
-
- //If preferred artifact factory is different from this one, use the preferred factory.
- if (!preferredArtifactFactory.getClass().equals(this.getClass())) {
- Object artifact = preferredArtifactFactory.load(batchId);
- if (artifact != null) {
- return artifact;
- }
- }
-
- if (logger.isLoggable(Level.FINER)) {
- logger.log(Level.FINER, "Preferred artifact factory failed to load artifact " + batchId +". Defaulting to batch.xml.");
- }
-
- ClassLoader tccl = Thread.currentThread().getContextClassLoader();
-
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("TCCL = " + tccl);
- }
-
- ArtifactMap artifactMap = initArtifactMapFromClassLoader(tccl);
-
- Object loadedArtifact = null;
- if (artifactMap != null) {
- loadedArtifact = artifactMap.getArtifactById(batchId);
- }
-
- if (loadedArtifact == null) {
- if (logger.isLoggable(Level.FINER)) {
- logger.log(Level.FINER, "Artifact not found in batch.xml, trying classloader");
- }
-
- try {
- Class<?> artifactClass = Thread.currentThread().getContextClassLoader().loadClass(batchId);
- if(artifactClass != null) {
- loadedArtifact = artifactClass.newInstance();
- }
- } catch (ClassNotFoundException e) {
- throw new BatchContainerRuntimeException("Tried but failed to load artifact with id: " + batchId, e);
- } catch (InstantiationException e) {
- throw new BatchContainerRuntimeException("Tried but failed to load artifact with id: " + batchId, e);
- } catch (IllegalAccessException e) {
- throw new BatchContainerRuntimeException("Tried but failed to load artifact with id: " + batchId, e);
- }
- }
-
- DependencyInjectionUtility.injectReferences(loadedArtifact, ProxyFactory.getInjectionReferences());
-
- if (logger.isLoggable(Level.FINER)) {
- logger.exiting(CLASSNAME, methodName, "For batch artifact id = " + batchId + ", loaded artifact instance: " +
- loadedArtifact + " of type: " + loadedArtifact.getClass().getCanonicalName());
- }
- return loadedArtifact;
- }
-
- private ArtifactMap initArtifactMapFromClassLoader(ClassLoader loader) {
- ArtifactMap artifactMap = new ArtifactMap();
-
- InputStream is = getBatchXMLStreamFromClassLoader(loader);
- if (is == null) {
- return null;
- } else {
- artifactMap = populateArtifactMapFromStream(artifactMap, is);
- }
-
- return artifactMap;
- }
-
- protected InputStream getBatchXMLStreamFromClassLoader(ClassLoader loader) {
- return loader.getResourceAsStream(BATCH_XML);
- }
-
- /*
- * Non-validating (e.g. that the artifact type is correct) load
- *
- * TODO - add some logging to the parsing
- */
- protected ArtifactMap populateArtifactMapFromStream(ArtifactMap tempMap, InputStream is) {
- XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
-
- try {
- XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(is);
-
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("Loaded XMLStreamReader = " + xmlStreamReader);
- }
-
- boolean processedRoot = false;
-
- // We are going to take advantage of the simplified structure of a
- // line
- // E.g.:
- // <batch-artifacts>
- // <item-processor id=MyItemProcessor class=jsr352/sample/MyItemProcessorImpl/>
- // ..
- // </batch-artifacts>
- //
- // and have much simpler logic than general-purpose parsing would
- // require.
- while (xmlStreamReader.hasNext()) {
- int event = xmlStreamReader.next();
-
- // Until we reach end of document
- if (event == END_DOCUMENT) {
- break;
- }
-
- // At this point we have either:
- // A) just passed START_DOCUMENT, and are at START_ELEMENT for the root,
- // <batch-artifacts>, or
- // B) we have just passed END_ELEMENT for one of the artifacts which is a child of
- // <batch-artifacts>.
- //
- // Only handle START_ELEMENT now so we can skip whitespace CHARACTERS events.
- //
- if (event == START_ELEMENT) {
- if (!processedRoot) {
- QName rootQName = xmlStreamReader.getName();
- if (!rootQName.equals(BATCH_ROOT_ELEM)) {
- throw new IllegalStateException("Expecting document with root element QName: " + BATCH_ROOT_ELEM
- + ", but found root element with QName: " + rootQName);
- } else {
- processedRoot = true;
- }
- } else {
-
- // Should only need localName
- String annotationShortName = xmlStreamReader.getLocalName();
- String id = xmlStreamReader.getAttributeValue(null, "id");
- String className = xmlStreamReader.getAttributeValue(null, "class");
- tempMap.addEntry(annotationShortName, id, className);
-
- // Ignore anything else (text/whitespace) within this
- // element
- while (event != END_ELEMENT) {
- event = xmlStreamReader.next();
- }
- }
- }
- }
- xmlStreamReader.close();
- is.close();
- return tempMap;
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- private class ArtifactMap {
-
- private Map<String, Class<?>> idToArtifactClassMap = new HashMap<String, Class<?>>();
-
- // Maps to a list of types not a single type since there's no reason a single artifact couldn't be annotated
- // with >1 batch artifact annotation type.
- private Map<String, List<String>> idToArtifactTypeListMap = new HashMap<String, List<String>>();
-
- /*
- * Init already synchronized, so no need to synch further
- */
- private void addEntry(String batchTypeName, String id, String className) {
- try {
- if (!idToArtifactClassMap.containsKey(id)) {
- Class<?> artifactClass = Thread.currentThread().getContextClassLoader().loadClass(className);
-
- idToArtifactClassMap.put(id, artifactClass);
- List<String> typeList = new ArrayList<String>();
- typeList.add(batchTypeName);
- idToArtifactTypeListMap.put(id, typeList);
- } else {
-
- Class<?> artifactClass = Thread.currentThread().getContextClassLoader().loadClass(className);
-
- // Already contains entry for this 'id', let's make sure it's the same Class
- // which thus must implement >1 batch artifact "type" (i.e. contains >1 batch artifact annotation).
- if (!idToArtifactClassMap.get(id).equals(artifactClass)) {
- if (logger.isLoggable(Level.SEVERE)) {
- Class<?> alreadyLoaded = idToArtifactClassMap.get(id);
- logger.severe("Attempted to load batch artifact with id: " + id + ", and className: " + className +
- ". Found: " + artifactClass + ", however the artifact id: " + id +
- " is already associated with: " + alreadyLoaded + ", of className: " +
- alreadyLoaded.getCanonicalName());
-
- }
- throw new IllegalArgumentException("Already loaded a different class for id = " + id);
- }
- List<String> typeList = idToArtifactTypeListMap.get(id);
- typeList.add(batchTypeName);
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- private Object getArtifactById(String id) {
-
- Object artifactInstance = null;
-
- try {
- Class<?> clazz = idToArtifactClassMap.get(id);
- if (clazz != null) {
- artifactInstance = (idToArtifactClassMap.get(id)).newInstance();
- }
- } catch (IllegalAccessException e) {
- throw new BatchContainerRuntimeException("Tried but failed to load artifact with id: " + id, e);
- } catch (InstantiationException e) {
- throw new BatchContainerRuntimeException("Tried but failed to load artifact with id: " + id, e);
- }
-
-
- return artifactInstance;
- }
-
- private List<String> getBatchTypeList(String id) {
- return idToArtifactTypeListMap.get(id);
- }
-
- }
-
- @Override
- public void init(IBatchConfig batchConfig) throws BatchContainerServiceException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void shutdown() throws BatchContainerServiceException {
- // TODO Auto-generated method stub
-
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/DelegatingJobXMLLoaderServiceImpl.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/DelegatingJobXMLLoaderServiceImpl.java b/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/DelegatingJobXMLLoaderServiceImpl.java
deleted file mode 100755
index e89d051..0000000
--- a/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/DelegatingJobXMLLoaderServiceImpl.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * 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.services.impl;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import com.ibm.jbatch.container.exception.BatchContainerRuntimeException;
-import com.ibm.jbatch.container.exception.BatchContainerServiceException;
-import com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl;
-import com.ibm.jbatch.spi.services.IBatchConfig;
-import com.ibm.jbatch.spi.services.IJobXMLLoaderService;
-
-public class DelegatingJobXMLLoaderServiceImpl implements IJobXMLLoaderService {
-
-
- private final static Logger logger = Logger.getLogger(DelegatingBatchArtifactFactoryImpl.class.getName());
- private final static String CLASSNAME = DelegatingBatchArtifactFactoryImpl.class.getName();
-
- protected static IJobXMLLoaderService preferredJobXmlLoader = ServicesManagerImpl.getInstance().getPreferredJobXMLLoaderService();
-
- public static final String PREFIX = "META-INF/batch-jobs/";
-
-
- @Override
- public String loadJSL(String id) {
-
- String method = "loadJob";
-
- logger.entering(CLASSNAME, method);
-
- String jobXML = null;
-
- if (!preferredJobXmlLoader.getClass().equals(this.getClass())) {
- jobXML = preferredJobXmlLoader.loadJSL(id);
- } else {
- if (logger.isLoggable(Level.FINER)) {
- logger.log(Level.FINER, "No preferred job xml loader is detected in configuration");
- }
- }
-
- if (jobXML != null) {
- if (logger.isLoggable(Level.FINER)) {
- logger.log(Level.FINER, "Preferred job xml loader loaded job with id " + id +".");
- }
- return jobXML;
- }
-
- if (logger.isLoggable(Level.FINER)) {
- logger.log(Level.FINER, "Preferred job xml loader failed to load " + id +". Defaulting to " + PREFIX);
- }
-
- jobXML = loadJobFromBatchJobs(id);
-
- if (jobXML == null) {
-
- if (logger.isLoggable(Level.FINER)) {
- logger.log(Level.FINER, "Failed to load " + id +" from " + PREFIX);
- }
-
- throw new BatchContainerServiceException("Could not load job xml with id: " + id);
- }
-
- if (logger.isLoggable(Level.FINER)) {
- logger.log(Level.FINER, "Loaded job xml with " + id +" from " + PREFIX);
- }
-
- return jobXML;
-
- }
-
-
- private static String loadJobFromBatchJobs(String id) {
-
- ClassLoader tccl = Thread.currentThread().getContextClassLoader();
-
- String relativePath = PREFIX + id + ".xml";
-
- InputStream stream = tccl.getResourceAsStream(relativePath);
-
- if (stream == null) {
- throw new BatchContainerRuntimeException(new FileNotFoundException(
- "Cannot find an XML file under " + PREFIX + " with the following name " + id + ".xml"));
- }
-
- return readJobXML(stream);
-
- }
-
-
- private static String readJobXML(InputStream stream) {
-
- StringBuffer out = new StringBuffer();
-
- try {
- byte[] b = new byte[4096];
- for (int i; (i = stream.read(b)) != -1;) {
- out.append(new String(b, 0, i));
- }
- } catch (FileNotFoundException e) {
- throw new BatchContainerServiceException(e);
- } catch (IOException e) {
- throw new BatchContainerServiceException(e);
- }
-
- return out.toString();
- }
-
-
- @Override
- public void init(IBatchConfig batchConfig) throws BatchContainerServiceException {
- // TODO Auto-generated method stub
-
- }
-
-
- @Override
- public void shutdown() throws BatchContainerServiceException {
- // TODO Auto-generated method stub
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/DirectoryJobXMLLoaderServiceImpl.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/DirectoryJobXMLLoaderServiceImpl.java b/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/DirectoryJobXMLLoaderServiceImpl.java
deleted file mode 100755
index ae3e0a4..0000000
--- a/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/DirectoryJobXMLLoaderServiceImpl.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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.services.impl;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.logging.Logger;
-
-import com.ibm.jbatch.container.exception.BatchContainerServiceException;
-import com.ibm.jbatch.spi.services.IBatchConfig;
-import com.ibm.jbatch.spi.services.IJobXMLLoaderService;
-
-
-public class DirectoryJobXMLLoaderServiceImpl implements IJobXMLLoaderService {
-
-
- private final static Logger logger = Logger.getLogger(DelegatingBatchArtifactFactoryImpl.class.getName());
- private final static String CLASSNAME = DirectoryJobXMLLoaderServiceImpl.class.getName();
-
- public static final String JOB_XML_DIR_PROP = "com.ibm.jbatch.jsl.directory";
- public static final String JOB_XML_PATH = System.getProperty(JOB_XML_DIR_PROP);
-
-
- @Override
- public String loadJSL(String id) {
-
-
- String jobXML = loadJobFromDirectory(JOB_XML_PATH, id);
-
- return jobXML;
-
- }
-
-
- private static String loadJobFromDirectory(String dir, String id) {
-
- File jobXMLFile = new File (JOB_XML_PATH, id + ".xml");
-
- String xmlString = readJobXML(jobXMLFile);
-
- return xmlString;
-
- }
-
-
- private static String readJobXML(File fileWithPath) {
-
- StringBuffer xmlBuffer = ( fileWithPath==null ? null : new StringBuffer() );
- try {
- if ( !(fileWithPath==null) ) {
- BufferedReader in = new BufferedReader(new FileReader(fileWithPath));
- String input = in.readLine();
- do {
- if (input != null) {
- xmlBuffer.append(input);
- input = in.readLine();
- }
- } while (input!=null);
- }
- } catch (FileNotFoundException e) {
- throw new BatchContainerServiceException("Could not find file " + fileWithPath);
- } catch (IOException e) {
- throw new BatchContainerServiceException(e);
- }
-
- return ( xmlBuffer==null ? null : xmlBuffer.toString() );
-
- }
-
-
- @Override
- public void init(IBatchConfig batchConfig) throws BatchContainerServiceException {
- // TODO Auto-generated method stub
-
- }
-
-
- @Override
- public void shutdown() throws BatchContainerServiceException {
- // TODO Auto-generated method stub
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/GrowableThreadPoolServiceImpl.java
----------------------------------------------------------------------
diff --git a/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/GrowableThreadPoolServiceImpl.java b/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/GrowableThreadPoolServiceImpl.java
deleted file mode 100755
index 65f2404..0000000
--- a/JSR352.Runtime/src/com/ibm/jbatch/container/services/impl/GrowableThreadPoolServiceImpl.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2012,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.services.impl;
-
-import java.util.concurrent.Executors;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import com.ibm.jbatch.container.exception.BatchContainerServiceException;
-import com.ibm.jbatch.spi.services.IBatchConfig;
-
-public class GrowableThreadPoolServiceImpl extends AbstractThreadPoolServiceImpl {
-
- private final static String sourceClass = GrowableThreadPoolServiceImpl.class.getName();
- private final static Logger logger = Logger.getLogger(sourceClass);
-
- public GrowableThreadPoolServiceImpl() {
- super();
- }
-
- public void init(IBatchConfig pgcConfig) throws BatchContainerServiceException {
- String method = "init";
- if(logger.isLoggable(Level.FINER)) { logger.entering(sourceClass, method); }
-
- executorService = Executors.newCachedThreadPool();
-
- if(logger.isLoggable(Level.FINER)) { logger.exiting(sourceClass, method); }
-
- }
-
-
-}