Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultCoupledResource.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultCoupledResource.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultCoupledResource.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultCoupledResource.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -19,20 +19,23 @@ package org.apache.sis.metadata.iso.iden import java.util.Collection; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementRef; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; import org.opengis.util.ScopedName; import org.opengis.metadata.citation.Citation; import org.opengis.metadata.identification.DataIdentification; import org.opengis.metadata.identification.CoupledResource; import org.opengis.metadata.identification.OperationMetadata; import org.apache.sis.metadata.iso.ISOMetadata; -import org.apache.sis.internal.jaxb.metadata.direct.GO_ScopedName; +import org.apache.sis.internal.jaxb.metadata.SV_OperationMetadata; +import org.apache.sis.internal.jaxb.FilterByVersion; +import org.apache.sis.internal.jaxb.LegacyNamespaces; +import org.apache.sis.internal.jaxb.gco.GO_GenericName; +import org.apache.sis.util.iso.DefaultNameSpace; +import org.apache.sis.util.iso.Names; import org.apache.sis.xml.Namespaces; -import static org.apache.sis.internal.jaxb.gco.PropertyType.LEGACY_XML; - /** * Links a given operation name with a resource identified by an "identifier". @@ -48,18 +51,20 @@ import static org.apache.sis.internal.ja * * @author Rémi Maréchal (Geomatys) * @author Martin Desruisseaux (Geomatys) - * @version 0.5 + * @author Cullen Rombach (Image Matters) + * @version 1.0 * @since 0.5 * @module */ @SuppressWarnings("CloneableClassWithoutClone") // ModifiableMetadata needs shallow clones. @XmlType(name = "SV_CoupledResource_Type", namespace = Namespaces.SRV, propOrder = { - "operationName", - "identifier", - "scopedName" /*, - "resourceReferences", - "resources", - "operation" */ + "scopedName", // ISO 19115-3:2016 way to write scoped name + "resourceReference", // New in ISO 19115:2014 + "resource", // Ibid. + "operation", // Ibid. + "operationName", // Legacy ISO 19139:2007 + "identifier", // Ibid. + "legacyName" // Legacy ISO 19139:2007 way to write scoped name }) @XmlRootElement(name = "SV_CoupledResource", namespace = Namespaces.SRV) public class DefaultCoupledResource extends ISOMetadata implements CoupledResource { @@ -163,8 +168,8 @@ public class DefaultCoupledResource exte * @return identifier of the resource, or {@code null} if none. */ @Override - @XmlElementRef - @XmlJavaTypeAdapter(GO_ScopedName.class) + @XmlElement(name = "scopedName") + @XmlJavaTypeAdapter(GO_GenericName.Since2014.class) public ScopedName getScopedName() { return scopedName; } @@ -185,7 +190,7 @@ public class DefaultCoupledResource exte * @return references to the resource on which the services operates. */ @Override -/// @XmlElement(name = "resourceReference", namespace = Namespaces.SRV) + // @XmlElement at the end of this class. public Collection<Citation> getResourceReferences() { return resourceReferences = nonNullCollection(resourceReferences, Citation.class); } @@ -205,7 +210,7 @@ public class DefaultCoupledResource exte * @return tightly coupled resources. */ @Override -/// @XmlElement(name = "resource", namespace = Namespaces.SRV) + // @XmlElement at the end of this class. public Collection<DataIdentification> getResources() { return resources = nonNullCollection(resources, DataIdentification.class); } @@ -225,7 +230,8 @@ public class DefaultCoupledResource exte * @return the service operation, or {@code null} if none. */ @Override -/// @XmlElement(name = "operation", namespace = Namespaces.SRV) + @XmlElement(name = "operation") + @XmlJavaTypeAdapter(SV_OperationMetadata.Since2014.class) public OperationMetadata getOperation() { return operation; } @@ -255,11 +261,11 @@ public class DefaultCoupledResource exte ////////////////////////////////////////////////////////////////////////////////////////////////// /** - * For JAXB marhalling of ISO 19119 document only. + * For JAXB marshalling of ISO 19139:2007 document only (XML based on legacy ISO 19115:2003 model). */ - @XmlElement(name = "operationName", namespace = Namespaces.SRV) + @XmlElement(name = "operationName", namespace = LegacyNamespaces.SRV) private String getOperationName() { - if (LEGACY_XML) { + if (FilterByVersion.LEGACY_METADATA.accept()) { final OperationMetadata operation = getOperation(); if (operation != null) { return operation.getOperationName(); @@ -269,10 +275,11 @@ public class DefaultCoupledResource exte } /** - * For JAXB unmarhalling of ISO 19119 document only. Sets {@link #operation} to a temporary - * {@link OperationName} placeholder. That temporary instance will be replaced by the real - * one when the enclosing {@link DefaultServiceIdentification} is unmarshalled. + * For JAXB unmarhalling of ISO 19139:2007 document only. Sets {@link #operation} to a temporary + * {@link OperationName} placeholder. That temporary instance will be replaced by the real one + * when the enclosing {@link DefaultServiceIdentification} is unmarshalled. */ + @SuppressWarnings("unused") private void setOperationName(final String name) { if (operation == null) { operation = new OperationName(name); @@ -281,10 +288,12 @@ public class DefaultCoupledResource exte /** * Returns the resource identifier, which is assumed to be the name as a string. + * Used in legacy ISO 19139:2007 documents. There is no setter method; we expect + * the XML to declare {@code <srv:operationName>} instead. */ - @XmlElement(name = "identifier", namespace = Namespaces.SRV) + @XmlElement(name = "identifier", namespace = LegacyNamespaces.SRV) private String getIdentifier() { - if (LEGACY_XML) { + if (FilterByVersion.LEGACY_METADATA.accept()) { final ScopedName name = getScopedName(); if (name != null) { return name.tip().toString(); @@ -292,4 +301,60 @@ public class DefaultCoupledResource exte } return null; } + + /** + * Returns the {@code <gco:ScopedName>} element to marshal in legacy ISO 19139:2007 element. + * The {@code <srv:scopedName>} element wrapper (note the lower-case "s") was missing in that + * legacy specification. This departure from ISO patterns has been fixed in ISO 19115-3:2016. + * + * <p>Note that the namespace is {@value Namespaces#GCO} rather than {@value LegacyNamespaces#GCO} + * because this is the namespace of the {@link ScopedName} type, not the namespace of a property + * in {@code SV_CoupledResource}.</p> + */ + @XmlElement(name = "ScopedName", namespace = Namespaces.GCO) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + private String getLegacyName() { + if (FilterByVersion.LEGACY_METADATA.accept()) { + final ScopedName name = getScopedName(); + if (name != null) return name.toString(); + } + return null; + } + + /** + * Invoked by JAXB when unmarshalling a legacy ISO 19139:2007 documents. + */ + @SuppressWarnings("unused") + private void setLegacyName(String value) { + if (value != null && !value.isEmpty()) { + /* + * If the given name does not have a namespace, add an arbitrary namespace + * in order to get an instanceof ScopedName instead of LocalName after parsing. + */ + if (value.indexOf(DefaultNameSpace.DEFAULT_SEPARATOR) < 0) { + value = "global" + DefaultNameSpace.DEFAULT_SEPARATOR + value; + } + setScopedName((ScopedName) Names.parseGenericName(null, null, value)); + } + } + + /** + * 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 = "resourceReference") + private Collection<Citation> getResourceReference() { + return FilterByVersion.CURRENT_METADATA.accept() ? getResourceReferences() : null; + } + + /** + * 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 = "resource") + private Collection<DataIdentification> getResource() { + return FilterByVersion.CURRENT_METADATA.accept() ? getResources() : null; + } }
Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -22,13 +22,16 @@ import java.nio.charset.Charset; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; -import org.opengis.metadata.extent.Extent; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import org.opengis.util.InternationalString; import org.opengis.metadata.citation.Citation; import org.opengis.metadata.identification.TopicCategory; import org.opengis.metadata.identification.DataIdentification; -import org.opengis.util.InternationalString; - -import static org.apache.sis.internal.jaxb.gco.PropertyType.LEGACY_XML; +import org.apache.sis.internal.metadata.OtherLocales; +import org.apache.sis.internal.jaxb.gmd.LocaleAdapter; +import org.apache.sis.internal.jaxb.LegacyNamespaces; +import org.apache.sis.internal.jaxb.FilterByVersion; +import org.apache.sis.internal.util.CollectionsExt; /** @@ -62,18 +65,28 @@ import static org.apache.sis.internal.ja * @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_DataIdentification_Type", propOrder = { - "languages", - "characterSets", - "topicCategory", + "language", // Legacy ISO 19115:2003 + "characterSets", // Legacy ISO 19115:2003 + "defaultLocale", // New in ISO 19115:2014 + "otherLocales", // New in ISO 19115:2014 "environmentDescription", - "extent", "supplementalInformation" + /* + * In ISO 19115:2003, we had an "topicCategory" attribute before "environmentDescription" + * and an "extent" attribute before "supplementalInformation". In ISO 19115:2014 revision, + * those attributes moved to the parent class. Apache SIS 1.0 aligns itself on the latest + * standard, but the consequence is that attribute order is wrong when marshalling an ISO + * 19139:2007 document. We could workaround by defining private methods, but it confuses + * PropertyAccessor. We choose to avoid this complication in this class and handle element + * reordering in org.apache.sis.xml.TransformingWriter instead. + */ }) @XmlRootElement(name = "MD_DataIdentification") public class DefaultDataIdentification extends AbstractIdentification implements DataIdentification { @@ -184,7 +197,7 @@ public class DefaultDataIdentification e * @see Locale#getISO3Language() */ @Override - @XmlElement(name = "language", required = true) + // @XmlElement at the end of this class. public Collection<Locale> getLanguages() { return languages = nonNullCollection(languages, Locale.class); } @@ -204,7 +217,7 @@ public class DefaultDataIdentification e * @return character coding standard(s) used. */ @Override - @XmlElement(name = "characterSet") + @XmlElement(name = "characterSet", namespace = LegacyNamespaces.GMD) public Collection<Charset> getCharacterSets() { return characterSets = nonNullCollection(characterSets, Charset.class); } @@ -276,32 +289,36 @@ public class DefaultDataIdentification e ////////////////////////////////////////////////////////////////////////////////////////////////// /** - * For JAXB marhalling of ISO 19115:2003 document only. + * Gets the default locale for this record (used in ISO 19115-3 format). */ - @XmlElement(name = "topicCategory") - private Collection<TopicCategory> getTopicCategory() { - return LEGACY_XML ? getTopicCategories() : null; + @XmlElement(name = "defaultLocale") + private Locale getDefaultLocale() { + return FilterByVersion.CURRENT_METADATA.accept() ? CollectionsExt.first(getLanguages()) : null; } /** - * For JAXB unmarhalling of ISO 19115:2003 document only. + * Sets the default locale for this record (used in ISO 19115-3 format). */ - private void setTopicCategory(final Collection<? extends TopicCategory> newValues) { - setTopicCategories(newValues); + @SuppressWarnings("unused") + private void setDefaultLocale(final Locale newValue) { + setLanguages(OtherLocales.setFirst(languages, newValue)); } /** - * For JAXB marhalling of ISO 19115:2003 document only. + * Gets the other locales for this record (used in ISO 19115-3 format). */ - @XmlElement(name = "extent") - private Collection<Extent> getExtent() { - return LEGACY_XML ? getExtents() : null; + @XmlElement(name = "otherLocale") + private Collection<Locale> getOtherLocales() { + return FilterByVersion.CURRENT_METADATA.accept() ? OtherLocales.filter(getLanguages()) : null; } /** - * For JAXB unmarhalling of ISO 19115:2003 document only. + * Returns the locale to marshal if the XML document is to be written + * according the legacy ISO 19115:2003 model. */ - private void setExtent(final Collection<? extends Extent> newValues) { - setExtents(newValues); + @XmlElement(name = "language", namespace = LegacyNamespaces.GMD) + @XmlJavaTypeAdapter(LocaleAdapter.class) + private Collection<Locale> getLanguage() { + return FilterByVersion.LEGACY_METADATA.accept() ? getLanguages() : null; } } Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultKeywordClass.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultKeywordClass.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultKeywordClass.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultKeywordClass.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -49,7 +49,7 @@ import org.apache.sis.util.iso.Types; * </ul> * * @author Martin Desruisseaux (Geomatys) - * @version 0.5 + * @version 1.0 * @since 0.5 * @module */ Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultKeywords.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultKeywords.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultKeywords.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultKeywords.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -20,11 +20,13 @@ 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.metadata.citation.Citation; import org.opengis.metadata.identification.Keywords; import org.opengis.metadata.identification.KeywordType; import org.opengis.metadata.identification.KeywordClass; +import org.apache.sis.internal.jaxb.metadata.MD_KeywordClass; import org.apache.sis.metadata.iso.ISOMetadata; import org.apache.sis.util.iso.Types; @@ -48,7 +50,8 @@ import org.apache.sis.util.iso.Types; * @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 */ @@ -56,7 +59,8 @@ import org.apache.sis.util.iso.Types; @XmlType(name = "MD_Keywords_Type", propOrder = { "keywords", "type", - "thesaurusName" + "thesaurusName", + "keywordClass" }) @XmlRootElement(name = "MD_Keywords") public class DefaultKeywords extends ISOMetadata implements Keywords { @@ -226,6 +230,8 @@ public class DefaultKeywords extends ISO * @since 0.5 */ @Override + @XmlElement(name = "keywordClass") + @XmlJavaTypeAdapter(MD_KeywordClass.Since2014.class) public KeywordClass getKeywordClass() { return keywordClass; } Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationChainMetadata.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationChainMetadata.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationChainMetadata.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationChainMetadata.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -52,7 +52,7 @@ import org.apache.sis.xml.Namespaces; * * @author Rémi Maréchal (Geomatys) * @author Martin Desruisseaux (Geomatys) - * @version 0.5 + * @version 1.0 * @since 0.5 * @module */ Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationMetadata.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationMetadata.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationMetadata.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationMetadata.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -22,12 +22,12 @@ import javax.xml.bind.annotation.XmlType import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import org.opengis.util.InternationalString; -import org.apache.sis.metadata.iso.ISOMetadata; -import org.apache.sis.metadata.TitleProperty; +import org.opengis.parameter.ParameterDescriptor; import org.opengis.metadata.citation.OnlineResource; import org.opengis.metadata.identification.DistributedComputingPlatform; import org.opengis.metadata.identification.OperationMetadata; -import org.opengis.parameter.ParameterDescriptor; +import org.apache.sis.metadata.iso.ISOMetadata; +import org.apache.sis.metadata.TitleProperty; import org.apache.sis.xml.Namespaces; @@ -52,7 +52,8 @@ import org.apache.sis.xml.Namespaces; * * @author Rémi Maréchal (Geomatys) * @author Martin Desruisseaux (Geomatys) - * @version 0.5 + * @author Cullen Rombach (Image Matters) + * @version 1.0 * @since 0.5 * @module */ @@ -60,11 +61,11 @@ import org.apache.sis.xml.Namespaces; @TitleProperty(name = "operationName") @XmlType(name = "SV_OperationMetadata_Type", namespace = Namespaces.SRV, propOrder = { "operationName", - "distributedComputingPlatforms", + "distributedComputingPlatforms", // Singular form used in ISO 19115:2014, was "DCP" in ISO 19115:2003. "operationDescription", "invocationName", - "parameters", - "connectPoints", + "connectPoints", // Was after "parameters" in ISO 19115:2003. + "parameters", // Actually "parameter" in ISO 19115:2014, was "parameters" in ISO 19115:2003. "dependsOn" }) @XmlRootElement(name = "SV_OperationMetadata", namespace = Namespaces.SRV) @@ -140,7 +141,7 @@ public class DefaultOperationMetadata ex * * @see #castOrCopy(OperationMetadata) */ - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "rawtypes"}) public DefaultOperationMetadata(final OperationMetadata object) { super(object); if (object != null) { @@ -185,7 +186,7 @@ public class DefaultOperationMetadata ex * @return an unique identifier for this interface. */ @Override - @XmlElement(name = "operationName", namespace = Namespaces.SRV, required = true) + @XmlElement(name = "operationName", required = true) public String getOperationName() { return operationName; } @@ -206,7 +207,7 @@ public class DefaultOperationMetadata ex * @return distributed computing platforms on which the operation has been implemented. */ @Override - @XmlElement(name = "DCP", namespace = Namespaces.SRV, required = true) + @XmlElement(name = "distributedComputingPlatform", required = true) public Collection<DistributedComputingPlatform> getDistributedComputingPlatforms() { return distributedComputingPlatforms = nonNullCollection(distributedComputingPlatforms, DistributedComputingPlatform.class); } @@ -226,7 +227,7 @@ public class DefaultOperationMetadata ex * @return free text description of the intent of the operation and the results of the operation, or {@code null} if none. */ @Override - @XmlElement(name = "operationDescription", namespace = Namespaces.SRV) + @XmlElement(name = "operationDescription") public InternationalString getOperationDescription() { return operationDescription; } @@ -248,7 +249,7 @@ public class DefaultOperationMetadata ex * or {@code null} if none. */ @Override - @XmlElement(name = "invocationName", namespace = Namespaces.SRV) + @XmlElement(name = "invocationName") public InternationalString getInvocationName() { return invocationName; } @@ -269,7 +270,7 @@ public class DefaultOperationMetadata ex * @return handle for accessing the service interface. */ @Override - @XmlElement(name = "connectPoint", namespace = Namespaces.SRV, required = true) + @XmlElement(name = "connectPoint", required = true) public Collection<OnlineResource> getConnectPoints() { return connectPoints = nonNullCollection(connectPoints, OnlineResource.class); } @@ -289,8 +290,8 @@ public class DefaultOperationMetadata ex * @return the parameters that are required for this interface, or an empty collection if none. */ @Override - @SuppressWarnings("unchecked") - @XmlElement(name = "parameters", namespace = Namespaces.SRV) + @XmlElement(name = "parameter") + @SuppressWarnings({"unchecked", "rawtypes"}) public Collection<ParameterDescriptor<?>> getParameters() { return parameters = nonNullCollection(parameters, (Class) ParameterDescriptor.class); } @@ -300,7 +301,7 @@ public class DefaultOperationMetadata ex * * @param newValues the new set of parameters that are required for this interface. */ - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "rawtypes"}) public void setParameters(final Collection<? extends ParameterDescriptor<?>> newValues) { parameters = writeCollection(newValues, parameters, (Class) ParameterDescriptor.class); } @@ -311,7 +312,7 @@ public class DefaultOperationMetadata ex * @return list of operation that must be completed immediately, or an empty list if none. */ @Override - @XmlElement(name = "dependsOn", namespace = Namespaces.SRV) + @XmlElement(name = "dependsOn") public List<OperationMetadata> getDependsOn() { return dependsOn = nonNullList(dependsOn, OperationMetadata.class); } Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultRepresentativeFraction.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultRepresentativeFraction.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultRepresentativeFraction.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultRepresentativeFraction.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -69,7 +69,7 @@ import static org.apache.sis.internal.me * * @author Cédric Briançon (Geomatys) * @author Martin Desruisseaux (Geomatys) - * @version 0.7 + * @version 1.0 * * @see DefaultResolution#getEquivalentScale() * @@ -411,6 +411,7 @@ public class DefaultRepresentativeFracti * * @see org.apache.sis.metadata.iso.ISOMetadata#setID(String) */ + @SuppressWarnings("unused") private void setID(String id) { MetadataUtilities.setObjectID(this, id); } @@ -431,6 +432,7 @@ public class DefaultRepresentativeFracti * * @see org.apache.sis.metadata.iso.ISOMetadata#setUUID(String) */ + @SuppressWarnings("unused") private void setUUID(final String id) { getIdentifierMap().put(IdentifierSpace.UUID, id); } Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultResolution.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultResolution.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultResolution.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultResolution.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -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,8 @@ public class DefaultResolution extends I */ @Override @ValueRange(minimum=0, isMinIncluded=false) + @XmlElement(name = "angularDistance") + @XmlJavaTypeAdapter(GO_Real.Since2014.class) public Double getAngularDistance() { return (property == ANGULAR) ? (Double) value : null; } @@ -352,6 +359,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/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -30,6 +30,7 @@ import org.opengis.metadata.identificati import org.opengis.metadata.identification.CouplingType; import org.opengis.metadata.identification.OperationChainMetadata; import org.opengis.metadata.identification.OperationMetadata; +import org.apache.sis.internal.jaxb.FilterByVersion; import org.apache.sis.xml.Namespaces; @@ -67,23 +68,24 @@ import org.apache.sis.xml.Namespaces; * @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.5 * @module */ @SuppressWarnings("CloneableClassWithoutClone") // ModifiableMetadata needs shallow clones. -@XmlType(name = "MD_ServiceIdentification_Type", propOrder = { // ISO 19139 still use the old prefix. +@XmlType(name = "SV_ServiceIdentification_Type", namespace = Namespaces.SRV, propOrder = { "serviceType", "serviceTypeVersions", -/// "accessProperties", + "accessProperties", + "couplingType", // "couplingType" and "coupledResource" were in reverse order in ISO 19115:2003. "coupledResources", - "couplingType", -/// "operatedDatasets", -/// "profiles", -/// "serviceStandards", + "operatedDataset", + "profile", + "serviceStandard", "containsOperations", "operatesOn", -/// "containsChain" + "operationChain" // Actually "containsChain" }) @XmlRootElement(name = "SV_ServiceIdentification", namespace = Namespaces.SRV) public class DefaultServiceIdentification extends AbstractIdentification implements ServiceIdentification { @@ -227,7 +229,7 @@ public class DefaultServiceIdentificatio * @return a service type name. */ @Override - @XmlElement(name = "serviceType", namespace = Namespaces.SRV, required = true) + @XmlElement(name = "serviceType", required = true) public GenericName getServiceType() { return serviceType; } @@ -248,7 +250,7 @@ public class DefaultServiceIdentificatio * @return the versions of the service. */ @Override - @XmlElement(name = "serviceTypeVersion", namespace = Namespaces.SRV) + @XmlElement(name = "serviceTypeVersion") public Collection<String> getServiceTypeVersions() { return serviceTypeVersions = nonNullCollection(serviceTypeVersions, String.class); } @@ -270,7 +272,7 @@ public class DefaultServiceIdentificatio * @since 0.5 */ @Override -/// @XmlElement(name = "accessProperties", namespace = Namespaces.SRV) + @XmlElement(name = "accessProperties") public StandardOrderProcess getAccessProperties() { return accessProperties; @@ -294,7 +296,7 @@ public class DefaultServiceIdentificatio * @return type of coupling between service and associated data, or {@code null} if none. */ @Override - @XmlElement(name = "couplingType", namespace = Namespaces.SRV) + @XmlElement(name = "couplingType") public CouplingType getCouplingType() { return couplingType; } @@ -315,7 +317,7 @@ public class DefaultServiceIdentificatio * @return further description(s) of the data coupling in the case of tightly coupled services. */ @Override - @XmlElement(name = "coupledResource", namespace = Namespaces.SRV) + @XmlElement(name = "coupledResource") public Collection<CoupledResource> getCoupledResources() { return coupledResources = nonNullCollection(coupledResources, CoupledResource.class); } @@ -337,7 +339,7 @@ public class DefaultServiceIdentificatio * @since 0.5 */ @Override -/// @XmlElement(name = "operatedDataset", namespace = Namespaces.SRV) + // @XmlElement at the end of this class. public Collection<Citation> getOperatedDatasets() { return operatedDatasets = nonNullCollection(operatedDatasets, Citation.class); } @@ -361,7 +363,7 @@ public class DefaultServiceIdentificatio * @since 0.5 */ @Override -/// @XmlElement(name = "profile", namespace = Namespaces.SRV) + // @XmlElement at the end of this class. public Collection<Citation> getProfiles() { return profiles = nonNullCollection(profiles, Citation.class); } @@ -383,7 +385,7 @@ public class DefaultServiceIdentificatio * @since 0.5 */ @Override -/// @XmlElement(name = "serviceStandard", namespace = Namespaces.SRV) + // @XmlElement at the end of this class. public Collection<Citation> getServiceStandards() { return serviceStandards = nonNullCollection(serviceStandards, Citation.class); } @@ -405,7 +407,7 @@ public class DefaultServiceIdentificatio * @return information about the operations that comprise the service. */ @Override - @XmlElement(name = "containsOperations", namespace = Namespaces.SRV) + @XmlElement(name = "containsOperations") public Collection<OperationMetadata> getContainsOperations() { return containsOperations = nonNullCollection(containsOperations, OperationMetadata.class); } @@ -425,7 +427,7 @@ public class DefaultServiceIdentificatio * @return information on the resources that the service operates on. */ @Override - @XmlElement(name = "operatesOn", namespace = Namespaces.SRV) + @XmlElement(name = "operatesOn") public Collection<DataIdentification> getOperatesOn() { return operatesOn = nonNullCollection(operatesOn, DataIdentification.class); } @@ -447,7 +449,7 @@ public class DefaultServiceIdentificatio * @since 0.5 */ @Override -/// @XmlElement(name = "containsChain", namespace = Namespaces.SRV) + // @XmlElement at the end of this class. public Collection<OperationChainMetadata> getContainsChain() { return containsChain = nonNullCollection(containsChain, OperationChainMetadata.class); } @@ -478,8 +480,34 @@ public class DefaultServiceIdentificatio ////////////////////////////////////////////////////////////////////////////////////////////////// /** + * 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 = "operatedDataset") + private Collection<Citation> getOperatedDataset() { + return FilterByVersion.CURRENT_METADATA.accept() ? getOperatedDatasets() : null; + } + + @XmlElement(name = "profile") + private Collection<Citation> getProfile() { + return FilterByVersion.CURRENT_METADATA.accept() ? getProfiles() : null; + } + + @XmlElement(name = "serviceStandard") + private Collection<Citation> getServiceStandard() { + return FilterByVersion.CURRENT_METADATA.accept() ? getServiceStandards() : null; + } + + @XmlElement(name = "containsChain") + private Collection<OperationChainMetadata> getOperationChain() { + return FilterByVersion.CURRENT_METADATA.accept() ? getContainsChain() : null; + } + + /** * Invoked after JAXB has unmarshalled this object. */ + @SuppressWarnings("unused") private void afterUnmarshal(Unmarshaller unmarshaller, Object parent) { if (containsOperations != null && coupledResources != null) { OperationName.resolve(containsOperations, coupledResources); Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultUsage.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultUsage.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultUsage.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultUsage.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -25,6 +25,7 @@ import org.opengis.util.InternationalStr import org.opengis.metadata.citation.Citation; import org.opengis.metadata.citation.Responsibility; import org.opengis.metadata.identification.Usage; +import org.apache.sis.internal.jaxb.FilterByVersion; import org.apache.sis.metadata.iso.ISOMetadata; import org.apache.sis.metadata.TitleProperty; import org.apache.sis.util.iso.Types; @@ -58,7 +59,8 @@ 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 */ @@ -68,7 +70,10 @@ import static org.apache.sis.internal.me "specificUsage", "usageDate", "userDeterminedLimitations", - "userContactInfo" + "userContactInfo", + "response", // New in ISO 19115:2014 + "additionalDocumentations", // Ibid. + "issues" // Ibid. Actually "identifiedIssues" }) @XmlRootElement(name = "MD_Usage") public class DefaultUsage extends ISOMetadata implements Usage { @@ -251,7 +256,7 @@ public class DefaultUsage extends ISOMet * @return means of communicating with person(s) and organization(s) using the resource(s). */ @Override - @XmlElement(name = "userContactInfo", required = true) + @XmlElement(name = "userContactInfo") public Collection<Responsibility> getUserContactInfo() { return userContactInfo = nonNullCollection(userContactInfo, Responsibility.class); } @@ -273,8 +278,8 @@ public class DefaultUsage extends ISOMet * @since 0.5 */ @Override -/// @XmlElement(name = "response") - public Collection<? extends InternationalString> getResponses() { + // @XmlElement at the end of this class. + public Collection<InternationalString> getResponses() { return responses = nonNullCollection(responses, InternationalString.class); } @@ -297,7 +302,7 @@ public class DefaultUsage extends ISOMet * @since 0.5 */ @Override -/// @XmlElement(name = "additionalDocumentation") + // @XmlElement at the end of this class. public Collection<Citation> getAdditionalDocumentation() { return additionalDocumentation = nonNullCollection(additionalDocumentation, Citation.class); } @@ -322,8 +327,8 @@ public class DefaultUsage extends ISOMet * @since 0.5 */ @Override -/// @XmlElement(name = "identifiedIssues") - public Collection<? extends Citation> getIdentifiedIssues() { + // @XmlElement at the end of this class. + public Collection<Citation> getIdentifiedIssues() { return identifiedIssues = nonNullCollection(identifiedIssues, Citation.class); } @@ -338,4 +343,38 @@ public class DefaultUsage extends ISOMet public void setIdentifiedIssues(final Collection<? extends Citation> newValues) { identifiedIssues = writeCollection(newValues, identifiedIssues, 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 = "response") + private Collection<InternationalString> getResponse() { + return FilterByVersion.CURRENT_METADATA.accept() ? getResponses() : null; + } + + @XmlElement(name = "additionalDocumentation") + private Collection<Citation> getAdditionalDocumentations() { + return FilterByVersion.CURRENT_METADATA.accept() ? getAdditionalDocumentation() : null; + } + + @XmlElement(name = "identifiedIssues") + private Collection<Citation> getIssues() { + return FilterByVersion.CURRENT_METADATA.accept() ? getIdentifiedIssues() : null; + } } Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/OperationName.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/OperationName.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/OperationName.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/OperationName.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -117,7 +117,7 @@ final class OperationName implements Ope final boolean exists = byName.containsKey(name); final OperationMetadata previous = byName.put(name, operation); if (previous != operation && (previous != null || exists)) { - byName.put(name, null); // Mark the entry as duplicated. + byName.put(name, null); // Mark the entry as duplicated. } } } Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -95,15 +95,21 @@ * @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 */ -@XmlSchema(location=Schemas.METADATA_XSD, elementFormDefault=XmlNsForm.QUALIFIED, namespace=Namespaces.GMD, xmlns = { - @XmlNs(prefix = "gmd", namespaceURI = Namespaces.GMD), - @XmlNs(prefix = "gco", namespaceURI = Namespaces.GCO), - @XmlNs(prefix = "srv", namespaceURI = Namespaces.SRV), - @XmlNs(prefix = "xsi", namespaceURI = Namespaces.XSI) +@XmlSchema(location="http://standards.iso.org/iso/19115/-3/mri/1.0/mri.xsd", + elementFormDefault=XmlNsForm.QUALIFIED, namespace=Namespaces.MRI, + xmlns = { + @XmlNs(prefix = "mri", namespaceURI = Namespaces.MRI), // Metadata for Resource Identification + @XmlNs(prefix = "srv", namespaceURI = Namespaces.SRV), // Metadata for Services 2.0 + @XmlNs(prefix = "lan", namespaceURI = Namespaces.LAN), // Language localization + @XmlNs(prefix = "mcc", namespaceURI = Namespaces.MCC), // Metadata Common Classes + @XmlNs(prefix = "gco", namespaceURI = Namespaces.GCO), // Geographic Common + @XmlNs(prefix = "gmd", namespaceURI = LegacyNamespaces.GMD), // Metadata ISO 19139:2007 + @XmlNs(prefix = "srv1", namespaceURI = LegacyNamespaces.SRV) // Metadata for Services 1.0 }) @XmlAccessorType(XmlAccessType.NONE) @XmlJavaTypeAdapters({ @@ -111,10 +117,11 @@ @XmlJavaTypeAdapter(CI_OnlineResource.class), @XmlJavaTypeAdapter(CI_Responsibility.class), @XmlJavaTypeAdapter(DCPList.class), - @XmlJavaTypeAdapter(DS_AssociationTypeCode.class), - @XmlJavaTypeAdapter(DS_InitiativeTypeCode.class), @XmlJavaTypeAdapter(EX_Extent.class), + @XmlJavaTypeAdapter(GO_DateTime.class), + @XmlJavaTypeAdapter(GO_GenericName.class), @XmlJavaTypeAdapter(MD_AggregateInformation.class), + @XmlJavaTypeAdapter(MD_AssociatedResource.class), @XmlJavaTypeAdapter(MD_BrowseGraphic.class), @XmlJavaTypeAdapter(MD_CharacterSetCode.class), @XmlJavaTypeAdapter(MD_Constraints.class), @@ -131,21 +138,18 @@ @XmlJavaTypeAdapter(MD_StandardOrderProcess.class), @XmlJavaTypeAdapter(MD_TopicCategoryCode.class), @XmlJavaTypeAdapter(MD_Usage.class), + @XmlJavaTypeAdapter(PT_Locale.class), @XmlJavaTypeAdapter(SV_CoupledResource.class), @XmlJavaTypeAdapter(SV_CouplingType.class), @XmlJavaTypeAdapter(SV_OperationMetadata.class), @XmlJavaTypeAdapter(SV_OperationChainMetadata.class), @XmlJavaTypeAdapter(SV_Parameter.class), - @XmlJavaTypeAdapter(SV_ParameterDirection.class), + @XmlJavaTypeAdapter(TM_Duration.class), // Java types, primitive types and basic OGC types handling @XmlJavaTypeAdapter(URIAdapter.class), - @XmlJavaTypeAdapter(LocaleAdapter.class), @XmlJavaTypeAdapter(StringAdapter.class), - @XmlJavaTypeAdapter(InternationalStringAdapter.class), - @XmlJavaTypeAdapter(GO_DateTime.class), - @XmlJavaTypeAdapter(GO_GenericName.class), - @XmlJavaTypeAdapter(GO_Boolean.class), @XmlJavaTypeAdapter(type=boolean.class, value=GO_Boolean.class) + @XmlJavaTypeAdapter(InternationalStringAdapter.class) }) package org.apache.sis.metadata.iso.identification; @@ -157,8 +161,8 @@ import javax.xml.bind.annotation.XmlAcce import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters; import org.apache.sis.xml.Namespaces; -import org.apache.sis.internal.jaxb.Schemas; +import org.apache.sis.internal.jaxb.LegacyNamespaces; import org.apache.sis.internal.jaxb.gco.*; -import org.apache.sis.internal.jaxb.gmd.*; +import org.apache.sis.internal.jaxb.gts.*; import org.apache.sis.internal.jaxb.code.*; import org.apache.sis.internal.jaxb.metadata.*; Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultAlgorithm.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultAlgorithm.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultAlgorithm.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultAlgorithm.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -23,7 +23,6 @@ import org.opengis.metadata.citation.Cit import org.opengis.metadata.lineage.Algorithm; import org.opengis.util.InternationalString; import org.apache.sis.metadata.iso.ISOMetadata; -import org.apache.sis.xml.Namespaces; /** @@ -48,7 +47,7 @@ import org.apache.sis.xml.Namespaces; * @author Cédric Briançon (Geomatys) * @author Guilhem Legal (Geomatys) * @author Martin Desruisseaux (Geomatys) - * @version 0.3 + * @version 1.0 * @since 0.3 * @module */ @@ -57,7 +56,7 @@ import org.apache.sis.xml.Namespaces; "citation", "description" }) -@XmlRootElement(name = "LE_Algorithm", namespace = Namespaces.GMI) +@XmlRootElement(name = "LE_Algorithm") public class DefaultAlgorithm extends ISOMetadata implements Algorithm { /** * Serial number for inter-operability with different versions. @@ -128,7 +127,7 @@ public class DefaultAlgorithm extends IS * @return algorithm and version or date, or {@code null}. */ @Override - @XmlElement(name = "citation", namespace = Namespaces.GMI, required = true) + @XmlElement(name = "citation", required = true) public Citation getCitation() { return citation; } @@ -149,7 +148,7 @@ public class DefaultAlgorithm extends IS * @return algorithm used to generate the data, or {@code null}. */ @Override - @XmlElement(name = "description", namespace = Namespaces.GMI, required = true) + @XmlElement(name = "description", required = true) public InternationalString getDescription() { return description; } Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultLineage.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultLineage.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultLineage.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultLineage.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -17,9 +17,10 @@ package org.apache.sis.metadata.iso.lineage; 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.XmlType; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.opengis.util.InternationalString; import org.opengis.metadata.citation.Citation; import org.opengis.metadata.maintenance.Scope; @@ -29,6 +30,8 @@ import org.opengis.metadata.lineage.Proc import org.opengis.metadata.maintenance.ScopeCode; import org.apache.sis.metadata.iso.ISOMetadata; import org.apache.sis.metadata.iso.maintenance.DefaultScope; +import org.apache.sis.internal.jaxb.FilterByVersion; +import org.apache.sis.internal.jaxb.metadata.MD_Scope; /** @@ -69,15 +72,16 @@ import org.apache.sis.metadata.iso.maint * @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 = "LI_Lineage_Type", propOrder = { "statement", -/// "scope", -/// "additionalResource", + "scope", // New in ISO 19115:2014 + "documentation", // New in ISO 19115:2014 (actually "additionalDocumentation") "processSteps", "sources" }) @@ -198,7 +202,8 @@ public class DefaultLineage extends ISOM * @since 0.5 */ @Override -/// @XmlElement(name = "scope") + @XmlElement(name = "scope") + @XmlJavaTypeAdapter(MD_Scope.Since2014.class) public Scope getScope() { return scope; } @@ -223,7 +228,7 @@ public class DefaultLineage extends ISOM * @since 0.5 */ @Override -/// @XmlElement(name = "additionalDocumentation") + // @XmlElement at the end of this class. public Collection<Citation> getAdditionalDocumentation() { return additionalDocumentation = nonNullCollection(additionalDocumentation, Citation.class); } @@ -278,4 +283,28 @@ public class DefaultLineage extends ISOM public void setSources(final Collection<? extends Source> newValues) { sources = writeCollection(newValues, sources, Source.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 = "additionalDocumentation") + private Collection<Citation> getDocumentation() { + return FilterByVersion.CURRENT_METADATA.accept() ? getAdditionalDocumentation() : null; + } } Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultNominalResolution.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultNominalResolution.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultNominalResolution.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultNominalResolution.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -22,7 +22,6 @@ import javax.xml.bind.annotation.XmlType import org.opengis.metadata.lineage.NominalResolution; import org.apache.sis.metadata.iso.ISOMetadata; import org.apache.sis.measure.ValueRange; -import org.apache.sis.xml.Namespaces; import static org.apache.sis.internal.metadata.MetadataUtilities.ensurePositive; @@ -46,7 +45,7 @@ import static org.apache.sis.internal.me * * @author Cédric Briançon (Geomatys) * @author Martin Desruisseaux (Geomatys) - * @version 0.5 + * @version 1.0 * @since 0.3 * @module */ @@ -55,7 +54,7 @@ import static org.apache.sis.internal.me "scanningResolution", "groundResolution" }) -@XmlRootElement(name = "LE_NominalResolution", namespace = Namespaces.GMI) +@XmlRootElement(name = "LE_NominalResolution") public class DefaultNominalResolution extends ISOMetadata implements NominalResolution { /** * Serial number for inter-operability with different versions. @@ -137,7 +136,7 @@ public class DefaultNominalResolution ex */ @Override @ValueRange(minimum=0, isMinIncluded=false) - @XmlElement(name = "scanningResolution", namespace = Namespaces.GMI, required = true) + @XmlElement(name = "scanningResolution") public Double getScanningResolution() { return scanningResolution; } @@ -164,7 +163,7 @@ public class DefaultNominalResolution ex */ @Override @ValueRange(minimum=0, isMinIncluded=false) - @XmlElement(name = "groundResolution", namespace = Namespaces.GMI, required = true) + @XmlElement(name = "groundResolution") public Double getGroundResolution() { return groundResolution; } Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultProcessStep.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultProcessStep.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultProcessStep.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultProcessStep.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -22,7 +22,9 @@ import javax.xml.bind.annotation.XmlType import javax.xml.bind.annotation.XmlSeeAlso; 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.TemporalPrimitive; import org.opengis.metadata.citation.Citation; import org.opengis.metadata.citation.Responsibility; import org.opengis.metadata.maintenance.Scope; @@ -33,10 +35,11 @@ import org.opengis.metadata.lineage.Proc import org.apache.sis.metadata.iso.ISOMetadata; import org.apache.sis.metadata.TitleProperty; import org.apache.sis.util.iso.Types; -import org.apache.sis.xml.Namespaces; - -import static org.apache.sis.internal.metadata.MetadataUtilities.toDate; -import static org.apache.sis.internal.metadata.MetadataUtilities.toMilliseconds; +import org.apache.sis.internal.jaxb.FilterByVersion; +import org.apache.sis.internal.jaxb.LegacyNamespaces; +import org.apache.sis.internal.jaxb.gml.TM_Primitive; +import org.apache.sis.internal.jaxb.metadata.MD_Scope; +import org.apache.sis.internal.util.TemporalUtilities; /** @@ -60,7 +63,8 @@ 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 */ @@ -69,12 +73,15 @@ import static org.apache.sis.internal.me @XmlType(name = "LI_ProcessStep_Type", propOrder = { "description", "rationale", - "date", + "stepDateTime", // New in ISO 19115:2014 + "date", // Legacy ISO 19115:2003 "processors", + "reference", // New in ISO 19115:2014 + "scope", // New in ISO 19115:2014 "sources", - "outputs", - "processingInformation", - "reports" + "outputs", // ISO 19115-2 extension + "processingInformation", // Ibid. + "reports" // Ibid. }) @XmlRootElement(name = "LI_ProcessStep") @XmlSeeAlso(org.apache.sis.internal.jaxb.gmi.LE_ProcessStep.class) @@ -82,7 +89,7 @@ public class DefaultProcessStep extends /** * Serial number for inter-operability with different versions. */ - private static final long serialVersionUID = -535020568951006598L; + private static final long serialVersionUID = -2338712901907082970L; /** * Description of the event, including related parameters or tolerances. @@ -95,11 +102,9 @@ public class DefaultProcessStep extends private InternationalString rationale; /** - * Date and time or range of date and time on or over which the process step occurred, - * in milliseconds elapsed since January 1st, 1970. If there is no such date, then this - * field is set to the special value {@link Long#MIN_VALUE}. + * Date, time or range of date and time over which the process step occurred. */ - private long date = Long.MIN_VALUE; + private TemporalPrimitive stepDateTime; /** * Identification of, and means of communication with, person(s) and @@ -168,7 +173,7 @@ public class DefaultProcessStep extends if (object != null) { description = object.getDescription(); rationale = object.getRationale(); - date = toMilliseconds(object.getDate()); + stepDateTime = TemporalUtilities.createInstant(object.getDate()); processors = copyCollection(object.getProcessors(), Responsibility.class); references = copyCollection(object.getReferences(), Citation.class); sources = copyCollection(object.getSources(), Source.class); @@ -247,24 +252,54 @@ public class DefaultProcessStep extends } /** + * Returns the date, time or range of date and time over which the process step occurred. + * + * @return date, time or period over which the process step occurred, or {@code null}. + * + * @since 1.0 + */ + @XmlElement(name = "stepDateTime") + @XmlJavaTypeAdapter(TM_Primitive.Since2014.class) + public TemporalPrimitive getStepDateTime() { + return stepDateTime; + } + + /** + * Sets the date, time or range of date and time over which the process step occurred. + * + * @param newValue the new date, time or period. + * + * @since 1.0 + */ + public void setStepDateTime(final TemporalPrimitive newValue) { + checkWritePermission(); + stepDateTime = newValue; + } + + /** * Returns the date and time or range of date and time on or over which the process step occurred. * * @return date on or over which the process step occurred, or {@code null}. + * + * @deprecated As of ISO 19115-1:2014, replaced by {@link #getStepDateTime()}. */ @Override - @XmlElement(name = "dateTime") + @Deprecated + @XmlElement(name = "dateTime", namespace = LegacyNamespaces.GMD) public Date getDate() { - return toDate(date); + return FilterByVersion.LEGACY_METADATA.accept() ? TemporalUtilities.getDate(getStepDateTime()) : null; } /** * Sets the date and time or range of date and time on or over which the process step occurred. * * @param newValue the new date. + * + * @deprecated As of ISO 19115-1:2014, replaced by {@link #setStepDateTime(TemporalPrimitive)}. */ + @Deprecated public void setDate(final Date newValue) { - checkWritePermission(); - date = toMilliseconds(newValue); + setStepDateTime(TemporalUtilities.createInstant(newValue)); } /** @@ -297,7 +332,7 @@ public class DefaultProcessStep extends * @since 0.5 */ @Override -/// @XmlElement(name = "reference") + // @XmlElement at the end of this class. public Collection<Citation> getReferences() { return references = nonNullCollection(references, Citation.class); } @@ -321,7 +356,8 @@ public class DefaultProcessStep extends * @since 0.5 */ @Override -/// @XmlElement(name = "scope") + @XmlElement(name = "scope") + @XmlJavaTypeAdapter(MD_Scope.Since2014.class) public Scope getScope() { return scope; } @@ -364,7 +400,7 @@ public class DefaultProcessStep extends * @return product generated as a result of the process step. */ @Override - @XmlElement(name = "output", namespace = Namespaces.GMI) + @XmlElement(name = "output") public Collection<Source> getOutputs() { return outputs = nonNullCollection(outputs, Source.class); } @@ -386,7 +422,7 @@ public class DefaultProcessStep extends * @return procedure by which the algorithm was applied to derive geographic data, or {@code null}. */ @Override - @XmlElement(name = "processingInformation", namespace = Namespaces.GMI) + @XmlElement(name = "processingInformation") public Processing getProcessingInformation() { return processingInformation; } @@ -409,7 +445,7 @@ public class DefaultProcessStep extends * @return report generated by the process step. */ @Override - @XmlElement(name = "report", namespace = Namespaces.GMI) + @XmlElement(name = "report") public Collection<ProcessStepReport> getReports() { return reports = nonNullCollection(reports, ProcessStepReport.class); } @@ -422,4 +458,28 @@ public class DefaultProcessStep extends public void setReports(final Collection<? extends ProcessStepReport> newValues) { reports = writeCollection(newValues, reports, ProcessStepReport.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 = "reference") + private Collection<Citation> getReference() { + return FilterByVersion.CURRENT_METADATA.accept() ? getReferences() : null; + } } Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultProcessStepReport.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultProcessStepReport.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultProcessStepReport.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultProcessStepReport.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -23,7 +23,6 @@ import org.opengis.metadata.lineage.Proc import org.opengis.util.InternationalString; import org.apache.sis.metadata.iso.ISOMetadata; import org.apache.sis.metadata.TitleProperty; -import org.apache.sis.xml.Namespaces; /** @@ -45,7 +44,7 @@ import org.apache.sis.xml.Namespaces; * @author Cédric Briançon (Geomatys) * @author Guilhem Legal (Geomatys) * @author Martin Desruisseaux (Geomatys) - * @version 0.3 + * @version 1.0 * @since 0.3 * @module */ @@ -56,7 +55,7 @@ import org.apache.sis.xml.Namespaces; "description", "fileType" }) -@XmlRootElement(name = "LE_ProcessStepReport", namespace = Namespaces.GMI) +@XmlRootElement(name = "LE_ProcessStepReport") public class DefaultProcessStepReport extends ISOMetadata implements ProcessStepReport { /** * Serial number for inter-operability with different versions. @@ -133,7 +132,7 @@ public class DefaultProcessStepReport ex * @return name of the processing report, or {@code null}. */ @Override - @XmlElement(name = "name", namespace = Namespaces.GMI, required = true) + @XmlElement(name = "name", required = true) public InternationalString getName() { return name; } @@ -154,7 +153,7 @@ public class DefaultProcessStepReport ex * @return what occurred during the process step, or {@code null}. */ @Override - @XmlElement(name = "description", namespace = Namespaces.GMI) + @XmlElement(name = "description") public InternationalString getDescription() { return description; } @@ -175,7 +174,7 @@ public class DefaultProcessStepReport ex * @return type of file that contains the processing report, or {@code null}. */ @Override - @XmlElement(name = "fileType", namespace = Namespaces.GMI) + @XmlElement(name = "fileType") public InternationalString getFileType() { return fileType; } Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultProcessing.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultProcessing.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultProcessing.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultProcessing.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -25,7 +25,6 @@ import org.opengis.metadata.citation.Cit import org.opengis.metadata.lineage.Algorithm; import org.opengis.metadata.lineage.Processing; import org.opengis.util.InternationalString; -import org.apache.sis.xml.Namespaces; import org.apache.sis.metadata.iso.ISOMetadata; import org.apache.sis.internal.jaxb.NonMarshalledAuthority; @@ -50,7 +49,7 @@ import org.apache.sis.internal.jaxb.NonM * @author Cédric Briançon (Geomatys) * @author Guilhem Legal (Geomatys) * @author Martin Desruisseaux (Geomatys) - * @version 0.3 + * @version 1.0 * @since 0.3 * @module */ @@ -63,7 +62,7 @@ import org.apache.sis.internal.jaxb.NonM "runTimeParameters", "algorithms" }) -@XmlRootElement(name = "LE_Processing", namespace = Namespaces.GMI) +@XmlRootElement(name = "LE_Processing") public class DefaultProcessing extends ISOMetadata implements Processing { /** * Serial number for inter-operability with different versions. @@ -154,7 +153,7 @@ public class DefaultProcessing extends I * @return identifier of the processing package that produced the data, or {@code null}. */ @Override - @XmlElement(name = "identifier", namespace = Namespaces.GMI, required = true) + @XmlElement(name = "identifier", required = true) public Identifier getIdentifier() { return NonMarshalledAuthority.getMarshallable(identifiers); } @@ -176,7 +175,7 @@ public class DefaultProcessing extends I * @return document describing processing software. */ @Override - @XmlElement(name = "softwareReference", namespace = Namespaces.GMI) + @XmlElement(name = "softwareReference") public Collection<Citation> getSoftwareReferences() { return softwareReferences = nonNullCollection(softwareReferences, Citation.class); } @@ -196,7 +195,7 @@ public class DefaultProcessing extends I * @return processing procedures, or {@code null}. */ @Override - @XmlElement(name = "procedureDescription", namespace = Namespaces.GMI) + @XmlElement(name = "procedureDescription") public InternationalString getProcedureDescription() { return procedureDescription; } @@ -217,7 +216,7 @@ public class DefaultProcessing extends I * @return documentation describing the processing. */ @Override - @XmlElement(name = "documentation", namespace = Namespaces.GMI) + @XmlElement(name = "documentation") public Collection<Citation> getDocumentations() { return documentations = nonNullCollection(documentations, Citation.class); } @@ -237,7 +236,7 @@ public class DefaultProcessing extends I * @return parameters to control the processing operations, or {@code null}. */ @Override - @XmlElement(name = "runTimeParameters", namespace = Namespaces.GMI) + @XmlElement(name = "runTimeParameters") public InternationalString getRunTimeParameters() { return runTimeParameters; } @@ -259,7 +258,7 @@ public class DefaultProcessing extends I * @return methodology by which geographic information was derived from the instrument readings. */ @Override - @XmlElement(name = "algorithm", namespace = Namespaces.GMI) + @XmlElement(name = "algorithm") public Collection<Algorithm> getAlgorithms() { return algorithms = nonNullCollection(algorithms, Algorithm.class); } Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultSource.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultSource.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultSource.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultSource.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -22,6 +22,7 @@ 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.util.InternationalString; import org.opengis.metadata.Identifier; import org.opengis.metadata.citation.Citation; @@ -37,9 +38,13 @@ import org.apache.sis.metadata.TitleProp import org.apache.sis.metadata.iso.ISOMetadata; import org.apache.sis.metadata.iso.maintenance.DefaultScope; import org.apache.sis.metadata.iso.identification.DefaultResolution; +import org.apache.sis.internal.jaxb.metadata.RS_ReferenceSystem; +import org.apache.sis.internal.jaxb.metadata.MD_Resolution; +import org.apache.sis.internal.jaxb.metadata.MD_Scope; +import org.apache.sis.internal.jaxb.FilterByVersion; +import org.apache.sis.internal.jaxb.LegacyNamespaces; import org.apache.sis.internal.metadata.Dependencies; import org.apache.sis.util.iso.Types; -import org.apache.sis.xml.Namespaces; /** @@ -75,7 +80,8 @@ import org.apache.sis.xml.Namespaces; * @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 */ @@ -83,12 +89,16 @@ import org.apache.sis.xml.Namespaces; @TitleProperty(name = "description") @XmlType(name = "LI_Source_Type", propOrder = { "description", - "scaleDenominator", + "scaleDenominator", // Legacy ISO 19115:2003 + "sourceSpatialResolution", // New in ISO 19115:2014 + "sourceReferenceSystem", // New in ISO 19115:2014 "sourceCitation", - "sourceExtents", + "sources", // New in ISO 19115:2014 (actually "sourceMetadata") + "sourceExtents", // Legacy ISO 19115:2003 + "scope", // New in ISO 19115:2014 "sourceSteps", - "processedLevel", - "resolution" + "processedLevel", // ISO 19115-2 extension + "resolution" // ISO 19115-2 extension }) @XmlRootElement(name = "LI_Source") @XmlSeeAlso(org.apache.sis.internal.jaxb.gmi.LE_Source.class) @@ -236,7 +246,8 @@ public class DefaultSource extends ISOMe * @since 0.5 */ @Override -/// @XmlElement(name = "sourceSpatialResolution") + @XmlElement(name = "sourceSpatialResolution") + @XmlJavaTypeAdapter(MD_Resolution.Since2014.class) public Resolution getSourceSpatialResolution() { return sourceSpatialResolution; } @@ -264,11 +275,16 @@ public class DefaultSource extends ISOMe */ @Override @Deprecated - @XmlElement(name = "scaleDenominator") @Dependencies("getSourceSpatialResolution") + @XmlElement(name = "scaleDenominator", namespace = LegacyNamespaces.GMD) public RepresentativeFraction getScaleDenominator() { - final Resolution resolution = getSourceSpatialResolution(); - return (resolution != null) ? resolution.getEquivalentScale() : null; + if (FilterByVersion.LEGACY_METADATA.accept()) { + final Resolution resolution = getSourceSpatialResolution(); + if (resolution != null) { + return resolution.getEquivalentScale(); + } + } + return null; } /** @@ -305,11 +321,10 @@ public class DefaultSource extends ISOMe * Returns the spatial reference system used by the source data. * * @return spatial reference system used by the source data, or {@code null}. - * - * @todo We need to annotate the referencing module before we can annotate this method. */ @Override -/// @XmlElement(name = "sourceReferenceSystem") + @XmlElement(name = "sourceReferenceSystem") + @XmlJavaTypeAdapter(RS_ReferenceSystem.Since2014.class) public ReferenceSystem getSourceReferenceSystem() { return sourceReferenceSystem; } @@ -353,7 +368,7 @@ public class DefaultSource extends ISOMe * @since 0.5 */ @Override -/// @XmlElement(name = "sourceMetadata") + // @XmlElement at the end of this class. public Collection<Citation> getSourceMetadata() { return sourceMetadata = nonNullCollection(sourceMetadata, Citation.class); } @@ -378,7 +393,8 @@ public class DefaultSource extends ISOMe * @since 0.5 */ @Override -/// @XmlElement(name = "scope") + @XmlElement(name = "scope") + @XmlJavaTypeAdapter(MD_Scope.Since2014.class) public Scope getScope() { return scope; } @@ -405,19 +421,24 @@ public class DefaultSource extends ISOMe */ @Override @Deprecated - @XmlElement(name = "sourceExtent") @Dependencies("getScope") + @XmlElement(name = "sourceExtent", namespace = LegacyNamespaces.GMD) public Collection<Extent> getSourceExtents() { - Scope scope = getScope(); - if (!(scope instanceof DefaultScope)) { - if (isModifiable()) { - scope = new DefaultScope(scope); - this.scope = scope; - } else { - return Collections.unmodifiableCollection(scope.getExtents()); + if (FilterByVersion.LEGACY_METADATA.accept()) { + Scope scope = getScope(); + if (scope != null) { + if (!(scope instanceof DefaultScope)) { + if (isModifiable()) { + scope = new DefaultScope(scope); + this.scope = scope; + } else { + return Collections.unmodifiableCollection(scope.getExtents()); + } + } + return ((DefaultScope) scope).getExtents(); } } - return ((DefaultScope) scope).getExtents(); + return null; } /** @@ -465,7 +486,7 @@ public class DefaultSource extends ISOMe * @return processing level of the source data, or {@code null}. */ @Override - @XmlElement(name = "processedLevel", namespace = Namespaces.GMI) + @XmlElement(name = "processedLevel") public Identifier getProcessedLevel() { return processedLevel; } @@ -486,7 +507,7 @@ public class DefaultSource extends ISOMe * @return distance between consistent parts of two adjacent pixels, or {@code null}. */ @Override - @XmlElement(name = "resolution", namespace = Namespaces.GMI) + @XmlElement(name = "resolution") public NominalResolution getResolution() { return resolution; } @@ -500,4 +521,28 @@ public class DefaultSource extends ISOMe checkWritePermission(); resolution = newValue; } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// 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 = "sourceMetadata") + private Collection<Citation> getSources() { + return FilterByVersion.CURRENT_METADATA.accept() ? getSourceMetadata() : null; + } } Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/package-info.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/package-info.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/package-info.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/package-info.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -65,21 +65,25 @@ * @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 */ -@XmlSchema(location=Schemas.METADATA_XSD, elementFormDefault=XmlNsForm.QUALIFIED, namespace=Namespaces.GMD, xmlns = { - @XmlNs(prefix = "gmi", namespaceURI = Namespaces.GMI), - @XmlNs(prefix = "gmd", namespaceURI = Namespaces.GMD), - @XmlNs(prefix = "gco", namespaceURI = Namespaces.GCO), - @XmlNs(prefix = "xsi", namespaceURI = Namespaces.XSI) +@XmlSchema(location="http://standards.iso.org/iso/19115/-3/mrl/1.0/mrl.xsd", + elementFormDefault=XmlNsForm.QUALIFIED, namespace=Namespaces.MRL, + xmlns = { + @XmlNs(prefix = "mrl", namespaceURI = Namespaces.MRL), // Metadata for Resource Lineage + @XmlNs(prefix = "mcc", namespaceURI = Namespaces.MCC), // Metadata Common Classes + @XmlNs(prefix = "gmd", namespaceURI = LegacyNamespaces.GMD) }) @XmlAccessorType(XmlAccessType.NONE) @XmlJavaTypeAdapters({ @XmlJavaTypeAdapter(CI_Citation.class), @XmlJavaTypeAdapter(CI_Responsibility.class), @XmlJavaTypeAdapter(EX_Extent.class), + @XmlJavaTypeAdapter(GO_Real.class), + @XmlJavaTypeAdapter(GO_DateTime.class), @XmlJavaTypeAdapter(LE_Algorithm.class), @XmlJavaTypeAdapter(LE_NominalResolution.class), @XmlJavaTypeAdapter(LE_Processing.class), @@ -90,7 +94,6 @@ @XmlJavaTypeAdapter(MD_RepresentativeFraction.class), // Java types, primitive types and basic OGC types handling - @XmlJavaTypeAdapter(GO_DateTime.class), @XmlJavaTypeAdapter(InternationalStringAdapter.class) }) package org.apache.sis.metadata.iso.lineage; @@ -104,6 +107,6 @@ import javax.xml.bind.annotation.adapter import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters; import org.apache.sis.xml.Namespaces; -import org.apache.sis.internal.jaxb.Schemas; +import org.apache.sis.internal.jaxb.LegacyNamespaces; import org.apache.sis.internal.jaxb.gco.*; import org.apache.sis.internal.jaxb.metadata.*;
