Skip to content

Commit

Permalink
remove redundant multi-release jar configuration
Browse files Browse the repository at this point in the history
Signed-off-by: Maxim Nesen <[email protected]>
  • Loading branch information
senivam committed Jan 25, 2024
1 parent 3b1b53e commit 3844a37
Show file tree
Hide file tree
Showing 76 changed files with 210 additions and 3,591 deletions.
40 changes: 20 additions & 20 deletions connectors/helidon-connector/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2020, 2023 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2020, 2024 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -32,10 +32,10 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java8.build.outputDirectory>${project.basedir}/target</java8.build.outputDirectory>
<java8.sourceDirectory>${project.basedir}/src/main/java8</java8.sourceDirectory>
<java17.build.outputDirectory>${project.basedir}/target17</java17.build.outputDirectory>
<java17.build.outputDirectory>${project.basedir}/target</java17.build.outputDirectory>
<java17.sourceDirectory>${project.basedir}/src/main/java17</java17.sourceDirectory>
<java21.build.outputDirectory>${project.basedir}/target21</java21.build.outputDirectory>
<java21.sourceDirectory>${project.basedir}/src/main/java21</java21.sourceDirectory>
</properties>

<dependencies>
Expand Down Expand Up @@ -91,10 +91,10 @@
<profile>
<id>HelidonExclude</id>
<activation>
<jdk>[1.8,17)</jdk>
<jdk>[17,21)</jdk>
</activation>
<build>
<directory>${java8.build.outputDirectory}</directory>
<directory>${java17.build.outputDirectory}</directory>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
Expand All @@ -107,7 +107,7 @@
</goals>
<configuration>
<sources>
<source>${java8.sourceDirectory}</source>
<source>${java17.sourceDirectory}</source>
</sources>
</configuration>
</execution>
Expand All @@ -129,10 +129,10 @@
<profile>
<id>HelidonInclude</id>
<activation>
<jdk>[17,)</jdk>
<jdk>[21,)</jdk>
</activation>
<build>
<directory>${java17.build.outputDirectory}</directory>
<directory>${java21.build.outputDirectory}</directory>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
Expand All @@ -145,7 +145,7 @@
</goals>
<configuration>
<sources>
<source>${java17.sourceDirectory}</source>
<source>${java21.sourceDirectory}</source>
</sources>
</configuration>
</execution>
Expand All @@ -155,13 +155,13 @@
</build>
</profile>
<profile>
<id>copyJDK17FilesToMultiReleaseJar</id>
<id>copyJDK21FilesToMultiReleaseJar</id>
<activation>
<file>
<!-- ${java17.build.outputDirectory} does not work here -->
<exists>target17/classes/org/glassfish/jersey/helidon/connector/HelidonConnectorProvider.class</exists>
<!-- ${java21.build.outputDirectory} does not work here -->
<exists>target21/classes/org/glassfish/jersey/helidon/connector/HelidonConnectorProvider.class</exists>
</file>
<jdk>[1.8,17)</jdk>
<jdk>[17,21)</jdk>
</activation>
<build>
<plugins>
Expand All @@ -182,16 +182,16 @@
<inherited>true</inherited>
<executions>
<execution>
<id>copy-jdk17-classes</id>
<id>copy-jdk21-classes</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${java8.build.outputDirectory}/classes/META-INF/versions/17</outputDirectory>
<outputDirectory>${java17.build.outputDirectory}/classes/META-INF/versions/21</outputDirectory>
<resources>
<resource>
<directory>${java17.build.outputDirectory}/classes</directory>
<directory>${java21.build.outputDirectory}/classes</directory>
</resource>
</resources>
</configuration>
Expand All @@ -203,14 +203,14 @@
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>copy-jdk17-sources</id>
<id>copy-jdk21-sources</id>
<phase>package</phase>
<configuration>
<target>
<property name="sources-jar" value="${java8.build.outputDirectory}/${project.artifactId}-${project.version}-sources.jar"/>
<property name="sources-jar" value="${java17.build.outputDirectory}/${project.artifactId}-${project.version}-sources.jar"/>
<echo>sources-jar: ${sources-jar}</echo>
<zip destfile="${sources-jar}" update="true">
<zipfileset dir="${java17.sourceDirectory}" prefix="META-INF/versions/17"/>
<zipfileset dir="${java21.sourceDirectory}" prefix="META-INF/versions/21"/>
</zip>
</target>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -15,21 +15,17 @@
*/
package org.glassfish.jersey.helidon.connector;

import io.helidon.jersey.connector.HelidonProperties;
import org.glassfish.jersey.internal.util.PropertiesClass;

import io.helidon.config.Config;
import io.helidon.webclient.WebClient;

/**
* Configuration options specific to the Client API that utilizes {@code HelidonConnectorProvider}.
* Configuration options specific to the Client API that utilizes {@code HelidonConnectorProvider}
* @since 2.31
*/
@PropertiesClass
public final class HelidonClientProperties {

/**
* A Helidon {@link Config} instance that is passed to {@link WebClient.Builder#config(Config)} if available
* A Helidon {@code Config} instance that is passed to {@code WebClient.Builder#config(Config)} if available.
*/
public static final String CONFIG = HelidonProperties.CONFIG;
public static final String CONFIG = "jersey.connector.helidon.config";
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -16,8 +16,8 @@

package org.glassfish.jersey.helidon.connector;

import org.glassfish.jersey.Beta;
import org.glassfish.jersey.client.spi.Connector;
import org.glassfish.jersey.client.spi.ConnectorProvider;
import org.glassfish.jersey.internal.util.JdkVersion;

import jakarta.ws.rs.ProcessingException;
Expand All @@ -26,51 +26,17 @@
import java.io.OutputStream;

/**
* Provider for Helidon WebClient {@link Connector} that utilizes the Helidon HTTP Client to send and receive
* HTTP request and responses. JDK 8 is not supported by the Helidon Connector.
* <p>
* The following properties are only supported at construction of this class:
* <ul>
* <li>{@link org.glassfish.jersey.client.ClientProperties#CONNECT_TIMEOUT}</li>
* <li>{@link org.glassfish.jersey.client.ClientProperties#FOLLOW_REDIRECTS}</li>
* <li>{@link org.glassfish.jersey.client.ClientProperties#PROXY_URI}</li>
* <li>{@link org.glassfish.jersey.client.ClientProperties#PROXY_USERNAME}</li>
* <li>{@link org.glassfish.jersey.client.ClientProperties#PROXY_PASSWORD}</li>
* <li>{@link org.glassfish.jersey.client.ClientProperties#READ_TIMEOUT}</li>
* <li>{@link HelidonClientProperties#CONFIG}</li>
* </ul>
* <p>
* If a {@link org.glassfish.jersey.client.ClientResponse} is obtained and an
* entity is not read from the response then
* {@link org.glassfish.jersey.client.ClientResponse#close()} MUST be called
* after processing the response to release connection-based resources.
* </p>
* <p>
* Client operations are thread safe, the HTTP connection may
* be shared between different threads.
* </p>
* <p>
* If a response entity is obtained that is an instance of {@link java.io.Closeable}
* then the instance MUST be closed after processing the entity to release
* connection-based resources.
* </p>
* <p>
* This connector uses {@link org.glassfish.jersey.client.ClientProperties#OUTBOUND_CONTENT_LENGTH_BUFFER} to buffer the entity
* written for instance by {@link jakarta.ws.rs.core.StreamingOutput}. Should the buffer be small and
* {@link jakarta.ws.rs.core.StreamingOutput#write(OutputStream)} be called many times, the performance can drop. The Content-Length
* or the Content_Encoding header is set by the underlaying Helidon WebClient regardless of the
* {@link org.glassfish.jersey.client.ClientProperties#OUTBOUND_CONTENT_LENGTH_BUFFER} size, however.
* </p>
* Helidon Connector stub which only throws exception when running on JDK prior to 21.
* New Helidon 3 does not support JDKs prior to 21.
*
* @since 2.31
* @since 3.0.5
*/
@Beta
public class HelidonConnectorProvider extends io.helidon.jersey.connector.HelidonConnectorProvider {
public class HelidonConnectorProvider implements ConnectorProvider {
@Override
public Connector getConnector(Client client, Configuration runtimeConfig) {
if (JdkVersion.getJdkVersion().getMajor() < 17) {
if (JdkVersion.getJdkVersion().getMajor() < 21) {
throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED());
}
return super.getConnector(client, runtimeConfig);
return null;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -15,17 +15,18 @@
*/
package org.glassfish.jersey.helidon.connector;

import io.helidon.jersey.connector.HelidonProperties;
import org.glassfish.jersey.internal.util.PropertiesClass;

/**
* Configuration options specific to the Client API that utilizes {@code HelidonConnectorProvider}
* Configuration options specific to the Client API that utilizes {@code HelidonConnectorProvider}.
* @since 2.31
*/
@PropertiesClass
public final class HelidonClientProperties {

/**
* A Helidon {@code Config} instance that is passed to {@code WebClient.Builder#config(Config)} if available.
* A Helidon {@link Config} instance that is passed to {@link WebClient.Builder#config(Config)} if available
*/
public static final String CONFIG = "jersey.connector.helidon.config";
public static final String CONFIG = HelidonProperties.CONFIG;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* Copyright (c) 2020, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

package org.glassfish.jersey.helidon.connector;

import org.glassfish.jersey.Beta;
import org.glassfish.jersey.client.spi.Connector;
import org.glassfish.jersey.internal.util.JdkVersion;

import jakarta.ws.rs.ProcessingException;
import jakarta.ws.rs.client.Client;
import jakarta.ws.rs.core.Configuration;
import java.io.OutputStream;

/**
* Provider for Helidon WebClient {@link Connector} that utilizes the Helidon HTTP Client to send and receive
* HTTP request and responses. JDK 8 is not supported by the Helidon Connector.
* <p>
* The following properties are only supported at construction of this class:
* <ul>
* <li>{@link org.glassfish.jersey.client.ClientProperties#CONNECT_TIMEOUT}</li>
* <li>{@link org.glassfish.jersey.client.ClientProperties#FOLLOW_REDIRECTS}</li>
* <li>{@link org.glassfish.jersey.client.ClientProperties#PROXY_URI}</li>
* <li>{@link org.glassfish.jersey.client.ClientProperties#PROXY_USERNAME}</li>
* <li>{@link org.glassfish.jersey.client.ClientProperties#PROXY_PASSWORD}</li>
* <li>{@link org.glassfish.jersey.client.ClientProperties#READ_TIMEOUT}</li>
* <li>{@link HelidonClientProperties#CONFIG}</li>
* </ul>
* <p>
* If a {@link org.glassfish.jersey.client.ClientResponse} is obtained and an
* entity is not read from the response then
* {@link org.glassfish.jersey.client.ClientResponse#close()} MUST be called
* after processing the response to release connection-based resources.
* </p>
* <p>
* Client operations are thread safe, the HTTP connection may
* be shared between different threads.
* </p>
* <p>
* If a response entity is obtained that is an instance of {@link java.io.Closeable}
* then the instance MUST be closed after processing the entity to release
* connection-based resources.
* </p>
* <p>
* This connector uses {@link org.glassfish.jersey.client.ClientProperties#OUTBOUND_CONTENT_LENGTH_BUFFER} to buffer the entity
* written for instance by {@link jakarta.ws.rs.core.StreamingOutput}. Should the buffer be small and
* {@link jakarta.ws.rs.core.StreamingOutput#write(OutputStream)} be called many times, the performance can drop. The Content-Length
* or the Content_Encoding header is set by the underlaying Helidon WebClient regardless of the
* {@link org.glassfish.jersey.client.ClientProperties#OUTBOUND_CONTENT_LENGTH_BUFFER} size, however.
* </p>
*
* @since 2.31
*/
@Beta
public class HelidonConnectorProvider extends io.helidon.jersey.connector.HelidonConnectorProvider {
@Override
public Connector getConnector(Client client, Configuration runtimeConfig) {
if (JdkVersion.getJdkVersion().getMajor() < 21) {
throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED());
}
return super.getConnector(client, runtimeConfig);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2020, 2022 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2020, 2024 Oracle and/or its affiliates. All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -14,4 +14,4 @@
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
#

not.supported=Helidon connector is not supported on JDK version less than 17.
not.supported=Helidon connector is not supported on JDK version less than 21.
Loading

0 comments on commit 3844a37

Please sign in to comment.