Package org.springframework.xd.rest.domain

Examples of org.springframework.xd.rest.domain.JobExecutionInfoResource$Page


    objectMapper.addMixInAnnotations(StepExecution.class, StepExecutionJacksonMixIn.class);
    objectMapper.addMixInAnnotations(StepExecutionHistory.class, StepExecutionHistoryJacksonMixIn.class);
    objectMapper.addMixInAnnotations(ExecutionContext.class, ExecutionContextJacksonMixIn.class);
    objectMapper.addMixInAnnotations(ExitStatus.class, ExitStatusJacksonMixIn.class);

    final JobExecutionInfoResource jobExecutionInfoResource = objectMapper.readValue(json,
        JobExecutionInfoResource.class);

    Assert.assertNotNull(jobExecutionInfoResource);
    Assert.assertEquals(Long.valueOf(0), jobExecutionInfoResource.getJobId());
    Assert.assertEquals("ff", jobExecutionInfoResource.getName());
    Assert.assertEquals("COMPLETED", jobExecutionInfoResource.getJobExecution().getStatus().name());

  }
View Full Code Here


  @CliCommand(value = DISPLAY_JOB_EXECUTION, help = "Display the details of a Job Execution")
  public String display(
      @CliOption(mandatory = true, key = { "", "id" }, help = "the id of the job execution") long jobExecutionId) {

    final JobExecutionInfoResource jobExecutionInfoResource = jobOperations().displayJobExecution(jobExecutionId);

    final Table jobExecutionTable = new Table();
    jobExecutionTable.addHeader(1, new TableHeader("Property"))
        .addHeader(2, new TableHeader("Value"));

    final StringBuilder details = new StringBuilder();

    details.append("Job Execution Details:\n");
    details.append(UiUtils.HORIZONTAL_LINE);

    final String localCreateTime = this.configuration.getLocalTime(jobExecutionInfoResource.getJobExecution().getCreateTime());
    final String localStartTime = this.configuration.getLocalTime(jobExecutionInfoResource.getJobExecution().getStartTime());
    final Date endTimeDate = jobExecutionInfoResource.getJobExecution().getEndTime();
    final String localEndTime = (endTimeDate == null) ? "" : this.configuration.getLocalTime(endTimeDate);

    jobExecutionTable.addRow("Job Execution ID", String.valueOf(jobExecutionInfoResource.getExecutionId()))
        .addRow("Job Name", jobExecutionInfoResource.getName())
        .addRow("Create Time", localCreateTime)
        .addRow("Start Time", localStartTime)
        .addRow("End Time", localEndTime)
        .addRow("Running", String.valueOf(jobExecutionInfoResource.getJobExecution().isRunning()))
        .addRow("Stopping", String.valueOf(jobExecutionInfoResource.getJobExecution().isStopping()))
        .addRow("Step Execution Count", String.valueOf(jobExecutionInfoResource.getStepExecutionCount()))
        .addRow("Execution Status", jobExecutionInfoResource.getJobExecution().getStatus().name());

    details.append(jobExecutionTable);

    details.append(UiUtils.HORIZONTAL_LINE);
    details.append("Job Parameters:\n");
    details.append(UiUtils.HORIZONTAL_LINE);

    if (jobExecutionInfoResource.getJobExecution().getJobParameters().isEmpty()) {
      details.append("No Job Parameters are present");
    }
    else {
      final Table jobParameterTable = new Table();
      jobParameterTable.addHeader(1, new TableHeader("Name"))
          .addHeader(2, new TableHeader("Value"))
          .addHeader(3, new TableHeader("Type"))
          .addHeader(4, new TableHeader("Identifying"));

      for (Map.Entry<String, JobParameter> jobParameterEntry : jobExecutionInfoResource.getJobExecution().getJobParameters().getParameters().entrySet()) {

        jobParameterTable.addRow(jobParameterEntry.getKey(),
            jobParameterEntry.getValue().getValue().toString(),
            jobParameterEntry.getValue().getType().name(),
            String.valueOf(jobParameterEntry.getValue().isIdentifying()));
      }

      details.append(jobParameterTable);
    }

    final String jobDefinitionStatus;
    if (jobExecutionInfoResource.isDeleted()) {
      jobDefinitionStatus = "Deleted";
    }
    else if (!jobExecutionInfoResource.isDeleted() && !jobExecutionInfoResource.isDeployed()) {
      jobDefinitionStatus = "Undeployed";
    }
    else {
      jobDefinitionStatus = "Deployed";
    }
View Full Code Here

    private boolean isJobComplete(String jobName) {
        boolean result = false;
        List<JobExecutionInfoResource> resources = getJobExecInfoByName(jobName);
        Iterator<JobExecutionInfoResource> resourceIter = resources.iterator();
        while (resourceIter.hasNext()) {
            JobExecutionInfoResource resource = resourceIter.next();

            if (jobName.equals(resource.getName())) {
                if (BatchStatus.COMPLETED.equals(resource.getJobExecution().getStatus())) {
                    result = true;
                    break;
                }
                else {
                    result = false;
View Full Code Here

  protected List<JobExecutionInfoResource> getJobExecInfoByName(String jobName) {
    PagedResources<JobExecutionInfoResource> jobExecutions = springXDTemplate.jobOperations().listJobExecutions();
    Iterator<JobExecutionInfoResource> iter = jobExecutions.iterator();
    List<JobExecutionInfoResource> result = new ArrayList<JobExecutionInfoResource>();
    while (iter.hasNext()) {
      JobExecutionInfoResource resource = iter.next();
      if (resource.getName().equals(jobName)) {
        result.add(resource);
      }
    }
    return result;
  }
View Full Code Here

TOP

Related Classes of org.springframework.xd.rest.domain.JobExecutionInfoResource$Page

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.