Skip to content

Commit

Permalink
Merge pull request #142 from ligangty/main
Browse files Browse the repository at this point in the history
Merge from quarkus-3
  • Loading branch information
ligangty authored Mar 19, 2024
2 parents 11536e1 + a0017d3 commit f63bcf4
Show file tree
Hide file tree
Showing 108 changed files with 548 additions and 1,786 deletions.
31 changes: 11 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
<parent>
<groupId>org.commonjava</groupId>
<artifactId>service-parent</artifactId>
<version>4</version>
<version>5-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.commonjava.indy.service</groupId>
<artifactId>indy-repository-service</artifactId>
<version>1.0.5-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>
<name>Indy :: Service :: Repository</name>
<url>https://github.com/Commonjava/indy-repository-service</url>
<description>Indy Repository Service</description>
Expand All @@ -43,8 +43,8 @@
<projectEmail>https://github.com/Commonjava/indy-repository-service</projectEmail>

<atlas.version>1.1.1</atlas.version>
<indymodel.version>1.5</indymodel.version>
<indysecurity.verison>1.1</indysecurity.verison>
<indymodel.version>2.0-SNAPSHOT</indymodel.version>
<indysecurity.verison>1.2-SNAPSHOT</indysecurity.verison>

<cassandra.version>3.11.3</cassandra.version>
<infinispan.version>14.0.6.Final</infinispan.version>
Expand Down Expand Up @@ -202,14 +202,6 @@
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-extension-jaeger-remote-sampler</artifactId>
</dependency>
<!-- for honeycomb otel usage, see: https://docs.honeycomb.io/getting-data-in/opentelemetry/java-distro/ -->
<!--
<dependency>
<groupId>io.honeycomb</groupId>
<artifactId>honeycomb-opentelemetry-sdk</artifactId>
<version>${honeycomb.otel.version}</version>
</dependency>
-->
<!-- quarkus otel deps end -->
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
Expand All @@ -218,7 +210,11 @@
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-core</artifactId>
<artifactId>infinispan-component-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-core-jakarta</artifactId>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
Expand All @@ -234,11 +230,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.ws.rs</groupId>
<artifactId>jboss-jaxrs-api_2.1_spec</artifactId>
<version>2.0.2.Final</version>
</dependency>
<dependency>
<groupId>org.commonjava.atlas</groupId>
<artifactId>atlas-relationships-api</artifactId>
Expand Down Expand Up @@ -355,8 +346,8 @@
</dependency>
<dependency>
<groupId>org.commonjava.util</groupId>
<artifactId>http-testserver-core</artifactId>
<version>2.0</version>
<artifactId>http-testserver-quarkus</artifactId>
<version>2.3.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,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.util.Set;

import static org.commonjava.indy.service.repository.change.event.kafka.KafkaEventUtils.CHANNEL_INTERNAL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,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.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Default;
import javax.inject.Inject;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.inject.Default;
import jakarta.inject.Inject;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import org.commonjava.indy.service.repository.model.ArtifactStore;
import org.commonjava.indy.service.repository.model.StoreKey;

import javax.enterprise.inject.Alternative;
import javax.inject.Named;
import jakarta.enterprise.inject.Alternative;
import jakarta.inject.Named;
import java.util.Map;

@Alternative
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.commonjava.indy.service.repository.model.ArtifactStore;
import org.commonjava.indy.service.repository.model.StoreKey;

import javax.enterprise.event.Event;
import jakarta.enterprise.event.Event;
import java.util.Map;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,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;

/**
* This event dispatcher will dispatch Store Event through kafka
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;

import javax.ws.rs.DELETE;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;
import jakarta.ws.rs.DELETE;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.core.Response;

@Path("/api/storage")
@RegisterRestClient(configKey="storage-service-api")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

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 @@ -20,7 +20,7 @@
import io.smallrye.config.WithDefault;
import io.smallrye.config.WithName;

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,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.util.ArrayList;
import java.util.List;

import static javax.ws.rs.core.Response.Status.FORBIDDEN;
import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR;
import static jakarta.ws.rs.core.Response.Status.FORBIDDEN;
import static jakarta.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR;

@ApplicationScoped
public class AdminController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,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.FileOutputStream;
import java.io.IOException;
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.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
Expand All @@ -45,9 +45,9 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static javax.ws.rs.core.Response.Status.BAD_REQUEST;
import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR;
import static javax.ws.rs.core.Response.Status.NOT_FOUND;
import static jakarta.ws.rs.core.Response.Status.BAD_REQUEST;
import static jakarta.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR;
import static jakarta.ws.rs.core.Response.Status.NOT_FOUND;
import static org.commonjava.indy.service.repository.model.StoreKey.fromString;
import static org.commonjava.indy.service.repository.model.pkg.MavenPackageTypeDescriptor.MAVEN_PKG_KEY;
import static org.commonjava.indy.service.repository.model.pkg.PackageTypeConstants.isValidPackageType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,25 @@
package org.commonjava.indy.service.repository.controller;

import org.commonjava.indy.service.repository.data.StoreDataManager;
import org.commonjava.indy.service.repository.exception.IndyDataException;
import org.commonjava.indy.service.repository.exception.IndyWorkflowException;
import org.commonjava.indy.service.repository.model.ArtifactStore;
import org.commonjava.indy.service.repository.model.StoreKey;
import org.commonjava.indy.service.repository.model.dto.EndpointView;
import org.commonjava.indy.service.repository.model.dto.EndpointViewListing;
import org.commonjava.indy.service.repository.model.version.Versioning;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import org.commonjava.indy.service.repository.util.JaxRsUriFormatter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import static jakarta.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR;

@ApplicationScoped
public class StatsController
Expand All @@ -42,4 +57,56 @@ public Versioning getVersionInfo()
return versioning;
}

public EndpointViewListing getEndpointsListing( final String baseUri, final JaxRsUriFormatter uriFormatter )
throws IndyWorkflowException
{
final List<ArtifactStore> stores;
try
{
stores = new ArrayList<>( dataManager.getAllArtifactStores() );
}
catch ( final IndyDataException e )
{
throw new IndyWorkflowException( INTERNAL_SERVER_ERROR.getStatusCode(),
"Failed to retrieve all endpoints: {}", e, e.getMessage() );
}

final List<EndpointView> points = new ArrayList<>();
for ( final ArtifactStore store : stores )
{
final StoreKey key = store.getKey();
final String resourceUri = uriFormatter.formatAbsolutePathTo( baseUri, "content", key.getPackageType(),
key.getType().singularEndpointName(),
key.getName() );

final EndpointView point = new EndpointView( store, resourceUri );
if ( !points.contains( point ) )
{
points.add( point );
}
}

return new EndpointViewListing( points );
}

public Map<String, List<String>> getAllStoreKeys()
throws IndyWorkflowException
{
final List<ArtifactStore> stores;
try
{
final Map<String, List<String>> result = new HashMap<>();
stores = new ArrayList<>( dataManager.getAllArtifactStores() );
List<String> items = stores.stream().map( s-> s.getKey().toString() ).collect( Collectors.toList() );
result.put("items", items);
return result;
}
catch ( final IndyDataException e )
{
throw new IndyWorkflowException( INTERNAL_SERVER_ERROR.getStatusCode(),
"Failed to retrieve all store keys: {}", e, e.getMessage() );
}

}

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

import javax.inject.Inject;
import jakarta.inject.Inject;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
Expand All @@ -50,7 +50,7 @@

import static java.util.Collections.emptySet;
import static java.util.Collections.singletonMap;
import static javax.ws.rs.core.Response.Status.METHOD_NOT_ALLOWED;
import static jakarta.ws.rs.core.Response.Status.METHOD_NOT_ALLOWED;
import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import static org.commonjava.indy.service.repository.data.StoreUpdateAction.DELETE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.annotation.Nonnull;
import jakarta.annotation.Nonnull;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Arrays;
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.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Default;
import javax.inject.Inject;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.inject.Default;
import jakarta.inject.Inject;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
Expand Down
Loading

0 comments on commit f63bcf4

Please sign in to comment.