Skip to content

Commit

Permalink
3.2.4-SNAPSHOT
Browse files Browse the repository at this point in the history
+ Vertx Json Schema
+ Keel 4.5.7

Signed-off-by: Sinri Edogawa <[email protected]>
  • Loading branch information
sinri committed Apr 10, 2024
1 parent f482735 commit 3399b04
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 6 deletions.
7 changes: 6 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<vertxVersion>4.5.4</vertxVersion>
<vertxVersion>4.5.7</vertxVersion>
<commonmarkVersion>0.21.0</commonmarkVersion>
<jacksonVersion>2.15.3</jacksonVersion>
<poiVersion>5.2.5</poiVersion>
Expand Down Expand Up @@ -145,6 +145,11 @@
<artifactId>vertx-redis-client</artifactId>
<version>${vertxVersion}</version>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-json-schema</artifactId>
<version>${vertxVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
Expand Down
13 changes: 12 additions & 1 deletion src/main/java/io/github/sinri/keel/core/KeelCronExpression.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ private void parseField(@Nonnull String rawComponent, @Nonnull Set<Integer> opti
}
}

/**
* @since 3.2.4
*/
public static ParsedCalenderElements parseCalenderToElements(@Nonnull Calendar currentCalendar) {
return new ParsedCalenderElements(currentCalendar);
}

@Nonnull
public String getRawCronExpression() {
return rawCronExpression;
Expand All @@ -119,17 +126,21 @@ public static class ParsedCalenderElements {
public final int month;
public final int weekday;

// debug use
public final int second;

public ParsedCalenderElements(@Nonnull Calendar currentCalendar) {
minute = currentCalendar.get(Calendar.MINUTE);
hour = currentCalendar.get(Calendar.HOUR_OF_DAY);
day = currentCalendar.get(Calendar.DAY_OF_MONTH);
month = 1 + currentCalendar.get(Calendar.MONTH);// make JAN 1, ...
weekday = currentCalendar.get(Calendar.DAY_OF_WEEK) - 1; // make sunday 0, ...
second = currentCalendar.get(Calendar.SECOND);
}

@Override
public String toString() {
return minute + " " + hour + " " + day + " " + month + " " + weekday;
return "(" + second + ") " + minute + " " + hour + " " + day + " " + month + " " + weekday;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
/**
* @since 2.7
*/
@Deprecated(since = "3.2.4")
public class JsonArrayScheme extends JsonValueScheme<JsonArray> {
private final Map<Integer, JsonElementScheme<?>> indexedElementSchemeMap = new LinkedHashMap<>();
private JsonElementScheme<?> defaultElementScheme;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/**
* @since 2.7
*/
@Deprecated(since = "3.2.4")
public class JsonBooleanScheme extends JsonValueScheme<Boolean> {
private Boolean expected;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/**
* @since 2.7
*/
@Deprecated(since = "3.2.4")
public interface JsonElementScheme<T> extends JsonifiableEntity<JsonElementScheme<T>> {
static JsonElementScheme<?> fromJsonObject(JsonObject jsonObject) {
JsonElementSchemeType scheme_type = JsonElementSchemeType.valueOf(jsonObject.getString("scheme_type"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/**
* @since 2.7
*/
@Deprecated(since = "3.2.4")
public class JsonNullScheme extends JsonValueScheme<Object> {
public JsonNullScheme() {
super();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
/**
* @since 2.7
*/
@Deprecated(since = "3.2.4")
public class JsonNumberScheme extends JsonValueScheme<Number> {
//private boolean withFractions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/**
* @since 2.7
*/
@Deprecated(since = "3.2.4")
public class JsonObjectScheme extends JsonValueScheme<JsonObject> {

private final Map<String, JsonElementScheme<?>> elementSchemeMap = new LinkedHashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import javax.annotation.Nonnull;

@Deprecated(since = "3.2.4")
public class JsonPlainScheme extends JsonValueScheme<Object> {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import static io.github.sinri.keel.helper.KeelHelpersInterface.KeelHelpers;

@Deprecated(since = "3.2.4")
public class JsonSchemeMismatchException extends Exception {
public static final String RuleSchemeError = "SchemeError";
public static final String RuleEmptyArrayNotAllowed = "EmptyArrayNotAllowed";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
/**
* @since 2.7
*/
@Deprecated(since = "3.2.4")
public class JsonStringScheme extends JsonValueScheme<String> {

private Pattern pattern;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/**
* @since 2.7
*/
@Deprecated(since = "3.2.4")
abstract public class JsonValueScheme<T> implements JsonElementScheme<T> {

protected T digested;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ protected KeelEventLogger buildEventLogger() {
@Override

public void start() throws Exception {
long delaySeconds = 60 - (System.currentTimeMillis() / 1000) % 60;
this.timerID = Keel.getVertx().setPeriodic(delaySeconds, 60_000L, timerID -> {
Calendar calendar = Calendar.getInstance();
handleEveryMinute(calendar);
int delaySeconds = 61 - KeelCronExpression.parseCalenderToElements(Calendar.getInstance()).second;
this.timerID = Keel.getVertx().setPeriodic(delaySeconds * 1000L, 60_000L, timerID -> {
handleEveryMinute(Calendar.getInstance());
refreshPlans();
});
}
Expand Down

0 comments on commit 3399b04

Please sign in to comment.