You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2018/02/01 15:48:24 UTC
svn commit: r1822885 - in /sis/branches/ISO-19115-3/core/sis-metadata/src:
main/java/org/apache/sis/metadata/iso/
main/java/org/apache/sis/metadata/iso/citation/
main/java/org/apache/sis/metadata/iso/content/
main/java/org/apache/sis/metadata/iso/distr...
Author: desruisseaux
Date: Thu Feb 1 15:48:23 2018
New Revision: 1822885
URL: http://svn.apache.org/viewvc?rev=1822885&view=rev
Log:
Fix more JAXB annotations following SchemaCompliance verification.
Modified:
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultResponsibleParty.java
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultBand.java
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultFeatureCatalogueDescription.java
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultSampleDimension.java
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/package-info.java
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultDataFile.java
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultFormat.java
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultMedium.java
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultStandardOrderProcess.java
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/AbstractIdentification.java
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultAggregateInformation.java
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultSource.java
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java
sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/test/xml/SchemaCompliance.java
Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java?rev=1822885&r1=1822884&r2=1822885&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java [UTF-8] Thu Feb 1 15:48:23 2018
@@ -72,7 +72,6 @@ import org.apache.sis.internal.jaxb.Filt
import org.apache.sis.internal.jaxb.Context;
import org.apache.sis.internal.jaxb.metadata.CI_Citation;
import org.apache.sis.internal.jaxb.metadata.MD_Identifier;
-import org.apache.sis.xml.Namespaces;
/**
@@ -1470,7 +1469,7 @@ public class DefaultMetadata extends ISO
* @return the acquisition of data.
*/
@Override
- @XmlElement(name = "acquisitionInformation", namespace = Namespaces.GMI)
+ @XmlElement(name = "acquisitionInformation")
public Collection<AcquisitionInformation> getAcquisitionInformation() {
return acquisitionInformation = nonNullCollection(acquisitionInformation, AcquisitionInformation.class);
}
Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultResponsibleParty.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultResponsibleParty.java?rev=1822885&r1=1822884&r2=1822885&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultResponsibleParty.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultResponsibleParty.java [UTF-8] Thu Feb 1 15:48:23 2018
@@ -223,8 +223,8 @@ public class DefaultResponsibleParty ext
*/
@Override
@Deprecated
- @XmlElement(name = "individualName")
@Dependencies("getParties")
+ @XmlElement(name = "individualName")
public String getIndividualName() {
final InternationalString name = getIndividual(false);
return (name != null) ? name.toString() : null;
@@ -263,8 +263,8 @@ public class DefaultResponsibleParty ext
*/
@Override
@Deprecated
- @XmlElement(name = "organisationName")
@Dependencies("getParties")
+ @XmlElement(name = "organisationName")
public InternationalString getOrganisationName() {
return getName(getParties(), Organisation.class, false);
}
@@ -303,8 +303,8 @@ public class DefaultResponsibleParty ext
*/
@Override
@Deprecated
- @XmlElement(name = "positionName")
@Dependencies("getParties")
+ @XmlElement(name = "positionName")
public InternationalString getPositionName() {
return getIndividual(true);
}
@@ -340,8 +340,8 @@ public class DefaultResponsibleParty ext
*/
@Override
@Deprecated
- @XmlElement(name = "contactInfo")
@Dependencies("getParties")
+ @XmlElement(name = "contactInfo")
public Contact getContactInfo() {
final Collection<Party> parties = getParties();
if (parties != null) { // May be null on marshalling.
Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultBand.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultBand.java?rev=1822885&r1=1822884&r2=1822885&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultBand.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultBand.java [UTF-8] Thu Feb 1 15:48:23 2018
@@ -325,24 +325,6 @@ public class DefaultBand extends Default
}
/**
- * {@inheritDoc}
- */
- @Override
- @ValueRange(minimum = 1)
- @XmlElement(name = "bitsPerValue")
- public Integer getBitsPerValue() {
- return super.getBitsPerValue();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setBitsPerValue(final Integer newValue) {
- super.setBitsPerValue(newValue);
- }
-
- /**
* Returns the number of discrete numerical values in the grid data.
*
* @return number of discrete numerical values in the grid data, or {@code null} if none.
@@ -370,40 +352,6 @@ public class DefaultBand extends Default
* {@inheritDoc}
*/
@Override
- @XmlElement(name = "scaleFactor")
- public Double getScaleFactor() {
- return super.getScaleFactor();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setScaleFactor(final Double newValue) {
- super.setScaleFactor(newValue);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- @XmlElement(name = "offset")
- public Double getOffset() {
- return super.getOffset();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setOffset(final Double newValue) {
- super.setOffset(newValue);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
@ValueRange(minimum = 0, isMinIncluded = false)
@XmlElement(name = "nominalSpatialResolution")
public Double getNominalSpatialResolution() {
@@ -441,7 +389,7 @@ public class DefaultBand extends Default
* @return polarization of the radiation transmitted, or {@code null}.
*/
@Override
- @XmlElement(name = "transmittedPolarization")
+ @XmlElement(name = "transmittedPolarisation")
public PolarizationOrientation getTransmittedPolarization() {
return transmittedPolarization;
}
@@ -462,7 +410,7 @@ public class DefaultBand extends Default
* @return polarization of the radiation detected, or {@code null}.
*/
@Override
- @XmlElement(name = "detectedPolarization")
+ @XmlElement(name = "detectedPolarisation")
public PolarizationOrientation getDetectedPolarization() {
return detectedPolarization;
}
Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultFeatureCatalogueDescription.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultFeatureCatalogueDescription.java?rev=1822885&r1=1822884&r2=1822885&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultFeatureCatalogueDescription.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultFeatureCatalogueDescription.java [UTF-8] Thu Feb 1 15:48:23 2018
@@ -21,11 +21,14 @@ 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.GenericName;
import org.opengis.metadata.citation.Citation;
import org.opengis.metadata.content.FeatureCatalogueDescription;
import org.opengis.metadata.content.FeatureTypeInfo;
import org.apache.sis.internal.jaxb.FilterByVersion;
+import org.apache.sis.internal.jaxb.LegacyNamespaces;
+import org.apache.sis.internal.jaxb.gmd.LocaleAdapter;
import org.apache.sis.internal.metadata.Dependencies;
import org.apache.sis.internal.metadata.LegacyPropertyAdapter;
@@ -60,7 +63,8 @@ import org.apache.sis.internal.metadata.
@SuppressWarnings("CloneableClassWithoutClone") // ModifiableMetadata needs shallow clones.
@XmlType(name = "MD_FeatureCatalogueDescription_Type", propOrder = {
"compliant",
- "languages",
+ "locale", // New in ISO 19115:2014
+ "language", // Legacy ISO 19115:2003
"includedWithDataset",
"featureTypesInfo", // New in ISO 19115:2014. Actual name is "featureTypeInfo"
"featureTypes", // Legacy ISO 19115:2003
@@ -182,7 +186,7 @@ public class DefaultFeatureCatalogueDesc
* @return language(s) used within the catalogue.
*/
@Override
- @XmlElement(name = "language")
+ // @XmlElement at the end of this class.
public Collection<Locale> getLanguages() {
return languages = nonNullCollection(languages, Locale.class);
}
@@ -250,8 +254,8 @@ public class DefaultFeatureCatalogueDesc
*/
@Override
@Deprecated
- @XmlElement(name = "featureTypes")
@Dependencies("getFeatureTypeInfo")
+ @XmlElement(name = "featureTypes", namespace = LegacyNamespaces.GMD)
public final Collection<GenericName> getFeatureTypes() {
if (!FilterByVersion.LEGACY_METADATA.accept()) return null;
return new LegacyPropertyAdapter<GenericName,FeatureTypeInfo>(getFeatureTypeInfo()) {
@@ -328,8 +332,27 @@ public class DefaultFeatureCatalogueDesc
* This attribute has been added by ISO 19115:2014 standard.
* If (and only if) marshalling an older standard version, we omit this attribute.
*/
- @XmlElement(name = "featureTypeInfo")
+ @XmlElement(name = "featureTypes")
private Collection<FeatureTypeInfo> getFeatureTypesInfo() {
return FilterByVersion.CURRENT_METADATA.accept() ? getFeatureTypeInfo() : null;
}
+
+ /**
+ * Returns the locale to marshal if the XML document is to be written
+ * according the new ISO 19115:2014 model.
+ */
+ @XmlElement(name = "locale")
+ private Collection<Locale> getLocale() {
+ return FilterByVersion.CURRENT_METADATA.accept() ? getLanguages() : null;
+ }
+
+ /**
+ * Returns the locale to marshal if the XML document is to be written
+ * according the legacy ISO 19115:2003 model.
+ */
+ @XmlElement(name = "language", namespace = LegacyNamespaces.GMD)
+ @XmlJavaTypeAdapter(LocaleAdapter.class)
+ private Collection<Locale> getLanguage() {
+ return FilterByVersion.LEGACY_METADATA.accept() ? getLanguages() : null;
+ }
}
Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultSampleDimension.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultSampleDimension.java?rev=1822885&r1=1822884&r2=1822885&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultSampleDimension.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultSampleDimension.java [UTF-8] Thu Feb 1 15:48:23 2018
@@ -365,7 +365,6 @@ public class DefaultSampleDimension exte
*/
@Override
@XmlElement(name = "scaleFactor")
- @XmlJavaTypeAdapter(GO_Real.Since2014.class)
public Double getScaleFactor() {
return scaleFactor;
}
@@ -387,7 +386,6 @@ public class DefaultSampleDimension exte
*/
@Override
@XmlElement(name = "offset")
- @XmlJavaTypeAdapter(GO_Real.Since2014.class)
public Double getOffset() {
return offset;
}
@@ -431,8 +429,7 @@ public class DefaultSampleDimension exte
*/
@Override
@ValueRange(minimum = 1)
- @XmlElement(name = "bitsPerValues")
- @XmlJavaTypeAdapter(GO_Integer.Since2014.class)
+ @XmlElement(name = "bitsPerValue")
public Integer getBitsPerValue() {
return bitsPerValue;
}
Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/package-info.java?rev=1822885&r1=1822884&r2=1822885&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/package-info.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/package-info.java [UTF-8] Thu Feb 1 15:48:23 2018
@@ -111,8 +111,8 @@
// Java types, primitive types and basic OGC types handling
@XmlJavaTypeAdapter(UnitAdapter.class),
- @XmlJavaTypeAdapter(LocaleAdapter.class),
@XmlJavaTypeAdapter(InternationalStringAdapter.class),
+ @XmlJavaTypeAdapter(PT_Locale.class),
@XmlJavaTypeAdapter(GO_GenericName.class),
@XmlJavaTypeAdapter(GO_RecordType.class),
@XmlJavaTypeAdapter(GO_Record.class),
@@ -133,6 +133,5 @@ import org.apache.sis.xml.Namespaces;
import org.apache.sis.internal.jaxb.LegacyNamespaces;
import org.apache.sis.internal.jaxb.Schemas;
import org.apache.sis.internal.jaxb.gco.*;
-import org.apache.sis.internal.jaxb.gmd.*;
import org.apache.sis.internal.jaxb.code.*;
import org.apache.sis.internal.jaxb.metadata.*;
Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultDataFile.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultDataFile.java?rev=1822885&r1=1822884&r2=1822885&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultDataFile.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultDataFile.java [UTF-8] Thu Feb 1 15:48:23 2018
@@ -16,15 +16,21 @@
*/
package org.apache.sis.metadata.iso.distribution;
+import java.net.URI;
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.LocalName;
import org.opengis.metadata.distribution.Format;
import org.opengis.metadata.distribution.DataFile;
-import org.opengis.util.LocalName;
import org.apache.sis.xml.Namespaces;
import org.apache.sis.metadata.iso.ISOMetadata;
+import org.apache.sis.internal.jaxb.FilterByVersion;
+import org.apache.sis.internal.jaxb.LegacyNamespaces;
+import org.apache.sis.internal.jaxb.gmx.MimeFileTypeAdapter;
+import org.opengis.util.InternationalString;
/**
@@ -55,6 +61,9 @@ import org.apache.sis.metadata.iso.ISOMe
*/
@SuppressWarnings("CloneableClassWithoutClone") // ModifiableMetadata needs shallow clones.
@XmlType(name = "MX_DataFile_Type", namespace = Namespaces.MDT, propOrder = {
+ "fileName",
+ "fileDescription",
+ "fileType",
"featureTypes",
"fileFormat"
})
@@ -66,6 +75,27 @@ public class DefaultDataFile extends ISO
private static final long serialVersionUID = -4556006719009557349L;
/**
+ * Name or path of the file.
+ *
+ * @since 1.0
+ */
+ private URI fileName;
+
+ /**
+ * Text description of the file.
+ *
+ * @since 1.0
+ */
+ private InternationalString fileDescription;
+
+ /**
+ * Format in which the file is encoded.
+ *
+ * @since 1.0
+ */
+ private String fileType;
+
+ /**
* Provides the list of feature types concerned by the transfer data file. Depending on
* the transfer choices, a data file may contain data related to one or many feature types.
* This attribute may be omitted when the dataset is composed of a single file and/or the
@@ -75,7 +105,10 @@ public class DefaultDataFile extends ISO
/**
* Defines the format of the transfer data file.
+ *
+ * @deprecated Removed in latest XSD schemas.
*/
+ @Deprecated
private Format fileFormat;
/**
@@ -98,6 +131,7 @@ public class DefaultDataFile extends ISO
if (object != null) {
featureTypes = copyCollection(object.getFeatureTypes(), LocalName.class);
fileFormat = object.getFileFormat();
+ // TODO: copy other properties.
}
}
@@ -127,6 +161,82 @@ public class DefaultDataFile extends ISO
}
/**
+ * Returns the name or path of the file.
+ *
+ * @return file name, or {@code null}.
+ *
+ * @see org.apache.sis.metadata.iso.identification.DefaultBrowseGraphic#getFileName()
+ * @since 1.0
+ */
+ @XmlElement(name = "fileName", required = true)
+ public URI getFileName() {
+ return fileName;
+ }
+
+ /**
+ * Sets the name or path of the file.
+ *
+ * @param newValue the new filename or path.
+ *
+ * @since 1.0
+ */
+ public void setFileName(final URI newValue) {
+ checkWritePermission();
+ fileName = newValue;
+ }
+
+ /**
+ * Returns the text description of the file.
+ *
+ * @return text description of the file, or {@code null}.
+ *
+ * @see org.apache.sis.metadata.iso.identification.DefaultBrowseGraphic#getFileDescription()
+ * @since 1.0
+ */
+ @XmlElement(name = "fileDescription", required = true)
+ public InternationalString getFileDescription() {
+ return fileDescription;
+ }
+
+ /**
+ * Sets the text description of the file.
+ *
+ * @param newValue the new file description.
+ *
+ * @since 1.0
+ */
+ public void setFileDescription(final InternationalString newValue) {
+ checkWritePermission();
+ fileDescription = newValue;
+ }
+
+ /**
+ * Format in which the file is encoded.
+ *
+ * @return format in which the file is encoded, or {@code null}.
+ *
+ * @see org.apache.sis.metadata.iso.identification.DefaultBrowseGraphic#getFileType()
+ * @since 1.0
+ */
+ @XmlElement(name = "fileType", required = true)
+ @XmlJavaTypeAdapter(MimeFileTypeAdapter.class)
+ public String getFileType() {
+ return fileType;
+ }
+
+ /**
+ * Sets the format in which the illustration is encoded.
+ * Raster formats are encouraged to use one of the names returned by
+ * {@link javax.imageio.ImageIO#getReaderFormatNames()}.
+ *
+ * @param newValue the new file type.
+ */
+ public void setFileType(final String newValue) {
+ checkWritePermission();
+ fileType = newValue;
+ }
+
+ /**
* Returns the list of feature types concerned by the transfer data file. Depending on
* the transfer choices, a data file may contain data related to one or many feature types.
* This attribute may be omitted when the dataset is composed of a single file and/or the
@@ -135,7 +245,7 @@ public class DefaultDataFile extends ISO
* @return list of features types concerned by the transfer data file.
*/
@Override
- @XmlElement(name = "featureType")
+ @XmlElement(name = "featureTypes")
public Collection<LocalName> getFeatureTypes() {
return featureTypes = nonNullCollection(featureTypes, LocalName.class);
}
@@ -153,18 +263,24 @@ public class DefaultDataFile extends ISO
* Returns the format of the transfer data file.
*
* @return format of the transfer data file, or {@code null}.
+ *
+ * @deprecated Removed in latest XSD schemas.
*/
@Override
- @XmlElement(name = "fileFormat", required = true)
+ @Deprecated
+ @XmlElement(name = "fileFormat", namespace = LegacyNamespaces.GMD)
public Format getFileFormat() {
- return fileFormat;
+ return FilterByVersion.LEGACY_METADATA.accept() ? fileFormat : null;
}
/**
* Sets the format of the transfer data file.
*
* @param newValue the new file format value.
+ *
+ * @deprecated Removed in latest XSD schemas.
*/
+ @Deprecated
public void setFileFormat(final Format newValue) {
checkWritePermission();
fileFormat = newValue;
Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultFormat.java?rev=1822885&r1=1822884&r2=1822885&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultFormat.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultFormat.java [UTF-8] Thu Feb 1 15:48:23 2018
@@ -29,6 +29,7 @@ import org.opengis.metadata.distribution
import org.apache.sis.internal.metadata.Dependencies;
import org.apache.sis.internal.metadata.LegacyPropertyAdapter;
import org.apache.sis.internal.jaxb.FilterByVersion;
+import org.apache.sis.internal.jaxb.LegacyNamespaces;
import org.apache.sis.internal.jaxb.metadata.MD_Medium;
import org.apache.sis.internal.jaxb.metadata.CI_Citation;
import org.apache.sis.metadata.iso.citation.DefaultCitation;
@@ -241,8 +242,8 @@ public class DefaultFormat extends ISOMe
*/
@Override
@Deprecated
- @XmlElement(name = "specification")
@Dependencies("getFormatSpecificationCitation")
+ @XmlElement(name = "specification", namespace = LegacyNamespaces.GMD)
public InternationalString getSpecification() {
if (FilterByVersion.LEGACY_METADATA.accept()) {
final Citation citation = getFormatSpecificationCitation();
@@ -279,8 +280,8 @@ public class DefaultFormat extends ISOMe
*/
@Override
@Deprecated
- @XmlElement(name = "name", required = true)
@Dependencies("getFormatSpecificationCitation")
+ @XmlElement(name = "name", namespace = LegacyNamespaces.GMD)
public InternationalString getName() {
if (FilterByVersion.LEGACY_METADATA.accept()) {
final Citation citation = getFormatSpecificationCitation();
@@ -319,8 +320,8 @@ public class DefaultFormat extends ISOMe
*/
@Override
@Deprecated
- @XmlElement(name = "version", required = true)
@Dependencies("getFormatSpecificationCitation")
+ @XmlElement(name = "version", namespace = LegacyNamespaces.GMD)
public InternationalString getVersion() {
if (FilterByVersion.LEGACY_METADATA.accept()) {
final Citation citation = getFormatSpecificationCitation();
Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultMedium.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultMedium.java?rev=1822885&r1=1822884&r2=1822885&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultMedium.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultMedium.java [UTF-8] Thu Feb 1 15:48:23 2018
@@ -238,8 +238,8 @@ public class DefaultMedium extends ISOMe
*/
@Override
@Deprecated
- @XmlElement(name = "density", namespace = LegacyNamespaces.GMD)
@Dependencies("getDensity")
+ @XmlElement(name = "density", namespace = LegacyNamespaces.GMD)
public Collection<Double> getDensities() {
if (!FilterByVersion.LEGACY_METADATA.accept()) return null;
return new AbstractSet<Double>() {
Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultStandardOrderProcess.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultStandardOrderProcess.java?rev=1822885&r1=1822884&r2=1822885&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultStandardOrderProcess.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultStandardOrderProcess.java [UTF-8] Thu Feb 1 15:48:23 2018
@@ -297,7 +297,7 @@ public class DefaultStandardOrderProcess
* @see org.apache.sis.util.iso.DefaultRecord#getRecordType()
*/
@Override
- @XmlElement(name = "orderOptionType")
+ @XmlElement(name = "orderOptionsType")
@XmlJavaTypeAdapter(GO_RecordType.Since2014.class)
public RecordType getOrderOptionType() {
return orderOptionType;
Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/AbstractIdentification.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/AbstractIdentification.java?rev=1822885&r1=1822884&r2=1822885&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/AbstractIdentification.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/AbstractIdentification.java [UTF-8] Thu Feb 1 15:48:23 2018
@@ -47,6 +47,7 @@ import org.apache.sis.internal.metadata.
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;
@@ -773,8 +774,8 @@ 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,AssociatedResource>(getAssociatedResources()) {
Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultAggregateInformation.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultAggregateInformation.java?rev=1822885&r1=1822884&r2=1822885&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultAggregateInformation.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultAggregateInformation.java [UTF-8] Thu Feb 1 15:48:23 2018
@@ -131,8 +131,8 @@ public class DefaultAggregateInformation
*/
@Override
@Deprecated
- @XmlElement(name = "aggregateDataSetName")
@Dependencies("getName")
+ @XmlElement(name = "aggregateDataSetName")
public Citation getAggregateDataSetName() {
return getName();
}
@@ -158,8 +158,8 @@ public class DefaultAggregateInformation
*/
@Override
@Deprecated
- @XmlElement(name = "aggregateDataSetIdentifier")
@Dependencies("getName")
+ @XmlElement(name = "aggregateDataSetIdentifier")
public Identifier getAggregateDataSetIdentifier() {
return getAggregateDataSetIdentifier(getAggregateDataSetName());
}
Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java?rev=1822885&r1=1822884&r2=1822885&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java [UTF-8] Thu Feb 1 15:48:23 2018
@@ -317,7 +317,7 @@ public class DefaultDataIdentification e
* Returns the locale to marshal if the XML document is to be written
* according the legacy ISO 19115:2003 model.
*/
- @XmlElement(name = "language", namespace = LegacyNamespaces.GMD, required = true)
+ @XmlElement(name = "language", namespace = LegacyNamespaces.GMD)
@XmlJavaTypeAdapter(LocaleAdapter.class)
private Collection<Locale> getLanguage() {
return FilterByVersion.LEGACY_METADATA.accept() ? getLanguages() : null;
Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultSource.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultSource.java?rev=1822885&r1=1822884&r2=1822885&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultSource.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultSource.java [UTF-8] Thu Feb 1 15:48:23 2018
@@ -42,6 +42,7 @@ import org.apache.sis.internal.jaxb.meta
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;
@@ -275,8 +276,8 @@ public class DefaultSource extends ISOMe
*/
@Override
@Deprecated
- @XmlElement(name = "scaleDenominator")
@Dependencies("getSourceSpatialResolution")
+ @XmlElement(name = "scaleDenominator", namespace = LegacyNamespaces.GMD)
public RepresentativeFraction getScaleDenominator() {
if (FilterByVersion.LEGACY_METADATA.accept()) {
final Resolution resolution = getSourceSpatialResolution();
@@ -421,8 +422,8 @@ public class DefaultSource extends ISOMe
*/
@Override
@Deprecated
- @XmlElement(name = "sourceExtent")
@Dependencies("getScope")
+ @XmlElement(name = "sourceExtent", namespace = LegacyNamespaces.GMD)
public Collection<Extent> getSourceExtents() {
if (FilterByVersion.LEGACY_METADATA.accept()) {
Scope scope = getScope();
Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java?rev=1822885&r1=1822884&r2=1822885&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java [UTF-8] Thu Feb 1 15:48:23 2018
@@ -38,6 +38,7 @@ import org.apache.sis.metadata.iso.citat
import org.apache.sis.internal.metadata.LegacyPropertyAdapter;
import org.apache.sis.internal.metadata.Dependencies;
import org.apache.sis.internal.jaxb.FilterByVersion;
+import org.apache.sis.internal.jaxb.LegacyNamespaces;
/**
@@ -238,8 +239,8 @@ public class DefaultMaintenanceInformati
*/
@Override
@Deprecated
- @XmlElement(name = "dateOfNextUpdate")
@Dependencies("getMaintenanceDates")
+ @XmlElement(name = "dateOfNextUpdate", namespace = LegacyNamespaces.GMD)
public Date getDateOfNextUpdate() {
if (FilterByVersion.LEGACY_METADATA.accept()) {
final Collection<CitationDate> dates = getMaintenanceDates();
@@ -347,8 +348,8 @@ public class DefaultMaintenanceInformati
*/
@Override
@Deprecated
- @XmlElement(name = "updateScope")
@Dependencies("getMaintenanceScopes")
+ @XmlElement(name = "updateScope", namespace = LegacyNamespaces.GMD)
public final Collection<ScopeCode> getUpdateScopes() {
if (!FilterByVersion.LEGACY_METADATA.accept()) return null;
return new LegacyPropertyAdapter<ScopeCode,Scope>(getMaintenanceScopes()) {
@@ -399,8 +400,8 @@ public class DefaultMaintenanceInformati
*/
@Override
@Deprecated
- @XmlElement(name = "updateScopeDescription")
@Dependencies("getMaintenanceScopes")
+ @XmlElement(name = "updateScopeDescription", namespace = LegacyNamespaces.GMD)
public final Collection<ScopeDescription> getUpdateScopeDescriptions() {
if (!FilterByVersion.LEGACY_METADATA.accept()) return null;
return new LegacyPropertyAdapter<ScopeDescription,Scope>(getMaintenanceScopes()) {
Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/test/xml/SchemaCompliance.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/test/xml/SchemaCompliance.java?rev=1822885&r1=1822884&r2=1822885&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/test/xml/SchemaCompliance.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/test/xml/SchemaCompliance.java [UTF-8] Thu Feb 1 15:48:23 2018
@@ -33,6 +33,7 @@ import java.util.Arrays;
import java.util.Objects;
import java.util.Collections;
import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
import javax.xml.XMLConstants;
import javax.xml.bind.annotation.XmlNs;
import javax.xml.bind.annotation.XmlType;
@@ -82,7 +83,22 @@ public final strictfp class SchemaCompli
* Classes or properties having a JAXB annotation in this namespace should be deprecated.
*/
private static final Set<String> DEPRECATED_NAMESPACES = Collections.unmodifiableSet(new HashSet<>(
- Arrays.asList(LegacyNamespaces.GMD, LegacyNamespaces.GMI)));
+ Arrays.asList(LegacyNamespaces.GMD, LegacyNamespaces.GMI, LegacyNamespaces.SRV)));
+
+ /**
+ * ISO 19115-2 classes to merge with ISO 19115-1 classes. For example ISO 19115-2 defines {@code MI_Band}
+ * as an extension of ISO 19115-1 {@code MD_Band}, but GeoAPI and Apache SIS merges those two types in a
+ * single class for simplicity. Consequently when reading the schema, we rename some {@code MI_*} types
+ * as {@code MD_*} in order to store properties together.
+ */
+ private static final Map<String,String> TYPES_TO_MERGE;
+ static {
+ final Map<String,String> m = new HashMap<>();
+ m.put("MI_Band_Type", "MD_Band_Type");
+ m.put("MI_CoverageDescription_Type", "MD_CoverageDescription_Type");
+ m.put("AbstractMX_File_Type", "MX_DataFile_Type");
+ TYPES_TO_MERGE = Collections.unmodifiableMap(m);
+ }
/**
* The prefix of XML type names for properties. In ISO/OGC schemas, this prefix does not appear
@@ -349,12 +365,19 @@ public final strictfp class SchemaCompli
* <xs:complexType name="(…)_PropertyType">
*/
case "complexType": {
- final String name = getMandatoryAttribute(node, "name");
+ String name = getMandatoryAttribute(node, "name");
if (name.endsWith(PROPERTY_TYPE_SUFFIX)) {
currentPropertyType = name;
verifyPropertyType(node);
currentPropertyType = null;
} else {
+ /*
+ * In the case of "(…)_PropertyType", replace some ISO 19115-2 types by ISO 19115-1 types.
+ * For example "MI_Band_Type" is renamed as "MD_Band_Type". We do that because we use only
+ * one class for representing those two distincts ISO types. Note that not all ISO 19115-2
+ * types extend an ISO 19115-1 type, so we need to apply a case-by-case approach.
+ */
+ name = TYPES_TO_MERGE.getOrDefault(name, name);
preparePropertyDefinitions(name);
storePropertyDefinition(node);
currentProperties = null;
@@ -658,7 +681,9 @@ public final strictfp class SchemaCompli
final String ns = element.namespace();
isDeprecated = DEPRECATED_NAMESPACES.contains(ns);
if (isDeprecated != method.isAnnotationPresent(Deprecated.class)) {
- throw new SchemaException("Unexpected deprecation status of " + className + '.' + name);
+ if (!Modifier.isPrivate(method.getModifiers())) {
+ throw new SchemaException("Unexpected deprecation status of " + className + '.' + name);
+ }
}
final Info info = properties.get(name);
if (info == null) {