Package org.springframework.batch.core

Examples of org.springframework.batch.core.JobParameters


        this.jobLauncher = jobLauncher;
    }

    @Override
    public void process(Exchange exchange) throws Exception {
        JobParameters jobParameters = prepareJobParameters(exchange.getIn().getHeaders());
        JobExecution jobExecution = jobLauncher.run(job, jobParameters);
        exchange.getOut().setBody(jobExecution);
    }
View Full Code Here


  @Override
  public long deleteData() {
    try {
      long jobInstanceCount = jobExplorer.getJobInstanceCount(deleteAllDataJob.getName());
      final JobParameters jobParameters = new JobParametersBuilder().addLong(RUN_ID, ++jobInstanceCount).toJobParameters();
      final JobExecution run = jobLauncher.run(deleteAllDataJob, jobParameters);
      assertExitStatus(run.getExitStatus());
      return runtime(run);
    } catch (final Exception e) {
      throw new IllegalStateException(e);
View Full Code Here

  //

  private long importData(final long amountOfData) {
    try {
      long jobInstanceCount = jobExplorer.getJobInstanceCount(importDataJob.getName());
      final JobParameters jobParameters = new JobParametersBuilder().addLong(RUN_ID, ++jobInstanceCount).addLong(NUMBER_OF_DATA, amountOfData)
          .toJobParameters();
      final JobExecution run = jobLauncher.run(importDataJob, jobParameters);
      assertExitStatus(run.getExitStatus());
      return runtime(run);
    } catch (final Exception e) {
View Full Code Here

  @Autowired
  private Job importDataJob;

  @Test
  public void testLaunchJob() throws Exception {
    final JobExecution run = jobLauncher.run(importDataJob, new JobParameters());
    assertTrue("Job not completed: " + run.getExitStatus(), run.getExitStatus().equals(ExitStatus.COMPLETED));

    final JdbcTemplate template = new JdbcTemplate(dataSource);
    assertThat(template.queryForObject("select count(id) from apprentice", Integer.class), is(5));
    assertThat(template.queryForObject("select count(id) from company", Integer.class), is(3));
View Full Code Here

         Map<String, JobParameter> param = new TreeMap<String, JobParameter>();
         param.put(JobConstants.TIMESTAMP_JOB_PARAM, new JobParameter(
               new Date()));
         param.put(JobConstants.CLUSTER_NAME_JOB_PARAM, new JobParameter(
               clusterName));
         JobParameters jobParameters = new JobParameters(param);
         try {
            long jobExecutionId =
                  jobManager.runJob(JobConstants.QUERY_CLUSTER_JOB_NAME,
                        jobParameters);
            TaskRead status = jobManager.getJobExecutionStatus(jobExecutionId);
View Full Code Here

            new JobParameter(ClusterStatus.PROVISION_ERROR.name()));
      param.put(JobConstants.CLUSTER_NAME_JOB_PARAM, new JobParameter(
            createSpec.getName()));
      param.put(JobConstants.VERIFY_NODE_STATUS_SCOPE_PARAM, new JobParameter(
            JobConstants.CLUSTER_NODE_SCOPE_VALUE));
      JobParameters jobParameters = new JobParameters(param);
      return jobManager.runJob(JobConstants.CREATE_CLUSTER_JOB_NAME,
            jobParameters);
   }
View Full Code Here

      param.put(JobConstants.TIMESTAMP_JOB_PARAM, new JobParameter(new Date()));
      param.put(JobConstants.CLUSTER_SUCCESS_STATUS_JOB_PARAM,
            new JobParameter(ClusterStatus.RUNNING.name()));
      param.put(JobConstants.CLUSTER_FAILURE_STATUS_JOB_PARAM,
            new JobParameter(ClusterStatus.CONFIGURE_ERROR.name()));
      JobParameters jobParameters = new JobParameters(param);
      clusterEntityMgr.updateClusterStatus(clusterName,
            ClusterStatus.CONFIGURING);
      clusterEntityMgr.cleanupActionError(clusterName);
      try {
         return jobManager.runJob(JobConstants.CONFIG_CLUSTER_JOB_NAME,
View Full Code Here

      param.put(JobConstants.TIMESTAMP_JOB_PARAM, new JobParameter(new Date()));
      param.put(JobConstants.CLUSTER_SUCCESS_STATUS_JOB_PARAM,
            new JobParameter(ClusterStatus.RUNNING.name()));
      param.put(JobConstants.CLUSTER_FAILURE_STATUS_JOB_PARAM,
            new JobParameter(ClusterStatus.PROVISION_ERROR.name()));
      JobParameters jobParameters = new JobParameters(param);
      clusterEntityMgr.updateClusterStatus(clusterName,
            ClusterStatus.PROVISIONING);
      clusterEntityMgr.cleanupActionError(clusterName);
      try {
         return jobManager.runJob(JobConstants.RESUME_CLUSTER_JOB_NAME,
View Full Code Here

      param.put(JobConstants.CLUSTER_NAME_JOB_PARAM, new JobParameter(
            clusterName));
      param.put(JobConstants.TIMESTAMP_JOB_PARAM, new JobParameter(new Date()));
      param.put(JobConstants.CLUSTER_FAILURE_STATUS_JOB_PARAM,
            new JobParameter(ClusterStatus.ERROR.name()));
      JobParameters jobParameters = new JobParameters(param);
      clusterEntityMgr.updateClusterStatus(clusterName, ClusterStatus.DELETING);
      clusterEntityMgr.cleanupActionError(clusterName);
      try {
         return jobManager.runJob(JobConstants.DELETE_CLUSTER_JOB_NAME,
               jobParameters);
View Full Code Here

      }
      Map<String, JobParameter> param = new TreeMap<String, JobParameter>();
      param.put(JobConstants.CLUSTER_NAME_JOB_PARAM, new JobParameter(clusterName));
      param.put(JobConstants.TIMESTAMP_JOB_PARAM, new JobParameter(new Date()));
      param.put(JobConstants.CLUSTER_FAILURE_STATUS_JOB_PARAM, new JobParameter(ClusterStatus.UPGRADE_ERROR.name()));
      JobParameters jobParameters = new JobParameters(param);
      clusterEntityMgr.storeClusterLastStatus(clusterName);
      clusterEntityMgr.updateClusterStatus(clusterName, ClusterStatus.UPGRADING);
      clusterEntityMgr.updateNodesActionForUpgrade(clusterName, Constants.NODE_ACTION_UPGRADING);
      clusterEntityMgr.cleanupErrorForClusterUpgrade(clusterName);
      try {
View Full Code Here

TOP

Related Classes of org.springframework.batch.core.JobParameters

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.