sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tlpin...@apache.org
Subject svn commit: r1517321 [11/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/internal/jaxb/gco/PropertyType.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -28,7 +28,9 @@ import org.apache.sis.xml.Namespaces;
 import org.apache.sis.xml.IdentifierMap;
 import org.apache.sis.xml.IdentifierSpace;
 import org.apache.sis.xml.IdentifiedObject;
+import org.apache.sis.xml.ReferenceResolver;
 import org.apache.sis.internal.jaxb.Context;
+import org.apache.sis.internal.jaxb.PrimitiveTypeProperties;
 import org.apache.sis.util.iso.SimpleInternationalString;
 
 
@@ -112,12 +114,12 @@ public abstract class PropertyType<Value
         extends XmlAdapter<ValueType,BoundType>
 {
     /**
-     * The wrapped GeoAPI metadata interface.
+     * The wrapped GeoAPI metadata instance.
      */
     protected BoundType metadata;
 
     /**
-     * Either an {@link ObjectReference} or a {@link String}.
+     * Either {@code null}, an {@link ObjectReference} or a {@link String}.
      *
      * <ul>
      *   <li>{@link ObjectReference} defines the {@code idref}, {@code uuidref}, {@code xlink:href},
@@ -138,32 +140,84 @@ public abstract class PropertyType<Value
     }
 
     /**
-     * Builds an adapter for the given GeoAPI interface.
+     * Builds an adapter for the given primitive wrapper. This constructor checks for nil reasons
+     * only if {@code check} is {@code true}.
+     *
+     * @param value The primitive type wrapper.
+     * @param mayBeNil {@code true} if we should check for nil reasons.
+     */
+    PropertyType(final BoundType value, final boolean mayBeNil) {
+        metadata = value;
+        if (mayBeNil) {
+            final Object property = PrimitiveTypeProperties.property(value);
+            if (property instanceof NilReason) {
+                reference = property.toString();
+            }
+        }
+    }
+
+    /**
+     * Builds an adapter for the given GeoAPI interface. This constructor checks if the given metadata
+     * implements the {@link NilObject} or {@link IdentifiedObject} interface. If the object implements
+     * both of them (should not happen, but we never know), then the identifiers will have precedence.
      *
      * @param metadata The interface to wrap.
      */
     protected PropertyType(final BoundType metadata) {
         this.metadata = metadata;
+        /*
+         * Do not invoke NilReason.forObject(metadata) in order to avoid unnecessary synchronization.
+         * Subclasses will use the PropertyType(BoundType, boolean) constructor instead when a check
+         * for primitive type is required.
+         */
+        if (metadata instanceof NilObject) {
+            final NilReason reason = ((NilObject) metadata).getNilReason();
+            if (reason != null) {
+                reference = reason.toString();
+            }
+        }
         if (metadata instanceof IdentifiedObject) {
+            /*
+             * Get the identifiers as full UUID or XLink objects. We do not use the more permissive methods
+             * working with arbitrary strings -- e.g. map.get(IdentifierSpace.HREF) -- because we are going
+             * to use those values for marshalling REFERENCES to an externally-defined metadata object, not
+             * for declaring the attributes to marshal together with the metadata. Since references REPLACE
+             * the original metadata object, we are better to ensure that they are well formed - in case of
+             * doubt, we are better to marshal the full object. We are not loosing information since in the
+             * later case, the identifiers will be marshalled as Strings by ISOMetadata. Example:
+             *
+             *   <gmd:CI_Citation>
+             *     <gmd:series uuidref="f8f5fcb1-d57b-4013-b3a4-4eaa40df6dcf">      ☚ marshalled by this
+             *       <gmd:CI_Series uuid="f8f5fcb1-d57b-4013-b3a4-4eaa40df6dcf">    ☚ marshalled by ISOMetadata
+             *         ...
+             *       </gmd:CI_Series>
+             *     </gmd:series>
+             *   </gmd:CI_Citation>
+             *
+             * We do not try to parse UUID or XLink objects from String because it should be the job of
+             * org.apache.sis.internal.jaxb.IdentifierMapWithSpecialCases.put(Citation, String).
+             */
             final IdentifierMap map = ((IdentifiedObject) metadata).getIdentifierMap();
             XLink  link = map.getSpecialized(IdentifierSpace.XLINK);
             UUID   uuid = map.getSpecialized(IdentifierSpace.UUID);
-            String anyUUID = (uuid != null) ? uuid.toString() : map.get(IdentifierSpace.UUID);
-            if (anyUUID != null || link != null) {
-                final Context context = Context.current();
-                if (uuid == null) {
-                    uuid = ObjectReference.toUUID(context, anyUUID); // May still null.
+            if (uuid != null || link != null) {
+                final Context           context  = Context.current();
+                final ReferenceResolver resolver = Context.resolver(context);
+                final Class<BoundType>  type     = getBoundType();
+                /*
+                 * Check if the user gives us the permission to use reference to those identifiers.
+                 * If not, forget them in order to avoid marshalling the identifiers twice (see the
+                 * example in the above comment).
+                 */
+                if (uuid != null && !resolver.canSubstituteByReference(context, type, metadata, uuid)) {
+                    uuid = null;
                 }
-                if (uuid == null || Context.resolver(context).canSubstituteByReference(context, getBoundType(), metadata, uuid)) {
-                    reference = new ObjectReference(uuid, anyUUID, link);
-                    return;
+                if (link != null && !resolver.canSubstituteByReference(context, type, metadata, link)) {
+                    link = null;
+                }
+                if (uuid != null || link != null) {
+                    reference = new ObjectReference(uuid, link);
                 }
-            }
-        }
-        if (metadata instanceof NilObject) {
-            final NilReason reason = ((NilObject) metadata).getNilReason();
-            if (reason != null) {
-                reference = reason.toString();
             }
         }
     }
@@ -239,15 +293,9 @@ public abstract class PropertyType<Value
      * future implementations.
      *
      * @return {@code true} if the wrapped metadata should not be marshalled.
-     *
-     * @see #getElement()
      */
     protected final boolean skip() {
-        if (metadata instanceof NilObject) {
-            return true;
-        }
-        final Object ref = reference;
-        return (ref instanceof ObjectReference) && ((ObjectReference) ref).anyUUID != null;
+        return reference != null;
     }
 
     /**
@@ -258,27 +306,29 @@ public abstract class PropertyType<Value
      * @return the current value, or {@code null} if none.
      * @category gco:ObjectReference
      */
-    @XmlAttribute(name = "uuidref", namespace = Namespaces.GCO)
+    @XmlAttribute(name = "uuidref")  // Defined in "gco" as unqualified attribute.
     public final String getUUIDREF() {
         final ObjectReference ref = reference(false);
-        return (ref != null) ? ref.anyUUID : null;
+        return (ref != null) ? toString(ref.uuid) : null;
     }
 
     /**
      * Sets the {@code uuidref} attribute value.
      *
-     * @param uuid The new attribute value.
+     * @param  uuid The new attribute value.
+     * @throws IllegalArgumentException If the given UUID can not be parsed.
      * @category gco:ObjectReference
      */
-    public final void setUUIDREF(final String uuid) {
-        reference(true).anyUUID = uuid;
+    public final void setUUIDREF(final String uuid) throws IllegalArgumentException {
+        final Context context = Context.current();
+        reference(true).uuid = Context.converter(context).toUUID(context, uuid);
     }
 
     /**
      * Returns the given URI as a string, or returns {@code null} if the given argument is null.
      */
-    private static String toString(final Object uri) {
-        return (uri != null) ? uri.toString() : null;
+    private static String toString(final Object text) {
+        return (text != null) ? text.toString() : null;
     }
 
     /**
@@ -370,7 +420,7 @@ public abstract class PropertyType<Value
     @XmlAttribute(name = "title", namespace = Namespaces.XLINK)
     public final String getTitle() {
         final XLink link = xlink(false);
-        return (link != null) ? toString(link.getTitle()) : null;
+        return (link != null) ? StringAdapter.toString(link.getTitle()) : null;
     }
 
     /**
@@ -506,10 +556,9 @@ public abstract class PropertyType<Value
      * If the {@linkplain #metadata} is still null, tries to resolve it using UUID, XLink
      * or NilReason information. This method is invoked at unmarshalling time.
      *
-     * @throws URISyntaxException If a URI can not be parsed.
-     * @throws IllegalArgumentException If the UUID can not be parsed.
+     * @throws URISyntaxException If a nil reason is present and can not be parsed.
      */
-    final BoundType resolve(final Context context) throws URISyntaxException, IllegalArgumentException {
+    final BoundType resolve(final Context context) throws URISyntaxException {
         final ObjectReference ref = reference(false);
         if (ref != null) {
             metadata = ref.resolve(context, getBoundType(), metadata);

Modified: sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -34,11 +34,11 @@ import org.apache.sis.internal.jaxb.Cont
  * @version 0.3
  * @module
  */
-public final class StringAdapter extends XmlAdapter<GO_CharacterString, String> {
+public class StringAdapter extends XmlAdapter<GO_CharacterString, String> {
     /**
-     * Empty constructor for JAXB.
+     * Empty constructor for JAXB or subclasses.
      */
-    private StringAdapter() {
+    public StringAdapter() {
     }
 
     /**
@@ -48,28 +48,38 @@ public final class StringAdapter extends
      * If the context is {@code null} or does not specify any locale, then the choice
      * of locale is left to the {@link InternationalString#toString()} implementation.
      *
-     * @param  value The wrapper for the value, or {@code null}.
-     * @return The string representation of the given text, or {@code null}.
+     * @param  text The {@code CharSequence} to convert to a {@code String}, or {@code null}.
+     * @return The localized representation of the given text, or {@code null} if the text was null.
+     *
+     * @see org.apache.sis.xml.XML#LOCALE
      */
-    public static String toString(final GO_CharacterString value) {
-        if (value != null) {
-            final CharSequence text = value.toCharSequence();
-            if (text != null) {
-                if (text instanceof InternationalString) {
-                    final Context context = Context.current();
-                    if (context != null) {
-                        final Locale locale = context.getLocale();
-                        if (locale != null) {
-                            // While Apache SIS accepts null locale, foreigner
-                            // implementations are not guaranteed to support null.
-                            return ((InternationalString) text).toString(locale);
-                        }
-                    }
+    static String toString(final CharSequence text) {
+        if (text == null) {
+            return null;
+        }
+        if (text instanceof InternationalString) {
+            final Context context = Context.current();
+            if (context != null) {
+                final Locale locale = context.getLocale();
+                if (locale != null) {
+                    // While Apache SIS accepts null locale, foreigner
+                    // implementations are not guaranteed to support null.
+                    return ((InternationalString) text).toString(locale);
                 }
-                return text.toString();
             }
         }
-        return null;
+        return text.toString();
+    }
+
+    /**
+     * Returns the string representation of the given {@code GO_CharacterString} for the current locale.
+     * The locale is determined by the {@link org.apache.sis.xml.XML#LOCALE} property given to the marshaller.
+     *
+     * @param  value The wrapper for the value, or {@code null}.
+     * @return The string representation of the given text, or {@code null}.
+     */
+    public static String toString(final GO_CharacterString value) {
+        return (value != null) ? toString(value.toCharSequence()) : null;
     }
 
     /**
@@ -95,6 +105,6 @@ public final class StringAdapter extends
      */
     @Override
     public GO_CharacterString marshal(final String value) {
-        return CharSequenceAdapter.wrap(value, value);
+        return CharSequenceAdapter.wrap(Context.current(), value, value);
     }
 }

Modified: sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/URIAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/URIAdapter.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/URIAdapter.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/URIAdapter.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -23,20 +23,19 @@ import org.apache.sis.internal.jaxb.Cont
 
 
 /**
- * JAXB adapter wrapping a URI value with a {@code <gco:CharacterString>} element,
- * for ISO-19139 compliance.
+ * JAXB adapter wrapping a URI value with a {@code <gmx:FileName>} element, for ISO-19139 compliance.
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.5)
- * @version 0.3
+ * @version 0.4
  * @module
  */
 public final class URIAdapter extends XmlAdapter<GO_CharacterString, URI> {
     /**
      * Empty constructor for JAXB.
      */
-    private URIAdapter() {
+    public URIAdapter() {
     }
 
     /**
@@ -44,7 +43,7 @@ public final class URIAdapter extends Xm
      * JAXB calls automatically this method at unmarshalling time.
      *
      * @param  value The wrapper for the URI value, or {@code null}.
-     * @return An {@link URI} which represents the URI value, or {@code null}.
+     * @return A {@link URI} which represents the URI value, or {@code null}.
      * @throws URISyntaxException If the string is not a valid URI.
      */
     @Override
@@ -66,6 +65,16 @@ public final class URIAdapter extends Xm
      */
     @Override
     public GO_CharacterString marshal(final URI value) {
-        return (value != null) ? CharSequenceAdapter.wrap(value, value.toString()) : null;
+        if (value != null) {
+            final Context context = Context.current();
+            final GO_CharacterString wrapper = CharSequenceAdapter.wrap(context, value, value.toString());
+            if (wrapper != null) {
+                if (!Context.isFlagSet(context, Context.SUBSTITUTE_FILENAME)) {
+                    wrapper.type = GO_CharacterString.FILENAME;
+                }
+                return wrapper;
+            }
+        }
+        return null;
     }
 }

Modified: sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/package-info.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/package-info.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/package-info.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -79,7 +79,7 @@
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.5)
- * @version 0.3
+ * @version 0.4
  * @module
  *
  * @see javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter

Modified: sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -74,23 +74,6 @@ public abstract class CodeListAdapter<Va
     }
 
     /**
-     * Forces the initialization of the given code list class, since some
-     * calls to {@link CodeList#valueOf(Class, String)} are done whereas
-     * the constructor has not already been called.
-     *
-     * @param <T>  The code list type.
-     * @param type The code list class to initialize.
-     */
-    protected static <T extends CodeList<T>> void ensureClassLoaded(final Class<T> type) {
-        final String name = type.getName();
-        try {
-            Class.forName(name, true, type.getClassLoader());
-        } catch (ClassNotFoundException e) {
-            throw new TypeNotPresentException(name, e); // Should never happen.
-        }
-    }
-
-    /**
      * Wraps the proxy value into an adapter.
      *
      * @param proxy The proxy version of {@link CodeList}, to be marshalled.

Modified: sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -24,7 +24,6 @@ import javax.xml.bind.annotation.XmlType
 import javax.xml.bind.annotation.XmlValue;
 import org.opengis.util.CodeList;
 import org.apache.sis.util.iso.Types;
-import org.apache.sis.util.logging.Logging;
 import org.apache.sis.internal.jaxb.Context;
 
 
@@ -46,21 +45,13 @@ import org.apache.sis.internal.jaxb.Cont
 @XmlType(name = "CodeList", propOrder = { "codeSpace", "codeListValue", "codeList" })
 public final class CodeListProxy {
     /**
-     * Returns the URL to given code list in the given XML file.
-     *
-     * @param  context    The current (un)marshalling context, or {@code null} if none.
-     * @param  file       The XML file, either {@code "gmxCodelists.xml"} or {@code "ML_gmxCodelists.xml"}.
-     * @param  identifier The UML identifier of the code list.
-     * @return The URL to the given code list in the given schema.
+     * The default schema to be given to {@link Context#schema(Context, String, String)} (last argument).
      */
-    private static String schema(final Context context, final String file, final String identifier) {
-        return schema(Context.schema(context, "gmd", "http://schemas.opengis.net/iso/19139/20070417/"),
-                "resources/Codelist", file, identifier);
-    }
+    public static final String DEFAULT_SCHEMA = "http://schemas.opengis.net/iso/19139/20070417/";
 
     /**
-     * Returns the URL to a given code list in the given XML file. This method concatenates
-     * the base schema URL with the given directory, file and identifier.
+     * Returns the URL to a given code list in the given XML file.
+     * This method concatenates the base schema URL with the given file and identifier.
      * Some examples of strings returned by this method are:
      *
      * <ul>
@@ -69,23 +60,14 @@ public final class CodeListProxy {
      *   <li>{@code "http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#CI_OnLineFunctionCode"}</li>
      * </ul>
      *
-     * @param  schema     The schema, typically as a result of a call to
-     *                    {@link Context#schema(Context, String, String)}.
-     * @param  directory  The directory to concatenate, for example {@code "resources/uom"}
-     *                    or {@code "resources/Codelist"} (<strong>no trailing {@code '/'}</strong>).
-     * @param  file       The XML file, for example {@code "gmxUom.xml"}, {@code "gmxCodelists.xml"}
-     *                    or {@code "ML_gmxCodelists.xml"} (<strong>no trailing {@code '#'}</strong>).
+     * @param  context    The current (un)marshalling context, or {@code null} if none.
+     * @param  file       The XML file, either {@code "gmxCodelists.xml"} or {@code "ML_gmxCodelists.xml"}.
      * @param  identifier The UML identifier of the code list.
      * @return The URL to the given code list in the given schema.
      */
-    private static String schema(final String schema, final String directory, final String file, final String identifier) {
-        final StringBuilder buffer = new StringBuilder(128);
-        buffer.append(schema);
-        final int length = buffer.length();
-        if (length != 0 && buffer.charAt(length - 1) != '/') {
-            buffer.append('/');
-        }
-        return buffer.append(directory).append('/').append(file).append('#').append(identifier).toString();
+    private static String schema(final Context context, final String file, final String identifier) {
+        return Context.schema(context, "gmd", DEFAULT_SCHEMA).append("resources/Codelist/")
+                .append(file).append('#').append(identifier).toString();
     }
 
     /**
@@ -183,7 +165,7 @@ public final class CodeListProxy {
                 value = ResourceBundle.getBundle("org.opengis.metadata.CodeLists",
                         locale, CodeList.class.getClassLoader()).getString(key);
             } catch (MissingResourceException e) {
-                Logging.recoverableException(CodeListAdapter.class, "marshal", e);
+                Context.warningOccured(context, code, CodeListAdapter.class, "marshal", e, false);
             }
         }
         if (value != null) {

Modified: sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -45,7 +45,7 @@ import org.apache.sis.internal.jaxb.gco.
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.5)
- * @version 0.3
+ * @version 0.4
  * @module
  */
 @XmlType(name = "Country_PropertyType")
@@ -63,10 +63,10 @@ public final class Country extends GO_Ch
     }
 
     /**
-     * Builds a {@code <gco:CharacterString>} element.
+     * Builds a {@code <gco:Country>} element.
      * For private use by {@link #create(Context, Locale)} only.
      */
-    private Country(final GO_CharacterString code) {
+    private Country(final CharSequence code) {
         super(code);
     }
 
@@ -91,7 +91,7 @@ public final class Country extends GO_Ch
      * @return The country to marshal, or {@code null} if the given locale was null
      *         or if its {@link Locale#getCountry()} attribute is the empty string.
      */
-    static Country create(final Context context, final Locale locale) {
+    public static Country create(final Context context, final Locale locale) {
         if (locale != null) {
             final String codeListValue = Context.converter(context).toCountryCode(context, locale);
             if (!codeListValue.isEmpty() && Context.isFlagSet(context, Context.SUBSTITUTE_COUNTRY)) {
@@ -99,7 +99,7 @@ public final class Country extends GO_Ch
                  * Marshal the locale as a <gco:CharacterString> instead than <Country>,
                  * using the user-supplied anchors if any.
                  */
-                final GO_CharacterString string = CharSequenceAdapter.wrap(locale, codeListValue);
+                final CharSequence string = CharSequenceAdapter.value(context, locale, codeListValue);
                 if (string != null) {
                     return new Country(string);
                 }
@@ -131,7 +131,7 @@ public final class Country extends GO_Ch
      *
      * @see LanguageCode#getLocale(Context, LanguageCode, boolean)
      */
-    static Locale getLocale(final Country value) {
+    public static Locale getLocale(final Country value) {
         if (value != null) {
             String code = null;
             if (value.proxy != null) {

Modified: sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LanguageCode.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LanguageCode.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LanguageCode.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LanguageCode.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -61,10 +61,10 @@ public final class LanguageCode extends 
     }
 
     /**
-     * Builds a {@code <gco:CharacterString>} element.
+     * Builds a {@code <gco:LanguageCode>} element.
      * For private use by {@link #create(Context, Locale)} only.
      */
-    private LanguageCode(final GO_CharacterString code) {
+    private LanguageCode(final CharSequence code) {
         super(code);
     }
 
@@ -89,7 +89,7 @@ public final class LanguageCode extends 
      * @return The language to marshal, or {@code null} if the given locale was null
      *         or if its {@link Locale#getLanguage()} attribute is the empty string.
      */
-    static LanguageCode create(final Context context, final Locale locale) {
+    public static LanguageCode create(final Context context, final Locale locale) {
         if (locale != null) {
             final String codeListValue = Context.converter(context).toLanguageCode(context, locale);
             if (!codeListValue.isEmpty() && Context.isFlagSet(context, Context.SUBSTITUTE_LANGUAGE)) {
@@ -97,22 +97,17 @@ public final class LanguageCode extends 
                  * Marshal the locale as a <gco:CharacterString> instead than <LanguageCode>,
                  * using the user-supplied anchors if any.
                  */
-                final GO_CharacterString string = CharSequenceAdapter.wrap(locale, codeListValue);
+                final CharSequence string = CharSequenceAdapter.value(context, locale, codeListValue);
                 if (string != null) {
                     return new LanguageCode(string);
                 }
             }
-            String codeSpace = null;
-            String value = null;
-            if (context != null) {
-                final Locale marshalLocale = context.getLocale();
-                if (marshalLocale != null) {
-                    codeSpace = Context.converter(context).toLanguageCode(context, locale);
-                    value = locale.getDisplayLanguage(marshalLocale);
-                    if (value.isEmpty()) {
-                        value = null;
-                    }
-                }
+            final Locale marshalLocale = (context != null) ? context.getLocale() : null;
+            final String codeSpace = Context.converter(context).toLanguageCode(context, locale);
+            String value = (marshalLocale != null) ? locale.getDisplayLanguage(marshalLocale)
+                                                   : locale.getDisplayLanguage();
+            if (value.isEmpty()) {
+                value = null;
             }
             if (!codeListValue.isEmpty() || value != null) {
                 return new LanguageCode(context, codeListValue, codeSpace, value);
@@ -124,6 +119,7 @@ public final class LanguageCode extends 
     /**
      * Returns the locale for the given language (which may be null), or {@code null} if none.
      *
+     * @param context The current (un)marshalling context, or {@code null} if none.
      * @param value The wrapper for this metadata value.
      * @param useCharSequence Whatever this method should fallback on the
      *        {@code gco:CharacterString} element if no value were specified for the
@@ -132,7 +128,7 @@ public final class LanguageCode extends 
      *
      * @see Country#getLocale(Country)
      */
-    static Locale getLocale(final Context context, final LanguageCode value, final boolean useCharSequence) {
+    public static Locale getLocale(final Context context, final LanguageCode value, final boolean useCharSequence) {
         if (value != null) {
             final CodeListProxy proxy = value.proxy;
             if (proxy != null) {

Modified: sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LocaleAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LocaleAdapter.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LocaleAdapter.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LocaleAdapter.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -38,8 +38,8 @@ import org.apache.sis.internal.jaxb.Cont
  * @version 0.3
  * @module
  *
- * @see org.apache.sis.internal.jaxb.gmd.LanguageCode
- * @see org.apache.sis.internal.jaxb.gmd.PT_Locale
+ * @see LanguageCode
+ * @see org.apache.sis.internal.jaxb.code.PT_Locale
  */
 public final class LocaleAdapter extends XmlAdapter<LanguageCode, Locale> {
     /**

Modified: sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/package-info.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/package-info.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/package-info.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -28,7 +28,6 @@
  * @see javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter
  */
 @XmlSchema(elementFormDefault = XmlNsForm.QUALIFIED, namespace = Namespaces.GMD, xmlns = {
-    @XmlNs(prefix = "gmi", namespaceURI = Namespaces.GMI),
     @XmlNs(prefix = "gmd", namespaceURI = Namespaces.GMD),
     @XmlNs(prefix = "gco", namespaceURI = Namespaces.GCO)
 })

Modified: sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/Anchor.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/Anchor.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/Anchor.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/Anchor.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -96,6 +96,9 @@ public final class Anchor extends XLink 
 
     /**
      * Returns the text as a string, or {@code null} if none.
+     *
+     * @param  locale Ignored in current implementation.
+     * @return The anchor text, or {@code null} if none.
      */
     @Override
     public String toString(final Locale locale) {
@@ -120,7 +123,7 @@ public final class Anchor extends XLink 
 
     /**
      * Returns the sequence of characters in the given range of index.
-     * The returned object still an anchor with the same attribute values.
+     * The returned object is an anchor with the same attribute values.
      * It is caller responsibility to determine if those attributes are still
      * appropriate for the sub-sequence.
      */
@@ -131,7 +134,7 @@ public final class Anchor extends XLink 
             original = "";
         }
         final String substring = original.substring(start, end);
-        if (substring == original) {
+        if (substring == original) { // Identity comparison is ok here.
             return this;
         }
         return new Anchor(this, substring);

Modified: sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/package-info.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/package-info.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/package-info.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -20,7 +20,7 @@
  *
  * @author  Guilhem Legal (Geomatys)
  * @since   0.3 (derived from geotk-2.5)
- * @version 0.3
+ * @version 0.4
  * @module
  *
  * @see javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter

Modified: sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/Objects.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/Objects.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/Objects.java (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/Objects.java Sun Aug 25 15:49:51 2013
@@ -21,7 +21,7 @@ import java.util.Arrays;
 
 /**
  * Place holder for {@link java.util.Objects}.
- * This class will be deleted when we will be allowed to compile for JDK7.
+ * This class exists only on the JDK6 branch of SIS.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from GeoAPI)

Modified: sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/StandardCharsets.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/StandardCharsets.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/StandardCharsets.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/StandardCharsets.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -21,7 +21,7 @@ import java.nio.charset.Charset;
 
 /**
  * Place holder for {@link java.nio.charset.StandardCharsets}.
- * This class will be deleted when we will be allowed to compile for JDK7.
+ * This class exists only on the JDK6 branch of SIS.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from GeoAPI)

Modified: sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/JDK8.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/JDK8.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/JDK8.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/JDK8.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -17,6 +17,11 @@
 package org.apache.sis.internal.jdk8;
 
 import java.util.Date;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.Locale;
+import java.util.TimeZone;
+import java.util.concurrent.atomic.AtomicReference;
 import javax.xml.bind.DatatypeConverter;
 import org.apache.sis.util.CharSequences;
 
@@ -32,6 +37,13 @@ import org.apache.sis.util.CharSequences
  */
 public final class JDK8 {
     /**
+     * A shared Gregorian calendar to use for {@link #printDateTime(Date)}.
+     * We share a single instance instead than using {@link ThreadLocal} instances
+     * on the assumption that usages of this calendar will be relatively rare.
+     */
+    private static final AtomicReference<Calendar> CALENDAR = new AtomicReference<Calendar>();
+
+    /**
      * Do not allow instantiation of this class.
      */
     private JDK8() {
@@ -135,4 +147,29 @@ public final class JDK8 {
         }
         return null;
     }
+
+    /**
+     * Formats a date value in a string, assuming UTC timezone and US locale.
+     * This method should be used only for occasional formatting.
+     *
+     * <p>This method will be replaced by {@link java.time.format.DateTimeFormatter} on the JDK8 branch.</p>
+     *
+     * @param  date The date to format, or {@code null}.
+     * @return The formatted date, or {@code null} if the given date was null.
+     *
+     * @see DatatypeConverter#printDateTime(Calendar)
+     */
+    public static String printDateTime(final Date date) {
+        if (date == null) {
+            return null;
+        }
+        Calendar calendar = CALENDAR.getAndSet(null);
+        if (calendar == null) {
+            calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC"), Locale.US);
+        }
+        calendar.setTime(date);
+        final String text = DatatypeConverter.printDateTime(calendar);
+        CALENDAR.set(calendar); // Recycle for future usage.
+        return text;
+    }
 }

Modified: sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -34,9 +34,18 @@ import org.apache.sis.util.iso.DefaultNa
  */
 public final class DefaultFactories extends SystemListener {
     /**
-     * The factory to use for creating names.
+     * A name factory which is guaranteed to be an instance of SIS {@link DefaultNameFactory}.
+     * We use this factory when we need to ensure that the created names are instances of the
+     * SIS {@link org.apache.sis.util.iso.AbstractName} implementation.
      */
-    public static final DefaultNameFactory NAMES = new DefaultNameFactory();
+    public static final DefaultNameFactory SIS_NAMES = new DefaultNameFactory();
+
+    /**
+     * The factory to use for creating names, not necessarily SIS instances.
+     * This is fixed to {@link #SIS_NAMES} for now, but will probably be fetched in a more
+     * dynamic way later.
+     */
+    public static final DefaultNameFactory NAMES = SIS_NAMES;
 
     /**
      * Cache of factories which are found by {@code META-INF/services}.
@@ -77,11 +86,17 @@ public final class DefaultFactories exte
         T factory = type.cast(FACTORIES.get(type));
         if (factory == null && !FACTORIES.containsKey(type)) {
             for (final T candidate : ServiceLoader.load(type)) {
-                if (candidate.getClass().getName().startsWith("org.apache.sis.")) {
+                final Class<?> ct = candidate.getClass();
+                if (ct.getName().startsWith("org.apache.sis.")) {
                     factory = candidate;
                     break;
                 }
-                if (factory == null) {
+                /*
+                 * Select the first provider found in the iteration. If more than one provider is found,
+                 * select the most specialized type. This is okay only for relatively simple configurations,
+                 * while we are waiting for a real dependency injection mechanism.
+                 */
+                if (factory == null || factory.getClass().isAssignableFrom(ct)) {
                     factory = candidate;
                 }
             }

Modified: sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/system/Modules.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/system/Modules.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/system/Modules.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/system/Modules.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -41,6 +41,11 @@ public final class Modules {
     /**
      * The {@value} module name.
      */
+    public static final String STORAGE = "org.apache.sis.storage";
+
+    /**
+     * The {@value} module name.
+     */
     public static final String NETCDF = "org.apache.sis.storage.netcdf";
 
     /**

Modified: sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -27,6 +27,7 @@ import org.apache.sis.util.Static;
 
 import static org.apache.sis.util.CharSequences.equalsFiltered;
 import static org.apache.sis.util.CharSequences.trimWhitespaces;
+import static org.apache.sis.util.CharSequences.isUnicodeIdentifier;
 import static org.apache.sis.util.Characters.Filter.LETTERS_AND_DIGITS;
 
 
@@ -65,6 +66,15 @@ public final class Citations extends Sta
     }
 
     /**
+     * Returns a "unlocalized" string representation of the given international string,
+     * or {@code null} if none. This method is used by {@link #getIdentifier(Citation)},
+     * which is why we don't want the localized string.
+     */
+    private static String toString(final InternationalString title) {
+        return (title != null) ? trimWhitespaces(title.toString(Locale.ROOT)) : null;
+    }
+
+    /**
      * Returns {@code true} if at least one {@linkplain Citation#getTitle() title} or
      * {@linkplain Citation#getAlternateTitles() alternate title} in {@code c1} is leniently
      * equal to a title or alternate title in {@code c2}. The comparison is case-insensitive
@@ -223,15 +233,37 @@ public final class Citations extends Sta
     }
 
     /**
-     * Returns the shortest identifier for the specified citation, or the title if there is
-     * no identifier. This method is useful for extracting the namespace from an authority,
-     * for example {@code "EPSG"}.
+     * Infers an identifier from the given citation, or returns {@code null} if no identifier has been found.
+     * This method is useful for extracting the namespace from an authority, for example {@code "EPSG"}.
+     * The implementation performs the following choices:
+     *
+     * <ul>
+     *   <li>If the given citation is {@code null}, then this method returns {@code null}.</li>
+     *   <li>Otherwise if the citation contains at least one {@linkplain Citation#getIdentifiers() identifier}, then:
+     *     <ul>
+     *       <li>If at least one identifier is a {@linkplain org.apache.sis.util.CharSequences#isUnicodeIdentifier
+     *           unicode identifier}, then the shortest of those identifiers is returned.</li>
+     *       <li>Otherwise the shortest identifier is returned, despite not being a Unicode identifier.</li>
+     *     </ul></li>
+     *   <li>Otherwise if the citation contains at least one {@linkplain Citation#getTitle() title} or
+     *       {@linkplain Citation#getAlternateTitles() alternate title}, then:
+     *     <ul>
+     *       <li>If at least one title is a {@linkplain org.apache.sis.util.CharSequences#isUnicodeIdentifier
+     *           unicode identifier}, then the shortest of those titles is returned.</li>
+     *       <li>Otherwise the shortest title is returned, despite not being a Unicode identifier.</li>
+     *     </ul></li>
+     *   <li>Otherwise this method returns {@code null}.</li>
+     * </ul>
+     *
+     * This method searches in alternate titles as a fallback because ISO specification said
+     * that those titles are often used for abbreviations.
      *
      * @param  citation The citation for which to get the identifier, or {@code null}.
-     * @return The shortest identifier of the given citation, or {@code null} if the
-     *         given citation was null or doesn't declare any identifier or title.
+     * @return An identifier for the given citation, or {@code null} if the given citation is null
+     *         or does not declare any identifier or title.
      */
     public static String getIdentifier(final Citation citation) {
+        boolean isUnicode = false; // Whether 'identifier' is a Unicode identifier.
         String identifier = null;
         if (citation != null) {
             final Iterator<? extends Identifier> it = iterator(citation.getIdentifiers());
@@ -241,18 +273,43 @@ public final class Citations extends Sta
                     final String candidate = trimWhitespaces(id.getCode());
                     if (candidate != null) {
                         final int length = candidate.length();
-                        if (length != 0) {
-                            if (identifier == null || length < identifier.length()) {
+                        if (length != 0 && (identifier == null || length < identifier.length())) {
+                            final boolean s = isUnicodeIdentifier(candidate);
+                            if (s || !isUnicode) {
                                 identifier = candidate;
+                                isUnicode = s;
                             }
                         }
                     }
                 }
             }
+            /*
+             * If no identifier has been found, fallback on the shortest title or alternate title.
+             * We search for alternate titles because ISO specification said that those titles are
+             * often used for abbreviations.
+             */
             if (identifier == null) {
-                final InternationalString title = citation.getTitle();
-                if (title != null) {
-                    identifier = title.toString();
+                identifier = toString(citation.getTitle());
+                if (identifier != null) {
+                    if (identifier.isEmpty()) {
+                        identifier = null;
+                    } else {
+                        isUnicode = isUnicodeIdentifier(identifier);
+                    }
+                }
+                final Iterator<? extends InternationalString> iterator = iterator(citation.getAlternateTitles());
+                if (iterator != null) while (iterator.hasNext()) {
+                    final String candidate = toString(iterator.next());
+                    if (candidate != null) {
+                        final int length = candidate.length();
+                        if (length != 0 && (identifier == null || length < identifier.length())) {
+                            final boolean s = isUnicodeIdentifier(candidate);
+                            if (s || !isUnicode) {
+                                identifier = candidate;
+                                isUnicode = s;
+                            }
+                        }
+                    }
                 }
             }
         }

Modified: sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/util/LocalizedParseException.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/util/LocalizedParseException.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/util/LocalizedParseException.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/util/LocalizedParseException.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -54,7 +54,7 @@ public final class LocalizedParseExcepti
     private final Locale locale;
 
     /**
-     * The resources key as one of the {@link Errors.Keys} constant.
+     * The resources key as one of the {@code Errors.Keys} constant.
      */
     private final int key;
 
@@ -68,7 +68,7 @@ public final class LocalizedParseExcepti
      * and message arguments. This is the most generic constructor.
      *
      * @param locale      The locale for {@link #getLocalizedMessage()}.
-     * @param key         The resource key as one of the {@link Errors.Keys} constant.
+     * @param key         The resource key as one of the {@code Errors.Keys} constant.
      * @param arguments   The value of {@link #arguments(String, ParsePosition)}.
      * @param errorOffset The position where the error is found while parsing.
      */
@@ -81,11 +81,11 @@ public final class LocalizedParseExcepti
 
     /**
      * Constructs a {@code ParseException} with a message formatted from the given resource key
-     * and unparseable string. This convenience constructor fetches the word starting at the error
+     * and unparsable string. This convenience constructor fetches the word starting at the error
      * index, and uses that word as the single argument associated to the resource key.
      *
      * @param locale      The locale for {@link #getLocalizedMessage()}.
-     * @param key         The resource key as one of the {@link Errors.Keys} constant.
+     * @param key         The resource key as one of the {@code Errors.Keys} constant.
      * @param text        The full text that {@code Format} failed to parse.
      * @param errorOffset The position where the error is found while parsing.
      */

Modified: sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/util/TemporalUtilities.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/util/TemporalUtilities.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/util/TemporalUtilities.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/util/TemporalUtilities.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -45,9 +45,10 @@ public final class TemporalUtilities ext
     /**
      * Returns a temporal factory if available.
      *
+     * @return The temporal factory.
      * @throws UnsupportedOperationException If the temporal factory is not available on the classpath.
      */
-    private static TemporalFactory getTemporalFactory() throws UnsupportedOperationException {
+    public static TemporalFactory getTemporalFactory() throws UnsupportedOperationException {
         final TemporalFactory factory = DefaultFactories.forClass(TemporalFactory.class);
         if (factory != null) {
             return factory;

Modified: sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -19,6 +19,7 @@ package org.apache.sis.internal.util;
 import java.util.Formatter;
 import java.util.FormattableFlags;
 import org.apache.sis.util.Static;
+import org.apache.sis.util.Classes;
 import org.apache.sis.util.CharSequences;
 
 import static java.lang.Math.abs;
@@ -30,7 +31,7 @@ import static java.lang.Math.max;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-3.00)
- * @version 0.3
+ * @version 0.4
  * @module
  */
 public final class Utilities extends Static {
@@ -117,6 +118,37 @@ public final class Utilities extends Sta
     }
 
     /**
+     * Returns a string representation of an instance of the given class having the given properties.
+     * This is a convenience method for implementation of {@link Object#toString()} methods that are
+     * used mostly for debugging purpose.
+     *
+     * @param  classe     The class to format.
+     * @param  properties The (<var>key</var>=</var>value</var>) pairs.
+     * @return A string representation of an instance of the given class having the given properties.
+     *
+     * @since 0.4
+     */
+    public static String toString(final Class<?> classe, final Object... properties) {
+        final StringBuffer buffer = new StringBuffer(32).append(Classes.getShortName(classe)).append('[');
+        boolean isNext = false;
+        for (int i=0; i<properties.length; i++) {
+            final Object value = properties[++i];
+            if (value != null) {
+                if (isNext) {
+                    buffer.append(", ");
+                }
+                buffer.append(properties[i-1]).append('=');
+                final boolean isText = (value instanceof CharSequence);
+                if (isText) buffer.append('“');
+                buffer.append(value);
+                if (isText) buffer.append('”');
+                isNext = true;
+            }
+        }
+        return buffer.append(']').toString();
+    }
+
+    /**
      * Formats the given character sequence to the given formatter. This method takes in account
      * the {@link FormattableFlags#UPPERCASE} and {@link FormattableFlags#LEFT_JUSTIFY} flags.
      *

Modified: sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -389,7 +389,7 @@ public abstract class CompoundFormat<T> 
         } else if (valueType == Date.class) {
             final DateFormat format;
             if (!Locale.ROOT.equals(locale)) {
-                format = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, locale);
+                format = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, locale);
             } else {
                 format = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.ROOT);
             }

Modified: sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/io/IO.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/io/IO.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/io/IO.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/io/IO.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -23,7 +23,7 @@ import java.io.Writer;
 import java.io.StringWriter;
 import java.io.CharArrayWriter;
 import org.apache.sis.util.Static;
-import org.apache.sis.util.resources.Messages;
+import org.apache.sis.util.resources.Vocabulary;
 
 
 /**
@@ -143,7 +143,7 @@ public final class IO extends Static {
         if (content != null) {
             return content.toString();
         }
-        return Messages.format(Messages.Keys.UnavailableContent);
+        return Vocabulary.format(Vocabulary.Keys.UnavailableContent);
     }
 
     /**

Modified: sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/measure/Angle.java
URL: http://svn.apache.org/viewvc/sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/measure/Angle.java?rev=1517321&r1=1517320&r2=1517321&view=diff
==============================================================================
--- sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/measure/Angle.java [UTF-8] (original)
+++ sis/branches/Shapefile/core/sis-utility/src/main/java/org/apache/sis/measure/Angle.java [UTF-8] Sun Aug 25 15:49:51 2013
@@ -241,7 +241,7 @@ public class Angle implements Comparable
     private static Format getAngleFormat() {
         assert Thread.holdsLock(Angle.class);
         if (format == null) {
-            format = AngleFormat.getInstance(Locale.ROOT);
+            format = new AngleFormat(Locale.ROOT);
         }
         return format;
     }



Mime
View raw message