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

Feature2.3.11 #266

Merged
merged 16 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
48 changes: 28 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.summerboot</groupId>
<artifactId>jexpress</artifactId>
<version>2.3.10</version>
<version>2.3.11</version>
<packaging>jar</packaging>
<name>Summer Boot jExpress</name>
<description>Summer Boot jExpress focuses on solving non-functional and operational maintainability requirements, some of which Spring Boot has (may) not yet provided</description>
Expand Down Expand Up @@ -173,12 +173,12 @@
<maven.compiler.target>11</maven.compiler.target>
<!-- Commons -->
<commons-lang3.version>3.13.0</commons-lang3.version>
<commons-cli.version>1.5.0</commons-cli.version>
<commons-io.version>2.13.0</commons-io.version>
<commons-text.version>1.10.0</commons-text.version>
<commons-cli.version>1.6.0</commons-cli.version>
<commons-io.version>2.15.0</commons-io.version>
<!-- <commons-text.version>1.11.0</commons-text.version>-->
<!-- <owasp.encoder.version>1.2.3</owasp.encoder.version>-->
<!-- Logging -->
<log4j-api.version>2.20.0</log4j-api.version>
<log4j-api.version>2.21.1</log4j-api.version>
<log4j-disruptor.version>3.4.4</log4j-disruptor.version>
<!-- Mail -->
<jakarta-mail.version>2.0.1</jakarta-mail.version>
Expand All @@ -188,26 +188,26 @@
<jwt.version>0.11.5</jwt.version>

<!-- NIO Netty -->
<netty.version>4.1.97.Final</netty.version>
<netty-tcnative.version>2.0.61.Final</netty-tcnative.version>
<netty.version>4.1.100.Final</netty.version>
<netty-tcnative.version>2.0.62.Final</netty-tcnative.version>
<!-- gRPC and protobuf -->
<grpc.version>1.58.0</grpc.version>
<guava.version>32.1.2-jre</guava.version>
<protobuf.version>3.24.3</protobuf.version>
<grpc.version>1.59.0</grpc.version>
<guava.version>32.1.3-jre</guava.version>
<protobuf.version>3.24.4</protobuf.version>
<!-- Web JAX-RS -->
<swagger.core.version>2.2.15</swagger.core.version>
<swagger.core.version>2.2.18</swagger.core.version>
<!--<elastic-apm.version>1.36.0</elastic-apm.version>-->


<!-- MIME-Type -->
<tika.version>2.9.0</tika.version>
<tika.version>2.9.1</tika.version>
<!-- JAX-RS -->
<rs-api.version>3.1.0</rs-api.version>
<jakarta.annotation.version>2.1.1</jakarta.annotation.version>
<reflections.version>0.10.2</reflections.version>

<!-- JSON/XML/Bean Validation -->
<jackson.version>2.15.2</jackson.version>
<jackson.version>2.15.3</jackson.version>
<!-- Bean Validation -->
<hibernate-validator.version>8.0.1.Final</hibernate-validator.version>
<el.Implementation.version>4.0.2</el.Implementation.version>
Expand All @@ -216,11 +216,11 @@
<guice.version>5.1.0</guice.version>

<!-- JPA -->
<hibernate.version>6.3.0.Final</hibernate.version>
<hibernate.version>6.3.1.Final</hibernate.version>
<hikari-cp.version>5.0.1</hikari-cp.version>

<!-- Cache -->
<jedis.version>4.4.3</jedis.version>
<jedis.version>5.0.2</jedis.version>

<quartz.version>2.3.2</quartz.version>

Expand All @@ -232,13 +232,14 @@
<pdfbox.version>2.0.25</pdfbox.version>-->
<!-- PDF - com.openhtmltopdf -->
<openhtml.version>1.0.10</openhtml.version>
<batik-transcoder.version>1.17</batik-transcoder.version>
<!-- PDF - iText -->
<itext7-core.version>7.2.5</itext7-core.version>
<itext7-html2pdf.version>4.0.5</itext7-html2pdf.version>
<itext7-core.version>8.0.2</itext7-core.version>
<itext7-html2pdf.version>5.0.2</itext7-html2pdf.version>

<!-- Testing -->
<testng.version>7.8.0</testng.version>
<jdbc.version>8.1.0</jdbc.version>
<jdbc.version>8.2.0</jdbc.version>
</properties>

<dependencies>
Expand All @@ -263,11 +264,11 @@
<version>${commons-io.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-text -->
<dependency>
<!-- <dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>${commons-text.version}</version>
</dependency>
</dependency>-->

<!-- https://mvnrepository.com/artifact/org.owasp.encoder/encoder -->
<!-- <dependency>
Expand Down Expand Up @@ -697,6 +698,13 @@
<artifactId>openhtmltopdf-svg-support</artifactId>
<version>${openhtml.version}</version>
</dependency>
<!-- security patch https://mvnrepository.com/artifact/org.apache.xmlgraphics/batik-transcoder -->
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-transcoder</artifactId>
<version>${batik-transcoder.version}</version>
</dependency>

<dependency>
<!-- Optional, leave out if you do not need MathML support. -->
<!-- Introduced in RC-13. -->
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/org/summerboot/jexpress/boot/BootConstant.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,18 @@
*/
package org.summerboot.jexpress.boot;

import java.util.Random;

/**
*
* @author Changski Tie Zheng Zhang 张铁铮, 魏泽北, 杜旺财, 杜富贵
*/
public interface BootConstant {

String APP_ID = String.format("%06d", new Random().nextInt(999999));

//version
String VERSION = "SummerBoot.jExpress 2.3.10";
String VERSION = "SummerBoot.jExpress 2.3.11";
String JEXPRESS_PACKAGE_NAME = "org.summerboot.jexpress";

String DEFAULT_ADMIN_MM = "changeit";
Expand Down
13 changes: 12 additions & 1 deletion src/main/java/org/summerboot/jexpress/boot/BootErrorCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private static int getErrorCode(int code) {
int NIO_FILE_UPLOAD_BAD_LENGTH = getErrorCode(NIO_BASE + 6);
int NIO_FILE_UPLOAD_EXCEED_SIZE_LIMIT = getErrorCode(NIO_BASE + 7);
int NIO_REQUEST_BAD_HEADER = getErrorCode(NIO_BASE + 8);
int NIO_REQUEST_BAD_DATA = getErrorCode(NIO_BASE + 9);
int BAD_RQUEST_DATA = getErrorCode(NIO_BASE + 9);
int NIO_REQUEST_BAD_ENCODING = getErrorCode(NIO_BASE + 10);
int NIO_REQUEST_BAD_DOWNLOAD = getErrorCode(NIO_BASE + 11);

Expand Down Expand Up @@ -88,4 +88,15 @@ private static int getErrorCode(int code) {
int ACCESS_ERROR_DATABASE = getErrorCode(ACCESS_BASE + 4);
int ACCESS_ERROR_RPC = getErrorCode(ACCESS_BASE + 5);

// Bad Request
int BR_BASE = 60;
int BAD_RQUEST_UNKNOWN_JSON_REQUEST_BODY = BR_BASE + 1;
int BAD_RQUEST_UNKNOWN_XML_REQUEST_BODY = BR_BASE + 2;
int BAD_RQUEST_MISSING_JSON_REQUEST_BODY = BR_BASE + 3;
int BAD_RQUEST_MISSING_REQUEST_BODY = BR_BASE + 4;
int BAD_RQUEST_MISSING_XML_REQUEST_BODY = BR_BASE + 5;
int BAD_RQUEST_INVALID_JSON_REQUEST_BODY = BR_BASE + 6;
int BAD_RQUEST_INVALID_XML_REQUEST_BODY = BR_BASE + 7;
int BAD_RQUEST_INVALID_REQUEST_BODY = BR_BASE + 8;
int BAD_RQUEST_MISSING_REQUIRED_FILED = BR_BASE + 9;
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import org.summerboot.jexpress.boot.instrumentation.jmx.ServerStatusMBean;
import org.summerboot.jexpress.integration.cache.AuthTokenCache;
import org.summerboot.jexpress.integration.cache.AuthTokenCacheLocalImpl;
import org.summerboot.jexpress.integration.quartz.SchedulerProvider;
import org.summerboot.jexpress.integration.quartz.GuiceSchedulerProvider;
import org.summerboot.jexpress.integration.smtp.BootPostOfficeImpl;
import org.summerboot.jexpress.integration.smtp.PostOffice;
import org.summerboot.jexpress.nio.server.BootHttpPingHandler;
Expand Down Expand Up @@ -141,7 +141,7 @@ public void configure() {
memo.append(INFO).append(caller);
}
// 7. supports org.quartz with Guice IoC
bind(Scheduler.class).toProvider(SchedulerProvider.class).asEagerSingleton();
bind(Scheduler.class).toProvider(GuiceSchedulerProvider.class).asEagerSingleton();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,6 @@
String[] hideJsonNumberFields() default {};

String[] hideJsonArrayFields() default {};

boolean sendRequestParsingErrorToClient() default false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
* @Scheduled(hour = 14, minute = 15, second = 16)// daily: 2:15:16pm everyday
* @Scheduled(minute = 15, second = 16)// hourly: every hour at the 15th minute and the 16th second
* @Scheduled(second = 16)// minutely: every minute at the 16th second
* @Scheduled(fixedRate = 10_000, initialDelay=5_000)// start job after 5 seconds, run job every 10 secsonds no matter how long the job takes
* @Scheduled(fixedDelay = 10_000, initialDelay=5_000)// start job after 5 seconds, when the job finished wait 10 seconds then start it again
* @Scheduled(fixedRateMs = 10_000, initialDelayMs=5_000)// start job after 5 seconds, run job every 10 secsonds no matter how long the job takes
* @Scheduled(fixedDelayMs = 10_000, initialDelayMs=5_000)// start job after 5 seconds, when the job finished wait 10 seconds then start it again
* }</pre>
*
* @author Changski Tie Zheng Zhang 张铁铮, 魏泽北, 杜旺财, 杜富贵
Expand All @@ -46,6 +46,14 @@

String[] cron() default {};

/**
* The name of a static field defined in the same class, which contains a
* configurable value
*
* @return
*/
String cronField() default "";

/**
* 1-31: for monthlyOnDayAndHourAndMinute(int dayOfMonth, int hour, int
* minute)
Expand All @@ -54,6 +62,14 @@
*/
int[] daysOfMonth() default {};

/**
* The name of a static field defined in the same class, which contains a
* configurable value
*
* @return
*/
String daysOfMonthField() default "";

/**
* 1-7 for SUN-SAT: for atHourAndMinuteOnGivenDaysOfWeek(int hour, int
* minute, Integer[] daysOfWeek)
Expand All @@ -62,27 +78,59 @@
*/
int[] daysOfWeek() default {};

/**
* The name of a static field defined in the same class, which contains a
* configurable value
*
* @return
*/
String daysOfWeekField() default "";

/**
* 0-23: for dailyAtHourAndMinute(int hour, int minute)
*
* @return
*/
int hour() default -1;

/**
* The name of a static field defined in the same class, which contains a
* configurable value
*
* @return
*/
String hourField() default "";

/**
* 0-59
*
* @return
*/
int minute() default -1;

/**
* The name of a static field defined in the same class, which contains a
* configurable value
*
* @return
*/
String minuteField() default "";

/**
* 0-59
*
* @return
*/
int second() default -1;

/**
* The name of a static field defined in the same class, which contains a
* configurable value
*
* @return
*/
String secondField() default "";

/**
* The fixedRate runs the scheduled task at every n millisecond. It doesn't
* check for any previous executions of the task.
Expand All @@ -96,7 +144,15 @@
*
* @return
*/
long fixedRate() default 0;
long fixedRateMs() default 0;

/**
* The name of a static field defined in the same class, which contains a
* configurable value
*
* @return
*/
String fixedRateMsField() default "";

/**
* The fixedDelay makes sure that there is a delay of n millisecond between
Expand All @@ -110,12 +166,28 @@
*
* @return
*/
long fixedDelay() default 0;
long fixedDelayMs() default 0;

/**
* The name of a static field defined in the same class, which contains a
* configurable value
*
* @return
*/
String fixedDelayMsField() default "";

/**
* start job after n millisecond
*
* @return
*/
long initialDelay() default 0;
long initialDelayMs() default 0;

/**
* The name of a static field defined in the same class, which contains a
* configurable value
*
* @return
*/
String initialDelayMsField() default "";
}
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,8 @@ private static List<String> parse(ConfigHeader memo) {
List<String> ret = new ArrayList<>();
lineBreak(memo.title(), null, ret);
lineBreak(memo.desc(), null, ret);
lineBreak(memo.format(), "Format: ", ret);
lineBreak(memo.example(), "Example: ", ret);
lineBreak(memo.format(), "Format> ", ret);
lineBreak(memo.example(), "Example> ", ret);

return ret;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import jakarta.annotation.Nonnull;
import jakarta.annotation.Nullable;
import org.apache.logging.log4j.Logger;
import org.summerboot.jexpress.boot.BootConstant;

/**
*
Expand All @@ -37,7 +38,7 @@ public class BootHealthInspectorImpl implements HealthInspector {
*/
@Override
public List<Err> ping(Object... args) {
ServiceError error = new ServiceError(-1);
ServiceError error = new ServiceError(BootConstant.APP_ID + "- ping");
healthCheck(error, null);
List<Err> errors = error.getErrors();
return errors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ default List<Err> ping(Object... params) {
blacklist(key, "uid123", 1000);
boolean isOnBlacklist = isBlacklist(key);
if (!isOnBlacklist) {
e = new Err(BootErrorCode.ACCESS_ERROR_CACHE, null, "Cache Data Error - failed to read", null);
e = new Err(BootErrorCode.ACCESS_ERROR_CACHE, null, "Cache Data Error - failed to read", null, null);
}
TimeUnit.MILLISECONDS.sleep(1500);
isOnBlacklist = isBlacklist(key);
if (isOnBlacklist) {
e = new Err(BootErrorCode.ACCESS_ERROR_CACHE, null, "Cache Access Error - failed to expire", null);
e = new Err(BootErrorCode.ACCESS_ERROR_CACHE, null, "Cache Access Error - failed to expire", null, null);
}
} catch (Throwable ex) {
e = new Err(BootErrorCode.ACCESS_ERROR_CACHE, null, "Cache Access Error - " + ex.toString(), ex);
e = new Err(BootErrorCode.ACCESS_ERROR_CACHE, null, "Cache Access Error - " + ex.toString(), ex, null);
}
List<Err> errors = null;
if (e != null) {
Expand Down
Loading
Loading