Skip to content
This repository has been archived by the owner on Mar 29, 2019. It is now read-only.

Commit

Permalink
Migrate Spring XD Batch REST endpoints
Browse files Browse the repository at this point in the history
Existing functionality in Spring XD's REST API was brought over into
Spring Batch Admin.  Functionality was ported "as is" and will be
cleaned up from a modeling perspective in a future commit.
  • Loading branch information
mminella committed Jan 6, 2015
1 parent eeeee7a commit 6ce0f36
Show file tree
Hide file tree
Showing 99 changed files with 4,830 additions and 208 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
<modules>
<module>spring-batch-admin-parent</module>
<module>spring-batch-admin-resources</module>
<!--<module>spring-batch-integration</module>-->
<module>spring-batch-admin-manager</module>
<module>spring-batch-admin-domain</module>
<module>spring-batch-admin-sample</module>
</modules>
<profiles>
Expand Down
92 changes: 92 additions & 0 deletions spring-batch-admin-domain/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-batch-admin-domain</artifactId>
<packaging>jar</packaging>
<description><![CDATA[Domain objects as well as serialization utilities used by Spring Batch Admin's REST endpoints.]]></description>
<parent>
<artifactId>spring-batch-admin-parent</artifactId>
<groupId>org.springframework.batch</groupId>
<version>2.0.0.BUILD-SNAPSHOT</version>
<relativePath>../spring-batch-admin-parent</relativePath>
</parent>
<name>Domain</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.hateoas</groupId>
<artifactId>spring-hateoas</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2010 the original author or authors.
* Copyright 2009-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.admin.history;
package org.springframework.batch.admin.domain;

public class CumulativeHistory {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/*
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.springframework.batch.admin.domain;

import org.springframework.batch.core.ExitStatus;

/**
* A job info for batch jobs that provides more details than the base {@link JobInfo}
*
* @author Andrew Eisenberg
* @author Ilayaperumal Gopinathan
*/
public class DetailedJobInfo extends JobInfo {

private String jobParameters;

private String duration;

private String startTime;

private String startDate;

private int stepExecutionCount;

private ExitStatus exitStatus;

private JobExecutionInfo lastExecutionInfo;

/**
* Construct detailed job info.
*
* @param name the name of the job
* @param executionCount the number of job executions
* @param launchable flag to specify if the job is launchable
* @param incrementable flag to specify if the job parameter is incrementable
* @param lastExecution the last job execution for this job
*/
public DetailedJobInfo(String name, int executionCount, boolean launchable, boolean incrementable,
JobExecutionInfo lastExecution) {
super(name, executionCount, launchable, incrementable);
this.lastExecutionInfo = lastExecution;
if (lastExecutionInfo != null) {
jobParameters = lastExecution.getJobParametersString();
duration = lastExecution.getDuration();
startTime = lastExecution.getStartTime();
startDate = lastExecution.getStartDate();
stepExecutionCount = lastExecution.getStepExecutionCount();
exitStatus = lastExecution.getJobExecution().getExitStatus();
}
}

public JobExecutionInfo getLastExecutionInfo() {
return lastExecutionInfo;
}

public String getJobParameters() {
return jobParameters;
}

public String getDuration() {
return duration;
}

public String getStartTime() {
return startTime;
}

public String getStartDate() {
return startDate;
}

public int getStepExecutionCount() {
return stepExecutionCount;
}

public ExitStatus getExitStatus() {
return exitStatus;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
* Copyright 2013-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.springframework.batch.admin.domain;

import javax.xml.bind.annotation.XmlRootElement;

import org.springframework.batch.core.ExitStatus;


/**
* Represents Expanded Batch job info that has more details on batch jobs.
*
* @author Ilayaperumal Gopinathan
* @since 2.0
*/
@XmlRootElement
public class DetailedJobInfoResource extends JobInfoResource {

private String jobParameters;

private String duration;

private String startTime;

private String startDate;

private int stepExecutionCount;

private ExitStatus exitStatus;

/**
* Default constructor for serialization frameworks.
*/
@SuppressWarnings("unused")
private DetailedJobInfoResource() {
super();
}

public DetailedJobInfoResource(String name, int executionCount, boolean launchable, boolean incrementable,
JobExecutionInfoResource lastExecution) {
super(name, executionCount, lastExecution != null && lastExecution.getJobExecution().getJobInstance() != null ? lastExecution.getJobExecution().getJobInstance().getInstanceId() : null , launchable, incrementable);
if (lastExecution != null) {
jobParameters = lastExecution.getJobParametersString();
duration = lastExecution.getDuration();
startTime = lastExecution.getStartTime();
startDate = lastExecution.getStartDate();
stepExecutionCount = lastExecution.getStepExecutionCount();
exitStatus = lastExecution.getJobExecution().getExitStatus();
}
}

public String getJobParameters() {
return jobParameters;
}

public String getDuration() {
return duration;
}

public String getStartTime() {
return startTime;
}

public String getStartDate() {
return startDate;
}

public int getStepExecutionCount() {
return stepExecutionCount;
}

public ExitStatus getExitStatus() {
return exitStatus;
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2010 the original author or authors.
* Copyright 2009-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.admin.history;
package org.springframework.batch.admin.domain;

import java.util.Date;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
/**
*
*/
package org.springframework.batch.admin.web;
package org.springframework.batch.admin.domain;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Properties;
import java.util.TimeZone;

import org.springframework.batch.admin.domain.support.JobParametersExtractor;
import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobInstance;
Expand Down
Loading

0 comments on commit 6ce0f36

Please sign in to comment.