当前位置: 首页>>代码示例>>Java>>正文


Java JobParametersInvalidException类代码示例

本文整理汇总了Java中org.springframework.batch.core.JobParametersInvalidException的典型用法代码示例。如果您正苦于以下问题:Java JobParametersInvalidException类的具体用法?Java JobParametersInvalidException怎么用?Java JobParametersInvalidException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JobParametersInvalidException类属于org.springframework.batch.core包,在下文中一共展示了JobParametersInvalidException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testCreateGenericArchive

import org.springframework.batch.core.JobParametersInvalidException; //导入依赖的package包/类
@Test
public void testCreateGenericArchive() throws NoSuchJobException,
JobExecutionAlreadyRunningException, JobRestartException,
JobInstanceAlreadyCompleteException, JobParametersInvalidException, IOException {
	Map<String, JobParameter> parameters =
			new HashMap<String, JobParameter>();

	JobParameters jobParameters = new JobParameters(parameters);

	Job palmwebArchive = jobLocator.getJob("PalmWeb");
	assertNotNull("Palmweb must not be null",  palmwebArchive);
	JobExecution jobExecution = jobLauncher.run(palmwebArchive, jobParameters);
	assertEquals("The job should complete successfully",jobExecution.getExitStatus().getExitCode(),"COMPLETED");
	for (StepExecution stepExecution : jobExecution.getStepExecutions()) {
		logger.info(stepExecution.getStepName() + " "
				+ stepExecution.getReadCount() + " "
				+ stepExecution.getFilterCount() + " "
				+ stepExecution.getWriteCount() + " " + stepExecution.getCommitCount());
	}
}
 
开发者ID:RBGKew,项目名称:eMonocot,代码行数:21,代码来源:PalmwebIntegrationTest.java

示例2: start

import org.springframework.batch.core.JobParametersInvalidException; //导入依赖的package包/类
public void start() throws IOException, InterruptedException {
	List<JobExecution> jobExecutions = new ArrayList<>();
	// launch jobs
	jobExecutions.addAll(IntStream.range(0, this.cardinality).mapToObj(i -> {
		Job analysisJob = this.jobFactory.get();
		JobParametersBuilder jobParametersBuilder = new JobParametersBuilder();
		jobParametersBuilder.addString("id", analysisJob.getName() + "-" + i, true);
		try {
			return this.jobLauncher.run(analysisJob, jobParametersBuilder.toJobParameters());
		} catch (JobExecutionAlreadyRunningException | JobRestartException | JobInstanceAlreadyCompleteException
				| JobParametersInvalidException exception) {
			throw new RuntimeException(exception);
		}
	}).collect(Collectors.toList()));
	// wait for termination
	while (jobExecutions.stream().anyMatch(jobExecution -> jobExecution.getStatus().isRunning())) {
		Thread.sleep(1000);
	}
}
 
开发者ID:maenu,项目名称:kowalski,代码行数:20,代码来源:Application.java

示例3: launch

import org.springframework.batch.core.JobParametersInvalidException; //导入依赖的package包/类
@RequestMapping("/launch")
public String launch() throws JobExecutionAlreadyRunningException,
        JobRestartException, JobInstanceAlreadyCompleteException,
        JobParametersInvalidException {

    //JobParametersの内容を変更しないと同一のジョブ実行と思われるっぽい。
    //同一のジョブ実行だと思われたら二回目からは実行されない。
    //(一回目の実行が既に完了しているので)
    //とりあえずIDっぽいものを持たせて実行の要求の度にインクリメントすることで
    //何度も実行できるようになった。
    //cf. JobParametersIncrementer
    JobParameters jobParameters = new JobParametersBuilder().addLong(
            "simpleBatchId", idGenerator.getAndIncrement())
            .toJobParameters();
    JobExecution execution = launcher.run(job, jobParameters);

    return execution.toString();
}
 
开发者ID:backpaper0,项目名称:spring-boot-sandbox,代码行数:19,代码来源:BatchLauncherController.java

示例4: launch

import org.springframework.batch.core.JobParametersInvalidException; //导入依赖的package包/类
@Override
public void launch(JobLaunchRequest request) {
	Job job;
	try {
		job = jobLocator.getJob(request.getJob());
		Map<String, JobParameter> jobParameterMap = new HashMap<String,	JobParameter>();
		for(String parameterName : request.getParameters().keySet()) {
			jobParameterMap.put(parameterName, new JobParameter(request.getParameters().get(parameterName)));
		}
		JobParameters jobParameters = new JobParameters(jobParameterMap);
		try {
			jobLauncher.run(job, jobParameters);
		} catch (JobExecutionAlreadyRunningException jeare) {
			jobStatusNotifier.notify(new JobExecutionException(jeare.getLocalizedMessage()), request.getParameters().get("resource.identifier"));
		} catch (JobRestartException jre) {
			jobStatusNotifier.notify(new JobExecutionException(jre.getLocalizedMessage()), request.getParameters().get("resource.identifier"));
		} catch (JobInstanceAlreadyCompleteException jiace) {
			jobStatusNotifier.notify(new JobExecutionException(jiace.getLocalizedMessage()), request.getParameters().get("resource.identifier"));
		} catch (JobParametersInvalidException jpie) {
			jobStatusNotifier.notify(new JobExecutionException(jpie.getLocalizedMessage()), request.getParameters().get("resource.identifier"));
		}
	} catch (NoSuchJobException nsje) {
		jobStatusNotifier.notify(new JobExecutionException(nsje.getLocalizedMessage()), request.getParameters().get("resource.identifier"));
	}
}
 
开发者ID:RBGKew,项目名称:eMonocot,代码行数:26,代码来源:JobLauncherImpl.java

示例5: testNotModifiedResponse

import org.springframework.batch.core.JobParametersInvalidException; //导入依赖的package包/类
/**
 *
 * @throws IOException
 *             if a temporary file cannot be created.
 * @throws NoSuchJobException
 *             if SpeciesPageHarvestingJob cannot be located
 * @throws JobParametersInvalidException
 *             if the job parameters are invalid
 * @throws JobInstanceAlreadyCompleteException
 *             if the job has already completed
 * @throws JobRestartException
 *             if the job cannot be restarted
 * @throws JobExecutionAlreadyRunningException
 *             if the job is already running
 */
@Test
public final void testNotModifiedResponse() throws IOException,
NoSuchJobException, JobExecutionAlreadyRunningException,
JobRestartException, JobInstanceAlreadyCompleteException,
JobParametersInvalidException {
	Map<String, JobParameter> parameters = new HashMap<String, JobParameter>();
	parameters.put("query.string", new JobParameter("select i from Image i"));

	JobParameters jobParameters = new JobParameters(parameters);

	Job job = jobLocator.getJob("ImageProcessing");
	assertNotNull("ImageProcessing must not be null", job);
	JobExecution jobExecution = jobLauncher.run(job, jobParameters);
	assertEquals("The job should complete successfully",jobExecution.getExitStatus().getExitCode(),"COMPLETED");

	for (StepExecution stepExecution : jobExecution.getStepExecutions()) {
		logger.info(stepExecution.getStepName() + " "
				+ stepExecution.getReadCount() + " "
				+ stepExecution.getFilterCount() + " "
				+ stepExecution.getWriteCount());
	}
}
 
开发者ID:RBGKew,项目名称:eMonocot,代码行数:38,代码来源:ImageProcessingJobIntegrationTest.java

示例6: launch

import org.springframework.batch.core.JobParametersInvalidException; //导入依赖的package包/类
@Override
public void launch(JobLaunchRequest request) {
	Job job;
	try {
		job = jobLocator.getJob(request.getJob());
		Map<String, JobParameter> jobParameterMap = new HashMap<String, JobParameter>();
		for(String parameterName : request.getParameters().keySet()) {
			jobParameterMap.put(parameterName, new JobParameter(request.getParameters().get(parameterName)));
		}

		JobParameters jobParameters = new JobParameters(jobParameterMap);
		jobLauncher.run(job, jobParameters);
	} catch (NoSuchJobException 
			| JobExecutionAlreadyRunningException
			| JobRestartException
			| JobInstanceAlreadyCompleteException
			| JobParametersInvalidException exception) {
			jobStatusNotifier.notify(new JobExecutionException(exception.getLocalizedMessage()), request.getParameters().get("job.configuration.id"));
	}
}
 
开发者ID:RBGKew,项目名称:powop,代码行数:21,代码来源:JobLauncherImpl.java

示例7: launchImmediately

import org.springframework.batch.core.JobParametersInvalidException; //导入依赖的package包/类
private JobExecution launchImmediately(TaskExecutor taskExecutor, Job job, JobParameters jobParameters)
{
	try
	{
		SimpleJobLauncher launcher = new SimpleJobLauncher();
		launcher.setJobRepository(jobRepository);
		launcher.setTaskExecutor(taskExecutor);
		return launcher.run(job, jobParameters);
	}
	catch (JobExecutionAlreadyRunningException | JobRestartException | JobInstanceAlreadyCompleteException
			| JobParametersInvalidException e)
	{
		logger.error("Unexpected exception", e);
		throw YonaException.unexpected(e);
	}
}
 
开发者ID:yonadev,项目名称:yona-server,代码行数:17,代码来源:BatchTaskService.java

示例8: main

import org.springframework.batch.core.JobParametersInvalidException; //导入依赖的package包/类
public static void main(String[] args) throws JobExecutionAlreadyRunningException, JobRestartException,
        JobInstanceAlreadyCompleteException, JobParametersInvalidException, DuplicateJobException {
    ConfigurableApplicationContext ctx = SpringApplication.run(Application.class, args);

    Job simpleJob = ctx.getBean("simpleJob", Job.class);
    JobRegistry jobRegistry = ctx.getBean("jobRegistry", JobRegistry.class);
    jobRegistry.register(new ReferenceJobFactory(simpleJob));
    
    //JobRepository jobRepository = ctx.getBean("jobRepository", JobRepository.class);
    //JobInstance jobInstance = jobRepository.createJobInstance("simpleJob", new JobParameters());
    // JobParameters jobParameters = ctx.getBean("basicParameters", JobParameters.class);
    //
    //JobRegistry jobRegistry = ctx.getBean("mapJobRegistry", JobRegistry.class);
    // jobRegistry.register();
    // jobLauncher.run(job, jobParameters);
}
 
开发者ID:selimok,项目名称:working-examples,代码行数:17,代码来源:Application.java

示例9: execute

import org.springframework.batch.core.JobParametersInvalidException; //导入依赖的package包/类
protected void execute(Job job, JobParameters jobParameters)
		throws JobExecutionAlreadyRunningException, JobRestartException,
		JobInstanceAlreadyCompleteException, JobParametersInvalidException,
		JobParametersNotFoundException {
	JobParameters nextParameters = getNextJobParameters(job, jobParameters);
	if (nextParameters != null) {
		JobExecution execution = this.jobLauncher.run(job, nextParameters);
		if (this.publisher != null) {
			this.publisher.publishEvent(new JobExecutionEvent(execution));
		}
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:13,代码来源:JobLauncherCommandLineRunner.java

示例10: run

import org.springframework.batch.core.JobParametersInvalidException; //导入依赖的package包/类
/**
 * Runs the scheduled job.
 *
 * @throws JobParametersInvalidException
 * @throws JobInstanceAlreadyCompleteException
 * @throws JobRestartException
 * @throws JobExecutionAlreadyRunningException
 */
@Scheduled(fixedRate = RATE)
public void run() throws JobExecutionAlreadyRunningException,
        JobRestartException, JobInstanceAlreadyCompleteException,
        JobParametersInvalidException {
    JobParameters params = new JobParameters(new HashMap<String, JobParameter>() {
        private static final long serialVersionUID = 1L;
        {
            put("execDate", new JobParameter(new Date(), true));
        }
    });

    jobLauncher.run(job, params);
}
 
开发者ID:hosuaby,项目名称:signature-processing,代码行数:22,代码来源:JobScheduler.java

示例11: shouldTaskletWork

import org.springframework.batch.core.JobParametersInvalidException; //导入依赖的package包/类
@Test
public void shouldTaskletWork() throws JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException,
        JobParametersInvalidException {
    Map<String, JobParameter> params = Maps.newHashMap();
    params.put("test", new JobParameter("przodownik"));
    params.put("time", new JobParameter(new Date()));
    JobExecution execution = jobLauncher.run(simpleStringProcessorTask, new JobParameters(params));
    log.info("Exit Status :  {}", execution.getExitStatus());
    Assert.assertEquals(ExitStatus.COMPLETED, execution.getExitStatus());

}
 
开发者ID:przodownikR1,项目名称:springBatchJmsKata,代码行数:12,代码来源:SimpleStringProcessingTest.java

示例12: requestJob3

import org.springframework.batch.core.JobParametersInvalidException; //导入依赖的package包/类
@RequestMapping("/job3/{input_file_name}")
@ResponseBody
String requestJob3(@PathVariable("input_file_name") String inputFileName) throws JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException, JobParametersInvalidException{
	JobParametersBuilder jobParametersBuilder = new JobParametersBuilder();
	jobParametersBuilder.addString("INPUT_FILE_PATH", inputFileName);
	jobParametersBuilder.addLong("TIMESTAMP",new Date().getTime());
	
	jobLauncher.run(job3, jobParametersBuilder.toJobParameters());
    return "Job3!";
}
 
开发者ID:pauldeng,项目名称:aws-elastic-beanstalk-worker-spring-boot-spring-batch-template,代码行数:11,代码来源:RESTController.java

示例13: testMatchTaxa

import org.springframework.batch.core.JobParametersInvalidException; //导入依赖的package包/类
/**
 *
 * @throws IOException
 *             if a temporary file cannot be created.
 * @throws NoSuchJobException
 *             if SpeciesPageHarvestingJob cannot be located
 * @throws JobParametersInvalidException
 *             if the job parameters are invalid
 * @throws JobInstanceAlreadyCompleteException
 *             if the job has already completed
 * @throws JobRestartException
 *             if the job cannot be restarted
 * @throws JobExecutionAlreadyRunningException
 *             if the job is already running
 */
@Test
public final void testMatchTaxa() throws IOException,
NoSuchJobException, JobExecutionAlreadyRunningException,
JobRestartException, JobInstanceAlreadyCompleteException,
JobParametersInvalidException {

	Session session = sessionFactory.openSession();
	Transaction tx = session.beginTransaction();

	List<Taxon> taxa = session.createQuery("from Taxon as taxon").list();
	solrIndexingListener.indexObjects(taxa);
	tx.commit();

	ClassPathResource input = new ClassPathResource("/org/emonocot/job/taxonmatch/input.csv");
	Map<String, JobParameter> parameters = new HashMap<String, JobParameter>();
	parameters.put("assume.accepted.matches", new JobParameter(Boolean.TRUE.toString()));
	parameters.put("input.file", new JobParameter(input.getFile().getAbsolutePath()));
	parameters.put("output.file", new JobParameter(File.createTempFile("output", "csv").getAbsolutePath()));

	JobParameters jobParameters = new JobParameters(parameters);

	Job taxonMatchingJob = jobLocator.getJob("TaxonMatching");
	assertNotNull("TaxonMatching must not be null", taxonMatchingJob);
	JobExecution jobExecution = jobLauncher.run(taxonMatchingJob, jobParameters);
	assertEquals("The job should complete successfully",jobExecution.getExitStatus().getExitCode(),"COMPLETED");

	FileReader file = new FileReader(jobParameters.getParameters().get("output.file").getValue().toString());
	BufferedReader reader = new BufferedReader(file);
	assertNotNull("There should be an output file", reader);
	String ln;
	while ((ln = reader.readLine()) != null) {
		logger.debug(ln);
	}
}
 
开发者ID:RBGKew,项目名称:eMonocot,代码行数:50,代码来源:TaxonMatchIntegrationTest.java

示例14: testNotModifiedResponse

import org.springframework.batch.core.JobParametersInvalidException; //导入依赖的package包/类
/**
 *
 * @throws IOException
 *             if a temporary file cannot be created.
 * @throws NoSuchJobException
 *             if SpeciesPageHarvestingJob cannot be located
 * @throws JobParametersInvalidException
 *             if the job parameters are invalid
 * @throws JobInstanceAlreadyCompleteException
 *             if the job has already completed
 * @throws JobRestartException
 *             if the job cannot be restarted
 * @throws JobExecutionAlreadyRunningException
 *             if the job is already running
 */
@Test
public final void testNotModifiedResponse() throws IOException,
NoSuchJobException, JobExecutionAlreadyRunningException,
JobRestartException, JobInstanceAlreadyCompleteException,
JobParametersInvalidException {
	Session session = sessionFactory.openSession();
	Transaction tx = session.beginTransaction();

	List<Taxon> taxa = session.createQuery("from Taxon as taxon").list();
	solrIndexingListener.indexObjects(taxa);
	tx.commit();

	Map<String, JobParameter> parameters =
			new HashMap<String, JobParameter>();
	parameters.put("authority.name", new JobParameter("test"));
	String repository = properties.getProperty("test.resource.baseUrl");
	parameters.put("authority.uri", new JobParameter(repository + "iucn.json"));
	parameters.put("authority.last.harvested",
			new JobParameter(Long.toString((IUCNJobIntegrationTest.PAST_DATETIME.getMillis()))));


	JobParameters jobParameters = new JobParameters(parameters);

	Job job = jobLocator.getJob("IUCNImport");
	assertNotNull("IUCNImport must not be null", job);
	JobExecution jobExecution = jobLauncher.run(job, jobParameters);
	assertEquals("The job should complete successfully",jobExecution.getExitStatus().getExitCode(),"COMPLETED");
	for (StepExecution stepExecution : jobExecution.getStepExecutions()) {
		logger.info(stepExecution.getStepName() + " "
				+ stepExecution.getReadCount() + " "
				+ stepExecution.getFilterCount() + " "
				+ stepExecution.getWriteCount() + " " + stepExecution.getCommitCount());
	}
}
 
开发者ID:RBGKew,项目名称:eMonocot,代码行数:50,代码来源:IUCNJobIntegrationTest.java

示例15: testCreateGenericArchive

import org.springframework.batch.core.JobParametersInvalidException; //导入依赖的package包/类
@Test
public void testCreateGenericArchive() throws NoSuchJobException,
JobExecutionAlreadyRunningException, JobRestartException,
JobInstanceAlreadyCompleteException, JobParametersInvalidException, IOException {
	Map<String, JobParameter> parameters =
			new HashMap<String, JobParameter>();
	parameters.put("specs.file", new JobParameter(specsFile.getFile().getAbsolutePath()));
	parameters.put("items.file", new JobParameter(itemsFile.getFile().getAbsolutePath()));
	parameters.put("taxon.file", new JobParameter(taxonFile.getFile().getAbsolutePath()));
	parameters.put("fields.terminated.by", new JobParameter(","));
	parameters.put("fields.enclosed.by", new JobParameter("\""));
	parameters.put("output.fields",new JobParameter("taxonID,description,language,license"));
	parameters.put("taxon.file.skip.lines", new JobParameter("1"));
	parameters.put("taxon.file.field.names", new JobParameter("taxonID,subfamily,subtribe,tribe,accessRights,bibliographicCitation,created,license,modified,references,rights,rightsHolder,acceptedNameUsage,acceptedNameUsageID,class,datasetID,datasetName,family,genus,infraspecificEpithet,kingdom,nameAccordingTo,namePublishedIn,namePublishedInID,namePublishedInYear,nomenclaturalCode,nomenclaturalStatus,order,originalNameUsage,originalNameUsageID,parentNameUsage,parentNameUsageID,phylum,scientificName,scientificNameAuthorship,scientificNameID,specificEpithet,subgenus,taxonRank,taxonRemarks,taxonomicStatus,verbatimTaxonRank"));
	parameters.put("taxon.file.delimiter", new JobParameter("\t"));
	parameters.put("taxon.file.quote.character", new JobParameter("\""));
	parameters.put("description.file.field.names", new JobParameter("taxonID,description,license,language,type,rights"));
	parameters.put("description.default.values", new JobParameter("license=http://creativecommons.org/licenses/by-nc-sa/3.0,language=EN,type=general,rights=© Copyright The Board of Trustees\\, Royal Botanic Gardens\\, Kew."));
	parameters.put("archive.file", new JobParameter(UUID.randomUUID().toString()));

	JobParameters jobParameters = new JobParameters(parameters);

	Job deltaToDwC = jobLocator.getJob("DeltaToDwC");
	assertNotNull("DeltaToDwC must not be null",  deltaToDwC);
	JobExecution jobExecution = jobLauncher.run(deltaToDwC, jobParameters);
	assertEquals("The job should complete successfully",jobExecution.getExitStatus().getExitCode(),"COMPLETED");
	for (StepExecution stepExecution : jobExecution.getStepExecutions()) {
		logger.info(stepExecution.getStepName() + " "
				+ stepExecution.getReadCount() + " "
				+ stepExecution.getFilterCount() + " "
				+ stepExecution.getWriteCount() + " " + stepExecution.getCommitCount());
	}

}
 
开发者ID:RBGKew,项目名称:eMonocot,代码行数:35,代码来源:DeltaNaturalLanguageDwcIntegrationTest.java


注:本文中的org.springframework.batch.core.JobParametersInvalidException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。