Clean up some TODOs from core

This commit is contained in:
dsyer
2008-12-07 23:23:49 +00:00
parent c84981ec9b
commit 8500db40ec
11 changed files with 42 additions and 38 deletions

View File

@@ -236,9 +236,9 @@ public class StepParser {
boolean isFaultTolerant = false;
// TODO determine if step should be fault-tolerant
String faultTolerant = element.getAttribute("fault-tolerant");
// TODO determine if step should be fault-tolerant
String skipLimit = element.getAttribute("skip-limit");
if (!isFaultTolerant) {
isFaultTolerant = checkIntValueForFaultToleranceNeeded(skipLimit);

View File

@@ -28,7 +28,6 @@ public class MapJobExplorerFactoryBean extends AbstractJobExplorerFactoryBean {
@Override
protected StepExecutionDao createStepExecutionDao() throws Exception {
// TODO Auto-generated method stub
return new MapStepExecutionDao();
}

View File

@@ -18,6 +18,7 @@ package org.springframework.batch.core.job.flow.support.state;
import java.util.ArrayList;
import java.util.Collection;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;
import org.springframework.batch.core.job.flow.Flow;
@@ -69,7 +70,7 @@ public class SplitState extends AbstractState {
@Override
public String handle(final FlowExecutor executor) throws Exception {
Collection<FutureTask<FlowExecution>> tasks = new ArrayList<FutureTask<FlowExecution>>();
Collection<Future<FlowExecution>> tasks = new ArrayList<Future<FlowExecution>>();
for (final Flow flow : flows) {
@@ -92,8 +93,8 @@ public class SplitState extends AbstractState {
Collection<FlowExecution> results = new ArrayList<FlowExecution>();
// TODO: could use a CompletionSerice?
for (FutureTask<FlowExecution> task : tasks) {
// TODO: could use a CompletionService
for (Future<FlowExecution> task : tasks) {
results.add(task.get());
}

View File

@@ -5,6 +5,7 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;
import org.springframework.batch.core.BatchStatus;
@@ -49,7 +50,7 @@ public class TaskExecutorPartitionHandler implements PartitionHandler, Initializ
public Collection<StepExecution> handle(StepExecutionSplitter stepExecutionSplitter,
StepExecution masterStepExecution) throws Exception {
Set<FutureTask<StepExecution>> tasks = new HashSet<FutureTask<StepExecution>>(gridSize);
Set<Future<StepExecution>> tasks = new HashSet<Future<StepExecution>>(gridSize);
Collection<StepExecution> result = new ArrayList<StepExecution>();
@@ -71,8 +72,7 @@ public class TaskExecutorPartitionHandler implements PartitionHandler, Initializ
ExitStatus exitStatus = ExitStatus.FAILED
.addExitDescription("TaskExecutor rejected the task for this step.");
/*
* This stepExecution hasn't been saved yet, but we'll set the
* status anyway in case the caller is tracking it through the
* Set the status in case the caller is tracking it through the
* JobExecution.
*/
stepExecution.setStatus(BatchStatus.FAILED);
@@ -82,8 +82,7 @@ public class TaskExecutorPartitionHandler implements PartitionHandler, Initializ
}
for (FutureTask<StepExecution> task : tasks) {
// TODO: timeout / heart beat
for (Future<StepExecution> task : tasks) {
result.add(task.get());
}
return result;

View File

@@ -54,7 +54,7 @@ public interface JobRepository {
* returned in a new {@link JobInstance}, associated with the
* {@link JobExecution}. If no previous instance is found, the execution
* will be associated with a new {@link JobInstance}
* @param jobName TODO
* @param jobName the name of the job that is to be executed
* @param jobParameters the runtime parameters for the job
*
* @return a valid job {@link JobExecution} for the arguments provided

View File

@@ -53,9 +53,9 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
private static final String FIND_JOBS_WITH_EMPTY_KEY = "SELECT JOB_INSTANCE_ID, JOB_NAME from %PREFIX%JOB_INSTANCE where JOB_NAME = ? and (JOB_KEY = ? OR JOB_KEY is NULL)";
private static final String GET_JOB_FROM_ID = "SELECT JOB_INSTANCE_ID, JOB_NAME, JOB_KEY, VERSION from %PREFIX%JOB_INSTANCE where JOB_INSTANCE_ID = ?";
private static final String GET_JOB_FROM_EXECUTION_ID = "SELECT ji.JOB_INSTANCE_ID, JOB_NAME, JOB_KEY, ji.VERSION from %PREFIX%JOB_INSTANCE ji, " +
"%PREFIX%JOB_EXECUTION je where JOB_EXECUTION_ID = ? and ji.JOB_INSTANCE_ID = je.JOB_INSTANCE_ID";
private static final String GET_JOB_FROM_EXECUTION_ID = "SELECT ji.JOB_INSTANCE_ID, JOB_NAME, JOB_KEY, ji.VERSION from %PREFIX%JOB_INSTANCE ji, "
+ "%PREFIX%JOB_EXECUTION je where JOB_EXECUTION_ID = ? and ji.JOB_INSTANCE_ID = je.JOB_INSTANCE_ID";
private static final String FIND_PARAMS_FROM_ID = "SELECT JOB_INSTANCE_ID, KEY_NAME, TYPE_CD, "
+ "STRING_VAL, DATE_VAL, LONG_VAL, DOUBLE_VAL from %PREFIX%JOB_PARAMS where JOB_INSTANCE_ID = ?";
@@ -182,7 +182,10 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
/*
* (non-Javadoc)
* @see org.springframework.batch.core.repository.dao.JobInstanceDao#getJobInstance(java.lang.Long)
*
* @see
* org.springframework.batch.core.repository.dao.JobInstanceDao#getJobInstance
* (java.lang.Long)
*/
public JobInstance getJobInstance(Long instanceId) {
@@ -217,7 +220,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
else if (type == ParameterType.DATE) {
value = new JobParameter(rs.getTimestamp(5));
}
// TODO: assert that value is not null?
// No need to assert that value is not null because it's an enum
map.put(rs.getString(2), value);
}
};
@@ -228,7 +231,10 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
/*
* (non-Javadoc)
* @see org.springframework.batch.core.repository.dao.JobInstanceDao#getJobNames()
*
* @see
* org.springframework.batch.core.repository.dao.JobInstanceDao#getJobNames
* ()
*/
public List<String> getJobNames() {
return getJdbcTemplate().query(getQuery(FIND_JOB_NAMES), new ParameterizedRowMapper<String>() {
@@ -240,8 +246,9 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
/*
* (non-Javadoc)
* @see org.springframework.batch.core.repository.dao.JobInstanceDao#getLastJobInstances(java.lang.String,
* int)
*
* @seeorg.springframework.batch.core.repository.dao.JobInstanceDao#
* getLastJobInstances(java.lang.String, int)
*/
public List<JobInstance> getLastJobInstances(String jobName, final int count) {
@@ -267,14 +274,19 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
return result;
}
/* (non-Javadoc)
* @see org.springframework.batch.core.repository.dao.JobInstanceDao#getJobInstance(org.springframework.batch.core.JobExecution)
/*
* (non-Javadoc)
*
* @see
* org.springframework.batch.core.repository.dao.JobInstanceDao#getJobInstance
* (org.springframework.batch.core.JobExecution)
*/
public JobInstance getJobInstance(JobExecution jobExecution) {
try {
return getJdbcTemplate().queryForObject(getQuery(GET_JOB_FROM_EXECUTION_ID), new JobInstanceRowMapper(), jobExecution.getId());
return getJdbcTemplate().queryForObject(getQuery(GET_JOB_FROM_EXECUTION_ID), new JobInstanceRowMapper(),
jobExecution.getId());
}
catch (EmptyResultDataAccessException e) {
return null;
@@ -303,18 +315,17 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
private final class JobInstanceRowMapper implements ParameterizedRowMapper<JobInstance> {
private JobParameters jobParameters;
public JobInstanceRowMapper() {
}
public JobInstanceRowMapper(JobParameters jobParameters) {
this.jobParameters = jobParameters;
}
public JobInstance mapRow(ResultSet rs, int rowNum) throws SQLException {
Long id = rs.getLong(1);
if(jobParameters == null){
if (jobParameters == null) {
jobParameters = getJobParameters(id);
}
JobInstance jobInstance = new JobInstance(rs.getLong(1), jobParameters, rs.getString(2));

View File

@@ -228,7 +228,8 @@ public class StepScope implements Scope, BeanFactoryPostProcessor, Ordered {
private static BeanDefinitionHolder createScopedProxy(String beanName, BeanDefinition definition,
BeanDefinitionRegistry registry, boolean proxyTargetClass) {
// TODO: detect presence of Spring 3.0 and use ScopedPoxyUtils instead
// TODO: (for Batch 2.1) detect presence of Spring 3.0 and use
// ScopedPoxyUtils instead
// Create the scoped proxy...
BeanDefinitionHolder proxyHolder = PlaceholderProxyFactoryBean.createScopedProxy(new BeanDefinitionHolder(

View File

@@ -14,7 +14,6 @@ import org.springframework.batch.core.StepExecution;
* @author Dave Syer
*
*/
// TODO: bin this?
@Aspect
public class StepScopeManager {

View File

@@ -6,7 +6,6 @@ import org.springframework.batch.core.JobParametersIncrementer;
public class TestIncrementer implements JobParametersIncrementer{
public JobParameters getNext(JobParameters parameters) {
// TODO Auto-generated method stub
return null;
}

View File

@@ -106,24 +106,20 @@ public class StepListenerMethodInterceptorTests {
}
public Object[] getArguments() {
// TODO Auto-generated method stub
return null;
}
public AccessibleObject getStaticPart() {
// TODO Auto-generated method stub
return null;
}
public Object getThis() {
// TODO Auto-generated method stub
return null;
}
public Object proceed() throws Throwable {
// TODO Auto-generated method stub
return null;
}
}
}
}

View File

@@ -272,7 +272,6 @@ public class TaskletStepExceptionTests {
}
public JobExecution getLastJobExecution(String jobName, JobParameters jobParameters) {
// TODO Auto-generated method stub
return null;
}
}