Merge pull request #968 from bcarrier/ingest_job_settings

push IngestSettings into IngestJob
This commit is contained in:
Richard Cordovano 2014-11-20 18:19:01 -05:00
commit dad342fe6c

View File

@ -65,7 +65,7 @@ final class IngestJob {
*/ */
private final long id; private final long id;
private final Content dataSource; private final Content dataSource;
private final boolean processUnallocatedSpace; private final IngestJobSettings ingestJobSettings;
private final Object dataSourceIngestPipelineLock; private final Object dataSourceIngestPipelineLock;
private DataSourceIngestPipeline firstStageDataSourceIngestPipeline; private DataSourceIngestPipeline firstStageDataSourceIngestPipeline;
private DataSourceIngestPipeline secondStageDataSourceIngestPipeline; private DataSourceIngestPipeline secondStageDataSourceIngestPipeline;
@ -148,7 +148,7 @@ final class IngestJob {
List<IngestModuleError> errors = new ArrayList<>(); List<IngestModuleError> errors = new ArrayList<>();
if (IngestJob.jobCreationIsEnabled) { if (IngestJob.jobCreationIsEnabled) {
long jobId = nextJobId.incrementAndGet(); long jobId = nextJobId.incrementAndGet();
IngestJob job = new IngestJob(jobId, dataSource, settings.getProcessUnallocatedSpace()); IngestJob job = new IngestJob(jobId, dataSource, settings);
IngestJob.jobsById.put(jobId, job); IngestJob.jobsById.put(jobId, job);
errors = job.start(settings.getEnabledIngestModuleTemplates()); errors = job.start(settings.getEnabledIngestModuleTemplates());
if (errors.isEmpty() && job.hasIngestPipeline()) { if (errors.isEmpty() && job.hasIngestPipeline()) {
@ -200,10 +200,11 @@ final class IngestJob {
* @param processUnallocatedSpace Whether or not unallocated space should be * @param processUnallocatedSpace Whether or not unallocated space should be
* processed during the ingest job. * processed during the ingest job.
*/ */
private IngestJob(long id, Content dataSource, boolean processUnallocatedSpace) { private IngestJob(long id, Content dataSource, IngestJobSettings settings) {
this.id = id; this.id = id;
this.dataSource = dataSource; this.dataSource = dataSource;
this.processUnallocatedSpace = processUnallocatedSpace;
this.ingestJobSettings = settings;
this.dataSourceIngestPipelineLock = new Object(); this.dataSourceIngestPipelineLock = new Object();
this.fileIngestPipelines = new LinkedBlockingQueue<>(); this.fileIngestPipelines = new LinkedBlockingQueue<>();
this.filesInProgress = new ArrayList<>(); this.filesInProgress = new ArrayList<>();
@ -239,7 +240,7 @@ final class IngestJob {
* @return True or false. * @return True or false.
*/ */
boolean shouldProcessUnallocatedSpace() { boolean shouldProcessUnallocatedSpace() {
return this.processUnallocatedSpace; return this.ingestJobSettings.getProcessUnallocatedSpace();
} }
/** /**