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

Migrate all validation related imports to Jakarta #49

Closed
Closed
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
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
<graal-svm-version>22.3.0</graal-svm-version>
<slf4j-api-version>2.0.5</slf4j-api-version>
<jakarta-version>6.0.0</jakarta-version>
<validation-api-version>3.0.2</validation-api-version>
<native-maven-plugin-version>0.9.19</native-maven-plugin-version>
<commons-exec-version>1.3</commons-exec-version>
<memoryfilesystem-version>2.6.0</memoryfilesystem-version>
Expand Down Expand Up @@ -234,6 +235,11 @@
<version>${jakarta-version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>${validation-api-version}</version>
</dependency>
<dependency>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@

package org.eclipse.esmf.ame.exceptions.model;

import javax.validation.constraints.NotEmpty;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import jakarta.validation.constraints.NotEmpty;
import lombok.AllArgsConstructor;
import lombok.Data;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.channels.FileChannel;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.FileSystem;
import java.nio.file.Files;
Expand All @@ -32,8 +30,6 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

import javax.annotation.Nonnull;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;
Expand All @@ -55,6 +51,7 @@

import io.vavr.Tuple;
import io.vavr.Tuple2;
import jakarta.annotation.Nonnull;

@Service
public class LocalFolderResolverStrategy implements ModelResolverStrategy {
Expand Down Expand Up @@ -278,7 +275,8 @@ private List<AspectModelInformation> getListOfAspectModels( final List<String> f
final String[] arg = transformToValidModelDirectory( path ).split( ":" );
final String namespace = arg[0] + ":" + arg[1];
final String fileName = arg[2];
String aspectModel = LocalFolderResolverUtils.readString( importFileSystem.getPath( path ), StandardCharsets.UTF_8 );
String aspectModel = LocalFolderResolverUtils.readString( importFileSystem.getPath( path ),
StandardCharsets.UTF_8 );
return new AspectModelInformation( namespace, fileName, aspectModel );
} catch ( IOException e ) {
throw new FileNotFoundException( "Cannot find in-memory file to create package information", e );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@
import java.util.Map;
import java.util.Optional;

import javax.annotation.Nonnull;

import org.eclipse.esmf.ame.model.repository.AspectModelInformation;
import org.eclipse.esmf.aspectmodel.urn.AspectModelUrn;

import io.vavr.Tuple2;
import jakarta.annotation.Nonnull;

public interface ModelResolverStrategy {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,18 @@

package org.eclipse.esmf.ame.repository.strategy.utils;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Objects;

import javax.annotation.Nonnull;

import org.apache.commons.io.FileUtils;
import org.eclipse.esmf.ame.exceptions.FileNotFoundException;
import org.eclipse.esmf.ame.exceptions.InvalidAspectModelException;
import org.eclipse.esmf.ame.model.resolver.FolderStructure;
import org.eclipse.esmf.aspectmodel.urn.AspectModelUrn;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import jakarta.annotation.Nonnull;

public class LocalFolderResolverUtils {

private static final Logger LOG = LoggerFactory.getLogger( LocalFolderResolverUtils.class );
Expand Down Expand Up @@ -82,12 +76,13 @@
* @param path The path to the file to be read.
* @param charset The character encoding to be used for decoding the file content.
* @return The content of the file as a string decoded with the specified character encoding.
*
* @throws IOException If an I/O error occurs while reading the file.
*/
public static String readString( Path path, Charset charset) throws IOException {
try ( InputStream inputStream = Files.newInputStream(path)) {
public static String readString( Path path, Charset charset ) throws IOException {
try ( InputStream inputStream = Files.newInputStream( path ) ) {
Dismissed Show dismissed Hide dismissed
byte[] bytes = inputStream.readAllBytes();
return new String(bytes, charset);
return new String( bytes, charset );
}
}
}
Loading