Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring boot support #63

Merged
merged 24 commits into from
Aug 7, 2019
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
92c5c0e
Move db-scheduler into a separate core module
evenh Jul 5, 2019
fad4dfa
Fix missing test imports
evenh Jul 5, 2019
3279e59
Move NOTICE generation to the root
evenh Jul 5, 2019
e1d8ff4
Empty new module for Spring Boot
evenh Jul 5, 2019
2904b21
Port configuration for creating Scheduler bean
evenh Jul 6, 2019
2b1097a
Add editorconfig for consistent style
evenh Jul 18, 2019
b90c4af
Use managed Spring Boot versions
evenh Jul 18, 2019
67772c5
Initial auto configuration tests
evenh Jul 18, 2019
0fffc82
Some more test cases
evenh Jul 22, 2019
5ad69ce
Move dependencies to the actual db-scheduler
evenh Jul 22, 2019
9c0b7b7
Log upon startup whether the DataSource is transaction aware
evenh Jul 23, 2019
5f1181a
config: immediateExecution -> immediateExecutionEnabled
evenh Jul 24, 2019
3bef4c0
Set Ubuntu Trusty as Travis OS
evenh Jul 24, 2019
875f1e7
Invoke `startTasks` in the builder
evenh Jul 24, 2019
c94a269
Adjust transaction aware notice
evenh Jul 24, 2019
c6f59cf
Add automatic health check
evenh Jul 26, 2019
b4722c4
Add a property for disabling the scheduler config
evenh Jul 26, 2019
8057d0f
Add Spring Boot example
evenh Jul 31, 2019
eabe736
Changing DB Scheduler references to db-scheduler. Moving doc to front…
kagkarlsson Aug 2, 2019
c84632e
Fix Maven deprecation
evenh Aug 6, 2019
bae96f3
Wrap DataSource in TransactionAwareDataSourceProxy if needed
evenh Aug 6, 2019
4d7a884
Enable maven-dependency-plugin for boot-starter
kagkarlsson Aug 6, 2019
14c32c0
Fix some dependencies
kagkarlsson Aug 6, 2019
eeb005d
Fix some more dependencies
kagkarlsson Aug 6, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .editorconfig
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
evenh marked this conversation as resolved.
Show resolved Hide resolved
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist: trusty
sudo: false
cache:
directories:
Expand Down
52 changes: 51 additions & 1 deletion NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,71 @@ This software includes third party software subject to the following licenses:
Apache Commons Compress under Apache License, Version 2.0
Apache Commons IO under Apache License, Version 2.0
Apache Commons Lang under Apache License, Version 2.0
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 under The Apache Software License, Version 2.0
DB Scheduler: Core under The Apache Software License, Version 2.0
DB Scheduler: Parent 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
java-8-matchers under MIT License
javax.annotation API under CDDL + GPLv2 with classpath exception
JBoss Logging 3 under Apache License, version 2.0
JCL 1.2 implemented over SLF4J under MIT License
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
otj-pg-embedded under Apache License, Version 2.0
PostgreSQL JDBC Driver - JDBC 4.2 under The PostgreSQL License
project ':json-path' under The Apache Software License, Version 2.0
SLF4J API Module under MIT License
SLF4J Simple Binding 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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will check this later..

XZ for Java under Public Domain


71 changes: 71 additions & 0 deletions db-scheduler-boot-starter/NOTICE
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


96 changes: 96 additions & 0 deletions db-scheduler-boot-starter/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?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>

<!-- Spring Boot dependencies -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<optional>true</optional>
</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>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.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<!-- TODO: Remove once the module is ready -->
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
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();
}
}
}
Loading