sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1819746 - in /sis/branches/ISO-19115-3/core: sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gts/ sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/ sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/ sis...
Date Sun, 31 Dec 2017 23:31:50 GMT
Author: desruisseaux
Date: Sun Dec 31 23:31:50 2017
New Revision: 1819746

URL: http://svn.apache.org/viewvc?rev=1819746&view=rev
Log: (empty)

Added:
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_FeatureTypeInfo.java
  (with props)
Modified:
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gts/TM_PeriodDuration.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultBand.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultCoverageDescription.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultFeatureCatalogueDescription.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/package-info.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultDigitalTransferOptions.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultResolution.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/MarshallingTest.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Real.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/UnitAdapter.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/resources/org/apache/sis/xml/NamespaceContent.txt

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gts/TM_PeriodDuration.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gts/TM_PeriodDuration.java?rev=1819746&r1=1819745&r2=1819746&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gts/TM_PeriodDuration.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gts/TM_PeriodDuration.java
[UTF-8] Sun Dec 31 23:31:50 2017
@@ -45,11 +45,11 @@ import org.apache.sis.util.iso.SimpleInt
  * @since   0.3
  * @module
  */
-public final class TM_PeriodDuration extends PropertyType<TM_PeriodDuration, PeriodDuration>
{
+public class TM_PeriodDuration extends PropertyType<TM_PeriodDuration, PeriodDuration>
{
     /**
      * Empty constructor for JAXB.
      */
-    public TM_PeriodDuration() {
+    TM_PeriodDuration() {
     }
 
     /**
@@ -78,7 +78,7 @@ public final class TM_PeriodDuration ext
      * @return {@code PeriodDuration.class}
      */
     @Override
-    protected Class<PeriodDuration> getBoundType() {
+    protected final Class<PeriodDuration> getBoundType() {
         return PeriodDuration.class;
     }
 
@@ -89,7 +89,7 @@ public final class TM_PeriodDuration ext
      * @return the time period, or {@code null}.
      */
     @XmlElement(name = "TM_PeriodDuration")
-    public Duration getElement() {
+    public final Duration getElement() {
         return toXML(metadata);
     }
 
@@ -142,7 +142,7 @@ public final class TM_PeriodDuration ext
      *
      * @param  duration  the adapter to set.
      */
-    public void setElement(final Duration duration) {
+    public final void setElement(final Duration duration) {
         metadata = toISO(duration);
     }
 
@@ -196,4 +196,23 @@ public final class TM_PeriodDuration ext
             Context.warningOccured(Context.current(), TM_PeriodDuration.class, methodName,
e, true);
         }
     }
+
+    /**
+     * Wraps the value only if marshalling ISO 19115-3 element.
+     * Otherwise (i.e. if marshalling a legacy ISO 19139:2007 document), omit the element.
+     */
+    public static final class Since2014 extends TM_PeriodDuration {
+        /** Empty constructor used only by JAXB. */
+        private Since2014() {
+        }
+
+        /**
+         * Wraps the given value in an ISO 19115-3 element, unless we are marshalling an
older document.
+         *
+         * @return a non-null value only if marshalling ISO 19115-3 or newer.
+         */
+        @Override protected TM_PeriodDuration wrap(final PeriodDuration value) {
+            return accept2014() ? super.wrap(value) : null;
+        }
+    }
 }

Added: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_FeatureTypeInfo.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_FeatureTypeInfo.java?rev=1819746&view=auto
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_FeatureTypeInfo.java
(added)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_FeatureTypeInfo.java
[UTF-8] Sun Dec 31 23:31:50 2017
@@ -0,0 +1,93 @@
+/*
+ * 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.jaxb.metadata;
+
+import javax.xml.bind.annotation.XmlElementRef;
+
+import org.apache.sis.internal.jaxb.gco.PropertyType;
+import org.apache.sis.metadata.iso.content.DefaultFeatureTypeInfo;
+import org.opengis.metadata.content.FeatureTypeInfo;
+
+
+/**
+ * JAXB adapter mapping implementing class to the GeoAPI interface. See
+ * package documentation for more information about JAXB and interface.
+ *
+ * @author  Cullen Rombach (Image Matters)
+ * @since   1.0
+ * @version 1.0
+ * @module
+ */
+public final class MD_FeatureTypeInfo extends PropertyType<MD_FeatureTypeInfo, FeatureTypeInfo>
{
+    /**
+     * Empty constructor for JAXB only.
+     */
+    public MD_FeatureTypeInfo() {
+    }
+
+    /**
+     * Returns the GeoAPI interface which is bound by this adapter.
+     * This method is indirectly invoked by the private constructor
+     * below, so it shall not depend on the state of this object.
+     *
+     * @return {@code FeatureTypeInfo.class}
+     */
+    @Override
+    protected Class<FeatureTypeInfo> getBoundType() {
+        return FeatureTypeInfo.class;
+    }
+
+    /**
+     * Constructor for the {@link #wrap} method only.
+     */
+    private MD_FeatureTypeInfo(final FeatureTypeInfo metadata) {
+        super(metadata);
+    }
+
+    /**
+     * Invoked by {@link PropertyType} at marshalling time for wrapping the given metadata
value
+     * in a {@code <gmd:MD_FeatureTypeInfo>} XML element.
+     *
+     * @param  metadata  the metadata element to marshall.
+     * @return a {@code PropertyType} wrapping the given the metadata element.
+     */
+    @Override
+    protected MD_FeatureTypeInfo wrap(final FeatureTypeInfo metadata) {
+        return new MD_FeatureTypeInfo(metadata);
+    }
+
+    /**
+     * Invoked by JAXB at marshalling time for getting the actual metadata to write
+     * inside the {@code <gmd:MD_FeatureTypeInfo>} XML element.
+     * This is the value or a copy of the value given in argument to the {@code wrap} method.
+     *
+     * @return the metadata to be marshalled.
+     */
+    @XmlElementRef
+    public DefaultFeatureTypeInfo getElement() {
+        return DefaultFeatureTypeInfo.castOrCopy(metadata);
+    }
+
+    /**
+     * Invoked by JAXB at unmarshalling time for storing the result temporarily.
+     *
+     * @param  metadata  the unmarshalled metadata.
+     */
+    public void setElement(final DefaultFeatureTypeInfo metadata) {
+        this.metadata = metadata;
+    }
+}

Propchange: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_FeatureTypeInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_FeatureTypeInfo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultBand.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultBand.java?rev=1819746&r1=1819745&r2=1819746&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultBand.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultBand.java
[UTF-8] Sun Dec 31 23:31:50 2017
@@ -22,12 +22,14 @@ import javax.xml.bind.annotation.XmlElem
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlSeeAlso;
 import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 import org.opengis.metadata.content.Band;
 import org.opengis.metadata.content.BandDefinition;
 import org.opengis.metadata.content.PolarizationOrientation;
 import org.opengis.metadata.content.TransferFunctionType;
-import org.apache.sis.xml.Namespaces;
 import org.apache.sis.measure.ValueRange;
+import org.apache.sis.internal.jaxb.gco.GO_Real;
+import org.apache.sis.internal.jaxb.gco.UnitAdapter;
 
 import static org.apache.sis.internal.metadata.MetadataUtilities.ensurePositive;
 
@@ -53,12 +55,16 @@ import static org.apache.sis.internal.me
  * @author  Touraïvane (IRD)
  * @author  Cédric Briançon (Geomatys)
  * @author  Rémi Maréchal (Geomatys)
- * @version 0.5
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.3
  * @module
  */
 @SuppressWarnings("CloneableClassWithoutClone")                 // ModifiableMetadata needs
shallow clones.
 @XmlType(name = "MD_Band_Type", propOrder = {
+    "boundMax",
+    "boundMin",
+    "boundUnits",
     "peakResponse",
     "bitsPerValue",
     "toneGradation",
@@ -190,7 +196,8 @@ public class DefaultBand extends Default
      */
     @Override
     @ValueRange(minimum = 0)
-/// @XmlElement(name = "boundMin")
+    @XmlElement(name = "boundMin")
+    @XmlJavaTypeAdapter(GO_Real.Since2014.class)
     public Double getBoundMin() {
         return boundMin;
     }
@@ -221,7 +228,8 @@ public class DefaultBand extends Default
      */
     @Override
     @ValueRange(minimum = 0)
-/// @XmlElement(name = "boundMax")
+    @XmlElement(name = "boundMax")
+    @XmlJavaTypeAdapter(GO_Real.Since2014.class)
     public Double getBoundMax() {
         return boundMax;
     }
@@ -251,7 +259,8 @@ public class DefaultBand extends Default
      * @see org.apache.sis.measure.Units#NANOMETRE
      */
     @Override
-/// @XmlElement(name = "boundUnits")
+    @XmlElement(name = "boundUnits")
+    @XmlJavaTypeAdapter(UnitAdapter.Since2014.class)
     public Unit<Length> getBoundUnits() {
         return boundUnits;
     }
@@ -274,7 +283,7 @@ public class DefaultBand extends Default
      * @return criterion for defining maximum and minimum wavelengths, or {@code null}.
      */
     @Override
-    @XmlElement(name = "bandBoundaryDefinition", namespace = Namespaces.GMI)
+    @XmlElement(name = "bandBoundaryDefinition")
     public BandDefinition getBandBoundaryDefinition() {
         return bandBoundaryDefinition;
     }
@@ -396,7 +405,7 @@ public class DefaultBand extends Default
      */
     @Override
     @ValueRange(minimum = 0, isMinIncluded = false)
-    @XmlElement(name = "nominalSpatialResolution", namespace = Namespaces.GMI)
+    @XmlElement(name = "nominalSpatialResolution")
     public Double getNominalSpatialResolution() {
         return super.getNominalSpatialResolution();
     }
@@ -413,7 +422,7 @@ public class DefaultBand extends Default
      * {@inheritDoc}
      */
     @Override
-    @XmlElement(name = "transferFunctionType", namespace = Namespaces.GMI)
+    @XmlElement(name = "transferFunctionType")
     public TransferFunctionType getTransferFunctionType() {
         return super.getTransferFunctionType();
     }
@@ -432,7 +441,7 @@ public class DefaultBand extends Default
      * @return polarization of the radiation transmitted, or {@code null}.
      */
     @Override
-    @XmlElement(name = "transmittedPolarization", namespace = Namespaces.GMI)
+    @XmlElement(name = "transmittedPolarization")
     public PolarizationOrientation getTransmittedPolarization() {
         return transmittedPolarization;
     }
@@ -453,7 +462,7 @@ public class DefaultBand extends Default
      * @return polarization of the radiation detected, or {@code null}.
      */
     @Override
-    @XmlElement(name = "detectedPolarization", namespace = Namespaces.GMI)
+    @XmlElement(name = "detectedPolarization")
     public PolarizationOrientation getDetectedPolarization() {
         return detectedPolarization;
     }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultCoverageDescription.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultCoverageDescription.java?rev=1819746&r1=1819745&r2=1819746&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultCoverageDescription.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultCoverageDescription.java
[UTF-8] Sun Dec 31 23:31:50 2017
@@ -31,7 +31,6 @@ import org.opengis.metadata.content.Imag
 import org.opengis.metadata.content.RangeDimension;
 import org.opengis.metadata.content.RangeElementDescription;
 import org.opengis.util.RecordType;
-import org.apache.sis.xml.Namespaces;
 import org.apache.sis.internal.metadata.Dependencies;
 import org.apache.sis.internal.metadata.LegacyPropertyAdapter;
 import org.apache.sis.internal.jaxb.FilterByVersion;
@@ -358,7 +357,7 @@ public class DefaultCoverageDescription
      * @return description of the specific range elements of a coverage.
      */
     @Override
-    @XmlElement(name = "rangeElementDescription", namespace = Namespaces.GMI)
+    @XmlElement(name = "rangeElementDescription")
     public Collection<RangeElementDescription> getRangeElementDescriptions() {
         return rangeElementDescriptions = nonNullCollection(rangeElementDescriptions, RangeElementDescription.class);
     }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultFeatureCatalogueDescription.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultFeatureCatalogueDescription.java?rev=1819746&r1=1819745&r2=1819746&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultFeatureCatalogueDescription.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultFeatureCatalogueDescription.java
[UTF-8] Sun Dec 31 23:31:50 2017
@@ -25,6 +25,7 @@ import org.opengis.util.GenericName;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.metadata.content.FeatureCatalogueDescription;
 import org.opengis.metadata.content.FeatureTypeInfo;
+import org.apache.sis.internal.jaxb.FilterByVersion;
 import org.apache.sis.internal.metadata.Dependencies;
 import org.apache.sis.internal.metadata.LegacyPropertyAdapter;
 
@@ -51,7 +52,8 @@ import org.apache.sis.internal.metadata.
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Touraïvane (IRD)
  * @author  Cédric Briançon (Geomatys)
- * @version 0.5
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -60,7 +62,8 @@ import org.apache.sis.internal.metadata.
     "compliant",
     "languages",
     "includedWithDataset",
-    "featureTypes",
+    "featureTypesInfo",             // New in ISO 19115:2014. Actual name is "featureTypeInfo"
+    "featureTypes",                 // Legacy ISO 19115:2003
     "featureCatalogueCitations"
 })
 @XmlRootElement(name = "MD_FeatureCatalogueDescription")
@@ -222,6 +225,7 @@ public class DefaultFeatureCatalogueDesc
      * @since 0.5
      */
     @Override
+    // @XmlElement at the end of this class.
     public Collection<FeatureTypeInfo> getFeatureTypeInfo() {
         return featureTypes = nonNullCollection(featureTypes, FeatureTypeInfo.class);
     }
@@ -249,6 +253,7 @@ public class DefaultFeatureCatalogueDesc
     @XmlElement(name = "featureTypes")
     @Dependencies("getFeatureTypeInfo")
     public final Collection<GenericName> getFeatureTypes() {
+        if (!FilterByVersion.LEGACY_METADATA.accept()) return null;
         return new LegacyPropertyAdapter<GenericName,FeatureTypeInfo>(getFeatureTypeInfo())
{
             /** Stores a legacy value into the new kind of value. */
             @Override protected FeatureTypeInfo wrap(final GenericName value) {
@@ -303,4 +308,28 @@ public class DefaultFeatureCatalogueDesc
     public void setFeatureCatalogueCitations(final Collection<? extends Citation> newValues)
{
         featureCatalogueCitations = writeCollection(newValues, featureCatalogueCitations,
Citation.class);
     }
+
+
+
+
+    //////////////////////////////////////////////////////////////////////////////////////////////////
+    ////////                                                                            
     ////////
+    ////////                               XML support with JAXB                        
     ////////
+    ////////                                                                            
     ////////
+    ////////        The following methods are invoked by JAXB using reflection (even if 
     ////////
+    ////////        they are private) or are helpers for other methods invoked by JAXB. 
     ////////
+    ////////        Those methods can be safely removed if Geographic Markup Language   
     ////////
+    ////////        (GML) support is not needed.                                        
     ////////
+    ////////                                                                            
     ////////
+    //////////////////////////////////////////////////////////////////////////////////////////////////
+
+    /**
+     * Invoked by JAXB at both marshalling and unmarshalling time.
+     * This attribute has been added by ISO 19115:2014 standard.
+     * If (and only if) marshalling an older standard version, we omit this attribute.
+     */
+    @XmlElement(name = "featureTypeInfo")
+    private Collection<FeatureTypeInfo> getFeatureTypesInfo() {
+        return FilterByVersion.CURRENT_METADATA.accept() ? getFeatureTypeInfo() : null;
+    }
 }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/package-info.java?rev=1819746&r1=1819745&r2=1819746&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/package-info.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/package-info.java
[UTF-8] Sun Dec 31 23:31:50 2017
@@ -100,6 +100,7 @@
     @XmlJavaTypeAdapter(CI_Citation.class),
     @XmlJavaTypeAdapter(MD_AttributeGroup.class),
     @XmlJavaTypeAdapter(MD_CoverageContentTypeCode.class),
+    @XmlJavaTypeAdapter(MD_FeatureTypeInfo.class),
     @XmlJavaTypeAdapter(MD_Identifier.class),
     @XmlJavaTypeAdapter(MD_ImagingConditionCode.class),
     @XmlJavaTypeAdapter(MD_RangeDimension.class),

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultDigitalTransferOptions.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultDigitalTransferOptions.java?rev=1819746&r1=1819745&r2=1819746&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultDigitalTransferOptions.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultDigitalTransferOptions.java
[UTF-8] Sun Dec 31 23:31:50 2017
@@ -20,6 +20,7 @@ import java.util.Collection;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 import org.opengis.util.InternationalString;
 import org.opengis.temporal.PeriodDuration;
 import org.opengis.metadata.citation.OnlineResource;
@@ -30,6 +31,9 @@ import org.apache.sis.internal.metadata.
 import org.apache.sis.measure.ValueRange;
 import org.apache.sis.metadata.iso.ISOMetadata;
 import org.apache.sis.internal.metadata.Dependencies;
+import org.apache.sis.internal.jaxb.gts.TM_PeriodDuration;
+import org.apache.sis.internal.jaxb.FilterByVersion;
+import org.apache.sis.internal.util.CollectionsExt;
 
 import static org.apache.sis.internal.metadata.MetadataUtilities.ensurePositive;
 
@@ -49,16 +53,19 @@ import static org.apache.sis.internal.me
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Touraïvane (IRD)
  * @author  Cédric Briançon (Geomatys)
- * @version 0.5
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.3
  * @module
  */
 @SuppressWarnings("CloneableClassWithoutClone")                 // ModifiableMetadata needs
shallow clones.
 @XmlType(name = "MD_DigitalTransferOptions_Type", propOrder = {
     "unitsOfDistribution",
+    "distributionFormat",
     "transferSize",
+    "transferFrequency",
     "onLines",
-    "offLine"
+    "offLines"
 })
 @XmlRootElement(name = "MD_DigitalTransferOptions")
 public class DefaultDigitalTransferOptions extends ISOMetadata implements DigitalTransferOptions
{
@@ -233,8 +240,14 @@ public class DefaultDigitalTransferOptio
      * @since 0.5
      */
     @Override
+    @XmlElement(name = "offLine")
     public Collection<Medium> getOffLines() {
-        return offLines = nonNullCollection(offLines, Medium.class);
+        Collection<Medium> c = offLines = nonNullCollection(offLines, Medium.class);
+        if (c != null && c.size() > 1 && FilterByVersion.LEGACY_METADATA.accept())
{
+            c = CollectionsExt.singletonOrEmpty(LegacyPropertyAdapter.getSingleton(c,
+                    Medium.class, null, DefaultDigitalTransferOptions.class, "getOffLines"));
+        }
+        return c;
     }
 
     /**
@@ -257,7 +270,6 @@ public class DefaultDigitalTransferOptio
      */
     @Override
     @Deprecated
-    @XmlElement(name = "offLine")
     @Dependencies("getOffLines")
     public Medium getOffLine() {
         return LegacyPropertyAdapter.getSingleton(getOffLines(), Medium.class, null, DefaultDigitalTransferOptions.class,
"getOffLine");
@@ -283,6 +295,8 @@ public class DefaultDigitalTransferOptio
      * @since 0.5
      */
     @Override
+    @XmlElement(name = "transferFrequency")
+    @XmlJavaTypeAdapter(TM_PeriodDuration.Since2014.class)
     public PeriodDuration getTransferFrequency() {
         return transferFrequency;
     }
@@ -307,6 +321,7 @@ public class DefaultDigitalTransferOptio
      * @since 0.5
      */
     @Override
+    // @XmlElement at the end of this class.
     public Collection<Format> getDistributionFormats() {
         return distributionFormats = nonNullCollection(distributionFormats, Format.class);
     }
@@ -321,4 +336,28 @@ public class DefaultDigitalTransferOptio
     public void setDistributionFormats(final Collection<? extends Format> newValues)
{
         distributionFormats = writeCollection(newValues, distributionFormats, Format.class);
     }
+
+
+
+
+    //////////////////////////////////////////////////////////////////////////////////////////////////
+    ////////                                                                            
     ////////
+    ////////                               XML support with JAXB                        
     ////////
+    ////////                                                                            
     ////////
+    ////////        The following methods are invoked by JAXB using reflection (even if 
     ////////
+    ////////        they are private) or are helpers for other methods invoked by JAXB. 
     ////////
+    ////////        Those methods can be safely removed if Geographic Markup Language   
     ////////
+    ////////        (GML) support is not needed.                                        
     ////////
+    ////////                                                                            
     ////////
+    //////////////////////////////////////////////////////////////////////////////////////////////////
+
+    /**
+     * Invoked by JAXB at both marshalling and unmarshalling time.
+     * This attribute has been added by ISO 19115:2014 standard.
+     * If (and only if) marshalling an older standard version, we omit this attribute.
+     */
+    @XmlElement(name = "distributionFormat")
+    private Collection<Format> getDistributionFormat() {
+        return FilterByVersion.CURRENT_METADATA.accept() ? getDistributionFormats() : null;
+    }
 }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultResolution.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultResolution.java?rev=1819746&r1=1819745&r2=1819746&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultResolution.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultResolution.java
[UTF-8] Sun Dec 31 23:31:50 2017
@@ -25,6 +25,8 @@ import org.opengis.metadata.identificati
 import org.opengis.metadata.identification.Resolution;
 import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.internal.jaxb.gco.GO_Distance;
+import org.apache.sis.internal.jaxb.gco.GO_Real;
+import org.apache.sis.internal.jaxb.gco.InternationalStringAdapter;
 import org.apache.sis.metadata.iso.ISOMetadata;
 import org.apache.sis.measure.ValueRange;
 import org.apache.sis.util.resources.Messages;
@@ -63,7 +65,8 @@ import static org.apache.sis.internal.me
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Touraïvane (IRD)
  * @author  Cédric Briançon (Geomatys)
- * @version 0.6
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  *
  * @see AbstractIdentification#getSpatialResolutions()
  *
@@ -291,6 +294,8 @@ public class DefaultResolution extends I
      */
     @Override
     @ValueRange(minimum=0, isMinIncluded=false)
+    @XmlElement(name = "vertical")
+    @XmlJavaTypeAdapter(GO_Real.Since2014.class)
     public Double getVertical() {
         return (property == VERTICAL) ? (Double) value : null;
     }
@@ -322,6 +327,7 @@ public class DefaultResolution extends I
      */
     @Override
     @ValueRange(minimum=0, isMinIncluded=false)
+    @XmlJavaTypeAdapter(GO_Real.Since2014.class)
     public Double getAngularDistance() {
         return (property == ANGULAR) ? (Double) value : null;
     }
@@ -352,6 +358,8 @@ public class DefaultResolution extends I
      * @since 0.5
      */
     @Override
+    @XmlElement(name = "levelOfDetail")
+    @XmlJavaTypeAdapter(InternationalStringAdapter.Since2014.class)
     public InternationalString getLevelOfDetail() {
         return (property == TEXT) ? (InternationalString) value : null;
     }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/MarshallingTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/MarshallingTest.java?rev=1819746&r1=1819745&r2=1819746&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/MarshallingTest.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/MarshallingTest.java
[UTF-8] Sun Dec 31 23:31:50 2017
@@ -412,9 +412,9 @@ public final class MarshallingTest exten
                 // Attribute description TODO: this doesn't work properly.
                 final DefaultRecordSchema schema = new DefaultRecordSchema(null, null, "MySchema");
                 final Map<CharSequence,Class<?>> members = new LinkedHashMap<>();
-                members.put("city",        String.class);
-                members.put("latitude",    Double.class);
-                members.put("longitude",   Double.class);
+                members.put("city",      String.class);
+                members.put("latitude",  Double.class);
+                members.put("longitude", Double.class);
                 final RecordType recordType = schema.createRecordType("MyRecordType", members);
                 coverageDescription.setAttributeDescription(recordType);
                 {
@@ -443,6 +443,8 @@ public final class MarshallingTest exten
             }
             // Feature Catalogue Description
             final DefaultFeatureCatalogueDescription featureCatalogueDescription = new DefaultFeatureCatalogueDescription();
+            featureCatalogueDescription.setIncludedWithDataset(true);
+            featureCatalogueDescription.setCompliant(true);
             md.setContentInfo(Arrays.asList(coverageDescription, featureCatalogueDescription));
         }
         return md;

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Real.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Real.java?rev=1819746&r1=1819745&r2=1819746&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Real.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Real.java
[UTF-8] Sun Dec 31 23:31:50 2017
@@ -74,7 +74,7 @@ public class GO_Real extends PropertyTyp
      *         by {@code <gco:Real>} element.
      */
     @Override
-    public GO_Real wrap(final Double value) {
+    protected GO_Real wrap(final Double value) {
         return new GO_Real(value);
     }
 
@@ -112,7 +112,7 @@ public class GO_Real extends PropertyTyp
          *
          * @return a non-null value only if marshalling ISO 19115-3 or newer.
          */
-        @Override public GO_Real wrap(final Double value) {
+        @Override protected GO_Real wrap(final Double value) {
             return accept2014() ? super.wrap(value) : null;
         }
     }

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/UnitAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/UnitAdapter.java?rev=1819746&r1=1819745&r2=1819746&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/UnitAdapter.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/UnitAdapter.java
[UTF-8] Sun Dec 31 23:31:50 2017
@@ -19,6 +19,7 @@ package org.apache.sis.internal.jaxb.gco
 import javax.measure.Unit;
 import javax.xml.bind.annotation.adapters.XmlAdapter;
 import org.apache.sis.internal.jaxb.Context;
+import org.apache.sis.internal.jaxb.FilterByVersion;
 import org.apache.sis.internal.jaxb.gml.Measure;
 
 
@@ -27,7 +28,7 @@ import org.apache.sis.internal.jaxb.gml.
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
  *
  * @see Measure
  *
@@ -78,4 +79,23 @@ public class UnitAdapter extends XmlAdap
             return Measure.getUOM(value, false, true);
         }
     }
+
+    /**
+     * Wraps the value only if marshalling ISO 19115-3 element.
+     * Otherwise (i.e. if marshalling a legacy ISO 19139:2007 document), omit the element.
+     */
+    public static final class Since2014 extends UnitAdapter {
+        /** Empty constructor used only by JAXB. */
+        private Since2014() {
+        }
+
+        /**
+         * Wraps the given value in an ISO 19115-3 element, unless we are marshalling an
older document.
+         *
+         * @return a non-null value only if marshalling ISO 19115-3 or newer.
+         */
+        @Override public String marshal(final Unit<?> value) {
+            return FilterByVersion.CURRENT_METADATA.accept() ? super.marshal(value) : null;
+        }
+    }
 }

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/resources/org/apache/sis/xml/NamespaceContent.txt
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/resources/org/apache/sis/xml/NamespaceContent.txt?rev=1819746&r1=1819745&r2=1819746&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/resources/org/apache/sis/xml/NamespaceContent.txt
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/resources/org/apache/sis/xml/NamespaceContent.txt
[UTF-8] Sun Dec 31 23:31:50 2017
@@ -514,6 +514,7 @@ http://standards.iso.org/iso/19115/-3/mr
     contentType
   MD_Band
     <type>
+    bandBoundaryDefinition
     bitsPerValue
     description
     descriptor
@@ -547,6 +548,7 @@ http://standards.iso.org/iso/19115/-3/mr
     <type>
     complianceCode
     featureCatalogueCitation
+    featureTypeInfo
     featureTypes
     includedWithDataset
     language
@@ -582,12 +584,17 @@ http://standards.iso.org/iso/19115/-3/mr
   MD_SampleDimension
     <type>
     bitsPerValue
+    boundMax
+    boundMin
+    boundUnits
     description
     descriptor
+    detectedPolarization
     maxValue
     meanValue
     minValue
     name
+    nominalSpatialResolution
     numberOfValues
     offset
     otherProperty
@@ -595,10 +602,15 @@ http://standards.iso.org/iso/19115/-3/mr
     scaleFactor
     sequenceIdentifier
     standardDeviation
+    transferFunctionType
+    transmittedPolarization
     units
   MI_Band
     bandBoundaryDefinition
     bitsPerValue
+    boundMax
+    boundMin
+    boundUnits
     description
     descriptor
     detectedPolarization
@@ -647,8 +659,10 @@ http://standards.iso.org/iso/19115/-3/mr
 http://standards.iso.org/iso/19115/-3/mrd/1.0
   MD_DigitalTransferOptions
     <type>
+    distributionFormat
     offLine
     onLine
+    transferFrequency
     transferSize
     unitsOfDistribution
   MD_Distribution
@@ -773,8 +787,11 @@ http://standards.iso.org/iso/19115/-3/mr
     denominator
   MD_Resolution
     <type>
+    angularDistance
     distance
     equivalentScale
+    levelOfDetail
+    vertical
   MD_Usage
     <type>
     additionalDocumentation
@@ -1242,12 +1259,6 @@ http://www.isotc211.org/2005/gmi
   LI_Source
     processedLevel
     resolution
-  MD_Band
-    bandBoundaryDefinition
-    detectedPolarization
-    nominalSpatialResolution
-    transferFunctionType
-    transmittedPolarization
   MD_Georectified
     checkPoint
   MD_Georeferenceable



Mime
View raw message