Modified: sis/trunk/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/extent/Extent.xml URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/extent/Extent.xml?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/extent/Extent.xml (original) +++ sis/trunk/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/extent/Extent.xml Mon Feb 26 11:28:17 2018 @@ -18,43 +18,44 @@ under the License. --> -<gmd:EX_Extent - xmlns:gco = "http://www.isotc211.org/2005/gco" - xmlns:gmd = "http://www.isotc211.org/2005/gmd" +<gex:EX_Extent + xmlns:gex = "http://standards.iso.org/iso/19115/-3/gex/1.0" + xmlns:gco = "http://standards.iso.org/iso/19115/-3/gco/1.0" xmlns:gml = "http://www.opengis.net/gml/3.2" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation = "http://www.isotc211.org/2005/gmd http://schemas.opengis.net/iso/19139/20070417/gmd/gmd.xsd"> + xsi:schemaLocation = "http://standards.iso.org/iso/19115/-3/gex/1.0 + http://standards.iso.org/iso/19115/-3/gex/1.0/gex.xsd"> - <gmd:geographicElement> - <gmd:EX_GeographicBoundingBox id="bbox"> - <gmd:extentTypeCode> + <gex:geographicElement> + <gex:EX_GeographicBoundingBox id="bbox"> + <gex:extentTypeCode> <gco:Boolean>true</gco:Boolean> - </gmd:extentTypeCode> - <gmd:westBoundLongitude> + </gex:extentTypeCode> + <gex:westBoundLongitude> <gco:Decimal>-99.0</gco:Decimal> - </gmd:westBoundLongitude> - <gmd:eastBoundLongitude> + </gex:westBoundLongitude> + <gex:eastBoundLongitude> <gco:Decimal>-79.0</gco:Decimal> - </gmd:eastBoundLongitude> - <gmd:southBoundLatitude> + </gex:eastBoundLongitude> + <gex:southBoundLatitude> <gco:Decimal>14.9844</gco:Decimal> - </gmd:southBoundLatitude> - <gmd:northBoundLatitude> + </gex:southBoundLatitude> + <gex:northBoundLatitude> <gco:Decimal>31.0</gco:Decimal> - </gmd:northBoundLatitude> - </gmd:EX_GeographicBoundingBox> - </gmd:geographicElement> - <gmd:temporalElement> - <gmd:EX_TemporalExtent> + </gex:northBoundLatitude> + </gex:EX_GeographicBoundingBox> + </gex:geographicElement> + <gex:temporalElement> + <gex:EX_TemporalExtent> <!-- TODO: This block needs the sis-temporal module. - <gmd:extent> + <gex:extent> <gml:TimePeriod gml:id="period"> <gml:description>Acquisition period</gml:description> <gml:beginPosition>2010-01-27T08:26:10-05:00</gml:beginPosition> <gml:endPosition>2010-08-27T08:26:10-05:00</gml:endPosition> </gml:TimePeriod> - </gmd:extent> + </gex:extent> --> - </gmd:EX_TemporalExtent> - </gmd:temporalElement> -</gmd:EX_Extent> + </gex:EX_TemporalExtent> + </gex:temporalElement> +</gex:EX_Extent>
Copied: sis/trunk/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/identification/ServiceIdentification (legacy).xml (from r1825261, sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/identification/ServiceIdentification (legacy).xml) URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/identification/ServiceIdentification%20%28legacy%29.xml?p2=sis/trunk/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/identification/ServiceIdentification%20%28legacy%29.xml&p1=sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/identification/ServiceIdentification%20%28legacy%29.xml&r1=1825261&r2=1825355&rev=1825355&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/identification/ServiceIdentification (legacy).xml (original) +++ sis/trunk/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/identification/ServiceIdentification (legacy).xml Mon Feb 26 11:28:17 2018 @@ -76,9 +76,6 @@ </gco:TypeName> </gco:attributeType> </srv:name> - <srv:direction> - <srv:SV_ParameterDirection>in</srv:SV_ParameterDirection> - </srv:direction> <srv:optionality> <gco:CharacterString>Optional</gco:CharacterString> </srv:optionality> Modified: sis/trunk/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/identification/ServiceIdentification.xml URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/identification/ServiceIdentification.xml?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/identification/ServiceIdentification.xml (original) +++ sis/trunk/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/identification/ServiceIdentification.xml Mon Feb 26 11:28:17 2018 @@ -19,82 +19,114 @@ --> <srv:SV_ServiceIdentification - xmlns:srv = "http://www.isotc211.org/2005/srv" - xmlns:gmd = "http://www.isotc211.org/2005/gmd" - xmlns:gco = "http://www.isotc211.org/2005/gco" + xmlns:srv = "http://standards.iso.org/iso/19115/-3/srv/2.0" + xmlns:mri = "http://standards.iso.org/iso/19115/-3/mri/1.0" + xmlns:cit = "http://standards.iso.org/iso/19115/-3/cit/1.0" + xmlns:gco = "http://standards.iso.org/iso/19115/-3/gco/1.0" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation = "http://www.isotc211.org/2005/srv http://schemas.opengis.net/iso/19139/20060504/srv/srv.xsd"> + xsi:schemaLocation = "http://standards.iso.org/iso/19115/-3/srv/2.0 + http://standards.iso.org/iso/19115/-3/srv/2.0/srv.xsd"> - <gmd:citation gco:nilReason="missing"/> - <gmd:abstract> + <mri:citation gco:nilReason="missing"/> + <mri:abstract> <gco:CharacterString>A dummy service for testing purpose.</gco:CharacterString> - </gmd:abstract> + </mri:abstract> <srv:serviceType> - <gco:LocalName>Web Map Server</gco:LocalName> + <gco:ScopedName>Web Map Server</gco:ScopedName> </srv:serviceType> <srv:serviceTypeVersion> <gco:CharacterString>1.0</gco:CharacterString> </srv:serviceTypeVersion> + <srv:couplingType> + <srv:SV_CouplingType codeList="http://standards.iso.org/iso/19115/resources/Codelist/cat/codelists.xml#SV_CouplingType" codeListValue="loose">Loose</srv:SV_CouplingType> + </srv:couplingType> + <srv:coupledResource> <srv:SV_CoupledResource> - <srv:operationName> - <gco:CharacterString>Get Map</gco:CharacterString> - </srv:operationName> - <srv:identifier> - <gco:CharacterString>ABC-123</gco:CharacterString> - </srv:identifier> - <gco:ScopedName>mySpace:ABC-123</gco:ScopedName> + <srv:scopedName> + <gco:ScopedName>mySpace:ABC-123</gco:ScopedName> + </srv:scopedName> + <srv:resourceReference> + <cit:CI_Citation> + <cit:title> + <gco:CharacterString>WMS specification</gco:CharacterString> + </cit:title> + </cit:CI_Citation> + </srv:resourceReference> + <srv:operation> + <srv:SV_OperationMetadata> + <srv:operationName> + <gco:CharacterString>Get Map</gco:CharacterString> + </srv:operationName> + <srv:distributedComputingPlatform> + <srv:DCPList codeList="http://standards.iso.org/iso/19115/resources/Codelist/cat/codelists.xml#DCPList" codeListValue="WebServices">Web services</srv:DCPList> + </srv:distributedComputingPlatform> + <srv:connectPoint gco:nilReason="missing"/> + <srv:parameter> + <srv:SV_Parameter> + <srv:name> + <gco:MemberName> + <gco:aName> + <gco:CharacterString>Version</gco:CharacterString> + </gco:aName> + <gco:attributeType> + <gco:TypeName> + <gco:aName> + <gco:CharacterString>CharacterString</gco:CharacterString> + </gco:aName> + </gco:TypeName> + </gco:attributeType> + </gco:MemberName> + </srv:name> + <srv:optionality> + <gco:Boolean>true</gco:Boolean> + </srv:optionality> + <srv:repeatability> + <gco:Boolean>false</gco:Boolean> + </srv:repeatability> + </srv:SV_Parameter> + </srv:parameter> + </srv:SV_OperationMetadata> + </srv:operation> </srv:SV_CoupledResource> </srv:coupledResource> - <srv:couplingType> - <srv:SV_CouplingType codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#SV_CouplingType" codeListValue="loose">Loose</srv:SV_CouplingType> - </srv:couplingType> - <srv:containsOperations> <srv:SV_OperationMetadata> <srv:operationName> <gco:CharacterString>Get Map</gco:CharacterString> </srv:operationName> - <srv:DCP> - <srv:DCPList codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#DCPList" codeListValue="WebServices">Web services</srv:DCPList> - </srv:DCP> - <srv:parameters> + <srv:distributedComputingPlatform> + <srv:DCPList codeList="http://standards.iso.org/iso/19115/resources/Codelist/cat/codelists.xml#DCPList" codeListValue="WebServices">Web services</srv:DCPList> + </srv:distributedComputingPlatform> + <srv:connectPoint gco:nilReason="missing"/> + <srv:parameter> <srv:SV_Parameter> <srv:name> - <gco:aName> - <gco:CharacterString>Version</gco:CharacterString> - </gco:aName> - <gco:attributeType> - <gco:TypeName> - <gco:aName> - <gco:CharacterString>CharacterString</gco:CharacterString> - </gco:aName> - </gco:TypeName> - </gco:attributeType> + <gco:MemberName> + <gco:aName> + <gco:CharacterString>Version</gco:CharacterString> + </gco:aName> + <gco:attributeType> + <gco:TypeName> + <gco:aName> + <gco:CharacterString>CharacterString</gco:CharacterString> + </gco:aName> + </gco:TypeName> + </gco:attributeType> + </gco:MemberName> </srv:name> <srv:optionality> - <gco:CharacterString>Optional</gco:CharacterString> + <gco:Boolean>true</gco:Boolean> </srv:optionality> <srv:repeatability> <gco:Boolean>false</gco:Boolean> </srv:repeatability> - - <!-- Deprecated element (removed from ISO 19115:2014), since it duplicates <gco:attributeType> above. --> - <srv:valueType> - <gco:TypeName> - <gco:aName> - <gco:CharacterString>CharacterString</gco:CharacterString> - </gco:aName> - </gco:TypeName> - </srv:valueType> - </srv:SV_Parameter> - </srv:parameters> - <srv:connectPoint gco:nilReason="missing"/> + </srv:parameter> </srv:SV_OperationMetadata> </srv:containsOperations> </srv:SV_ServiceIdentification> Modified: sis/trunk/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/lineage/ProcessStep.xml URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/lineage/ProcessStep.xml?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/lineage/ProcessStep.xml (original) +++ sis/trunk/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/lineage/ProcessStep.xml Mon Feb 26 11:28:17 2018 @@ -18,25 +18,29 @@ under the License. --> -<gmi:LE_ProcessStep - xmlns:gmd = "http://www.isotc211.org/2005/gmd" - xmlns:gco = "http://www.isotc211.org/2005/gco" - xmlns:gmi = "http://www.isotc211.org/2005/gmi" +<mrl:LE_ProcessStep + xmlns:mrl = "http://standards.iso.org/iso/19115/-3/mrl/1.0" + xmlns:mcc = "http://standards.iso.org/iso/19115/-3/mcc/1.0" + xmlns:gco = "http://standards.iso.org/iso/19115/-3/gco/1.0" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation = "http://www.isotc211.org/2005/gmd http://schemas.opengis.net/iso/19139/20070417/gmd/gmd.xsd"> + xsi:schemaLocation = "http://standards.iso.org/iso/19115/-3/mrl/1.0 + http://standards.iso.org/iso/19115/-3/mrl/1.0/mrl.xsd"> - <!-- - As of February 2011, there is not yet any XSD schema for the "gmi" namespace on the - OGC web site. Consequently the validation of this file does not work fully yet. - --> - <gmd:description> + <mrl:description> <gco:CharacterString>Some process step.</gco:CharacterString> - </gmd:description> - <gmi:processingInformation> - <gmi:LE_Processing> - <gmi:procedureDescription> + </mrl:description> + <mrl:processingInformation> + <mrl:LE_Processing> + <mrl:identifier> + <mcc:MD_Identifier> + <mcc:code> + <gco:CharacterString>P4</gco:CharacterString> + </mcc:code> + </mcc:MD_Identifier> + </mrl:identifier> + <mrl:procedureDescription> <gco:CharacterString>Some procedure.</gco:CharacterString> - </gmi:procedureDescription> - </gmi:LE_Processing> - </gmi:processingInformation> -</gmi:LE_ProcessStep> + </mrl:procedureDescription> + </mrl:LE_Processing> + </mrl:processingInformation> +</mrl:LE_ProcessStep> Modified: sis/trunk/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/quality/PositionalAccuracy.xml URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/quality/PositionalAccuracy.xml?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/quality/PositionalAccuracy.xml (original) +++ sis/trunk/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/quality/PositionalAccuracy.xml Mon Feb 26 11:28:17 2018 @@ -18,55 +18,67 @@ under the License. --> -<gmd:DQ_RelativeInternalPositionalAccuracy - xmlns:gmd = "http://www.isotc211.org/2005/gmd" - xmlns:gco = "http://www.isotc211.org/2005/gco" +<mdq:DQ_RelativeInternalPositionalAccuracy + xmlns:mdq="http://standards.iso.org/iso/19157/-2/mdq/1.0" + xmlns:mcc="http://standards.iso.org/iso/19115/-3/mcc/1.0" + xmlns:cit="http://standards.iso.org/iso/19115/-3/cit/1.0" + xmlns:lan="http://standards.iso.org/iso/19115/-3/lan/1.0" + xmlns:gco="http://standards.iso.org/iso/19115/-3/gco/1.0" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation = "http://www.isotc211.org/2005/gmd http://schemas.opengis.net/iso/19139/20070417/gmd/gmd.xsd"> + xsi:schemaLocation = "http://standards.iso.org/iso/19157/-2/mdq/1.0 http://standards.iso.org/iso/19157/-2/mdq/1.0/mdq.xsd + http://standards.iso.org/iso/19115/-3/lan/1.0 http://standards.iso.org/iso/19115/-3/lan/1.0/lan.xsd"> <!-- - The <nameOfMeasure> element below is the main purpose of MetadataMarshallingTest.testPositionalAccuracy(). - The <result> element was added only in order to allow validation of this XML file, with the addition of an - opportunist check of xsi:type declaration. + The <measure> element below is the main purpose of MetadataMarshallingTest.testPositionalAccuracy(). + The <result> element was added only in order to allow validation of this XML file, with the addition + of an opportunist check of xsi:type declaration. --> - <gmd:nameOfMeasure xsi:type="gmd:PT_FreeText_PropertyType"> - <gco:CharacterString>Quantitative quality measure focusing on the effective class percent regarded to the total surface size</gco:CharacterString> - <gmd:PT_FreeText> - <gmd:textGroup> - <gmd:LocalisedCharacterString locale="#locale-fra">Mesure qualité quantitative de type pourcentage de représentation de la classe par rapport à la surface totale</gmd:LocalisedCharacterString> - </gmd:textGroup> - </gmd:PT_FreeText> - </gmd:nameOfMeasure> - <gmd:result> + <mdq:measure> + <mdq:DQ_MeasureReference> + <mdq:measureIdentification> + <mcc:MD_Identifier> + <mcc:code xsi:type="lan:PT_FreeText_PropertyType"> + <gco:CharacterString>Quantitative quality measure focusing on the effective class percent regarded to the total surface size</gco:CharacterString> + <lan:PT_FreeText> + <lan:textGroup> + <lan:LocalisedCharacterString locale="#locale-fra">Mesure qualité quantitative de type pourcentage de représentation de la classe par rapport à la surface totale</lan:LocalisedCharacterString> + </lan:textGroup> + </lan:PT_FreeText> + </mcc:code> + </mcc:MD_Identifier> + </mdq:measureIdentification> + </mdq:DQ_MeasureReference> + </mdq:measure> + <mdq:result> <!-- The xsi:type declaration below is useless, but we put it in order to test that it does not break unmarshalling. --> - <gmd:DQ_ConformanceResult xsi:type="gmd:DQ_ConformanceResult_Type"> - <gmd:specification> - <gmd:CI_Citation> - <gmd:title> + <mdq:DQ_ConformanceResult xsi:type="mdq:DQ_ConformanceResult_Type"> + <mdq:specification> + <cit:CI_Citation> + <cit:title> <gco:CharacterString>Some documentation for a conformance test.</gco:CharacterString> - </gmd:title> - <gmd:date> - <gmd:CI_Date> - <gmd:date> + </cit:title> + <cit:date> + <cit:CI_Date> + <cit:date> <!-- Dummy date for the purpose of this test. --> <gco:DateTime>2009-08-12T19:40:17.653+02:00</gco:DateTime> - </gmd:date> - <gmd:dateType> - <gmd:CI_DateTypeCode codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="creation">Creation</gmd:CI_DateTypeCode> - </gmd:dateType> - </gmd:CI_Date> - </gmd:date> - </gmd:CI_Citation> - </gmd:specification> - <gmd:explanation> + </cit:date> + <cit:dateType> + <cit:CI_DateTypeCode codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="creation">Creation</cit:CI_DateTypeCode> + </cit:dateType> + </cit:CI_Date> + </cit:date> + </cit:CI_Citation> + </mdq:specification> + <mdq:explanation> <gco:CharacterString>We should explain here what a test conformance means.</gco:CharacterString> - </gmd:explanation> - <gmd:pass> + </mdq:explanation> + <mdq:pass> <gco:Boolean>true</gco:Boolean> - </gmd:pass> - </gmd:DQ_ConformanceResult> - </gmd:result> -</gmd:DQ_RelativeInternalPositionalAccuracy> + </mdq:pass> + </mdq:DQ_ConformanceResult> + </mdq:result> +</mdq:DQ_RelativeInternalPositionalAccuracy> Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/RS_Identifier.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/RS_Identifier.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/RS_Identifier.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/RS_Identifier.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -22,11 +22,11 @@ import org.opengis.metadata.Identifier; /** - * JAXB adapter mapping the GeoAPI {@link ReferenceIdentifier} to an implementation class that can - * be marshalled. See the package documentation for more information about JAXB and interfaces. + * JAXB adapter mapping the GeoAPI {@link Identifier} to an implementation class that can be marshalled. + * See the package documentation for more information about JAXB and interfaces. * * <p>Note that a class of the same name is defined in the {@link org.apache.sis.internal.jaxb.metadata} - * package, which serve the same purpose (wrapping exactly the same interface) but using the ISO 19139 + * package, which serve the same purpose (wrapping exactly the same interface) but using the ISO 19139:2007 * syntax instead. The ISO 19139 syntax represents the code and codespace as XML elements, while in this * GML representation the code is a XML value and the codespace is a XML attribute.</p> * Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/SC_VerticalCRS.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/SC_VerticalCRS.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/SC_VerticalCRS.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/SC_VerticalCRS.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -26,7 +26,7 @@ import org.apache.sis.referencing.crs.De /** * JAXB adapter for {@link VerticalCRS}, in order to integrate the value in an element * complying with OGC/ISO standard. Note that the CRS is formatted using the GML schema, - * not the ISO 19139 one. + * not the ISO 19139:2007 one. * * @author Guilhem Legal (Geomatys) * @author Martin Desruisseaux (Geomatys) Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -42,6 +42,7 @@ import org.opengis.referencing.ObjectFac import org.opengis.referencing.AuthorityFactory; import org.opengis.referencing.IdentifiedObject; import org.apache.sis.internal.jaxb.Context; +import org.apache.sis.internal.jaxb.UseLegacyMetadata; import org.apache.sis.internal.jaxb.referencing.Code; import org.apache.sis.internal.util.Numerics; import org.apache.sis.internal.util.UnmodifiableArrayList; @@ -121,7 +122,7 @@ import org.apache.sis.metadata.iso.Immut * objects and passed between threads without synchronization. * * @author Martin Desruisseaux (IRD, Geomatys) - * @version 0.7 + * @version 1.0 * @since 0.4 * @module */ @@ -138,6 +139,7 @@ import org.apache.sis.metadata.iso.Immut org.apache.sis.referencing.datum.DefaultPrimeMeridian.class, org.apache.sis.referencing.cs.AbstractCS.class }) +@UseLegacyMetadata public class AbstractIdentifiedObject extends FormattableObject implements IdentifiedObject, LenientComparable, Deprecable, Serializable { Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -213,7 +213,7 @@ public final strictfp class AbstractIden final AbstractIdentifiedObject o2 = new AbstractIdentifiedObject(properties); final AbstractIdentifiedObject o3 = new AbstractIdentifiedObject(properties); final AbstractIdentifiedObject o4 = new AbstractIdentifiedObject(properties); - final Context context = new Context(0, null, null, null, null, null, null, null); + final Context context = new Context(0, null, null, null, null, null, null, null, null); try { final String c1, c2, c3, c4; assertEquals("o1", "epsg-7019", c1 = o1.getID()); Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -486,7 +486,7 @@ public final strictfp class DefaultProje * Test marshalling and compare with the original file. The comparison ignores the <gml:name> nodes because the * marshalled CRS contains many operation method and parameter aliases which were not in the original XML file. */ - assertMarshalEqualsFile(XML_FILE, crs, STRICT, new String[] {"gml:name"}, + assertMarshalEqualsFile(XML_FILE, crs, null, STRICT, new String[] {"gml:name"}, new String[] {"xmlns:*", "xsi:schemaLocation", "gml:id"}); } Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultEllipsoidTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultEllipsoidTest.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultEllipsoidTest.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultEllipsoidTest.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -232,7 +232,7 @@ public final strictfp class DefaultEllip /* * Marshall and compare to the original file. */ - assertMarshalEqualsFile(ELLIPSOID_FILE, ellipsoid, "xlmns:*", "xsi:schemaLocation"); + assertMarshalEqualsFile(ELLIPSOID_FILE, ellipsoid, "xmlns:*", "xsi:schemaLocation"); } /** @@ -258,6 +258,6 @@ public final strictfp class DefaultEllip /* * Marshall and compare to the original file. */ - assertMarshalEqualsFile(SPHERE_FILE, ellipsoid, "xlmns:*", "xsi:schemaLocation"); + assertMarshalEqualsFile(SPHERE_FILE, ellipsoid, "xmlns:*", "xsi:schemaLocation"); } } Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -100,7 +100,7 @@ public final strictfp class DefaultTempo @Test public void testMarshalling() throws JAXBException { final DefaultTemporalDatum datum = create(); - assertMarshalEqualsFile(XML_FILE, datum, "xlmns:*", "xsi:schemaLocation"); + assertMarshalEqualsFile(XML_FILE, datum, "xmlns:*", "xsi:schemaLocation"); } /** Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/integration/MetadataTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/integration/MetadataTest.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/integration/MetadataTest.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/integration/MetadataTest.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -60,6 +60,7 @@ import org.apache.sis.referencing.cs.Def import org.apache.sis.referencing.cs.DefaultVerticalCS; import org.apache.sis.referencing.crs.DefaultVerticalCRS; import org.apache.sis.internal.jaxb.metadata.replace.ReferenceSystemMetadata; +import org.apache.sis.internal.jaxb.LegacyNamespaces; import org.apache.sis.internal.jaxb.gmx.Anchor; import org.apache.sis.internal.system.Loggers; import org.apache.sis.referencing.NamedIdentifier; @@ -70,6 +71,7 @@ import org.apache.sis.xml.MarshallerPool import org.apache.sis.xml.IdentifierSpace; import org.apache.sis.xml.NilObject; import org.apache.sis.xml.NilReason; +import org.apache.sis.xml.XML; import static java.util.Collections.singleton; import static java.util.Collections.singletonMap; @@ -86,6 +88,7 @@ import org.junit.Test; import static org.apache.sis.test.Assert.*; import static org.apache.sis.test.TestUtilities.getSingleton; +import static org.apache.sis.metadata.iso.DefaultMetadataTest.REGRESSION; import org.apache.sis.internal.geoapi.evolution.UnsupportedCodeList; @@ -95,7 +98,7 @@ import org.apache.sis.internal.geoapi.ev * * @author Guilhem Legal (Geomatys) * @author Martin Desruisseaux (Geomatys) - * @version 0.8 + * @version 1.0 * * @see org.apache.sis.metadata.iso.DefaultMetadataTest * @@ -305,6 +308,13 @@ public strictfp class MetadataTest exten new DefaultVerticalExtent(Double.NaN, Double.NaN, vcrs), temporal))); } + /* + * Data identification / Environmental description and Supplemental information. + */ + { + identification.setEnvironmentDescription (new SimpleInternationalString("Possibly cloudy.")); + identification.setSupplementalInformation(new SimpleInternationalString("This metadata has been modified with dummy values.")); + } metadata.setIdentificationInfo(singleton(identification)); } /* @@ -399,6 +409,7 @@ public strictfp class MetadataTest exten final MarshallerPool pool = getMarshallerPool(); final Marshaller ms = pool.acquireMarshaller(); final StringWriter writer = new StringWriter(25000); + ms.setProperty(XML.METADATA_VERSION, VERSION_2007); ms.marshal(createHardCoded(), writer); pool.recycle(ms); /* @@ -408,9 +419,9 @@ public strictfp class MetadataTest exten * by the anchor version so we can compare the XML with the "Metadata.xml" file content. */ final StringBuffer xml = writer.getBuffer(); - replace(xml, "<gco:CharacterString>Common Data Index record</gco:CharacterString>", + replace(xml, "<gcol:CharacterString>Common Data Index record</gcol:CharacterString>", "<gmx:Anchor xlink:href=\"SDN:L231:3:CDI\">Common Data Index record</gmx:Anchor>"); - replace(xml, "<gco:CharacterString>EPSG:4326</gco:CharacterString>", + replace(xml, "<gcol:CharacterString>EPSG:4326</gcol:CharacterString>", "<gmx:Anchor xlink:href=\"SDN:L101:2:4326\">EPSG:4326</gmx:Anchor>"); replace(xml, "License", "Licence"); /* @@ -420,7 +431,7 @@ public strictfp class MetadataTest exten * and those values may change in future SIS version. */ final XMLComparator comparator = new XMLComparator(getResource(), xml.toString()); - comparator.ignoredNodes.add(Namespaces.GMD + ":temporalElement"); + comparator.ignoredNodes.add(LegacyNamespaces.GMD + ":temporalElement"); comparator.ignoredAttributes.add("http://www.w3.org/2000/xmlns:*"); comparator.ignoredAttributes.add(Namespaces.XSI + ":schemaLocation"); comparator.ignoredAttributes.add(Namespaces.GML + ":id"); @@ -456,6 +467,10 @@ public strictfp class MetadataTest exten final Unmarshaller unmarshaller = pool.acquireUnmarshaller(); final DefaultMetadata metadata = (DefaultMetadata) unmarshaller.unmarshal(getResource()); pool.recycle(unmarshaller); + if (REGRESSION) { + assertTrue("Maybe SIS-402 has been fixed and this anti-regression hack can be removed?", + metadata.getCharacterSets().add(StandardCharsets.UTF_8)); + } final DefaultMetadata expected = createHardCoded(); assertTrue(metadata.equals(expected, ComparisonMode.DEBUG)); loggings.skipNextLogIfContains("sis-temporal"); @@ -469,6 +484,9 @@ public strictfp class MetadataTest exten @Test public void testMetadataWithVerticalCRS() throws JAXBException { final Metadata metadata = unmarshalFile(Metadata.class, VERTICAL_CRS_XML); + if (REGRESSION) { + ((DefaultMetadata) metadata).setCharacterSet(CharacterSet.UTF_8); + } assertEquals("fileIdentifier", "20090901", metadata.getFileIdentifier()); assertEquals("language", Locale.ENGLISH, metadata.getLanguage()); assertEquals("characterSet", CharacterSet.UTF_8, metadata.getCharacterSet()); @@ -562,7 +580,7 @@ public strictfp class MetadataTest exten * * Now marshal the object and compare with the original file. */ - assertMarshalEqualsFile(VERTICAL_CRS_XML, metadata, "xmlns:*", "xsi:schemaLocation"); + assertMarshalEqualsFile(VERTICAL_CRS_XML, metadata, VERSION_2007, "xmlns:*", "xsi:schemaLocation"); } /** Modified: sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata.xml URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata.xml?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata.xml (original) +++ sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata.xml Mon Feb 26 11:28:17 2018 @@ -353,6 +353,9 @@ <gmd:topicCategory> <gmd:MD_TopicCategoryCode>oceans</gmd:MD_TopicCategoryCode> </gmd:topicCategory> + <gmd:environmentDescription> + <gco:CharacterString>Possibly cloudy.</gco:CharacterString> + </gmd:environmentDescription> <gmd:extent> <gmd:EX_Extent> <gmd:geographicElement> @@ -412,6 +415,9 @@ </gmd:verticalElement> </gmd:EX_Extent> </gmd:extent> + <gmd:supplementalInformation> + <gco:CharacterString>This metadata has been modified with dummy values.</gco:CharacterString> + </gmd:supplementalInformation> </gmd:MD_DataIdentification> </gmd:identificationInfo> <gmd:contentInfo> Modified: sis/trunk/core/sis-utility/pom.xml URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/pom.xml?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-utility/pom.xml (original) +++ sis/trunk/core/sis-utility/pom.xml Mon Feb 26 11:28:17 2018 @@ -87,6 +87,15 @@ Miscellaneous utilities. </roles> </contributor> <contributor> + <name>Cullen Rombach</name> + <organization>Image Matters</organization> + <organizationUrl>http://www.imagemattersllc.com</organizationUrl> + <timezone>-5</timezone> + <roles> + <role>developer</role> + </roles> + </contributor> + <contributor> <name>Guilhem Legal</name> <email>[email protected]</email> <organization>Geomatys</organization> Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/UnsupportedCodeList.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/UnsupportedCodeList.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/UnsupportedCodeList.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/UnsupportedCodeList.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -26,16 +26,18 @@ import static org.opengis.annotation.Spe /** * Placeholder for code list not yet available in GeoAPI. - * Currently only for {@code org.opengis.metadata.citation.TelephoneType}, but we use the - * {@code UnsupportedCodeList} class name for making clear that this class will disappear - * in a future Apache SIS version. + * Currently defines constants mostly for {@code org.opengis.metadata.citation.TelephoneType}, + * but constants for other code list can be constructed like below: + * + * {@preformat java + * operation.getDistributedComputingPlatforms().add(UnsupportedCodeList.valueOf("SOAP")); + * } * * @author Martin Desruisseaux (Geomatys) - * @version 0.8 + * @version 1.0 * @since 0.5 * @module */ -@UML(identifier="CI_TelephoneTypeCode", specification=ISO_19115) public final class UnsupportedCodeList extends CodeList<UnsupportedCodeList> { /** * For cross-version compatibility. @@ -60,6 +62,12 @@ public final class UnsupportedCodeList e public static final CodeList<?> FACSIMILE = new UnsupportedCodeList("FACSIMILE"); /** + * A frequently used code list element. + */ + @UML(identifier="WebServices", obligation=CONDITIONAL, specification=ISO_19115) + public static final CodeList<?> WEB_SERVICES = new UnsupportedCodeList("WEB_SERVICES"); + + /** * Constructor for new code list element. * * @param name The code list name. Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/UnsupportedCodeListAdapter.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/UnsupportedCodeListAdapter.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/UnsupportedCodeListAdapter.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/evolution/UnsupportedCodeListAdapter.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -52,7 +52,7 @@ public abstract class UnsupportedCodeLis /** * Creates a wrapper for a {@link CodeList}, in order to handle the format specified in ISO-19139. * - * @param value The value of the {@link CodeList} to be marshalled. + * @param value the value of the {@link CodeList} to be marshalled. */ protected UnsupportedCodeListAdapter(final CodeListUID value) { identifier = value; @@ -66,15 +66,15 @@ public abstract class UnsupportedCodeLis * return new ValueType(value); * } * - * @param value The value of {@link CodeList} to be marshalled. - * @return The wrapper for the code list value. + * @param value the value of {@link CodeList} to be marshalled. + * @return the wrapper for the code list value. */ protected abstract ValueType wrap(CodeListUID value); /** * Returns the name of the code list class. * - * @return The code list class name. + * @return the code list class name. */ protected abstract String getCodeListName(); @@ -82,8 +82,8 @@ public abstract class UnsupportedCodeLis * Substitutes the adapter value read from an XML stream by the object which will * contains the value. JAXB calls automatically this method at unmarshalling time. * - * @param adapter The adapter for this metadata value. - * @return A code list which represents the metadata value. + * @param adapter the adapter for this metadata value. + * @return a code list which represents the metadata value. */ @Override public final CodeList<?> unmarshal(final ValueType adapter) { @@ -97,8 +97,8 @@ public abstract class UnsupportedCodeLis * Substitutes the code list by the adapter to be marshalled into an XML file or stream. * JAXB calls automatically this method at marshalling time. * - * @param value The code list value. - * @return The adapter for the given code list. + * @param value the code list value. + * @return the adapter for the given code list. */ @Override public final ValueType marshal(final CodeList<?> value) { Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/temporal/Instant.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/temporal/Instant.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/temporal/Instant.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/temporal/Instant.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -21,7 +21,7 @@ import org.opengis.temporal.TemporalPrim /** - * Placeholder for a GeoAPI interfaces not present in GeoAPI 3.0.0. + * Placeholder for a GeoAPI interfaces not present in GeoAPI 3.0. * * @author Martin Desruisseaux (Geomatys) * @since 0.3 Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/temporal/Period.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/temporal/Period.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/temporal/Period.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/temporal/Period.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -20,7 +20,7 @@ import org.opengis.temporal.TemporalPrim /** - * Placeholder for a GeoAPI interfaces not present in GeoAPI 3.0.0. + * Placeholder for a GeoAPI interfaces not present in GeoAPI 3.0. * * @author Martin Desruisseaux (Geomatys) * @since 0.3 Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/temporal/PeriodDuration.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/temporal/PeriodDuration.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/temporal/PeriodDuration.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/temporal/PeriodDuration.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -20,7 +20,7 @@ import org.opengis.util.InternationalStr /** - * Placeholder for a GeoAPI interfaces which is still incomplete in GeoAPI 3.0.0. + * Placeholder for a GeoAPI interfaces which is still incomplete in GeoAPI 3.0. * We reproduce here the GeoAPI 3.1-pending API. Note that at the time of writing, * this is a bad API (values shall not be instances of {@link InternationalString}). * This will be fixed in a future GeoAPI version. Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/temporal/Position.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/temporal/Position.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/temporal/Position.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/temporal/Position.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -20,7 +20,7 @@ import java.util.Date; /** - * Placeholder for a GeoAPI interfaces not present in GeoAPI 3.0.0. + * Placeholder for a GeoAPI interfaces not present in GeoAPI 3.0. * * @author Martin Desruisseaux (Geomatys) * @since 0.3 Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/temporal/TemporalFactory.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/temporal/TemporalFactory.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/temporal/TemporalFactory.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/temporal/TemporalFactory.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -21,7 +21,7 @@ import org.opengis.util.InternationalStr /** - * Placeholder for a GeoAPI interfaces not present in GeoAPI 3.0.0. + * Placeholder for a GeoAPI interfaces not present in GeoAPI 3.0. * * @author Martin Desruisseaux (Geomatys) * @since 0.3 Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/temporal/package-info.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/temporal/package-info.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/temporal/package-info.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/geoapi/temporal/package-info.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -16,7 +16,7 @@ */ /** - * Placeholder for GeoAPI interfaces not present in GeoAPI 3.0.0. + * Placeholder for GeoAPI interfaces not present in GeoAPI 3.0. * * <STRONG>Do not use!</STRONG> * Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -50,7 +50,8 @@ import org.apache.sis.xml.ReferenceResol * if no (un)marshalling is in progress. * * @author Martin Desruisseaux (Geomatys) - * @version 0.7 + * @author Cullen Rombach (Image Matters) + * @version 1.0 * @since 0.3 * @module */ @@ -59,40 +60,46 @@ public final class Context extends Marsh * The bit flag telling if a marshalling process is under progress. * This flag is unset for unmarshalling processes. */ - public static final int MARSHALLING = 1; + public static final int MARSHALLING = 0x1; /** * The bit flag for enabling substitution of language codes by character strings. * * @see org.apache.sis.xml.XML#STRING_SUBSTITUTES */ - public static final int SUBSTITUTE_LANGUAGE = 2; + public static final int SUBSTITUTE_LANGUAGE = 0x2; /** * The bit flag for enabling substitution of country codes by character strings. * * @see org.apache.sis.xml.XML#STRING_SUBSTITUTES */ - public static final int SUBSTITUTE_COUNTRY = 4; + public static final int SUBSTITUTE_COUNTRY = 0x4; /** * The bit flag for enabling substitution of filenames by character strings. * * @see org.apache.sis.xml.XML#STRING_SUBSTITUTES */ - public static final int SUBSTITUTE_FILENAME = 8; + public static final int SUBSTITUTE_FILENAME = 0x8; /** * The bit flag for enabling substitution of mime types by character strings. * * @see org.apache.sis.xml.XML#STRING_SUBSTITUTES */ - public static final int SUBSTITUTE_MIMETYPE = 16; + public static final int SUBSTITUTE_MIMETYPE = 0x10; + + /** + * Whether we are (un)marshalling legacy metadata as defined in 2003 model (ISO 19139:2007). + * If this flag is not set, then we assume latest metadata as defined in 2014 model (ISO 19115-3). + */ + public static final int LEGACY_METADATA = 0x20; /** * Bit where to store whether {@link #finish()} shall invoke {@code Semaphores.clear(Semaphores.NULL_COLLECTION)}. */ - private static final int CLEAR_SEMAPHORE = 32; + private static final int CLEAR_SEMAPHORE = 0x40; /** * The thread-local context. Elements are created in the constructor, and removed in a @@ -109,7 +116,7 @@ public final class Context extends Marsh /** * Various boolean attributes determines by the above static constants. */ - private int bitMasks; + final int bitMasks; /** * The locale to use for marshalling, or an empty queue if no locale were explicitly specified. @@ -123,7 +130,7 @@ public final class Context extends Marsh private final TimeZone timezone; /** - * The base URL of ISO 19139 (or other standards) schemas. The valid values + * The base URL of ISO 19115-3 (or other standards) schemas. The valid values * are documented in the {@link org.apache.sis.xml.XML#SCHEMAS} property. */ private final Map<String,String> schemas; @@ -203,18 +210,25 @@ public final class Context extends Marsh * @param timezone the timezone, or {@code null} if unspecified. * @param schemas the schemas root URL, or {@code null} if none. * @param versionGML the GML version, or {@code null}. + * @param versionMetadata the metadata version, or {@code null}. * @param resolver the resolver in use. * @param converter the converter in use. * @param warningListener the object to inform about warnings. */ @SuppressWarnings("ThisEscapedInObjectConstruction") - public Context(final int bitMasks, - final Locale locale, final TimeZone timezone, - final Map<String,String> schemas, final Version versionGML, - final ReferenceResolver resolver, final ValueConverter converter, + public Context(int bitMasks, + final Locale locale, + final TimeZone timezone, + final Map<String,String> schemas, + final Version versionGML, + final Version versionMetadata, + final ReferenceResolver resolver, + final ValueConverter converter, final WarningListener<?> warningListener) { - this.bitMasks = bitMasks; + if (versionMetadata != null && versionMetadata.compareTo(LegacyNamespaces.VERSION_2014) < 0) { + bitMasks |= LEGACY_METADATA; + } this.locales = new LinkedList<>(); this.timezone = timezone; this.schemas = schemas; // No clone, because this class is internal. @@ -224,15 +238,21 @@ public final class Context extends Marsh this.warningListener = warningListener; this.identifiers = new HashMap<>(); this.identifiedObjects = new IdentityHashMap<>(); - if ((bitMasks & MARSHALLING) != 0) { - if (!Semaphores.queryAndSet(Semaphores.NULL_COLLECTION)) { - this.bitMasks |= CLEAR_SEMAPHORE; - } - } if (locale != null) { locales.add(locale); } previous = CURRENT.get(); + if ((bitMasks & MARSHALLING) != 0) { + /* + * Set global semaphore last after our best effort to ensure that construction + * will not fail with an OutOfMemoryError. This is preferable for allowing the + * caller to invoke finish() in a finally block. + */ + if (!Semaphores.queryAndSet(Semaphores.NULL_COLLECTION)) { + bitMasks |= CLEAR_SEMAPHORE; + } + } + this.bitMasks = bitMasks; CURRENT.set(this); } @@ -264,10 +284,14 @@ public final class Context extends Marsh */ @Override public final Version getVersion(final String prefix) { - if (prefix.equals("gml")) { - return versionGML; + switch (prefix) { + case "gml": return versionGML; + case "gmd": { + if ((bitMasks & MARSHALLING) == 0) break; // If unmarshalling, we don't know the version. + return (bitMasks & LEGACY_METADATA) == 0 ? LegacyNamespaces.VERSION_2016 : LegacyNamespaces.VERSION_2007; + } + // Future SIS versions may add more cases here. } - // Future SIS versions may add more cases here. return null; } @@ -347,7 +371,7 @@ public final class Context extends Marsh /** * Returns {@code true} if the GML version is equals or newer than the specified version. - * If no GML version were specified, then this method returns {@code true}, i.e. newest + * If no GML version was specified, then this method returns {@code true}, i.e. newest * version is assumed. * * <div class="note"><b>API note:</b> @@ -370,7 +394,7 @@ public final class Context extends Marsh } /** - * Returns the base URL of ISO 19139 (or other standards) schemas. + * Returns the base URL of ISO 19115-3 (or other standards) schemas. * The valid values are documented in the {@link org.apache.sis.xml.XML#SCHEMAS} property. * If the returned value is not empty, then this method guarantees it ends with {@code '/'}. * Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/LegacyNamespaces.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/LegacyNamespaces.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/LegacyNamespaces.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/LegacyNamespaces.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -22,8 +22,9 @@ import org.apache.sis.util.Version; /** * Legacy XML namespaces, and {@link Version} constants for identifying when those namespaces were used. * - * @author Guilhem Legal (Geomatys) - * @version 0.4 + * @author Guilhem Legal (Geomatys) + * @author Cullen Rombach (Image Matters) + * @version 1.0 * * @see org.apache.sis.xml.Namespaces * @@ -32,7 +33,14 @@ import org.apache.sis.util.Version; */ public final class LegacyNamespaces { /** - * Miscellaneous version constants. + * Miscellaneous version constants used for ISO standards. + */ + public static final Version VERSION_2007 = new Version("2007"), + VERSION_2014 = new Version("2014"), + VERSION_2016 = new Version("2016"); + + /** + * Miscellaneous version constants used for GML versions. */ public static final Version VERSION_3_0 = new Version("3.0"), VERSION_3_2 = new Version("3.2"); @@ -52,24 +60,49 @@ public final class LegacyNamespaces { public static final String GML = "http://www.opengis.net/gml"; /** - * A non-public (un)marshaller property for controlling usage of {@code org.apache.sis.xml.FilteredNamespaces}. - * Values can be: - * - * <ul> - * <li>{@link Boolean#FALSE} for disabling namespace replacements. XML (un)marshalling will use the namespaces URI - * supported natively by SIS as declared in JAXB annotations. This is sometime useful for debugging purpose.</li> - * <li>{@link Boolean#TRUE} for forcing namespace replacements at unmarshalling time. This is useful for reading a - * XML document of unknown GML version.</li> - * <li>{@code null} or missing for the default behavior, which is apply namespace replacements only if the - * {@link org.apache.sis.xml.XML#GML_VERSION} property is set to an older value than the one supported - * natively by SIS.</li> - * </ul> - * - * This property can be given to {@link org.apache.sis.xml.MarshallerPool} constructor, or set directly on - * a {@code Marshaller} or {@code Unmarshaller} instance created by {@code MarshallerPool} by invoking its - * {@code setProperty(String, Object)} method. + * The <code>{@value}</code> URL, used in ISO 19139:2007. + * The usual prefix for this namespace is {@code "gmd"}. + */ + public static final String GMD = "http://www.isotc211.org/2005/gmd"; + + /** + * The <code>{@value}</code> URL. + * The usual prefix for this namespace is {@code "gmi"}. + */ + public static final String GMI = "http://standards.iso.org/iso/19115/-2/gmi/1.0"; + + /** + * The <code>{@value}</code> URL, used in ISO 19139:2007. + * The usual prefix for this namespace is {@code "gmx"}. + */ + public static final String GMX = "http://www.isotc211.org/2005/gmx"; + + /** + * The <code>{@value}</code> URL, used in ISO 19139:2007. + * The usual prefix for this namespace is {@code "gco"}. + * Replaced by {@link org.apache.sis.xml.Namespaces#GCO}. + */ + public static final String GCO = "http://www.isotc211.org/2005/gco"; + + /** + * The <code>{@value}</code> URL, used in ISO 19139:2007. + * The usual prefix for this namespace is {@code "srv"}. + * Replaced by {@link org.apache.sis.xml.Namespaces#SRV}. + */ + public static final String SRV = "http://www.isotc211.org/2005/srv"; + + /** + * The <code>{@value}</code> URL, used in ISO 19110. + * The usual prefix for this namespace is {@code "gfc"}. + * Replaced by {@link org.apache.sis.xml.Namespaces#GFC}. + */ + public static final String GFC = "http://www.isotc211.org/2005/gfc"; + + /** + * The <code>{@value}</code> URL, used in ISO 19139:2007. + * The usual prefix for this namespace is {@code "gts"}. */ - public static final String APPLY_NAMESPACE_REPLACEMENTS = "org.apache.sis.xml.applyNamespaceReplacements"; + public static final String GTS = "http://www.isotc211.org/2005/gts"; /** * Do not allow instantiation of this class. Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/NonMarshalledAuthority.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/NonMarshalledAuthority.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/NonMarshalledAuthority.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/NonMarshalledAuthority.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -41,7 +41,7 @@ import org.apache.sis.xml.IdentifierSpac * <p>There is two kinds of non-marshalled identifiers:</p> * * <ul> - * <li>The XML attributes declared by ISO 19139 specification in the {@code gco:PropertyType} + * <li>The XML attributes declared by ISO 19115-3 specification in the {@code gco:PropertyType} * element: {@code gml:id}, {@code gco:uuid} and {@code xlink:href}. Those attributes are * not part of the ISO 19115 specification. Those authorities are declared in the * {@link IdentifierSpace} interfaces.</li> @@ -109,7 +109,7 @@ public final class NonMarshalledAuthorit /** * Returns the first marshallable identifier from the given collection. This method omits - * "special" identifiers (ISO 19139 attributes, ISBN codes...), which are recognized by + * "special" identifiers (ISO 19115-3 attributes, ISBN codes...), which are recognized by * the implementation class of their authority. * * <p>This method is used for implementation of {@code getIdentifier()} methods (singular form) @@ -132,9 +132,8 @@ public final class NonMarshalledAuthorit /** * Sets the given identifier in the given collection. This method removes all identifiers - * that are not ISO 19139 identifiers before to adds the given one in the collection. This - * method is used when the given collection is expected to contains only one ISO 19115 - * identifier. + * that are not ISO 19115-3 identifiers before to adds the given one in the collection. + * This method is used when the given collection is expected to contains only one ISO 19115-1 identifier. * * <p>This method is used for implementation of {@code setIdentifier(Identifier)} methods * in public metadata objects.</p> Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Schemas.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Schemas.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Schemas.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Schemas.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -41,35 +41,37 @@ package org.apache.sis.internal.jaxb; * </ul> * * @author Martin Desruisseaux (Geomatys) - * @version 0.7 + * @author Cullen Rombach (Image Matters) + * @version 1.0 * @since 0.4 * @module */ public final class Schemas { /** - * The XSD definition for Geographic Markup Language (GML) objects. - */ - public static final String GML_XSD = "http://schemas.opengis.net/gml/3.2.1/gml.xsd"; - - /** - * The XSD definition for metadata objects. + * The root directory of ISO 19115 metadata schemas. + * This is the schema used by default in Apache SIS. */ - public static final String METADATA_XSD = "http://schemas.opengis.net/iso/19139/20070417/gmd/gmd.xsd"; + public static final String METADATA_ROOT = "http://standards.iso.org/iso/19115/"; /** * The root directory of OGC metadata schemas. * This is the schema used by default in Apache SIS. + * Some alternatives to this URL are: + * + * <ul> + * <li>http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/</li> + * <li>http://www.isotc211.org/2005/</li> + * </ul> */ - public static final String METADATA_ROOT = "http://schemas.opengis.net/iso/19139/20070417/"; + public static final String METADATA_ROOT_LEGACY = "http://schemas.opengis.net/iso/19139/20070417/"; /** - * The root directory of ISO metadata schemas. - * This is sometime used as an alternative to {@link #METADATA_ROOT}. + * The string to append to {@link #METADATA_ROOT} for obtaining the path to the definitions of code lists. */ - public static final String ISO_19139_ROOT = "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/"; + public static final String CODELISTS_PATH = "resources/Codelist/cat/codelists.xml"; /** - * The string to append to {@link #METADATA_ROOT} or {@link #ISO_19139_ROOT} for obtaining the path + * The string to append to {@link #METADATA_ROOT_LEGACY} or one of its alternative for obtaining the path * to the definitions of code lists. * * <p>A localized version of this file exists also with the {@code "ML_gmxCodelists.xml"} filename @@ -77,10 +79,10 @@ public final class Schemas { * * @see <a href="https://issues.apache.org/jira/browse/SIS-154">SIS-154</a> */ - public static final String CODELISTS_PATH = "resources/Codelist/gmxCodelists.xml"; + public static final String CODELISTS_PATH_LEGACY = "resources/Codelist/gmxCodelists.xml"; /** - * The string to append to {@link #METADATA_ROOT} or {@link #ISO_19139_ROOT} for obtaining the path + * The string to append to {@link #METADATA_ROOT} or one of its alternative for obtaining the path * to the definitions of units of measurement. * * <p>A localized version of this file exists also with the {@code "ML_gmxUom.xml"} filename Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/CharSequenceAdapter.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/CharSequenceAdapter.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/CharSequenceAdapter.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/CharSequenceAdapter.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -22,13 +22,14 @@ import org.apache.sis.util.CharSequences import org.apache.sis.xml.XLink; import org.apache.sis.xml.ReferenceResolver; import org.apache.sis.internal.jaxb.Context; +import org.apache.sis.internal.jaxb.FilterByVersion; import org.apache.sis.internal.jaxb.gmx.Anchor; import org.apache.sis.internal.jaxb.gmd.PT_FreeText; /** - * JAXB adapter in order to wrap the string value with a {@code <gco:CharacterString>} element, - * for ISO-19139 compliance. A {@link CharSequenceAdapter} can handle the following types: + * JAXB adapter wrapping the string value in a {@code <gco:CharacterString>} element, for ISO 19115-3 compliance. + * A {@link CharSequenceAdapter} can handle the following types: * * <ul> * <li>{@link InternationalString}, which may be mapped to {@link PT_FreeText} elements.</li> @@ -40,7 +41,7 @@ import org.apache.sis.internal.jaxb.gmd. * @author Cédric Briançon (Geomatys) * @author Guilhem Legal (Geomatys) * @author Martin Desruisseaux (Geomatys) - * @version 0.6 + * @version 1.0 * * @see StringAdapter * @see InternationalStringAdapter @@ -48,11 +49,11 @@ import org.apache.sis.internal.jaxb.gmd. * @since 0.3 * @module */ -public final class CharSequenceAdapter extends XmlAdapter<GO_CharacterString, CharSequence> { +public class CharSequenceAdapter extends XmlAdapter<GO_CharacterString, CharSequence> { /** * Constructor for JAXB only. */ - private CharSequenceAdapter() { + public CharSequenceAdapter() { } /** @@ -63,7 +64,7 @@ public final class CharSequenceAdapter e * @return a {@link CharSequence} which represents the metadata value. */ @Override - public CharSequence unmarshal(final GO_CharacterString value) { + public final CharSequence unmarshal(final GO_CharacterString value) { return (value != null) ? value.toCharSequence() : null; } @@ -91,12 +92,12 @@ public final class CharSequenceAdapter e return wrap(Context.current(), value, (String) value); // Slightly more efficient variant of this method. } /* - * <gmd:someElement xsi:type="gmd:PT_FreeText_PropertyType"> + * <mdb:someElement xsi:type="lan:PT_FreeText_PropertyType"> * <gco:CharacterString>...</gco:CharacterString> - * <gmd:PT_FreeText> + * <lan:PT_FreeText> * ... see PT_FreeText ... - * </gmd:PT_FreeText> - * </gmd:someElement> + * </lan:PT_FreeText> + * </mdb:someElement> */ if (value instanceof InternationalString) { final PT_FreeText ft = PT_FreeText.create((InternationalString) value); @@ -135,9 +136,9 @@ public final class CharSequenceAdapter e * have been replaced by an Anchor. The output will be one of the following: * * ┌──────────────────────────────────────────────────┬────────────────────────────────┐ - * │ <gmd:someElement> │ <gmd:someElement> │ + * │ <mdb:someElement> │ <mdb:someElement> │ * │ <gco:CharacterString>...</gco:CharacterString> │ <gmx:Anchor>...</gmx:Anchor> │ - * │ </gmd:someElement> │ </gmd:someElement> │ + * │ </mdb:someElement> │ </mdb:someElement> │ * └──────────────────────────────────────────────────┴────────────────────────────────┘ */ return new GO_CharacterString(value); @@ -182,4 +183,23 @@ public final class CharSequenceAdapter e } return string; } + + /** + * Wraps the value only if marshalling ISO 19115-3 element. + * Otherwise (i.e. if marshalling a legacy ISO 19139:2007 document), omit the element. + */ + public static final class Since2014 extends CharSequenceAdapter { + /** Empty constructor used only by JAXB. */ + public Since2014() { + } + + /** + * Wraps the given value in an ISO 19115-3 element, unless we are marshalling an older document. + * + * @return a non-null value only if marshalling ISO 19115-3 or newer. + */ + @Override public GO_CharacterString marshal(final CharSequence value) { + return FilterByVersion.CURRENT_METADATA.accept() ? super.marshal(value) : null; + } + } } Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Boolean.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Boolean.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Boolean.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Boolean.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -23,9 +23,9 @@ import javax.xml.bind.annotation.XmlType /** * Surrounds boolean value by {@code <gco:Boolean>}. - * The ISO-19139 standard requires most types to be surrounded by an element representing the value type. + * The ISO 19115-3 standard requires most types to be wrapped by an element representing the value type. * The JAXB default behavior is to marshal primitive Java types directly, without such wrapper element. - * The role of this class is to add the {@code <gco:…>} wrapper element required by ISO 19139. + * The role of this class is to add the {@code <gco:…>} wrapper element required by ISO 19115-3. * * @author Cédric Briançon (Geomatys) * @author Martin Desruisseaux (Geomatys) @@ -63,7 +63,7 @@ public final class GO_Boolean extends Pr /** * Allows JAXB to change the result of the marshalling process, according to the - * ISO-19139 standard and its requirements about primitive types. + * ISO 19115-3 standard and its requirements about primitive types. * * @param value the boolean value we want to surround by an element representing its type. * @return an adaptation of the boolean value, that is to say a boolean value surrounded Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -23,6 +23,7 @@ import javax.xml.bind.annotation.XmlType import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElements; import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSeeAlso; import org.w3c.dom.Element; import org.opengis.util.CodeList; @@ -32,16 +33,18 @@ import org.apache.sis.internal.jaxb.gmx. import org.apache.sis.internal.jaxb.gmx.FileName; import org.apache.sis.internal.jaxb.gmx.MimeFileType; import org.apache.sis.internal.jaxb.gmd.CodeListUID; +import org.apache.sis.internal.jaxb.LegacyNamespaces; import org.apache.sis.util.CharSequences; import org.apache.sis.util.Workaround; import org.apache.sis.util.iso.Types; -import org.apache.sis.util.resources.Errors; +import org.apache.sis.util.resources.IndexedResourceBundle; import org.apache.sis.util.resources.Messages; +import org.apache.sis.util.resources.Errors; /** - * JAXB wrapper for string value in a {@code <gco:CharacterString>}, {@code <gmx:Anchor>}, - * {@code <gmx:FileName>} or {@code <gmx:MimeFileType>} element, for ISO-19139 compliance. + * JAXB wrapper for string value in a {@code <gco:CharacterString>}, {@code <gcx:Anchor>}, + * {@code <gcx:FileName>} or {@code <gcx:MimeFileType>} element, for ISO 19115-3 compliance. * * <p>{@code FileName} and {@code MimeFileType} are possible substitutions for {@code CharacterString}. * They make sense only in {@link org.apache.sis.metadata.iso.identification.DefaultBrowseGraphic} or @@ -54,7 +57,8 @@ import org.apache.sis.util.resources.Mes * * @author Cédric Briançon (Geomatys) * @author Martin Desruisseaux (Geomatys) - * @version 0.7 + * @author Cullen Rombach (Image Matters) + * @version 1.0 * * @see org.apache.sis.internal.jaxb.gmd.PT_FreeText * @@ -67,6 +71,7 @@ import org.apache.sis.util.resources.Mes org.apache.sis.internal.jaxb.gmd.LanguageCode.class, org.apache.sis.internal.jaxb.gmd.Country.class }) +@XmlRootElement(name = "CharacterString") public class GO_CharacterString { /* * Numerical values below are ordered: if two or more values are defined (thoerically not legal, @@ -74,27 +79,33 @@ public class GO_CharacterString { */ /** * Value assigned to {@link #type} if the character string - * shall be marshalled as a {@code <gmx:MimeFileType>} element. + * shall be marshalled as a {@code <gcx:MimeFileType>} element. */ public static final byte MIME_TYPE = 1; /** * Value assigned to {@link #type} if the character string - * shall be marshalled as a {@code <gmx:FileName>} element. + * shall be marshalled as a {@code <gcx:FileName>} element. */ - public static final byte FILENAME = 2; + public static final byte FILENAME = 3; // Precedence over legacy <gmd:UML> + + /** + * Value assigned to {@link #type} if the character string + * shall be marshalled as a legacy {@code <gmd:URL>} element. + */ + public static final byte URL = 2; /** * Value assigned to {@link #type} if the current {@link #text} - * has been found in a {@code <gmx:Anchor>} element. + * has been found in a {@code <gcx:Anchor>} element. */ - private static final byte ANCHOR = 3; + private static final byte ANCHOR = 4; /** * Value assigned to {@link #type} if the current {@link #text} * has been found in an enumeration or code list element. */ - private static final byte ENUM = 4; + private static final byte ENUM = 5; /** * The XML element names for each possible {@link #type} values. @@ -107,6 +118,7 @@ public class GO_CharacterString { case FILENAME: return "FileName"; case ANCHOR: return "Anchor"; case ENUM: return "ControlledVocabulary"; + case URL: return "URL"; // In legacy XML only. default: throw new AssertionError(type); } } @@ -156,7 +168,7 @@ public class GO_CharacterString { * If the given value overwrites a previous one, a warning is emitted. * * @param value the value to set. - * @param property 0 or one of the {@link #MIME_TYPE}, {@link #FILENAME} or {@link #ANCHOR} constants. + * @param property 0 or one of the {@link #MIME_TYPE}, {@link #FILENAME}, {@link #URL} or {@link #ANCHOR} constants. */ private void setText(CharSequence value, byte property) { value = CharSequences.trimWhitespaces(value); @@ -185,7 +197,7 @@ public class GO_CharacterString { } /** - * Returns the text in a {@code <gco:CharacterString>}, {@code <gmx:FileName>} or {@code <gmx:MimeFileType>} + * Returns the text in a {@code <gco:CharacterString>}, {@code <gcx:FileName>} or {@code <gcx:MimeFileType>} * element, or {@code null} if none. This method does not return anything for {@code Enum} or {@code CodeList} * instances, as the later are handled by {@link #getCodeList()}. * @@ -193,13 +205,15 @@ public class GO_CharacterString { */ @XmlElements({ @XmlElement(type = String.class, name = "CharacterString"), - @XmlElement(type = Anchor.class, name = "Anchor", namespace = Namespaces.GMX), - @XmlElement(type = FileName.class, name = "FileName", namespace = Namespaces.GMX), - @XmlElement(type = MimeFileType.class, name = "MimeFileType", namespace = Namespaces.GMX) + @XmlElement(type = Anchor.class, name = "Anchor", namespace = Namespaces.GCX), + @XmlElement(type = FileName.class, name = "FileName", namespace = Namespaces.GCX), + @XmlElement(type = MimeFileType.class, name = "MimeFileType", namespace = Namespaces.GCX), + @XmlElement(type = GO_URL.class, name = "URL", namespace = LegacyNamespaces.GMD) }) private Object getValue() { switch (type) { case 0: return StringAdapter.toString(text); + case URL: return new GO_URL(text.toString()); case FILENAME: return new FileName(text.toString()); case MIME_TYPE: return new MimeFileType(text.toString()); case ANCHOR: return text; // Shall be an instance of Anchor. @@ -208,10 +222,11 @@ public class GO_CharacterString { } /** - * Sets the {@code <gco:CharacterString>}, {@code <gmx:FileName>} or {@code <gmx:MimeFileType>} value. + * Sets the {@code <gco:CharacterString>}, {@code <gcx:FileName>} or {@code <gcx:MimeFileType>} value. * * <p>This method is invoked by JAXB at unmarshalling time and should not need to be invoked directly.</p> */ + @SuppressWarnings("unused") private void setValue(final Object value) { if (value instanceof Anchor) { setText((Anchor) value, ANCHOR); @@ -219,6 +234,8 @@ public class GO_CharacterString { setText(value.toString(), FILENAME); } else if (value instanceof MimeFileType) { setText(value.toString(), MIME_TYPE); + } else if (value instanceof GO_URL) { // Legacy ISO 19139:2007 + setText(value.toString(), URL); } else { setText((CharSequence) value, (byte) 0); } @@ -230,7 +247,7 @@ public class GO_CharacterString { * * <div class="note"><b>Note:</b> * we have to rely on a somewhat complicated mechanism because the code lists implementations in GeoAPI - * do not hae JAXB annotations. If those annotations are added in a future GeoAPI implementation, then + * do not have JAXB annotations. If those annotations are added in a future GeoAPI implementation, then * we could replace this mechanism by a simple property annotated with {@code XmlElementRef}.</div> * * @since 0.7 @@ -243,23 +260,15 @@ public class GO_CharacterString { } final CodeList<?> code = Types.forCodeTitle(text); final String name = Types.getListName(code); - final String namespace; /* - * The namespace is usually GMD, but we also have some other namespaces link GMI. + * The namespace has have various value like CIT, SRV, MDQ, MRI, MSR, LAN, etc. * The real namespace is declared in the @XmlElement annotation of the getElement * method in the JAXB adapter. We could use reflection, but we do not in order to * avoid potential class loading issue and also because not all CodeList are in the * same package. */ - if (name.startsWith("MD_") || name.startsWith("CI_") || name.startsWith("DS_")) { - namespace = Namespaces.GMD; - } else if (name.startsWith("MI_")) { - namespace = Namespaces.GMI; - } else if (name.startsWith("SV_") || name.equals("DCPList")) { - namespace = Namespaces.SRV; - } else if (name.startsWith("CS_") || name.startsWith("CD_") || name.startsWith("SC_")) { - namespace = Namespaces.GML; - } else { + String namespace = Namespaces.guessForType(name); + if (namespace == null) { namespace = XMLConstants.NULL_NS_URI; } return new JAXBElement<>(new QName(namespace, name), CodeListUID.class, @@ -267,25 +276,37 @@ public class GO_CharacterString { } /** - * Invoked by JAXB for any XML element which is not a {@code <gco:CharacterString>}, {@code <gmx:FileName>} - * or {@code <gmx:MimeFileType>}. This method presumes that the element name is the CodeList standard name. + * Invoked by JAXB for any XML element which is not a {@code <gco:CharacterString>}, {@code <gcx:FileName>} + * or {@code <gcx:MimeFileType>}. This method presumes that the element name is the CodeList standard name. * If not, the element will be ignored. */ - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "unused"}) private void setCodeList(final Object value) { final Element e = (Element) value; if (e.getNodeType() == Element.ELEMENT_NODE) { final Class<?> ct = Types.forStandardName(e.getLocalName()); + final Class<? extends IndexedResourceBundle> resources; + final short errorKey; + final Object[] args; if (ct != null && CodeList.class.isAssignableFrom(ct)) { - final String attribute = e.getAttribute("codeListValue"); + final String attribute = e.getAttribute("codeListValue").trim(); if (!attribute.isEmpty()) { text = Types.getCodeTitle(Types.forCodeName((Class) ct, attribute, true)); type = ENUM; return; + } else { + resources = Errors.class; + errorKey = Errors.Keys.MissingOrEmptyAttribute_2; + args = new Object[2]; + args[1] = "codeListValue"; } + } else { + resources = Messages.class; + errorKey = Messages.Keys.UnknownCodeList_1; + args = new Object[1]; } - Context.warningOccured(Context.current(), GO_CharacterString.class, "setCodeList", - Errors.class, Errors.Keys.UnknownType_1, e.getNodeName()); + args[0] = e.getNodeName(); + Context.warningOccured(Context.current(), GO_CharacterString.class, "setCodeList", resources, errorKey, args); } } Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_DateTime.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_DateTime.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_DateTime.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_DateTime.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -29,7 +29,7 @@ import org.apache.sis.internal.jaxb.XmlU /** * JAXB adapter wrapping the date value in a {@code <gco:Date>} or {@code <gco:DateTime>} element, - * for ISO-19139 compliance. Only one of {@code Date} or {@code DateTime} field shall be non-null. + * for ISO 19115-3 compliance. Only one of {@code Date} or {@code DateTime} field shall be non-null. * At marshalling time, the choice is performed depending on whatever the given date contains * hour, minute or seconds information different than zero. * Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Decimal.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Decimal.java?rev=1825355&r1=1825354&r2=1825355&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Decimal.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Decimal.java [UTF-8] Mon Feb 26 11:28:17 2018 @@ -23,9 +23,9 @@ import javax.xml.bind.annotation.XmlType /** * Surrounds double values by {@code <gco:Decimal>}. - * The ISO-19139 standard requires most types to be surrounded by an element representing the value type. + * The ISO 19115-3 standard requires most types to be wrapped by an element representing the value type. * The JAXB default behavior is to marshal primitive Java types directly, without such wrapper element. - * The role of this class is to add the {@code <gco:…>} wrapper element required by ISO 19139. + * The role of this class is to add the {@code <gco:…>} wrapper element required by ISO 19115-3. * * <div class="section">Relationship with {@code GO_Real}</div> * This adapter is identical to {@link GO_Real} except for the element name, which is {@code "Decimal"} instead @@ -38,7 +38,6 @@ import javax.xml.bind.annotation.XmlType * @version 0.3 * * @see GO_Real - * @see GO_Decimal32 * * @since 0.3 * @module @@ -72,7 +71,7 @@ public final class GO_Decimal extends Pr /** * Allows JAXB to change the result of the marshalling process, according to the - * ISO-19139 standard and its requirements about primitive types. + * ISO 19115-3 standard and its requirements about primitive types. * * @param value the double value we want to surround by an element representing its type. * @return an adaptation of the double value, that is to say a double value surrounded
