Skip to content

Commit

Permalink
Update to Quarkus 3
Browse files Browse the repository at this point in the history
  • Loading branch information
ruhan1 committed Mar 4, 2024
1 parent 4fb37f1 commit 1eb1b5f
Show file tree
Hide file tree
Showing 27 changed files with 98 additions and 118 deletions.
14 changes: 11 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.commonjava</groupId>
<artifactId>service-parent</artifactId>
<version>2</version>
<version>5-SNAPSHOT</version>
</parent>
<groupId>org.commonjava.util</groupId>
<artifactId>gateway</artifactId>
Expand Down Expand Up @@ -98,7 +98,7 @@
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-opentelemetry-exporter-otlp</artifactId>
<artifactId>quarkus-opentelemetry</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
Expand All @@ -120,6 +120,14 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
</dependencies>
<build>
<resources>
Expand All @@ -130,7 +138,7 @@
</resources>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<groupId>io.quarkus.platform</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<executions>
<execution>
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/org/commonjava/util/gateway/AdminResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
import io.vertx.core.json.JsonObject;
import org.commonjava.util.gateway.services.AdminService;

import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;

import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static javax.ws.rs.core.MediaType.TEXT_PLAIN;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.Context;

import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON;
import static jakarta.ws.rs.core.MediaType.TEXT_PLAIN;

@Path( "/proxy" )
public class AdminResource
Expand Down
16 changes: 5 additions & 11 deletions src/main/java/org/commonjava/util/gateway/ProxyResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,14 @@

import io.smallrye.mutiny.Uni;
import io.vertx.core.http.HttpServerRequest;
import jakarta.ws.rs.*;
import org.commonjava.util.gateway.services.ProxyService;
import org.jboss.resteasy.annotations.jaxrs.PathParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.inject.Inject;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.HEAD;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import jakarta.inject.Inject;
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.Response;
import java.io.InputStream;

import static org.commonjava.util.gateway.util.ServiceUtils.pathWithParams;
Expand All @@ -44,7 +38,7 @@ public class ProxyResource
ProxyService proxyService;

@HEAD
public Uni<Response> head( @PathParam( "path" ) String path, final @Context HttpServerRequest request )
public Uni<Response> head(@PathParam( "path" ) String path, final @Context HttpServerRequest request )
throws Exception
{
logger.debug( "Head resource: {}", path );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.core.MultivaluedMap;
import jakarta.ws.rs.core.Response;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
Expand All @@ -43,7 +43,7 @@

import static java.lang.System.currentTimeMillis;
import static java.nio.charset.Charset.defaultCharset;
import static javax.ws.rs.core.Response.Status.OK;
import static jakarta.ws.rs.core.Response.Status.OK;
import static org.apache.commons.lang3.StringUtils.isNotBlank;

@ApplicationScoped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.enterprise.inject.Alternative;
import jakarta.enterprise.inject.Alternative;
import java.io.File;
import java.util.regex.Pattern;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.enterprise.inject.Alternative;
import jakarta.enterprise.inject.Alternative;
import java.io.File;

import static org.apache.commons.lang3.StringUtils.isNotBlank;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
import org.slf4j.LoggerFactory;
import org.yaml.snakeyaml.Yaml;

import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import jakarta.annotation.PostConstruct;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.ext.Provider;

/**
* This default mapper allows any exception to be captured ensuring a ResponseContextFilter is always called.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ExceptionMapper;

/**
* This WebApplicationException handler will check for a HTTP response status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package org.commonjava.util.gateway.interceptor;

import javax.interceptor.InterceptorBinding;
import jakarta.interceptor.InterceptorBinding;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.interceptor.AroundInvoke;
import javax.interceptor.Interceptor;
import javax.interceptor.InvocationContext;
import javax.ws.rs.core.Response;
import jakarta.interceptor.AroundInvoke;
import jakarta.interceptor.Interceptor;
import jakarta.interceptor.InvocationContext;
import jakarta.ws.rs.core.Response;

@Interceptor
@ExceptionHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import org.eclipse.microprofile.health.HealthCheckResponse;
import org.eclipse.microprofile.health.Liveness;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import java.util.Optional;

import static org.eclipse.microprofile.health.HealthCheckResponse.Status.UP;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package org.commonjava.util.gateway.metrics.health;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Singleton;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Singleton;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import org.eclipse.microprofile.health.HealthCheckResponse;
import org.eclipse.microprofile.health.Liveness;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import java.util.Optional;

import static org.eclipse.microprofile.health.HealthCheckResponse.Status.UP;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerRequestFilter;
import javax.ws.rs.container.ContainerResponseContext;
import javax.ws.rs.container.ContainerResponseFilter;
import javax.ws.rs.ext.Provider;
import jakarta.ws.rs.container.ContainerRequestContext;
import jakarta.ws.rs.container.ContainerRequestFilter;
import jakarta.ws.rs.container.ContainerResponseContext;
import jakarta.ws.rs.container.ContainerResponseFilter;
import jakarta.ws.rs.ext.Provider;
import java.io.IOException;

/**
Expand Down Expand Up @@ -104,5 +104,6 @@ private String getMethodName( ContainerRequestContext context )
}

private static final String METHOD_NAME = ResourceMethodInvoker.class.getName();

private static final Logger logger = LoggerFactory.getLogger( FlightRecorderFilter.class.getName() );
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import jdk.jfr.FlightRecorder;
import org.commonjava.util.gateway.metrics.jfr.events.JaxRSEvent;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Observes;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.event.Observes;

@ApplicationScoped
public class FlightRecorderMetrics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import io.quarkus.scheduler.Scheduled;
import org.commonjava.util.gateway.config.ProxyConfiguration;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import java.util.concurrent.TimeUnit;

@ApplicationScoped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import jakarta.annotation.PostConstruct;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import java.io.IOException;
import java.io.InputStream;
import java.lang.management.ManagementFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import jakarta.annotation.PostConstruct;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.ws.rs.core.Response;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.core.Response;
import java.io.InputStream;

import static io.vertx.core.http.HttpMethod.HEAD;
import static io.vertx.core.http.impl.HttpUtils.normalizePath;
import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR;
import static jakarta.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR;
import static org.commonjava.util.gateway.services.ProxyConstants.FORBIDDEN_HEADERS;

@ApplicationScoped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import okhttp3.Request;
import org.eclipse.microprofile.config.inject.ConfigProperty;

import javax.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.ApplicationScoped;

@ApplicationScoped
public class OtelAdapter
Expand All @@ -33,7 +33,7 @@ public class OtelAdapter
rb.header( key, value );
};

@ConfigProperty( name = "quarkus.opentelemetry.enabled" )
@ConfigProperty( name = "quarkus.otel.enabled" )
Boolean enabled;

public Span newClientSpan( String adapterName, String name )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.ws.rs.core.StreamingOutput;
import jakarta.ws.rs.core.StreamingOutput;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import java.time.Duration;
import java.util.concurrent.atomic.AtomicLong;

import static javax.ws.rs.core.HttpHeaders.HOST;
import static jakarta.ws.rs.core.HttpHeaders.HOST;

public class WebClientAdapter
{
Expand Down
14 changes: 8 additions & 6 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ quarkus:
limits:
max-body-size: 500M

opentelemetry:
otel:
enabled: true
tracer:
traces:
enabled: true
# reflect sampling on collector
resource-attributes: sampler_ratio=0.05
#resource-attributes: sampler_ratio=0.05
sampler:
ratio: 0.05
exporter:
otlp:
~: traceidratio
arg: 0.05
exporter:
otlp:
traces:
# This is for sending to something like opentelemetry-collector
# endpoint: http://localhost:4317

Expand Down
Loading

0 comments on commit 1eb1b5f

Please sign in to comment.