-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
separate step listeners for step writers
- Loading branch information
Showing
17 changed files
with
161 additions
and
63 deletions.
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
.../src/main/java/uk/ac/ebi/eva/accession/clustering/batch/listeners/JobExecutionSetter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package uk.ac.ebi.eva.accession.clustering.batch.listeners; | ||
|
||
import org.springframework.batch.core.ExitStatus; | ||
import org.springframework.batch.core.StepExecution; | ||
import org.springframework.batch.core.StepExecutionListener; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import uk.ac.ebi.eva.accession.clustering.batch.io.ClusteringWriter; | ||
import uk.ac.ebi.eva.accession.clustering.batch.io.RSSplitWriter; | ||
|
||
import static uk.ac.ebi.eva.accession.clustering.configuration.BeanNames.CLUSTERED_CLUSTERING_WRITER; | ||
import static uk.ac.ebi.eva.accession.clustering.configuration.BeanNames.CLUSTERED_CLUSTERING_WRITER_JOB_EXECUTION_SETTER; | ||
import static uk.ac.ebi.eva.accession.clustering.configuration.BeanNames.NON_CLUSTERED_CLUSTERING_WRITER; | ||
import static uk.ac.ebi.eva.accession.clustering.configuration.BeanNames.NON_CLUSTERED_CLUSTERING_WRITER_JOB_EXECUTION_SETTER; | ||
import static uk.ac.ebi.eva.accession.clustering.configuration.BeanNames.RS_SPLIT_WRITER; | ||
import static uk.ac.ebi.eva.accession.clustering.configuration.BeanNames.RS_SPLIT_WRITER_JOB_EXECUTION_SETTER; | ||
|
||
@Configuration | ||
public class JobExecutionSetter { | ||
@Bean(NON_CLUSTERED_CLUSTERING_WRITER_JOB_EXECUTION_SETTER) | ||
public StepExecutionListener getNonClusteredClusteringWriterJobExecutionSetter( | ||
@Qualifier(NON_CLUSTERED_CLUSTERING_WRITER) ClusteringWriter nonClusteredClusteringWriter) { | ||
return new StepExecutionListener() { | ||
@Override | ||
public void beforeStep(StepExecution stepExecution) { | ||
nonClusteredClusteringWriter.setJobExecution(stepExecution.getJobExecution()); | ||
} | ||
|
||
@Override | ||
public ExitStatus afterStep(StepExecution stepExecution) { | ||
return stepExecution.getExitStatus(); | ||
} | ||
}; | ||
} | ||
|
||
@Bean(CLUSTERED_CLUSTERING_WRITER_JOB_EXECUTION_SETTER) | ||
public StepExecutionListener getClusteredClusteringWriterJobExecutionSetter( | ||
@Qualifier(CLUSTERED_CLUSTERING_WRITER) ClusteringWriter clusteredClusteringWriter) { | ||
return new StepExecutionListener() { | ||
@Override | ||
public void beforeStep(StepExecution stepExecution) { | ||
clusteredClusteringWriter.setJobExecution(stepExecution.getJobExecution()); | ||
} | ||
|
||
@Override | ||
public ExitStatus afterStep(StepExecution stepExecution) { | ||
return stepExecution.getExitStatus(); | ||
} | ||
}; | ||
} | ||
|
||
|
||
@Bean(RS_SPLIT_WRITER_JOB_EXECUTION_SETTER) | ||
public StepExecutionListener getRSSplitWriterJobExecutionSetter( | ||
@Qualifier(RS_SPLIT_WRITER) RSSplitWriter rsSplitWriter) { | ||
return new StepExecutionListener() { | ||
@Override | ||
public void beforeStep(StepExecution stepExecution) { | ||
rsSplitWriter.setJobExecution(stepExecution.getJobExecution()); | ||
} | ||
|
||
@Override | ||
public ExitStatus afterStep(StepExecution stepExecution) { | ||
return stepExecution.getExitStatus(); | ||
} | ||
}; | ||
} | ||
} |
40 changes: 0 additions & 40 deletions
40
...src/main/java/uk/ac/ebi/eva/accession/clustering/batch/listeners/JobProgressListener.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.