You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2014/05/28 16:39:26 UTC

svn commit: r1598027 - in /sis/trunk: ./ core/sis-feature/src/main/java/org/apache/sis/feature/ core/sis-feature/src/test/java/org/apache/sis/feature/ core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ core/sis-referencing/src/main/java/org/a...

Author: desruisseaux
Date: Wed May 28 14:39:25 2014
New Revision: 1598027

URL: http://svn.apache.org/r1598027
Log:
Merge from the JDK6 branch.

Added:
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/Names.java
      - copied unchanged from r1598022, sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/Names.java
    sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/iso/NamesTest.java
      - copied unchanged from r1598022, sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/iso/NamesTest.java
Modified:
    sis/trunk/   (props changed)
    sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java
    sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java
    sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultOperation.java
    sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
    sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/package-info.java
    sis/trunk/core/sis-feature/src/test/java/org/apache/sis/feature/DefaultFeatureTypeTest.java
    sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/CustomMetadataTest.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Static.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/package-info.java
    sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
    sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/iso/NameMarshallingTest.java
    sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java

Propchange: sis/trunk/
------------------------------------------------------------------------------
  Merged /sis/branches/JDK8:r1597749-1598017
  Merged /sis/branches/JDK7:r1597768-1598021
  Merged /sis/branches/JDK6:r1597770-1598022

Modified: sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java?rev=1598027&r1=1598026&r2=1598027&view=diff
==============================================================================
--- sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java [UTF-8] (original)
+++ sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java [UTF-8] Wed May 28 14:39:25 2014
@@ -138,7 +138,7 @@ public class DefaultAssociationRole exte
         String p = titleProperty; // No synchronization - not a big deal if computed twice.
         if (p == null) {
             p = "";
-            for (final AbstractIdentifiedType type : valueType.getProperties(true)) {
+            for (final AbstractIdentifiedType type : valueType.getPropertyTypes(true)) {
                 if (type instanceof DefaultAttributeType<?>) {
                     final DefaultAttributeType<?> pt = (DefaultAttributeType<?>) type;
                     if (pt.getMaximumOccurs() != 0 && CharSequence.class.isAssignableFrom(pt.getValueClass())) {

Modified: sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java?rev=1598027&r1=1598026&r2=1598027&view=diff
==============================================================================
--- sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java [UTF-8] (original)
+++ sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java [UTF-8] Wed May 28 14:39:25 2014
@@ -41,8 +41,8 @@ import org.apache.sis.internal.util.Unmo
  * Abstraction of a real-world phenomena. A {@code FeatureType} instance describes the class of all
  * {@linkplain AbstractFeature feature} instances of that type.
  *
- * <div class="note"><b>Note:</b>
- * Compared to the Java language, {@code FeatureType} is equivalent to {@link Class} while
+ * <div class="note"><b>Analogy:</b>
+ * compared to the Java language, {@code FeatureType} is equivalent to {@link Class} while
  * {@code Feature} instances are equivalent to {@link Object} instances of that class.</div>
  *
  * <div class="warning"><b>Warning:</b>
@@ -56,17 +56,17 @@ import org.apache.sis.internal.util.Unmo
  * Names can be {@linkplain org.apache.sis.util.iso.DefaultScopedName scoped} for avoiding name collision.
  *
  * {@section Properties and inheritance}
- * Each feature type can provide descriptions for the following {@linkplain #getProperties(boolean) properties}:
+ * Each feature type can provide descriptions for the following {@link #getPropertyTypes(boolean) properties}:
  *
  * <ul>
  *   <li>{@linkplain DefaultAttributeType    Attributes}</li>
- *   <li>{@linkplain DefaultAssociationRole  Associations to other feature types}</li>
+ *   <li>{@linkplain DefaultAssociationRole  Associations to other features}</li>
  *   <li>{@linkplain DefaultOperation        Operations}</li>
  * </ul>
  *
  * In addition, a feature type can inherit the properties of one or more other feature types.
  * Properties defined in the sub-type can override properties of the same name defined in the
- * {@link #getSuperTypes() super-types}, provided that values of the sub-type property are
+ * {@linkplain #getSuperTypes() super-types}, provided that values of the sub-type property are
  * assignable to the super-type property.
  *
  * <div class="note"><b>Analogy:</b> compared to the Java language, the above rule is similar to overriding a method
@@ -133,7 +133,7 @@ public class DefaultFeatureType extends 
      * Any feature operation, any feature attribute type and any feature association role
      * that carries characteristics of a feature type.
      *
-     * @see #getProperties(boolean)
+     * @see #getPropertyTypes(boolean)
      */
     private final List<PropertyType> properties;
 
@@ -141,7 +141,7 @@ public class DefaultFeatureType extends 
      * All properties, including the ones declared in the super-types.
      * This is an unmodifiable view of the {@link #byName} values.
      *
-     * @see #getProperties(boolean)
+     * @see #getPropertyTypes(boolean)
      */
     private transient Collection<PropertyType> allProperties;
 
@@ -435,6 +435,10 @@ public class DefaultFeatureType extends 
      * However as a safety, this method also checks that all properties in this feature type is assignable
      * from a property of the same name in the given type.
      *
+     * <div class="note"><b>Analogy:</b>
+     * if we compare {@code FeatureType} to {@link Class} in the Java language, then this method is equivalent
+     * to {@link Class#isAssignableFrom(Class)}.</div>
+     *
      * @param  type The type to be checked.
      * @return {@code true} if instances of the given type can be assigned to association of this type.
      */
@@ -519,6 +523,10 @@ public class DefaultFeatureType extends 
     /**
      * Returns the direct parents of this feature type.
      *
+     * <div class="note"><b>Analogy:</b>
+     * if we compare {@code FeatureType} to {@link Class} in the Java language, then this method is equivalent
+     * to {@link Class#getSuperclass()} except that feature types allow multi-inheritance.</div>
+     *
      * <div class="warning"><b>Warning:</b>
      * The type of list elements will be changed to {@code FeatureType} if and when such interface
      * will be defined in GeoAPI.</div>
@@ -532,8 +540,8 @@ public class DefaultFeatureType extends 
     /**
      * Returns any feature operation, any feature attribute type and any feature association role that
      * carries characteristics of a feature type. The returned collection will include the properties
-     * inherited from the {@link #getSuperTypes() super-types} only if {@code includeSuperTypes} is
-     * {@code true}.
+     * inherited from the {@linkplain #getSuperTypes() super-types} only if {@code includeSuperTypes}
+     * is {@code true}.
      *
      * <div class="warning"><b>Warning:</b>
      * The type of list elements will be changed to {@code PropertyType} if and when such interface
@@ -545,7 +553,7 @@ public class DefaultFeatureType extends 
      *         feature type (not including parent types).
      */
     @SuppressWarnings("unchecked")
-    public Collection<AbstractIdentifiedType> getProperties(final boolean includeSuperTypes) {
+    public Collection<AbstractIdentifiedType> getPropertyTypes(final boolean includeSuperTypes) {
         /*
          * Cast is a workaround for "Apache SIS on GeoAPI 3.0" branch only (other branches do not need cast).
          * This is because GeoAPI 3.0 does not provide the 'org.opengis.feature.PropertyType' interface, and
@@ -577,6 +585,10 @@ public class DefaultFeatureType extends 
     /**
      * Creates a new feature instance of this type.
      *
+     * <div class="note"><b>Analogy:</b>
+     * if we compare {@code FeatureType} to {@link Class} and {@code Feature} to {@link Object} in the Java language,
+     * then this method is equivalent to {@link Class#newInstance()}.</div>
+     *
      * @return A new feature instance.
      * @throws IllegalStateException if this feature type {@linkplain #isAbstract() is abstract}.
      */

Modified: sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultOperation.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultOperation.java?rev=1598027&r1=1598026&r2=1598027&view=diff
==============================================================================
--- sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultOperation.java [UTF-8] (original)
+++ sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultOperation.java [UTF-8] Wed May 28 14:39:25 2014
@@ -62,7 +62,7 @@ public class DefaultOperation extends Pr
     /**
      * The type of the result, or {@code null} if none.
      */
-    private final DefaultAttributeType<?> result;
+    private final AbstractIdentifiedType result;
 
     /**
      * Constructs an operation from the given properties. The identification map is given unchanged to
@@ -73,7 +73,7 @@ public class DefaultOperation extends Pr
      * @param result         The type of the result, or {@code null} if none.
      */
     public DefaultOperation(final Map<String,?> identification,
-            final ParameterDescriptorGroup parameters, final DefaultAttributeType<?> result)
+            final ParameterDescriptorGroup parameters, final AbstractIdentifiedType result)
     {
         super(identification);
         ArgumentChecks.ensureNonNull("parameters", parameters);
@@ -95,7 +95,7 @@ public class DefaultOperation extends Pr
      *
      * @return The type of the result, or {@code null} if none.
      */
-    public DefaultAttributeType<?> getResult() {
+    public AbstractIdentifiedType getResult() {
         return result;
     }
 

Modified: sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java?rev=1598027&r1=1598026&r2=1598027&view=diff
==============================================================================
--- sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java [UTF-8] (original)
+++ sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java [UTF-8] Wed May 28 14:39:25 2014
@@ -168,7 +168,7 @@ header: for (int i=0; ; i++) {
          * Done writing the header. Now write all property rows.
          * Rows without value will be skipped only if optional.
          */
-        for (final AbstractIdentifiedType propertyType : featureType.getProperties(true)) {
+        for (final AbstractIdentifiedType propertyType : featureType.getPropertyTypes(true)) {
             Object value;
             if (feature != null) {
                 value = feature.getPropertyValue(propertyType.getName().toString());
@@ -207,7 +207,7 @@ header: for (int i=0; ; i++) {
                 valueType     = toString(pt.getValueType().getName());
                 valueClass    = AbstractFeature.class;
             } else if (propertyType instanceof DefaultOperation) {
-                final DefaultAttributeType<?> resultType = ((DefaultOperation) propertyType).getResult();
+                final AbstractIdentifiedType resultType = ((DefaultOperation) propertyType).getResult();
                 valueType   = toString(resultType.getName());
                 valueClass  = null;
                 minimumOccurs = -1;

Modified: sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/package-info.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/package-info.java?rev=1598027&r1=1598026&r2=1598027&view=diff
==============================================================================
--- sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/package-info.java [UTF-8] (original)
+++ sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/package-info.java [UTF-8] Wed May 28 14:39:25 2014
@@ -26,7 +26,7 @@
  *       {@linkplain org.apache.sis.feature.DefaultAttributeType attributes},
  *       {@linkplain org.apache.sis.feature.DefaultOperation operations} or
  *       {@linkplain org.apache.sis.feature.DefaultAssociationRole associations to other features}
- *       (collectively called “{@linkplain org.apache.sis.feature.DefaultFeatureType#getProperties(boolean) properties}”
+ *       (collectively called “{@linkplain org.apache.sis.feature.DefaultFeatureType#getPropertyTypes(boolean) properties}”
  *       or “characteristics”) that a feature can have.</p>
  *
  *       <div class="note"><b>Analogy:</b> a {@code FeatureType} in a Spatial Information System is equivalent to a

Modified: sis/trunk/core/sis-feature/src/test/java/org/apache/sis/feature/DefaultFeatureTypeTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-feature/src/test/java/org/apache/sis/feature/DefaultFeatureTypeTest.java?rev=1598027&r1=1598026&r2=1598027&view=diff
==============================================================================
--- sis/trunk/core/sis-feature/src/test/java/org/apache/sis/feature/DefaultFeatureTypeTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-feature/src/test/java/org/apache/sis/feature/DefaultFeatureTypeTest.java [UTF-8] Wed May 28 14:39:25 2014
@@ -149,8 +149,8 @@ public final strictfp class DefaultFeatu
      */
     private static void assertUnmodifiable(final DefaultFeatureType feature) {
         final Collection<?> superTypes         = feature.getSuperTypes();
-        final Collection<?> declaredProperties = feature.getProperties(false);
-        final Collection<?> allProperties      = feature.getProperties(true);
+        final Collection<?> declaredProperties = feature.getPropertyTypes(false);
+        final Collection<?> allProperties      = feature.getPropertyTypes(true);
         if (!superTypes.isEmpty()) try {
             superTypes.clear();
             fail("Super-types collection shall not be modifiable.");
@@ -179,7 +179,7 @@ public final strictfp class DefaultFeatu
      * This method tests the following {@code FeatureType} methods:
      *
      * <ul>
-     *   <li>{@link DefaultFeatureType#getProperties(boolean)}</li>
+     *   <li>{@link DefaultFeatureType#getPropertyTypes(boolean)}</li>
      *   <li>{@link DefaultFeatureType#getProperty(String)}</li>
      * </ul>
      *
@@ -192,7 +192,7 @@ public final strictfp class DefaultFeatu
             final String... expected)
     {
         int index = 0;
-        for (final AbstractIdentifiedType property : feature.getProperties(includeSuperTypes)) {
+        for (final AbstractIdentifiedType property : feature.getPropertyTypes(includeSuperTypes)) {
             assertTrue("Found more properties than expected.", index < expected.length);
             final String name = expected[index++];
             assertNotNull(name, property);
@@ -258,7 +258,7 @@ public final strictfp class DefaultFeatu
                 false, null, city, population, festival);
 
         assertUnmodifiable(complex);
-        final Collection<AbstractIdentifiedType> properties = complex.getProperties(false);
+        final Collection<AbstractIdentifiedType> properties = complex.getPropertyTypes(false);
         final Iterator<AbstractIdentifiedType> it = properties.iterator();
 
         assertEquals("name",            "Festival",                     complex.getName().toString());

Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/CustomMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/CustomMetadataTest.java?rev=1598027&r1=1598026&r2=1598027&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/CustomMetadataTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/CustomMetadataTest.java [UTF-8] Wed May 28 14:39:25 2014
@@ -101,13 +101,13 @@ public final strictfp class CustomMetada
             @Override public InternationalString getAbstract() {
                 Map<Locale, String> names = new HashMap<Locale, String>();
                 names.put(Locale.ENGLISH, "Description");
-                return DefaultFactories.NAMES.createInternationalString(names);
+                return DefaultFactories.SIS_NAMES.createInternationalString(names);
             }
 
             @Override public InternationalString getEnvironmentDescription() {
                 Map<Locale, String> names = new HashMap<Locale, String>();
                 names.put(Locale.ENGLISH, "Environment");
-                return DefaultFactories.NAMES.createInternationalString(names);
+                return DefaultFactories.SIS_NAMES.createInternationalString(names);
             }
 
             @Override public InternationalString                   getSupplementalInformation()    {return null;}

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java?rev=1598027&r1=1598026&r2=1598027&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java [UTF-8] Wed May 28 14:39:25 2014
@@ -43,6 +43,7 @@ import org.apache.sis.internal.jaxb.refe
 import org.apache.sis.internal.util.Numerics;
 import org.apache.sis.internal.util.UnmodifiableArrayList;
 import org.apache.sis.internal.referencing.WKTUtilities;
+import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.io.wkt.FormattableObject;
 import org.apache.sis.io.wkt.Formatter;
 import org.apache.sis.io.wkt.ElementKind;
@@ -312,11 +313,18 @@ public class AbstractIdentifiedObject ex
         // "alias": CharSequence, CharSequence[], GenericName or GenericName[]
         // -------------------------------------------------------------------
         value = properties.get(ALIAS_KEY);
+        final GenericName[] names;
         try {
-            alias = immutableSet(true, Types.toGenericNames(value, null));
+            /*
+             * Note: DefaultFactories.SIS_NAMES is guarantee to be a DefaultNameFactory class, not a sub-class.
+             * However for the purpose of this method, any sub-class would be okay. We should revisit this code
+             * with this flexibility in mind when we will use dependency injection.
+             */
+            names = DefaultFactories.SIS_NAMES.toGenericNames(value);
         } catch (ClassCastException e) {
             throw (IllegalArgumentException) illegalPropertyType(properties, ALIAS_KEY, value).initCause(e);
         }
+        alias = immutableSet(true, names);
 
         // -----------------------------------------------------------
         // "identifiers": ReferenceIdentifier or ReferenceIdentifier[]

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java?rev=1598027&r1=1598026&r2=1598027&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java [UTF-8] Wed May 28 14:39:25 2014
@@ -29,7 +29,7 @@ import org.apache.sis.util.iso.DefaultNa
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.5
  * @module
  */
 public final class DefaultFactories extends SystemListener {
@@ -37,6 +37,9 @@ public final class DefaultFactories exte
      * 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.
+     *
+     * <p>Note that this need to be the exact SIS class, not a user-provided subclass,
+     * otherwise we could not guarantee the above-cited requirement.</p>
      */
     public static final DefaultNameFactory SIS_NAMES = new DefaultNameFactory();
 

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Static.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Static.java?rev=1598027&r1=1598026&r2=1598027&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Static.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Static.java [UTF-8] Wed May 28 14:39:25 2014
@@ -55,6 +55,8 @@ package org.apache.sis.util;
  * <tr><th colspan="2" class="hsep">OGC/ISO objects (metadata, referencing, geometries)</th></tr>
  * <tr><td>{@link org.apache.sis.util.iso.Types}</td>
  *     <td>Provide UML identifier and description for GeoAPI types.</td></tr>
+ * <tr><td>{@link org.apache.sis.util.iso.Names}</td>
+ *     <td>Convenience methods for creating, parsing and formatting {@linkplain org.opengis.util.GenericName} objects.</td></tr>
  * <tr><td>{@link org.apache.sis.metadata.iso.citation.Citations}</td>
  *     <td>Pre-defined {@link org.opengis.metadata.citation.Citation}
  *         and methods for comparing against titles or identifiers.</td></tr>

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java?rev=1598027&r1=1598026&r2=1598027&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java [UTF-8] Wed May 28 14:39:25 2014
@@ -36,24 +36,28 @@ import org.apache.sis.internal.jdk7.Obje
 
 /**
  * Base class for sequence of identifiers rooted within the context of a {@linkplain DefaultNameSpace namespace}.
- * Names are <em>immutable</em>. They may be {@linkplain #toFullyQualifiedName() fully qualified}
- * like {@code "org.opengis.util.Record"}, or they may be relative to a {@linkplain #scope() scope}
- * like {@code "util.Record"} in the {@code "org.opengis"} scope.
- * See the {@linkplain GenericName GeoAPI javadoc} for an illustration.
+ * Names shall be <em>immutable</em> and thread-safe. A name can be local to a namespace.
+ * See the {@linkplain org.apache.sis.util.iso package javadoc} for an illustration of name anatomy.
  *
- * <p>Subclasses need only to implement the following methods:</p>
- * <ul>
- *   <li>{@link #scope()}</li>
- *   <li>{@link #getParsedNames()}</li>
- * </ul>
+ * <p>The easiest way to create a name is to use the {@link Names#createLocalName(CharSequence, CharSequence)}
+ * convenience static method. That method supports the common case where the name is made only of a
+ * (<var>namespace</var>, <var>local part</var>) pair of strings. However generic names allows finer grain.
+ * For example the above-cited strings can both be split into smaller name components.
+ * If such finer grain control is desired, {@link DefaultNameFactory} can be used instead of {@link Names}.</p>
  *
  * {@section <code>Comparable</code> ordering}
  * This class has a natural ordering that is inconsistent with {@link #equals(Object)}.
  * See {@link #compareTo(GenericName)} for more information.
  *
- * {@section Immutability and thread safety}
- * This base class is immutable and thread-safe. Subclasses shall make sure that any overridden methods
- * remain safe to call from multiple threads and do not change any public {@code GenericName} state.
+ * {@section Note for implemetors}
+ * Subclasses need only to implement the following methods:
+ * <ul>
+ *   <li>{@link #scope()}</li>
+ *   <li>{@link #getParsedNames()}</li>
+ * </ul>
+ *
+ * Subclasses shall make sure that any overridden methods remain safe to call from multiple threads
+ * and do not change any public {@code GenericName} state.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3 (derived from geotk-2.1)

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java?rev=1598027&r1=1598026&r2=1598027&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java [UTF-8] Wed May 28 14:39:25 2014
@@ -21,6 +21,8 @@ import java.util.List;
 import java.util.Arrays;
 import java.util.Locale;
 import java.util.ArrayList;
+import java.util.Collection;
+import org.opengis.metadata.Identifier;
 import org.opengis.util.TypeName;
 import org.opengis.util.NameSpace;
 import org.opengis.util.LocalName;
@@ -58,6 +60,7 @@ import static org.apache.sis.util.iso.De
  *
  * <ul>
  *   <li>{@link #parseGenericName(NameSpace, CharSequence)}</li>
+ *   <li>{@link #toGenericNames(Object)}</li>
  * </ul>
  *
  * {@section Thread safety}
@@ -67,7 +70,7 @@ import static org.apache.sis.util.iso.De
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.1)
- * @version 0.3
+ * @version 0.5
  * @module
  */
 public class DefaultNameFactory extends AbstractFactory implements NameFactory {
@@ -282,4 +285,90 @@ public class DefaultNameFactory extends 
         }
         return createGenericName(scope, names.toArray(new String[names.size()]));
     }
+
+    /**
+     * Converts the given value to an array of generic names. If the given value is an instance of
+     * {@link GenericName}, {@link String} or any other type enumerated below, then it is converted
+     * and returned in an array of length 1. If the given value is an array or a collection, then an
+     * array of same length is returned where each element has been converted.
+     *
+     * <p>Allowed types or element types are:</p>
+     * <ul>
+     *   <li>{@link GenericName}, to be casted and returned as-is.</li>
+     *   <li>{@link CharSequence} (usually a {@link String} or an {@link InternationalString}),
+     *       to be parsed as a generic name using the {@link DefaultNameSpace#DEFAULT_SEPARATOR ':'} separator.</li>
+     *   <li>{@link Identifier}, its {@linkplain Identifier#getCode() code} to be parsed as a generic name
+     *       using the {@link DefaultNameSpace#DEFAULT_SEPARATOR ':'} separator.</li>
+     * </ul>
+     *
+     * If {@code value} is an array or a collection containing {@code null} elements,
+     * then the corresponding element in the returned array will also be {@code null}.
+     *
+     * @param  value The object to cast into an array of generic names, or {@code null}.
+     * @return The generic names, or {@code null} if the given {@code value} was null.
+     *         Note that it may be the {@code value} reference itself casted to {@code GenericName[]}.
+     * @throws ClassCastException if {@code value} can't be casted.
+     *
+     * @since 0.5
+     */
+    public GenericName[] toGenericNames(Object value) throws ClassCastException {
+        if (value == null) {
+            return null;
+        }
+        GenericName name = toGenericName(value);
+        if (name != null) {
+            return new GenericName[] {
+                name
+            };
+        }
+        /*
+         * Above code checked for a singleton. Now check for a collection or an array.
+         */
+        final Object[] values;
+        if (value instanceof Object[]) {
+            values = (Object[]) value;
+            if (values instanceof GenericName[]) {
+                return (GenericName[]) values;
+            }
+        } else if (value instanceof Collection<?>) {
+            values = ((Collection<?>) value).toArray();
+        } else {
+            throw new ClassCastException(Errors.format(Errors.Keys.IllegalArgumentClass_2,
+                    "value", value.getClass()));
+        }
+        final GenericName[] names = new GenericName[values.length];
+        for (int i=0; i<values.length; i++) {
+            value = values[i];
+            if (value != null) {
+                name = toGenericName(value);
+                if (name == null) {
+                    throw new ClassCastException(Errors.format(Errors.Keys.IllegalArgumentClass_2,
+                            "value[" + i + ']', value.getClass()));
+                }
+                names[i] = name;
+            }
+        }
+        return names;
+    }
+
+    /**
+     * Creates a generic name from the given value. The value may be an instance of
+     * {@link GenericName}, {@link Identifier} or {@link CharSequence}. If the given
+     * object is not recognized, then this method returns {@code null}.
+     *
+     * @param  value The object to convert.
+     * @return The converted object, or {@code null} if {@code value} is not convertible.
+     */
+    private GenericName toGenericName(final Object value) {
+        if (value instanceof GenericName) {
+            return (GenericName) value;
+        }
+        if (value instanceof Identifier) {
+            return parseGenericName(null, ((Identifier) value).getCode());
+        }
+        if (value instanceof CharSequence) {
+            return parseGenericName(null, (CharSequence) value);
+        }
+        return null;
+    }
 }

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java?rev=1598027&r1=1598026&r2=1598027&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java [UTF-8] Wed May 28 14:39:25 2014
@@ -442,14 +442,34 @@ public class DefaultNameSpace implements
     }
 
     /**
-     * Returns a string representation of this namespace.
+     * Returns a JCR-like lexical form representation of this namespace.
+     * Following the <cite>Java Content Repository</cite> (JCR) convention,
+     * this method returns the string representation of {@linkplain #name()} between curly brackets.
      *
-     * @return A string representation of this namespace.
+     * <div class="note"><b>Example:</b> if the name of this namespace is “<code>org.apache.sis</code>”,
+     * then this method returns “<code>{org.apache.sis}</code>”.</div>
+     *
+     * {@section Usage}
+     * With this convention, it would be possible to create an <cite>expanded form</cite> of a generic name
+     * (except for escaping of illegal characters) with a simple concatenation as in the following code example:
+     *
+     * {@preformat java
+     *     GenericName name = ...; // A name
+     *     println("Expanded form = " + name.scope() + name);
+     * }
+     *
+     * However the convention followed by this {@code DefaultNameSpace} implementation is not specified in the
+     * {@link NameSpace} contract. This implementation follows the JCR convention for debugging convenience,
+     * but applications needing better guarantees should use {@link Names#toExpandedString(GenericName)} instead.
+     *
+     * @return A JCR-like lexical form of this namespace.
+     *
+     * @see Names#toExpandedString(GenericName)
      */
     @Debug
     @Override
     public String toString() {
-        return "NameSpace[\"" + name() + "\"]";
+        return new StringBuilder(name.length() + 2).append('{').append(name).append('}').toString();
     }
 
     /**

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java?rev=1598027&r1=1598026&r2=1598027&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java [UTF-8] Wed May 28 14:39:25 2014
@@ -19,7 +19,6 @@ package org.apache.sis.util.iso;
 import java.util.Map;
 import java.util.HashMap;
 import java.util.SortedMap;
-import java.util.Collection;
 import java.util.Locale;
 import java.util.Properties;
 import java.util.ResourceBundle;
@@ -50,8 +49,6 @@ import org.apache.sis.internal.system.De
  * This class provides:
  *
  * <ul>
- *   <li>{@link #toInternationalString(CharSequence)} and {@link #toGenericName(Object, NameFactory)}
- *       for creating name-related objects from various objects.</li>
  *   <li>{@link #getStandardName(Class)}, {@link #getListName(CodeList)} and {@link #getCodeName(CodeList)}
  *       for fetching ISO names if possible.</li>
  *   <li>{@link #getCodeTitle(CodeList)}, {@link #getDescription(CodeList)} and
@@ -62,7 +59,7 @@ import org.apache.sis.internal.system.De
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3 (derived from geotk-3.19)
- * @version 0.4
+ * @version 0.5
  * @module
  */
 public final class Types extends Static {
@@ -89,14 +86,15 @@ public final class Types extends Static 
     /**
      * Returns the ISO name for the given class, or {@code null} if none.
      * This method can be used for GeoAPI interfaces or {@link CodeList}.
-     * Examples:
      *
+     * <div class="note"><b>Examples:</b>
      * <ul>
      *   <li><code>getStandardName({@linkplain org.opengis.metadata.citation.Citation}.class)</code>
      *       (an interface) returns {@code "CI_Citation"}.</li>
      *   <li><code>getStandardName({@linkplain org.opengis.referencing.cs.AxisDirection}.class)</code>
      *       (a code list) returns {@code "CS_AxisDirection"}.</li>
      * </ul>
+     * </div>
      *
      * This method looks for the {@link UML} annotation on the given type. It does not search for
      * parent classes or interfaces if the given type is not directly annotated (i.e. {@code @UML}
@@ -131,13 +129,14 @@ public final class Types extends Static 
      * Returns the ISO classname (if available) or the Java classname (as a fallback)
      * of the given code. This method uses the {@link UML} annotation if it exists, or
      * fallback on the {@linkplain Class#getSimpleName() simple class name} otherwise.
-     * Examples:
      *
+     * <div class="note"><b>Examples:</b>
      * <ul>
      *   <li>{@code getListName(AxisDirection.NORTH)} returns {@code "CS_AxisDirection"}.</li>
      *   <li>{@code getListName(CharacterSet.UTF_8)} returns {@code "MD_CharacterSetCode"}.</li>
      *   <li>{@code getListName(ImagingCondition.BLURRED_IMAGE)} returns {@code "MD_ImagingConditionCode"}.</li>
      * </ul>
+     * </div>
      *
      * @param  code The code for which to get the class name, or {@code null}.
      * @return The ISO (preferred) or Java (fallback) class name, or {@code null} if the given code is null.
@@ -154,13 +153,14 @@ public final class Types extends Static 
     /**
      * Returns the ISO name (if available) or the Java name (as a fallback) of the given code.
      * If the code has no {@link UML} identifier, then the programmatic name is used as a fallback.
-     * Examples:
      *
+     * <div class="note"><b>Examples:</b>
      * <ul>
      *   <li>{@code getCodeName(AxisDirection.NORTH)} returns {@code "north"}.</li>
      *   <li>{@code getCodeName(CharacterSet.UTF_8)} returns {@code "utf8"}.</li>
      *   <li>{@code getCodeName(ImagingCondition.BLURRED_IMAGE)} returns {@code "blurredImage"}.</li>
      * </ul>
+     * </div>
      *
      * @param  code The code for which to get the name, or {@code null}.
      * @return The UML identifiers or programmatic name for the given code,
@@ -187,14 +187,15 @@ public final class Types extends Static 
      *
      * <p>The current heuristic implementation iterates over {@linkplain CodeList#names() all code names},
      * selects the longest one excluding the {@linkplain CodeList#name() field name} if possible, then
-     * {@linkplain CharSequences#camelCaseToSentence(CharSequence) makes a sentence} from that name.
-     * Examples:</p>
+     * {@linkplain CharSequences#camelCaseToSentence(CharSequence) makes a sentence} from that name.</p>
      *
+     * <div class="note"><b>Examples:</b>
      * <ul>
      *   <li>{@code getCodeLabel(AxisDirection.NORTH)} returns {@code "North"}.</li>
      *   <li>{@code getCodeLabel(CharacterSet.UTF_8)} returns {@code "UTF-8"}.</li>
      *   <li>{@code getCodeLabel(ImagingCondition.BLURRED_IMAGE)} returns {@code "Blurred image"}.</li>
      * </ul>
+     * </div>
      *
      * @param  code The code from which to get a title, or {@code null}.
      * @return A unlocalized title for the given code, or {@code null} if the given code is null.
@@ -461,12 +462,13 @@ public final class Types extends Static 
      * Returns the GeoAPI interface for the given ISO name, or {@code null} if none.
      * The identifier argument shall be the value documented in the {@link UML#identifier()}
      * annotation associated with the GeoAPI interface.
-     * Examples:
      *
+     * <div class="note"><b>Examples:</b>
      * <ul>
      *   <li>{@code forStandardName("CI_Citation")}      returns <code>{@linkplain org.opengis.metadata.citation.Citation}.class</code></li>
      *   <li>{@code forStandardName("CS_AxisDirection")} returns <code>{@linkplain org.opengis.referencing.cs.AxisDirection}.class</code></li>
      * </ul>
+     * </div>
      *
      * Only identifiers for the stable part of GeoAPI are recognized. This method does not handle
      * the identifiers for the {@code geoapi-pending} module.
@@ -552,25 +554,6 @@ public final class Types extends Static 
     }
 
     /**
-     * Returns the given characters sequence as an international string. If the given sequence is
-     * null or an instance of {@link InternationalString}, this this method returns it unchanged.
-     * Otherwise, this method copies the {@link InternationalString#toString()} value in a new
-     * {@link SimpleInternationalString} instance and returns it.
-     *
-     * @param  string The characters sequence to convert, or {@code null}.
-     * @return The given sequence as an international string,
-     *         or {@code null} if the given sequence was null.
-     *
-     * @see DefaultNameFactory#createInternationalString(Map)
-     */
-    public static InternationalString toInternationalString(final CharSequence string) {
-        if (string == null || string instanceof InternationalString) {
-            return (InternationalString) string;
-        }
-        return new SimpleInternationalString(string.toString());
-    }
-
-    /**
      * Returns an international string for the values in the given properties map, or {@code null} if none.
      * This method is used when a property in a {@link java.util.Map} may have many localized variants.
      * For example the given map may contains a {@code "remarks"} property defined by values associated to
@@ -679,11 +662,30 @@ public final class Types extends Static 
     }
 
     /**
+     * Returns the given characters sequence as an international string. If the given sequence is
+     * null or an instance of {@link InternationalString}, this this method returns it unchanged.
+     * Otherwise, this method copies the {@link InternationalString#toString()} value in a new
+     * {@link SimpleInternationalString} instance and returns it.
+     *
+     * @param  string The characters sequence to convert, or {@code null}.
+     * @return The given sequence as an international string,
+     *         or {@code null} if the given sequence was null.
+     *
+     * @see DefaultNameFactory#createInternationalString(Map)
+     */
+    public static InternationalString toInternationalString(final CharSequence string) {
+        if (string == null || string instanceof InternationalString) {
+            return (InternationalString) string;
+        }
+        return new SimpleInternationalString(string.toString());
+    }
+
+    /**
      * Returns the given array of {@code CharSequence}s as an array of {@code InternationalString}s.
      * If the given array is null or an instance of {@code InternationalString[]}, then this method
      * returns it unchanged. Otherwise a new array of type {@code InternationalString[]} is created
      * and every elements from the given array is copied or
-     * {@linkplain #toInternationalString(CharSequence) converted} in the new array.
+     * {@linkplain #toInternationalString(CharSequence) casted} in the new array.
      *
      * <p>If a defensive copy of the {@code strings} array is wanted, then the caller needs to check
      * if the returned array is the same instance than the one given in argument to this method.</p>
@@ -726,69 +728,17 @@ public final class Types extends Static 
      * @return The generic names, or {@code null} if the given {@code value} was null.
      *         Note that it may be the {@code value} reference itself casted to {@code GenericName[]}.
      * @throws ClassCastException if {@code value} can't be casted.
+     *
+     * @deprecated Moved to {@link DefaultNameFactory#toGenericNames(Object)}.
      */
+    @Deprecated
     public static GenericName[] toGenericNames(Object value, NameFactory factory) throws ClassCastException {
         if (value == null) {
             return null;
         }
-        if (factory == null) {
-            factory = DefaultFactories.NAMES;
-        }
-        GenericName name = toGenericName(value, factory);
-        if (name != null) {
-            return new GenericName[] {
-                name
-            };
-        }
-        /*
-         * Above code checked for a singleton. Now check for a collection or an array.
-         */
-        final Object[] values;
-        if (value instanceof Object[]) {
-            values = (Object[]) value;
-            if (values instanceof GenericName[]) {
-                return (GenericName[]) values;
-            }
-        } else if (value instanceof Collection<?>) {
-            values = ((Collection<?>) value).toArray();
-        } else {
-            throw new ClassCastException(Errors.format(Errors.Keys.IllegalArgumentClass_2,
-                    "value", value.getClass()));
-        }
-        final GenericName[] names = new GenericName[values.length];
-        for (int i=0; i<values.length; i++) {
-            value = values[i];
-            if (value != null) {
-                name = toGenericName(value, factory);
-                if (name == null) {
-                    throw new ClassCastException(Errors.format(Errors.Keys.IllegalArgumentClass_2,
-                            "value[" + i + ']', value.getClass()));
-                }
-                names[i] = name;
-            }
-        }
-        return names;
-    }
-
-    /**
-     * Creates a generic name from the given value. The value may be an instance of
-     * {@link GenericName}, {@link Identifier} or {@link CharSequence}. If the given
-     * object is not recognized, then this method returns {@code null}.
-     *
-     * @param  value The object to convert.
-     * @param  factory The factory to use for creating names.
-     * @return The converted object, or {@code null} if {@code value} is not convertible.
-     */
-    private static GenericName toGenericName(final Object value, final NameFactory factory) {
-        if (value instanceof GenericName) {
-            return (GenericName) value;
+        if (!(factory instanceof DefaultNameFactory)) {
+            factory = DefaultFactories.SIS_NAMES;
         }
-        if (value instanceof Identifier) {
-            return factory.parseGenericName(null, ((Identifier) value).getCode());
-        }
-        if (value instanceof CharSequence) {
-            return factory.parseGenericName(null, (CharSequence) value);
-        }
-        return null;
+       return ((DefaultNameFactory) factory).toGenericNames(value);
     }
 }

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/package-info.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/package-info.java?rev=1598027&r1=1598026&r2=1598027&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/package-info.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/package-info.java [UTF-8] Wed May 28 14:39:25 2014
@@ -38,6 +38,12 @@
  *       <li>{@link org.apache.sis.util.iso.DefaultScopedName} for a composite of a <cite>head</cite> name and a <cite>tail</cite> name.</li>
  *     </ul>
  *   </li>
+ *   <li>Static utility methods:
+ *     <ul>
+ *       <li>{@link org.apache.sis.util.iso.Types} for working with UML identifiers of GeoAPI types.</li>
+ *       <li>{@link org.apache.sis.util.iso.Names} for simple operations on {@code GenericName}.</li>
+ *     </ul>
+ *   </li>
  * </ul>
  *
  * {@section Anatomy of a name}
@@ -51,7 +57,7 @@
  * (<span style="background:LightSkyBlue"><var>path</var></span>.<span style="background:Yellow"><var>tip</var></span>)
  * pairs of attributes, respectively:
  *
- * <blockquote><table class="compact" style="border-spacing:21pt 0" summary="Anatomy of a name">
+ * <table class="compact" style="border-spacing:21pt 0; white-space: nowrap" summary="Anatomy of a name">
  *   <tr>
  *     <th>{@linkplain org.apache.sis.util.iso.AbstractName#scope() scope}.name</th>
  *     <th>{@linkplain org.apache.sis.util.iso.AbstractName#head() head}.{@linkplain org.apache.sis.util.iso.DefaultScopedName#tail() tail}</th>
@@ -84,11 +90,11 @@
  *     <td><code>org.apache.sis.util.<span style="background:Yellow">iso</span></code></td>
  *     <td>{@linkplain org.apache.sis.util.iso.DefaultLocalName Local name}</td>
  *   </tr>
- * </table></blockquote>
+ * </table>
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3 (derived from geotk-3.00)
- * @version 0.3
+ * @version 0.5
  * @module
  */
 @XmlSchema(elementFormDefault = XmlNsForm.QUALIFIED, namespace = Namespaces.GCO, xmlns = {

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java?rev=1598027&r1=1598026&r2=1598027&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java [UTF-8] Wed May 28 14:39:25 2014
@@ -85,6 +85,7 @@ import org.junit.BeforeClass;
     org.apache.sis.internal.util.LocalizedParseExceptionTest.class,
     org.apache.sis.util.iso.AbstractNameTest.class,
     org.apache.sis.util.iso.DefaultNameFactoryTest.class,
+    org.apache.sis.util.iso.NamesTest.class,
     org.apache.sis.internal.simple.SimpleReferenceIdentifierTest.class,
 
     // Measurements and formatting.

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/iso/NameMarshallingTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/iso/NameMarshallingTest.java?rev=1598027&r1=1598026&r2=1598027&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/iso/NameMarshallingTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/iso/NameMarshallingTest.java [UTF-8] Wed May 28 14:39:25 2014
@@ -85,7 +85,7 @@ public final strictfp class NameMarshall
      */
     @Test
     public void testLocalName() throws JAXBException {
-        final NameFactory factory = DefaultFactories.NAMES;
+        final NameFactory factory = DefaultFactories.SIS_NAMES;
         final LocalName name = factory.createLocalName(null, "An ordinary local name");
         assertEquals("An ordinary local name", name.toString());
         final String expected =
@@ -108,7 +108,7 @@ public final strictfp class NameMarshall
     @Test
     @DependsOnMethod("testLocalName")
     public void testLocalNameWithAmp() throws JAXBException {
-        final NameFactory factory = DefaultFactories.NAMES;
+        final NameFactory factory = DefaultFactories.SIS_NAMES;
         final LocalName name = factory.createLocalName(null, "A name with & and > and <.");
         assertEquals("A name with & and > and <.", name.toString());
         final String expected =
@@ -130,7 +130,7 @@ public final strictfp class NameMarshall
      */
     @Test
     public void testTypeName() throws JAXBException {
-        final NameFactory factory = DefaultFactories.NAMES;
+        final NameFactory factory = DefaultFactories.SIS_NAMES;
         final TypeName name = factory.createTypeName(null, "An other local name");
         assertEquals("An other local name", name.toString());
         final String expected =
@@ -156,7 +156,7 @@ public final strictfp class NameMarshall
      */
     @Test
     public void testScopedName() throws JAXBException {
-        final NameFactory factory = DefaultFactories.NAMES;
+        final NameFactory factory = DefaultFactories.SIS_NAMES;
         final GenericName name = factory.createGenericName(null, "myScope","myName");
         assertEquals("myScope:myName", name.toString());
         final String expected =

Modified: sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java?rev=1598027&r1=1598026&r2=1598027&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java [UTF-8] Wed May 28 14:39:25 2014
@@ -787,7 +787,7 @@ final class MetadataReader {
         String name = variable.getName();
         if (name != null && !(name = name.trim()).isEmpty()) {
             if (nameFactory == null) {
-                nameFactory = DefaultFactories.NAMES;
+                nameFactory = DefaultFactories.NAMES; // Real dependency injection to be used in a future version.
             }
             band.setSequenceIdentifier(nameFactory.createMemberName(null, name,
                     nameFactory.createTypeName(null, variable.getDataTypeName())));