sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tlpin...@apache.org
Subject svn commit: r1517321 [14/16] - in /sis/branches/Shapefile: ./ application/ application/sis-console/ application/sis-console/src/main/artifact/ application/sis-console/src/main/java/org/apache/sis/console/ application/sis-console/src/main/resources/org/...
Date Sun, 25 Aug 2013 15:49:59 GMT
Modified: sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/xml/PooledUnmarshaller.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/xml/PooledUnmarshaller.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/xml/PooledUnmarshaller.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/xml/PooledUnmarshaller.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -63,20 +63,21 @@ final class PooledUnmarshaller extends P
 
     /**
      * Creates a pooled unmarshaller wrapping the given one.
+     * Callers shall invoke {@link #reset(Pooled)} after construction for completing the initialization.
      *
-     * @param unmarshaller The unmarshaller to use for the actual work.
-     * @param internal {@code true} if the JAXB implementation is the one bundled in JDK 6,
-     *        or {@code false} if this is the external implementation provided as a JAR file
-     *        in the endorsed directory.
+     * @param  unmarshaller The unmarshaller to use for the actual work.
+     * @param  template The {@link PooledTemplate} from which to get the initial values.
+     * @throws JAXBException If an error occurred while setting a property.
      */
-    PooledUnmarshaller(final Unmarshaller unmarshaller, final boolean internal) {
-        super(internal);
+    PooledUnmarshaller(final Unmarshaller unmarshaller, final Pooled template) throws JAXBException {
+        super(template);
         this.unmarshaller = unmarshaller;
+        initialize(template);
     }
 
     /**
      * Resets the given unmarshaller property to its initial state.
-     * This method is invoked automatically by {@link #reset()}.
+     * This method is invoked automatically by {@link #reset(Pooled)}.
      *
      * @param  key   The property to reset.
      * @param  value The saved initial value to give to the property.
@@ -299,7 +300,7 @@ final class PooledUnmarshaller extends P
 
     /**
      * Delegates to the wrapped unmarshaller. The initial state will be saved
-     * if it was not already done, for future restoration by {@link #reset()}.
+     * if it was not already done, for future restoration by {@link #reset(Pooled)}.
      */
     @Override
     @SuppressWarnings("rawtypes")
@@ -319,7 +320,7 @@ final class PooledUnmarshaller extends P
 
     /**
      * Delegates to the wrapped unmarshaller. The initial state will be saved
-     * if it was not already done, for future restoration by {@link #reset()}.
+     * if it was not already done, for future restoration by {@link #reset(Pooled)}.
      *
      * @deprecated Replaced by {@link #setSchema(javax.xml.validation.Schema)} in JAXB 2.0.
      */
@@ -345,7 +346,7 @@ final class PooledUnmarshaller extends P
 
     /**
      * Delegates to the wrapped unmarshaller. The initial state will be saved
-     * if it was not already done, for future restoration by {@link #reset()}.
+     * if it was not already done, for future restoration by {@link #reset(Pooled)}.
      */
     @Override
     public void setSchema(final Schema schema) {
@@ -363,7 +364,7 @@ final class PooledUnmarshaller extends P
 
     /**
      * Delegates to the wrapped unmarshaller. The initial state will be saved
-     * if it was not already done, for future restoration by {@link #reset()}.
+     * if it was not already done, for future restoration by {@link #reset(Pooled)}.
      */
     @Override
     public void setEventHandler(final ValidationEventHandler handler) throws JAXBException {
@@ -381,7 +382,7 @@ final class PooledUnmarshaller extends P
 
     /**
      * Delegates to the wrapped unmarshaller. The initial state will be saved
-     * if it was not already done, for future restoration by {@link #reset()}.
+     * if it was not already done, for future restoration by {@link #reset(Pooled)}.
      */
     @Override
     public void setAttachmentUnmarshaller(final AttachmentUnmarshaller au) {
@@ -401,7 +402,7 @@ final class PooledUnmarshaller extends P
 
     /**
      * Delegates to the wrapped marshaller. The initial state will be saved
-     * if it was not already done, for future restoration by {@link #reset()}.
+     * if it was not already done, for future restoration by {@link #reset(Pooled)}.
      */
     @Override
     public void setListener(final Listener listener) {

Modified: sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -130,9 +130,9 @@ public class ReferenceResolver {
      * SIS can not know if the metadata shall be fully marshalled or not.
      * Such information needs to be provided by the application.
      *
-     * <p>The default implementation conservatively returns {@code false} in every cases.
-     * Subclasses can override this method if they know whether the receiver will be able
-     * to resolve such references.</p>
+     * <p>The default implementation conservatively returns {@code false} in every cases except for instances of
+     * {@link NilObject}, since the later exist only for carrying the {@code gco} and {@code xlink} attributes.
+     * Subclasses can override this method if they know whether the receiver will be able to resolve the reference.</p>
      *
      * @param  <T>     The compile-time type of the {@code type} argument.
      * @param  context Context (GML version, locale, <i>etc.</i>) of the (un)marshalling process.
@@ -144,7 +144,7 @@ public class ReferenceResolver {
      *         instead than marshalling the given metadata.
      */
     public <T> boolean canSubstituteByReference(final MarshalContext context, final Class<T> type, final T object, final UUID uuid) {
-        return false;
+        return (object instanceof NilObject);
     }
 
     /**
@@ -154,9 +154,9 @@ public class ReferenceResolver {
      * SIS can not know if the metadata shall be fully marshalled or not.
      * Such information needs to be provided by the application.
      *
-     * <p>The default implementation conservatively returns {@code false} in every cases.
-     * Subclasses can override this method if they know whether the receiver will be able
-     * to resolve such references.</p>
+     * <p>The default implementation conservatively returns {@code false} in every cases except for instances of
+     * {@link NilObject}, since the later exist only for carrying the {@code gco} and {@code xlink} attributes.
+     * Subclasses can override this method if they know whether the receiver will be able to resolve the reference.</p>
      *
      * @param  <T>     The compile-time type of the {@code type} argument.
      * @param  context Context (GML version, locale, <i>etc.</i>) of the (un)marshalling process.
@@ -168,7 +168,7 @@ public class ReferenceResolver {
      *         instead than marshalling the given metadata.
      */
     public <T> boolean canSubstituteByReference(final MarshalContext context, final Class<T> type, final T object, final XLink link) {
-        return false;
+        return (object instanceof NilObject);
     }
 
     /**
@@ -181,30 +181,28 @@ public class ReferenceResolver {
      *   <th>As {@code <gco:CharacterString>}</th>
      *   <th>As {@code <gmx:Anchor>}</th>
      * </tr><tr>
-     * <td>{@preformat xml
-     *   <gmd:country>
-     *     <gco:CharacterString>France</gco:CharacterString>
-     *   </gmd:country>
-     * }</td>
-     * <td>{@preformat xml
-     *   <gmd:country>
-     *     <gmx:Anchor xlink:href="SDN:C320:2:FR">France</gmx:Anchor>
-     *   </gmd:country>
-     * }</td>
-     * </tr>
+     * <td>
+     *   <pre> &lt;gmd:country&gt;
+     *     &lt;gco:CharacterString&gt;France&lt;/gco:CharacterString&gt;
+     * &lt;/gmd:country&gt;</pre>
+     * </td><td>
+     *   <pre> &lt;gmd:country&gt;
+     *     &lt;gmx:Anchor xlink:href="SDN:C320:2:FR"&gt;France&lt;/gmx:Anchor&gt;
+     * &lt;/gmd:country&gt;</pre>
+     * </td></tr>
      * </table>
      *
      * Subclasses can override this method if they can provide a mapping from some text
      * values to anchors.
      *
      * @param  context Context (GML version, locale, <i>etc.</i>) of the (un)marshalling process.
-     * @param  object  The object for which an anchor is requested. Often same than {@code text},
-     *                 but can also be the {@link java.net.URI} or {@link java.util.Locale} instance
-     *                 for which {@code text} is a string representation.
-     * @param  text    The textual representation of the object for which to get the anchor.
+     * @param  value   The value for which an anchor is requested. Often the same instance than {@code text},
+     *                 but can also be the {@link java.net.URI} or {@link java.util.Locale} instance for which
+     *                 {@code text} is a string representation.
+     * @param  text    The textual representation of the value for which to get the anchor.
      * @return The anchor for the given text, or {@code null} if none.
      */
-    public XLink anchor(final MarshalContext context, final Object object, final CharSequence text) {
+    public XLink anchor(final MarshalContext context, final Object value, final CharSequence text) {
         return (text instanceof Anchor) ? (Anchor) text : null;
     }
 }

Modified: sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -16,7 +16,11 @@
  */
 package org.apache.sis.xml;
 
+import java.util.Map;
 import java.util.Locale;
+import java.util.TimeZone;
+import java.util.logging.LogRecord; // For javadoc
+import java.net.URL;
 import java.io.File;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -25,31 +29,40 @@ import java.io.StringWriter;
 import javax.xml.bind.Marshaller;
 import javax.xml.bind.Unmarshaller;
 import javax.xml.bind.JAXBException;
+import javax.xml.transform.Source;
+import javax.xml.transform.Result;
 import org.apache.sis.util.Static;
+import org.apache.sis.util.Version;
+import org.apache.sis.util.logging.WarningListener;
 import org.apache.sis.internal.system.Modules;
 import org.apache.sis.internal.system.SystemListener;
 import org.apache.sis.internal.jaxb.TypeRegistration;
 
+import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
+
 
 /**
  * Provides convenience methods for marshalling and unmarshalling SIS objects.
  * This class defines also some property keys that can be given to the {@link Marshaller}
  * and {@link Unmarshaller} instances created by {@link PooledMarshaller}:
  *
- * <ul>
- *   <li>{@link #LOCALE} for specifying the locale to use for international strings and code lists.</li>
- *   <li>{@link #TIMEZONE} for specifying the timezone to use for dates and times.</li>
- *   <li>{@link #SCHEMAS} for specifying the root URL of metadata schemas to use.</li>
- *   <li>{@link #DEFAULT_NAMESPACE} for specifying the default namespace of the XML document to write.</li>
- *   <li>{@link #RESOLVER} for replacing {@code xlink} or {@code uuidref} attributes by the actual object to use.</li>
- *   <li>{@link #CONVERTER} for controlling the conversion of URL, UUID, Units or similar objects.</li>
- *   <li>{@link #STRING_SUBSTITUTES} for specifying which code lists to replace by simpler {@code <gco:CharacterString>} elements.</li>
- * </ul>
+ * <table class="sis">
+ *   <tr><th>Key</th>                         <th>Value type</th>                <th>Purpose</th></tr>
+ *   <tr><td>{@link #LOCALE}</td>             <td>{@link Locale}</td>            <td>for specifying the locale to use for international strings and code lists.</td></tr>
+ *   <tr><td>{@link #TIMEZONE}</td>           <td>{@link TimeZone}</td>          <td>for specifying the timezone to use for dates and times.</td></tr>
+ *   <tr><td>{@link #SCHEMAS}</td>            <td>{@link Map}</td>               <td>for specifying the root URL of metadata schemas to use.</td></tr>
+ *   <tr><td>{@link #DEFAULT_NAMESPACE}</td>  <td>{@link String}</td>            <td>for specifying the default namespace of the XML document to write.</td></tr>
+ *   <tr><td>{@link #GML_VERSION}</td>        <td>{@link Version}</td>           <td>for specifying the GML version to the document be (un)marshalled.</td></tr>
+ *   <tr><td>{@link #RESOLVER}</td>           <td>{@link ReferenceResolver}</td> <td>for replacing {@code xlink} or {@code uuidref} attributes by the actual object to use.</td></tr>
+ *   <tr><td>{@link #CONVERTER}</td>          <td>{@link ValueConverter}</td>    <td>for controlling the conversion of URL, UUID, Units or similar objects.</td></tr>
+ *   <tr><td>{@link #STRING_SUBSTITUTES}</td> <td>{@code String[]}</td>          <td>for specifying which code lists to replace by simpler {@code <gco:CharacterString>} elements.</td></tr>
+ *   <tr><td>{@link #WARNING_LISTENER}</td>   <td>{@link WarningListener}</td>   <td>for being notified about non-fatal warnings.</td></tr>
+ * </table>
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-3.00)
- * @version 0.3
+ * @version 0.4
  * @module
  */
 public final class XML extends Static {
@@ -88,13 +101,13 @@ public final class XML extends Static {
      *
      * {@section Default behavior}
      * If this property is never set, then (un)marshalling will use the
-     * {@linkplain java.util.TimeZone#getDefault() default timezone}.
+     * {@linkplain TimeZone#getDefault() default timezone}.
      */
     public static final String TIMEZONE = "org.apache.sis.xml.timezone";
 
     /**
      * Specifies the root URL of schemas. The value for this property shall
-     * be an instance of {@link java.util.Map Map&lt;String,String&gt;}.
+     * be an instance of {@link Map Map&lt;String,String&gt;}.
      * This property controls the URL to be used when marshalling the following elements:
      *
      * <ul>
@@ -133,12 +146,13 @@ public final class XML extends Static {
     public static final String DEFAULT_NAMESPACE = "org.apache.sis.xml.defaultNamespace";
 
     /**
-     * Specifies the GML version to be marshalled or unmarshalled. The GML version may affect the
-     * set of XML elements to be marshalled. Newer versions typically have more elements, but not
-     * always. For example in {@code gml:VerticalDatum}, the {@code gml:verticalDatumType} property
+     * Specifies the GML version of the document to be marshalled or unmarshalled.
+     * The GML version may affect the set of XML elements to be marshalled.
+     * Newer versions typically have more elements, but not always.
+     * For example in {@code gml:VerticalDatum}, the {@code gml:verticalDatumType} property
      * presents in GML 3.0 and 3.1 has been removed in GML 3.2.
      *
-     * <p>The value can be {@link String} or {@link org.apache.sis.util.Version} objects.
+     * <p>The value can be {@link String} or {@link Version} objects.
      * If no version is specified, then the most recent GML version is assumed.</p>
      */
     public static final String GML_VERSION = "org.apache.sis.gml.version";
@@ -219,9 +233,15 @@ public final class XML extends Static {
     public static final String CONVERTER = "org.apache.sis.xml.converter";
 
     /**
-     * Allows marshallers to substitute some code lists by the simpler {@code <gco:CharacterString>}
-     * element. The value for this property shall be a coma-separated list of any of the following
-     * values: "{@code language}", "{@code country}".
+     * Allows marshallers to substitute some code lists by the simpler {@code <gco:CharacterString>} element.
+     * The value for this property shall be a {@code String[]} array of any of the following values:
+     *
+     * <ul>
+     *   <li>"{@code language}" for substituting {@code <gmd:LanguageCode>} elements</li>
+     *   <li>"{@code country}"  for substituting {@code <gmd:Country>} elements</li>
+     *   <li>"{@code filename}" for substituting {@code <gmx:FileName>} elements</li>
+     *   <li>"{@code mimetype}" for substituting {@code <gmx:MimeFileType>} elements</li>
+     * </ul>
      *
      * {@section Example}
      * INSPIRE compliant language code shall be formatted like below (formatting may vary):
@@ -247,6 +267,18 @@ public final class XML extends Static {
     public static final String STRING_SUBSTITUTES = "org.apache.sis.xml.stringSubstitutes";
 
     /**
+     * Specifies a listener to be notified when a non-fatal error occurred during the (un)marshalling.
+     * The value for this property shall be an instance of {@code WarningListener<Object>}.
+     *
+     * <p>By default, warnings that occur during the (un)marshalling process are logged. However if a
+     * property is set for this key, then the {@link WarningListener#warningOccured(Object, LogRecord)}
+     * method will be invoked and the warning will <em>not</em> be logged by the (un)marshaller.</p>
+     *
+     * @see WarningListener
+     */
+    public static final String WARNING_LISTENER = "org.apache.sis.xml.warningListener";
+
+    /**
      * The pool of marshallers and unmarshallers used by this class.
      * The field name uses the uppercase convention because this field is almost constant:
      * this field is initially null, then created by {@link #getPool()} when first needed.
@@ -306,6 +338,7 @@ public final class XML extends Static {
      * @throws JAXBException If an error occurred during the marshalling.
      */
     public static String marshal(final Object object) throws JAXBException {
+        ensureNonNull("object", object);
         final StringWriter output = new StringWriter();
         final MarshallerPool pool = getPool();
         final Marshaller marshaller = pool.acquireMarshaller();
@@ -322,6 +355,8 @@ public final class XML extends Static {
      * @throws JAXBException If an error occurred during the marshalling.
      */
     public static void marshal(final Object object, final OutputStream output) throws JAXBException {
+        ensureNonNull("object", object);
+        ensureNonNull("output", output);
         final MarshallerPool pool = getPool();
         final Marshaller marshaller = pool.acquireMarshaller();
         marshaller.marshal(object, output);
@@ -336,8 +371,40 @@ public final class XML extends Static {
      * @throws JAXBException If an error occurred during the marshalling.
      */
     public static void marshal(final Object object, final File output) throws JAXBException {
+        ensureNonNull("object", object);
+        ensureNonNull("output", output);
+        final MarshallerPool pool = getPool();
+        final Marshaller marshaller = pool.acquireMarshaller();
+        marshaller.marshal(object, output);
+        pool.recycle(marshaller);
+    }
+
+    /**
+     * Marshall the given object to a stream, DOM or other destinations.
+     * This is the most flexible marshalling method provided in this {@code XML} class.
+     * The destination is specified by the {@code output} argument implementation, for example
+     * {@link javax.xml.transform.stream.StreamResult} for writing to a file or output stream.
+     * The optional {@code properties} map can contain any key documented in this {@code XML} class,
+     * together with the keys documented in the <cite>supported properties</cite> section of the the
+     * {@link Marshaller} class.
+     *
+     * @param  object The root of content tree to be marshalled.
+     * @param  output The file to be written.
+     * @param  properties An optional map of properties to give to the marshaller, or {@code null} if none.
+     * @throws JAXBException If a property has an illegal value, or if an error occurred during the marshalling.
+     *
+     * @since 0.4
+     */
+    public static void marshal(final Object object, final Result output, final Map<String,?> properties) throws JAXBException {
+        ensureNonNull("object", object);
+        ensureNonNull("output", output);
         final MarshallerPool pool = getPool();
         final Marshaller marshaller = pool.acquireMarshaller();
+        if (properties != null) {
+            for (final Map.Entry<String,?> entry : properties.entrySet()) {
+                marshaller.setProperty(entry.getKey(), entry.getValue());
+            }
+        }
         marshaller.marshal(object, output);
         pool.recycle(marshaller);
     }
@@ -350,6 +417,7 @@ public final class XML extends Static {
      * @throws JAXBException If an error occurred during the unmarshalling.
      */
     public static Object unmarshal(final String input) throws JAXBException {
+        ensureNonNull("input", input);
         final StringReader in = new StringReader(input);
         final MarshallerPool pool = getPool();
         final Unmarshaller unmarshaller = pool.acquireUnmarshaller();
@@ -366,6 +434,23 @@ public final class XML extends Static {
      * @throws JAXBException If an error occurred during the unmarshalling.
      */
     public static Object unmarshal(final InputStream input) throws JAXBException {
+        ensureNonNull("input", input);
+        final MarshallerPool pool = getPool();
+        final Unmarshaller unmarshaller = pool.acquireUnmarshaller();
+        final Object object = unmarshaller.unmarshal(input);
+        pool.recycle(unmarshaller);
+        return object;
+    }
+
+    /**
+     * Unmarshall an object from the given URL.
+     *
+     * @param  input The URL from which to read a XML representation.
+     * @return The object unmarshalled from the given input.
+     * @throws JAXBException If an error occurred during the unmarshalling.
+     */
+    public static Object unmarshal(final URL input) throws JAXBException {
+        ensureNonNull("input", input);
         final MarshallerPool pool = getPool();
         final Unmarshaller unmarshaller = pool.acquireUnmarshaller();
         final Object object = unmarshaller.unmarshal(input);
@@ -381,10 +466,43 @@ public final class XML extends Static {
      * @throws JAXBException If an error occurred during the unmarshalling.
      */
     public static Object unmarshal(final File input) throws JAXBException {
+        ensureNonNull("input", input);
         final MarshallerPool pool = getPool();
         final Unmarshaller unmarshaller = pool.acquireUnmarshaller();
         final Object object = unmarshaller.unmarshal(input);
         pool.recycle(unmarshaller);
         return object;
     }
+
+    /**
+     * Unmarshall an object from the given stream, DOM or other sources.
+     * This is the most flexible unmarshalling method provided in this {@code XML} class.
+     * The source is specified by the {@code input} argument implementation, for example
+     * {@link javax.xml.transform.stream.StreamSource} for reading from a file or input stream.
+     * The optional {@code properties} map can contain any key documented in this {@code XML} class,
+     * together with the keys documented in the <cite>supported properties</cite> section of the the
+     * {@link Unmarshaller} class.
+     *
+     * @param  input The file from which to read a XML representation.
+     * @param  properties An optional map of properties to give to the unmarshaller, or {@code null} if none.
+     * @return The object unmarshalled from the given input.
+     * @throws JAXBException If a property has an illegal value, or if an error occurred during the unmarshalling.
+     *
+     * @since 0.4
+     *
+     * @see org.apache.sis.storage.xml.XMLStore
+     */
+    public static Object unmarshal(final Source input, final Map<String,?> properties) throws JAXBException {
+        ensureNonNull("input", input);
+        final MarshallerPool pool = getPool();
+        final Unmarshaller unmarshaller = pool.acquireUnmarshaller();
+        if (properties != null) {
+            for (final Map.Entry<String,?> entry : properties.entrySet()) {
+                unmarshaller.setProperty(entry.getKey(), entry.getValue());
+            }
+        }
+        final Object object = unmarshaller.unmarshal(input);
+        pool.recycle(unmarshaller);
+        return object;
+    }
 }

Modified: sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/xml/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/xml/package-info.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/xml/package-info.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/xml/package-info.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -59,7 +59,7 @@
  * @author  Guilhem Legal (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-3.00)
- * @version 0.3
+ * @version 0.4
  * @module
  */
 package org.apache.sis.xml;

Modified: sis/branches/Shapefile/core/sis-utility/src/main/javadoc/overview.html
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/javadoc/overview.html?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/javadoc/overview.html (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/javadoc/overview.html Sun Aug 25 15:49:51 2013
@@ -1,4 +1,24 @@
 <!DOCTYPE html>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
 <html>
   <head>
     <title>API Overview</title>

Modified: sis/branches/Shapefile/core/sis-utility/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/site/apt/index.apt?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/site/apt/index.apt [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/site/apt/index.apt [UTF-8] Sun Aug 25 15:49:51 2013
@@ -1,3 +1,22 @@
+~~
+~~ Licensed to the Apache Software Foundation (ASF) under one
+~~ or more contributor license agreements.  See the NOTICE file
+~~ distributed with this work for additional information
+~~ regarding copyright ownership.  The ASF licenses this file
+~~ to you under the Apache License, Version 2.0 (the
+~~ "License"); you may not use this file except in compliance
+~~ with the License.  You may obtain a copy of the License at
+~~
+~~   http://www.apache.org/licenses/LICENSE-2.0
+~~
+~~ Unless required by applicable law or agreed to in writing,
+~~ software distributed under the License is distributed on an
+~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+~~ KIND, either express or implied.  See the License for the
+~~ specific language governing permissions and limitations
+~~ under the License.
+~~
+
                              ------------------------------
                                         Overview
                              ------------------------------

Modified: sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/internal/converter/ConverterRegistryTest.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/internal/converter/ConverterRegistryTest.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/internal/converter/ConverterRegistryTest.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/internal/converter/ConverterRegistryTest.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -36,7 +36,7 @@ import static org.apache.sis.test.Assert
  *
  * <p>This test shall not perform any conversion neither serialization. It shall only ensures
  * that the converters are properly registered. This is because some {@link SystemConverter}
- * methods may query back {@link HeuristicRegistry#SYSTEM} while we want to keep the tests
+ * methods may query back {@link SystemRegistry#INSTANCE} while we want to keep the tests
  * isolated.</p>
  *
  * @author  Martin Desruisseaux (Geomatys)
@@ -335,4 +335,31 @@ public final strictfp class ConverterReg
          */
         assertAllConvertersAreRegistered();
     }
+
+    /**
+     * Tests automatic creation of a converter for an array of values.
+     */
+    @Test
+    public void testArrayOfWrapperTypes() {
+        register(new NumberConverter<Float,Double>(Float.class, Double.class));
+        final ObjectConverter<?,?> converter = registry.find(Float[].class, Double[].class);
+        assertInstanceOf("Array conversions", ArrayConverter.class, converter);
+        assertEquals(Float [].class, converter.getSourceClass());
+        assertEquals(Double[].class, converter.getTargetClass());
+        assertSame("Converter shall be cached.", converter, registry.find(Float[].class, Double[].class));
+    }
+
+    /**
+     * Tests automatic creation of a converter for an array of values.
+     */
+    @Test
+    @DependsOnMethod("testArrayOfWrapperTypes")
+    public void testArrayOfPrimitiveTypes() {
+        register(new NumberConverter<Float,Double>(Float.class, Double.class));
+        final ObjectConverter<?,?> converter = registry.find(float[].class, double[].class);
+        assertInstanceOf("Array conversions", ArrayConverter.class, converter);
+        assertEquals(float [].class, converter.getSourceClass());
+        assertEquals(double[].class, converter.getTargetClass());
+        assertSame("Converter shall be cached.", converter, registry.find(float[].class, double[].class));
+    }
 }

Modified: sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/internal/converter/StringConverterTest.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/internal/converter/StringConverterTest.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/internal/converter/StringConverterTest.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/internal/converter/StringConverterTest.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -187,7 +187,8 @@ public final strictfp class StringConver
     @Test
     public void testAngle() {
         final ObjectConverter<String,Angle> c = new StringConverter.Angle();
-        runInvertibleConversion(c, "42°30′00″", new Angle(42.5));
+        runInvertibleConversion(c, "42°30′",       new Angle(42.5));
+        runInvertibleConversion(c, "42°30′56.25″", new Angle(42.515625));
         tryUnconvertibleValue(c);
         assertSerializedEquals(c);
     }

Modified: sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/internal/test/XMLComparatorTest.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/internal/test/XMLComparatorTest.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/internal/test/XMLComparatorTest.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/internal/test/XMLComparatorTest.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -33,8 +33,7 @@ import static org.junit.Assert.*;
  */
 public final strictfp class XMLComparatorTest extends TestCase {
     /**
-     * Tests the {@link XMLComparator#ignoredAttributes} and {@link XMLComparator#ignoredNodes}
-     * sets.
+     * Tests the {@link XMLComparator#ignoredAttributes} and {@link XMLComparator#ignoredNodes} sets.
      *
      * @throws Exception Should never happen.
      */

Modified: sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/internal/util/UtilitiesTest.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/internal/util/UtilitiesTest.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/internal/util/UtilitiesTest.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/internal/util/UtilitiesTest.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -31,7 +31,7 @@ import static org.apache.sis.test.Assert
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.4
  * @module
  */
 public final strictfp class UtilitiesTest extends TestCase {
@@ -51,4 +51,12 @@ public final strictfp class UtilitiesTes
         assertTrue (epsilonEqual(-100, -100 + COMPARISON_THRESHOLD * 50));
         assertFalse(epsilonEqual( 100,  100 + COMPARISON_THRESHOLD * 150));
     }
+
+    /**
+     * Tests the {@link Utilities#toString(Class, Object[])} method.
+     */
+    @Test
+    public void testToString() {
+        assertEquals("Number[base=“decimal”, value=20]", Utilities.toString(Number.class, "base", "decimal", "value", 20));
+    }
 }

Modified: sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/math/MathFunctionsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/math/MathFunctionsTest.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/math/MathFunctionsTest.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/math/MathFunctionsTest.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -56,8 +56,10 @@ public final strictfp class MathFunction
      */
     @Test
     public void testTruncate() {
-        assertEquals(+4, truncate(+4.9), 0);
-        assertEquals(-4, truncate(-4.9), 0);
+        assertEquals(+4.0, truncate(+4.9), 0);
+        assertEquals(-4.0, truncate(-4.9), 0);
+        assertEquals(+0.0, truncate(+0.1), 0);
+        assertEquals(-0.0, truncate(-0.1), 0);
         assertEquals("Positive zero",
                 Double.doubleToLongBits(+0.0),
                 Double.doubleToLongBits(truncate(+0.5)));

Modified: sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/measure/AngleFormatTest.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/measure/AngleFormatTest.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/measure/AngleFormatTest.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/measure/AngleFormatTest.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -19,6 +19,7 @@ package org.apache.sis.measure;
 import java.util.Locale;
 import java.text.FieldPosition;
 import java.text.AttributedCharacterIterator;
+import java.text.ParseException;
 import org.apache.sis.test.TestCase;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.DependsOnMethod;
@@ -33,7 +34,7 @@ import static org.apache.sis.test.TestUt
  *
  * @author  Martin Desruisseaux (MPO, IRD, Geomatys)
  * @since   0.3 (derived from geotk-2.0)
- * @version 0.3
+ * @version 0.4
  * @module
  */
 @DependsOn({
@@ -60,6 +61,24 @@ public final strictfp class AngleFormatT
     }
 
     /**
+     * Tests a {@code '?'} symbol without suffix.
+     */
+    @Test(expected = IllegalArgumentException.class)
+    public void testIllegalOptionalField() {
+        final AngleFormat f = new AngleFormat(Locale.CANADA);
+        f.applyPattern("DD°MM?SS.m″");
+    }
+
+    /**
+     * Tests a {@code '?'} symbol without suffix.
+     */
+    @Test(expected = IllegalArgumentException.class)
+    public void testIllegalOptionalLastField() {
+        final AngleFormat f = new AngleFormat(Locale.CANADA);
+        f.applyPattern("DD°MM?");
+    }
+
+    /**
      * Tests using {@link Locale#CANADA}.
      */
     @Test
@@ -73,6 +92,7 @@ public final strictfp class AngleFormatT
         assertEquals("-12.247°",  formatAndParse(f, new Angle   (-12.247)));
         assertEquals( "13.214°N", formatAndParse(f, new Latitude( 13.214)));
         assertEquals( "12.782°S", formatAndParse(f, new Latitude(-12.782)));
+        assertEquals("-00.010°",  formatAndParse(f, new Angle   (-0.01)));
     }
 
     /**
@@ -83,9 +103,10 @@ public final strictfp class AngleFormatT
         final AngleFormat f = new AngleFormat("DD.ddd°", Locale.FRANCE);
         assertEquals(3, f.getMinimumFractionDigits());
         assertEquals(3, f.getMaximumFractionDigits());
-        assertEquals( "DD.ddd°", f.toPattern());
-        assertEquals("19,457°E", formatAndParse(f, new Longitude( 19.457)));
-        assertEquals("78,124°S", formatAndParse(f, new Latitude (-78.124)));
+        assertEquals( "DD.ddd°",  f.toPattern());
+        assertEquals( "19,457°E", formatAndParse(f, new Longitude( 19.457)));
+        assertEquals( "78,124°S", formatAndParse(f, new Latitude (-78.124)));
+        assertEquals("-00,010°",  formatAndParse(f, new Angle    (-0.01)));
     }
 
     /**
@@ -96,9 +117,10 @@ public final strictfp class AngleFormatT
         final AngleFormat f = new AngleFormat("DDddd", Locale.CANADA);
         assertEquals(3, f.getMinimumFractionDigits());
         assertEquals(3, f.getMaximumFractionDigits());
-        assertEquals("DDddd",  f.toPattern());
-        assertEquals("19457E", formatAndParse(f, new Longitude( 19.457)));
-        assertEquals("78124S", formatAndParse(f, new Latitude (-78.124)));
+        assertEquals( "DDddd",  f.toPattern());
+        assertEquals( "19457E", formatAndParse(f, new Longitude( 19.457)));
+        assertEquals( "78124S", formatAndParse(f, new Latitude (-78.124)));
+        assertEquals("-00010",  formatAndParse(f, new Angle    (-0.01)));
     }
 
     /**
@@ -113,6 +135,7 @@ public final strictfp class AngleFormatT
         assertEquals( "DD°MM.m", f.toPattern());
         assertEquals( "12°30.0", formatAndParse(f, new Angle( 12.50)));
         assertEquals("-10°15.0", formatAndParse(f, new Angle(-10.25)));
+        assertEquals("-00°00.6", formatAndParse(f, new Angle( -0.01)));
     }
 
     /**
@@ -127,6 +150,74 @@ public final strictfp class AngleFormatT
         assertEquals( "DD°MM′SS.sss″", f.toPattern());
         assertEquals( "12°30′56.250″", formatAndParse(f, new Angle( 12.515625)));
         assertEquals("-12°30′56.250″", formatAndParse(f, new Angle(-12.515625)));
+        assertEquals("-00°00′36.000″", formatAndParse(f, new Angle( -0.01)));
+    }
+
+    /**
+     * Tests values that have to be rounded, especially the values near zero.
+     */
+    @Test
+    @DependsOnMethod("testDegreeMinutesSeconds")
+    public void testRounding() {
+        final AngleFormat f = new AngleFormat("DD°MM′SS.sss″", Locale.CANADA);
+        assertEquals( "01°00′00.000″", f.format(new Angle(+(59 + (59.9999 / 60)) / 60)));
+        assertEquals("-01°00′00.000″", f.format(new Angle(-(59 + (59.9999 / 60)) / 60)));
+        assertEquals("-00°59′59.999″", f.format(new Angle(-(59 + (59.9988 / 60)) / 60)));
+    }
+
+    /**
+     * Tests with optional minutes and seconds fields.
+     */
+    @Test
+    @DependsOnMethod("testDegreeMinutesSeconds")
+    public void testOptionalFields() {
+        final AngleFormat f = new AngleFormat(Locale.CANADA);
+        assertEquals("D°?MM′?SS.################″?", f.toPattern());
+        assertEquals("12°",          formatAndParse(f, new Angle(12)));
+        assertEquals("12°30′",       formatAndParse(f, new Angle(12.5)));
+        assertEquals("12°36″",       formatAndParse(f, new Angle(12.01)));
+        assertEquals("12°00′36″N",   formatAndParse(f, new Latitude(12.01)));
+        assertEquals("12°30′56.25″", formatAndParse(f, new Angle(12.515625)));
+        assertEquals("-36″",         formatAndParse(f, new Angle(-0.01)));
+        assertEquals("0°00′36″S",    formatAndParse(f, new Latitude(-0.01)));
+    }
+
+    /**
+     * Tests the example provided in the {@link AngleFormat} javadoc.
+     *
+     * @throws ParseException If a string can not be parsed.
+     */
+    @Test
+    @DependsOnMethod("testOptionalFields")
+    public void testJavadocExamples() throws ParseException {
+        final AngleFormat f = new AngleFormat(Locale.CANADA);
+        testExample(f, "DD°MM′SS.#″",   "48°30′00″", "-12°31′52.5″", 0.000);
+        testExample(f, "DD°MM′",        "48°30′",    "-12°32′",      0.003);
+        testExample(f, "DD.ddd",        "48.500",    "-12.531",      2.500);
+        testExample(f, "DD.###",        "48.5",      "-12.531",      2.500);
+        testExample(f, "DDMM",          "4830",      "-1232",        0.003);
+        testExample(f, "DDMMSSs",       "4830000",   "-1231525",     0.000);
+        testExample(f, "DD°MM′?SS.s″?", "48°30′",    "-12°31′52.5″", 0.000);
+    }
+
+    /**
+     * Tests a single line of Javadoc examples.
+     *
+     * @param f       The angle format to test.
+     * @param pattern The pattern to apply for the test.
+     * @param e1      The expected string value of 48.5.
+     * @param e2      The expected string value of -12.53125.
+     * @param eps     The tolerance for comparing the parsed value of {@code e2}.
+     */
+    private static void testExample(final AngleFormat f, final String pattern, final String e1, final String e2,
+            final double eps) throws ParseException
+    {
+        f.applyPattern(pattern);
+        assertEquals("toPattern()", pattern, f.toPattern());
+        assertEquals("format(double)", e1,       f.format(48.5));
+        assertEquals("format(double)", e2,       f.format(-12.53125));
+        assertEquals("parse(String)",  48.5,     f.parse(e1).degrees(), 0.0);
+        assertEquals("parse(String)", -12.53125, f.parse(e2).degrees(), eps);
     }
 
     /**
@@ -160,7 +251,7 @@ public final strictfp class AngleFormatT
     @Test
     @DependsOnMethod("testOptionalFractionDigits")
     public void testSetMaximumWidth() {
-        final AngleFormat f = new AngleFormat(Locale.CANADA);
+        final AngleFormat f = new AngleFormat("D°MM′SS.################″", Locale.CANADA);
         assertEquals("D°MM′SS.################″", f.toPattern());
 
         f.setMaximumWidth(12);

Modified: sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/measure/AngleTest.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/measure/AngleTest.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/measure/AngleTest.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/measure/AngleTest.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -29,7 +29,7 @@ import static org.junit.Assert.*;
  *
  * @author  Martin Desruisseaux (MPO, IRD, Geomatys)
  * @since   0.3 (derived from geotk-2.0)
- * @version 0.3
+ * @version 0.4
  * @module
  */
 @DependsOn(AngleFormatTest.class)
@@ -39,9 +39,11 @@ public final strictfp class AngleTest ex
      */
     @Test
     public void testToString() {
-        assertEquals("45°30′00″",  new Angle    (45.5).toString());
-        assertEquals("45°30′00″N", new Latitude (45.5).toString());
-        assertEquals("45°30′00″E", new Longitude(45.5).toString());
+        assertEquals("45°",           new Angle    (45  ).toString());
+        assertEquals("45°30′",        new Angle    (45.5).toString());
+        assertEquals("45°30′N",       new Latitude (45.5).toString());
+        assertEquals("45°30′E",       new Longitude(45.5).toString());
+        assertEquals("45°30′56.25″E", new Longitude(45.515625).toString());
 
         // Angle out of expected range.
         assertEquals( "720.0°E", new Longitude( 720).toString());
@@ -59,6 +61,7 @@ public final strictfp class AngleTest ex
      */
     @Test
     public void testParse() {
+        assertEquals(new Angle    (45.5), new Angle    ("45°30′"));
         assertEquals(new Angle    (45.5), new Angle    ("45°30′00″"));
         assertEquals(new Latitude (45.5), new Latitude ("45°30′00″N"));
         assertEquals(new Longitude(45.5), new Longitude("45°30′00″E"));
@@ -75,13 +78,13 @@ public final strictfp class AngleTest ex
      */
     @Test
     public void testFormatTo() {
-        assertEquals("5°30′00″",  String.format(Locale.CANADA,  "%s",    new Angle   (5.5)));
-        assertEquals("5°30′00″N", String.format(Locale.CANADA,  "%s",    new Latitude(5.5)));
-        assertEquals("  5°30′",   String.format(Locale.CANADA,  "%7.5s", new Angle   (5.5)));
-        assertEquals("  5.5°N",   String.format(Locale.CANADA,  "%7.5s", new Latitude(5.5)));
-        assertEquals("  5,5°N",   String.format(Locale.FRANCE,  "%7.5s", new Latitude(5.5)));
-        assertEquals("5,5°N  ",   String.format(Locale.FRANCE, "%-7.5s", new Latitude(5.5)));
-        assertEquals("N",         String.format(Locale.FRANCE,  "%1.1s", new Latitude(5.5)));
-        assertEquals(" ",         String.format(Locale.FRANCE,  "%1.0s", new Latitude(5.5)));
+        assertEquals("5°30′36″",  String.format(Locale.CANADA,  "%s",    new Angle   (5.51)));
+        assertEquals("5°30′36″N", String.format(Locale.CANADA,  "%s",    new Latitude(5.51)));
+        assertEquals("  5°31′",   String.format(Locale.CANADA,  "%7.5s", new Angle   (5.51)));
+        assertEquals("  5.5°N",   String.format(Locale.CANADA,  "%7.5s", new Latitude(5.51)));
+        assertEquals("  5,5°N",   String.format(Locale.FRANCE,  "%7.5s", new Latitude(5.51)));
+        assertEquals("5,5°N  ",   String.format(Locale.FRANCE, "%-7.5s", new Latitude(5.51)));
+        assertEquals("N",         String.format(Locale.FRANCE,  "%1.1s", new Latitude(5.51)));
+        assertEquals(" ",         String.format(Locale.FRANCE,  "%1.0s", new Latitude(5.51)));
     }
 }

Modified: sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/test/AnnotationsTestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/test/AnnotationsTestCase.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/test/AnnotationsTestCase.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/test/AnnotationsTestCase.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -270,7 +270,9 @@ public abstract strictfp class Annotatio
                     break;
                 }
             }
-            assertTrue("Namespace is not declared in the package @XmlSchema.xmlns().", found);
+            if (!found) {
+                fail("Namespace for " + impl + " is not declared in the package @XmlSchema.xmlns().");
+            }
         } else {
             namespace = schemaNamespace;
         }

Modified: sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/test/TestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/test/TestCase.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/test/TestCase.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/test/TestCase.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -50,7 +50,7 @@ import static org.apache.sis.test.TestCo
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-3.16)
- * @version 0.3
+ * @version 0.4
  * @module
  */
 @RunWith(TestRunner.class)
@@ -72,6 +72,23 @@ public abstract strictfp class TestCase 
     public static final boolean PENDING_NEXT_GEOAPI_RELEASE = false;
 
     /**
+     * A flag for code that are pending future SIS development before to be enabled.
+     * This flag is always set to {@code false}. It shall be used as below:
+     *
+     * {@preformat java
+     *     if (PENDING_FUTURE_SIS_VERSION) {
+     *         // Do some stuff here.
+     *     }
+     * }
+     *
+     * The intend is to make easier to identify test cases that fail with the current version
+     * of SIS (e.g. because of unsupported operations), but should pass in a future version.
+     *
+     * @since 0.4
+     */
+    public static final boolean PENDING_FUTURE_SIS_VERSION = false;
+
+    /**
      * The output writer where to print debugging information (never {@code null}).
      * Texts sent to this printer will be show only if the test fails, or if the
      * {@value org.apache.sis.test.TestConfiguration#VERBOSE_OUTPUT_KEY} system property

Modified: sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/test/XMLComparator.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/test/XMLComparator.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/test/XMLComparator.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/test/XMLComparator.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -30,7 +30,6 @@ import java.io.IOException;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
-
 import org.w3c.dom.Attr;
 import org.w3c.dom.CDATASection;
 import org.w3c.dom.Comment;
@@ -41,7 +40,6 @@ import org.w3c.dom.NodeList;
 import org.w3c.dom.ProcessingInstruction;
 import org.w3c.dom.Text;
 import org.xml.sax.SAXException;
-
 import org.apache.sis.util.ArgumentChecks;
 
 import static java.lang.StrictMath.*;
@@ -60,11 +58,14 @@ import org.apache.sis.internal.jdk7.JDK7
  * protected methods defined in this class, which can be overridden.
  *
  * <p>By default, this comparator expects the documents to contain the same elements and
- * the same attributes (but the order of attributes may be different). However it is
- * possible to:</p>
+ * the same attributes (but the order of attributes may be different).
+ * However it is possible to:</p>
  *
  * <ul>
+ *   <li>Specify whether comments shall be ignored (see {@link #ignoreComments})</li>
  *   <li>Specify attributes to ignore in comparisons (see {@link #ignoredAttributes})</li>
+ *   <li>Specify nodes to ignore, including children (see {@link #ignoredNodes})</li>
+ *   <li>Specify a tolerance threshold for comparisons of numerical values (see {@link #tolerance})</li>
  * </ul>
  *
  * @author  Johann Sorel (Geomatys)
@@ -72,6 +73,9 @@ import org.apache.sis.internal.jdk7.JDK7
  * @since   0.3 (derived from geotk-3.17)
  * @version 0.3
  * @module
+ *
+ * @see XMLTestCase
+ * @see Assert#assertXmlEquals(Object, Object, String[])
  */
 public strictfp class XMLComparator {
     /**

Modified: sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -26,7 +26,7 @@ import org.junit.BeforeClass;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.4
  * @module
  */
 @Suite.SuiteClasses({
@@ -41,6 +41,7 @@ import org.junit.BeforeClass;
     org.apache.sis.util.CharactersTest.class,
     org.apache.sis.util.CharSequencesTest.class,
     org.apache.sis.util.StringBuildersTest.class,
+    org.apache.sis.util.ExceptionsTest.class,
     org.apache.sis.util.UtilitiesTest.class,
     org.apache.sis.util.NumbersTest.class,
     org.apache.sis.util.ClassesTest.class,
@@ -51,6 +52,7 @@ import org.junit.BeforeClass;
     org.apache.sis.util.logging.PerformanceLevelTest.class,
     org.apache.sis.util.logging.WarningListenersTest.class,
     org.apache.sis.util.logging.MonolineFormatterTest.class,
+    org.apache.sis.util.logging.LoggerAdapterTest.class,
     org.apache.sis.math.MathFunctionsTest.class,
     org.apache.sis.math.StatisticsTest.class,
     org.apache.sis.math.StatisticsFormatTest.class,
@@ -98,11 +100,12 @@ import org.junit.BeforeClass;
     org.apache.sis.util.collection.TreeTableFormatTest.class,
     org.apache.sis.util.collection.RangeSetTest.class,
 
-    // Converters
+    // Converters.
     org.apache.sis.internal.converter.AngleConverterTest.class,
     org.apache.sis.internal.converter.StringConverterTest.class,
     org.apache.sis.internal.converter.PathConverterTest.class,
     org.apache.sis.internal.converter.FallbackConverterTest.class,
+    org.apache.sis.internal.converter.ArrayConverterTest.class,
     org.apache.sis.internal.converter.ConverterRegistryTest.class,
     org.apache.sis.internal.converter.SystemRegistryTest.class,
     org.apache.sis.internal.converter.NumberConverterTest.class, // Shall be after SystemRegistryTest.
@@ -112,8 +115,13 @@ import org.junit.BeforeClass;
     org.apache.sis.xml.NilReasonTest.class,
     org.apache.sis.xml.OGCNamespacePrefixMapperTest.class,
     org.apache.sis.xml.MarshallerPoolTest.class,
+    org.apache.sis.internal.jaxb.XmlUtilitiesTest.class,
     org.apache.sis.internal.jaxb.IdentifierMapAdapterTest.class,
-    org.apache.sis.internal.jaxb.IdentifierMapWithSpecialCasesTest.class
+    org.apache.sis.internal.jaxb.IdentifierMapWithSpecialCasesTest.class,
+    org.apache.sis.internal.jaxb.gco.StringAdapterTest.class,
+    org.apache.sis.internal.jaxb.gco.MeasureTest.class,
+    org.apache.sis.internal.jaxb.gco.PropertyTypeTest.class,
+    org.apache.sis.util.iso.NameMarshallingTest.class
 })
 public final strictfp class UtilityTestSuite extends TestSuite {
     /**

Modified: sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/util/VersionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/util/VersionTest.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/util/VersionTest.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/util/VersionTest.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -16,6 +16,7 @@
  */
 package org.apache.sis.util;
 
+import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
@@ -25,9 +26,9 @@ import static org.apache.sis.test.Assert
 /**
  * Tests the {@link Version} class, especially the {@code compareTo} method.
  *
- * @author  Martin Desruisseaux (IRD)
+ * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3 (derived from geotk-2.4)
- * @version 0.3
+ * @version 0.4
  * @module
  */
 public final strictfp class VersionTest extends TestCase {
@@ -54,6 +55,7 @@ public final strictfp class VersionTest 
      * Tests a alpha-numeric version.
      */
     @Test
+    @DependsOnMethod("testNumeric")
     public void testAlphaNumeric() {
         final Version version = new Version("1.6.b2");
         assertEquals("1.6.b2", version.toString());
@@ -69,6 +71,48 @@ public final strictfp class VersionTest 
     }
 
     /**
+     * Tests the {@link Version#valueOf(int[])} method.
+     */
+    @Test
+    public void testValueOf() {
+        Version version = Version.valueOf(1);
+        assertEquals("1", version.toString());
+        assertEquals( 1,  version.getMajor());
+        assertNull  (     version.getMinor());
+        assertNull  (     version.getRevision());
+
+        version = Version.valueOf(10);
+        assertEquals("10", version.toString());
+        assertEquals( 10,  version.getMajor());
+        assertNull  (      version.getMinor());
+        assertNull  (      version.getRevision());
+
+        version = Version.valueOf(0, 4);
+        assertEquals("0.4", version.toString());
+        assertEquals( 0,    version.getMajor());
+        assertEquals(   4,  version.getMinor());
+        assertNull  (       version.getRevision());
+
+        version = Version.valueOf(6, 11, 2);
+        assertEquals("6.11.2", version.toString());
+        assertEquals( 6,       version.getMajor());
+        assertEquals(   11,    version.getMinor());
+        assertEquals(      2,  version.getRevision());
+    }
+
+    /**
+     * Tests the cached values of {@link Version#valueOf(int[])}.
+     */
+    @Test
+    @DependsOnMethod("testValueOf")
+    public void testCachedValueOf() {
+        for (int major=1; major<=2; major++) {
+            final Version version = Version.valueOf(major);
+            assertSame(version.toString(), version, Version.valueOf(major));
+        }
+    }
+
+    /**
      * Tests serialization.
      */
     @Test

Modified: sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/util/collection/WeakValueHashMapTest.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/util/collection/WeakValueHashMapTest.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/util/collection/WeakValueHashMapTest.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/util/collection/WeakValueHashMapTest.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -36,7 +36,7 @@ import static org.apache.sis.test.TestUt
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3 (derived from geotk-2.0)
- * @version 0.3
+ * @version 0.4
  * @module
  */
 @DependsOn(org.apache.sis.util.ArraysExtTest.class)
@@ -197,4 +197,29 @@ public final strictfp class WeakValueHas
         assertSame (v1, weakMap.get(k1));
         assertSame (v2, weakMap.get(k2));
     }
+
+    /**
+     * Tests using identity comparisons. This test uses two {@link Integer} keys having the same value
+     * but being different instances.
+     *
+     * @since 0.4
+     */
+    @Test
+    @DependsOnMethod("testStrongReferences")
+    public void testIdentityComparisons() {
+        final WeakValueHashMap<Integer,Integer> weakMap = new WeakValueHashMap<Integer,Integer>(Integer.class, true);
+        final Integer k1 = 10;
+        final Integer k2 = 20;
+        final Integer k3 = new Integer(10); // Really want a new instance.
+        final Integer v1 = 1;
+        final Integer v2 = 2;
+        final Integer v3 = 3;
+        assertEquals(k1, k3); // Necessary condition for the test to be valid.
+        assertNull(weakMap.put(k1, v1));  assertSame(v1, weakMap.put(k1, v1));
+        assertNull(weakMap.put(k2, v2));  assertSame(v2, weakMap.put(k2, v2));
+        assertNull(weakMap.put(k3, v3));  assertSame(v3, weakMap.put(k3, v3));
+        assertSame(v1, weakMap.get(k1));
+        assertSame(v2, weakMap.get(k2));
+        assertSame(v3, weakMap.get(k3));
+    }
 }

Modified: sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/util/logging/EmptyWarningListeners.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/util/logging/EmptyWarningListeners.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/util/logging/EmptyWarningListeners.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/util/logging/EmptyWarningListeners.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -30,6 +30,11 @@ import org.apache.sis.util.resources.Err
  * component where the real {@link WarningListeners} instance is not yet available.</p>
  *
  * @param <S> If the listener list had a source, that would be type type of the source.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.3
+ * @version 0.3
+ * @module
  */
 public final strictfp class EmptyWarningListeners<S> extends WarningListeners<S> {
     /**

Modified: sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/util/logging/WarningListenersTest.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/util/logging/WarningListenersTest.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/util/logging/WarningListenersTest.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/util/logging/WarningListenersTest.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -53,6 +53,14 @@ public final strictfp class WarningListe
     }
 
     /**
+     * Returns the type warning sources.
+     */
+    @Override
+    public Class<String> getSourceClass() {
+        return String.class;
+    }
+
+    /**
      * Invoked when a warning occurred. The implementation in this test verifies that the {@code source} argument has
      * the expected values, then stores the log record in the {@link #warning} field for inspection by the test method.
      */

Modified: sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/xml/NilReasonTest.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/xml/NilReasonTest.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/xml/NilReasonTest.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/test/java/org/apache/sis/xml/NilReasonTest.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -17,6 +17,7 @@
 package org.apache.sis.xml;
 
 import java.net.URISyntaxException;
+import org.opengis.util.InternationalString;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.metadata.citation.ResponsibleParty;
 import org.apache.sis.util.LenientComparable;
@@ -33,7 +34,7 @@ import static org.apache.sis.test.Assert
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-3.18)
- * @version 0.3
+ * @version 0.4
  * @module
  */
 public final strictfp class NilReasonTest extends TestCase {
@@ -94,6 +95,163 @@ public final strictfp class NilReasonTes
     }
 
     /**
+     * Tests {@link NilReason#createNilObject(Class)} for a boolean type.
+     * Opportunistically tests {@link NilReason#forObject(Object)} with the created object.
+     *
+     * @since 0.4
+     */
+    @Test
+    public void testCreateNilBoolean() {
+        final Boolean value = NilReason.MISSING.createNilObject(Boolean.class);
+        assertEquals (Boolean.FALSE, value);
+        assertNotSame(Boolean.FALSE, value);
+        assertSame("NilReason.forObject(…)", NilReason.MISSING, NilReason.forObject(value));
+        assertNull("NilReason.forObject(…)", NilReason.forObject(Boolean.FALSE));
+        assertNull("NilReason.forObject(…)", NilReason.forObject(Boolean.TRUE));
+        assertSame("Expected cached value.", value, NilReason.MISSING.createNilObject(Boolean.class));
+    }
+
+    /**
+     * Tests {@link NilReason#createNilObject(Class)} for an integer type.
+     * Opportunistically tests {@link NilReason#forObject(Object)} with the created object.
+     *
+     * @since 0.4
+     */
+    @Test
+    public void testCreateNilInteger() {
+        final Integer zero  = 0;
+        final Integer value = NilReason.MISSING.createNilObject(Integer.class);
+        assertEquals (zero, value);
+        assertNotSame(zero, value);
+        assertSame("NilReason.forObject(…)", NilReason.MISSING, NilReason.forObject(value));
+        assertNull("NilReason.forObject(…)", NilReason.forObject(zero));
+        assertNull("NilReason.forObject(…)", NilReason.forObject(1));
+        assertSame("Expected cached value.", value, NilReason.MISSING.createNilObject(Integer.class));
+    }
+
+    /**
+     * Tests {@link NilReason#createNilObject(Class)} for a byte type.
+     * Opportunistically tests {@link NilReason#forObject(Object)} with the created object.
+     *
+     * @since 0.4
+     */
+    @Test
+    public void testCreateNilByte() {
+        final Byte zero  = 0;
+        final Byte value = NilReason.MISSING.createNilObject(Byte.class);
+        assertEquals (zero, value);
+        assertNotSame(zero, value);
+        assertSame("NilReason.forObject(…)", NilReason.MISSING, NilReason.forObject(value));
+        assertNull("NilReason.forObject(…)", NilReason.forObject(zero));
+        assertNull("NilReason.forObject(…)", NilReason.forObject(1));
+        assertSame("Expected cached value.", value, NilReason.MISSING.createNilObject(Byte.class));
+    }
+
+    /**
+     * Tests {@link NilReason#createNilObject(Class)} for a short type.
+     * Opportunistically tests {@link NilReason#forObject(Object)} with the created object.
+     *
+     * @since 0.4
+     */
+    @Test
+    public void testCreateNilShort() {
+        final Short zero  = 0;
+        final Short value = NilReason.MISSING.createNilObject(Short.class);
+        assertEquals (zero, value);
+        assertNotSame(zero, value);
+        assertSame("NilReason.forObject(…)", NilReason.MISSING, NilReason.forObject(value));
+        assertNull("NilReason.forObject(…)", NilReason.forObject(zero));
+        assertNull("NilReason.forObject(…)", NilReason.forObject(1));
+        assertSame("Expected cached value.", value, NilReason.MISSING.createNilObject(Short.class));
+    }
+
+    /**
+     * Tests {@link NilReason#createNilObject(Class)} for a long type.
+     * Opportunistically tests {@link NilReason#forObject(Object)} with the created object.
+     *
+     * @since 0.4
+     */
+    @Test
+    public void testCreateNilLong() {
+        final Long zero  = 0L;
+        final Long value = NilReason.MISSING.createNilObject(Long.class);
+        assertEquals (zero, value);
+        assertNotSame(zero, value);
+        assertSame("NilReason.forObject(…)", NilReason.MISSING, NilReason.forObject(value));
+        assertNull("NilReason.forObject(…)", NilReason.forObject(zero));
+        assertNull("NilReason.forObject(…)", NilReason.forObject(1L));
+        assertSame("Expected cached value.", value, NilReason.MISSING.createNilObject(Long.class));
+    }
+
+    /**
+     * Tests {@link NilReason#createNilObject(Class)} for a float type.
+     * Opportunistically tests {@link NilReason#forObject(Object)} with the created object.
+     *
+     * @since 0.4
+     */
+    @Test
+    public void testCreateNilFloat() {
+        final Float nan  = Float.NaN;
+        final Float value = NilReason.MISSING.createNilObject(Float.class);
+        assertEquals (nan, value);
+        assertNotSame(nan, value);
+        assertSame("NilReason.forObject(…)", NilReason.MISSING, NilReason.forObject(value));
+        assertNull("NilReason.forObject(…)", NilReason.forObject(nan));
+        assertNull("NilReason.forObject(…)", NilReason.forObject(0f));
+        assertSame("Expected cached value.", value, NilReason.MISSING.createNilObject(Float.class));
+    }
+
+    /**
+     * Tests {@link NilReason#createNilObject(Class)} for a double type.
+     * Opportunistically tests {@link NilReason#forObject(Object)} with the created object.
+     *
+     * @since 0.4
+     */
+    @Test
+    public void testCreateNilDouble() {
+        final Double nan  = Double.NaN;
+        final Double value = NilReason.MISSING.createNilObject(Double.class);
+        assertEquals (nan, value);
+        assertNotSame(nan, value);
+        assertSame("NilReason.forObject(…)", NilReason.MISSING, NilReason.forObject(value));
+        assertNull("NilReason.forObject(…)", NilReason.forObject(nan));
+        assertNull("NilReason.forObject(…)", NilReason.forObject(0.0));
+        assertSame("Expected cached value.", value, NilReason.MISSING.createNilObject(Double.class));
+    }
+
+    /**
+     * Tests {@link NilReason#createNilObject(Class)} for a string type.
+     * Opportunistically tests {@link NilReason#forObject(Object)} with the created object.
+     *
+     * @since 0.4
+     */
+    @Test
+    public void testCreateNilString() {
+        final String value = NilReason.MISSING.createNilObject(String.class);
+        assertEquals ("", value);
+        assertNotSame("", value);
+        assertSame("NilReason.forObject(…)", NilReason.MISSING, NilReason.forObject(value));
+        assertNull("NilReason.forObject(…)", NilReason.forObject(""));
+        assertNull("NilReason.forObject(…)", NilReason.forObject("null"));
+        assertSame("Expected cached value.", value, NilReason.MISSING.createNilObject(String.class));
+    }
+
+    /**
+     * Tests {@link NilReason#createNilObject(Class)} for an international string type.
+     * Opportunistically tests {@link NilReason#forObject(Object)} with the created object.
+     *
+     * @since 0.4
+     */
+    @Test
+    public void testCreateNilInternationalString() {
+        final InternationalString value = NilReason.MISSING.createNilObject(InternationalString.class);
+        assertEquals("", value.toString());
+        assertInstanceOf("Unexpected impl.", NilObject.class, value);
+        assertSame("NilReason.forObject(…)", NilReason.MISSING, NilReason.forObject(value));
+        assertSame("Expected cached value.", value, NilReason.MISSING.createNilObject(InternationalString.class));
+    }
+
+    /**
      * Tests the creation of {@link NilObject} instances.
      */
     @Test
@@ -103,6 +261,8 @@ public final strictfp class NilReasonTes
         assertNull(citation.getTitle());
         assertTrue(citation.getDates().isEmpty());
         assertEquals("NilObject.toString()", "Citation[template]", citation.toString());
+        assertSame("NilReason.forObject(…)", NilReason.TEMPLATE, NilReason.forObject(citation));
+        assertSame("Expected cached value.", citation, NilReason.TEMPLATE.createNilObject(Citation.class));
     }
 
     /**

Modified: sis/branches/Shapefile/core/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/src/site/apt/index.apt?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/src/site/apt/index.apt [UTF-8] (original)
+++ sis/branches/Shapefile/core/src/site/apt/index.apt [UTF-8] Sun Aug 25 15:49:51 2013
@@ -1,3 +1,22 @@
+~~
+~~ Licensed to the Apache Software Foundation (ASF) under one
+~~ or more contributor license agreements.  See the NOTICE file
+~~ distributed with this work for additional information
+~~ regarding copyright ownership.  The ASF licenses this file
+~~ to you under the Apache License, Version 2.0 (the
+~~ "License"); you may not use this file except in compliance
+~~ with the License.  You may obtain a copy of the License at
+~~
+~~   http://www.apache.org/licenses/LICENSE-2.0
+~~
+~~ Unless required by applicable law or agreed to in writing,
+~~ software distributed under the License is distributed on an
+~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+~~ KIND, either express or implied.  See the License for the
+~~ specific language governing permissions and limitations
+~~ under the License.
+~~
+
                              ------------------------------
                                 Apache SIS core modules
                              ------------------------------

Modified: sis/branches/Shapefile/ide-project/NetBeans/build.xml
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/ide-project/NetBeans/build.xml?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/ide-project/NetBeans/build.xml (original)
+++ sis/branches/Shapefile/ide-project/NetBeans/build.xml Sun Aug 25 15:49:51 2013
@@ -1,4 +1,24 @@
 <?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
 <!--
   Customization of Apache SIS build from NetBeans IDE.
 -->
@@ -7,11 +27,11 @@
   <import file="nbproject/build-impl.xml"/>
 
   <!--
-    Called before JAR creation. Copies the "*.utf" resources files created by Maven.
+    Called after compilation. Copies the "*.utf" resources files created by Maven.
     Note that the Apache SIS project must have been build by Maven at least once it
     can be built by the NetBeans IDE.
   -->
-  <target name="-pre-jar">
+  <target name="-post-compile">
     <copy todir="${build.classes.dir}/org/apache/sis/util/iso">
       <fileset dir="${project.root}/core/sis-utility/src/main/resources/org/apache/sis/util/iso">
         <include name="class-index.properties"/>
@@ -26,10 +46,49 @@
     <!-- Following are classical properties resources files. -->
     <copy todir="${build.classes.dir}">
       <fileset dir="${project.root}/core/sis-utility/src/main/resources">
-        <include name="META-INF/services/*"/>
+        <include name="**/*.properties"/>
+      </fileset>
+      <fileset dir="${project.root}/application/sis-console/src/main/resources">
+        <include name="**/*.properties"/>
+      </fileset>
+    </copy>
+
+    <!-- FileTypeDetector implementations to be loaded by ServiceLoader. -->
+    <concat destfile="${build.classes.dir}/META-INF/services/java.nio.file.spi.FileTypeDetector" encoding="UTF-8" fixlastline="yes">
+      <fileset dir="${project.root}">
+        <include name="*/*/src/main/resources/META-INF/services/java.nio.file.spi.FileTypeDetector"/>
       </fileset>
-      <fileset dir="${project.root}/core/sis-metadata/src/main/resources">
-        <include name="META-INF/services/*"/>
+    </concat>
+
+    <!-- ObjectConverter implementations to be loaded by ServiceLoader. -->
+    <concat destfile="${build.classes.dir}/META-INF/services/org.apache.sis.util.ObjectConverter" encoding="UTF-8" fixlastline="yes">
+      <fileset dir="${project.root}">
+        <include name="*/*/src/main/resources/META-INF/services/org.apache.sis.util.ObjectConverter"/>
+      </fileset>
+    </concat>
+
+    <!-- TypeRegistration implementations to be loaded by ServiceLoader. -->
+    <concat destfile="${build.classes.dir}/META-INF/services/org.apache.sis.internal.jaxb.TypeRegistration" encoding="UTF-8" fixlastline="yes">
+      <fileset dir="${project.root}">
+        <include name="*/*/src/main/resources/META-INF/services/org.apache.sis.internal.jaxb.TypeRegistration"/>
+      </fileset>
+    </concat>
+
+    <!-- DataStoreProvider implementations to be loaded by ServiceLoader. -->
+    <concat destfile="${build.classes.dir}/META-INF/services/org.apache.sis.storage.DataStoreProvider" encoding="UTF-8" fixlastline="yes">
+      <fileset dir="${project.root}">
+        <include name="*/*/src/main/resources/META-INF/services/org.apache.sis.storage.DataStoreProvider"/>
+      </fileset>
+    </concat>
+  </target>
+
+  <!--
+    Called after compilation of test classes in order to copy test files.
+  -->
+  <target name="-post-compile-test">
+    <copy todir="${build.test.classes.dir}">
+      <fileset dir="${project.root}/core/sis-metadata/src/test/resources">
+        <include name="**/*.xml"/>
       </fileset>
     </copy>
   </target>



Mime
View raw message