Skip to content

Commit

Permalink
jersey common modules - module infos added
Browse files Browse the repository at this point in the history
Signed-off-by: jansupol <jan.supol@oracle.com>
  • Loading branch information
jansupol authored and senivam committed Jan 24, 2024
1 parent 0124c55 commit e7abe28
Show file tree
Hide file tree
Showing 13 changed files with 164 additions and 36 deletions.
26 changes: 16 additions & 10 deletions core-client/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022 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,16 +15,11 @@
*/

module org.glassfish.jersey.client {
//requires jakarta.ws.rs;
requires org.glassfish.jersey.core.common;

requires jakarta.annotation;

requires jakarta.inject;
requires java.logging;
//requires java.base;


requires jakarta.inject;
requires org.glassfish.jersey.core.common;

exports org.glassfish.jersey.client;
exports org.glassfish.jersey.client.authentication;
Expand All @@ -33,6 +28,17 @@
exports org.glassfish.jersey.client.inject;
exports org.glassfish.jersey.client.spi;

provides jakarta.ws.rs.client.ClientBuilder with
org.glassfish.jersey.client.JerseyClientBuilder;
opens org.glassfish.jersey.client;
opens org.glassfish.jersey.client.spi;
opens org.glassfish.jersey.client.filter;

// for Localization messages
opens org.glassfish.jersey.client.internal;
opens org.glassfish.jersey.client.internal.jdkconnector;

uses org.glassfish.jersey.client.spi.DefaultSslContextProvider;
uses org.glassfish.jersey.spi.ComponentProvider;

provides jakarta.ws.rs.client.ClientBuilder
with org.glassfish.jersey.client.JerseyClientBuilder;
}
9 changes: 7 additions & 2 deletions core-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@
<version>${compiler.common.mvn.plugin.version}</version>
<inherited>false</inherited>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<compilerArguments>
<!-- Do not warn about using sun.misc.Unsafe -->
<XDignore.symbol.file />
Expand Down Expand Up @@ -225,6 +223,13 @@
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>jakarta.inject</groupId>
Expand Down
37 changes: 24 additions & 13 deletions core-common/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022 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,28 +16,30 @@

module org.glassfish.jersey.core.common {
requires transitive jakarta.ws.rs;
requires transitive jakarta.inject;
requires static jakarta.xml.bind;
requires java.logging;
requires static jakarta.activation;
requires jakarta.annotation;
requires java.logging;
requires java.desktop;
requires jakarta.activation;

// Filename-based auto-modules
requires transitive jakarta.inject;
requires org.osgi.core;
requires static org.osgi.core;
requires osgi.resource.locator;

// Exports rather all, which corresponds to previous state without module-info
exports org.glassfish.jersey;
exports org.glassfish.jersey.internal;
exports org.glassfish.jersey.internal.config;
exports org.glassfish.jersey.internal.guava;
exports org.glassfish.jersey.internal.inject;
exports org.glassfish.jersey.internal.jsr166 to org.glassfish.jersey.core.server;
exports org.glassfish.jersey.internal.l10n;
exports org.glassfish.jersey.internal.sonar;
exports org.glassfish.jersey.internal.spi;
exports org.glassfish.jersey.internal.routing;
exports org.glassfish.jersey.internal.util;
exports org.glassfish.jersey.internal.util.collection;
exports org.glassfish.jersey.internal;
exports org.glassfish.jersey.logging;
exports org.glassfish.jersey.message;
exports org.glassfish.jersey.message.internal;
Expand All @@ -49,18 +51,27 @@
exports org.glassfish.jersey.spi;
exports org.glassfish.jersey.uri;
exports org.glassfish.jersey.uri.internal;
exports org.glassfish.jersey;
exports org.glassfish.jersey.internal.jsr166 to org.glassfish.jersey.core.server;

opens org.glassfish.jersey.message.internal;
opens org.glassfish.jersey.innate.spi to org.glassfish.jersey.media.multipart;
opens org.glassfish.jersey.internal;
opens org.glassfish.jersey.message.internal;

uses jakarta.ws.rs.core.Feature;
uses jakarta.ws.rs.container.DynamicFeature;
uses jakarta.ws.rs.ext.RuntimeDelegate;

uses org.glassfish.jersey.innate.spi.EntityPartBuilderProvider;
uses org.glassfish.jersey.internal.ServiceFinder;
uses org.glassfish.jersey.internal.inject.InjectionManagerFactory;
uses org.glassfish.jersey.internal.spi.AutoDiscoverable;
uses org.glassfish.jersey.internal.spi.ForcedAutoDiscoverable;
uses org.glassfish.jersey.model.internal.spi.ParameterServiceProvider;
uses org.glassfish.jersey.spi.HeaderDelegateProvider;
uses org.glassfish.jersey.spi.ExternalConfigurationProvider;

provides jakarta.ws.rs.ext.RuntimeDelegate with org.glassfish.jersey.internal.RuntimeDelegateImpl;
provides org.glassfish.jersey.internal.spi.AutoDiscoverable with org.glassfish.jersey.logging.LoggingFeatureAutoDiscoverable;
//provides org.osgi.framework.SynchronousBundleListener with org.glassfish.jersey.internal.OsgiRegistry;

provides jakarta.ws.rs.ext.RuntimeDelegate
with org.glassfish.jersey.internal.RuntimeDelegateImpl;
provides org.glassfish.jersey.internal.spi.AutoDiscoverable
with org.glassfish.jersey.logging.LoggingFeatureAutoDiscoverable,
org.glassfish.jersey.internal.config.ExternalPropertiesAutoDiscoverable;
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import org.glassfish.jersey.internal.LocalizationMessages;
import org.glassfish.jersey.internal.OsgiRegistry;
import org.glassfish.jersey.internal.util.collection.ClassTypePair;

import org.glassfish.jersey.internal.util.collection.LazyValue;
import org.glassfish.jersey.internal.util.collection.Value;
import org.glassfish.jersey.internal.util.collection.Values;
Expand Down
6 changes: 5 additions & 1 deletion core-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,13 @@
<parallel>classes</parallel>
<perCoreThreadCount>true</perCoreThreadCount>
<threadCount>1</threadCount>
<forkCount>0</forkCount>
<forkCount>1</forkCount>
<reuseForks>true</reuseForks>
<systemPropertiesFile>${project.basedir}/etc/systemPropertiesFile</systemPropertiesFile>
<argLine>
--add-modules jakarta.xml.bind
${surefire.security.argline}
</argLine>
</configuration>
</plugin>
<plugin>
Expand Down
34 changes: 30 additions & 4 deletions core-server/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022 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 @@ -34,18 +34,44 @@
// Exports rather all, which corresponds to previous state without module-info
exports org.glassfish.jersey.server;
exports org.glassfish.jersey.server.spi;
exports org.glassfish.jersey.server.spi.internal;
exports org.glassfish.jersey.server.model;
exports org.glassfish.jersey.server.wadl;
exports org.glassfish.jersey.server.wadl.config;
exports org.glassfish.jersey.server.wadl.processor;
exports org.glassfish.jersey.server.filter;
exports org.glassfish.jersey.server.filter.internal;
exports org.glassfish.jersey.server.monitoring;
exports org.glassfish.jersey.server.wadl.internal;
exports org.glassfish.jersey.server.internal;
exports org.glassfish.jersey.server.internal.inject;
exports org.glassfish.jersey.server.internal.monitoring;
exports org.glassfish.jersey.server.internal.process;

provides jakarta.ws.rs.core.Configuration with org.glassfish.jersey.server.ResourceConfig;
// provides jakarta.ws.rs.core.Configuration with org.glassfish.jersey.server.ServerConfig;
uses org.glassfish.jersey.server.spi.ComponentProvider;
uses org.glassfish.jersey.server.spi.ExternalRequestScope;
uses org.glassfish.jersey.server.spi.WebServerProvider;

opens com.sun.research.ws.wadl to jakarta.xml.bind;

opens org.glassfish.jersey.server;
opens org.glassfish.jersey.server.filter;
opens org.glassfish.jersey.server.filter.internal;
opens org.glassfish.jersey.server.internal;
opens org.glassfish.jersey.server.internal.inject;
opens org.glassfish.jersey.server.internal.monitoring;
opens org.glassfish.jersey.server.internal.monitoring.jmx;
opens org.glassfish.jersey.server.internal.process;
opens org.glassfish.jersey.server.internal.routing;
opens org.glassfish.jersey.server.model;
opens org.glassfish.jersey.server.wadl.processor;

provides jakarta.ws.rs.ext.RuntimeDelegate
with org.glassfish.jersey.server.internal.RuntimeDelegateImpl;
provides org.glassfish.jersey.internal.spi.AutoDiscoverable
with org.glassfish.jersey.server.filter.internal.ServerFiltersAutoDiscoverable;
provides org.glassfish.jersey.internal.spi.ForcedAutoDiscoverable
with org.glassfish.jersey.server.wadl.internal.WadlAutoDiscoverable,
org.glassfish.jersey.server.internal.monitoring.MonitoringAutodiscoverable;
provides org.glassfish.jersey.model.internal.spi.ParameterServiceProvider
with org.glassfish.jersey.server.model.Parameter.ServerParameterService;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2022 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 @@ -19,6 +19,7 @@
import java.io.CharArrayWriter;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InaccessibleObjectException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
Expand Down Expand Up @@ -402,7 +403,7 @@ public Constructor<?> run() throws NoSuchMethodException {
});
parameterClassInstance = defaultConstructor.newInstance();
} catch (final InstantiationException | SecurityException | IllegalAccessException
| IllegalArgumentException | InvocationTargetException ex) {
| IllegalArgumentException | InvocationTargetException | InaccessibleObjectException ex) {
LOGGER.log(Level.FINE, null, ex);
} catch (final PrivilegedActionException ex) {
LOGGER.log(Level.FINE, null, ex.getCause());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ public void testCreateEndpoint() {
*/
@Test
public void testRuntimeDelegateInstance() {
try {
RuntimeDelegate.getInstance().createEndpoint((Application) null, com.sun.net.httpserver.HttpHandler.class);
} catch (Exception e) {
// does not matter, this just makes sure the correct RuntimeDelegate is set
}
assertSame(RuntimeDelegateImpl.class, RuntimeDelegate.getInstance().getClass());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,24 @@ public class JarFileScannerTest {

@BeforeEach
public void setUp() throws Exception {
final String separator = System.getProperty("path.separator");
final String oldClassPath = System.getProperty("java.class.path");
final String sureFireClassPath = System.getProperty("surefire.test.class.path");
final String modulePath = System.getProperty("jdk.module.path");
final StringBuilder classPath = new StringBuilder();
if (oldClassPath != null) {
classPath.append(oldClassPath);
classPath.append(separator);
}
if (sureFireClassPath != null) {
classPath.append(sureFireClassPath);
classPath.append(separator);
}
if (modulePath != null) {
classPath.append(modulePath);
}

final String[] entries = classPath.toString().split(separator);

jaxRsApiPath = setUpJaxRsApiPath();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,24 @@ public class VFSSchemeResourceFinderTest extends AbstractFinderTest {

@BeforeEach
public void setUp() throws Exception {
final String separator = System.getProperty("path.separator");
final String oldClassPath = System.getProperty("java.class.path");
final String sureFireClassPath = System.getProperty("surefire.test.class.path");
final String modulePath = System.getProperty("jdk.module.path");
final StringBuilder classPath = new StringBuilder();
if (oldClassPath != null) {
classPath.append(oldClassPath);
classPath.append(separator);
}
if (sureFireClassPath != null) {
classPath.append(sureFireClassPath);
classPath.append(separator);
}
if (modulePath != null) {
classPath.append(modulePath);
}

final String[] entries = classPath.toString().split(separator);

jaxRsApiPath = setUpJaxRsApiPath();

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
org.glassfish.jersey.server.AutoDiscoverableServerTest$CommonAutoDiscoverable
org.glassfish.jersey.server.AutoDiscoverableServerTest$CommonAutoDiscoverable
org.glassfish.jersey.server.filter.internal.ServerFiltersAutoDiscoverable
8 changes: 5 additions & 3 deletions inject/hk2/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022 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 @@

module org.glassfish.jersey.inject.hk2 {

requires transitive jakarta.annotation;
requires transitive jakarta.inject;
requires jakarta.annotation;
requires jakarta.inject;
requires java.logging;

requires org.glassfish.hk2.api;
Expand All @@ -29,4 +29,6 @@
exports org.glassfish.jersey.inject.hk2;
opens org.glassfish.jersey.inject.hk2;

provides org.glassfish.jersey.internal.inject.InjectionManagerFactory
with org.glassfish.jersey.inject.hk2.Hk2InjectionManagerFactory;
}
30 changes: 30 additions & 0 deletions media/jaxb/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (c) 2022 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
*/

module org.glassfish.jersey.media.jaxb {
requires java.logging;
requires jakarta.ws.rs;
requires jakarta.xml.bind;
requires org.glassfish.jersey.core.common;

opens org.glassfish.jersey.jaxb.internal;

exports org.glassfish.jersey.jaxb;
exports org.glassfish.jersey.jaxb.internal;

provides org.glassfish.jersey.internal.spi.ForcedAutoDiscoverable
with org.glassfish.jersey.jaxb.internal.JaxbAutoDiscoverable;
}

0 comments on commit e7abe28

Please sign in to comment.