This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch geoapi-4.0 in repository https://gitbox.apache.org/repos/asf/sis.git
The following commit(s) were added to refs/heads/geoapi-4.0 by this push: new f5e80273b3 Move some URLs in a class for easier maintenance. Change "http:sis.apache.org" to "https:". Allow configuration of the URL to EPSG installation. f5e80273b3 is described below commit f5e80273b3234a85760f9708589fb1e654f8f8dc Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Fri May 6 14:46:22 2022 +0200 Move some URLs in a class for easier maintenance. Change "http:sis.apache.org" to "https:". Allow configuration of the URL to EPSG installation. https://issues.apache.org/jira/browse/SIS-336 --- .../sis/internal/metadata/sql/Initializer.java | 9 ++-- .../metadata/iso/citation/HardCodedCitations.java | 5 +- .../sis/metadata/sql/MetadataWriterTest.java | 3 +- .../java/org/apache/sis/test/sql/TestDatabase.java | 2 +- .../main/java/org/apache/sis/referencing/CRS.java | 4 +- .../sis/referencing/EPSGFactoryFallback.java | 46 ++++++++++++++++- .../factory/GeodeticAuthorityFactory.java | 6 +-- .../referencing/factory/sql/EPSGDataAccess.java | 7 +-- .../sis/referencing/factory/sql/EPSGFactory.java | 4 +- .../sis/referencing/factory/sql/package-info.java | 2 +- .../operation/projection/package-info.java | 2 +- .../transform/DefaultMathTransformFactory.java | 4 +- .../referencing/factory/sql/EPSGInstallerTest.java | 2 +- .../factory/sql/epsg/DataScriptFormatter.java | 3 +- .../sis/referencing/factory/sql/epsg/package.html | 4 +- .../report/CoordinateOperationMethods.java | 9 ++-- .../report/CoordinateReferenceSystems.java | 6 +-- .../sis/referencing/report/HTMLGenerator.java | 2 +- .../apache/sis/internal/util/DefinitionURI.java | 2 +- .../apache/sis/internal/util/MetadataServices.java | 8 ++- .../java/org/apache/sis/internal/util/URLs.java | 57 ++++++++++++++++++++++ .../java/org/apache/sis/setup/Configuration.java | 2 +- .../apache/sis/setup/InstallationResources.java | 22 ++++++++- .../apache/sis/internal/storage/xml/StoreTest.java | 4 +- 24 files changed, 170 insertions(+), 45 deletions(-) diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/Initializer.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/Initializer.java index c3896c6b9c..6dc76a3f0b 100644 --- a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/Initializer.java +++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/Initializer.java @@ -45,6 +45,8 @@ import org.apache.sis.util.resources.Messages; import org.apache.sis.util.logging.Logging; import org.apache.sis.util.Configuration; +import static org.apache.sis.internal.util.MetadataServices.EMBEDDED; + /** * Manages the unique {@link DataSource} instance to the {@code $SIS_DATA/Databases/SpatialMetadata} database. @@ -65,7 +67,7 @@ import org.apache.sis.util.Configuration; * All other methods are related to getting the {@code DataSource} instance, through JNDI or otherwise. * * @author Martin Desruisseaux (Geomatys) - * @version 1.1 + * @version 1.2 * @since 0.7 * @module */ @@ -84,11 +86,6 @@ public abstract class Initializer { */ public static final String JNDI = "jdbc/" + DATABASE; - /** - * A pseudo-authority name used by {@link InstallationResources} for the embedded data resources. - */ - public static final String EMBEDDED = "Embedded"; - /** * Data source specified by the user, to be used if no data source is specified by JNDI. * diff --git a/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/HardCodedCitations.java b/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/HardCodedCitations.java index 0baebe2ae9..07fc075cd6 100644 --- a/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/HardCodedCitations.java +++ b/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/HardCodedCitations.java @@ -24,6 +24,7 @@ import org.opengis.metadata.citation.PresentationForm; import org.apache.sis.metadata.iso.DefaultIdentifier; import org.apache.sis.util.SimpleInternationalString; import org.apache.sis.internal.util.Constants; +import org.apache.sis.internal.util.URLs; import org.apache.sis.util.Static; @@ -88,7 +89,7 @@ public final strictfp class HardCodedCitations extends Static { */ public static final DefaultCitation EPSG; static { - final DefaultOnlineResource r = new DefaultOnlineResource(URI.create("https://epsg.org/")); + final DefaultOnlineResource r = new DefaultOnlineResource(URI.create(URLs.EPSG)); r.setFunction(OnLineFunction.INFORMATION); final DefaultResponsibility p = new DefaultResponsibility(Role.PRINCIPAL_INVESTIGATOR, null, @@ -103,7 +104,7 @@ public final strictfp class HardCodedCitations extends Static { } /** - * Codespace for objects specific to <a href="http://sis.apache.org">Apache SIS</a>. + * Codespace for objects specific to <a href="https://sis.apache.org">Apache SIS</a>. */ public static final DefaultCitation SIS; static { diff --git a/core/sis-metadata/src/test/java/org/apache/sis/metadata/sql/MetadataWriterTest.java b/core/sis-metadata/src/test/java/org/apache/sis/metadata/sql/MetadataWriterTest.java index 41cccf9c08..00e8d21864 100644 --- a/core/sis-metadata/src/test/java/org/apache/sis/metadata/sql/MetadataWriterTest.java +++ b/core/sis-metadata/src/test/java/org/apache/sis/metadata/sql/MetadataWriterTest.java @@ -28,6 +28,7 @@ import org.apache.sis.test.sql.TestDatabase; import org.apache.sis.metadata.iso.citation.HardCodedCitations; import org.apache.sis.metadata.iso.citation.DefaultTelephone; import org.apache.sis.metadata.MetadataStandard; +import org.apache.sis.internal.util.URLs; import org.apache.sis.test.TestUtilities; import org.apache.sis.test.TestCase; import org.apache.sis.test.DependsOn; @@ -168,7 +169,7 @@ public final strictfp class MetadataWriterTest extends TestCase { @SuppressWarnings("deprecation") final OnlineResource resource = contact.getOnlineResource(); assertSame(resource, TestUtilities.getSingleton(contact.getOnlineResources())); - assertEquals("https://epsg.org/", resource.getLinkage().toString()); + assertEquals(URLs.EPSG, resource.getLinkage().toString()); assertEquals(OnLineFunction.INFORMATION, resource.getFunction()); /* * Ask columns that are known to not exist. diff --git a/core/sis-metadata/src/test/java/org/apache/sis/test/sql/TestDatabase.java b/core/sis-metadata/src/test/java/org/apache/sis/test/sql/TestDatabase.java index be02d4af91..fa8d28f7fb 100644 --- a/core/sis-metadata/src/test/java/org/apache/sis/test/sql/TestDatabase.java +++ b/core/sis-metadata/src/test/java/org/apache/sis/test/sql/TestDatabase.java @@ -218,7 +218,7 @@ public strictfp class TestDatabase implements AutoCloseable { * @return connection to a PostgreSQL database * @throws SQLException if an error occurred while connecting to the database or creating the schema. * - * @see <a href="http://sis.apache.org/source.html#postgres">Configuring PostgreSQL for Apache SIS tests</a> + * @see <a href="https://sis.apache.org/source.html#postgres">Configuring PostgreSQL for Apache SIS tests</a> * * @since 1.0 */ diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java index 685b20396c..32951af0b5 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java @@ -107,7 +107,7 @@ import org.opengis.geometry.Geometry; * <h2>Usage example</h2> * The most frequently used methods in this class are {@link #forCode forCode(…)}, {@link #fromWKT fromWKT(…)} * and {@link #findOperation findOperation(…)}. An usage example is like below - * (see the <a href="http://sis.apache.org/tables/CoordinateReferenceSystems.html">Apache SIS™ Coordinate + * (see the <a href="https://sis.apache.org/tables/CoordinateReferenceSystems.html">Apache SIS™ Coordinate * Reference System (CRS) codes</a> page for the complete list of EPSG codes): * * {@preformat java @@ -153,7 +153,7 @@ public final class CRS extends Static { /** * Returns the Coordinate Reference System for the given authority code. * The set of available codes depends on the {@link CRSAuthorityFactory} instances available on the classpath. - * There is many thousands of <a href="http://sis.apache.org/tables/CoordinateReferenceSystems.html">CRS + * There is many thousands of <a href="https://sis.apache.org/tables/CoordinateReferenceSystems.html">CRS * defined by EPSG authority or by other authorities</a>. * The following table lists a very small subset of codes which are guaranteed to be available * on any installation of Apache SIS: diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSGFactoryFallback.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSGFactoryFallback.java index 273fa46351..75a49568d4 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSGFactoryFallback.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSGFactoryFallback.java @@ -46,8 +46,12 @@ import org.apache.sis.metadata.iso.citation.DefaultCitation; import org.apache.sis.referencing.factory.GeodeticAuthorityFactory; import org.apache.sis.internal.referencing.provider.TransverseMercator; import org.apache.sis.internal.referencing.Resources; +import org.apache.sis.internal.system.DefaultFactories; import org.apache.sis.internal.system.Fallback; +import org.apache.sis.internal.util.MetadataServices; import org.apache.sis.internal.util.Constants; +import org.apache.sis.internal.util.URLs; +import org.apache.sis.setup.InstallationResources; import org.apache.sis.util.resources.Vocabulary; import org.apache.sis.util.CharSequences; import org.apache.sis.util.Debug; @@ -61,7 +65,7 @@ import org.apache.sis.measure.Units; * in the {@link CRS#forCode(String)} method javadoc is always available. * * @author Martin Desruisseaux (Geomatys) - * @version 1.0 + * @version 1.2 * @since 0.7 * @module */ @@ -92,6 +96,15 @@ final class EPSGFactoryFallback extends GeodeticAuthorityFactory */ private Citation authority; + /** + * URL where users can get more information about the installation process. + * Fetched when first needed. + * + * @see #getInstallationURL() + * @see <a href="https://issues.apache.org/jira/browse/SIS-336">SIS-336</a> + */ + private String installationURL; + /** * Constructor for the singleton instance. */ @@ -353,7 +366,36 @@ final class EPSGFactoryFallback extends GeodeticAuthorityFactory throw e; } throw new NoSuchAuthorityCodeException(Resources.format(Resources.Keys.NoSuchAuthorityCodeInSubset_4, - Constants.EPSG, toClass(kind), code, "http://sis.apache.org/epsg.html"), AUTHORITY, code); + Constants.EPSG, toClass(kind), code, getInstallationURL()), AUTHORITY, code); + } + + /** + * Returns a URL where users can get more information about the installation process. + */ + private synchronized String getInstallationURL() { + if (installationURL == null) { + installationURL = URLs.EPSG_INSTALL; // To be used as fallback. + final Iterable<InstallationResources> services = + DefaultFactories.createServiceLoader(InstallationResources.class); + /* + * Following loop will be executed one or two times. First, we check for resources that are + * specifically for EPSG geodetic dataset. If none are found, fallback on embedded database. + */ + boolean embedded = false; + do { + final String authority = embedded ? MetadataServices.EMBEDDED : Constants.EPSG; + for (InstallationResources res : services) { + if (res.getAuthorities().contains(authority)) { + final String url = res.getInstructionURL(); + if (url != null) { + installationURL = url; + return url; + } + } + } + } while ((embedded = !embedded) == true); + } + return installationURL; } /** diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java index 7a82bbe6e5..fd11ee22c4 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java @@ -1139,7 +1139,7 @@ public abstract class GeodeticAuthorityFactory extends AbstractFactory implement * @throws FactoryException if the object creation failed for some other reason. * * @see org.apache.sis.parameter.DefaultParameterDescriptor - * @see <a href="http://sis.apache.org/tables/CoordinateOperationMethods.html">Apache SIS™ Coordinate Operation Methods</a> + * @see <a href="https://sis.apache.org/tables/CoordinateOperationMethods.html">Apache SIS™ Coordinate Operation Methods</a> */ public ParameterDescriptor<?> createParameterDescriptor(final String code) throws NoSuchAuthorityCodeException, FactoryException @@ -1153,7 +1153,7 @@ public abstract class GeodeticAuthorityFactory extends AbstractFactory implement * (e.g. map projection) by itself, but tells us what is needed in order to perform such operation. * * <p>Available methods depend both on the {@linkplain #getAuthorityCodes(Class) set declared by the authority} and on the - * <a href="http://sis.apache.org/tables/CoordinateOperationMethods.html">list of methods implemented in Apache SIS</a>. + * <a href="https://sis.apache.org/tables/CoordinateOperationMethods.html">list of methods implemented in Apache SIS</a>. * In order to be supported, an operation method must have its formulas coded in the Java programming language. * See {@link org.apache.sis.referencing.operation.transform.MathTransformProvider} for more information.</p> * @@ -1167,7 +1167,7 @@ public abstract class GeodeticAuthorityFactory extends AbstractFactory implement * @throws FactoryException if the object creation failed for some other reason. * * @see org.apache.sis.referencing.operation.DefaultOperationMethod - * @see <a href="http://sis.apache.org/tables/CoordinateOperationMethods.html">Apache SIS™ Coordinate Operation Methods</a> + * @see <a href="https://sis.apache.org/tables/CoordinateOperationMethods.html">Apache SIS™ Coordinate Operation Methods</a> */ public OperationMethod createOperationMethod(final String code) throws NoSuchAuthorityCodeException, FactoryException { return cast(OperationMethod.class, createObject(code), code); diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java index 63b4c8819f..304e8766ed 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java @@ -86,6 +86,7 @@ import org.apache.sis.internal.util.Constants; import org.apache.sis.internal.util.CollectionsExt; import org.apache.sis.internal.util.StandardDateFormat; import org.apache.sis.internal.util.Strings; +import org.apache.sis.internal.util.URLs; import org.apache.sis.metadata.iso.citation.DefaultCitation; import org.apache.sis.metadata.iso.citation.DefaultOnlineResource; import org.apache.sis.metadata.iso.extent.DefaultExtent; @@ -159,7 +160,7 @@ import static org.apache.sis.internal.referencing.ServicesForMetadata.CONNECTION * @author Johann Sorel (Geomatys) * @version 1.2 * - * @see <a href="http://sis.apache.org/tables/CoordinateReferenceSystems.html">List of authority codes</a> + * @see <a href="https://sis.apache.org/tables/CoordinateReferenceSystems.html">List of authority codes</a> * * @since 0.7 * @module @@ -473,8 +474,8 @@ addURIs: for (int i=0; ; i++) { OnLineFunction function; InternationalString description = null; switch (i) { - case 0: url = "https://epsg.org/"; function = OnLineFunction.SEARCH; break; - case 1: url = "https://epsg.org/"; function = OnLineFunction.DOWNLOAD; break; + case 0: url = URLs.EPSG; function = OnLineFunction.SEARCH; break; + case 1: url = URLs.EPSG; function = OnLineFunction.DOWNLOAD; break; case 2: { url = SQLUtilities.getSimplifiedURL(metadata); function = OnLineFunction.valueOf(CONNECTION); diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGFactory.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGFactory.java index 4c590dfbe3..6c5625ebab 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGFactory.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGFactory.java @@ -81,7 +81,7 @@ import org.apache.sis.util.Localized; * * @see EPSGDataAccess * @see SQLTranslator - * @see <a href="http://sis.apache.org/tables/CoordinateReferenceSystems.html">List of authority codes</a> + * @see <a href="https://sis.apache.org/tables/CoordinateReferenceSystems.html">List of authority codes</a> * * @since 0.7 * @module @@ -372,7 +372,7 @@ public class EPSGFactory extends ConcurrentAuthorityFactory<EPSGDataAccess> impl * The EPSG dataset can not be distributed with Apache SIS at this time for licensing reasons. * Users need to either install the dataset manually (for example with the help of this method), * or add on the classpath to a separated bundle like {@code org.apache.sis:non-free:sis-epsg.jar}. - * See <a href="http://sis.apache.org/epsg.html">How to use EPSG geodetic dataset</a> for more information. + * See <a href="https://sis.apache.org/epsg.html">How to use EPSG geodetic dataset</a> for more information. * * @param connection connection to the database where to create the EPSG schema. * @throws UnavailableFactoryException if installation failed. The exception will have a diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/package-info.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/package-info.java index 3e533d8ec5..72828144d1 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/package-info.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/package-info.java @@ -18,7 +18,7 @@ /** * Factories for geodetic objects defined in a SQL database, typically the EPSG dataset. * This package provides support for all codes prefixed by {@code "EPSG:"} in the Apache SIS's - * <a href="http://sis.apache.org/tables/CoordinateReferenceSystems.html">list of authority codes</a>. + * <a href="https://sis.apache.org/tables/CoordinateReferenceSystems.html">list of authority codes</a>. * The main class in this package is {@link org.apache.sis.referencing.factory.sql.EPSGFactory}, * which requires a {@link javax.sql.DataSource} providing connections to an EPSG database. * diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/package-info.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/package-info.java index 8a0001d5b9..0bf3eec923 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/package-info.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/package-info.java @@ -36,7 +36,7 @@ * More on this convention is explained below.</p> * * <p>Users wanting to know more about the available projections and their parameters should look at the - * <a href="http://sis.apache.org/tables/CoordinateOperationMethods.html">list of coordinate operation methods</a>. + * <a href="https://sis.apache.org/tables/CoordinateOperationMethods.html">list of coordinate operation methods</a>. * Only users interested in the <em>implementation</em> of those projections should look at this package.</p> * * diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java index 46af41fccb..0afee4202b 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java @@ -96,7 +96,7 @@ import org.apache.sis.util.resources.Errors; * <h2>Standard parameters</h2> * {@code MathTransform} instances are created from {@linkplain DefaultParameterValueGroup parameter values}. * The parameters expected by each operation available in a default Apache SIS installation is - * <a href="http://sis.apache.org/tables/CoordinateOperationMethods.html">listed here</a>. + * <a href="https://sis.apache.org/tables/CoordinateOperationMethods.html">listed here</a>. * The set of parameters varies for each operation or projection, but the following can be considered typical: * * <ul> @@ -486,7 +486,7 @@ public class DefaultMathTransformFactory extends AbstractFactory implements Math * Returns the default parameter values for a math transform using the given operation method. * The {@code method} argument is the name of any {@code OperationMethod} instance returned by * <code>{@link #getAvailableMethods(Class) getAvailableMethods}({@linkplain SingleOperation}.class)</code>. - * Valid names are <a href="http://sis.apache.org/tables/CoordinateOperationMethods.html">listed here</a>. + * Valid names are <a href="https://sis.apache.org/tables/CoordinateOperationMethods.html">listed here</a>. * * <p>This function creates new parameter instances at every call. * Parameters are intended to be modified by the user before to be given to the diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java index 992695de56..1cbc7914a6 100644 --- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java +++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java @@ -59,7 +59,7 @@ import static org.junit.Assume.assumeTrue; * <p>This test requires that {@code $SIS_DATA/Databases/ExternalSources} directory contains * the {@code EPSG_Tables.sql}, {@code EPSG_Data.sql} and {@code EPSG_FKeys.sql} files. * Those files can be <a href="https://epsg.org/">downloaded from the source</a> or from - * <a href="http://sis.apache.org/source.html#non-free">SIS non-free directory</a>.</p> + * <a href="https://sis.apache.org/source.html#non-free">SIS non-free directory</a>.</p> * * <p>Every databases created by this test suite exist only in memory. * This class does not write anything to disk (except maybe some temporary files).</p> diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/DataScriptFormatter.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/DataScriptFormatter.java index d2e3870b10..8d01331b1f 100644 --- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/DataScriptFormatter.java +++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/DataScriptFormatter.java @@ -35,6 +35,7 @@ import java.util.regex.Pattern; import org.apache.sis.util.ArraysExt; import org.apache.sis.util.Workaround; import org.apache.sis.util.CharSequences; +import org.apache.sis.internal.util.URLs; import org.apache.sis.internal.metadata.sql.ScriptRunner; import org.apache.sis.test.sql.TestDatabase; @@ -186,7 +187,7 @@ public final class DataScriptFormatter extends ScriptRunner { try (LineNumberReader in = new LineNumberReader(new InputStreamReader(Files.newInputStream(inputFile), StandardCharsets.UTF_8))) { out.write("---\n" + "--- Copyright International Association of Oil and Gas Producers (IOGP)\n" + - "--- See https://epsg.org/terms-of-use.html (a copy is in ./LICENSE.txt).\n" + + "--- See " + URLs.EPSG_LICENSE + " (a copy is in ./LICENSE.txt).\n" + "---\n" + "--- This file has been reformatted (without any change in the data) for the needs of Apache SIS project.\n" + "--- See org.apache.sis.referencing.factory.sql.epsg.DataScriptFormatter.\n" + diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/package.html b/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/package.html index 9991b35d8e..221a5c0523 100644 --- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/package.html +++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/package.html @@ -140,7 +140,7 @@ java org.apache.sis.referencing.factory.sql.epsg.DataScriptFormatter $EPSG_SCRIP <li><p>Run the tests. It it convenient to run <code>org.apache.sis.referencing.factory.sql.EPSGInstallerTest</code> in an IDE first, for easier debugging if some changes in database structure or content broke some code. Then the whole Apache SIS project should be - <a href="http://sis.apache.org/source.html#tests">tested extensively</a>, preferably with a PostgreSQL server ready to accept local + <a href="https://sis.apache.org/source.html#tests">tested extensively</a>, preferably with a PostgreSQL server ready to accept local connections to <code>SpatialMetadataTest</code> database:</p> <pre>mvn install -Dorg.apache.sis.test.extensive=true</pre></li> @@ -148,7 +148,7 @@ java org.apache.sis.referencing.factory.sql.epsg.DataScriptFormatter $EPSG_SCRIP <li><p>Regenerate the HTML pages listing available CRS and coordinate operation methods. Those pages will be copied into the <code><a href="http://svn.apache.org/repos/asf/sis/site/trunk/content/tables/">site/content/tables/</a></code> - directory during the <a href="http://sis.apache.org/release-management.html#update-crs-list">release process</a>, + directory during the <a href="https://sis.apache.org/release-management.html#update-crs-list">release process</a>, but for now the purpose is only to check if there is errors:</p> <ul> <li><p>Upgrade the <code>FACTORY.VERSION</code> value defined in the diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateOperationMethods.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateOperationMethods.java index 49d4949c05..ac5e31516f 100644 --- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateOperationMethods.java +++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateOperationMethods.java @@ -38,6 +38,7 @@ import org.apache.sis.internal.referencing.provider.Affine; import org.apache.sis.internal.referencing.provider.AlbersEqualArea; import org.apache.sis.internal.referencing.provider.LambertConformal2SP; import org.apache.sis.internal.referencing.provider.ObliqueMercator; +import org.apache.sis.internal.util.URLs; import org.apache.sis.measure.Range; import org.apache.sis.measure.Latitude; import org.apache.sis.measure.Longitude; @@ -57,7 +58,7 @@ import org.opengis.metadata.Identifier; /** * Generates a list of projection parameters in a HTML page. This class is used for updating the - * <a href="http://sis.apache.org/tables/CoordinateOperationMethods.html">CoordinateOperationMethods.html</a> page. + * <a href="https://sis.apache.org/tables/CoordinateOperationMethods.html">CoordinateOperationMethods.html</a> page. * The {@linkplain #main(String[])} method creates the "{@code CoordinateOperationMethods.html}" file in the current * default directory if it does not already exists. Users is responsible for moving the generated file to the Apache * SIS {@code "content/"} site directory. @@ -165,9 +166,9 @@ public strictfp class CoordinateOperationMethods extends HTMLGenerator { openTag("li"); println("The <code>semi-major</code> and <code>semi-minor</code> parameters are needed for all map projections,"); println("but usually do not need to be specified explicitly since they are inferred from the ellipsoid"); - println("(unless <a href=\"http://sis.apache.org/apidocs/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.html\">creating parameterized transforms directly</a>)."); - println("For this reason, those parameters are usually not shown in <a href=\"https://epsg.org/\">EPSG repository</a>"); - println("or <a href=\"http://docs.opengeospatial.org/is/12-063r5/12-063r5.html\">Well Known Text</a> (WKT) definitions."); + println("(unless <a href=\"https://sis.apache.org/apidocs/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.html\">creating parameterized transforms directly</a>)."); + println("For this reason, those parameters are usually not shown in <a href=\"" + URLs.EPSG + "\">EPSG repository</a>"); + println("or <a href=\"" + URLs.WKT_SPECIFICATION + "\">Well Known Text</a> (WKT) definitions."); reopenTag("li"); println("The <code>earth_radius</code> and <code>inverse_flattening</code> parameters (not shown below) are implicitly supported by all map projections."); println("They are other ways to specify the ellipsoid (actually rarely used)."); diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java index b8f29f333a..1c01f792c6 100644 --- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java +++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java @@ -352,12 +352,12 @@ public final strictfp class CoordinateReferenceSystems extends AuthorityCodesRep properties.setProperty("TITLE", "Apache SIS™ Coordinate Reference System (CRS) codes"); properties.setProperty("PRODUCT.NAME", "Apache SIS™"); properties.setProperty("PRODUCT.VERSION", getVersion()); - properties.setProperty("PRODUCT.URL", "http://sis.apache.org"); - properties.setProperty("JAVADOC.GEOAPI", "http://www.geoapi.org/snapshot/javadoc"); + properties.setProperty("PRODUCT.URL", "https://sis.apache.org"); + properties.setProperty("JAVADOC.GEOAPI", "https://www.geoapi.org/snapshot/javadoc"); properties.setProperty("FACTORY.NAME", "EPSG"); properties.setProperty("FACTORY.VERSION", "9.9.1"); properties.setProperty("FACTORY.VERSION.SUFFIX", ", together with other sources"); - properties.setProperty("PRODUCT.VERSION.SUFFIX", " (provided that <a href=\"http://sis.apache.org/epsg.html\">a connection to an EPSG database exists</a>)"); + properties.setProperty("PRODUCT.VERSION.SUFFIX", " (provided that <a href=\"https://sis.apache.org/epsg.html\">a connection to an EPSG database exists</a>)"); properties.setProperty("DESCRIPTION", "<p><b>Notation:</b></p>\n" + "<ul>\n" + " <li>The " + YX_ORDER + " symbol in front of authority codes (${PERCENT.ANNOTATED} of them) identifies" + diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/HTMLGenerator.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/HTMLGenerator.java index 802afb28d0..f8751f3d4a 100644 --- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/HTMLGenerator.java +++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/HTMLGenerator.java @@ -33,7 +33,7 @@ import org.apache.sis.util.Deprecable; /** * Base class of all classes used to generate HTML pages to be published on - * the <a href="http://sis.apache.org/">http://sis.apache.org/</a> web site. + * the <a href="https://sis.apache.org/">https://sis.apache.org/</a> web site. * * <p>This class creates files in the current default directory. It is user's responsibility * to move the files to the appropriate Apache SIS {@code "content/"} site directory.</p> diff --git a/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java b/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java index acd6987fed..a21b204245 100644 --- a/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java +++ b/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java @@ -715,7 +715,7 @@ public final class DefinitionURI { */ private void appendStringTo(final StringBuilder buffer, char separator) { if (isHTTP) { - buffer.append("http://").append(DOMAIN).append("/def"); + buffer.append(Constants.HTTP + "//").append(DOMAIN).append("/def"); separator = '/'; } int n = 4; diff --git a/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java b/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java index e5101ec841..5975d010b4 100644 --- a/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java +++ b/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java @@ -40,11 +40,17 @@ import org.opengis.util.ControlledVocabulary; * implementation using Java reflection. * * @author Martin Desruisseaux (Geomatys) - * @version 1.0 + * @version 1.2 * @since 0.6 * @module */ public class MetadataServices extends OptionalDependency { + /** + * A pseudo-authority name used by {@link org.apache.sis.setup.InstallationResources} for identifying + * the embedded data resources. The actual data are provided by the metadata module. + */ + public static final String EMBEDDED = "Embedded"; + /** * The services, fetched when first needed. */ diff --git a/core/sis-utility/src/main/java/org/apache/sis/internal/util/URLs.java b/core/sis-utility/src/main/java/org/apache/sis/internal/util/URLs.java new file mode 100644 index 0000000000..1f49c4f770 --- /dev/null +++ b/core/sis-utility/src/main/java/org/apache/sis/internal/util/URLs.java @@ -0,0 +1,57 @@ +/* + * 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.internal.util; + +import org.apache.sis.util.Static; + + +/** + * Hard-coded URLs other than XML namespaces. + * The are mostly for documentation. + * + * @author Martin Desruisseaux (Geomatys) + * @version 1.2 + * @since 1.2 + * @module + */ +public final class URLs extends Static { + /** + * EPSG home page. + */ + public static final String EPSG = "https://epsg.org/"; + + /** + * EPSG terms of use. + */ + public static final String EPSG_LICENSE = "https://epsg.org/terms-of-use.html"; + + /** + * Installation instructions for EPSG database. + */ + public static final String EPSG_INSTALL = "https://sis.apache.org/epsg.html"; + + /** + * The Well-Known Text (WKT) 2 specification implemented by Apache SIS. + */ + public static final String WKT_SPECIFICATION = "http://docs.opengeospatial.org/is/12-063r5/12-063r5.html"; + + /** + * Do not allow instantiation of this class. + */ + private URLs() { + } +} diff --git a/core/sis-utility/src/main/java/org/apache/sis/setup/Configuration.java b/core/sis-utility/src/main/java/org/apache/sis/setup/Configuration.java index cd4a52a21f..21538bf16a 100644 --- a/core/sis-utility/src/main/java/org/apache/sis/setup/Configuration.java +++ b/core/sis-utility/src/main/java/org/apache/sis/setup/Configuration.java @@ -133,7 +133,7 @@ public final class Configuration { * The supplier may return {@code null}, in which case it will be ignored. * @throws IllegalStateException if {@link DataSource} has already be obtained before this method call. * - * @see <a href="http://sis.apache.org/epsg.html#jndi">How to use EPSG geodetic dataset</a> + * @see <a href="https://sis.apache.org/epsg.html#jndi">How to use EPSG geodetic dataset</a> */ public void setDatabase(final Supplier<DataSource> source) { ArgumentChecks.ensureNonNull("source", source); diff --git a/core/sis-utility/src/main/java/org/apache/sis/setup/InstallationResources.java b/core/sis-utility/src/main/java/org/apache/sis/setup/InstallationResources.java index 9143e5b60c..d47458a1f8 100644 --- a/core/sis-utility/src/main/java/org/apache/sis/setup/InstallationResources.java +++ b/core/sis-utility/src/main/java/org/apache/sis/setup/InstallationResources.java @@ -20,6 +20,9 @@ import java.util.Set; import java.util.Locale; import java.io.IOException; import java.io.BufferedReader; +import org.apache.sis.internal.util.URLs; +import org.apache.sis.internal.util.Constants; +import org.apache.sis.internal.util.MetadataServices; /** @@ -58,12 +61,12 @@ import java.io.BufferedReader; * * Above registration is usually done automatically when extension modules are added on the classpath. * For example adding the {@code org.apache.sis.non-free:sis-epsg} Maven dependency as documented on - * the <a href="http://sis.apache.org/epsg.html">Apache SIS web site</a> is the only step needed for + * the <a href="https://sis.apache.org/epsg.html">Apache SIS web site</a> is the only step needed for * allowing Apache SIS to read the EPSG scripts (however SIS still needs an installation directory * for writing the database; see above-cited web page for more information). * * @author Martin Desruisseaux (Geomatys) - * @version 0.8 + * @version 1.2 * @since 0.7 * @module */ @@ -100,6 +103,21 @@ public abstract class InstallationResources { */ public abstract Set<String> getAuthorities(); + /** + * Returns a URL where users can get more information about the installation process. + * + * @return URL to installation instruction, or {@code null} if none. + * + * @since 1.2 + */ + public String getInstructionURL() { + final Set<String> authorities = getAuthorities(); + if (authorities.contains(Constants.EPSG) || authorities.contains(MetadataServices.EMBEDDED)) { + return URLs.EPSG_INSTALL; + } + return null; + } + /** * Returns the terms of use of the resources distributed by the specified authority, or {@code null} if none. * The terms of use can be returned in either plain text or HTML. diff --git a/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/StoreTest.java b/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/StoreTest.java index bc72797a8b..094e32e035 100644 --- a/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/StoreTest.java +++ b/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/StoreTest.java @@ -68,7 +68,7 @@ public final strictfp class StoreTest extends TestCase { " <gmd:onlineResource>\n" + " <gmd:CI_OnlineResource>\n" + " <gmd:linkage>\n" + - " <gmd:URL>http://sis.apache.org</gmd:URL>\n" + + " <gmd:URL>https://sis.apache.org</gmd:URL>\n" + " </gmd:linkage>\n" + " <gmd:function>\n" + " <gmd:CI_OnLineFunctionCode codeListValue=\"information\" codeSpace=\"fra\">Information</gmd:CI_OnLineFunctionCode>\n" + @@ -106,7 +106,7 @@ public final strictfp class StoreTest extends TestCase { assertEquals(StandardCharsets.UTF_8, getSingleton(metadata.getLocalesAndCharsets().values())); assertEquals(Role.PRINCIPAL_INVESTIGATOR, resp.getRole()); assertEquals("Apache SIS", String.valueOf(party.getName())); - assertEquals("http://sis.apache.org", String.valueOf(resource.getLinkage())); + assertEquals("https://sis.apache.org", String.valueOf(resource.getLinkage())); assertEquals(OnLineFunction.INFORMATION, resource.getFunction()); } }