From commits-return-6470-apmail-sis-commits-archive=sis.apache.org@sis.apache.org Thu Oct 8 20:16:30 2015 Return-Path: X-Original-To: apmail-sis-commits-archive@www.apache.org Delivered-To: apmail-sis-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D57E1184BC for ; Thu, 8 Oct 2015 20:16:30 +0000 (UTC) Received: (qmail 87629 invoked by uid 500); 8 Oct 2015 20:16:24 -0000 Delivered-To: apmail-sis-commits-archive@sis.apache.org Received: (qmail 87599 invoked by uid 500); 8 Oct 2015 20:16:24 -0000 Mailing-List: contact commits-help@sis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: sis-dev@sis.apache.org Delivered-To: mailing list commits@sis.apache.org Received: (qmail 87590 invoked by uid 99); 8 Oct 2015 20:16:24 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Oct 2015 20:16:24 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 1F601180DE7 for ; Thu, 8 Oct 2015 20:16:24 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.79 X-Spam-Level: * X-Spam-Status: No, score=1.79 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id o_JABY7n96i5 for ; Thu, 8 Oct 2015 20:16:22 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTP id EB8E120F7B for ; Thu, 8 Oct 2015 20:16:21 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 63EC9E0256 for ; Thu, 8 Oct 2015 20:16:21 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id C16A43A03C8 for ; Thu, 8 Oct 2015 20:16:20 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r1707616 - in /sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis: util/resources/Errors.java util/resources/Errors.properties util/resources/Errors_fr.properties xml/IdentifierSpace.java xml/ReferenceResolver.java Date: Thu, 08 Oct 2015 20:16:20 -0000 To: commits@sis.apache.org From: desruisseaux@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20151008201620.C16A43A03C8@svn01-us-west.apache.org> Author: desruisseaux Date: Thu Oct 8 20:16:20 2015 New Revision: 1707616 URL: http://svn.apache.org/viewvc?rev=1707616&view=rev Log: Emit a warning of no object is found for a xlink:href. Add some documentation. Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/xml/IdentifierSpace.java sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1707616&r1=1707615&r2=1707616&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] Thu Oct 8 20:16:20 2015 @@ -746,6 +746,11 @@ public final class Errors extends Indexe public static final short NonUniformScale = 88; /** + * No element for the “{0}” identifier, or the identifier is a forward reference. + */ + public static final short NotABackwardReference_1 = 199; + + /** * Argument ‘{0}’ shall not be NaN (Not-a-Number). */ public static final short NotANumber_1 = 89; @@ -916,6 +921,11 @@ public final class Errors extends Indexe public static final short UnexpectedParameter_1 = 152; /** + * Expected “{0}” to reference an instance of ‘{1}’, but found an instance of ‘{2}’. + */ + public static final short UnexpectedTypeForReference_3 = 200; + + /** * Unexpected value “{1}” in “{0}” element. */ public static final short UnexpectedValueInElement_2 = 191; Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1707616&r1=1707615&r2=1707616&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] (original) +++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] Thu Oct 8 20:16:20 2015 @@ -155,6 +155,7 @@ NonPerpendicularDirections_2 = Axis NonScaleUnit_1 = \u201c{0}\u201d is not a scale unit. NonTemporalUnit_1 = \u201c{0}\u201d is not a time unit. NonUniformScale = Scale is not uniform. +NotABackwardReference_1 = No element for the \u201c{0}\u201d identifier, or the identifier is a forward reference. NotAnAffineTransform = Transform is not affine. NotANumber_1 = Argument \u2018{0}\u2019 shall not be NaN (Not-a-Number). NotAPrimitiveWrapper_1 = Class \u2018{0}\u2019 is not a primitive type wrapper. @@ -194,6 +195,7 @@ UnexpectedEndOfFile_1 = Unex UnexpectedEndOfString_1 = More characters were expected at the end of \u201c{0}\u201d. UnexpectedFileFormat_2 = File \u201c{1}\u201d seems to be encoded in an other format than {0}. UnexpectedParameter_1 = Parameter \u201c{0}\u201d was not expected. +UnexpectedTypeForReference_3 = Expected \u201c{0}\u201d to reference an instance of \u2018{1}\u2019, but found an instance of \u2018{2}\u2019. UnexpectedValueInElement_2 = Unexpected value \u201c{1}\u201d in \u201c{0}\u201d element. UnitlessParameter_1 = Parameter \u201c{0}\u201d has no unit. UnknownAuthority_1 = Authority \u201c{0}\u201d is unknown. Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1707616&r1=1707615&r2=1707616&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] (original) +++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] Thu Oct 8 20:16:20 2015 @@ -152,6 +152,7 @@ NonPerpendicularDirections_2 = Les NonScaleUnit_1 = \u00ab\u202f{0}\u202f\u00bb n\u2019est pas une unit\u00e9 d\u2019\u00e9chelles. NonTemporalUnit_1 = \u00ab\u202f{0}\u202f\u00bb n\u2019est pas une unit\u00e9 de temps. NonUniformScale = L\u2019\u00e9chelle n\u2019est pas uniforme. +NotABackwardReference_1 = Il n\u2019y a pas d\u2019\u00e9l\u00e9ment pour l\u2019identifiant \u201c{0}\u201d, ou l\u2019identifiant est une r\u00e9f\u00e9rence vers l\u2019avant. NotAnAffineTransform = La transformation n\u2019est pas affine. NotANumber_1 = L\u2019argument \u2018{0}\u2019 ne doit pas \u00eatre NaN (Not-a-Number). NotAPrimitiveWrapper_1 = La classe \u2018{0}\u2019 n\u2019est pas un adaptateur d\u2019un type primitif. @@ -190,6 +191,7 @@ UnexpectedEndOfFile_1 = Fin UnexpectedEndOfString_1 = D\u2019autres caract\u00e8res \u00e9taient attendus \u00e0 la fin du texte \u00ab\u202f{0}\u202f\u00bb. UnexpectedFileFormat_2 = Le fichier \u00ab\u202f{1}\u202f\u00bb semble \u00eatre encod\u00e9 dans un autre format que {0}. UnexpectedParameter_1 = Le param\u00e8tre \u00ab\u202f{0}\u202f\u00bb est inattendu. +UnexpectedTypeForReference_3 = L\u2019identifiant \u201c{0}\u201d r\u00e9f\u00e9rence une instance de \u2018{2}\u2019 alors qu\u2019on attendait une instance de \u2018{1}\u2019. UnexpectedValueInElement_2 = La valeur \u00ab\u202f{1}\u202f\u00bb dans l\u2019\u00e9l\u00e9ment \u00ab\u202f{0}\u202f\u00bb est inattendue. UnitlessParameter_1 = Le param\u00e8tre \u00ab\u202f{0}\u202f\u00bb n\u2019a pas d\u2019unit\u00e9. UnknownAuthority_1 = L\u2019autorit\u00e9 \u00ab\u202f{0}\u202f\u00bb n\u2019est pas reconnue. Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/xml/IdentifierSpace.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/xml/IdentifierSpace.java?rev=1707616&r1=1707615&r2=1707616&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/xml/IdentifierSpace.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/xml/IdentifierSpace.java [UTF-8] Thu Oct 8 20:16:20 2015 @@ -63,7 +63,10 @@ public interface IdentifierSpace exte * for {@code "gco:id"} in metadata documents. However the {@code "gco:"} prefix is omitted * in XML documents (i.e. the {@code gco:id} attribute is unqualified).

* - *

The XML attribute name of the reference to such identified object is {@code "xlink:href"}.

+ *

Elements with {@code gml:id} or {@code gco:id} attribute can be referenced from other XML elements + * using the {@code xlink:href} attribute. This is done automatically by Apache SIS implementations at + * marshalling and unmarshalling time. If many of {@code gml:id}, {@code gco:uuid} and {@code xlink:href} + * attributes are used, then {@code gml:id} has precedence.

* * @see javax.xml.bind.annotation.XmlID */ @@ -78,7 +81,9 @@ public interface IdentifierSpace exte * {@code "gco:"} prefix is omitted in XML documents (i.e. the {@code gco:uuid} attribute * is unqualified).

* - *

The XML attribute name of the reference to such identified object is {@code "gco:uuidref"}. + *

Elements with {@code gco:uuid} attribute can be referenced from other XML elements using the + * {@code gco:uuidref} attribute. However this is not done automatically by Apache SIS. Users need + * to manage their set of UUIDs in their own {@link ReferenceResolver} subclass.

* * @see UUID */ Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java?rev=1707616&r1=1707615&r2=1707616&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java [UTF-8] Thu Oct 8 20:16:20 2015 @@ -129,9 +129,22 @@ public class ReferenceResolver { ensureNonNull("xlink", link); final URI href = link.getHRef(); if (href != null && href.toString().startsWith("#")) { - final Object object = Context.getObjectForID(Context.current(), href.getFragment()); + final String id = href.getFragment(); + final Context c = (context instanceof Context) ? (Context) context : Context.current(); + final Object object = Context.getObjectForID(c, id); if (type.isInstance(object)) { return type.cast(object); + } else { + final short key; + final Object args; + if (object == null) { + key = Errors.Keys.NotABackwardReference_1; + args = id; + } else { + key = Errors.Keys.UnexpectedTypeForReference_3; + args = new Object[] {id, type, object.getClass()}; + } + Context.warningOccured(c, ReferenceResolver.class, "resolve", Errors.class, key, args); } } return null;