sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 01/01: Merge branch 'geoapi-4.0' into geoapi-3.1.
Date Sat, 28 Jul 2018 15:54:21 GMT
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-3.1
in repository https://gitbox.apache.org/repos/asf/sis.git

commit 794af35cdd2a4dc96906afc2124b05de8cd5a551
Merge: e044c13 188f5f5
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Sat Jul 28 16:33:11 2018 +0200

    Merge branch 'geoapi-4.0' into geoapi-3.1.

 .../sis/internal/jaxb/NonMarshalledAuthority.java  |   9 +
 .../sis/internal/jaxb/SpecializedIdentifier.java   |   2 +-
 .../sis/internal/jaxb/gco/ObjectReference.java     |   1 -
 .../apache/sis/internal/jaxb/lan/PT_FreeText.java  |   7 +-
 .../apache/sis/internal/jaxb/lan/TextGroup.java    |   1 -
 .../metadata/EllipsoidalHeightCombiner.java        |   4 +-
 .../sis/internal/metadata/MetadataUtilities.java   |  14 +-
 .../apache/sis/internal/metadata/Resources.java    | 128 ++++++++
 .../sis/internal/metadata/Resources.properties     |  23 ++
 .../sis/internal/metadata/Resources_fr.properties  |  28 ++
 .../sis/internal/metadata/ServicesForUtility.java  | 159 ----------
 .../internal/metadata/TransformationAccuracy.java  |   2 +-
 .../sis/internal/metadata/sql/ScriptRunner.java    |  43 ++-
 .../sis/internal/simple/CitationConstant.java      |  58 +++-
 .../org/apache/sis/metadata/MetadataStandard.java  |  68 ++--
 .../apache/sis/metadata/ModifiableMetadata.java    | 341 ++++++++++++---------
 .../org/apache/sis/metadata/PropertyAccessor.java  |   4 +-
 .../java/org/apache/sis/metadata/StateChanger.java |   9 +-
 .../org/apache/sis/metadata/TreeTableView.java     |  57 +++-
 .../iso/DefaultApplicationSchemaInformation.java   |  14 +-
 .../iso/DefaultExtendedElementInformation.java     |  20 +-
 .../apache/sis/metadata/iso/DefaultIdentifier.java |  10 +-
 .../apache/sis/metadata/iso/DefaultMetadata.java   |  25 +-
 .../iso/DefaultMetadataExtensionInformation.java   |   4 +-
 .../sis/metadata/iso/DefaultMetadataScope.java     |   4 +-
 .../org/apache/sis/metadata/iso/ISOMetadata.java   |  20 +-
 .../sis/metadata/iso/ImmutableIdentifier.java      |   4 +-
 .../acquisition/DefaultAcquisitionInformation.java |   2 +-
 .../acquisition/DefaultEnvironmentalRecord.java    |   8 +-
 .../sis/metadata/iso/acquisition/DefaultEvent.java |   8 +-
 .../iso/acquisition/DefaultInstrument.java         |   6 +-
 .../metadata/iso/acquisition/DefaultObjective.java |   2 +-
 .../metadata/iso/acquisition/DefaultOperation.java |  12 +-
 .../sis/metadata/iso/acquisition/DefaultPlan.java  |   6 +-
 .../metadata/iso/acquisition/DefaultPlatform.java  |   4 +-
 .../iso/acquisition/DefaultPlatformPass.java       |   2 +-
 .../iso/acquisition/DefaultRequestedDate.java      |   4 +-
 .../iso/acquisition/DefaultRequirement.java        |   8 +-
 .../sis/metadata/iso/citation/AbstractParty.java   |   2 +-
 .../sis/metadata/iso/citation/Citations.java       | 111 +++----
 .../sis/metadata/iso/citation/DefaultAddress.java  |   8 +-
 .../sis/metadata/iso/citation/DefaultCitation.java |  25 +-
 .../metadata/iso/citation/DefaultCitationDate.java |   4 +-
 .../sis/metadata/iso/citation/DefaultContact.java  |   4 +-
 .../metadata/iso/citation/DefaultIndividual.java   |   2 +-
 .../iso/citation/DefaultOnlineResource.java        |  14 +-
 .../iso/citation/DefaultResponsibility.java        |   2 +-
 .../iso/citation/DefaultResponsibleParty.java      |   6 +-
 .../sis/metadata/iso/citation/DefaultSeries.java   |   6 +-
 .../metadata/iso/citation/DefaultTelephone.java    |   4 +-
 .../iso/constraint/DefaultConstraints.java         |   4 +-
 .../iso/constraint/DefaultReleasability.java       |   2 +-
 .../iso/constraint/DefaultSecurityConstraints.java |   8 +-
 .../sis/metadata/iso/content/DefaultBand.java      |  16 +-
 .../iso/content/DefaultCoverageDescription.java    |  10 +-
 .../DefaultFeatureCatalogueDescription.java        |   8 +-
 .../iso/content/DefaultFeatureTypeInfo.java        |   4 +-
 .../iso/content/DefaultImageDescription.java       |  22 +-
 .../iso/content/DefaultRangeDimension.java         |   4 +-
 .../content/DefaultRangeElementDescription.java    |   4 +-
 .../iso/content/DefaultSampleDimension.java        |  26 +-
 .../metadata/iso/distribution/DefaultDataFile.java |   8 +-
 .../DefaultDigitalTransferOptions.java             |   6 +-
 .../iso/distribution/DefaultDistribution.java      |   2 +-
 .../iso/distribution/DefaultDistributor.java       |   2 +-
 .../metadata/iso/distribution/DefaultFormat.java   |  12 +-
 .../metadata/iso/distribution/DefaultMedium.java   |  10 +-
 .../distribution/DefaultStandardOrderProcess.java  |  14 +-
 .../iso/extent/AbstractGeographicExtent.java       |   2 +-
 .../sis/metadata/iso/extent/DefaultExtent.java     |  15 +-
 .../iso/extent/DefaultGeographicBoundingBox.java   |  40 ++-
 .../iso/extent/DefaultGeographicDescription.java   |   2 +-
 .../iso/extent/DefaultSpatialTemporalExtent.java   |   6 +-
 .../metadata/iso/extent/DefaultTemporalExtent.java |   6 +-
 .../metadata/iso/extent/DefaultVerticalExtent.java |  18 +-
 .../apache/sis/metadata/iso/extent/Extents.java    |   4 +-
 .../iso/identification/AbstractIdentification.java |   8 +-
 .../DefaultAggregateInformation.java               |   2 +-
 .../identification/DefaultAssociatedResource.java  |   8 +-
 .../iso/identification/DefaultBrowseGraphic.java   |   6 +-
 .../iso/identification/DefaultCoupledResource.java |   8 +-
 .../identification/DefaultDataIdentification.java  |   4 +-
 .../iso/identification/DefaultKeywordClass.java    |   6 +-
 .../iso/identification/DefaultKeywords.java        |   6 +-
 .../DefaultOperationChainMetadata.java             |   4 +-
 .../identification/DefaultOperationMetadata.java   |   6 +-
 .../DefaultRepresentativeFraction.java             |   8 +-
 .../iso/identification/DefaultResolution.java      |   2 +-
 .../DefaultServiceIdentification.java              |   6 +-
 .../metadata/iso/identification/DefaultUsage.java  |   8 +-
 .../sis/metadata/iso/lineage/DefaultAlgorithm.java |   4 +-
 .../sis/metadata/iso/lineage/DefaultLineage.java   |   4 +-
 .../iso/lineage/DefaultNominalResolution.java      |   4 +-
 .../metadata/iso/lineage/DefaultProcessStep.java   |  10 +-
 .../iso/lineage/DefaultProcessStepReport.java      |   6 +-
 .../metadata/iso/lineage/DefaultProcessing.java    |   4 +-
 .../sis/metadata/iso/lineage/DefaultSource.java    |  18 +-
 .../maintenance/DefaultMaintenanceInformation.java |  12 +-
 .../sis/metadata/iso/maintenance/DefaultScope.java |   2 +-
 .../iso/maintenance/DefaultScopeDescription.java   |   4 +-
 .../sis/metadata/iso/quality/AbstractElement.java  |  15 +-
 .../iso/quality/DefaultConformanceResult.java      |   6 +-
 .../iso/quality/DefaultCoverageResult.java         |  10 +-
 .../metadata/iso/quality/DefaultDataQuality.java   |   4 +-
 .../iso/quality/DefaultQuantitativeResult.java     |   6 +-
 .../sis/metadata/iso/spatial/DefaultDimension.java |  12 +-
 .../sis/metadata/iso/spatial/DefaultGCP.java       |   2 +-
 .../metadata/iso/spatial/DefaultGCPCollection.java |   6 +-
 .../iso/spatial/DefaultGeometricObjects.java       |   4 +-
 .../metadata/iso/spatial/DefaultGeorectified.java  |  10 +-
 .../iso/spatial/DefaultGeoreferenceable.java       |   8 +-
 .../spatial/DefaultGridSpatialRepresentation.java  |  17 +-
 .../DefaultVectorSpatialRepresentation.java        |   2 +-
 .../org/apache/sis/metadata/sql/Dispatcher.java    |  29 +-
 .../org/apache/sis/metadata/sql/Installer.java     |  34 +-
 .../apache/sis/metadata/sql/MetadataFallback.java  | 141 ++++++++-
 .../apache/sis/metadata/sql/MetadataSource.java    |  24 +-
 .../apache/sis/metadata/sql/MetadataWriter.java    |   2 +-
 .../apache/sis/metadata/sql/TableHierarchy.java    |  60 ++--
 .../org/apache/sis/metadata/sql/package-info.java  |   2 +-
 .../main/java/org/apache/sis/util/iso/Types.java   |  42 ++-
 .../org/apache/sis/metadata/sql/Citations.sql      | 228 ++++++++++++++
 .../org/apache/sis/metadata/sql/Contents.sql       |  60 ++++
 .../org/apache/sis/metadata/sql/Create.sql         | 133 --------
 .../internal/jaxb/cat/CodeListMarshallingTest.java |   5 +-
 .../internal/jaxb/lan/FreeTextMarshallingTest.java |   6 +-
 .../sis/metadata/ModifiableMetadataTest.java       | 188 ++++++++++++
 .../apache/sis/metadata/PropertyAccessorTest.java  |   2 -
 .../apache/sis/metadata/TreeTableFormatTest.java   |   4 -
 .../sis/metadata/iso/CustomMetadataTest.java       |   2 -
 .../sis/metadata/iso/ImmutableIdentifierTest.java  |   5 +-
 .../sis/metadata/iso/citation/CitationsTest.java   | 171 ++++++-----
 .../iso/citation/DefaultCitationDateTest.java      |   2 -
 .../metadata/iso/citation/DefaultCitationTest.java |   8 +-
 .../metadata/iso/citation/HardCodedCitations.java  |   8 +-
 .../DefaultRepresentativeFractionTest.java         |   4 +-
 .../quality/AbstractPositionalAccuracyTest.java    |   3 -
 .../sis/metadata/sql/MetadataFallbackVerifier.java | 141 +++++++++
 .../sis/metadata/sql/MetadataSourceTest.java       |  53 +++-
 .../apache/sis/test/suite/MetadataTestSuite.java   |   5 +-
 .../java/org/apache/sis/util/iso/TypesTest.java    |   5 +-
 .../apache/sis/xml/NilReasonMarshallingTest.java   |   5 +-
 .../org/apache/sis/xml/UUIDMarshallingTest.java    |   5 +-
 .../org/apache/sis/xml/XLinkMarshallingTest.java   |   5 +-
 .../referencing/PositionalAccuracyConstant.java    |   3 +-
 .../{PolarStereographicSouth.java => ESRI.java}    |  83 +++--
 .../internal/referencing/provider/Mollweide.java   |  99 ++++++
 .../provider/PolarStereographicSouth.java          |  35 +--
 .../apache/sis/referencing/IdentifiedObjects.java  |   2 +-
 .../apache/sis/referencing/NamedIdentifier.java    |   4 +-
 .../factory/ConcurrentAuthorityFactory.java        |   2 -
 .../referencing/factory/sql/EPSGDataAccess.java    |   5 +-
 .../operation/CoordinateOperationRegistry.java     |   2 +-
 .../operation/projection/Mollweide.java            | 182 +++++++++++
 .../operation/projection/NormalizedProjection.java |  33 +-
 ...g.opengis.referencing.operation.OperationMethod |   1 +
 .../referencing/provider/ProvidersTest.java        |   1 +
 .../sis/referencing/NamedIdentifierTest.java       |   2 +-
 .../operation/projection/MollweideTest.java        | 167 ++++++++++
 .../org/apache/sis/test/ReferencingAssert.java     |   2 +-
 .../sis/test/suite/ReferencingTestSuite.java       |   1 +
 .../apache/sis/internal/util/CollectionsExt.java   |  51 ++-
 .../sis/internal/util/TreeFormatCustomization.java |  46 +++
 .../java/org/apache/sis/measure/AbstractUnit.java  |   4 +-
 .../main/java/org/apache/sis/measure/Salinity.java |   7 +-
 .../java/org/apache/sis/measure/UnitFormat.java    |  69 ++++-
 .../java/org/apache/sis/measure/UnitRegistry.java  |  22 +-
 .../main/java/org/apache/sis/measure/Units.java    |  15 +-
 .../java/org/apache/sis/measure/package-info.java  |   2 +-
 .../sis/util/collection/TreeTableFormat.java       |  62 ++--
 .../java/org/apache/sis/util/resources/Errors.java |   7 +-
 .../apache/sis/util/resources/Errors.properties    |   1 -
 .../apache/sis/util/resources/Errors_fr.properties |   1 -
 .../org/apache/sis/measure/UnitFormatTest.java     |  35 ++-
 .../java/org/apache/sis/measure/UnitsTest.java     |  16 +-
 ide-project/NetBeans/build.xml                     |   3 +
 ide-project/NetBeans/nbproject/project.xml         |   4 +-
 .../storage/earthobservation/LandsatReader.java    |   6 +-
 .../org/apache/sis/storage/gdal/Proj4Factory.java  |   2 +-
 .../org/apache/sis/storage/netcdf/NetcdfStore.java |   2 +-
 .../org/apache/sis/storage/sql/package-info.java   |  22 +-
 .../sis/internal/storage/AbstractFeatureSet.java   |   2 +-
 .../sis/internal/storage/MetadataBuilder.java      |   2 +-
 .../org/apache/sis/storage/StorageConnector.java   |   6 +-
 184 files changed, 2943 insertions(+), 1266 deletions(-)

diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultApplicationSchemaInformation.java
index cba8d6b,14bcb47..ac60d20
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultApplicationSchemaInformation.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultApplicationSchemaInformation.java
@@@ -257,14 -254,10 +257,14 @@@ public class DefaultApplicationSchemaIn
      /**
       * Sets the full application schema given as an ASCII file.
       *
 +     * <div class="warning"><b>Upcoming API change</b><br>
 +     * {@code URI} may be replaced by {@link CharSequence} in GeoAPI 4.0.
 +     * </div>
 +     *
       * @param  newValue  the new ASCII file.
       */
 -    public void setSchemaAscii(final CharSequence newValue) {
 +    public void setSchemaAscii(final URI newValue) {
-         checkWritePermission();
+         checkWritePermission(schemaAscii);
          schemaAscii = newValue;
      }
  
@@@ -288,15 -276,10 +288,15 @@@
      /**
       * Sets the full application schema given as a graphics file.
       *
 +     * <div class="warning"><b>Upcoming API change</b><br>
 +     * As of ISO 19115:2014, {@code URI} is replaced by {@link OnlineResource}.
 +     * This change may be applied in GeoAPI 4.0.
 +     * </div>
 +     *
       * @param  newValue  the new graphics file.
       */
 -    public void setGraphicsFile(final OnlineResource newValue) {
 +    public void setGraphicsFile(final URI newValue) {
-         checkWritePermission();
+         checkWritePermission(graphicsFile);
          graphicsFile = newValue;
      }
  
@@@ -320,15 -298,10 +320,15 @@@
      /**
       * Sets the full application schema given as a software development file.
       *
 +     * <div class="warning"><b>Upcoming API change</b><br>
 +     * As of ISO 19115:2014, {@code URI} is replaced by {@link OnlineResource}.
 +     * This change may be applied in GeoAPI 4.0.
 +     * </div>
 +     *
       * @param  newValue  the new software development file.
       */
 -    public void setSoftwareDevelopmentFile(final OnlineResource newValue) {
 +    public void setSoftwareDevelopmentFile(final URI newValue) {
-         checkWritePermission();
+         checkWritePermission(softwareDevelopmentFile);
          softwareDevelopmentFile = newValue;
      }
  
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java
index b16b150,5cee8a2..1aa20c9
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java
@@@ -877,9 -874,8 +879,8 @@@ public class DefaultMetadata extends IS
       *
       * @param  newValues  the new contacts.
       */
 -    public void setContacts(final Collection<? extends Responsibility> newValues)
{
 -        contacts = writeCollection(newValues, contacts, Responsibility.class);
 +    public void setContacts(final Collection<? extends ResponsibleParty> newValues)
{
-         checkWritePermission();
 +        contacts = writeCollection(newValues, contacts, ResponsibleParty.class);
      }
  
      /**
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java
index 23b0091,6d8f04d..5c5da01
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java
@@@ -210,14 -206,10 +210,14 @@@ public class DefaultOnlineResource exte
      /**
       * Sets the name of the online resource.
       *
 +     * <div class="warning"><b>Upcoming API change — internationalization</b><br>
 +     * The argument type may be changed from {@code String} to {@code InternationalString}
in GeoAPI 4.0.
 +     * </div>
 +     *
       * @param  newValue  the new name, or {@code null} if none.
       */
 -    public void setName(final InternationalString newValue) {
 +    public void setName(final String newValue) {
-         checkWritePermission();
+         checkWritePermission(name);
          name = newValue;
      }
  
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultSeries.java
index c1c6fe0,26bcde0..ade0a02
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultSeries.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultSeries.java
@@@ -168,15 -163,10 +168,15 @@@ public class DefaultSeries extends ISOM
      /**
       * Sets information identifying the issue of the series.
       *
 +     * <div class="warning"><b>Upcoming API change — generalization</b><br>
 +     * As of ISO 19115:2014, {@code String} is replaced by the {@link InternationalString}
interface.
 +     * This change will be tentatively applied in GeoAPI 4.0.
 +     * </div>
 +     *
       * @param  newValue  the new issue identification, or {@code null} if none.
       */
 -    public void setIssueIdentification(final InternationalString newValue) {
 +    public void setIssueIdentification(final String newValue) {
-         checkWritePermission();
+         checkWritePermission(issueIdentification);
          issueIdentification = newValue;
      }
  
@@@ -199,15 -184,10 +199,15 @@@
      /**
       * Sets details on which pages of the publication the article was published.
       *
 +     * <div class="warning"><b>Upcoming API change — generalization</b><br>
 +     * As of ISO 19115:2014, {@code String} is replaced by the {@link InternationalString}
interface.
 +     * This change will be tentatively applied in GeoAPI 4.0.
 +     * </div>
 +     *
       * @param  newValue  the new page, or {@code null} if none.
       */
 -    public void setPage(final InternationalString newValue) {
 +    public void setPage(final String newValue) {
-         checkWritePermission();
+         checkWritePermission(page);
          page = newValue;
      }
  }
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultDistributor.java
index 2e972bf,3d47d7d..a213eec
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultDistributor.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultDistributor.java
@@@ -171,15 -166,10 +171,15 @@@ public class DefaultDistributor extend
      /**
       * Sets the party from whom the resource may be obtained.
       *
 +     * <div class="warning"><b>Upcoming API change — generalization</b><br>
 +     * As of ISO 19115:2014, {@code ResponsibleParty} is replaced by the {@code Responsibility}
parent interface.
 +     * This change may be applied in GeoAPI 4.0.
 +     * </div>
 +     *
       * @param  newValue  the new distributor contact.
       */
 -    public void setDistributorContact(final Responsibility newValue) {
 +    public void setDistributorContact(final ResponsibleParty newValue) {
-         checkWritePermission();
+         checkWritePermission(distributorContact);
          distributorContact = newValue;
      }
  
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java
index c9c0221,2000a20..5e014a7
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java
@@@ -509,14 -458,10 +509,14 @@@ public class DefaultScopeDescription ex
       * If and only if the {@code newValue} is non-null, then this method automatically
       * discards all other properties.
       *
 +     * <div class="warning"><b>Upcoming API change:</b>
 +     * The type of this property may be changed to {@link InternationalString} for ISO 19115:2014
conformance.
 +     * See <a href="http://jira.codehaus.org/browse/GEO-221">GEO-221</a> for
more information.</div>
 +     *
       * @param newValue Other class of information.
       */
 -    public void setOther(final InternationalString newValue) {
 +    public void setOther(final String newValue) {
-         checkWritePermission();
+         checkWritePermission(value);
          if (newValue != null || property == OTHER) {
              warningOnOverwrite(OTHER);
              property = OTHER;
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/Dispatcher.java
index e1c7611,6cc95e5..956b3a9
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/Dispatcher.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/Dispatcher.java
@@@ -31,6 -32,6 +32,10 @@@ import org.apache.sis.metadata.ValueExi
  import org.apache.sis.internal.system.Semaphores;
  import org.apache.sis.internal.metadata.Dependencies;
  
++// Branch-dependent imports
++import org.opengis.metadata.citation.Responsibility;
++import org.opengis.metadata.citation.ResponsibleParty;
++
  
  /**
   * The handler for metadata proxy that implement (indirectly) metadata interfaces like
@@@ -126,7 -127,7 +131,7 @@@ final class Dispatcher implements Invoc
       * @return the value to be returned from the public method invoked by the method.
       */
      @Override
--    public Object invoke(final Object proxy, final Method method, final Object[] args) {
++    public Object invoke(final Object proxy, Method method, final Object[] args) {
          final int n = (args != null) ? args.length : 0;
          switch (method.getName()) {
              case "toString": {
@@@ -155,6 -156,6 +160,7 @@@
                   */
                  Object value;
                  try {
++                    method = supercede(method);
                      value = fetchValue(source.getLookupInfo(method.getDeclaringClass()),
method);
                  } catch (ReflectiveOperationException | SQLException | MetadataStoreException
e) {
                      throw new BackingStoreException(error(method), e);
@@@ -312,4 -317,4 +322,17 @@@
      public String toString() {
          return toString(getClass());
      }
++
++    /**
++     * If the given method is superceded by a new method, the new method.
++     * This is a hack for transition from legacy ISO type to newer type:
++     * {@code ResponsibleParty.getRole()} overriding {@code Responsibility.getRole()}
++     * confuses this {@code Dispatcher} class. We need the method in the base interface.
++     */
++    private static Method supercede(Method method) throws NoSuchMethodException {
++        if (method.getDeclaringClass() == ResponsibleParty.class && "getRole".equals(method.getName()))
{
++            method = Responsibility.class.getMethod("getRole");
++        }
++        return method;
++    }
  }
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataFallback.java
index 7a8ec06,4a43928..e74023c
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataFallback.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataFallback.java
@@@ -17,12 -17,21 +17,23 @@@
  package org.apache.sis.metadata.sql;
  
  import org.opengis.util.ControlledVocabulary;
+ import org.opengis.metadata.citation.Role;
  import org.opengis.metadata.citation.Citation;
- import org.apache.sis.internal.metadata.ServicesForUtility;
+ import org.opengis.metadata.citation.PresentationForm;
+ import org.apache.sis.metadata.iso.ImmutableIdentifier;
+ import org.apache.sis.metadata.iso.citation.DefaultCitation;
+ import org.apache.sis.metadata.iso.citation.DefaultOrganisation;
 -import org.apache.sis.metadata.iso.citation.DefaultResponsibility;
+ import org.apache.sis.internal.util.Constants;
+ import org.apache.sis.util.iso.Types;
  import org.apache.sis.util.ArgumentChecks;
  import org.apache.sis.util.logging.WarningListener;
  import org.apache.sis.xml.NilReason;
  
+ import static java.util.Collections.singleton;
+ 
++// Branch-dependent import
++import org.apache.sis.metadata.iso.citation.DefaultResponsibleParty;
++
  
  /**
   * A fallback providing hard-coded values of metadata entities.
@@@ -87,6 -95,130 +97,131 @@@ final class MetadataFallback extends Me
      }
  
      /**
+      * Returns the build-in citation for the given primary key, or {@code null}.
+      * The content in this method should be consistent with the content provided
+      * in the {@code "Citations.sql"} script (this is verified by JUnit tests).
+      *
+      * @param  key  the primary key of the desired citation.
+      * @return the requested citation, or {@code null} if unknown.
+      */
+     static Citation createCitation(final String key) {
+         CharSequence     title;
+         CharSequence     alternateTitle        = null;
+         CharSequence     edition               = null;
+         String           code                  = null;
+         String           codeSpace             = null;
+         String           version               = null;
+         CharSequence     citedResponsibleParty = null;
+         PresentationForm presentationForm      = null;
+         String           copyFrom              = null;      // Copy citedResponsibleParty
from those citations.
+         switch (key) {
+             case "ISO 19115-1": {
+                 title     = "Geographic Information — Metadata Part 1: Fundamentals";
+                 edition   = "ISO 19115-1:2014(E)";
+                 code      = "19115-1";
+                 codeSpace = "ISO";
+                 version   = "2014(E)";
+                 citedResponsibleParty = "International Organization for Standardization";
+                 presentationForm = PresentationForm.DOCUMENT_DIGITAL;
+                 break;
+             }
+             case "ISO 19115-2": {
+                 title     = "Geographic Information — Metadata Part 2: Extensions for
imagery and gridded data";
+                 edition   = "ISO 19115-2:2009(E)";
+                 code      = "19115-2";
+                 codeSpace = "ISO";
+                 version   = "2009(E)";
+                 copyFrom  = "ISO 19115-1";
+                 presentationForm = PresentationForm.DOCUMENT_DIGITAL;
+                 break;
+             }
+             case "WMS": {
+                 title             = "Web Map Server";
+                 alternateTitle    = "WMS";
+                 edition = version = "1.3";
+                 code              = "WMS";      // Note: OGC internal code is 06-042.
+                 codeSpace         = "OGC";
+                 copyFrom          = "OGC";
+                 presentationForm  = PresentationForm.DOCUMENT_DIGITAL;
+                 break;
+             }
+             case "OGC": {
+                 title                 = "OGC Naming Authority";
+                 code                  = Constants.OGC;
+                 citedResponsibleParty = "Open Geospatial Consortium";
+                 presentationForm      = PresentationForm.DOCUMENT_DIGITAL;
+                 break;
+             }
+             case "IOGP": {          // Not in public API (see Citations.IOGP javadoc)
+                 title = "IOGP Surveying and Positioning Guidance Note 7";
+                 code             = Constants.IOGP;
+                 copyFrom         = Constants.EPSG;
+                 presentationForm = PresentationForm.DOCUMENT_DIGITAL;
+                 break;
+             }
+             case Constants.EPSG: {
+                 title                 = "EPSG Geodetic Parameter Dataset";
+                 alternateTitle        = "EPSG Dataset";
+                 code                  = Constants.EPSG;
+                 codeSpace             = Constants.IOGP;
+                 citedResponsibleParty = "International Association of Oil & Gas producers";
+                 presentationForm      = PresentationForm.TABLE_DIGITAL;
+                 break;
+             }
+             case Constants.SIS: {
+                 title     = "Apache Spatial Information System";
+                 code      = key;
+                 codeSpace = "Apache";
+                 break;
+             }
+             case "ISBN": {
+                 title = "International Standard Book Number";
+                 alternateTitle = key;
+                 break;
+             }
+             case "ISSN": {
+                 title = "International Standard Serial Number";
+                 alternateTitle = key;
+                 break;
+             }
+             case Constants.PROJ4: {
+                 title     = "Proj";
+                 code      = "Proj4";
+                 codeSpace = "OSGeo";
+                 break;
+             }
+             case "IHO S-57": {
+                 title = code     = "S-57";
+                 codeSpace        = "IHO";
+                 version          = "3.1";
+                 presentationForm = PresentationForm.DOCUMENT_DIGITAL;
+                 break;
+             }
+             default: return null;
+         }
+         /*
+          * Do not use the 'c.getFoo().add(foo)' pattern below. Use the 'c.setFoo(singleton(foo))'
pattern instead.
+          * This is because this method may be invoked during XML serialization, in which
case some getter methods
+          * may return null (for preventing JAXB to marshal some empty elements).
+          */
+         final DefaultCitation c = new DefaultCitation(title);
+         if (alternateTitle        != null) c.setAlternateTitles(singleton(Types.toInternationalString(alternateTitle)));
+         if (edition               != null) c.setEdition(Types.toInternationalString(edition));
+         if (code                  != null) c.setIdentifiers(singleton(new ImmutableIdentifier(null,
codeSpace, code, version, null)));
+         if (presentationForm      != null) c.setPresentationForms(singleton(presentationForm));
+         if (citedResponsibleParty != null) {
 -            c.setCitedResponsibleParties(singleton(new DefaultResponsibility(Role.PRINCIPAL_INVESTIGATOR,
null,
 -                    new DefaultOrganisation(citedResponsibleParty, null, null, null))));
++            final DefaultResponsibleParty r = new DefaultResponsibleParty(Role.PRINCIPAL_INVESTIGATOR);
++            r.setParties(singleton(new DefaultOrganisation(citedResponsibleParty, null,
null, null)));
++            c.setCitedResponsibleParties(singleton(r));
+         }
+         if (copyFrom != null) {
+             c.setCitedResponsibleParties(createCitation(copyFrom).getCitedResponsibleParties());
+         }
+         c.transition(DefaultCitation.State.FINAL);
+         return c;
+     }
+ 
+     /**
       * Ignored.
       */
      @Override
diff --cc core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java
index 5c33496,dee83e6..461039a
--- a/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java
+++ b/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java
@@@ -86,14 -86,11 +86,10 @@@ public final strictfp class TreeTableFo
          assertMultilinesEquals(
              "Citation………………………………………………………………………………
Undercurrent\n" +
              "  ├─Alternate title…………………………………………………
Andākarento\n" +
-             "  ├─Identifier………………………………………………………………
9782505004509\n" +
-             "  │   ├─Authority………………………………………………………
International Standard Book Number\n" +
-             "  │   │   └─Alternate title……………………………
ISBN\n" +
-             "  │   └─Code space……………………………………………………
ISBN\n"+
              "  ├─Cited responsible party (1 of 2)\n" +
 -            "  │   ├─Role……………………………………………………………………
Author\n" +
 -            "  │   └─Individual……………………………………………………
Testsuya Toyoda\n" +
 +            "  │   ├─Individual……………………………………………………
Testsuya Toyoda\n" +
 +            "  │   └─Role……………………………………………………………………
Author\n" +
              "  ├─Cited responsible party (2 of 2)\n" +
 -            "  │   ├─Role……………………………………………………………………
Editor\n" +
              "  │   ├─Extent………………………………………………………………
World\n" +
              "  │   │   └─Geographic element\n" +
              "  │   │       ├─West bound longitude…… 180°W\n" +
diff --cc core/sis-metadata/src/test/java/org/apache/sis/metadata/sql/MetadataSourceTest.java
index e8697b6,ca045d9..de424ce
--- a/core/sis-metadata/src/test/java/org/apache/sis/metadata/sql/MetadataSourceTest.java
+++ b/core/sis-metadata/src/test/java/org/apache/sis/metadata/sql/MetadataSourceTest.java
@@@ -57,6 -79,11 +79,10 @@@ public final strictfp class MetadataSou
              source.install();
              verifyFormats(source);
              testSearch(source);
 -            testEmptyCollection(source);
+             ensureReadOnly(source);
+ 
+             // Opportunistic verification using the database we have at hand.
+             MetadataFallbackVerifier.compare(source);
          }
      }
  
@@@ -107,4 -134,40 +133,25 @@@
          specification.setTitle(null);
          assertNull(source.search(format));
      }
+ 
+     /**
 -     * Verifies that empty collections are empty, not-null.
 -     *
 -     * @param  source  the instance to test.
 -     * @throws MetadataStoreException if an error occurred while querying the database.
 -     */
 -    @TestStep
 -    public static void testEmptyCollection(final MetadataSource source) throws MetadataStoreException
{
 -        final Citation c = source.lookup(Citation.class, "SIS");
 -        final Collection<?> details = c.getOtherCitationDetails();
 -        assertNotNull("Empty collection should not be null.", details);
 -        assertTrue("Expected an empty collection.", details.isEmpty());
 -        assertSame("Collection shall be unmodifiable.", Collections.EMPTY_LIST, details);
 -    }
 -
 -    /**
+      * Verifies that instances created by {@link MetadataSource} are read-only.
+      * In particular, it should not be possible to add elements in the collection.
+      *
+      * @param  source  the instance to test.
+      * @throws MetadataStoreException if an error occurred while querying the database.
+      */
+     @TestStep
+     public static void ensureReadOnly(final MetadataSource source) throws MetadataStoreException
{
+         final Citation c = source.lookup(Citation.class, "SIS");
+         @SuppressWarnings("unchecked")                                  // Cheat or the
purpose of this test.
+         final Collection<InternationalString> titles = (Collection<InternationalString>)
c.getAlternateTitles();
+         final InternationalString more = new SimpleInternationalString("An open source project.");
+         try {
+             titles.add(more);
+             fail("Pre-defined metadata should be unmodifiable.");
+         } catch (UnsupportedOperationException e) {
+             // This is the expected exception.
+         }
+     }
  }


Mime
View raw message