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/01/17 14:25:43 UTC
svn commit: r1821368 - in /sis/branches/ISO-19115-3/core:
sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/
sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/
sis-metadata/src/test/java/org/apache/sis/metadat...
Author: desruisseaux
Date: Wed Jan 17 14:25:43 2018
New Revision: 1821368
URL: http://svn.apache.org/viewvc?rev=1821368&view=rev
Log:
Adaptation of commit 8752a2098d01e36eb375241208b35cbfdeae5227 from Image Matter
(Fixed a number of bugs in the sis-metadata tests, but they are still not perfect).
We abandon for now the attempt to marshal "topicCategory" and "extent" at the locations were they were
in ISO 19139:2007 because having the same attribute at two possible locations confuse PropertyAccessor.
Modified:
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameter.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/DefaultDataIdentification.java
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.java
sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java
sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java
Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameter.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameter.java?rev=1821368&r1=1821367&r2=1821368&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameter.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameter.java [UTF-8] Wed Jan 17 14:25:43 2018
@@ -33,6 +33,7 @@ import org.opengis.parameter.ParameterDi
import org.opengis.parameter.ParameterDescriptor;
import org.apache.sis.internal.simple.SimpleIdentifiedObject;
import org.apache.sis.internal.jaxb.metadata.direct.GO_MemberName;
+import org.apache.sis.internal.jaxb.FilterByVersion;
import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.internal.metadata.NameToIdentifier;
import org.apache.sis.util.ComparisonMode;
@@ -41,7 +42,6 @@ import org.apache.sis.xml.Namespaces;
import static org.apache.sis.util.Utilities.deepEquals;
import static org.apache.sis.internal.util.CollectionsExt.nonNull;
-import static org.apache.sis.internal.jaxb.gco.PropertyType.LEGACY_XML;
/**
@@ -230,13 +230,16 @@ public final class ServiceParameter exte
}
/**
- * For JAXB marhalling of ISO 19119 document only.
+ * For JAXB marshalling of ISO 19139 document only.
* Note that there is not setter method, since we expect the same information
* to be provided in the {@link #name} attribute type.
*/
@XmlElement(name = "valueType")
final TypeName getValueType() {
- return (LEGACY_XML && memberName != null) ? memberName.getAttributeType() : null;
+ if (memberName != null && FilterByVersion.LEGACY_METADATA.accept()) {
+ return memberName.getAttributeType();
+ }
+ return null;
}
/**
@@ -265,7 +268,11 @@ public final class ServiceParameter exte
*/
@XmlElement(name = "optionality", required = true)
final String getOptionality() {
- return LEGACY_XML ? (optionality ? "Optional" : "Mandatory") : Boolean.toString(optionality);
+ if (FilterByVersion.CURRENT_METADATA.accept()) {
+ return Boolean.toString(optionality);
+ } else {
+ return optionality ? "Optional" : "Mandatory";
+ }
}
/**
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=1821368&r1=1821367&r2=1821368&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] Wed Jan 17 14:25:43 2018
@@ -96,8 +96,8 @@ import org.apache.sis.util.iso.Types;
"spatialRepresentationTypes", // Here in ISO 19115:2014 (was after 'aggregationInfo' in ISO 19115:2003)
"spatialResolutions", // Shall be kept next to 'spatialRepresentationTypes'
"temporalResolution", // ISO 19115-3 only
- "topicCategory", // Here in ISO 19115:2014 (was in subclasses in ISO 19115:2003)
- "extent", // Here in ISO 19115:2014 (was in subclasses in ISO 19115:2003)
+ "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",
@@ -524,7 +524,7 @@ public class AbstractIdentification exte
* @since 0.5
*/
@Override
- // @XmlElement at the end of this class.
+ @XmlElement(name = "topicCategory")
public Collection<TopicCategory> getTopicCategories() {
return topicCategories = nonNullCollection(topicCategories, TopicCategory.class);
}
@@ -548,7 +548,7 @@ public class AbstractIdentification exte
* @since 0.5
*/
@Override
- // @XmlElement at the end of this class.
+ @XmlElement(name = "extent")
public Collection<Extent> getExtents() {
return extents = nonNullCollection(extents, Extent.class);
}
@@ -831,16 +831,6 @@ public class AbstractIdentification exte
return FilterByVersion.CURRENT_METADATA.accept() ? getTemporalResolutions() : null;
}
- @XmlElement(name = "topicCategory")
- private Collection<TopicCategory> getTopicCategory() {
- return FilterByVersion.CURRENT_METADATA.accept() ? getTopicCategories() : null;
- }
-
- @XmlElement(name = "extent")
- private Collection<Extent> getExtent() {
- return FilterByVersion.CURRENT_METADATA.accept() ? getExtents() : null;
- }
-
@XmlElement(name = "additionalDocumentation")
private Collection<Citation> getAdditionalDocumentation() {
return FilterByVersion.CURRENT_METADATA.accept() ? getAdditionalDocumentations() : null;
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=1821368&r1=1821367&r2=1821368&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] Wed Jan 17 14:25:43 2018
@@ -24,7 +24,6 @@ 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.metadata.extent.Extent;
import org.opengis.metadata.citation.Citation;
import org.opengis.metadata.identification.TopicCategory;
import org.opengis.metadata.identification.DataIdentification;
@@ -77,10 +76,18 @@ import org.apache.sis.internal.util.Coll
"characterSets", // Legacy ISO 19115:2003
"defaultLocale", // New in ISO 19115:2014
"otherLocales", // New in ISO 19115:2014
- "topicCategory",
"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 attributes (experimented
+ * on commit 72d5b788703854b64d6be8eb57ba762afdfb0197), but it confuses PropertyAccessor.
+ * We choose to avoid this complication since it affects only marshalling in legacy format
+ * and we hope that most metadata readers are tolerant to attributes in a different order.
+ */
})
@XmlRootElement(name = "MD_DataIdentification")
public class DefaultDataIdentification extends AbstractIdentification implements DataIdentification {
@@ -307,15 +314,6 @@ public class DefaultDataIdentification e
}
/**
- * Sets the other locales for this record (used in ISO 19115-3 format).
- * Defined as a matter of principle, but not invoked by JAXB implementation.
- */
- @SuppressWarnings("unused")
- private void setOtherLocales(final Collection<? extends Locale> newValues) {
- setLanguages(OtherLocales.merge(CollectionsExt.first(languages), newValues));
- }
-
- /**
* Returns the locale to marshal if the XML document is to be written
* according the legacy ISO 19115:2003 model.
*/
@@ -324,35 +322,4 @@ public class DefaultDataIdentification e
private Collection<Locale> getLanguage() {
return FilterByVersion.LEGACY_METADATA.accept() ? getLanguages() : null;
}
-
- /**
- * For JAXB marhalling of ISO 19115:2003 document only.
- */
- @XmlElement(name = "topicCategory", namespace = LegacyNamespaces.GMD)
- private Collection<TopicCategory> getTopicCategory() {
- return FilterByVersion.LEGACY_METADATA.accept() ? getTopicCategories() : null;
- }
-
- /**
- * For JAXB unmarhalling of ISO 19115:2003 document only.
- */
- private void setTopicCategory(final Collection<? extends TopicCategory> newValues) {
- setTopicCategories(newValues);
- }
-
- /**
- * For JAXB marhalling of ISO 19115:2003 document only.
- * For the more recent ISO 19115:2014, we inherit {@link #getExtents()} from the parent class instead.
- */
- @XmlElement(name = "extent", namespace = LegacyNamespaces.GMD)
- private Collection<Extent> getExtent() {
- return FilterByVersion.LEGACY_METADATA.accept() ? getExtents() : null;
- }
-
- /**
- * For JAXB unmarhalling of ISO 19115:2003 document only.
- */
- private void setExtent(final Collection<? extends Extent> newValues) {
- setExtents(newValues);
- }
}
Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.java?rev=1821368&r1=1821367&r2=1821368&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentification.java [UTF-8] Wed Jan 17 14:25:43 2018
@@ -22,7 +22,6 @@ import javax.xml.bind.annotation.XmlType
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.opengis.util.GenericName;
-import org.opengis.metadata.extent.Extent;
import org.opengis.metadata.citation.Citation;
import org.opengis.metadata.identification.DataIdentification;
import org.opengis.metadata.distribution.StandardOrderProcess;
@@ -79,7 +78,6 @@ import org.apache.sis.xml.Namespaces;
"serviceType",
"serviceTypeVersions",
"accessProperties",
- "extent", // Legacy ISO 19115:2003
"coupledResources",
"couplingType",
"operatedDataset",
@@ -507,15 +505,6 @@ public class DefaultServiceIdentificatio
}
/**
- * For JAXB marhalling of ISO 19115:2003 document only.
- * For the more recent ISO 19115:2014, we inherit {@link #getExtents()} from the parent class instead.
- */
- @XmlElement(name = "extent")
- private Collection<Extent> getExtent() {
- return FilterByVersion.LEGACY_METADATA.accept() ? getExtents() : null;
- }
-
- /**
* Invoked after JAXB has unmarshalled this object.
*/
@SuppressWarnings("unused")
Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java?rev=1821368&r1=1821367&r2=1821368&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java [UTF-8] Wed Jan 17 14:25:43 2018
@@ -81,7 +81,7 @@ import static org.apache.sis.metadata.Pr
* to be updated.</p>
*
* @author Martin Desruisseaux (Geomatys)
- * @version 0.5
+ * @version 1.0
* @since 0.3
* @module
*/
@@ -184,8 +184,8 @@ public final strictfp class PropertyAcce
// Citation.class, "getCollectiveTitle", "collectiveTitle", "collectiveTitle", "Collective title", InternationalString.class, -- deprecated as of ISO 19115:2014
Citation.class, "getISBN", "ISBN", "ISBN", "ISBN", String.class,
Citation.class, "getISSN", "ISSN", "ISSN", "ISSN", String.class,
- Citation.class, "getGraphics", "graphics", "graphic", "Graphics", BrowseGraphic[].class,
- Citation.class, "getOnlineResources", "onlineResources", "onlineResource", "Online resources", OnlineResource[].class);
+ Citation.class, "getOnlineResources", "onlineResources", "onlineResource", "Online resources", OnlineResource[].class,
+ Citation.class, "getGraphics", "graphics", "graphic", "Graphics", BrowseGraphic[].class);
}
/**
@@ -208,24 +208,24 @@ public final strictfp class PropertyAcce
Identification.class, "getCredits", "credits", "credit", "Credits", InternationalString[].class,
Identification.class, "getStatus", "status", "status", "Status", Progress[].class,
Identification.class, "getPointOfContacts", "pointOfContacts", "pointOfContact", "Point of contacts", Responsibility[].class,
+ Identification.class, "getSpatialRepresentationTypes", "spatialRepresentationTypes", "spatialRepresentationType", "Spatial representation types", SpatialRepresentationType[].class,
+ Identification.class, "getSpatialResolutions", "spatialResolutions", "spatialResolution", "Spatial resolutions", Resolution[].class,
+ Identification.class, "getTemporalResolutions", "temporalResolutions", "temporalResolution", "Temporal resolutions", Duration[].class,
+ Identification.class, "getTopicCategories", "topicCategories", "topicCategory", "Topic categories", TopicCategory[].class,
+ Identification.class, "getExtents", "extents", "extent", "Extents", Extent[].class,
+ Identification.class, "getAdditionalDocumentations", "additionalDocumentations", "additionalDocumentation", "Additional documentations", Citation[].class,
+ Identification.class, "getProcessingLevel", "processingLevel", "processingLevel", "Processing level", Identifier.class,
Identification.class, "getResourceMaintenances", "resourceMaintenances", "resourceMaintenance", "Resource maintenances", MaintenanceInformation[].class,
Identification.class, "getGraphicOverviews", "graphicOverviews", "graphicOverview", "Graphic overviews", BrowseGraphic[].class,
Identification.class, "getResourceFormats", "resourceFormats", "resourceFormat", "Resource formats", Format[].class,
Identification.class, "getDescriptiveKeywords", "descriptiveKeywords", "descriptiveKeywords", "Descriptive keywords", Keywords[].class,
Identification.class, "getResourceSpecificUsages", "resourceSpecificUsages", "resourceSpecificUsage", "Resource specific usages", Usage[].class,
Identification.class, "getResourceConstraints", "resourceConstraints", "resourceConstraints", "Resource constraints", Constraints[].class,
- Identification.class, "getSpatialRepresentationTypes", "spatialRepresentationTypes", "spatialRepresentationType", "Spatial representation types", SpatialRepresentationType[].class,
- Identification.class, "getSpatialResolutions", "spatialResolutions", "spatialResolution", "Spatial resolutions", Resolution[].class,
+ Identification.class, "getAssociatedResources", "associatedResources", "associatedResource", "Associated resources", AssociatedResource[].class,
DataIdentification.class, "getLanguages", "languages", "language", "Languages", Locale[].class,
DataIdentification.class, "getCharacterSets", "characterSets", "characterSet", "Character sets", Charset[].class,
- Identification.class, "getTopicCategories", "topicCategories", "topicCategory", "Topic categories", TopicCategory[].class,
DataIdentification.class, "getEnvironmentDescription", "environmentDescription", "environmentDescription", "Environment description", InternationalString.class,
- Identification.class, "getExtents", "extents", "extent", "Extents", Extent[].class,
- DataIdentification.class, "getSupplementalInformation", "supplementalInformation", "supplementalInformation", "Supplemental information", InternationalString.class,
- Identification.class, "getAdditionalDocumentations", "additionalDocumentations", "additionalDocumentation", "Additional documentations", Citation[].class,
- Identification.class, "getAssociatedResources", "associatedResources", "associatedResource", "Associated resources", AssociatedResource[].class,
- Identification.class, "getProcessingLevel", "processingLevel", "processingLevel", "Processing level", Identifier.class,
- Identification.class, "getTemporalResolutions", "temporalResolutions", "temporalResolution", "Temporal resolutions", Duration[].class);
+ DataIdentification.class, "getSupplementalInformation", "supplementalInformation", "supplementalInformation", "Supplemental information", InternationalString.class);
}
/**
Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java?rev=1821368&r1=1821367&r2=1821368&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java [UTF-8] Wed Jan 17 14:25:43 2018
@@ -43,7 +43,7 @@ import static org.apache.sis.test.Metada
* Tests {@link DefaultDataIdentification}.
*
* @author Martin Desruisseaux (Geomatys)
- * @version 0.5
+ * @version 1.0
* @since 0.3
* @module
*/
@@ -140,23 +140,23 @@ public final strictfp class DefaultDataI
" │ │ └─Date type………………………………… Creation\n" +
" │ └─Identifier………………………………………… SST_Global.nc\n" +
" ├─Abstract………………………………………………………… NCEP SST Global 5.0 x 2.5 degree model data\n" +
+ " ├─Spatial representation type……… Grid\n" +
+ " ├─Extent……………………………………………………………… World\n" +
+ " │ └─Geographic element\n" +
+ " │ ├─West bound longitude…… 180°W\n" +
+ " │ ├─East bound longitude…… 180°E\n" +
+ " │ ├─South bound latitude…… 90°S\n" +
+ " │ ├─North bound latitude…… 90°N\n" +
+ " │ └─Extent type code……………… true\n" +
" ├─Descriptive keywords\n" +
" │ ├─Keyword………………………………………………… EARTH SCIENCE > Oceans > Ocean Temperature > Sea Surface Temperature\n" +
" │ ├─Type………………………………………………………… Theme\n" +
" │ └─Thesaurus name……………………………… GCMD Science Keywords\n" +
" ├─Resource constraints\n" +
" │ └─Use limitation……………………………… Freely available\n" +
- " ├─Spatial representation type……… Grid\n" +
" ├─Language (1 of 2)………………………………… en_US\n" +
" ├─Language (2 of 2)………………………………… en\n" +
- " ├─Character set…………………………………………… US-ASCII\n" +
- " └─Extent……………………………………………………………… World\n" +
- " └─Geographic element\n" +
- " ├─West bound longitude…… 180°W\n" +
- " ├─East bound longitude…… 180°E\n" +
- " ├─South bound latitude…… 90°S\n" +
- " ├─North bound latitude…… 90°N\n" +
- " └─Extent type code……………… true\n",
+ " └─Character set…………………………………………… US-ASCII\n",
TestUtilities.formatNameAndValue(create().asTreeTable()));
}
Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java?rev=1821368&r1=1821367&r2=1821368&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java [UTF-8] Wed Jan 17 14:25:43 2018
@@ -120,14 +120,6 @@ public abstract class PropertyType<Value
extends XmlAdapter<ValueType,BoundType>
{
/**
- * {@code true} if marshalling an XML based on ISO 19115:2003 model. A value of {@code false}
- * (ISO 19115:2014 model) is not yet supported, so we currently use this variable only as a way
- * to identify the code to revisit when we will want to support the new model.
- */
- @Deprecated
- public static final boolean LEGACY_XML = true;
-
- /**
* The wrapped GeoAPI metadata instance, or {@code null} if the metadata shall not be marshalled.
* Metadata are not marshalled when replaced by {@code xlink:href} or {@code uuidref} attributes.
*/