This is an automated email from the ASF dual-hosted git repository. asf-gitbox-commits pushed a commit to branch geoapi-4.0 in repository https://gitbox.apache.org/repos/asf/sis.git
commit 8c153011edde0945a36b09a22b34f644a9f1f864 Author: Martin Desruisseaux <[email protected]> AuthorDate: Mon Nov 30 12:15:57 2026 +0100 Remove OSGi and JavaEE support (but keep Jakarta). OSGi was de-facto abandonned since we moved the build system to Gradle because the required information was missing from MANIFEST/META-INF.MF. JavaEE is removed because it is replaced by Jakarta and the latter has been upgraded to Java modules, while JavaEE has not. --- endorsed/build.gradle.kts | 4 -- .../org/apache/sis/metadata/MetadataStandard.java | 3 +- .../internal/shared/ReferencingServices.java | 2 +- .../sis/metadata/iso/citation/Citations.java | 3 +- .../apache/sis/metadata/sql/MetadataSource.java | 3 +- .../metadata/sql/internal/shared/Initializer.java | 4 +- .../metadata/sql/internal/shared/package-info.java | 4 +- .../main/org/apache/sis/xml/XML.java | 5 +- .../org/apache/sis/xml/bind/TypeRegistration.java | 3 +- .../sis/xml/internal/shared/XmlUtilities.java | 2 - .../apache/sis/referencing/AuthorityFactories.java | 3 +- .../main/org/apache/sis/referencing/CommonCRS.java | 7 +- .../factory/ConcurrentAuthorityFactory.java | 6 +- .../sis/storage/netcdf/NetcdfStoreProvider.java | 3 +- .../org/apache/sis/storage/DataStoreRegistry.java | 3 +- .../org/apache/sis/converter/SystemRegistry.java | 5 +- .../org/apache/sis/converter/package-info.java | 2 +- .../main/org/apache/sis/measure/Angle.java | 13 ++-- .../main/org/apache/sis/system/DaemonThread.java | 6 +- .../main/org/apache/sis/system/Modules.java | 5 +- .../org/apache/sis/system/OptionalDependency.java | 4 +- .../main/org/apache/sis/system/Shutdown.java | 6 +- .../main/org/apache/sis/system/SystemListener.java | 42 +---------- .../sis/util/internal/shared/MetadataServices.java | 2 +- .../javax.servlet.ServletContainerInitializer | 1 - .../src/org.apache.sis.web/main/module-info.java | 17 +---- .../org/apache/sis/web/javaee/JavaBeanHook.java | 60 ---------------- .../org/apache/sis/web/javaee/ServletListener.java | 69 ------------------ .../org/apache/sis/web/javaee/package-info.java | 27 ------- .../org/apache/sis/web/osgi/OSGiActivator.java | 83 ---------------------- .../main/org/apache/sis/web/osgi/package-info.java | 23 ------ netbeans-project/ivy.xml | 4 -- 32 files changed, 43 insertions(+), 381 deletions(-) diff --git a/endorsed/build.gradle.kts b/endorsed/build.gradle.kts index a7b4a7ca4c..9ba5788e89 100644 --- a/endorsed/build.gradle.kts +++ b/endorsed/build.gradle.kts @@ -73,10 +73,6 @@ dependencies { compileOnly(group = "jakarta.annotation", name = "jakarta.annotation-api", version = "3.0.0") compileOnly(group = "jakarta.servlet", name = "jakarta.servlet-api", version = "6.1.0") compileOnly(group = "jakarta.ejb", name = "jakarta.ejb-api", version = "4.0.1") - compileOnly(group = "javax.annotation", name = "javax.annotation-api", version = "1.3.2") - compileOnly(group = "javax.servlet", name = "javax.servlet-api", version = "4.0.1") - compileOnly(group = "javax.ejb", name = "javax.ejb-api", version = "3.2.2") - compileOnly(group = "org.osgi", name = "osgi.core", version = "8.0.0") // Test dependencies testImplementation(tests.junit5) diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/MetadataStandard.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/MetadataStandard.java index dd3445c1c2..eceb7a2263 100644 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/MetadataStandard.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/MetadataStandard.java @@ -41,7 +41,6 @@ import org.apache.sis.util.collection.TableColumn; import org.apache.sis.util.collection.CheckedContainer; import org.apache.sis.util.internal.shared.Strings; import org.apache.sis.system.Configuration; -import org.apache.sis.system.Modules; import org.apache.sis.system.Semaphores; import org.apache.sis.system.SystemListener; import org.apache.sis.metadata.internal.Resources; @@ -174,7 +173,7 @@ public class MetadataStandard implements Serializable { ISO_19111, ISO_19123 }; - SystemListener.add(new SystemListener(Modules.METADATA) { + SystemListener.add(new SystemListener() { @Override protected void classpathChanged() { clearCache(); } diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/internal/shared/ReferencingServices.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/internal/shared/ReferencingServices.java index 5104ac50ad..a53483fede 100644 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/internal/shared/ReferencingServices.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/internal/shared/ReferencingServices.java @@ -71,7 +71,7 @@ public class ReferencingServices extends OptionalDependency { * force a new {@code ReferencingServices} lookup if the module path changes. */ protected ReferencingServices() { - super(Modules.METADATA, Modules.REFERENCING); + super(Modules.REFERENCING); } /** diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/citation/Citations.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/citation/Citations.java index 42ebbb5208..94af9cda41 100644 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/citation/Citations.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/citation/Citations.java @@ -35,7 +35,6 @@ import org.apache.sis.metadata.internal.CitationConstant; import org.apache.sis.metadata.internal.shared.Identifiers; import org.apache.sis.metadata.simple.SimpleCitation; import org.apache.sis.xml.bind.NonMarshalledAuthority; -import org.apache.sis.system.Modules; import org.apache.sis.system.SystemListener; import org.apache.sis.metadata.iso.DefaultIdentifier; // For javadoc @@ -477,7 +476,7 @@ public final class Citations { }; static { // Must be after CITATIONS array construction. - SystemListener.add(new SystemListener(Modules.METADATA) { + SystemListener.add(new SystemListener() { @Override protected void classpathChanged() {refresh();} @Override protected void databaseChanged() {refresh();} }); diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/MetadataSource.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/MetadataSource.java index 4ee6e76b62..003e558d7d 100644 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/MetadataSource.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/MetadataSource.java @@ -52,7 +52,6 @@ import org.opengis.referencing.IdentifiedObject; import org.apache.sis.metadata.MetadataStandard; import org.apache.sis.metadata.KeyNamePolicy; import org.apache.sis.metadata.ValueExistencePolicy; -import org.apache.sis.system.Modules; import org.apache.sis.system.SystemListener; import org.apache.sis.system.DelayedExecutor; import org.apache.sis.system.DelayedRunnable; @@ -287,7 +286,7 @@ public class MetadataSource implements AutoCloseable { */ private static MetadataSource instance; static { - SystemListener.add(new SystemListener(Modules.METADATA) { + SystemListener.add(new SystemListener() { @Override protected void classpathChanged() { synchronized (MetadataSource.class) { instance = null; diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/internal/shared/Initializer.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/internal/shared/Initializer.java index 5bd54321ac..449491fb82 100644 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/internal/shared/Initializer.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/internal/shared/Initializer.java @@ -166,7 +166,7 @@ public abstract class Initializer { } /** - * Invoked when the JVM is shutting down, or when the Servlet or OSGi bundle is uninstalled. + * Invoked when the <abbr>JVM</abbr> is shutting down or when the module is removed from a container. * This method forgets the data source and unregisters the listener from the JNDI context. * Note that there is no need to shutdown a HDQLDB or Derby engine since this shutdown is * only for {@link DataSource} obtained from JNDI context, in which case shuting down the @@ -452,7 +452,7 @@ public abstract class Initializer { } /** - * Invoked when the <abbr>JVM</abbr> is shutting down, or when the Servlet or OSGi bundle is uninstalled. + * Invoked when the <abbr>JVM</abbr> is shutting down or when the module is removed from a container. * This method shutdowns the database. * * @throws ReflectiveOperationException if the shutdown process requires reflection and that operation failed. diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/internal/shared/package-info.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/internal/shared/package-info.java index c0d36e3940..71647449ce 100644 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/internal/shared/package-info.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/internal/shared/package-info.java @@ -25,9 +25,9 @@ * * <h2>Declaring the data source in a web container</h2> * The {@link org.apache.sis.metadata.sql.internal.shared.Initializer#getDataSource()} method gets the unique, - * SIS-wide, data source for JDBC connection to the {@code $SIS_DATA/Databases/SpatialMetadata}. + * SIS-wide, data source for <abbr>JDBC</abbr> connection to the {@code $SIS_DATA/Databases/SpatialMetadata}. * The method Javadoc describes the steps for fetching that data source. - * When used in a JavaEE container, the data source can be configured as below: + * When used in a Servlet container, the data source can be configured as below: * * <ol class="verbose"> * <li><p>Make the JDBC driver available to the web container and its applications. On Tomcat, this diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/XML.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/XML.java index 7e4cd64884..49aa34e353 100644 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/XML.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/XML.java @@ -47,7 +47,6 @@ import jakarta.xml.bind.JAXBException; import org.apache.sis.util.Version; import org.apache.sis.util.Workaround; import org.apache.sis.util.resources.Errors; -import org.apache.sis.system.Modules; import org.apache.sis.system.SystemListener; import org.apache.sis.xml.internal.shared.URISource; import org.apache.sis.xml.bind.TypeRegistration; @@ -384,7 +383,7 @@ public final class XML { * The field name uses the uppercase convention because this field is almost constant: * this field is initially null, then created by {@link #getPool()} when first needed. * Once created the field value usually doesn't change. However, the field may be reset - * to {@code null} when modules are loaded or unloaded by a container such as OSGi, + * to {@code null} when modules are loaded or unloaded by a container such as Jakarta, * because the set of classes returned by {@link TypeRegistration#load(boolean)} may have changed. * * @see #getPool() @@ -396,7 +395,7 @@ public final class XML { * be created because the {@code JAXBContext} may be different. */ static { - SystemListener.add(new SystemListener(Modules.UTILITIES) { + SystemListener.add(new SystemListener() { @Override protected void classpathChanged() { POOL = null; } diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/TypeRegistration.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/TypeRegistration.java index 263db54e74..75b3035316 100644 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/TypeRegistration.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/TypeRegistration.java @@ -31,7 +31,6 @@ import java.lang.ref.Reference; import java.lang.ref.WeakReference; import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.JAXBException; -import org.apache.sis.system.Modules; import org.apache.sis.system.Reflect; import org.apache.sis.system.SystemListener; import org.apache.sis.system.DelayedExecutor; @@ -85,7 +84,7 @@ public abstract class TypeRegistration { * Forces reloading of JAXB context and converters if the module path changes. */ static { - SystemListener.add(new SystemListener(Modules.UTILITIES) { + SystemListener.add(new SystemListener() { @Override protected void classpathChanged() { synchronized (TypeRegistration.class) { context = null; diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/internal/shared/XmlUtilities.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/internal/shared/XmlUtilities.java index bfb4e0e26b..46254c81e8 100644 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/internal/shared/XmlUtilities.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/internal/shared/XmlUtilities.java @@ -46,7 +46,6 @@ import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.DatatypeConfigurationException; import static javax.xml.datatype.DatatypeConstants.FIELD_UNDEFINED; import org.apache.sis.system.SystemListener; -import org.apache.sis.system.Modules; import org.apache.sis.xml.bind.Context; import org.apache.sis.temporal.TemporalDate; @@ -73,7 +72,6 @@ public final class XmlUtilities extends SystemListener { * For internal usage only. */ private XmlUtilities() { - super(Modules.UTILITIES); } /** diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/AuthorityFactories.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/AuthorityFactories.java index d1ab0d7272..c7335f9571 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/AuthorityFactories.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/AuthorityFactories.java @@ -36,7 +36,6 @@ import org.apache.sis.referencing.internal.shared.LazySet; import org.apache.sis.referencing.internal.shared.FilteredIterator; import org.apache.sis.system.Reflect; import org.apache.sis.system.Loggers; -import org.apache.sis.system.Modules; import org.apache.sis.system.Configuration; import org.apache.sis.system.SystemListener; import org.apache.sis.referencing.factory.MultiAuthoritiesFactory; @@ -94,7 +93,7 @@ final class AuthorityFactories<T extends AuthorityFactory> extends LazySet<T> { * when the module path changed. */ static { - SystemListener.add(new SystemListener(Modules.REFERENCING) { + SystemListener.add(new SystemListener() { @Override protected void classpathChanged() {ALL.reload();} }); } diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/CommonCRS.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/CommonCRS.java index 8bf0e9ac2e..b67af0fff3 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/CommonCRS.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/CommonCRS.java @@ -73,7 +73,6 @@ import org.apache.sis.referencing.internal.shared.Formulas; import org.apache.sis.metadata.iso.citation.Citations; import org.apache.sis.system.SystemListener; import org.apache.sis.system.Semaphores; -import org.apache.sis.system.Modules; import org.apache.sis.util.OptionalCandidate; import org.apache.sis.util.ArgumentChecks; import org.apache.sis.util.ComparisonMode; @@ -438,7 +437,7 @@ public enum CommonCRS { * This will clear the cache, since the EPSG database may have changed. */ static { - SystemListener.add(new SystemListener(Modules.REFERENCING) { + SystemListener.add(new SystemListener() { @Override protected void classpathChanged() { for (final CommonCRS e : values()) { e.clear(); @@ -1395,7 +1394,7 @@ public enum CommonCRS { * This will clear the cache, since the factories may have changed. */ static { - SystemListener.add(new SystemListener(Modules.REFERENCING) { + SystemListener.add(new SystemListener() { @Override protected void classpathChanged() { for (final Vertical e : values()) { e.clear(); @@ -1706,7 +1705,7 @@ public enum CommonCRS { * This will clear the cache, since the factories may have changed. */ static { - SystemListener.add(new SystemListener(Modules.REFERENCING) { + SystemListener.add(new SystemListener() { @Override protected void classpathChanged() { for (final Temporal e : values()) { e.clear(); diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java index b9c661bbfd..8b5334fd91 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java @@ -341,7 +341,7 @@ public abstract class ConcurrentAuthorityFactory<DAO extends GeodeticAuthorityFa * that this ConcurrentAuthorityFactory is no longer in use. * * 2) Closes the Data Access Objects at JVM shutdown time if the application is standalone, - * or when the bundle is uninstalled if running inside an OSGi or Servlet container. + * or when the bundle is uninstalled if running inside a container such as Jakarta. */ final var closer = new ShutdownHook<>(availableDAOs); Cleaners.SHARED.register(this, closer); @@ -2130,7 +2130,7 @@ public abstract class ConcurrentAuthorityFactory<DAO extends GeodeticAuthorityFa /** * A hook to be executed either when the {@link ConcurrentAuthorityFactory} is collected by the garbage collector, - * when the Java Virtual Machine is shutdown, or when the module is uninstalled by the OSGi or Servlet container. + * when the Java Virtual Machine is shutdown, or when the module is uninstalled by a container such as Jakarta. * * <p><strong>Do not keep reference to the enclosing factory</strong> - in particular, * this class must be static - otherwise the factory would never been garbage collected.</p> @@ -2167,7 +2167,7 @@ public abstract class ConcurrentAuthorityFactory<DAO extends GeodeticAuthorityFa } /** - * Invoked at JVM shutdown time, or when the container (OSGi or Servlet) uninstall the bundle containing SIS. + * Invoked when the <abbr>JVM</abbr> is shutting down or when the module is removed from a container. */ @Override public Object call() throws Exception { diff --git a/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java b/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java index 1fd28453db..f2f33b2208 100644 --- a/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java +++ b/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java @@ -48,7 +48,6 @@ import org.apache.sis.storage.event.StoreListeners; import org.apache.sis.io.stream.ChannelDataInput; import org.apache.sis.io.stream.IOUtilities; import org.apache.sis.system.SystemListener; -import org.apache.sis.system.Modules; import org.apache.sis.setup.GeometryLibrary; import org.apache.sis.util.Version; import org.apache.sis.util.logging.Logging; @@ -137,7 +136,7 @@ public class NetcdfStoreProvider extends DataStoreProvider { * because the UCAR library may no longer be on the module path. */ static { - SystemListener.add(new SystemListener(Modules.NETCDF) { + SystemListener.add(new SystemListener() { @Override protected void classpathChanged() { reset(); } diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/DataStoreRegistry.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/DataStoreRegistry.java index 2e4e3d465b..a66fdc7e89 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/DataStoreRegistry.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/DataStoreRegistry.java @@ -24,7 +24,6 @@ import java.nio.file.StandardOpenOption; import org.apache.sis.io.stream.IOUtilities; import org.apache.sis.io.stream.InternalOptionKey; import org.apache.sis.system.Reflect; -import org.apache.sis.system.Modules; import org.apache.sis.system.SystemListener; import org.apache.sis.storage.internal.Resources; import org.apache.sis.storage.base.Capability; @@ -52,7 +51,7 @@ final class DataStoreRegistry extends LazySet<DataStoreProvider> { */ static final DataStoreRegistry INSTANCE = new DataStoreRegistry(); static { - SystemListener.add(new SystemListener(Modules.STORAGE) { + SystemListener.add(new SystemListener() { @Override protected void classpathChanged() { INSTANCE.reload(); } diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/converter/SystemRegistry.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/converter/SystemRegistry.java index 0bbb6346b0..ab50b7ac47 100644 --- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/converter/SystemRegistry.java +++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/converter/SystemRegistry.java @@ -24,7 +24,6 @@ import org.apache.sis.util.ObjectConverter; import org.apache.sis.util.UnconvertibleObjectException; import org.apache.sis.system.SystemListener; import org.apache.sis.system.Reflect; -import org.apache.sis.system.Modules; /** @@ -70,10 +69,10 @@ public final class SystemRegistry extends ConverterRegistry { * because the set of reachable `module-info.class` files may have changed. * If any converters were registered by explicit calls to `register(…)`, * then those converters are lost. This is of concern only for applications - * using a container framework such as Servlet or OSGi. + * using a container framework such as Jakarta. * See package javadoc for more information. */ - SystemListener.add(new SystemListener(Modules.UTILITIES) { + SystemListener.add(new SystemListener() { @Override protected void classpathChanged() { INSTANCE.clear(); } diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/converter/package-info.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/converter/package-info.java index 3fe7f57d87..029180d158 100644 --- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/converter/package-info.java +++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/converter/package-info.java @@ -28,7 +28,7 @@ * of their {@link org.apache.sis.util.ObjectConverter} implementations in {@code module-info.java} * as provider of the {@code org.apache.sis.util.ObjectConverter} service. * - * <p>Applications deployed in a container framework like OSGi shall use only the service loader mechanism, + * <p>Applications deployed in a container framework like Jakarta should use only the service loader mechanism, * because system converters are discarded every time that the module-path changes. Having the converters * declared in {@code module-info.java} ensures that they will be reloaded when needed.</p> * diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/Angle.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/Angle.java index b97f2fe180..5388a7ce61 100644 --- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/Angle.java +++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/Angle.java @@ -291,13 +291,12 @@ public class Angle implements Comparable<Angle>, Formattable, Serializable { * Returns a shared instance of {@link AngleFormat}. The return type is * {@link Format} in order to avoid class loading before necessary. * - * <p>This method must be invoked in a {@code synchronized(Angle.class)} block. We use - * synchronization instead of static class initialization because {@code AngleFormat} - * is not thread-safe, so it needs to be used in a synchronized block anyway. We could - * avoid synchronization by using {@link ThreadLocal}, but this brings other issues in - * OSGi context. Given that our Javadoc said that {@link #Angle(String)} and {@link #toString()} - * should be used mostly for debugging purpose, we consider not worth to ensure high - * concurrency capability here.</p> + * <p>This method must be invoked in a {@code synchronized(Angle.class)} block. + * We use synchronization instead of static class initialization because + * {@code AngleFormat} is not thread-safe, so it needs to be used in a synchronized block anyway. + * We could avoid synchronization by using {@link ThreadLocal}, but it has other issues in web containers. + * Given that our Javadoc said that {@link #Angle(String)} and {@link #toString()} should be used mostly + * for debugging purpose, we consider not worth to ensure high concurrency capability here.</p> */ private static Format getAngleFormat() { assert Thread.holdsLock(Angle.class); diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/system/DaemonThread.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/system/DaemonThread.java index 3dbf7585a9..6b24254fe3 100644 --- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/system/DaemonThread.java +++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/system/DaemonThread.java @@ -46,7 +46,7 @@ abstract class DaemonThread extends Thread { * The previous element in a chain of {@code DaemonThread}s. We maintain a linked list of * {@code DaemonThread} to be killed when {@link #killAll(DaemonThread, long)} will be invoked. * We do not rely on the thread listed by the {@link Threads#DAEMONS} group because in an - * OSGi context, we need to handle separately the threads created by each SIS module. + * web container, we need to handle separately the threads created by each SIS module. */ private final DaemonThread previous; @@ -61,8 +61,8 @@ abstract class DaemonThread extends Thread { * only small and quick methods, without deep nesting levels. * * <p>We need to maintain a list of daemon threads created by each SIS module in order to - * kill them at shutdown time (not strictly necessary for pure JSEE applications, but - * required in OSGi environment). Each module using {@code DaemonThread} shall maintain + * kill them at shutdown time (not strictly necessary for standalone applications, but + * required in web containers). Each module using {@code DaemonThread} shall maintain * its <strong>own</strong> list (don't use the list of another module), like below:</p> * * {@snippet lang="java" : diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/system/Modules.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/system/Modules.java index 3b170fdeef..8f00f394f8 100644 --- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/system/Modules.java +++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/system/Modules.java @@ -18,12 +18,11 @@ package org.apache.sis.system; /** - * Constants related to SIS modules management. + * Constants related to <abbr>SIS</abbr> modules management. * The constants in this class are used for two purposes: * * <ul> - * <li>Module symbolic names, as declared in {@code module-info.java} files. In an OSGi context, this would be - * the {@code Bundle-SymbolicName} entry of the {@code META-INF/MANIFEST.MF} file in each JAR files.</li> + * <li>Module names, as declared in {@code module-info.java} files.</li> * * <li>Logger names for "module-wide" messages, or when the message to log does not fit in a more * accurate category. Note that other logger names are listed in the {@link Loggers} class.</li> diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/system/OptionalDependency.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/system/OptionalDependency.java index f5e540aebf..99734e72ae 100644 --- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/system/OptionalDependency.java +++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/system/OptionalDependency.java @@ -40,12 +40,10 @@ public abstract class OptionalDependency extends SystemListener { /** * Creates a new optional dependency. * - * @param module a constant from the {@link Modules} class which identify the module that need the optional dependency. * @param dependency the name of the optional module on which the specified {@code module} depends. */ @SuppressWarnings("this-escape") // This class is internal API. - protected OptionalDependency(final String module, final String dependency) { - super(module); + protected OptionalDependency(final String dependency) { this.dependency = dependency; SystemListener.add(this); } diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/system/Shutdown.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/system/Shutdown.java index 6a9dcd2f77..e6b58f2e1a 100644 --- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/system/Shutdown.java +++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/system/Shutdown.java @@ -33,7 +33,7 @@ import static org.apache.sis.util.internal.shared.Constants.NANOS_PER_SECOND; public final class Shutdown extends Thread { /** * Non-null if a shutdown hook is already registered. That shutdown hook is not necessarily {@link #hook}. - * It may be an OSGi or Servlet shutdown hook instead, as notified by {@link #setContainer(String)}. + * It may be a Servlet shutdown hook instead, as notified by {@link #setContainer(String)}. * * @see #setContainer(String) */ @@ -104,7 +104,7 @@ public final class Shutdown extends Thread { } /** - * Registers a code to execute at JVM shutdown time, or if SIS library is unloaded from a container such as OSGi. + * Registers a code to execute at JVM shutdown time, or if SIS library is unloaded from a web container. * The resources will be disposed at shutdown time in reverse order (most recently added resources disposed first). * * <p>The same resource shall not be added twice.</p> @@ -151,7 +151,7 @@ public final class Shutdown extends Thread { /** * Unregisters the supervisor MBean, executes the disposal tasks and shutdowns the {@code org.apache.sis.util} threads. - * This method may be invoked at JVM shutdown, or if a container like OSGi is unloading the <abbr>SIS</abbr> library. + * This method may be invoked at JVM shutdown, or if a container such as Jakarta is unloading the <abbr>SIS</abbr> library. * * @param caller the class invoking this method (used for logging purpose), or {@code null} if this method * is invoked at JVM shutdown time (in which case the logging system is not available anymore). diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/system/SystemListener.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/system/SystemListener.java index f9fe2e354f..601d64047c 100644 --- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/system/SystemListener.java +++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/system/SystemListener.java @@ -23,9 +23,8 @@ import org.apache.sis.util.ArraysExt; /** - * Listeners for changes in the Apache SIS system. This listener is used only for rare events, - * like OSGi module loaded or unloaded. We use this class instead of OSGi listeners in order - * to keep the SIS library OSGi-independent. + * Listeners for changes in the Apache <abbr>SIS</abbr> system. + * This listener is used only for rare events, such as modules loaded or unloaded from a web container such as Jakarta. * * @author Martin Desruisseaux (Geomatys) */ @@ -40,21 +39,10 @@ public abstract class SystemListener implements EventListener { */ private static SystemListener[] listeners; - /** - * The OSGi module symbolic name, as declared in the {@code Bundle-SymbolicName} entry of the - * {@code META-INF/MANIFEST.MF} file. Shall be one of {@link Modules} constants. This is used - * in order to detect which listeners to remove when a module is uninstalled. - */ - private final String module; - /** * Creates a new listener. - * - * @param module the OSGi module symbolic name, as declared in the {@code Bundle-SymbolicName} - * entry of the {@code META-INF/MANIFEST.MF} file. Shall be one of {@link Modules} constants. */ - protected SystemListener(final String module) { - this.module = module; + protected SystemListener() { } /** @@ -95,30 +83,6 @@ public abstract class SystemListener implements EventListener { } } - /** - * Removes all listeners for the module of the given name. - * - * @param name the name of the module for which to remove listeners, or {@code null} if the module - * to uninstall does not have symbolic name (in which case it is probably not a SIS module). - */ - public static synchronized void removeModule(final String name) { - if (name != null) { - final SystemListener[] list = listeners; - if (list != null) { - int count = 0; - final var modified = new SystemListener[list.length]; - for (final SystemListener listener : list) { - if (!name.equals(listener.module)) { - modified[count++] = listener; - } - } - if (count != list.length) { - listeners = Arrays.copyOf(modified, count); - } - } - } - } - /** * Notifies all registered listeners that the module path may have changed. */ diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/shared/MetadataServices.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/shared/MetadataServices.java index 3505656cd9..04a11123a0 100644 --- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/shared/MetadataServices.java +++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/shared/MetadataServices.java @@ -63,7 +63,7 @@ public class MetadataServices extends OptionalDependency { * force a new {@code MetadataServices} lookup if the module path changes. */ protected MetadataServices() { - super(Modules.UTILITIES, Modules.METADATA); + super(Modules.METADATA); } /** diff --git a/endorsed/src/org.apache.sis.web/main/META-INF/services/javax.servlet.ServletContainerInitializer b/endorsed/src/org.apache.sis.web/main/META-INF/services/javax.servlet.ServletContainerInitializer deleted file mode 100644 index 049f87fea7..0000000000 --- a/endorsed/src/org.apache.sis.web/main/META-INF/services/javax.servlet.ServletContainerInitializer +++ /dev/null @@ -1 +0,0 @@ -org.apache.sis.web.javaee.ServletListener diff --git a/endorsed/src/org.apache.sis.web/main/module-info.java b/endorsed/src/org.apache.sis.web/main/module-info.java index edd24615e0..489a69bc70 100644 --- a/endorsed/src/org.apache.sis.web/main/module-info.java +++ b/endorsed/src/org.apache.sis.web/main/module-info.java @@ -16,7 +16,7 @@ */ /** - * Support for Apache <abbr>SIS</abbr> execution in the context of JavaEE or web containers. + * Support for Apache <abbr>SIS</abbr> execution in the context of Servlet or web containers. * This module registers listeners for stopping Apache <abbr>SIS</abbr> background threads * when a web application or an Enterprise JavaBean (<abbr>EJB</abbr>) using <abbr>SIS</abbr> * is undeployed from a container. @@ -24,10 +24,7 @@ * * <ul> * <li>Jakarta Servlet ({@code jakarta.servlet} package)</li> - * <li>JavaEE Servlet ({@code javax.servlet} package)</li> * <li>Jakarta Enterprise JavaBeans (<abbr>EJB</abbr>) ({@code jakarta.ejb} package)</li> - * <li>JavaEE <abbr>EJB</abbr> ({@code javax.ejb} package)</li> - * <li>OGSGi ({@code org.osgi.framework} package)</li> * </ul> * * Web applications or Enterprise JavaBeans should consider adding this module in their dependencies @@ -40,22 +37,10 @@ module org.apache.sis.web { requires transitive org.apache.sis.util; - // Servlet (new and old) requires static jakarta.servlet; - requires static javax.servlet.api; - - // JavaEE (new and old) requires static jakarta.annotation; requires static jakarta.ejb; - requires static java.annotation; - requires static javax.ejb.api; - - // OSGi bundle - requires static osgi.core; provides jakarta.servlet.ServletContainerInitializer with org.apache.sis.web.jakarta.ServletListener; - - provides javax.servlet.ServletContainerInitializer - with org.apache.sis.web.javaee.ServletListener; } diff --git a/endorsed/src/org.apache.sis.web/main/org/apache/sis/web/javaee/JavaBeanHook.java b/endorsed/src/org.apache.sis.web/main/org/apache/sis/web/javaee/JavaBeanHook.java deleted file mode 100644 index 0b97ff8c2c..0000000000 --- a/endorsed/src/org.apache.sis.web/main/org/apache/sis/web/javaee/JavaBeanHook.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.sis.web.javaee; - -import javax.ejb.Startup; -import javax.ejb.Singleton; -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; -import org.apache.sis.system.Shutdown; - - -/** - * Listener for Enterprise JavaBeans, used as a shutdown hook when the <abbr>EJB</abbr> is undeployed. - * This class should not be used directly. - * - * @author Martin Desruisseaux (Geomatys) - */ -@Startup -@Singleton -public final class JavaBeanHook { - /** - * Invoked by reflection. - */ - public JavaBeanHook() { - } - - /** - * Notifies Apache <abbr>SIS</abbr> that the application is initializing. - */ - @PostConstruct - public void initialize() { - Shutdown.setContainer("EJB (JavaEE)"); - } - - /** - * Receives notification that the application is about to be shutdown. - */ - @PreDestroy - public void shutdown() { - try { - Shutdown.stop(getClass()); - } catch (Exception e) { - Shutdown.log(getClass(), e); - } - } -} diff --git a/endorsed/src/org.apache.sis.web/main/org/apache/sis/web/javaee/ServletListener.java b/endorsed/src/org.apache.sis.web/main/org/apache/sis/web/javaee/ServletListener.java deleted file mode 100644 index ef69fd8492..0000000000 --- a/endorsed/src/org.apache.sis.web/main/org/apache/sis/web/javaee/ServletListener.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.sis.web.javaee; - -import java.util.Set; -import javax.servlet.ServletContext; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; -import javax.servlet.ServletContainerInitializer; -import javax.servlet.annotation.HandlesTypes; -import javax.servlet.annotation.WebListener; -import org.apache.sis.system.Shutdown; - - -/** - * Copy of the {@linkplain org.apache.sis.web.jakarta.ServletListener listener for Jakarta} - * using the JaveEE package name instead of Jakarta. - * - * @author Martin Desruisseaux (Geomatys) - */ -@WebListener("Apache SIS shutdown hook") -public final class ServletListener implements ServletContainerInitializer, ServletContextListener { - /** - * Invoked by reflection by the service loader. - */ - public ServletListener() { - } - - /** - * Notifies Apache <abbr>SIS</abbr> that the application is initializing. - * - * @param handled classes declared by {@link HandlesTypes}, or {@code null} if none. - * @param context context of the web application in which the classes were discovered. - */ - @Override - public void onStartup(final Set<Class<?>> handled, final ServletContext context) { - context.addListener(this); - final String env = context.getServerInfo(); - Shutdown.setContainer(env != null ? env : "Servlet"); - } - - /** - * Receives notification that the application is about to be shutdown. - * - * @param event the context of the servlet being shutdown. - */ - @Override - public void contextDestroyed(final ServletContextEvent event) { - try { - Shutdown.stop(getClass()); - } catch (Exception e) { - event.getServletContext().log(e.toString(), e); - } - } -} diff --git a/endorsed/src/org.apache.sis.web/main/org/apache/sis/web/javaee/package-info.java b/endorsed/src/org.apache.sis.web/main/org/apache/sis/web/javaee/package-info.java deleted file mode 100644 index 9137f99f9e..0000000000 --- a/endorsed/src/org.apache.sis.web/main/org/apache/sis/web/javaee/package-info.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -/** - * All classes having a dependencies to JavaEE ({@code javax.servlet} and {@code javax.ejb} packages). - * JavaEE contains Enterprise JavaBeans (<abbr>EJB</abbr>) for business logic and servlet for the web. - * JavaEE is replaced by Jakarta ({@code jakarta.*} packages), but not all applications have migrated. - * This package is provided for web applications that are still using JavaEE. - * - * @author Martin Desruisseaux (Geomatys) - */ -package org.apache.sis.web.javaee; diff --git a/endorsed/src/org.apache.sis.web/main/org/apache/sis/web/osgi/OSGiActivator.java b/endorsed/src/org.apache.sis.web/main/org/apache/sis/web/osgi/OSGiActivator.java deleted file mode 100644 index 4255995a41..0000000000 --- a/endorsed/src/org.apache.sis.web/main/org/apache/sis/web/osgi/OSGiActivator.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.sis.web.osgi; - -import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleEvent; -import org.osgi.framework.BundleListener; -import org.apache.sis.system.Shutdown; -import org.apache.sis.system.SystemListener; - - -/** - * Bundle activator for OSGi environment. - * - * @author Martin Desruisseaux (Geomatys) - */ -public final class OSGiActivator implements BundleActivator, BundleListener { - /** - * Creates a new bundle activator. - */ - public OSGiActivator() { - } - - /** - * Invoked when this bundle is started. - * - * @param context the execution context of the bundle being started. - */ - @Override - public void start(final BundleContext context) { - context.addBundleListener(this); - Shutdown.setContainer("OSGi"); - } - - /** - * Invoked when this bundle is stopped. - * This method shutdowns the {@code org.apache.sis.util} threads. - * - * @param context the execution context of the bundle being stopped. - * @throws Exception if an error occurred during unregistration of the supervisor MBean or resource disposal. - */ - @Override - public void stop(final BundleContext context) throws Exception { - context.removeBundleListener(this); - Shutdown.stop(getClass()); - } - - /** - * Invoked when another module has been installed or un-installed. - * This method notifies the Apache SIS library that the module path may have changed. - * - * @param event the event that describe the life-cycle change. - */ - @Override - public void bundleChanged(final BundleEvent event) { - switch (event.getType()) { - case BundleEvent.STARTED: { - SystemListener.fireClasspathChanged(); - break; - } - case BundleEvent.STOPPED: { - SystemListener.fireClasspathChanged(); - SystemListener.removeModule(event.getBundle().getSymbolicName()); - break; - } - } - } -} diff --git a/endorsed/src/org.apache.sis.web/main/org/apache/sis/web/osgi/package-info.java b/endorsed/src/org.apache.sis.web/main/org/apache/sis/web/osgi/package-info.java deleted file mode 100644 index 96548d7860..0000000000 --- a/endorsed/src/org.apache.sis.web/main/org/apache/sis/web/osgi/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * All classes having a dependencies to OSGi ({@code org.osgi.framework} packages). - * - * @author Martin Desruisseaux (Geomatys) - */ -package org.apache.sis.web.osgi; diff --git a/netbeans-project/ivy.xml b/netbeans-project/ivy.xml index d688071dfa..17e5ad0b2a 100644 --- a/netbeans-project/ivy.xml +++ b/netbeans-project/ivy.xml @@ -27,13 +27,9 @@ <dependency org="software.amazon.awssdk" name="aws-core" rev="2.57.13"/> <dependency org="software.amazon.awssdk" name="s3" rev="2.57.13"/> <dependency org="org.antlr" name="antlr4-maven-plugin" rev="4.13.2"/> - <dependency org="javax.servlet" name="javax.servlet-api" rev="4.0.1"/> <dependency org="jakarta.servlet" name="jakarta.servlet-api" rev="6.1.0"/> - <dependency org="javax.ejb" name="javax.ejb-api" rev="3.2.2"/> <dependency org="jakarta.ejb" name="jakarta.ejb-api" rev="4.0.1"/> <dependency org="jakarta.annotation" name="jakarta.annotation-api" rev="3.0.0"/> - <dependency org="javax.annotation" name="javax.annotation-api" rev="1.3.2"/> - <dependency org="org.osgi" name="osgi.core" rev="8.0.0"/> <dependency org="org.junit.platform" name="junit-platform-launcher" rev="1.10.3"/> <dependency org="org.junit.jupiter" name="junit-jupiter-api" rev="5.10.3"/> <dependency org="org.apache.derby" name="derby" rev="10.17.1.0"/>
