Package org.springframework.batch.core

Examples of org.springframework.batch.core.JobParameter


    Map<String, JobParameter> map = new HashMap<String, JobParameter>();
    for(Entry<String, JobParameterType> entry : request.jobParameters.entrySet()) {
      ParameterType parameterType = entry.getValue().parameterType;
      if(parameterType == ParameterType.DATE) {
        if(entry.getValue().parameter instanceof Integer) {
          map.put(entry.getKey(), new JobParameter(new Date((Integer)entry.getValue().parameter)));
        } else if(entry.getValue().parameter instanceof Date) {
          map.put(entry.getKey(), new JobParameter(((Date)entry.getValue().parameter)));
        }
      } else if(parameterType == ParameterType.DOUBLE) {
        map.put(entry.getKey(), new JobParameter((Double)entry.getValue().parameter));
      } else if(parameterType == ParameterType.LONG) {
        if(entry.getValue().parameter instanceof Long) {
          map.put(entry.getKey(), new JobParameter((Long)entry.getValue().parameter));
        } else if(entry.getValue().parameter instanceof Integer) {
          Long tmp = new Long((Integer)entry.getValue().parameter);
          map.put(entry.getKey(), new JobParameter(tmp));
        }
      } else if(parameterType == ParameterType.STRING) {
        map.put(entry.getKey(), new JobParameter((String)entry.getValue().parameter));
      }
    }
    JobParameters jobParameters = new JobParameters(map);

    boolean jobInstanceExists = jobRepository.isJobInstanceExists(jobName, jobParameters);
View Full Code Here


    Map<String, JobParameter> map = new HashMap<String, JobParameter>();
    for(Entry<String, JobParameterType> entry : request.jobParameters.entrySet()) {
      ParameterType parameterType = entry.getValue().parameterType;
      if(parameterType == ParameterType.DATE) {
        if(entry.getValue().parameter instanceof Integer) {
          map.put(entry.getKey(), new JobParameter(new Date((Integer)entry.getValue().parameter)));
        } else if(entry.getValue().parameter instanceof Date) {
          map.put(entry.getKey(), new JobParameter(((Date)entry.getValue().parameter)));
        }
      } else if(parameterType == ParameterType.DOUBLE) {
        map.put(entry.getKey(), new JobParameter((Double)entry.getValue().parameter));
      } else if(parameterType == ParameterType.LONG) {
        if(entry.getValue().parameter instanceof Long) {
          map.put(entry.getKey(), new JobParameter((Long)entry.getValue().parameter));
        } else if(entry.getValue().parameter instanceof Integer) {
          Long tmp = new Long((Integer)entry.getValue().parameter);
          map.put(entry.getKey(), new JobParameter(tmp));
        }
      } else if(parameterType == ParameterType.STRING) {
        map.put(entry.getKey(), new JobParameter((String)entry.getValue().parameter));
      }
    }
    JobParameters jobParameters = new JobParameters(map);
    //throws JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException
    JobExecution jobExecution = null;
View Full Code Here

    Map<String, JobParameter> map = new HashMap<String, JobParameter>();
    for(Entry<String, JobParameterType> entry : request.jobParameters.entrySet()) {
      ParameterType parameterType = entry.getValue().parameterType;
      if(parameterType == ParameterType.DATE) {
        if(entry.getValue().parameter instanceof Integer) {
          map.put(entry.getKey(), new JobParameter(new Date((Integer)entry.getValue().parameter)));
        } else if(entry.getValue().parameter instanceof Date) {
          map.put(entry.getKey(), new JobParameter(((Date)entry.getValue().parameter)));
        }
      } else if(parameterType == ParameterType.DOUBLE) {
        map.put(entry.getKey(), new JobParameter((Double)entry.getValue().parameter));
      } else if(parameterType == ParameterType.LONG) {
        if(entry.getValue().parameter instanceof Long) {
          map.put(entry.getKey(), new JobParameter((Long)entry.getValue().parameter));
        } else if(entry.getValue().parameter instanceof Integer) {
          Long tmp = new Long((Integer)entry.getValue().parameter);
          map.put(entry.getKey(), new JobParameter(tmp));
        }
      } else if(parameterType == ParameterType.STRING) {
        map.put(entry.getKey(), new JobParameter((String)entry.getValue().parameter));
      }
    }
    JobParameters jobParameters = new JobParameters(map);

    JobExecution lastJobExecution = jobRepository.getLastJobExecution(jobName, jobParameters);
View Full Code Here

    Map<String, JobParameter> map = new HashMap<String, JobParameter>();
    for(Entry<String, JobParameterType> entry : type.parameters.entrySet()) {
      ParameterType parameterType = entry.getValue().parameterType;
      if(parameterType == ParameterType.DATE) {
        if(entry.getValue().parameter instanceof Integer) {
          map.put(entry.getKey(), new JobParameter(new Date((Integer)entry.getValue().parameter)));
        } else if(entry.getValue().parameter instanceof Long) {
          map.put(entry.getKey(), new JobParameter(new Date((Long)entry.getValue().parameter)));
        } else if(entry.getValue().parameter instanceof Date) {
          map.put(entry.getKey(), new JobParameter(((Date)entry.getValue().parameter)));
        }
      } else if(parameterType == ParameterType.DOUBLE) {
        map.put(entry.getKey(), new JobParameter((Double)entry.getValue().parameter));
      } else if(parameterType == ParameterType.LONG) {
        if(entry.getValue().parameter instanceof Long) {
          map.put(entry.getKey(), new JobParameter((Long)entry.getValue().parameter));
        } else if(entry.getValue().parameter instanceof Integer) {
          Long tmp = new Long((Integer)entry.getValue().parameter);
          map.put(entry.getKey(), new JobParameter(tmp));
        }
      } else if(parameterType == ParameterType.STRING) {
        map.put(entry.getKey(), new JobParameter((String)entry.getValue().parameter));
      }
    }
    return new JobParameters(map);
  }
View Full Code Here

  private JobParameters params;

  @Before
  public void setup() {
    Map<String, JobParameter> p = new LinkedHashMap<String, JobParameter>();
    p.put("mr.input", new JobParameter("/batch-param-test/input/"));
    p.put("mr.output", new JobParameter("/batch-param-test/output/"));
    p.put("properties-file", new JobParameter("dummy-1.properties"));
    params = new JobParameters(p);
  }
View Full Code Here

   * @return a new JobParameters object containing only a parameter for the
   * current timestamp, to ensure that the job instance will be unique
   */
  private JobParameters makeUniqueJobParameters() {
    Map<String, JobParameter> parameters = new HashMap<String, JobParameter>();
    parameters.put("timestamp", new JobParameter(new Date().getTime()));
    return new JobParameters(parameters);
  }
View Full Code Here

   * @return a new JobParameters object containing only a parameter for the
   * current timestamp, to ensure that the job instance will be unique.
   */
  protected JobParameters getUniqueJobParameters() {
    Map<String, JobParameter> parameters = new HashMap<String, JobParameter>();
    parameters.put("timestamp", new JobParameter(new Date().getTime()));
    return new JobParameters(parameters);
  }
View Full Code Here

   }

   private void refreshClusterStatus(List<String> clusterNames) {
      for (String clusterName : clusterNames) {
         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,
View Full Code Here

      validateNetworkAccessibility(createSpec.getName(), createSpec.getNetworkNames(), vcClusters);
      //save configuration into meta-db, and extend configuration using default spec
      clusterConfigMgr.createClusterConfig(clusterSpec);
      clusterEntityMgr.updateClusterStatus(name, ClusterStatus.PROVISIONING);
      Map<String, JobParameter> param = new TreeMap<String, JobParameter>();
      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()));
      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

               "To update a cluster, its status must be RUNNING, CONFIGURE_ERROR or SERVICE_ERROR");
      }
      clusterConfigMgr.updateAppConfig(clusterName, createSpec);

      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_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 {
View Full Code Here

TOP

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

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.