Skip to content

Commit

Permalink
migrated Para to Spring Boot 3.x, JDK 17+
Browse files Browse the repository at this point in the history
  • Loading branch information
albogdano committed Apr 24, 2024
1 parent f91f2ef commit 9474740
Show file tree
Hide file tree
Showing 121 changed files with 3,298 additions and 3,422 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN curl -Ls https://github.com/Erudika/para/archive/master.tar.gz | tar -xz -C
RUN cd /para/para-master && mvn -q install -DskipTests=true -DskipITs=true && \
cd /para/para-master/para-jar && mv target/para-[0-9]*.jar /para/

FROM adoptopenjdk/openjdk11:alpine-jre
FROM eclipse-temurin:21-alpine

ENV BOOT_SLEEP=0 \
JAVA_OPTS="-Dloader.path=lib"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-base
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN curl -Ls https://github.com/Erudika/para/archive/master.tar.gz | tar -xz -C
RUN cd /para/para-master && mvn -q install -DskipTests=true -DskipITs=true && \
cd /para/para-master/para-jar && mvn -q -Pbase clean package && mv target/para-[0-9]*.jar /para/

FROM adoptopenjdk/openjdk11:alpine-jre
FROM eclipse-temurin:21-alpine

ENV BOOT_SLEEP=0 \
JAVA_OPTS="-Dloader.path=lib"
Expand Down
2 changes: 1 addition & 1 deletion para-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
</execution>
</executions>
<configuration>
<release>11</release>
<release>17</release>
<stylesheetfile>../para-core/src/main/javadoc/stylesheet.css</stylesheetfile>
<show>public</show>
<aggregate>true</aggregate>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.ws.rs.core.MultivaluedHashMap;
import jakarta.ws.rs.core.MultivaluedMap;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
Expand All @@ -55,8 +57,6 @@
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import javax.ws.rs.core.MultivaluedHashMap;
import javax.ws.rs.core.MultivaluedMap;
import nl.altindag.ssl.SSLFactory;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -1698,7 +1698,7 @@ public Map<String, Map<String, List<String>>> grantResourcePermission(String sub
permission.add(App.AllowedMethods.GUEST);
}
subjectid = Utils.urlEncode(subjectid);
resourcePath = Utils.urlEncode(resourcePath);
resourcePath = Utils.base64encURL(resourcePath.getBytes());
return invokePut(Utils.formatMessage("_permissions/{0}/{1}", subjectid, resourcePath), permission, Map.class);
}

Expand All @@ -1713,7 +1713,7 @@ public Map<String, Map<String, List<String>>> revokeResourcePermission(String su
return Collections.emptyMap();
}
subjectid = Utils.urlEncode(subjectid);
resourcePath = Utils.urlEncode(resourcePath);
resourcePath = Utils.base64encURL(resourcePath.getBytes());
return invokeDelete(Utils.formatMessage("_permissions/{0}/{1}", subjectid, resourcePath), null, Map.class);
}

Expand Down Expand Up @@ -1742,7 +1742,7 @@ public boolean isAllowedTo(String subjectid, String resourcePath, String httpMet
return false;
}
subjectid = Utils.urlEncode(subjectid);
resourcePath = Utils.urlEncode(resourcePath);
resourcePath = Utils.base64encURL(resourcePath.getBytes());
String url = Utils.formatMessage("_permissions/{0}/{1}/{2}", subjectid, resourcePath, httpMethod);
Boolean result = invokeGet(url, null, Boolean.class);
return result != null && result;
Expand Down
71 changes: 35 additions & 36 deletions para-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<name>para-core</name>

<properties>
<jacksonVer>2.16.1</jacksonVer>
<jacksonVer>2.17.0</jacksonVer>
<flexmarkVer>0.64.8</flexmarkVer>
</properties>

Expand All @@ -28,20 +28,20 @@
<dependency>
<groupId>io.github.classgraph</groupId>
<artifactId>classgraph</artifactId>
<version>4.8.165</version>
<version>4.8.168</version>
</dependency>

<!-- INJECT & JAX-RS -->
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1.1</version>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
<version>3.1.0</version>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>jakarta.inject</groupId>
<artifactId>jakarta.inject-api</artifactId>
<version>1.0.5</version>
<version>2.0.1</version>
</dependency>

<!-- JACKSON -->
Expand All @@ -56,20 +56,20 @@
<version>${jacksonVer}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-base</artifactId>
<groupId>com.fasterxml.jackson.jakarta.rs</groupId>
<artifactId>jackson-jakarta-rs-base</artifactId>
<version>${jacksonVer}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<groupId>com.fasterxml.jackson.jakarta.rs</groupId>
<artifactId>jackson-jakarta-rs-json-provider</artifactId>
<version>${jacksonVer}</version>
<exclusions>
<!-- <exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-jaxb-annotations</artifactId>
</exclusion>
</exclusions>
</exclusions>-->
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
Expand Down Expand Up @@ -136,7 +136,7 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-access</artifactId>
<version>${logbackVer}</version>
<version>1.4.14</version>
</dependency>

<!-- METRICS -->
Expand Down Expand Up @@ -166,8 +166,7 @@
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<!-- WARN: Breaking changes in 7.x! Wait until Spring Boot 6, javax=>jakarta -->
<version>6.2.5.Final</version>
<version>8.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down Expand Up @@ -238,37 +237,37 @@
<dependency>
<groupId>com.samskivert</groupId>
<artifactId>jmustache</artifactId>
<version>1.15</version>
<version>1.16</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>3.0.1-b06</version>
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
<version>5.0.1</version>
</dependency>
<!-- <dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.4.0-b180830.0359</version>
</dependency>-->
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>4.0.2</version>
</dependency>
<!-- <dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>javax.el</artifactId>
<version>2.2.6</version>
</dependency>
</dependency>-->
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>stax2-api</artifactId>
<version>4.2.1</version>
<version>4.2.2</version>
</dependency>
<dependency>
<groupId>io.github.hakky54</groupId>
<artifactId>sslcontext-kickstart</artifactId>
<version>7.4.11</version>
<version>8.3.3</version>
</dependency>
</dependencies>

Expand All @@ -278,7 +277,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>templating-maven-plugin</artifactId>
<version>1.0.0</version>
<version>3.0.0</version>
<executions>
<execution>
<id>generate-verion-class</id>
Expand All @@ -295,7 +294,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>3.0.0</version>
<version>3.2.0</version>
<configuration>
<revisionOnScmFailure>UNKNOWN</revisionOnScmFailure>
<getRevisionOnlyOnce>true</getRevisionOnlyOnce>
Expand All @@ -317,7 +316,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.2</version>
<version>3.3.1</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
Expand Down Expand Up @@ -348,7 +347,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.1</version>
<version>3.6.3</version>
<executions>
<execution>
<id>javadocs</id>
Expand All @@ -358,7 +357,7 @@
</execution>
</executions>
<configuration>
<release>11</release>
<release>17</release>
<stylesheetfile>src/main/javadoc/stylesheet.css</stylesheetfile>
<show>public</show>
<aggregate>true</aggregate>
Expand All @@ -370,7 +369,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
<configuration>
<archive>
<manifestEntries>
Expand Down
8 changes: 4 additions & 4 deletions para-core/src/main/java/com/erudika/para/core/Address.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
*/
package com.erudika.para.core;

import com.erudika.para.core.utils.CoreUtils;
import com.erudika.para.core.utils.ParaObjectUtils;
import com.erudika.para.core.annotations.Locked;
import com.erudika.para.core.annotations.Stored;
import com.erudika.para.core.utils.CoreUtils;
import com.erudika.para.core.utils.Pager;
import com.erudika.para.core.utils.Para;
import com.erudika.para.core.utils.ParaObjectUtils;
import com.erudika.para.core.utils.Utils;
import java.util.List;
import java.util.Objects;
import javax.validation.constraints.Size;
import javax.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;

/**
* This class represents an address. It enables location based search queries.
Expand Down
2 changes: 1 addition & 1 deletion para-core/src/main/java/com/erudika/para/core/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import javax.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotBlank;
import org.apache.commons.collections.bidimap.DualHashBidiMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
Expand Down
2 changes: 1 addition & 1 deletion para-core/src/main/java/com/erudika/para/core/Linker.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import java.util.List;
import java.util.Map;
import java.util.Objects;
import javax.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotBlank;

/**
* This class represents a many-to-many relationship (link) between two objects.
Expand Down
4 changes: 2 additions & 2 deletions para-core/src/main/java/com/erudika/para/core/ParaObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

import java.io.Serializable;
import java.util.List;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;

/**
* The core domain interface. All Para objects implement it.
Expand Down
7 changes: 5 additions & 2 deletions para-core/src/main/java/com/erudika/para/core/Tag.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import com.erudika.para.core.utils.Para;
import com.erudika.para.core.utils.ParaObjectUtils;
import com.erudika.para.core.utils.Utils;
import jakarta.validation.constraints.NotBlank;
import java.util.List;
import javax.validation.constraints.NotBlank;
import org.apache.commons.lang3.StringUtils;

/**
Expand Down Expand Up @@ -117,7 +117,10 @@ public String getTag() {
* @param tag a tag. Must not be null or empty.
*/
public void setTag(String tag) {
this.tag = Utils.noSpaces(StringUtils.trimToEmpty(tag).toLowerCase().replaceAll("[^\\p{L}\\p{N}\\+\\#\\-\\.]+", " ").replaceAll("\\p{Z}+", " "), "-");
this.tag = Utils.noSpaces(StringUtils.trimToEmpty(tag).toLowerCase().
replaceAll("^[\\p{S}|\\p{P}|\\p{C}|\\-|\\+|\\p{Z}]*", "").
replaceAll("[^\\p{L}\\p{N}\\+\\#\\-\\.]+", " ").
replaceAll("\\p{Z}+", " "), "-");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import com.erudika.para.core.utils.Utils;
import java.util.List;
import java.util.Objects;
import javax.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotBlank;

/**
* A translation is a key/value pair which holds a single translated string.
Expand Down
2 changes: 1 addition & 1 deletion para-core/src/main/java/com/erudika/para/core/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import javax.naming.LimitExceededException;
import javax.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotBlank;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
4 changes: 2 additions & 2 deletions para-core/src/main/java/com/erudika/para/core/Vote.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.NotNull;
import org.apache.commons.lang3.StringUtils;
import javax.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotBlank;

/**
* When a user votes on an object the vote is saved as positive or negative.
Expand Down
2 changes: 1 addition & 1 deletion para-core/src/main/java/com/erudika/para/core/Webhook.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import javax.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotBlank;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.validator.constraints.URL;
import org.slf4j.LoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.validation.Constraint;
import javax.validation.Payload;
import javax.validation.constraints.Pattern;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;
import jakarta.validation.constraints.Pattern;

/**
* Annotation for email validation.
*
* @author Alex Bogdanovski [alex@erudika.com]
*/
@javax.validation.constraints.Email(message = "Please provide a valid email address")
@jakarta.validation.constraints.Email(message = "Please provide a valid email address")
@Pattern(regexp = EMAIL_PATTERN, message = "Please provide a valid email address")
@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE })
@Retention(RetentionPolicy.RUNTIME)
Expand Down
Loading

0 comments on commit 9474740

Please sign in to comment.