Author: desruisseaux Date: Sun Aug 20 15:49:18 2017 New Revision: 1805567 URL: http://svn.apache.org/viewvc?rev=1805567&view=rev Log: Merge from JDK7 branch.
Modified: sis/trunk/ (props changed) sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/DateAdapter.java sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/UniversalTimeAdapter.java sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/Anchor.java sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Locales.java sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecord.java sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecordType.java sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java sis/trunk/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java sis/trunk/storage/sis-gdal/src/test/java/org/apache/sis/storage/gdal/Proj4FactoryTest.java sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java Propchange: sis/trunk/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Sun Aug 20 15:49:18 2017 @@ -1,5 +1,5 @@ /sis/branches/Android:1430670-1480699 /sis/branches/JDK6:1394364-1758914 -/sis/branches/JDK7:1394913-1804427 -/sis/branches/JDK8:1584960-1804426 +/sis/branches/JDK7:1394913-1805566 +/sis/branches/JDK8:1584960-1804582 /sis/branches/JDK9:1773327-1803064 Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/DateAdapter.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/DateAdapter.java?rev=1805567&r1=1805566&r2=1805567&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/DateAdapter.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/DateAdapter.java [UTF-8] Sun Aug 20 15:49:18 2017 @@ -26,7 +26,7 @@ import org.apache.sis.internal.jaxb.XmlU /** * JAXB adapter wrapping the date value (as milliseconds elapsed since January 1st, 1970) in a - * {@link XMLGregorianCalendar} for the {@code xsd:date} type. Hours, minutes and seconds are + * {@link XMLGregorianCalendar} for the {@code xs:date} type. Hours, minutes and seconds are * discarded. * * <p>Using this adapter is equivalent to apply the following annotation on a {@code Date} field:</p> @@ -81,7 +81,7 @@ public final class DateAdapter extends X final Context context = Context.current(); try { final XMLGregorianCalendar gc = XmlUtilities.toXML(context, value); - XmlUtilities.trimTime(gc, true); // Type is xsd:date without time. + XmlUtilities.trimTime(gc, true); // Type is xs:date without time. return gc; } catch (DatatypeConfigurationException e) { Context.warningOccured(context, XmlAdapter.class, "marshal", e, true); Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java?rev=1805567&r1=1805566&r2=1805567&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java [UTF-8] Sun Aug 20 15:49:18 2017 @@ -58,7 +58,7 @@ import org.apache.sis.measure.Units; * <gml:semiMajorAxis uom="urn:ogc:def:uom:EPSG::9001">6378137</gml:semiMajorAxis> * } * - * Both have a value of type {@code xsd:double} and a {@code uom} attribute (without namespace) + * Both have a value of type {@code xs:double} and a {@code uom} attribute (without namespace) * of type {@code gml:UomIdentifier}. Those two informations are represented by this class. * * @author Cédric Briançon (Geomatys) Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/UniversalTimeAdapter.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/UniversalTimeAdapter.java?rev=1805567&r1=1805566&r2=1805567&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/UniversalTimeAdapter.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/UniversalTimeAdapter.java [UTF-8] Sun Aug 20 15:49:18 2017 @@ -32,7 +32,7 @@ import static org.apache.sis.internal.ja /** * JAXB adapter wrapping the date value (as milliseconds elapsed since January 1st, 1970) in a - * {@link XMLGregorianCalendar} for the {@code xsd:dateTime} type with the timezone forced to UTC. + * {@link XMLGregorianCalendar} for the {@code xs:dateTime} type with the timezone forced to UTC. * The milliseconds are omitted if not different than zero. * * @author Martin Desruisseaux (Geomatys) Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/Anchor.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/Anchor.java?rev=1805567&r1=1805566&r2=1805567&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/Anchor.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/Anchor.java [UTF-8] Sun Aug 20 15:49:18 2017 @@ -21,6 +21,7 @@ import java.util.Locale; import java.util.Objects; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlValue; +import javax.xml.bind.annotation.XmlRootElement; import org.opengis.util.InternationalString; import org.apache.sis.xml.XLink; @@ -36,11 +37,13 @@ import org.apache.sis.xml.XLink; * * @author Guilhem Legal (Geomatys) * @author Martin Desruisseaux (Geomatys) - * @version 0.3 + * @author Cullen Rombach (Image Matters) + * @version 0.8 * @since 0.3 * @module */ @XmlType(name = "Anchor_Type") +@XmlRootElement(name = "Anchor") public final class Anchor extends XLink implements InternationalString { /** * Defined as a matter of principle (this class is not expected to be serialized). Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java?rev=1805567&r1=1805566&r2=1805567&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java [UTF-8] Sun Aug 20 15:49:18 2017 @@ -46,14 +46,14 @@ public final class Utilities extends Sta * * <div class="section">Relationship with {@code gml:id}</div> * This method may be invoked for building {@code gml:id} values. Strictly speaking this is not appropriate - * since the {@code xsd:ID} type defines valid identifiers as containing only letters, digits, underscores, + * since the {@code xs:ID} type defines valid identifiers as containing only letters, digits, underscores, * hyphens, and periods. This differ from Unicode identifier in two ways: * * <ul> * <li>Unicode identifiers accept Japanese or Chinese ideograms for instance, which are considered as letters.</li> * <li>Unicode identifiers do not accept the {@code '-'} and {@code ':'} characters. However this restriction * fits well our need, since those characters are typical values for the {@code separator} argument.</li> - * <li>Note that {@code '_'} is valid both in {@code xsd:ID} and Unicode identifier.</li> + * <li>Note that {@code '_'} is valid both in {@code xs:ID} and Unicode identifier.</li> * </ul> * * @param appendTo the buffer where to append the valid characters. Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Locales.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Locales.java?rev=1805567&r1=1805566&r2=1805567&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Locales.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Locales.java [UTF-8] Sun Aug 20 15:49:18 2017 @@ -46,7 +46,8 @@ import static org.apache.sis.util.collec * } * * @author Martin Desruisseaux (IRD, Geomatys) - * @version 0.4 + * @author Cullen Rombach (Image Matters) + * @version 0.8 * @since 0.3 * @module */ @@ -275,11 +276,11 @@ filter: for (final Locale locale : local return unique(new Locale.Builder().setLanguageTag(code).build()); } /* - * Old syntax (e.g. "en_US"). Split in (language, country, variant) components, + * Old syntax (e.g. "en_US" or "eng; USA"). Split in (language, country, variant) components, * then convert the 3-letters codes to the 2-letters ones. */ String language, country = "", variant = ""; - if (p1 < 0) { + if (p1 < 0 && (p1 = code.indexOf(';', fromIndex)) < 0) { p1 = code.length(); } else { final int s = p1 + 1; Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecord.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecord.java?rev=1805567&r1=1805566&r2=1805567&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecord.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecord.java [UTF-8] Sun Aug 20 15:49:18 2017 @@ -53,7 +53,8 @@ import org.apache.sis.internal.util.Abst * </ul> * * @author Martin Desruisseaux (Geomatys) - * @version 0.5 + * @author Cullen Rombach (Image Matters) + * @version 0.8 * * @see DefaultRecordType * @see DefaultRecordSchema @@ -96,6 +97,59 @@ public class DefaultRecord implements Re } /** + * Creates a new record initialized to a shallow copy of the given record. + * The members contained in the given record are <strong>not</strong> recursively copied. + * + * @param record the record to copy (can not be null). + * + * @since 0.8 + */ + public DefaultRecord(final Record record) { + this(record.getRecordType()); + for (final Map.Entry<MemberName,Integer> entry : definition.memberIndices().entrySet()) { + final MemberName name = entry.getKey(); + final Object value = record.locate(name); + if (value != null) { + final int index = entry.getValue(); + final Class<?> valueClass = definition.getValueClass(index); + if (valueClass != null && !valueClass.isInstance(value)) { + throw new ClassCastException(Errors.format(Errors.Keys.IllegalPropertyValueClass_3, + name, valueClass, value.getClass())); + } + Array.set(values, index, value); + } + } + } + + /** + * Returns a SIS implementation with the name and members of the given arbitrary implementation. + * This method performs the first applicable action in the following choices: + * + * <ul> + * <li>If the given object is {@code null}, then this method returns {@code null}.</li> + * <li>Otherwise if the given object is already an instance of {@code DefaultRecord}, + * then it is returned unchanged.</li> + * <li>Otherwise a new {@code DefaultRecord} instance is created using the + * {@linkplain #DefaultRecord(Record) copy constructor} and returned. + * Note that this is a shallow copy operation, since the members contained + * in the given object are not recursively copied.</li> + * </ul> + * + * @param other The object to get as a SIS implementation, or {@code null} if none. + * @return A SIS implementation containing the members of the given object + * (may be the given object itself), or {@code null} if the argument was {@code null}. + * + * @since 0.8 + */ + public static DefaultRecord castOrCopy(final Record other) { + if (other == null || other instanceof DefaultRecord) { + return (DefaultRecord) other; + } else { + return new DefaultRecord(other); + } + } + + /** * Returns the type definition of this record. * * @return the type definition of this record. Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecordType.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecordType.java?rev=1805567&r1=1805566&r2=1805567&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecordType.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecordType.java [UTF-8] Sun Aug 20 15:49:18 2017 @@ -445,6 +445,7 @@ public class DefaultRecordType extends R /** * Empty constructor only used by JAXB. */ + @SuppressWarnings("unused") private DefaultRecordType() { typeName = null; container = null; Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java?rev=1805567&r1=1805566&r2=1805567&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java [UTF-8] Sun Aug 20 15:49:18 2017 @@ -189,7 +189,7 @@ public final class Namespaces extends St private static final Map<String,String> SPECIFIC_URLS; static { final Map<String,String> p = new HashMap<>(40); - p.put(XMLConstants.W3C_XML_SCHEMA_NS_URI, "xsd"); + p.put(XMLConstants.W3C_XML_SCHEMA_NS_URI, "xsd"); // TODO: should be "xs". p.put(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "xsi"); p.put("http://www.w3.org/2004/02/skos/core#", "skos"); p.put("http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdf"); Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java?rev=1805567&r1=1805566&r2=1805567&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java [UTF-8] Sun Aug 20 15:49:18 2017 @@ -30,7 +30,7 @@ import static org.junit.Assert.*; * Tests the {@link Locales} class. * * @author Martin Desruisseaux (Geomatys) - * @version 0.4 + * @version 0.8 * @since 0.3 * @module */ @@ -82,6 +82,7 @@ public final strictfp class LocalesTest assertSame(Locale.CANADA_FRENCH, Locales.parse("fr_CAN")); assertSame(Locale.CANADA_FRENCH, Locales.parse("fra_CAN")); assertSame(Locale.JAPAN, Locales.parse("ja_JP")); + assertSame(Locale.US, Locales.parse("en; USA")); assertEquals(new Locale("de", "DE"), Locales.parse("de_DE")); assertEquals(new Locale("", "GB"), Locales.parse("_GB")); Modified: sis/trunk/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java?rev=1805567&r1=1805566&r2=1805567&view=diff ============================================================================== --- sis/trunk/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java [UTF-8] (original) +++ sis/trunk/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java [UTF-8] Sun Aug 20 15:49:18 2017 @@ -16,6 +16,7 @@ */ package org.apache.sis.storage.gdal; +import java.util.Arrays; import java.util.Map; import java.util.Set; import java.util.HashMap; @@ -274,7 +275,7 @@ public class Proj4Factory extends Geodet /** * Returns the set of authority codes for objects of the given type. * Current implementation can not return complete Proj.4 definition strings. - * Instead, this method currently returns only fragments (e.g. {@code "+init="}). + * Instead, this method currently returns only fragments (e.g. {@code "+proj=lcc"}). * * @param type the spatial reference objects type. * @return fragments of definition strings for spatial reference objects of the given type. @@ -282,19 +283,21 @@ public class Proj4Factory extends Geodet */ @Override public Set<String> getAuthorityCodes(Class<? extends IdentifiedObject> type) throws FactoryException { - final String method; - if (type.isAssignableFrom(ProjectedCRS.class)) { // Must be tested first. - method = ""; - } else if (type.isAssignableFrom(GeographicCRS.class)) { // Should be tested before GeocentricCRS. - method = "latlon"; - } else if (type.isAssignableFrom(GeocentricCRS.class)) { - method = "geocent"; - } else { - return Collections.emptySet(); + final Set<String> codes = new LinkedHashSet<>(10); + if (type.isAssignableFrom(GeographicCRS.class)) { + codes.add("latlon"); + } + if (type.isAssignableFrom(GeocentricCRS.class)) { + codes.add("geocent"); + } + if (type.isAssignableFrom(ProjectedCRS.class)) { + codes.addAll(Arrays.asList("lcc", "merc", "tmerc", "stere")); // Only a subset of supported projections. + } + final String[] methods = codes.toArray(new String[codes.size()]); + codes.clear(); + for (final String method : methods) { + codes.add(PROJ_PARAM.concat(method)); } - final Set<String> codes = new LinkedHashSet<>(4); - codes.add("+init="); - codes.add(PROJ_PARAM.concat(method)); return codes; } @@ -582,16 +585,22 @@ public class Proj4Factory extends Geodet private CoordinateReferenceSystem createCRS(final PJ pj, final boolean withHeight) throws FactoryException { final PJ.Type type = pj.getType(); final boolean geographic = PJ.Type.GEOGRAPHIC.equals(type); + final boolean geocentric = PJ.Type.GEOCENTRIC.equals(type); final Proj4Parser parser = new Proj4Parser(pj.getCode()); final String dir = parser.value("axis", "enu"); - final CoordinateSystemAxis[] axes = new CoordinateSystemAxis[withHeight ? dir.length() : 2]; + final CoordinateSystemAxis[] axes = new CoordinateSystemAxis[geocentric | withHeight ? dir.length() : 2]; for (int i=0; i<axes.length; i++) { final char d = Character.toLowerCase(dir.charAt(i)); char abbreviation = Character.toUpperCase(d); boolean vertical = false; final AxisDirection c; final String name; - switch (d) { + if (geocentric) switch (d) { + case 'e': c = AxisDirection.GEOCENTRIC_X; name = "Geocentric X"; break; + case 'n': c = AxisDirection.GEOCENTRIC_Y; name = "Geocentric Y"; break; + case 'u': c = AxisDirection.GEOCENTRIC_Z; name = "Geocentric Z"; break; + default: c = AxisDirection.OTHER; name = "Unknown"; break; + } else switch (d) { case 'e': c = AxisDirection.EAST; name = geographic ? "Geodetic longitude" : "Easting"; break; case 'w': c = AxisDirection.WEST; name = geographic ? "Geodetic longitude" : "Westing"; break; case 'n': c = AxisDirection.NORTH; name = geographic ? "Geodetic latitude" : "Northing"; break; Modified: sis/trunk/storage/sis-gdal/src/test/java/org/apache/sis/storage/gdal/Proj4FactoryTest.java URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-gdal/src/test/java/org/apache/sis/storage/gdal/Proj4FactoryTest.java?rev=1805567&r1=1805566&r2=1805567&view=diff ============================================================================== --- sis/trunk/storage/sis-gdal/src/test/java/org/apache/sis/storage/gdal/Proj4FactoryTest.java [UTF-8] (original) +++ sis/trunk/storage/sis-gdal/src/test/java/org/apache/sis/storage/gdal/Proj4FactoryTest.java [UTF-8] Sun Aug 20 15:49:18 2017 @@ -64,8 +64,10 @@ public final strictfp class Proj4Factory @Test public void testGetAuthorityCodes() throws FactoryException { final Proj4Factory factory = Proj4Factory.INSTANCE; - assertTrue(factory.getAuthorityCodes(GeographicCRS.class).containsAll(Arrays.asList("+init=", "+proj=latlon"))); - assertTrue(factory.getAuthorityCodes(CoordinateReferenceSystem.class).containsAll(Arrays.asList("+init=", "+proj="))); + assertTrue(factory.getAuthorityCodes(GeographicCRS.class).containsAll(Arrays.asList("+proj=latlon"))); + assertTrue(factory.getAuthorityCodes(ProjectedCRS.class).containsAll(Arrays.asList("+proj=merc", "+proj=lcc"))); + assertTrue(factory.getAuthorityCodes(CoordinateReferenceSystem.class).containsAll( + Arrays.asList("+proj=latlon", "+proj=merc", "+proj=lcc"))); } /** Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java?rev=1805567&r1=1805566&r2=1805567&view=diff ============================================================================== --- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java [UTF-8] (original) +++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java [UTF-8] Sun Aug 20 15:49:18 2017 @@ -108,12 +108,24 @@ public final class Store extends DataSto static final char ORDINATE_SEPARATOR = ' '; /** - * The prefix for elements in the {@code @columns} line that specify the data type. + * The prefix for elements in the {@code @columns} line that specify the data type, + * as required by the OGC CSV encoding specification. * Examples: {@code xsd:boolean}, {@code xsd:decimal}, {@code xsd:integer}, <i>etc</i>. + * + * <p>Note that this prefix is slightly different than the {@code "xs:"} prefix used + * in {@code https://www.w3.org/2009/XMLSchema/XMLSchema.xsd} file. This data store + * implementation accepts both.</p> */ private static final String TYPE_PREFIX = "xsd:"; /** + * The prefix used in {@code https://www.w3.org/2009/XMLSchema/XMLSchema.xsd} file. + * This is not the same prefix than the one specified by OGC CSV encoding, but this + * implementation accepts both. + */ + private static final String XS_PREFIX = "xs:"; + + /** * The reader, set by the constructor and cleared when no longer needed. * * @see #readLine() @@ -470,8 +482,11 @@ public final class Store extends DataSto Class<?> type = null; if (++i < size) { String tn = elements.get(i); - if (!tn.isEmpty() && tn.regionMatches(true, 0, TYPE_PREFIX, 0, TYPE_PREFIX.length())) { - String st = tn.substring(TYPE_PREFIX.length()).toLowerCase(Locale.US); + int length; + if (tn.regionMatches(true, 0, TYPE_PREFIX, 0, length = TYPE_PREFIX.length()) || + tn.regionMatches(true, 0, XS_PREFIX, 0, length = XS_PREFIX.length())) + { + String st = tn.substring(length).toLowerCase(Locale.US); switch (st) { case "boolean": type = Boolean.class; break; case "decimal": type = Double .class; break; Modified: sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java?rev=1805567&r1=1805566&r2=1805567&view=diff ============================================================================== --- sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java [UTF-8] (original) +++ sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java [UTF-8] Sun Aug 20 15:49:18 2017 @@ -155,31 +155,31 @@ final class Types { parent = builder.build(); /* * WayPoint ⇾ GPXEntity - * ┌──────────────────┬────────────────┬────────────────────────┬─────────────┐ - * │ Name │ Type │ XML type │ Cardinality │ - * ├──────────────────┼────────────────┼────────────────────────┼─────────────┤ - * │ sis:identifier │ Integer │ │ [1 … 1] │ - * │ sis:envelope │ Envelope │ │ [1 … 1] │ - * │ sis:geometry │ Point │ (lat,lon) attributes │ [1 … 1] │ - * │ ele │ Double │ xsd:decimal │ [0 … 1] │ - * │ time │ Temporal │ xsd:dateTime │ [0 … 1] │ - * │ magvar │ Double │ gpx:degreesType │ [0 … 1] │ - * │ geoidheight │ Double │ xsd:decimal │ [0 … 1] │ - * │ name │ String │ xsd:string │ [0 … 1] │ - * │ cmt │ String │ xsd:string │ [0 … 1] │ - * │ desc │ String │ xsd:string │ [0 … 1] │ - * │ src │ String │ xsd:string │ [0 … 1] │ - * │ link │ OnlineResource │ gpx:linkType │ [0 … ∞] │ - * │ sym │ String │ xsd:string │ [0 … 1] │ - * │ type │ String │ xsd:string │ [0 … 1] │ - * │ fix │ Fix │ gpx:fixType │ [0 … 1] │ - * │ sat │ Integer │ xsd:nonNegativeInteger │ [0 … 1] │ - * │ hdop │ Double │ xsd:decimal │ [0 … 1] │ - * │ vdop │ Double │ xsd:decimal │ [0 … 1] │ - * │ pdop │ Double │ xsd:decimal │ [0 … 1] │ - * │ ageofdgpsdata │ Double │ xsd:decimal │ [0 … 1] │ - * │ dgpsid │ Integer │ gpx:dgpsStationType │ [0 … 1] │ - * └──────────────────┴────────────────┴────────────────────────┴─────────────┘ + * ┌──────────────────┬────────────────┬───────────────────────┬─────────────┐ + * │ Name │ Type │ XML type │ Cardinality │ + * ├──────────────────┼────────────────┼───────────────────────┼─────────────┤ + * │ sis:identifier │ Integer │ │ [1 … 1] │ + * │ sis:envelope │ Envelope │ │ [1 … 1] │ + * │ sis:geometry │ Point │ (lat,lon) attributes │ [1 … 1] │ + * │ ele │ Double │ xs:decimal │ [0 … 1] │ + * │ time │ Temporal │ xs:dateTime │ [0 … 1] │ + * │ magvar │ Double │ gpx:degreesType │ [0 … 1] │ + * │ geoidheight │ Double │ xs:decimal │ [0 … 1] │ + * │ name │ String │ xs:string │ [0 … 1] │ + * │ cmt │ String │ xs:string │ [0 … 1] │ + * │ desc │ String │ xs:string │ [0 … 1] │ + * │ src │ String │ xs:string │ [0 … 1] │ + * │ link │ OnlineResource │ gpx:linkType │ [0 … ∞] │ + * │ sym │ String │ xs:string │ [0 … 1] │ + * │ type │ String │ xs:string │ [0 … 1] │ + * │ fix │ Fix │ gpx:fixType │ [0 … 1] │ + * │ sat │ Integer │ xs:nonNegativeInteger │ [0 … 1] │ + * │ hdop │ Double │ xs:decimal │ [0 … 1] │ + * │ vdop │ Double │ xs:decimal │ [0 … 1] │ + * │ pdop │ Double │ xs:decimal │ [0 … 1] │ + * │ ageofdgpsdata │ Double │ xs:decimal │ [0 … 1] │ + * │ dgpsid │ Integer │ gpx:dgpsStationType │ [0 … 1] │ + * └──────────────────┴────────────────┴───────────────────────┴─────────────┘ */ builder.clear().setSuperTypes(parent).setNameSpace(Tags.PREFIX).setName("WayPoint"); builder.addAttribute(GeometryType.POINT).setName(geomName) @@ -207,21 +207,21 @@ final class Types { wayPoint = create(builder, resources); /* * Route ⇾ GPXEntity - * ┌────────────────┬────────────────┬────────────────────────┬─────────────┐ - * │ Name │ Type │ XML type │ Cardinality │ - * ├────────────────┼────────────────┼────────────────────────┼─────────────┤ - * │ sis:identifier │ Integer │ │ [1 … 1] │ - * │ sis:envelope │ Envelope │ │ [1 … 1] │ - * │ sis:geometry │ Polyline │ │ [1 … 1] │ - * │ name │ String │ xsd:string │ [0 … 1] │ - * │ cmt │ String │ xsd:string │ [0 … 1] │ - * │ desc │ String │ xsd:string │ [0 … 1] │ - * │ src │ String │ xsd:string │ [0 … 1] │ - * │ link │ OnlineResource │ gpx:linkType │ [0 … ∞] │ - * │ number │ Integer │ xsd:nonNegativeInteger │ [0 … 1] │ - * │ type │ String │ xsd:string │ [0 … 1] │ - * │ rtept │ WayPoint │ gpx:wptType │ [0 … ∞] │ - * └────────────────┴────────────────┴────────────────────────┴─────────────┘ + * ┌────────────────┬────────────────┬───────────────────────┬─────────────┐ + * │ Name │ Type │ XML type │ Cardinality │ + * ├────────────────┼────────────────┼───────────────────────┼─────────────┤ + * │ sis:identifier │ Integer │ │ [1 … 1] │ + * │ sis:envelope │ Envelope │ │ [1 … 1] │ + * │ sis:geometry │ Polyline │ │ [1 … 1] │ + * │ name │ String │ xs:string │ [0 … 1] │ + * │ cmt │ String │ xs:string │ [0 … 1] │ + * │ desc │ String │ xs:string │ [0 … 1] │ + * │ src │ String │ xs:string │ [0 … 1] │ + * │ link │ OnlineResource │ gpx:linkType │ [0 … ∞] │ + * │ number │ Integer │ xs:nonNegativeInteger │ [0 … 1] │ + * │ type │ String │ xs:string │ [0 … 1] │ + * │ rtept │ WayPoint │ gpx:wptType │ [0 … ∞] │ + * └────────────────┴────────────────┴───────────────────────┴─────────────┘ */ final DefaultAttributeType<?> groupResult = GroupAsPolylineOperation.getResult(geometries); GroupAsPolylineOperation groupOp = new GroupAsPolylineOperation(geomInfo, Tags.ROUTE_POINTS, groupResult); @@ -258,21 +258,21 @@ final class Types { trackSegment = create(builder, resources); /* * Track ⇾ GPXEntity - * ┌────────────────┬────────────────┬────────────────────────┬─────────────┐ - * │ Name │ Type │ XML type │ Cardinality │ - * ├────────────────┼────────────────┼────────────────────────┼─────────────┤ - * │ sis:identifier │ Integer │ │ [1 … 1] │ - * │ sis:envelope │ Envelope │ │ [1 … 1] │ - * │ sis:geometry │ Polyline │ │ [1 … 1] │ - * │ name │ String │ xsd:string │ [0 … 1] │ - * │ cmt │ String │ xsd:string │ [0 … 1] │ - * │ desc │ String │ xsd:string │ [0 … 1] │ - * │ src │ String │ xsd:string │ [0 … 1] │ - * │ link │ OnlineResource │ gpx:linkType │ [0 … ∞] │ - * │ number │ Integer │ xsd:nonNegativeInteger │ [0 … 1] │ - * │ type │ String │ xsd:string │ [0 … 1] │ - * │ trkseg │ TrackSegment │ gpx:trksegType │ [0 … ∞] │ - * └────────────────┴────────────────┴────────────────────────┴─────────────┘ + * ┌────────────────┬────────────────┬───────────────────────┬─────────────┐ + * │ Name │ Type │ XML type │ Cardinality │ + * ├────────────────┼────────────────┼───────────────────────┼─────────────┤ + * │ sis:identifier │ Integer │ │ [1 … 1] │ + * │ sis:envelope │ Envelope │ │ [1 … 1] │ + * │ sis:geometry │ Polyline │ │ [1 … 1] │ + * │ name │ String │ xs:string │ [0 … 1] │ + * │ cmt │ String │ xs:string │ [0 … 1] │ + * │ desc │ String │ xs:string │ [0 … 1] │ + * │ src │ String │ xs:string │ [0 … 1] │ + * │ link │ OnlineResource │ gpx:linkType │ [0 … ∞] │ + * │ number │ Integer │ xs:nonNegativeInteger │ [0 … 1] │ + * │ type │ String │ xs:string │ [0 … 1] │ + * │ trkseg │ TrackSegment │ gpx:trksegType │ [0 … ∞] │ + * └────────────────┴────────────────┴───────────────────────┴─────────────┘ */ groupOp = new GroupAsPolylineOperation(geomInfo, Tags.TRACK_SEGMENTS, groupResult); builder.clear().setSuperTypes(parent).setNameSpace(Tags.PREFIX).setName("Track");