This repository has been archived by the owner on Mar 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate Spring XD Batch REST endpoints
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
Showing
99 changed files
with
4,830 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
...ch-admin-domain/src/main/java/org/springframework/batch/admin/domain/DetailedJobInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
90 changes: 90 additions & 0 deletions
90
...-domain/src/main/java/org/springframework/batch/admin/domain/DetailedJobInfoResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.