moved to jakarta

This commit is contained in:
lucio 2024-03-11 10:22:25 +01:00
parent e36605ec12
commit 3aeca7c089
29 changed files with 94 additions and 97 deletions

32
pom.xml
View File

@ -24,17 +24,27 @@
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
<properties> <properties>
<tomcat.version>9.0.85</tomcat.version> <tomcat.version>10.1.19</tomcat.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source> <maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target> <maven.compiler.target>11</maven.compiler.target>
</properties> </properties>
<scm> <scm>
<connection>scm:git:https://code-repo.d4science.org/gCubeSystem/common-smartgears.git</connection> <connection>
<developerConnection>scm:git:httpstps://code-repo.d4science.org/gCubeSystem/common-smartgears.git</developerConnection> scm:git:https://code-repo.d4science.org/gCubeSystem/common-smartgears.git</connection>
<developerConnection>
scm:git:httpstps://code-repo.d4science.org/gCubeSystem/common-smartgears.git</developerConnection>
<url>https://code-repo.d4science.org/gCubeSystem/common-smartgears</url> <url>https://code-repo.d4science.org/gCubeSystem/common-smartgears</url>
</scm> </scm>
<dependencies> <dependencies>
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<!--
https://mvnrepository.com/artifact/jakarta.servlet/jakarta.servlet-api -->
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.0.0</version>
</dependency>
<dependency> <dependency>
<groupId>org.reflections</groupId> <groupId>org.reflections</groupId>
<artifactId>reflections</artifactId> <artifactId>reflections</artifactId>
@ -102,12 +112,6 @@
<groupId>org.gcube.common.security</groupId> <groupId>org.gcube.common.security</groupId>
<artifactId>gcube-secrets</artifactId> <artifactId>gcube-secrets</artifactId>
</dependency> </dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/io.micrometer/micrometer-core --> <!-- https://mvnrepository.com/artifact/io.micrometer/micrometer-core -->
<dependency> <dependency>
<groupId>io.micrometer</groupId> <groupId>io.micrometer</groupId>
@ -119,7 +123,8 @@
<artifactId>micrometer-registry-prometheus</artifactId> <artifactId>micrometer-registry-prometheus</artifactId>
<version>1.9.0</version> <version>1.9.0</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.apache.tomcat/tomcat-catalina --> <!--
https://mvnrepository.com/artifact/org.apache.tomcat/tomcat-catalina -->
<dependency> <dependency>
<groupId>org.apache.tomcat</groupId> <groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina</artifactId> <artifactId>tomcat-catalina</artifactId>
@ -143,6 +148,10 @@
<version>1.9.0</version> <version>1.9.0</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.gcube.resources</groupId>
<artifactId>common-gcore-resources</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
@ -185,7 +194,8 @@
<configuration> <configuration>
<primaryArtifact>false</primaryArtifact> <primaryArtifact>false</primaryArtifact>
<classifier>probe</classifier> <classifier>probe</classifier>
<packagingIncludes>WEB-INF/classes/org/gcube/smartgears/probe/**/*</packagingIncludes> <packagingIncludes>
WEB-INF/classes/org/gcube/smartgears/probe/**/*</packagingIncludes>
<failOnMissingWebXml>false</failOnMissingWebXml> <failOnMissingWebXml>false</failOnMissingWebXml>
</configuration> </configuration>
<executions> <executions>

View File

@ -4,9 +4,9 @@ import static java.util.Collections.emptyList;
import java.util.Set; import java.util.Set;
import javax.servlet.ServletContainerInitializer; import jakarta.servlet.ServletContainerInitializer;
import javax.servlet.ServletContext; import jakarta.servlet.ServletContext;
import javax.servlet.ServletException; import jakarta.servlet.ServletException;
import org.gcube.smartgears.context.application.ApplicationContext; import org.gcube.smartgears.context.application.ApplicationContext;
import org.gcube.smartgears.context.container.ContainerContext; import org.gcube.smartgears.context.container.ContainerContext;

View File

@ -1,6 +1,6 @@
package org.gcube.smartgears.context.application; package org.gcube.smartgears.context.application;
import javax.servlet.ServletContext; import jakarta.servlet.ServletContext;
import org.gcube.common.events.Hub; import org.gcube.common.events.Hub;
import org.gcube.smartgears.configuration.application.ApplicationConfiguration; import org.gcube.smartgears.configuration.application.ApplicationConfiguration;

View File

@ -7,7 +7,7 @@ import java.io.FileInputStream;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import java.util.UUID; import java.util.UUID;
import javax.servlet.ServletContext; import jakarta.servlet.ServletContext;
import org.gcube.common.events.Hub; import org.gcube.common.events.Hub;
import org.gcube.smartgears.configuration.PersistenceConfiguration; import org.gcube.smartgears.configuration.PersistenceConfiguration;

View File

@ -4,9 +4,9 @@ import java.io.IOException;
import java.util.Collections; import java.util.Collections;
import java.util.Set; import java.util.Set;
import javax.servlet.ServletException; import jakarta.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.gcube.smartgears.Constants; import org.gcube.smartgears.Constants;
import org.gcube.smartgears.configuration.application.GCubeExclude; import org.gcube.smartgears.configuration.application.GCubeExclude;

View File

@ -2,7 +2,7 @@ package org.gcube.smartgears.extensions;
import java.util.Set; import java.util.Set;
import javax.servlet.Servlet; import jakarta.servlet.Servlet;
import org.gcube.smartgears.configuration.application.GCubeExclude; import org.gcube.smartgears.configuration.application.GCubeExclude;
import org.gcube.smartgears.context.application.ApplicationContext; import org.gcube.smartgears.context.application.ApplicationContext;

View File

@ -16,11 +16,11 @@ import java.util.LinkedHashSet;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import javax.servlet.ServletException; import jakarta.servlet.ServletException;
import javax.servlet.ServletRequest; import jakarta.servlet.ServletRequest;
import javax.servlet.ServletResponse; import jakarta.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.gcube.smartgears.configuration.application.GCubeExclude; import org.gcube.smartgears.configuration.application.GCubeExclude;
import org.gcube.smartgears.context.application.ApplicationContext; import org.gcube.smartgears.context.application.ApplicationContext;

View File

@ -5,7 +5,7 @@ import static org.gcube.common.events.impl.Utils.valid;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import javax.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServlet;
import org.gcube.common.validator.annotations.NotEmpty; import org.gcube.common.validator.annotations.NotEmpty;
import org.gcube.smartgears.configuration.application.GCubeExclude; import org.gcube.smartgears.configuration.application.GCubeExclude;
@ -66,7 +66,7 @@ public abstract class HttpExtension extends HttpServlet implements ApplicationEx
} }
//extensions use init(context) instead //extensions use init(context) instead
public final void init() throws javax.servlet.ServletException { public final void init() throws jakarta.servlet.ServletException {
}; };
@Override @Override

View File

@ -2,14 +2,14 @@ package org.gcube.smartgears.extensions;
import java.io.IOException; import java.io.IOException;
import javax.servlet.Filter; import jakarta.servlet.Filter;
import javax.servlet.FilterChain; import jakarta.servlet.FilterChain;
import javax.servlet.FilterConfig; import jakarta.servlet.FilterConfig;
import javax.servlet.ServletException; import jakarta.servlet.ServletException;
import javax.servlet.ServletRequest; import jakarta.servlet.ServletRequest;
import javax.servlet.ServletResponse; import jakarta.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.gcube.smartgears.handlers.application.request.RequestException; import org.gcube.smartgears.handlers.application.request.RequestException;
import org.gcube.smartgears.utils.Utils; import org.gcube.smartgears.utils.Utils;

View File

@ -5,9 +5,9 @@ import static org.gcube.smartgears.extensions.HttpExtension.Method.GET;
import java.io.IOException; import java.io.IOException;
import javax.servlet.ServletException; import jakarta.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper; import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
import org.gcube.smartgears.configuration.application.ApplicationConfiguration; import org.gcube.smartgears.configuration.application.ApplicationConfiguration;

View File

@ -15,9 +15,9 @@ import java.util.Map;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import javax.servlet.ServletException; import jakarta.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.gcube.smartgears.extensions.ApiResource; import org.gcube.smartgears.extensions.ApiResource;
import org.gcube.smartgears.extensions.ApiSignature; import org.gcube.smartgears.extensions.ApiSignature;

View File

@ -9,9 +9,9 @@ import java.util.Set;
import java.util.Timer; import java.util.Timer;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.servlet.ServletException; import jakarta.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper; import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
import org.gcube.common.health.api.HealthCheck; import org.gcube.common.health.api.HealthCheck;

View File

@ -8,9 +8,9 @@ import static org.gcube.smartgears.handlers.application.request.RequestError.inv
import java.io.IOException; import java.io.IOException;
import javax.servlet.ServletException; import jakarta.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.gcube.common.resources.gcore.Resources; import org.gcube.common.resources.gcore.Resources;
import org.gcube.smartgears.extensions.ApiResource; import org.gcube.smartgears.extensions.ApiResource;

View File

@ -5,9 +5,9 @@ import static org.gcube.smartgears.extensions.HttpExtension.Method.GET;
import java.io.IOException; import java.io.IOException;
import javax.servlet.ServletException; import jakarta.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.gcube.smartgears.extensions.ApiResource; import org.gcube.smartgears.extensions.ApiResource;
import org.gcube.smartgears.extensions.ApiSignature; import org.gcube.smartgears.extensions.ApiSignature;

View File

@ -5,9 +5,9 @@ import static org.gcube.smartgears.extensions.HttpExtension.Method.GET;
import java.io.IOException; import java.io.IOException;
import javax.servlet.ServletException; import jakarta.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.gcube.smartgears.extensions.ApiResource; import org.gcube.smartgears.extensions.ApiResource;
import org.gcube.smartgears.extensions.ApiSignature; import org.gcube.smartgears.extensions.ApiSignature;

View File

@ -1,7 +1,7 @@
package org.gcube.smartgears.handlers.application; package org.gcube.smartgears.handlers.application;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.gcube.smartgears.context.application.ApplicationContext; import org.gcube.smartgears.context.application.ApplicationContext;

View File

@ -1,7 +1,7 @@
package org.gcube.smartgears.handlers.application; package org.gcube.smartgears.handlers.application;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.gcube.smartgears.context.application.ApplicationContext; import org.gcube.smartgears.context.application.ApplicationContext;

View File

@ -1,6 +1,6 @@
package org.gcube.smartgears.handlers.application.request; package org.gcube.smartgears.handlers.application.request;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
/** /**

View File

@ -4,9 +4,7 @@ import static java.util.concurrent.TimeUnit.SECONDS;
import static org.gcube.common.events.Observes.Kind.critical; import static org.gcube.common.events.Observes.Kind.critical;
import static org.gcube.common.events.Observes.Kind.resilient; import static org.gcube.common.events.Observes.Kind.resilient;
import static org.gcube.smartgears.Constants.profile_management; import static org.gcube.smartgears.Constants.profile_management;
import static org.gcube.smartgears.handlers.ProfileEvents.addToContext;
import static org.gcube.smartgears.handlers.ProfileEvents.changed; import static org.gcube.smartgears.handlers.ProfileEvents.changed;
import static org.gcube.smartgears.handlers.ProfileEvents.removeFromContext;
import static org.gcube.smartgears.lifecycle.container.ContainerLifecycle.activation; import static org.gcube.smartgears.lifecycle.container.ContainerLifecycle.activation;
import static org.gcube.smartgears.lifecycle.container.ContainerLifecycle.failure; import static org.gcube.smartgears.lifecycle.container.ContainerLifecycle.failure;
import static org.gcube.smartgears.lifecycle.container.ContainerLifecycle.part_activation; import static org.gcube.smartgears.lifecycle.container.ContainerLifecycle.part_activation;
@ -26,6 +24,7 @@ import org.gcube.smartgears.handlers.container.ContainerHandler;
import org.gcube.smartgears.handlers.container.ContainerLifecycleEvent; import org.gcube.smartgears.handlers.container.ContainerLifecycleEvent;
import org.gcube.smartgears.lifecycle.container.ContainerLifecycle; import org.gcube.smartgears.lifecycle.container.ContainerLifecycle;
import org.gcube.smartgears.lifecycle.container.ContainerState; import org.gcube.smartgears.lifecycle.container.ContainerState;
import org.gcube.smartgears.managers.ContextEvents;
import org.gcube.smartgears.provider.ProviderFactory; import org.gcube.smartgears.provider.ProviderFactory;
import org.gcube.smartgears.publishing.Publisher; import org.gcube.smartgears.publishing.Publisher;
import org.gcube.smartgears.utils.Utils; import org.gcube.smartgears.utils.Utils;
@ -129,7 +128,7 @@ public class ContainerProfileManager extends ContainerHandler {
} }
@Observes(value = addToContext) @Observes(value = ContextEvents.ADD_CONTEXT_TO_CONTAINER)
void addTo(String scope) { void addTo(String scope) {
log.info("add_to_context event arrived in container"); log.info("add_to_context event arrived in container");
for (Publisher publisher : publishers) for (Publisher publisher : publishers)
@ -151,7 +150,7 @@ public class ContainerProfileManager extends ContainerHandler {
} }
@Observes(value = removeFromContext) @Observes(value = ContextEvents.REMOVE_CONTEXT_FROM_CONTAINER)
void removeFrom(String scope) { void removeFrom(String scope) {
log.info("remove_from_context event arrived in container"); log.info("remove_from_context event arrived in container");
for (Publisher publisher : publishers) for (Publisher publisher : publishers)

View File

@ -31,7 +31,7 @@ public class HealthTask extends TimerTask{
Status totalStatus = responses.stream().anyMatch(r -> r.getStatus().equals(Status.DOWN)) ? Status.DOWN : Status.UP; Status totalStatus = responses.stream().anyMatch(r -> r.getStatus().equals(Status.DOWN)) ? Status.DOWN : Status.UP;
this.response = new HealthResponse(totalStatus, responses); this.response = new HealthResponse(totalStatus, responses);
log.debug("health task executed with total status {}",totalStatus); log.trace("health task executed with total status {}",totalStatus);
} }
public HealthResponse getResponse() { public HealthResponse getResponse() {

View File

@ -15,11 +15,11 @@ import java.io.ObjectOutputStream;
import java.util.List; import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import javax.servlet.FilterRegistration; import jakarta.servlet.FilterRegistration;
import javax.servlet.ServletContext; import jakarta.servlet.ServletContext;
import javax.servlet.ServletContextEvent; import jakarta.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener; import jakarta.servlet.ServletContextListener;
import javax.servlet.ServletRegistration; import jakarta.servlet.ServletRegistration;
import org.gcube.common.events.Observes; import org.gcube.common.events.Observes;
import org.gcube.smartgears.configuration.application.ApplicationHandlers; import org.gcube.smartgears.configuration.application.ApplicationHandlers;

View File

@ -122,18 +122,6 @@ public class ContainerManager {
context.lifecycle().tryMoveTo(ContainerState.partActive); context.lifecycle().tryMoveTo(ContainerState.partActive);
} }
@Observes(value = ContextEvents.ADD_CONTEXT_TO_CONTAINER, kind = Kind.critical)
void addContext(String scope) {
log.info("adding context {} event send", context);
context.events().fire(scope, ProfileEvents.addToContext);
}
@Observes(value = ContextEvents.REMOVE_CONTEXT_FROM_CONTAINER, kind = Kind.critical)
void removeContext(String scope) {
log.info("removing context {} event send", context);
context.events().fire(scope, ProfileEvents.removeFromContext);
}
/** /**
* Stops container management on remote request. * Stops container management on remote request.
* *

View File

@ -10,14 +10,14 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.servlet.Filter; import jakarta.servlet.Filter;
import javax.servlet.FilterChain; import jakarta.servlet.FilterChain;
import javax.servlet.FilterConfig; import jakarta.servlet.FilterConfig;
import javax.servlet.ServletException; import jakarta.servlet.ServletException;
import javax.servlet.ServletRequest; import jakarta.servlet.ServletRequest;
import javax.servlet.ServletResponse; import jakarta.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.gcube.common.authorization.library.exception.AuthorizationException; import org.gcube.common.authorization.library.exception.AuthorizationException;
import org.gcube.smartgears.Constants; import org.gcube.smartgears.Constants;

View File

@ -1,7 +1,7 @@
package org.gcube.smartgears.probe; package org.gcube.smartgears.probe;
import javax.servlet.ServletContextListener; import jakarta.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener; import jakarta.servlet.annotation.WebListener;
import org.gcube.smartgears.managers.ContainerManager; import org.gcube.smartgears.managers.ContainerManager;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -12,12 +12,12 @@ public class ContainerListener implements ServletContextListener {
public static Logger log = LoggerFactory.getLogger(ContainerListener.class); public static Logger log = LoggerFactory.getLogger(ContainerListener.class);
public void contextDestroyed(javax.servlet.ServletContextEvent sce) { public void contextDestroyed(jakarta.servlet.ServletContextEvent sce) {
log.trace("shutting down container from probe"); log.trace("shutting down container from probe");
ContainerManager.instance.stop(true); ContainerManager.instance.stop(true);
}; };
public void contextInitialized(javax.servlet.ServletContextEvent sce) { public void contextInitialized(jakarta.servlet.ServletContextEvent sce) {
log.trace("starting up probe..."); log.trace("starting up probe...");
}; };
} }

View File

@ -13,7 +13,7 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.servlet.ServletContext; import jakarta.servlet.ServletContext;
import org.gcube.common.events.Hub; import org.gcube.common.events.Hub;
import org.gcube.common.events.impl.DefaultHub; import org.gcube.common.events.impl.DefaultHub;

View File

@ -2,7 +2,7 @@ package org.gcube.smartgears.provider;
import java.util.List; import java.util.List;
import javax.servlet.ServletContext; import jakarta.servlet.ServletContext;
import org.gcube.smartgears.configuration.SmartgearsConfiguration; import org.gcube.smartgears.configuration.SmartgearsConfiguration;
import org.gcube.smartgears.configuration.application.ApplicationHandlers; import org.gcube.smartgears.configuration.application.ApplicationHandlers;

View File

@ -16,8 +16,8 @@ import java.util.Collection;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.gcube.common.authorization.library.provider.ServiceIdentifier; import org.gcube.common.authorization.library.provider.ServiceIdentifier;
import org.gcube.common.authorization.library.provider.ServiceInfo; import org.gcube.common.authorization.library.provider.ServiceInfo;

View File

@ -3,7 +3,7 @@ package utils;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
import javax.servlet.ServletContext; import jakarta.servlet.ServletContext;
import org.gcube.smartgears.configuration.application.ApplicationConfiguration; import org.gcube.smartgears.configuration.application.ApplicationConfiguration;
import org.gcube.smartgears.configuration.application.ApplicationHandlers; import org.gcube.smartgears.configuration.application.ApplicationHandlers;