Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultSpatialTemporalExtent.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultSpatialTemporalExtent.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultSpatialTemporalExtent.java [UTF-8] (original) +++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultSpatialTemporalExtent.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -20,7 +20,6 @@ import java.util.Collection; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; -import org.opengis.annotation.UML; import org.opengis.geometry.Envelope; import org.opengis.metadata.extent.TemporalExtent; import org.opengis.metadata.extent.VerticalExtent; @@ -30,6 +29,8 @@ import org.opengis.metadata.extent.Spati import org.opengis.referencing.operation.TransformException; import org.apache.sis.internal.metadata.ReferencingServices; +// Branch-specific imports +import org.opengis.annotation.UML; import static org.opengis.annotation.Obligation.OPTIONAL; import static org.opengis.annotation.Specification.ISO_19115; @@ -55,7 +56,7 @@ import static org.opengis.annotation.Spe * @author Rémi Maréchal (Geomatys) * @author Touraïvane (IRD) * @author Cédric Briançon (Geomatys) - * @version 0.5 + * @version 1.0 * @since 0.3 * @module */
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultTemporalExtent.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultTemporalExtent.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultTemporalExtent.java [UTF-8] (original) +++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultTemporalExtent.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -62,7 +62,7 @@ import org.apache.sis.xml.NilReason; * @author Martin Desruisseaux (IRD, Geomatys) * @author Touraïvane (IRD) * @author Cédric Briançon (Geomatys) - * @version 0.8 + * @version 1.0 * @since 0.3 * @module */ Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultVerticalExtent.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultVerticalExtent.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultVerticalExtent.java [UTF-8] (original) +++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultVerticalExtent.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -57,12 +57,14 @@ import org.apache.sis.xml.NilReason; * <li>Serialized objects of this class are not guaranteed to be compatible with future Apache SIS releases. * Serialization support is appropriate for short term storage or RMI between applications running the * same version of Apache SIS. For long term storage, use {@link org.apache.sis.xml.XML} instead.</li> + * <li>Coordinate Reference System can not be specified by identifier only; they have to be specified in full. + * See <a href="https://issues.apache.org/jira/browse/SIS-397">SIS-397</a>.</li> * </ul> * * @author Martin Desruisseaux (IRD, Geomatys) * @author Touraïvane (IRD) * @author Cédric Briançon (Geomatys) - * @version 0.8 + * @version 1.0 * @since 0.3 * @module */ @@ -211,9 +213,11 @@ public class DefaultVerticalExtent exten * The CRS identification includes unit of measure. * * @return the vertical CRS, or {@code null}. + * + * @see <a href="https://issues.apache.org/jira/browse/SIS-397">SIS-397</a> */ @Override - @XmlElement(name = "verticalCRS", required = true) + @XmlElement(name = "verticalCRS") public VerticalCRS getVerticalCRS() { return verticalCRS; } Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/package-info.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/package-info.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/package-info.java [UTF-8] (original) +++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/package-info.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -135,30 +135,31 @@ * @author Touraïvane (IRD) * @author Cédric Briançon (Geomatys) * @author Guilhem Legal (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 = "xsi", namespaceURI = Namespaces.XSI) +@XmlSchema(location="http://standards.iso.org/iso/19115/-3/gex/1.0/gex.xsd", + elementFormDefault=XmlNsForm.QUALIFIED, namespace=Namespaces.GEX, + xmlns = { + @XmlNs(prefix = "gex", namespaceURI = Namespaces.GEX), // Geospatial Extent + @XmlNs(prefix = "mcc", namespaceURI = Namespaces.MCC) // Metadata Common Classes }) @XmlAccessorType(XmlAccessType.NONE) @XmlJavaTypeAdapters({ - @XmlJavaTypeAdapter(EX_GeographicBoundingBox.class), @XmlJavaTypeAdapter(EX_GeographicExtent.class), @XmlJavaTypeAdapter(EX_TemporalExtent.class), @XmlJavaTypeAdapter(EX_VerticalExtent.class), @XmlJavaTypeAdapter(GM_Object.class), + @XmlJavaTypeAdapter(GO_Boolean.class), @XmlJavaTypeAdapter(MD_Identifier.class), @XmlJavaTypeAdapter(SC_VerticalCRS.class), @XmlJavaTypeAdapter(TM_Primitive.class), // Java types, primitive types and basic OGC types handling @XmlJavaTypeAdapter(InternationalStringAdapter.class), - @XmlJavaTypeAdapter(GO_Boolean.class), @XmlJavaTypeAdapter(type=boolean.class, value=GO_Boolean.class), - @XmlJavaTypeAdapter(GO_Decimal.class), @XmlJavaTypeAdapter(type=double.class, value=GO_Decimal.class) + @XmlJavaTypeAdapter(value=GO_Decimal.class, type=double.class) }) package org.apache.sis.metadata.iso.extent; @@ -171,7 +172,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.gco.*; import org.apache.sis.internal.jaxb.gml.*; import org.apache.sis.internal.jaxb.metadata.*; Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/AbstractIdentification.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/AbstractIdentification.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/AbstractIdentification.java [UTF-8] (original) +++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/AbstractIdentification.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -23,7 +23,7 @@ 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 org.opengis.annotation.UML; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.opengis.metadata.Identifier; import org.opengis.metadata.citation.Citation; import org.opengis.metadata.citation.ResponsibleParty; @@ -45,9 +45,14 @@ import org.opengis.metadata.spatial.Spat import org.opengis.util.InternationalString; import org.apache.sis.internal.metadata.Dependencies; import org.apache.sis.internal.metadata.LegacyPropertyAdapter; +import org.apache.sis.internal.jaxb.metadata.MD_Identifier; +import org.apache.sis.internal.jaxb.FilterByVersion; +import org.apache.sis.internal.jaxb.LegacyNamespaces; import org.apache.sis.metadata.iso.ISOMetadata; import org.apache.sis.util.iso.Types; +// Branch-specific imports +import org.opengis.annotation.UML; import static org.opengis.annotation.Obligation.OPTIONAL; import static org.opengis.annotation.Obligation.CONDITIONAL; import static org.opengis.annotation.Specification.ISO_19115; @@ -82,7 +87,8 @@ import static org.opengis.annotation.Spe * @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 */ @@ -94,17 +100,28 @@ import static org.opengis.annotation.Spe "credits", "status", "pointOfContacts", + "spatialRepresentationTypes", // Here in ISO 19115:2014 (was after 'aggregationInfo' in ISO 19115:2003) + "spatialResolutions", // Shall be kept next to 'spatialRepresentationTypes' + "topicCategories", // Here in ISO 19115:2014 (was in subclasses in ISO 19115:2003) + "extents", // Here in ISO 19115:2014 (was in subclasses in ISO 19115:2003) + "additionalDocumentation", // ISO 19115:2014 only + "processingLevel", // ISO 19115:2014 only "resourceMaintenances", "graphicOverviews", "resourceFormats", "descriptiveKeywords", "resourceSpecificUsages", "resourceConstraints", - "aggregationInfo", - "spatialRepresentationTypes", // After 'pointOfContact' according ISO 19115:2014, but here for ISO 19115:2003 compatibility. - "spatialResolutions" // Shall be kept next to 'spatialRepresentationTypes' + "associatedResource", + "aggregationInfo", // Legacy ISO 19115:2003 (replaced by 'associatedResources') + /* + * NOTE: legacy ISO 19115:2003 specification had 'spatialRepresentationTypes' and 'spatialResolutions' + * elements last. If we wanted to produce strictly compliant legacy XML documents, we would have + * to duplicate those attributes. We avoid this complexity on the assumption that readers are + * tolerant to different order (this relaxation is needed only for legacy XML). + */ }) -@XmlRootElement(name = "MD_Identification") +@XmlRootElement(name = "AbstractMD_Identification") @XmlSeeAlso({ DefaultDataIdentification.class, DefaultServiceIdentification.class @@ -505,7 +522,7 @@ public class AbstractIdentification exte * * @since 0.5 */ -/// @XmlElement(name = "topicCategory") + @XmlElement(name = "topicCategory") @UML(identifier="topicCategory", obligation=CONDITIONAL, specification=ISO_19115) public Collection<TopicCategory> getTopicCategories() { return topicCategories = nonNullCollection(topicCategories, TopicCategory.class); @@ -529,7 +546,7 @@ public class AbstractIdentification exte * * @since 0.5 */ -/// @XmlElement(name = "extent") + @XmlElement(name = "extent") @UML(identifier="extent", obligation=CONDITIONAL, specification=ISO_19115) public Collection<Extent> getExtents() { return extents = nonNullCollection(extents, Extent.class); @@ -553,7 +570,7 @@ public class AbstractIdentification exte * * @since 0.5 */ -/// @XmlElement(name = "additionalDocumentation") + // @XmlElement at the end of this class. @UML(identifier="additionalDocumentation", obligation=OPTIONAL, specification=ISO_19115) public Collection<Citation> getAdditionalDocumentations() { return additionalDocumentations = nonNullCollection(additionalDocumentations, Citation.class); @@ -577,7 +594,8 @@ public class AbstractIdentification exte * * @since 0.5 */ -/// @XmlElement(name = "processingLevel") + @XmlElement(name = "processingLevel") + @XmlJavaTypeAdapter(MD_Identifier.Since2014.class) @UML(identifier="processingLevel", obligation=OPTIONAL, specification=ISO_19115) public Identifier getProcessingLevel() { return processingLevel; @@ -733,7 +751,7 @@ public class AbstractIdentification exte * * @since 0.5 */ -/// @XmlElement(name = "associatedResource") + // @XmlElement at the end of this class. @UML(identifier="associatedResource", obligation=OPTIONAL, specification=ISO_19115) public Collection<DefaultAssociatedResource> getAssociatedResources() { return associatedResources = nonNullCollection(associatedResources, DefaultAssociatedResource.class); @@ -764,9 +782,10 @@ public class AbstractIdentification exte */ @Override @Deprecated - @XmlElement(name = "aggregationInfo") @Dependencies("getAssociatedResources") + @XmlElement(name = "aggregationInfo", namespace = LegacyNamespaces.GMD) public Collection<AggregateInformation> getAggregationInfo() { + if (!FilterByVersion.LEGACY_METADATA.accept()) return null; return new LegacyPropertyAdapter<AggregateInformation,DefaultAssociatedResource>(getAssociatedResources()) { @Override protected DefaultAssociatedResource wrap(final AggregateInformation value) { return DefaultAssociatedResource.castOrCopy(value); @@ -810,4 +829,33 @@ public class AbstractIdentification exte } setAssociatedResources(r); } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// 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> getAdditionalDocumentation() { + return FilterByVersion.CURRENT_METADATA.accept() ? getAdditionalDocumentations() : null; + } + + @XmlElement(name = "associatedResource") + private Collection<DefaultAssociatedResource> getAssociatedResource() { + return FilterByVersion.CURRENT_METADATA.accept() ? getAssociatedResources() : null; + } } Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultAggregateInformation.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultAggregateInformation.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultAggregateInformation.java [UTF-8] (original) +++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultAggregateInformation.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -22,6 +22,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.metadata.Identifier; import org.opengis.metadata.citation.Citation; import org.opengis.metadata.identification.AggregateInformation; @@ -29,6 +30,9 @@ import org.opengis.metadata.identificati import org.opengis.metadata.identification.InitiativeType; import org.apache.sis.metadata.iso.citation.DefaultCitation; import org.apache.sis.internal.metadata.Dependencies; +import org.apache.sis.internal.jaxb.LegacyNamespaces; +import org.apache.sis.internal.jaxb.code.DS_AssociationTypeCode; +import org.apache.sis.internal.jaxb.code.DS_InitiativeTypeCode; /** @@ -63,18 +67,19 @@ import org.apache.sis.internal.metadata. * * @author Guilhem Legal (Geomatys) * @author Martin Desruisseaux (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_AggregateInformation_Type", propOrder = { +@XmlType(name = "MD_AggregateInformation_Type", namespace = LegacyNamespaces.GMD, propOrder = { "aggregateDataSetName", "aggregateDataSetIdentifier", - "associationType", - "initiativeType" + "association", // Actually "associationType", in replacement of the one defined in parent class. + "initiative" // Actually "initiativeType", ibid. }) -@XmlRootElement(name = "MD_AggregateInformation") +@XmlRootElement(name = "MD_AggregateInformation", namespace = LegacyNamespaces.GMD) public class DefaultAggregateInformation extends DefaultAssociatedResource implements AggregateInformation { /** * Serial number for compatibility with different versions. @@ -145,8 +150,8 @@ public class DefaultAggregateInformation */ @Override @Deprecated - @XmlElement(name = "aggregateDataSetName") @Dependencies("getName") + @XmlElement(name = "aggregateDataSetName") public Citation getAggregateDataSetName() { return getName(); } @@ -172,8 +177,8 @@ public class DefaultAggregateInformation */ @Override @Deprecated - @XmlElement(name = "aggregateDataSetIdentifier") @Dependencies("getName") + @XmlElement(name = "aggregateDataSetIdentifier") public Identifier getAggregateDataSetIdentifier() { return getAggregateDataSetIdentifier(getAggregateDataSetName()); } @@ -181,7 +186,7 @@ public class DefaultAggregateInformation /** * Returns the first identifier of the given citation. */ - static Identifier getAggregateDataSetIdentifier(final Citation name) { + private static Identifier getAggregateDataSetIdentifier(final Citation name) { if (name != null) { final Collection<? extends Identifier> names = name.getIdentifiers(); if (names != null) { // May be null on XML marshalling. @@ -230,45 +235,52 @@ public class DefaultAggregateInformation } } + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// 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. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** - * Returns the type of relation between the resources. - * - * @return association type of the aggregate dataset. + * For (un)marshalling the {@code associationType} element at the location expected by ISO 19139:2007 schemas. + * We do not rely on {@code org.apache.sis.xml.TransformingWriter} reordering mechanism because this element + * is interleaved with other element to reorder (namely {@code "topicCategory"} and {@code "extent"}), and + * expanding {@code TransformingWriter} to handle those cases would be complicated. */ - @Override - @XmlElement(name = "associationType", required = true) - public AssociationType getAssociationType() { - return super.getAssociationType(); + @XmlElement(name = "associationType") + @XmlJavaTypeAdapter(DS_AssociationTypeCode.class) + private AssociationType getAssociation() { + return getAssociationType(); } - /** - * Sets the type of relation between the resources. - * - * @param newValue the new association type. - */ - @Override - public void setAssociationType(final AssociationType newValue) { - super.setAssociationType(newValue); + /** Must be declared together with {@link #getAssociation()}. */ + @SuppressWarnings("unused") + private void setAssociation(final AssociationType newValue) { + setAssociationType(newValue); } /** - * Returns the type of initiative under which the associated resource was produced, or {@code null} if none. - * - * @return type of initiative under which the aggregate dataset was produced, or {@code null}. + * For (un)marshalling the {@code initiativeType} element at the location expected by ISO 19139:2007 schemas. + * See {@link #getAssociation()} for more explanation. */ - @Override @XmlElement(name = "initiativeType") - public InitiativeType getInitiativeType() { - return super.getInitiativeType(); + @XmlJavaTypeAdapter(DS_InitiativeTypeCode.class) + private InitiativeType getInitiative() { + return getInitiativeType(); } - /** - * Sets a new type of initiative under which the associated resource was produced. - * - * @param newValue the new initiative. - */ - @Override - public void setInitiativeType(final InitiativeType newValue) { - super.setInitiativeType(newValue); + /** Must be declared together with {@link #getInitiative()}. */ + @SuppressWarnings("unused") + private void setInitiative(final InitiativeType newValue) { + setInitiativeType(newValue); } } Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultAssociatedResource.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultAssociatedResource.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultAssociatedResource.java [UTF-8] (original) +++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultAssociatedResource.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -19,10 +19,14 @@ package org.apache.sis.metadata.iso.iden 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.metadata.citation.Citation; import org.opengis.metadata.identification.AggregateInformation; import org.opengis.metadata.identification.AssociationType; import org.opengis.metadata.identification.InitiativeType; +import org.apache.sis.internal.jaxb.metadata.CI_Citation; +import org.apache.sis.internal.jaxb.code.DS_AssociationTypeCode; +import org.apache.sis.internal.jaxb.code.DS_InitiativeTypeCode; import org.apache.sis.metadata.iso.ISOMetadata; // Branch-specific imports. @@ -59,17 +63,18 @@ import static org.opengis.annotation.Spe * * @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 = "MD_AssociatedResource_Type" /*, propOrder = { +@XmlType(name = "MD_AssociatedResource_Type", propOrder = { "name", "associationType", "initiativeType", "metadataReference" -}*/) +}) @XmlRootElement(name = "MD_AssociatedResource") @UML(identifier="MD_AssociatedResource", specification=ISO_19115) public class DefaultAssociatedResource extends ISOMetadata { @@ -165,7 +170,8 @@ public class DefaultAssociatedResource e * * @return Citation information about the associated resource, or {@code null} if none. */ -/// @XmlElement(name = "name") + @XmlElement(name = "name") + @XmlJavaTypeAdapter(CI_Citation.Since2014.class) @UML(identifier="name", obligation=CONDITIONAL, specification=ISO_19115) public Citation getName() { return name; @@ -186,7 +192,8 @@ public class DefaultAssociatedResource e * * @return type of relation between the resources. */ -/// @XmlElement(name = "associationType", required = true) + @XmlElement(name = "associationType", required = true) + @XmlJavaTypeAdapter(DS_AssociationTypeCode.Since2014.class) @UML(identifier="associationType", obligation=MANDATORY, specification=ISO_19115) public AssociationType getAssociationType() { return associationType; @@ -207,7 +214,8 @@ public class DefaultAssociatedResource e * * @return the type of initiative under which the associated resource was produced, or {@code null} if none. */ -/// @XmlElement(name = "initiativeType") + @XmlElement(name = "initiativeType") + @XmlJavaTypeAdapter(DS_InitiativeTypeCode.Since2014.class) @UML(identifier="initiativeType", obligation=OPTIONAL, specification=ISO_19115) public InitiativeType getInitiativeType() { return initiativeType; @@ -228,7 +236,8 @@ public class DefaultAssociatedResource e * * @return reference to the metadata of the associated resource, or {@code null} if none. */ -/// @XmlElement(name = "metadataReference") + @XmlElement(name = "metadataReference") + @XmlJavaTypeAdapter(CI_Citation.Since2014.class) @UML(identifier="metadataReference", obligation=CONDITIONAL, specification=ISO_19115) public Citation getMetadataReference() { return metadataReference; Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphic.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphic.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphic.java [UTF-8] (original) +++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphic.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -22,14 +22,17 @@ 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.annotation.UML; import org.opengis.util.InternationalString; import org.opengis.metadata.citation.OnlineResource; import org.opengis.metadata.constraint.Constraints; import org.opengis.metadata.identification.BrowseGraphic; import org.apache.sis.metadata.iso.ISOMetadata; import org.apache.sis.internal.jaxb.gmx.MimeFileTypeAdapter; +import org.apache.sis.internal.jaxb.FilterByVersion; +import org.apache.sis.xml.Namespaces; +// Branch-specific imports +import org.opengis.annotation.UML; import static org.opengis.annotation.Obligation.OPTIONAL; import static org.opengis.annotation.Specification.ISO_19115; @@ -54,17 +57,20 @@ import static org.opengis.annotation.Spe * @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_BrowseGraphic_Type", propOrder = { +@XmlType(name = "MD_BrowseGraphic_Type", namespace = Namespaces.MCC, propOrder = { "fileName", "fileDescription", - "fileType" + "fileType", + "linkage", // New in ISO 19115:2014 + "imageConstraint" // Ibid. }) -@XmlRootElement(name = "MD_BrowseGraphic") +@XmlRootElement(name = "MD_BrowseGraphic", namespace = Namespaces.MCC) public class DefaultBrowseGraphic extends ISOMetadata implements BrowseGraphic { /** * Serial number for compatibility with different versions. @@ -236,7 +242,7 @@ public class DefaultBrowseGraphic extend * * @since 0.5 */ -/// @XmlElement(name = "imageConstraints") + // @XmlElement at the end of this class. @UML(identifier="imageContraints", obligation=OPTIONAL, specification=ISO_19115) public Collection<Constraints> getImageConstraints() { return imageConstraints = nonNullCollection(imageConstraints, Constraints.class); @@ -260,7 +266,7 @@ public class DefaultBrowseGraphic extend * * @since 0.5 */ -/// @XmlElement(name = "linkage") + // @XmlElement at the end of this class. @UML(identifier="linkage", obligation=OPTIONAL, specification=ISO_19115) public Collection<OnlineResource> getLinkages() { return linkages = nonNullCollection(linkages, OnlineResource.class); @@ -276,4 +282,33 @@ public class DefaultBrowseGraphic extend public void setLinkages(final Collection<? extends OnlineResource> newValues) { linkages = writeCollection(newValues, linkages, OnlineResource.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 = "imageConstraints") + private Collection<Constraints> getImageConstraint() { + return FilterByVersion.CURRENT_METADATA.accept() ? getImageConstraints() : null; + } + + @XmlElement(name = "linkage") + private Collection<OnlineResource> getLinkage() { + return FilterByVersion.CURRENT_METADATA.accept() ? getLinkages() : null; + } } Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultCoupledResource.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultCoupledResource.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultCoupledResource.java [UTF-8] (original) +++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultCoupledResource.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -19,18 +19,21 @@ 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.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; - // Branch-specific imports import org.opengis.annotation.UML; import static org.opengis.annotation.Obligation.OPTIONAL; @@ -59,18 +62,20 @@ import static org.opengis.annotation.Spe * * @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) @UML(identifier="SV_CoupledResource", specification=ISO_19115) @@ -147,8 +152,8 @@ public class DefaultCoupledResource exte * * @return identifier of the resource, or {@code null} if none. */ - @XmlElementRef - @XmlJavaTypeAdapter(GO_ScopedName.class) + @XmlElement(name = "scopedName") + @XmlJavaTypeAdapter(GO_GenericName.Since2014.class) @UML(identifier="scopedName", obligation=OPTIONAL, specification=ISO_19115) public ScopedName getScopedName() { return scopedName; @@ -169,7 +174,7 @@ public class DefaultCoupledResource exte * * @return references to the resource on which the services operates. */ -/// @XmlElement(name = "resourceReference", namespace = Namespaces.SRV) + // @XmlElement at the end of this class. @UML(identifier="resourceReference", obligation=OPTIONAL, specification=ISO_19115) public Collection<Citation> getResourceReferences() { return resourceReferences = nonNullCollection(resourceReferences, Citation.class); @@ -189,7 +194,7 @@ public class DefaultCoupledResource exte * * @return tightly coupled resources. */ -/// @XmlElement(name = "resource", namespace = Namespaces.SRV) + // @XmlElement at the end of this class. @UML(identifier="resource", obligation=OPTIONAL, specification=ISO_19115) public Collection<DataIdentification> getResources() { return resources = nonNullCollection(resources, DataIdentification.class); @@ -214,7 +219,8 @@ public class DefaultCoupledResource exte * * @return the service operation, or {@code null} if none. */ -/// @XmlElement(name = "operation", namespace = Namespaces.SRV) + @XmlElement(name = "operation") + @XmlJavaTypeAdapter(SV_OperationMetadata.Since2014.class) @UML(identifier="operation", obligation=OPTIONAL, specification=ISO_19115) public DefaultOperationMetadata getOperation() { return operation; @@ -250,11 +256,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 DefaultOperationMetadata operation = getOperation(); if (operation != null) { return operation.getOperationName(); @@ -264,10 +270,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); @@ -276,10 +283,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(); @@ -287,4 +296,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/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java [UTF-8] (original) +++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -22,14 +22,17 @@ 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.CharacterSet; 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; /** @@ -63,18 +66,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 { @@ -185,7 +198,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); } @@ -209,7 +222,7 @@ public class DefaultDataIdentification e * @return character coding standard(s) used. */ @Override - @XmlElement(name = "characterSet") + @XmlElement(name = "characterSet", namespace = LegacyNamespaces.GMD) public Collection<CharacterSet> getCharacterSets() { return characterSets = nonNullCollection(characterSets, CharacterSet.class); } @@ -285,32 +298,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/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultKeywordClass.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultKeywordClass.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultKeywordClass.java [UTF-8] (original) +++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultKeywordClass.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -56,7 +56,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/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultKeywords.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultKeywords.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultKeywords.java [UTF-8] (original) +++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultKeywords.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -20,15 +20,17 @@ import java.util.Collection; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; -import org.opengis.util.CodeList; -import org.opengis.annotation.UML; +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.apache.sis.internal.jaxb.metadata.MD_KeywordClass; import org.apache.sis.metadata.iso.ISOMetadata; import org.apache.sis.util.iso.Types; +// Branch-specific imports +import org.opengis.annotation.UML; import static org.opengis.annotation.Obligation.OPTIONAL; import static org.opengis.annotation.Specification.ISO_19115; @@ -52,7 +54,8 @@ import static org.opengis.annotation.Spe * @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 +63,8 @@ import static org.opengis.annotation.Spe @XmlType(name = "MD_Keywords_Type", propOrder = { "keywords", "type", - "thesaurusName" + "thesaurusName", + "keywordClass" }) @XmlRootElement(name = "MD_Keywords") public class DefaultKeywords extends ISOMetadata implements Keywords { @@ -88,7 +92,7 @@ public class DefaultKeywords extends ISO * User-defined categorization of groups of keywords that extend or are orthogonal * to the standardized {@linkplain #getType() keyword type} codes. */ - private CodeList<?> keywordClass; + private DefaultKeywordClass keywordClass; /** * Constructs an initially empty keywords. @@ -225,8 +229,8 @@ public class DefaultKeywords extends ISO * Returns the user-defined categorization of groups of keywords that extend or * are orthogonal to the standardized {@linkplain #getType() keyword type} codes. * - * <div class="warning"><b>Upcoming API change — specialization</b><br> - * The element type will be changed to the {@code KeywordClass} code list + * <div class="warning"><b>Upcoming API change — generalization</b><br> + * The element type will be changed to the {@code KeywordClass} interface * when GeoAPI will provide it (tentatively in GeoAPI 3.1). * </div> * @@ -234,48 +238,25 @@ public class DefaultKeywords extends ISO * * @since 0.5 */ + @XmlElement(name = "keywordClass") + @XmlJavaTypeAdapter(MD_KeywordClass.Since2014.class) @UML(identifier="keywordClass", obligation=OPTIONAL, specification=ISO_19115) - public CodeList<?> getKeywordClass() { + public DefaultKeywordClass getKeywordClass() { return keywordClass; } /** * Sets the user-defined categorization of groups of keywords. * - * <div class="warning"><b>Upcoming API change — specialization</b><br> - * The argument type will be changed to the {@code KeywordClass} code list when GeoAPI will provide it - * (tentatively in GeoAPI 3.1). In the meantime, users can define their own code list class as below: - * - * {@preformat java - * final class UnsupportedCodeList extends CodeList<UnsupportedCodeList> { - * private static final List<UnsupportedCodeList> VALUES = new ArrayList<UnsupportedCodeList>(); - * - * // Need to declare at least one code list element. - * public static final UnsupportedCodeList MY_CODE_LIST = new UnsupportedCodeList("MY_CODE_LIST"); - * - * private UnsupportedCodeList(String name) { - * super(name, VALUES); - * } - * - * public static UnsupportedCodeList valueOf(String code) { - * return valueOf(UnsupportedCodeList.class, code); - * } - * - * @Override - * public UnsupportedCodeList[] family() { - * synchronized (VALUES) { - * return VALUES.toArray(new UnsupportedCodeList[VALUES.size()]); - * } - * } - * } - * } - * </div> + * <div class="warning"><b>Upcoming API change — generalization</b><br> + * The argument type will be changed to the {@code KeywordClass} interface when GeoAPI will provide it + * (tentatively in GeoAPI 3.1).</div> * * @param newValue new user-defined categorization of groups of keywords. * * @since 0.5 */ - public void setKeywordClass(final CodeList<?> newValue) { + public void setKeywordClass(final DefaultKeywordClass newValue) { checkWritePermission(); keywordClass = newValue; } Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationChainMetadata.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationChainMetadata.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationChainMetadata.java [UTF-8] (original) +++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationChainMetadata.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -64,7 +64,7 @@ import static org.opengis.annotation.Spe * * @author Rémi Maréchal (Geomatys) * @author Martin Desruisseaux (Geomatys) - * @version 0.5 + * @version 1.0 * @since 0.5 * @module */ Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationMetadata.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationMetadata.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationMetadata.java [UTF-8] (original) +++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationMetadata.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -23,10 +23,10 @@ import javax.xml.bind.annotation.XmlElem import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.opengis.util.InternationalString; +import org.opengis.parameter.ParameterDescriptor; +import org.opengis.metadata.citation.OnlineResource; import org.apache.sis.metadata.iso.ISOMetadata; import org.apache.sis.metadata.TitleProperty; -import org.opengis.metadata.citation.OnlineResource; -import org.opengis.parameter.ParameterDescriptor; import org.apache.sis.xml.Namespaces; // Branch-specific imports @@ -67,7 +67,8 @@ import static org.opengis.annotation.Spe * * @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 */ @@ -75,11 +76,11 @@ import static org.opengis.annotation.Spe @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) @@ -138,7 +139,7 @@ public class DefaultOperationMetadata ex * * @param object the metadata to copy values from, or {@code null} if none. */ - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "rawtypes"}) public DefaultOperationMetadata(final DefaultOperationMetadata object) { super(object); if (object != null) { @@ -157,7 +158,7 @@ public class DefaultOperationMetadata ex * * @return an unique identifier for this interface. */ - @XmlElement(name = "operationName", namespace = Namespaces.SRV, required = true) + @XmlElement(name = "operationName", required = true) @UML(identifier="operationName", obligation=MANDATORY, specification=ISO_19115) public String getOperationName() { return operationName; @@ -184,7 +185,7 @@ public class DefaultOperationMetadata ex * @return distributed computing platforms on which the operation has been implemented. */ @XmlJavaTypeAdapter(DCPList.class) - @XmlElement(name = "DCP", namespace = Namespaces.SRV, required = true) + @XmlElement(name = "distributedComputingPlatform", required = true) @UML(identifier="distributedComputingPlatform", obligation=MANDATORY, specification=ISO_19115) public Collection<CodeList<?>> getDistributedComputingPlatforms() { return distributedComputingPlatforms = nonNullCollection(distributedComputingPlatforms, (Class) CodeList.class); @@ -233,7 +234,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. */ - @XmlElement(name = "operationDescription", namespace = Namespaces.SRV) + @XmlElement(name = "operationDescription") @UML(identifier="operationDescription", obligation=OPTIONAL, specification=ISO_19115) public InternationalString getOperationDescription() { return operationDescription; @@ -255,7 +256,7 @@ public class DefaultOperationMetadata ex * @return the name used to invoke this interface within the context of the distributed computing platforms, * or {@code null} if none. */ - @XmlElement(name = "invocationName", namespace = Namespaces.SRV) + @XmlElement(name = "invocationName") @UML(identifier="invocationName", obligation=OPTIONAL, specification=ISO_19115) public InternationalString getInvocationName() { return invocationName; @@ -276,7 +277,7 @@ public class DefaultOperationMetadata ex * * @return handle for accessing the service interface. */ - @XmlElement(name = "connectPoint", namespace = Namespaces.SRV, required = true) + @XmlElement(name = "connectPoint", required = true) @UML(identifier="connectPoint", obligation=MANDATORY, specification=ISO_19115) public Collection<OnlineResource> getConnectPoints() { return connectPoints = nonNullCollection(connectPoints, OnlineResource.class); @@ -296,8 +297,8 @@ public class DefaultOperationMetadata ex * * @return the parameters that are required for this interface, or an empty collection if none. */ - @SuppressWarnings("unchecked") - @XmlElement(name = "parameters", namespace = Namespaces.SRV) + @XmlElement(name = "parameter") + @SuppressWarnings({"unchecked", "rawtypes"}) @UML(identifier="parameters", obligation=OPTIONAL, specification=ISO_19115) public Collection<ParameterDescriptor<?>> getParameters() { return parameters = nonNullCollection(parameters, (Class) ParameterDescriptor.class); @@ -308,7 +309,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); } @@ -323,7 +324,7 @@ public class DefaultOperationMetadata ex * * @return list of operation that must be completed immediately, or an empty list if none. */ - @XmlElement(name = "dependsOn", namespace = Namespaces.SRV) + @XmlElement(name = "dependsOn") @UML(identifier="dependsOn", obligation=OPTIONAL, specification=ISO_19115) public List<DefaultOperationMetadata> getDependsOn() { return dependsOn = nonNullList(dependsOn, DefaultOperationMetadata.class); Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultRepresentativeFraction.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultRepresentativeFraction.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultRepresentativeFraction.java [UTF-8] (original) +++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultRepresentativeFraction.java [UTF-8] Mon Feb 26 11:28:17 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/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultResolution.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultResolution.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultResolution.java [UTF-8] (original) +++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultResolution.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -20,12 +20,13 @@ 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.annotation.UML; import org.opengis.util.InternationalString; import org.opengis.metadata.identification.RepresentativeFraction; 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; @@ -33,6 +34,7 @@ import org.apache.sis.util.resources.Mes import static org.apache.sis.internal.metadata.MetadataUtilities.ensurePositive; // Branch-specific imports +import org.opengis.annotation.UML; import static org.opengis.annotation.Obligation.CONDITIONAL; import static org.opengis.annotation.Specification.ISO_19115; @@ -68,7 +70,8 @@ import static org.opengis.annotation.Spe * @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() * @@ -294,8 +297,10 @@ public class DefaultResolution extends I * * @since 0.5 */ - @UML(identifier="vertical", obligation=CONDITIONAL, specification=ISO_19115) @ValueRange(minimum=0, isMinIncluded=false) + @XmlElement(name = "vertical") + @XmlJavaTypeAdapter(GO_Real.Since2014.class) + @UML(identifier="vertical", obligation=CONDITIONAL, specification=ISO_19115) public Double getVertical() { return (property == VERTICAL) ? (Double) value : null; } @@ -325,8 +330,10 @@ public class DefaultResolution extends I * * @since 0.5 */ - @UML(identifier="angularDistance", obligation=CONDITIONAL, specification=ISO_19115) @ValueRange(minimum=0, isMinIncluded=false) + @XmlElement(name = "angularDistance") + @XmlJavaTypeAdapter(GO_Real.Since2014.class) + @UML(identifier="angularDistance", obligation=CONDITIONAL, specification=ISO_19115) public Double getAngularDistance() { return (property == ANGULAR) ? (Double) value : null; } @@ -356,6 +363,8 @@ public class DefaultResolution extends I * * @since 0.5 */ + @XmlElement(name = "levelOfDetail") + @XmlJavaTypeAdapter(InternationalStringAdapter.Since2014.class) @UML(identifier="levelOfDetail", obligation=CONDITIONAL, specification=ISO_19115) public InternationalString getLevelOfDetail() { return (property == TEXT) ? (InternationalString) value : null; Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.java [UTF-8] (original) +++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -22,7 +22,6 @@ 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.annotation.UML; import org.opengis.util.CodeList; import org.opengis.util.GenericName; import org.opengis.metadata.citation.Citation; @@ -30,8 +29,11 @@ import org.opengis.metadata.identificati import org.opengis.metadata.distribution.StandardOrderProcess; import org.opengis.metadata.identification.ServiceIdentification; import org.apache.sis.internal.jaxb.code.SV_CouplingType; +import org.apache.sis.internal.jaxb.FilterByVersion; import org.apache.sis.xml.Namespaces; +// Branch-specific imports +import org.opengis.annotation.UML; import static org.opengis.annotation.Obligation.OPTIONAL; import static org.opengis.annotation.Obligation.MANDATORY; import static org.opengis.annotation.Obligation.CONDITIONAL; @@ -72,23 +74,24 @@ import static org.opengis.annotation.Spe * @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 { @@ -232,7 +235,7 @@ public class DefaultServiceIdentificatio * * @return a service type name. */ - @XmlElement(name = "serviceType", namespace = Namespaces.SRV, required = true) + @XmlElement(name = "serviceType", required = true) @UML(identifier="serviceType", obligation=MANDATORY, specification=ISO_19115) public GenericName getServiceType() { return serviceType; @@ -253,7 +256,7 @@ public class DefaultServiceIdentificatio * * @return the versions of the service. */ - @XmlElement(name = "serviceTypeVersion", namespace = Namespaces.SRV) + @XmlElement(name = "serviceTypeVersion") @UML(identifier="serviceTypeVersion", obligation=OPTIONAL, specification=ISO_19115) public Collection<String> getServiceTypeVersions() { return serviceTypeVersions = nonNullCollection(serviceTypeVersions, String.class); @@ -275,7 +278,7 @@ public class DefaultServiceIdentificatio * * @since 0.5 */ -/// @XmlElement(name = "accessProperties", namespace = Namespaces.SRV) + @XmlElement(name = "accessProperties") @UML(identifier="accessProperties", obligation=OPTIONAL, specification=ISO_19115) public StandardOrderProcess getAccessProperties() { return accessProperties; @@ -305,7 +308,7 @@ public class DefaultServiceIdentificatio * @return type of coupling between service and associated data, or {@code null} if none. */ @XmlJavaTypeAdapter(SV_CouplingType.class) - @XmlElement(name = "couplingType", namespace = Namespaces.SRV) + @XmlElement(name = "couplingType") @UML(identifier="couplingType", obligation=CONDITIONAL, specification=ISO_19115) public CodeList<?> getCouplingType() { return couplingType; @@ -360,7 +363,7 @@ public class DefaultServiceIdentificatio * * @return further description(s) of the data coupling in the case of tightly coupled services. */ - @XmlElement(name = "coupledResource", namespace = Namespaces.SRV) + @XmlElement(name = "coupledResource") @UML(identifier="coupledResource", obligation=CONDITIONAL, specification=ISO_19115) public Collection<DefaultCoupledResource> getCoupledResources() { return coupledResources = nonNullCollection(coupledResources, DefaultCoupledResource.class); @@ -387,7 +390,7 @@ public class DefaultServiceIdentificatio * * @since 0.5 */ -/// @XmlElement(name = "operatedDataset", namespace = Namespaces.SRV) + // @XmlElement at the end of this class. @UML(identifier="operatedDataset", obligation=OPTIONAL, specification=ISO_19115) public Collection<Citation> getOperatedDatasets() { return operatedDatasets = nonNullCollection(operatedDatasets, Citation.class); @@ -411,7 +414,7 @@ public class DefaultServiceIdentificatio * * @since 0.5 */ -/// @XmlElement(name = "profile", namespace = Namespaces.SRV) + // @XmlElement at the end of this class. @UML(identifier="profile", obligation=OPTIONAL, specification=ISO_19115) public Collection<Citation> getProfiles() { return profiles = nonNullCollection(profiles, Citation.class); @@ -433,7 +436,7 @@ public class DefaultServiceIdentificatio * * @since 0.5 */ -/// @XmlElement(name = "serviceStandard", namespace = Namespaces.SRV) + // @XmlElement at the end of this class. @UML(identifier="serviceStandard", obligation=OPTIONAL, specification=ISO_19115) public Collection<Citation> getServiceStandards() { return serviceStandards = nonNullCollection(serviceStandards, Citation.class); @@ -460,7 +463,7 @@ public class DefaultServiceIdentificatio * * @return information about the operations that comprise the service. */ - @XmlElement(name = "containsOperations", namespace = Namespaces.SRV) + @XmlElement(name = "containsOperations") @UML(identifier="containsOperations", obligation=OPTIONAL, specification=ISO_19115) public Collection<DefaultOperationMetadata> getContainsOperations() { return containsOperations = nonNullCollection(containsOperations, DefaultOperationMetadata.class); @@ -485,7 +488,7 @@ public class DefaultServiceIdentificatio * * @return information on the resources that the service operates on. */ - @XmlElement(name = "operatesOn", namespace = Namespaces.SRV) + @XmlElement(name = "operatesOn") @UML(identifier="operatesOn", obligation=OPTIONAL, specification=ISO_19115) public Collection<DataIdentification> getOperatesOn() { return operatesOn = nonNullCollection(operatesOn, DataIdentification.class); @@ -512,7 +515,7 @@ public class DefaultServiceIdentificatio * * @since 0.5 */ -/// @XmlElement(name = "containsChain", namespace = Namespaces.SRV) + // @XmlElement at the end of this class. @UML(identifier="containsChain", obligation=OPTIONAL, specification=ISO_19115) public Collection<DefaultOperationChainMetadata> getContainsChain() { return containsChain = nonNullCollection(containsChain, DefaultOperationChainMetadata.class); @@ -549,8 +552,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<DefaultOperationChainMetadata> 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/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultUsage.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultUsage.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultUsage.java [UTF-8] (original) +++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultUsage.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -21,15 +21,17 @@ import java.util.Collection; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; -import org.opengis.annotation.UML; import org.opengis.util.InternationalString; import org.opengis.metadata.citation.Citation; import org.opengis.metadata.citation.ResponsibleParty; 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; +// Branch-specific imports +import org.opengis.annotation.UML; import static org.opengis.annotation.Obligation.OPTIONAL; import static org.opengis.annotation.Specification.ISO_19115; import static org.apache.sis.internal.metadata.MetadataUtilities.toDate; @@ -61,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 */ @@ -71,7 +74,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 { @@ -262,7 +268,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<ResponsibleParty> getUserContactInfo() { return userContactInfo = nonNullCollection(userContactInfo, ResponsibleParty.class); } @@ -288,9 +294,9 @@ public class DefaultUsage extends ISOMet * * @since 0.5 */ -/// @XmlElement(name = "response") + // @XmlElement at the end of this class. @UML(identifier="response", obligation=OPTIONAL, specification=ISO_19115) - public Collection<? extends InternationalString> getResponses() { + public Collection<InternationalString> getResponses() { return responses = nonNullCollection(responses, InternationalString.class); } @@ -312,7 +318,7 @@ public class DefaultUsage extends ISOMet * * @since 0.5 */ -/// @XmlElement(name = "additionalDocumentation") + // @XmlElement at the end of this class. @UML(identifier="additionalDocumentation", obligation=OPTIONAL, specification=ISO_19115) public Collection<Citation> getAdditionalDocumentation() { return additionalDocumentation = nonNullCollection(additionalDocumentation, Citation.class); @@ -337,9 +343,9 @@ public class DefaultUsage extends ISOMet * * @since 0.5 */ -/// @XmlElement(name = "identifiedIssues") + // @XmlElement at the end of this class. @UML(identifier="identifiedIssues", obligation=OPTIONAL, specification=ISO_19115) - public Collection<? extends Citation> getIdentifiedIssues() { + public Collection<Citation> getIdentifiedIssues() { return identifiedIssues = nonNullCollection(identifiedIssues, Citation.class); } @@ -354,4 +360,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/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/OperationName.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/OperationName.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/OperationName.java [UTF-8] (original) +++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/OperationName.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -90,7 +90,7 @@ final class OperationName extends Defaul final boolean exists = byName.containsKey(name); final DefaultOperationMetadata 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/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java [UTF-8] (original) +++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -95,27 +95,34 @@ * @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({ @XmlJavaTypeAdapter(CI_Citation.class), @XmlJavaTypeAdapter(CI_OnlineResource.class), @XmlJavaTypeAdapter(CI_ResponsibleParty.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_BrowseGraphic.class), @XmlJavaTypeAdapter(MD_CharacterSetCode.class), + @XmlJavaTypeAdapter(MD_CharacterSetLegacy.class), @XmlJavaTypeAdapter(MD_Constraints.class), @XmlJavaTypeAdapter(MD_DataIdentification.class), @XmlJavaTypeAdapter(MD_Format.class), @@ -130,19 +137,17 @@ @XmlJavaTypeAdapter(MD_StandardOrderProcess.class), @XmlJavaTypeAdapter(MD_TopicCategoryCode.class), @XmlJavaTypeAdapter(MD_Usage.class), + @XmlJavaTypeAdapter(PT_Locale.class), @XmlJavaTypeAdapter(SV_CoupledResource.class), @XmlJavaTypeAdapter(SV_OperationMetadata.class), @XmlJavaTypeAdapter(SV_OperationChainMetadata.class), @XmlJavaTypeAdapter(SV_Parameter.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; @@ -154,8 +159,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.*;
