forked from kagkarlsson/db-scheduler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request kagkarlsson#63 from evenh/spring-boot-support
Spring boot support
- Loading branch information
Showing
128 changed files
with
1,753 additions
and
179 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
charset = utf-8 | ||
|
||
[*.java] | ||
indent_style = space | ||
indent_size = 4 |
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
dist: trusty | ||
sudo: false | ||
cache: | ||
directories: | ||
|
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
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,71 @@ | ||
Db-scheduler | ||
|
||
Copyright 2015 Gustav Karlsson. All Rights Reserved. | ||
|
||
This product includes software developed by Gustav Karlsson. | ||
Licensed under Apache 2 - http://www.apache.org/licenses/LICENSE-2.0.html | ||
|
||
|
||
This software includes third party software subject to the following licenses: | ||
|
||
Apache Log4j API under Apache License, Version 2.0 | ||
Apache Log4j to SLF4J Adapter under Apache License, Version 2.0 | ||
ASM based accessors helper used by json-smart under The Apache Software License, Version 2.0 | ||
ASM Core under BSD | ||
AssertJ fluent assertions under Apache License, Version 2.0 | ||
Bean Validation API under Apache License 2.0 | ||
Byte Buddy (without dependencies) under Apache License, Version 2.0 | ||
Byte Buddy Java agent under Apache License, Version 2.0 | ||
ClassMate under The Apache Software License, Version 2.0 | ||
cron-utils under Apache 2.0 | ||
db-scheduler: Core under The Apache Software License, Version 2.0 | ||
db-scheduler: Spring Boot Starter under The Apache Software License, Version 2.0 | ||
Guava: Google Core Libraries for Java under The Apache Software License, Version 2.0 | ||
Hamcrest Core under New BSD License | ||
Hamcrest library under New BSD License | ||
Hibernate Validator Engine under Apache License 2.0 | ||
HikariCP under The Apache Software License, Version 2.0 | ||
HyperSQL Database under HSQLDB License, a BSD open source license | ||
Jackson datatype: JSR310 under The Apache Software License, Version 2.0 | ||
Jackson-annotations under The Apache Software License, Version 2.0 | ||
Jackson-core under The Apache Software License, Version 2.0 | ||
jackson-databind under The Apache Software License, Version 2.0 | ||
javax.annotation API under CDDL + GPLv2 with classpath exception | ||
JBoss Logging 3 under Apache License, version 2.0 | ||
JSON library from Android SDK under Apache License 2.0 | ||
JSON Small and Fast Parser under The Apache Software License, Version 2.0 | ||
JSONassert under The Apache Software License, Version 2.0 | ||
JUL to SLF4J bridge under MIT License | ||
JUnit under Eclipse Public License 1.0 | ||
Logback Classic Module under Eclipse Public License - v 1.0 or GNU Lesser General Public License | ||
Logback Core Module under Eclipse Public License - v 1.0 or GNU Lesser General Public License | ||
Micro JDBC under The Apache Software License, Version 2.0 | ||
mockito-core under The MIT License | ||
Objenesis under Apache 2 | ||
org.xmlunit:xmlunit-core under The Apache Software License, Version 2.0 | ||
project ':json-path' under The Apache Software License, Version 2.0 | ||
SLF4J API Module under MIT License | ||
SnakeYAML under Apache License, Version 2.0 | ||
Spring AOP under Apache License, Version 2.0 | ||
Spring Beans under Apache License, Version 2.0 | ||
Spring Boot under Apache License, Version 2.0 | ||
Spring Boot Actuator under Apache License, Version 2.0 | ||
Spring Boot Actuator AutoConfigure under Apache License, Version 2.0 | ||
Spring Boot Auto-Configure Annotation Processor under Apache License, Version 2.0 | ||
Spring Boot AutoConfigure under Apache License, Version 2.0 | ||
Spring Boot Configuration Processor under Apache License, Version 2.0 | ||
Spring Boot JDBC Starter under Apache License, Version 2.0 | ||
Spring Boot Logging Starter under Apache License, Version 2.0 | ||
Spring Boot Starter under Apache License, Version 2.0 | ||
Spring Boot Test under Apache License, Version 2.0 | ||
Spring Boot Test Auto-Configure under Apache License, Version 2.0 | ||
Spring Boot Test Starter under Apache License, Version 2.0 | ||
Spring Commons Logging Bridge under Apache License, Version 2.0 | ||
Spring Context under Apache License, Version 2.0 | ||
Spring Core under Apache License, Version 2.0 | ||
Spring Expression Language (SpEL) under Apache License, Version 2.0 | ||
Spring JDBC under Apache License, Version 2.0 | ||
Spring TestContext Framework under Apache License, Version 2.0 | ||
Spring Transaction under Apache License, Version 2.0 | ||
|
||
|
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,102 @@ | ||
<?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/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>db-scheduler-parent</artifactId> | ||
<groupId>com.github.kagkarlsson</groupId> | ||
<version>5.3-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>db-scheduler-spring-boot-starter</artifactId> | ||
<name>db-scheduler: Spring Boot Starter</name> | ||
<description>A starter for Spring Boot that will configure db-scheduler</description> | ||
|
||
<properties> | ||
<license.dir>${project.parent.basedir}/.license</license.dir> | ||
</properties> | ||
|
||
<dependencies> | ||
<!-- The library itself --> | ||
<dependency> | ||
<groupId>com.github.kagkarlsson</groupId> | ||
<artifactId>db-scheduler</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
</dependency> | ||
|
||
<!-- Spring dependencies --> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-context</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-jdbc</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-actuator</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-autoconfigure</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-actuator-autoconfigure</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
|
||
<!-- Validation --> | ||
<dependency> | ||
<groupId>javax.validation</groupId> | ||
<artifactId>validation-api</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.hibernate.validator</groupId> | ||
<artifactId>hibernate-validator</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<!-- Test --> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-jdbc</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.assertj</groupId> | ||
<artifactId>assertj-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.hsqldb</groupId> | ||
<artifactId>hsqldb</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
34 changes: 34 additions & 0 deletions
34
.../main/java/com/github/kagkarlsson/scheduler/boot/actuator/DbSchedulerHealthIndicator.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,34 @@ | ||
package com.github.kagkarlsson.scheduler.boot.actuator; | ||
|
||
import com.github.kagkarlsson.scheduler.Scheduler; | ||
import com.github.kagkarlsson.scheduler.SchedulerState; | ||
import java.util.Objects; | ||
import org.springframework.boot.actuate.health.Health; | ||
import org.springframework.boot.actuate.health.HealthIndicator; | ||
|
||
public class DbSchedulerHealthIndicator implements HealthIndicator { | ||
private final SchedulerState state; | ||
|
||
public DbSchedulerHealthIndicator(Scheduler scheduler) { | ||
this.state = Objects.requireNonNull(scheduler).getSchedulerState(); | ||
} | ||
|
||
@Override | ||
public Health health() { | ||
if (state.isStarted() && !state.isShuttingDown()) { | ||
return Health.up() | ||
.withDetail("state", "started") | ||
.build(); | ||
} else if (state.isStarted() && state.isShuttingDown()) { | ||
return Health.outOfService() | ||
.withDetail("state", "shutting_down") | ||
.build(); | ||
} else if (!state.isStarted() && !state.isShuttingDown()) { | ||
return Health.down() | ||
.withDetail("state", "not_started") | ||
.build(); | ||
} else { | ||
return Health.down().build(); | ||
} | ||
} | ||
} |
Oops, something went wrong.