Skip to content

Commit

Permalink
Upgrade service parent to version 5-SNAPSHOT
Browse files Browse the repository at this point in the history
  • Loading branch information
sswguo committed Jan 29, 2024
1 parent b9e8bdd commit 6393b03
Show file tree
Hide file tree
Showing 27 changed files with 83 additions and 88 deletions.
11 changes: 5 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>org.commonjava</groupId>
<artifactId>service-parent</artifactId>
<version>2</version>
<version>5-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.commonjava.indy.service</groupId>
Expand All @@ -41,11 +41,10 @@
<httpcoreVersion>4.4.9</httpcoreVersion>
<httpclientVersion>4.5.13</httpclientVersion>
<indyModelVersion>1.5-SNAPSHOT</indyModelVersion>
<quarkus-plugin.version>2.3.0.Final</quarkus-plugin.version>
<weftVersion>1.22</weftVersion>
<keycloakVersion>22.0.3</keycloakVersion>
<quarkus.package.type>uber-jar</quarkus.package.type>
<infinispanVersion>12.1.11.Final</infinispanVersion>
<infinispanVersion>14.0.21.Final</infinispanVersion>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -172,12 +171,12 @@

<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-core</artifactId>
<artifactId>infinispan-core-jakarta</artifactId>
<version>${infinispanVersion}</version>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-commons</artifactId>
<artifactId>infinispan-commons-jakarta</artifactId>
<version>${infinispanVersion}</version>
</dependency>
<dependency>
Expand All @@ -196,7 +195,7 @@
</resources>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<groupId>io.quarkus.platform</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
import org.xnio.*;
import org.xnio.channels.AcceptingChannel;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Observes;
import javax.inject.Inject;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.event.Observes;
import jakarta.inject.Inject;
import java.io.IOException;
import java.net.InetSocketAddress;

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

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

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

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.indy.service.httprox.util.ProxyUtils.normalizePathAnd;

@ApplicationScoped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import org.eclipse.microprofile.rest.client.annotation.RegisterProvider;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;

import javax.ws.rs.*;
import javax.ws.rs.core.Response;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.Response;

@Path("/api/admin/stores")
@RegisterRestClient(configKey="repo-service-api")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import io.quarkus.runtime.Startup;
import org.eclipse.microprofile.config.inject.ConfigProperty;

import javax.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.ApplicationScoped;
import java.util.Properties;

@Startup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.commonjava.indy.service.httprox.model.TrackingType;
import org.eclipse.microprofile.config.inject.ConfigProperty;

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

@Startup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

import org.commonjava.cdi.util.weft.config.DefaultWeftConfig;

import javax.enterprise.inject.Default;
import javax.enterprise.inject.Produces;
import jakarta.enterprise.inject.Default;
import jakarta.enterprise.inject.Produces;

public class ProxyWeftConfig
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import org.slf4j.LoggerFactory;
import org.yaml.snakeyaml.Yaml;

import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import jakarta.annotation.PostConstruct;
import jakarta.enterprise.context.ApplicationScoped;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.commonjava.indy.service.httprox.util.CacheProducer;
import org.commonjava.indy.service.httprox.util.OtelAdapter;
import org.commonjava.indy.service.httprox.util.RepoCreator;
import org.eclipse.microprofile.context.ManagedExecutor;
import org.eclipse.microprofile.rest.client.inject.RestClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -33,9 +34,9 @@
import org.xnio.conduits.ConduitStreamSinkChannel;
import org.xnio.conduits.ConduitStreamSourceChannel;

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 static org.commonjava.indy.pkg.PackageTypeConstants.PKG_TYPE_GENERIC_HTTP;
Expand All @@ -60,7 +61,7 @@ public class ProxyAcceptHandler implements ChannelListener<AcceptingChannel<Stre
KeycloakProxyAuthenticator proxyAuthenticator;

@Inject
ProxyTransfersExecutor proxyExecutor;
ManagedExecutor proxyExecutor;

@Inject
OtelAdapter otel;
Expand Down Expand Up @@ -116,7 +117,7 @@ public void handleEvent(AcceptingChannel<StreamConnection> channel) {
ProxyRepositoryCreator repoCreator = new RepoCreator( config );

final ProxyResponseWriter writer =
new ProxyResponseWriter( config, repoCreator, accepted, repositoryService, contentRetrievalService, proxyExecutor.getExecutor(), proxyAuthenticator, objectMapper, cacheProducer, start, otel );
new ProxyResponseWriter( config, repoCreator, accepted, repositoryService, contentRetrievalService, proxyExecutor, proxyAuthenticator, objectMapper, cacheProducer, start, otel );

logger.debug("Setting writer: {}", writer);
sink.getWriteSetter().set(writer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;

import static javax.ws.rs.HttpMethod.GET;
import static javax.ws.rs.HttpMethod.HEAD;
import static jakarta.ws.rs.HttpMethod.GET;
import static jakarta.ws.rs.HttpMethod.HEAD;
import static org.commonjava.indy.service.httprox.util.CertUtils.*;
import static org.commonjava.indy.service.httprox.util.HttpProxyConstants.GET_METHOD;
import static org.commonjava.indy.service.httprox.util.PortFinder.findOpenPort;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.commonjava.indy.service.httprox.model.TrackingKey;
import org.commonjava.indy.service.httprox.model.TrackingType;
import org.commonjava.indy.service.httprox.util.*;
import org.eclipse.microprofile.context.ManagedExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xnio.ChannelListener;
Expand Down Expand Up @@ -68,7 +69,7 @@ public final class ProxyResponseWriter
private boolean directed = false;

private ProxyRequestReader proxyRequestReader;
private final WeftExecutorService tunnelAndMITMExecutor;
private final ManagedExecutor tunnelAndMITMExecutor;

private KeycloakProxyAuthenticator proxyAuthenticator;

Expand All @@ -82,7 +83,7 @@ public final class ProxyResponseWriter

public ProxyResponseWriter(final ProxyConfiguration config, final ProxyRepositoryCreator repoCreator,
final StreamConnection accepted, final RepositoryService repositoryService,
final ContentRetrievalService contentRetrievalService, final WeftExecutorService executor,
final ContentRetrievalService contentRetrievalService, final ManagedExecutor executor,
final KeycloakProxyAuthenticator proxyAuthenticator, final IndyObjectMapper indyObjectMapper,
final CacheProducer cacheProducer, final long start, final OtelAdapter otel)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,29 @@
*/
package org.commonjava.indy.service.httprox.handler;

import jakarta.inject.Named;
import jakarta.ws.rs.Produces;
import org.commonjava.cdi.util.weft.ExecutorConfig;
import org.commonjava.cdi.util.weft.WeftExecutorService;
import org.commonjava.cdi.util.weft.WeftManaged;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import org.eclipse.microprofile.context.ManagedExecutor;

import static org.commonjava.cdi.util.weft.ExecutorConfig.BooleanLiteral.FALSE;

@ApplicationScoped
public class ProxyTransfersExecutor {

@Inject
@WeftManaged
@ExecutorConfig( named = "mitm-transfers", threads = 0, priority = 5, loadSensitive = FALSE )
WeftExecutorService executor;

protected ProxyTransfersExecutor()
{
}
public class ProxyTransfersExecutor {

public ProxyTransfersExecutor(WeftExecutorService exec)
@Named("mitm-transfers")
@ApplicationScoped
@Produces
public ManagedExecutor getExecutor()
{
this.executor = exec;
}

public WeftExecutorService getExecutor()
{
return executor;
return ManagedExecutor.builder().maxAsync(100)
.maxQueued(200)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.StreamingOutput;
import jakarta.ws.rs.WebApplicationException;
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 @@ -32,8 +32,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
*/
package org.commonjava.indy.service.httprox.stats;

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

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

@Path( "/api/stats" )
public class StatsHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

import javax.enterprise.inject.Alternative;
import javax.inject.Named;
import jakarta.enterprise.inject.Alternative;
import jakarta.inject.Named;

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

import javax.enterprise.inject.Default;
import javax.enterprise.inject.Produces;
import javax.inject.Singleton;
import jakarta.enterprise.inject.Default;
import jakarta.enterprise.inject.Produces;
import jakarta.inject.Singleton;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import org.infinispan.manager.DefaultCacheManager;
import org.infinispan.manager.EmbeddedCacheManager;

import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import jakarta.annotation.PostConstruct;
import jakarta.enterprise.context.ApplicationScoped;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

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

import io.quarkus.oidc.client.OidcClient;

import javax.annotation.Priority;
import javax.inject.Inject;
import javax.ws.rs.Priorities;
import javax.ws.rs.client.ClientRequestContext;
import javax.ws.rs.client.ClientRequestFilter;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.ext.Provider;
import jakarta.annotation.Priority;
import jakarta.inject.Inject;
import jakarta.ws.rs.Priorities;
import jakarta.ws.rs.client.ClientRequestContext;
import jakarta.ws.rs.client.ClientRequestFilter;
import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.ext.Provider;

@Provider
@Priority(Priorities.AUTHENTICATION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.Response;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import java.util.concurrent.TimeUnit;
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
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
import org.eclipse.microprofile.rest.client.inject.RestClient;
import org.junit.jupiter.api.Test;

import javax.inject.Inject;
import javax.ws.rs.WebApplicationException;
import jakarta.inject.Inject;
import jakarta.ws.rs.WebApplicationException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;

Expand Down
Loading

0 comments on commit 6393b03

Please sign in to comment.