Package org.springframework.batch.core

Examples of org.springframework.batch.core.JobParameters


      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.ERROR.name()));
      JobParameters jobParameters = new JobParameters(param);
      clusterEntityMgr.updateClusterStatus(clusterName, ClusterStatus.STARTING);
      try {
         return jobManager.runJob(JobConstants.START_CLUSTER_JOB_NAME,
               jobParameters);
      } catch (Exception e) {
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.STOPPED.name()));
      param.put(JobConstants.CLUSTER_FAILURE_STATUS_JOB_PARAM,
            new JobParameter(ClusterStatus.ERROR.name()));
      JobParameters jobParameters = new JobParameters(param);
      clusterEntityMgr.updateClusterStatus(clusterName, ClusterStatus.STOPPING);
      clusterEntityMgr.cleanupActionError(clusterName);
      try {
         return jobManager.runJob(JobConstants.STOP_CLUSTER_JOB_NAME,
               jobParameters);
View Full Code Here

            new JobParameter(ClusterStatus.RUNNING.name()));
      param.put(JobConstants.CLUSTER_FAILURE_STATUS_JOB_PARAM,
            new JobParameter(ClusterStatus.RUNNING.name()));
      param.put(JobConstants.VERIFY_NODE_STATUS_SCOPE_PARAM, new JobParameter(
            JobConstants.GROUP_NODE_SCOPE_VALUE));
      JobParameters jobParameters = new JobParameters(param);
      clusterEntityMgr.updateClusterStatus(clusterName, ClusterStatus.UPDATING);
      try {
         return jobManager.runJob(JobConstants.RESIZE_CLUSTER_JOB_NAME,
               jobParameters);
      } catch (Exception e) {
View Full Code Here

      }
      param.put(JobConstants.CLUSTER_SUCCESS_STATUS_JOB_PARAM,
            new JobParameter(ClusterStatus.RUNNING.name()));
      param.put(JobConstants.CLUSTER_FAILURE_STATUS_JOB_PARAM,
            new JobParameter(ClusterStatus.RUNNING.name()));
      JobParameters jobParameters = new JobParameters(param);
      try {
         clusterEntityMgr.updateClusterStatus(clusterName,
               ClusterStatus.VHM_RUNNING);
         return jobManager.runJob(JobConstants.SET_MANUAL_ELASTICITY_JOB_NAME,
               jobParameters);
View Full Code Here

               boolean vmPowerOn =
                     (node.getStatus().ordinal() != NodeStatus.POWERED_OFF
                           .ordinal());

               JobParameters nodeParameters =
                     parametersBuilder
                           .addString(JobConstants.CLUSTER_NAME_JOB_PARAM,
                                 clusterName)
                           .addString(JobConstants.TARGET_NAME_JOB_PARAM,
                                 node.getVmName())
View Full Code Here

            String nodeName = nodeEntity.getVmName();
            boolean vmPowerOn =
                  (nodeEntity.getStatus().ordinal() != NodeStatus.POWERED_OFF
                        .ordinal());
            logger.debug("orginal vm power on? " + vmPowerOn);
            JobParameters nodeParameters =
                  parametersBuilder
                        .addString(JobConstants.SUB_JOB_NODE_NAME, nodeName)
                        .addString(JobConstants.TARGET_NAME_JOB_PARAM, nodeName)
                        .addString(JobConstants.CLUSTER_NAME_JOB_PARAM,
                              clusterName)
View Full Code Here

   @Override
   public JobParameters getJobParameters(Job job, StepExecution stepExecution) {
      String stepName = stepExecution.getStepName();
      int index = stepName.lastIndexOf("-");
      int stepNumber = Integer.parseInt(stepName.substring(index + 1));
      JobParameters jobParameters = stepExecution.getJobParameters();
      Map<String, JobParameter> jobParametersMap =
            jobParameters.getParameters();
      Map<String, JobParameter> subJobParameters =
            new TreeMap<String, JobParameter>();
      for (String key : jobParametersMap.keySet()) {
         subJobParameters.put(key, jobParametersMap.get(key));
      }
      if (jobParametersMap
            .containsKey(JobConstants.SUB_JOB_PARAMETERS_NUMBER
                  + stepNumber)) {
         int jobParametersNumber =
               (int) jobParameters
                     .getLong(JobConstants.SUB_JOB_PARAMETERS_NUMBER
                           + stepNumber);
         for (int count = 0; count < jobParametersNumber; count++) {
            String key =
                  jobParameters.getString(JobUtils.getSubJobParameterPrefixKey(
                        stepNumber, count));
            JobParameter parameterValue =
                  jobParametersMap.get(JobUtils.getSubJobParameterPrefixValue(
                        stepNumber, count));
            subJobParameters.put(key, parameterValue);
         }
      }
      subJobParameters.put(JobConstants.TIMESTAMP_JOB_PARAM, new JobParameter(
            new Date()));
      return new JobParameters(subJobParameters);
   }
View Full Code Here

      this.jobExecutionStatusHolder = jobExecutionStatusHolder;
   }

   private void unRegisterJob(JobExecution je) {
      String jobName = je.getJobInstance().getJobName();
      JobParameters jobParameters = je.getJobInstance().getJobParameters();
      long subJobEnabled = jobParameters.getLong(JobConstants.SUB_JOB_ENABLED);
      // sub job launcher
      if (subJobEnabled == 1) {
         if (jobRegistry != null) {
            try {
               Job job = jobRegistry.getJob(jobName);
View Full Code Here

         if (subJobNumber > 0) {
            logger.debug("sub job number: " + subJobNumber);
            List<JobParameters> subJobParametersList =
                  new ArrayList<JobParameters>();
            for (int i = 0; i < subJobNumber; i++) {
               JobParameters subJobParameters =
                     (JobParameters) preparingJobExecution
                           .getExecutionContext()
                           .get(JobConstants.SUB_JOB_PARAMETERS_KEY_PREFIX + i);
               subJobParametersList.add(subJobParameters);
            }
View Full Code Here

      mainJob.setJobRepository(jobRepository);
      mainJob.afterPropertiesSet();
      JobFactory jobFactory = new ReferenceJobFactory(mainJob);
      jobRegistry.register(jobFactory);
      logger.info("registered job: " + mainJob.getName());
      JobParameters mainJobParameters = new JobParameters(mainJobParams);
      JobExecution mainJobExecution =
            jobLauncher.run(mainJob, mainJobParameters);
      logger.info("launched main job: " + mainJob.getName());
      return mainJobExecution.getId();
   }
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.