Skip to content

Commit

Permalink
(Jakarta migration) Deprecate JAX-RS 2 modules #84
Browse files Browse the repository at this point in the history
  • Loading branch information
andrus committed Nov 25, 2023
1 parent a726501 commit 88aceb2
Show file tree
Hide file tree
Showing 61 changed files with 319 additions and 141 deletions.
4 changes: 4 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.0-M3

* #84 (Jakarta migration) Deprecate JAX-RS 2 modules

## 3.0.M2

* #65 Upgrade to Jersey 2.38 / 3.0.9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@

/**
* @since 2.0
* @deprecated The users are encouraged to switch to the Jakarta-based flavor
*/
@Deprecated(since = "3.0", forRemoval = true)
public class JerseyBeanValidationModule extends ConfigModule {

public static JerseyBeanValidationModuleExtender extend(Binder binder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@

/**
* @since 2.0
* @deprecated The users are encouraged to switch to the Jakarta-based flavor
*/
@Deprecated(since = "3.0", forRemoval = true)
public class JerseyBeanValidationModuleExtender extends ModuleExtender<JerseyBeanValidationModuleExtender> {

public JerseyBeanValidationModuleExtender(Binder binder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@

/**
* @since 2.0
* @deprecated The users are encouraged to switch to the Jakarta-based flavor
*/
@Deprecated(since = "3.0", forRemoval = true)
public class JerseyBeanValidationModuleProvider implements BQModuleProvider {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
import javax.ws.rs.core.Feature;
import javax.ws.rs.core.FeatureContext;

/**
* @deprecated The users are encouraged to switch to the Jakarta-based flavor
*/
@Deprecated(since = "3.0", forRemoval = true)
public class InstrumentedFeature implements Feature {

private final RequestTimer filter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@

/**
* @since 3.0
* @deprecated The users are encouraged to switch to the Jakarta-based flavor
*/
@Deprecated(since = "3.0", forRemoval = true)
@BQConfig
public class InstrumentedHttpClientFactoryFactory extends HttpClientFactoryFactory {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

import java.util.Map;

/**
* @deprecated The users are encouraged to switch to the Jakarta-based flavor
*/
@Deprecated(since = "3.0", forRemoval = true)
public class JerseyClientHealthChecks implements HealthCheckGroup {
private final Map<String, HealthCheck> healthChecks;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
import java.util.Map;
import java.util.function.Supplier;

/**
* @deprecated The users are encouraged to switch to the Jakarta-based flavor
*/
@Deprecated(since = "3.0", forRemoval = true)
@BQConfig
public class JerseyClientHealthChecksFactory {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@

import javax.inject.Singleton;

/**
* @deprecated The users are encouraged to switch to the Jakarta-based flavor
*/
@Deprecated(since = "3.0", forRemoval = true)
public class JerseyClientInstrumentedModule extends ConfigModule {

public static final MetricNaming METRIC_NAMING = MetricNaming.forModule(JerseyClientInstrumentedModule.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@

import static java.util.Arrays.asList;

/**
* @deprecated The users are encouraged to switch to the Jakarta-based flavor
*/
@Deprecated(since = "3.0", forRemoval = true)
public class JerseyClientInstrumentedModuleProvider implements BQModuleProvider {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
import java.util.List;
import java.util.Map;

/**
* @deprecated The users are encouraged to switch to the Jakarta-based flavor
*/
@Deprecated(since = "3.0", forRemoval = true)
// The priority must be higher than that of RequestLogger, so that the Timer could print its output inside the Logger
@Priority(200)
public class RequestTimer implements ClientRequestFilter, ClientResponseFilter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@

/**
* Provides a simple HTTP health check to verify that remote endpoints are alive and accessible.
*
* @deprecated The users are encouraged to switch to the Jakarta-based flavor
*/
@Deprecated(since = "3.0", forRemoval = true)
public class HttpHealthCheck implements HealthCheck {

private Supplier<Response> responseSupplier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@
package io.bootique.jersey.client.instrumented.mdc;

import io.bootique.jersey.client.ClientAsyncExecutorProvider;
import javax.inject.Inject;
import javax.inject.Named;
import org.glassfish.jersey.client.ClientAsyncExecutor;

import javax.inject.Inject;
import javax.inject.Named;
import java.util.concurrent.*;

/**
* @since 3.0
* @deprecated The users are encouraged to switch to the Jakarta-based flavor
*/
@Deprecated(since = "3.0", forRemoval = true)
@ClientAsyncExecutor
public class MDCAwareClientAsyncExecutorProvider extends ClientAsyncExecutorProvider {

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

/**
* @since 3.0
* @deprecated The users are encouraged to switch to the Jakarta-based flavor
*/
@Deprecated(since = "3.0", forRemoval = true)
public class MDCAwareThreadPoolExecutor extends ThreadPoolExecutor {

public MDCAwareThreadPoolExecutor(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
package io.bootique.jersey.client;

import java.lang.annotation.Annotation;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import javax.inject.Provider;

import io.bootique.BootiqueException;
import io.bootique.di.Injector;
import io.bootique.di.Key;
import io.bootique.di.TypeLiteral;
import org.glassfish.hk2.api.Injectee;

import javax.inject.Provider;
import java.lang.annotation.Annotation;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

/**
* Base utilities for bridge between Bootique DI and HK2 container
*
* @deprecated The users are encouraged to switch to the Jakarta-based flavor
*/
@Deprecated(since = "3.0", forRemoval = true)
class BaseClientBqHk2Bridge {

protected final Injector injector;
Expand All @@ -24,9 +27,9 @@ protected BaseClientBqHk2Bridge(Injector injector) {

protected Provider<?> resolveBqProvider(Injectee injectee) {
TypeLiteral<?> typeLiteral = TypeLiteral.of(injectee.getRequiredType());
if(Provider.class.equals(typeLiteral.getRawType())) {
if (Provider.class.equals(typeLiteral.getRawType())) {
Type requiredType = getGenericParameterType(injectee.getRequiredType());
if(requiredType == null) {
if (requiredType == null) {
throw new BootiqueException(-1, "Not specified generic type for Provider injection point.");
}
typeLiteral = TypeLiteral.of(requiredType);
Expand All @@ -39,7 +42,7 @@ protected Provider<?> resolveBqProvider(Injectee injectee) {
? Key.get(typeLiteral)
: Key.get(typeLiteral, bindingAnnotation);

if(!injector.hasProvider(key) && !allowDynamicInjectionForKey(injectee, key)) {
if (!injector.hasProvider(key) && !allowDynamicInjectionForKey(injectee, key)) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
import javax.inject.Named;
import java.util.logging.Logger;

/**
* @deprecated The users are encouraged to switch to the Jakarta-based flavor
*/
@Deprecated(since = "3.0", forRemoval = true)
// a copy of non-public Jersey DefaultClientAsyncExecutorProvider that allows us to customize async pool parameters
@ClientAsyncExecutor
public class ClientAsyncExecutorProvider extends ThreadPoolExecutorProvider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,20 @@

package io.bootique.jersey.client;

import javax.inject.Inject;
import javax.inject.Provider;

import io.bootique.di.BQInject;
import io.bootique.di.Injector;
import io.bootique.di.TypeLiteral;
import org.glassfish.hk2.api.Injectee;
import org.glassfish.hk2.api.InjectionResolver;
import org.glassfish.hk2.api.ServiceHandle;

import javax.inject.Inject;
import javax.inject.Provider;

/**
* @deprecated The users are encouraged to switch to the Jakarta-based flavor
*/
@Deprecated(since = "3.0", forRemoval = true)
public class ClientBqInjectInjector extends BaseClientBqHk2Bridge implements InjectionResolver<BQInject> {

@Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,25 @@

package io.bootique.jersey.client;

import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.Collections;
import java.util.Set;

import javax.inject.Inject;
import javax.inject.Provider;
import javax.inject.Singleton;

import io.bootique.di.Injector;
import io.bootique.di.Key;
import io.bootique.di.TypeLiteral;
import org.glassfish.hk2.api.DescriptorType;
import org.glassfish.hk2.api.DescriptorVisibility;
import org.glassfish.hk2.api.Injectee;
import org.glassfish.hk2.api.JustInTimeInjectionResolver;
import org.glassfish.hk2.api.ServiceHandle;
import org.glassfish.hk2.api.ServiceLocator;
import org.glassfish.hk2.api.*;
import org.glassfish.hk2.utilities.AbstractActiveDescriptor;
import org.glassfish.hk2.utilities.ServiceLocatorUtilities;

import javax.inject.Inject;
import javax.inject.Provider;
import javax.inject.Singleton;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.Collections;
import java.util.Set;

/**
* @deprecated The users are encouraged to switch to the Jakarta-based flavor
*/
@Deprecated(since = "3.0", forRemoval = true)
public class ClientBqInjectorBridge extends BaseClientBqHk2Bridge implements JustInTimeInjectionResolver {

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
import java.security.KeyStore;
import java.util.Map;

/**
* @deprecated The users are encouraged to switch to the Jakarta-based flavor
*/
@Deprecated(since = "3.0", forRemoval = true)
public class DefaultHttpClientFactory implements HttpClientFactory {

private ClientConfig config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
import java.util.Set;
import java.util.function.Supplier;

/**
* @deprecated The users are encouraged to switch to the Jakarta-based flavor
*/
@Deprecated(since = "3.0", forRemoval = true)
public class DefaultHttpTargets implements HttpTargets {

private final Map<String, Supplier<WebTarget>> namedTargets;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
/**
* JAX RS {@link javax.ws.rs.client.Client} builder that builds the client with references to various parts of
* "jerseyclient" Bootique configuration.
*
* @deprecated The users are encouraged to switch to the Jakarta-based flavor
*/
@Deprecated(since = "3.0", forRemoval = true)
public interface HttpClientBuilder {

Client build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@

/**
* An injectable factory for creating JAX RS clients based on Bootique configuration.
*
* @deprecated The users are encouraged to switch to the Jakarta-based flavor
*/
@Deprecated(since = "3.0", forRemoval = true)
public interface HttpClientFactory {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
import java.util.Set;
import java.util.function.Supplier;

/**
* @deprecated The users are encouraged to switch to the Jakarta-based flavor
*/
@Deprecated(since = "3.0", forRemoval = true)
@BQConfig("Configures HttpClientFactory, including named authenticators, timeouts, SSL certificates, etc.")
public class HttpClientFactoryFactory {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@

/**
* An injectable manager of preconfigured JAX RS {@link WebTarget} objects.
*
* @deprecated The users are encouraged to switch to the Jakarta-based flavor
*/
@Deprecated(since = "3.0", forRemoval = true)
public interface HttpTargets {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,19 @@

package io.bootique.jersey.client;

import javax.inject.Qualifier;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import javax.inject.Qualifier;

/**
* A DI annotation for a set of JAXRS client features.
*
* @deprecated The users are encouraged to switch to the Jakarta-based flavor
*/
@Target({ ElementType.PARAMETER, ElementType.FIELD, ElementType.METHOD })
@Deprecated(since = "3.0", forRemoval = true)
@Target({ElementType.PARAMETER, ElementType.FIELD, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Qualifier
public @interface JerseyClientFeatures {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
import javax.ws.rs.core.Feature;
import java.util.Set;

/**
* @deprecated The users are encouraged to switch to the Jakarta-based flavor
*/
@Deprecated(since = "3.0", forRemoval = true)
public class JerseyClientModule extends ConfigModule {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@

import javax.ws.rs.core.Feature;

/**
* @deprecated The users are encouraged to switch to the Jakarta-based flavor
*/
@Deprecated(since = "3.0", forRemoval = true)
public class JerseyClientModuleExtender {

private Binder binder;
Expand Down
Loading

0 comments on commit 88aceb2

Please sign in to comment.