sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1615100 - in /sis/branches/JDK7: ./ core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/ core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/...
Date Fri, 01 Aug 2014 13:49:29 GMT
Author: desruisseaux
Date: Fri Aug  1 13:49:29 2014
New Revision: 1615100

URL: http://svn.apache.org/r1615100
Log:
Merge from the JDK8 branch.

Added:
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/LegacyCodes.java
      - copied unchanged from r1615098, sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/xml/LegacyCodes.java
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/xml/LegacyCodesTest.java
      - copied unchanged from r1615098, sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/xml/LegacyCodesTest.java
Modified:
    sis/branches/JDK7/   (props changed)
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MD_CharacterSetCode.java
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/PT_Locale.java
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java
    sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
    sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/CustomMetadataTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ReferencingInMetadataTest.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/EnumAdapter.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/ValueConverter.java
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/mock/MetadataMock.java
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/TypesTest.java
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/xml/ValueConverterTest.java
    sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/XMLStoreTest.java

Propchange: sis/branches/JDK7/
------------------------------------------------------------------------------
  Merged /sis/branches/JDK8:r1614720-1615098

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MD_CharacterSetCode.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MD_CharacterSetCode.java?rev=1615100&r1=1615099&r2=1615100&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MD_CharacterSetCode.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MD_CharacterSetCode.java [UTF-8] Fri Aug  1 13:49:29 2014
@@ -16,50 +16,67 @@
  */
 package org.apache.sis.internal.jaxb.code;
 
+import java.util.Locale;
+import java.nio.charset.Charset;
+import java.nio.charset.IllegalCharsetNameException;
 import javax.xml.bind.annotation.XmlElement;
-import org.opengis.metadata.identification.CharacterSet;
-import org.apache.sis.internal.jaxb.gmd.CodeListAdapter;
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+import org.apache.sis.xml.ValueConverter;
+import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.internal.jaxb.gmd.CodeListProxy;
 
 
 /**
- * JAXB adapter for {@link CharacterSet}, in order to integrate the value in an element
+ * JAXB adapter for {@link Charset}, in order to integrate the value in an element
  * complying with ISO-19139 standard. See package documentation for more information about
  * the handling of {@code CodeList} in ISO-19139.
  *
  * @author  Cédric Briançon (Geomatys)
+ * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.5)
- * @version 0.3
+ * @version 0.5
  * @module
  */
-public final class MD_CharacterSetCode extends CodeListAdapter<MD_CharacterSetCode, CharacterSet> {
+public final class MD_CharacterSetCode extends XmlAdapter<MD_CharacterSetCode, Charset> {
     /**
-     * Empty constructor for JAXB only.
+     * A proxy form of the {@link CodeList}.
      */
-    public MD_CharacterSetCode() {
-    }
-
-    /**
-     * Creates a new adapter for the given proxy.
-     */
-    private MD_CharacterSetCode(final CodeListProxy proxy) {
-        super(proxy);
-    }
+    private CodeListProxy proxy;
 
     /**
-     * {@inheritDoc}
+     * Substitutes the adapter value read from an XML stream by the object which will
+     * contains the value. JAXB calls automatically this method at unmarshalling time.
+     *
+     * @param  adapter The adapter for this metadata value.
+     * @return A code list which represents the metadata value.
      */
     @Override
-    protected MD_CharacterSetCode wrap(CodeListProxy proxy) {
-        return new MD_CharacterSetCode(proxy);
+    public final Charset unmarshal(final MD_CharacterSetCode adapter) throws IllegalCharsetNameException {
+        final Context context = Context.current();
+        return Context.converter(context).toCharset(context, adapter.proxy.identifier());
     }
 
     /**
-     * {@inheritDoc}
+     * Substitutes the code list by the adapter to be marshalled into an XML file
+     * or stream. JAXB calls automatically this method at marshalling time.
+     *
+     * @param  value The code list value.
+     * @return The adapter for the given code list.
      */
     @Override
-    protected Class<CharacterSet> getCodeListClass() {
-        return CharacterSet.class;
+    public final MD_CharacterSetCode marshal(final Charset value) {
+        final Context context = Context.current();
+        final ValueConverter converter = Context.converter(context);
+        final String code = converter.toCharsetCode(context, value);
+        if (code != null) {
+            final Locale locale = context.getLocale();
+            final MD_CharacterSetCode c = new MD_CharacterSetCode();
+            c.proxy = new CodeListProxy(context, "MD_CharacterSetCode", code,
+                    (locale != null) ? converter.toLanguageCode(context, locale) : null,
+                    (locale != null) ? value.displayName(locale) : value.displayName());
+            return c;
+        }
+        return null;
     }
 
     /**
@@ -67,7 +84,6 @@ public final class MD_CharacterSetCode e
      *
      * @return The value to be marshalled.
      */
-    @Override
     @XmlElement(name = "MD_CharacterSetCode")
     public CodeListProxy getElement() {
         return proxy;

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/PT_Locale.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/PT_Locale.java?rev=1615100&r1=1615099&r2=1615100&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/PT_Locale.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/PT_Locale.java [UTF-8] Fri Aug  1 13:49:29 2014
@@ -17,14 +17,13 @@
 package org.apache.sis.internal.jaxb.code;
 
 import java.util.Locale;
+import java.nio.charset.Charset;
 import javax.xml.bind.Marshaller;
 import javax.xml.bind.PropertyException;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.adapters.XmlAdapter;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import org.opengis.metadata.identification.CharacterSet;
-import org.apache.sis.util.iso.Types;
 import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.internal.jaxb.gmd.Country;
 import org.apache.sis.internal.jaxb.gmd.LanguageCode;
@@ -105,7 +104,7 @@ public final class PT_Locale extends Xml
          */
         @XmlElement(required = true)
         @XmlJavaTypeAdapter(MD_CharacterSetCode.class)
-        CharacterSet characterEncoding;
+        Charset characterEncoding;
 
         /**
          * Empty constructor for JAXB only.
@@ -141,7 +140,8 @@ public final class PT_Locale extends Xml
                 return;
             }
             if (encoding != null) {
-                characterEncoding = Types.forCodeName(CharacterSet.class, encoding, true);
+                final Context context = Context.current();
+                characterEncoding = Context.converter(context).toCharset(context, encoding);
             }
         }
     }

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java?rev=1615100&r1=1615099&r2=1615100&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java [UTF-8] Fri Aug  1 13:49:29 2014
@@ -19,6 +19,7 @@ package org.apache.sis.metadata.iso;
 import java.util.Date;
 import java.util.Locale;
 import java.util.Collection;
+import java.nio.charset.Charset;
 import javax.xml.bind.Marshaller;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlSeeAlso;
@@ -34,7 +35,6 @@ import org.opengis.metadata.citation.Res
 import org.opengis.metadata.constraint.Constraints;
 import org.opengis.metadata.content.ContentInformation;
 import org.opengis.metadata.distribution.Distribution;
-import org.opengis.metadata.identification.CharacterSet;
 import org.opengis.metadata.identification.Identification;
 import org.opengis.metadata.maintenance.MaintenanceInformation;
 import org.opengis.metadata.maintenance.ScopeCode;
@@ -108,7 +108,7 @@ public class DefaultMetadata extends ISO
     /**
      * Serial number for inter-operability with different versions.
      */
-    private static final long serialVersionUID = 7337533776231004504L;
+    private static final long serialVersionUID = -5374952007292101340L;
 
     /**
      * Unique identifier for this metadata file, or {@code null} if none.
@@ -129,7 +129,7 @@ public class DefaultMetadata extends ISO
     /**
      * Full name of the character coding standard used for the metadata set.
      */
-    private CharacterSet characterSet;
+    private Charset characterSet;
 
     /**
      * File identifier of the metadata to which this metadata is a subset (child).
@@ -392,22 +392,22 @@ public class DefaultMetadata extends ISO
     }
 
     /**
-     * Returns the full name of the character coding standard used for the metadata set.
+     * Returns the character coding standard used for the metadata set.
      *
-     * @return character coding standard used for the metadata, or {@code null}.
+     * @return Character coding standard used for the metadata, or {@code null}.
      */
     @Override
     @XmlElement(name = "characterSet")
-    public CharacterSet getCharacterSet()  {
+    public Charset getCharacterSet()  {
         return characterSet;
     }
 
     /**
-     * Sets the full name of the character coding standard used for the metadata set.
+     * Sets the character coding standard used for the metadata set.
      *
      * @param newValue The new character set.
      */
-    public void setCharacterSet(final CharacterSet newValue) {
+    public void setCharacterSet(final Charset newValue) {
         checkWritePermission();
         characterSet = newValue;
     }

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java?rev=1615100&r1=1615099&r2=1615100&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java [UTF-8] Fri Aug  1 13:49:29 2014
@@ -18,12 +18,12 @@ package org.apache.sis.metadata.iso.iden
 
 import java.util.Collection;
 import java.util.Locale;
+import java.nio.charset.Charset;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import org.opengis.metadata.extent.Extent;
 import org.opengis.metadata.citation.Citation;
-import org.opengis.metadata.identification.CharacterSet;
 import org.opengis.metadata.identification.TopicCategory;
 import org.opengis.metadata.identification.DataIdentification;
 import org.opengis.util.InternationalString;
@@ -63,7 +63,7 @@ public class DefaultDataIdentification e
     /**
      * Serial number for compatibility with different versions.
      */
-    private static final long serialVersionUID = 6104637930243499850L;
+    private static final long serialVersionUID = 6104637930243499851L;
 
     /**
      * Language(s) used within the dataset.
@@ -73,7 +73,7 @@ public class DefaultDataIdentification e
     /**
      * Full name of the character coding standard used for the dataset.
      */
-    private Collection<CharacterSet> characterSets;
+    private Collection<Charset> characterSets;
 
     /**
      * Description of the dataset in the producer’s processing environment, including items
@@ -123,7 +123,7 @@ public class DefaultDataIdentification e
         super(object);
         if (object != null) {
             languages                  = copyCollection(object.getLanguages(), Locale.class);
-            characterSets              = copyCollection(object.getCharacterSets(), CharacterSet.class);
+            characterSets              = copyCollection(object.getCharacterSets(), Charset.class);
             environmentDescription     = object.getEnvironmentDescription();
             supplementalInformation    = object.getSupplementalInformation();
         }
@@ -155,9 +155,16 @@ public class DefaultDataIdentification e
     }
 
     /**
-     * Returns the language(s) used within the dataset.
+     * Returns the language(s) used within the resource.
+     * The first element in iteration order shall be the default language.
+     * All other elements, if any, are alternate language(s) used within the resource.
+     *
+     * <p>The language string representations should use ISO 639-2 language code as
+     * returned by {@link Locale#getISO3Language()}.</p>
      *
      * @return Language(s) used.
+     *
+     * @see Locale#getISO3Language()
      */
     @Override
     @XmlElement(name = "language", required = true)
@@ -175,30 +182,30 @@ public class DefaultDataIdentification e
     }
 
     /**
-     * Returns the full name of the character coding standard used for the dataset.
+     * Returns the character coding standard used for the dataset.
      *
-     * @return Name(s) of the character coding standard(s) used.
+     * @return Character coding standard(s) used.
      */
     @Override
     @XmlElement(name = "characterSet")
-    public Collection<CharacterSet> getCharacterSets() {
-        return characterSets = nonNullCollection(characterSets, CharacterSet.class);
+    public Collection<Charset> getCharacterSets() {
+        return characterSets = nonNullCollection(characterSets, Charset.class);
     }
 
     /**
-     * Sets the full name of the character coding standard used for the dataset.
+     * Sets the character coding standard used for the dataset.
      *
      * @param newValues The new character sets.
      */
-    public void setCharacterSets(final Collection<? extends CharacterSet> newValues) {
-        characterSets = writeCollection(newValues, characterSets, CharacterSet.class);
+    public void setCharacterSets(final Collection<? extends Charset> newValues) {
+        characterSets = writeCollection(newValues, characterSets, Charset.class);
     }
 
     /**
-     * Returns a description of the dataset in the producer's processing environment. This includes
+     * Returns a description of the resource in the producer's processing environment. This includes
      * items such as the software, the computer operating system, file name, and the dataset size.
      *
-     * @return Description of the dataset in the producer's processing environment, or {@code null}.
+     * @return Description of the resource in the producer's processing environment, or {@code null}.
      */
     @Override
     @XmlElement(name = "environmentDescription")
@@ -207,7 +214,7 @@ public class DefaultDataIdentification e
     }
 
     /**
-     * Sets the description of the dataset in the producer’s processing environment.
+     * Sets the description of the resource in the producer’s processing environment.
      *
      * @param newValue The new environment description.
      */
@@ -217,7 +224,7 @@ public class DefaultDataIdentification e
     }
 
     /**
-     * Any other descriptive information about the dataset.
+     * Any other descriptive information about the resource.
      *
      * @return Other descriptive information, or {@code null}.
      */
@@ -228,7 +235,7 @@ public class DefaultDataIdentification e
     }
 
     /**
-     * Sets any other descriptive information about the dataset.
+     * Sets any other descriptive information about the resource.
      *
      * @param newValue The new supplemental information.
      */

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java?rev=1615100&r1=1615099&r2=1615100&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java [UTF-8] Fri Aug  1 13:49:29 2014
@@ -32,7 +32,7 @@
  * {@linkplain org.apache.sis.metadata.iso.ISOMetadata ISO-19115 metadata}<br>
  * {@code  ├─}     {@linkplain org.apache.sis.metadata.iso.identification.AbstractIdentification       Identification} «abstract»<br>
  * {@code  │   ├─} {@linkplain org.apache.sis.metadata.iso.identification.DefaultDataIdentification    Data identification}<br>
- * {@code  │   └─} {@linkplain org.apache.sis.metadata.iso.identification.DefaultServiceIdentification Service identification}<br>
+ * {@code  │   └─} {@linkplain org.apache.sis.metadata.iso.service.DefaultServiceIdentification        Service identification}<br>
  * {@code  ├─}     {@linkplain org.apache.sis.metadata.iso.identification.DefaultResolution            Resolution}<br>
  * {@code  ├─}     {@linkplain org.apache.sis.metadata.iso.identification.DefaultBrowseGraphic         Browse graphic}<br>
  * {@code  ├─}     {@linkplain org.apache.sis.metadata.iso.identification.DefaultKeywords              Keywords}<br>
@@ -43,23 +43,20 @@
  * {@code  ├─} {@linkplain org.opengis.metadata.identification.KeywordType     Keyword type}<br>
  * {@code  ├─} {@linkplain org.opengis.metadata.identification.AssociationType Association type}<br>
  * {@code  ├─} {@linkplain org.opengis.metadata.identification.InitiativeType  Initiative type}<br>
- * {@code  ├─} {@linkplain org.opengis.metadata.identification.TopicCategory   Topic category}<br>
- * {@code  └─} {@linkplain org.opengis.metadata.identification.CharacterSet    Character set}<br>
+ * {@code  └─} {@linkplain org.opengis.metadata.identification.TopicCategory   Topic category}<br>
  * </td><td class="sep" style="width: 50%; white-space: nowrap">
  *                 {@linkplain org.apache.sis.metadata.iso.identification.AbstractIdentification       Identification} «abstract»<br>
+ * {@code  ├─}     {@linkplain org.apache.sis.metadata.iso.identification.DefaultResolution            Resolution}<br>
+ * {@code  ├─}     {@linkplain org.opengis.metadata.identification.TopicCategory                       Topic category} «code list»<br>
  * {@code  ├─}     {@linkplain org.opengis.metadata.identification.Progress                            Progress} «code list»<br>
  * {@code  ├─}     {@linkplain org.apache.sis.metadata.iso.identification.DefaultBrowseGraphic         Browse graphic}<br>
  * {@code  ├─}     {@linkplain org.apache.sis.metadata.iso.identification.DefaultKeywords              Keywords}<br>
  * {@code  │   └─} {@linkplain org.opengis.metadata.identification.KeywordType                         Keyword type} «code list»<br>
  * {@code  ├─}     {@linkplain org.apache.sis.metadata.iso.identification.DefaultUsage                 Usage}<br>
- * {@code  └─}     {@linkplain org.apache.sis.metadata.iso.identification.DefaultAggregateInformation  Aggregate information}<br>
+ * {@code  └─}     {@linkplain org.apache.sis.metadata.iso.identification.DefaultAssociatedResource    Associated resource}<br>
  * {@code      ├─} {@linkplain org.opengis.metadata.identification.AssociationType                     Association type} «code list»<br>
  * {@code      └─} {@linkplain org.opengis.metadata.identification.InitiativeType                      Initiative type} «code list»<br>
  *                 {@linkplain org.apache.sis.metadata.iso.identification.DefaultDataIdentification    Data identification}<br>
- * {@code  ├─}     {@linkplain org.apache.sis.metadata.iso.identification.DefaultResolution            Resolution}<br>
- * {@code  └─}     {@linkplain org.opengis.metadata.identification.TopicCategory                       Topic category} «code list»<br>
- *                 {@linkplain org.apache.sis.metadata.iso.identification.DefaultServiceIdentification Service identification}<br>
- *                 {@linkplain org.opengis.metadata.identification.CharacterSet                        Character set} «code list»<br>
  * </td></tr></table>
  *
  * <p>In addition to the standard properties, SIS provides the following methods:</p>

Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java?rev=1615100&r1=1615099&r2=1615100&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java [UTF-8] Fri Aug  1 13:49:29 2014
@@ -23,6 +23,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Locale;
 import java.util.Date;
+import java.nio.charset.Charset;
 
 import org.opengis.metadata.Identifier;
 import org.opengis.metadata.extent.Extent;
@@ -216,7 +217,7 @@ public final strictfp class PropertyAcce
             Identification.class, "getSpatialRepresentationTypes", "spatialRepresentationTypes", "spatialRepresentationType", "Spatial representation types", SpatialRepresentationType[].class,
             Identification.class, "getSpatialResolutions",         "spatialResolutions",         "spatialResolution",         "Spatial resolutions",          Resolution[].class,
         DataIdentification.class, "getLanguages",                  "languages",                  "language",                  "Languages",                    Locale[].class,
-        DataIdentification.class, "getCharacterSets",              "characterSets",              "characterSet",              "Character sets",               CharacterSet[].class,
+        DataIdentification.class, "getCharacterSets",              "characterSets",              "characterSet",              "Character sets",               Charset[].class,
         DataIdentification.class, "getEnvironmentDescription",     "environmentDescription",     "environmentDescription",    "Environment description",      InternationalString.class,
         DataIdentification.class, "getSupplementalInformation",    "supplementalInformation",    "supplementalInformation",   "Supplemental information",     InternationalString.class,
             Identification.class, "getExtents",                    "extents",                    "extent",                    "Extents",                      Extent[].class,

Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/CustomMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/CustomMetadataTest.java?rev=1615100&r1=1615099&r2=1615100&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/CustomMetadataTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/CustomMetadataTest.java [UTF-8] Fri Aug  1 13:49:29 2014
@@ -23,6 +23,7 @@ import java.util.Locale;
 import java.lang.reflect.Proxy;
 import java.lang.reflect.Method;
 import java.lang.reflect.InvocationHandler;
+import java.nio.charset.Charset;
 import javax.xml.bind.JAXBException;
 import org.opengis.metadata.Metadata;
 import org.opengis.metadata.Identifier;
@@ -120,7 +121,7 @@ public final strictfp class CustomMetada
             @Override public Collection<Resolution>                getSpatialResolutions()         {return null;}
             @Override public Collection<Duration>                  getTemporalResolutions()        {return null;}
             @Override public Collection<Locale>                    getLanguages()                  {return null;}
-            @Override public Collection<CharacterSet>              getCharacterSets()              {return null;}
+            @Override public Collection<Charset>                   getCharacterSets()              {return null;}
             @Override public Collection<TopicCategory>             getTopicCategories()            {return null;}
             @Override public Collection<Extent>                    getExtents()                    {return null;}
             @Override public Collection<InternationalString>       getCredits()                    {return null;}
@@ -132,7 +133,7 @@ public final strictfp class CustomMetada
             @Override public Collection<Keywords>                  getDescriptiveKeywords()        {return null;}
             @Override public Collection<Usage>                     getResourceSpecificUsages()     {return null;}
             @Override public Collection<Constraints>               getResourceConstraints()        {return null;}
-            @Override public Collection<AggregateInformation>      getAggregationInfo()            {return null;}
+@Deprecated @Override public Collection<AggregateInformation>      getAggregationInfo()            {return null;}
             @Override public Collection<AssociatedResource>        getAssociatedResources()        {return null;}
             @Override public Collection<Citation>                  getAdditionalDocumentations()   {return null;}
         };

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java?rev=1615100&r1=1615099&r2=1615100&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java [UTF-8] Fri Aug  1 13:49:29 2014
@@ -20,6 +20,7 @@ import java.net.URI;
 import java.net.URL;
 import java.util.Arrays;
 import java.util.Locale;
+import java.nio.charset.StandardCharsets;
 import javax.xml.bind.Unmarshaller;
 import javax.xml.bind.JAXBException;
 import javax.measure.unit.SI;
@@ -98,7 +99,7 @@ public strictfp class DefaultMetadataTes
         final DefaultMetadata metadata = new DefaultMetadata();
         metadata.setFileIdentifier("Apache SIS/Metadata test");
         metadata.setLanguage(Locale.ENGLISH);
-        metadata.setCharacterSet(CharacterSet.UTF_8);
+        metadata.setCharacterSet(StandardCharsets.UTF_8);
         metadata.setHierarchyLevels(singleton(ScopeCode.DATASET));
         metadata.setHierarchyLevelNames(singleton("Common Data Index record"));
         metadata.setDateStamp(TestUtilities.date("2009-01-01 04:00:00"));

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ReferencingInMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ReferencingInMetadataTest.java?rev=1615100&r1=1615099&r2=1615100&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ReferencingInMetadataTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ReferencingInMetadataTest.java [UTF-8] Fri Aug  1 13:49:29 2014
@@ -18,6 +18,7 @@ package org.apache.sis.test.integration;
 
 import java.net.URI;
 import java.util.Locale;
+import java.nio.charset.StandardCharsets;
 import javax.xml.bind.JAXBException;
 import org.opengis.metadata.Metadata;
 import org.opengis.metadata.citation.Citation;
@@ -28,7 +29,6 @@ import org.opengis.metadata.citation.Rol
 import org.opengis.metadata.extent.Extent;
 import org.opengis.metadata.extent.GeographicBoundingBox;
 import org.opengis.metadata.extent.VerticalExtent;
-import org.opengis.metadata.identification.CharacterSet;
 import org.opengis.metadata.identification.DataIdentification;
 import org.opengis.metadata.spatial.GeometricObjectType;
 import org.opengis.metadata.spatial.SpatialRepresentation;
@@ -83,7 +83,7 @@ public final strictfp class ReferencingI
         final Metadata metadata = unmarshalFile(Metadata.class, VERTICAL_CRS_XML);
         assertEquals("fileIdentifier", "20090901",                     metadata.getFileIdentifier());
         assertEquals("language",       Locale.ENGLISH,                 metadata.getLanguage());
-        assertEquals("characterSet",   CharacterSet.UTF_8,             metadata.getCharacterSet());
+        assertEquals("characterSet",   StandardCharsets.UTF_8,         metadata.getCharacterSet());
         assertEquals("dateStamp",      xmlDate("2014-01-04 00:00:00"), metadata.getDateStamp());
         /*
          * <gmd:contact>

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java?rev=1615100&r1=1615099&r2=1615100&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java [UTF-8] Fri Aug  1 13:49:29 2014
@@ -37,7 +37,7 @@ import org.apache.sis.internal.jaxb.Sche
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.5)
- * @version 0.3
+ * @version 0.5
  * @module
  *
  * @see CodeListAdapter
@@ -117,15 +117,15 @@ public final class CodeListProxy {
     }
 
     /**
-     * Builds a value for {@link LanguageCode} and {@link Country} elements.
+     * Builds a code list with the given attributes.
      *
      * @param context       The current (un)marshalling context, or {@code null} if none.
      * @param codeList      The {@code codeList} attribute, to be concatenated after the {@code "#"} symbol.
-     * @param codeListValue The {@code codeListValue} attribute, to be declared in the attribute.
+     * @param codeListValue The {@code codeListValue} attribute, to be declared in the XML element.
      * @param codeSpace     The 3-letters language code of the {@code value} attribute, or {@code null} if none.
      * @param value         The value in the language specified by the {@code codeSpace} attribute, or {@code null} if none.
      */
-    CodeListProxy(final Context context, final String codeList, final String codeListValue,
+    public CodeListProxy(final Context context, final String codeList, final String codeListValue,
             final String codeSpace, final String value)
     {
         this.codeList      = schema(context, codeList);

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/EnumAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/EnumAdapter.java?rev=1615100&r1=1615099&r2=1615100&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/EnumAdapter.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/EnumAdapter.java [UTF-8] Fri Aug  1 13:49:29 2014
@@ -16,7 +16,6 @@
  */
 package org.apache.sis.internal.jaxb.gmd;
 
-import java.util.Locale;
 import javax.xml.bind.annotation.adapters.XmlAdapter;
 import org.opengis.util.Enumerated;
 import org.apache.sis.util.iso.Types;
@@ -56,21 +55,19 @@ public abstract class EnumAdapter<ValueT
      * @return The presumed enumeration constant name.
      */
     protected static String name(String value) {
-        value = value.toUpperCase(Locale.ROOT);
         /*
          * Replace space ! " # $ % & ' ( ) * + , - . / punction characters by '_'.
          * For example this replace "in/out" by "IN_OUT" in ParameterDirection.
+         *
+         * Note: we do not use codepoint API because this method is mostly for
+         * GeoAPI programmatic constant names, which are written in English.
          */
-        StringBuilder replaced = null;
-        for (int i=value.length(); --i>=0;) {
-            if (value.charAt(i) < '0') {
-                if (replaced == null) {
-                    replaced = new StringBuilder(value);
-                }
-                replaced.setCharAt(i, '_');
-            }
+        final char[] ca = value.toCharArray();
+        for (int i=0; i<ca.length; i++) {
+            final char c = ca[i];
+            ca[i] = (c >= '0') ? Character.toUpperCase(c) : '_';
         }
-        return (replaced != null) ? replaced.toString() : value;
+        return String.valueOf(ca);
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java?rev=1615100&r1=1615099&r2=1615100&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java [UTF-8] Fri Aug  1 13:49:29 2014
@@ -523,9 +523,10 @@ public final class Units extends Static 
      *   </tr>
      * </table>
      *
-     * <b>Note:</b> EPSG uses code 9102 (<cite>degree</cite>) for prime meridian and coordinate operation parameters,
+     * <div class="note"><b>Note:</b>
+     * EPSG uses code 9102 (<cite>degree</cite>) for prime meridian and coordinate operation parameters,
      * and code 9122 (<cite>degree (supplier to define representation)</cite>) for coordinate system axes.
-     * But Apache SIS considers those two codes as synonymous.
+     * But Apache SIS considers those two codes as synonymous.</div>
      *
      * @param  code The EPSG code for a unit of measurement.
      * @return The unit, or {@code null} if the code is unrecognized.

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/ValueConverter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/ValueConverter.java?rev=1615100&r1=1615099&r2=1615100&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/ValueConverter.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/ValueConverter.java [UTF-8] Fri Aug  1 13:49:29 2014
@@ -24,6 +24,8 @@ import java.util.MissingResourceExceptio
 import java.util.IllformedLocaleException;
 import java.util.Locale;
 import java.util.UUID;
+import java.nio.charset.Charset;
+import java.nio.charset.IllegalCharsetNameException;
 import javax.measure.unit.Unit;
 import org.apache.sis.measure.Units;
 import org.apache.sis.util.Locales;
@@ -64,7 +66,7 @@ import static org.apache.sis.util.CharSe
  *
  * @author Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-3.07)
- * @version 0.4
+ * @version 0.5
  * @module
  */
 public class ValueConverter {
@@ -180,6 +182,69 @@ public class ValueConverter {
     }
 
     /**
+     * Converts the given character set to a code.
+     *
+     * <p>The default implementation first invokes {@link Charset#name()}. Then if marshalling to ISO 19139:2007,
+     * this method converts the <a href="http://www.iana.org/assignments/character-sets">IANA</a> name to a
+     * ISO 19115:2003 {@code MD_CharacterSetCode} using the following equivalence table:</p>
+     *
+     * <table class="sis">
+     *   <caption>IANA to ISO 19115:2003 character set code</caption>
+     *   <tr>
+     *     <td><table class="compact" summary="IANA to ISO 19115:2003">
+     *       <tr><td style="width: 90px"><b>IANA</b></td><td><b>ISO 19115:2003</b></td></tr>
+     *       <tr><td>{@code ISO-8859-1}</td>  <td>{@code 8859part1}</td></tr>
+     *       <tr><td>{@code ISO-8859-2}</td>  <td>{@code 8859part2}</td></tr>
+     *       <tr><td>{@code ISO-8859-3}</td>  <td>{@code 8859part3}</td></tr>
+     *       <tr><td>{@code ISO-8859-4}</td>  <td>{@code 8859part4}</td></tr>
+     *       <tr><td>{@code ISO-8859-5}</td>  <td>{@code 8859part5}</td></tr>
+     *       <tr><td>{@code ISO-8859-6}</td>  <td>{@code 8859part6}</td></tr>
+     *       <tr><td>{@code ISO-8859-7}</td>  <td>{@code 8859part7}</td></tr>
+     *       <tr><td>{@code ISO-8859-8}</td>  <td>{@code 8859part8}</td></tr>
+     *       <tr><td>{@code ISO-8859-9}</td>  <td>{@code 8859part9}</td></tr>
+     *       <tr><td>{@code ISO-8859-10}</td> <td>{@code 8859part10}</td></tr>
+     *       <tr><td>{@code ISO-8859-11}</td> <td>{@code 8859part11}</td></tr>
+     *       <tr><td>{@code ISO-8859-12}</td> <td>{@code 8859part12}</td></tr>
+     *       <tr><td>{@code ISO-8859-13}</td> <td>{@code 8859part13}</td></tr>
+     *       <tr><td>{@code ISO-8859-14}</td> <td>{@code 8859part14}</td></tr>
+     *       <tr><td>{@code ISO-8859-15}</td> <td>{@code 8859part15}</td></tr>
+     *       <tr><td>{@code ISO-8859-16}</td> <td>{@code 8859part16}</td></tr>
+     *     </table></td>
+     *     <td class="sep"><table class="compact" summary="IANA to ISO 19115:2003">
+     *       <tr><td style="width: 90px"><b>IANA</b></td><td><b>ISO 19115:2003</b></td></tr>
+     *       <tr><td>{@code UCS-2}</td>     <td>{@code ucs2}</td></tr>
+     *       <tr><td>{@code UCS-4}</td>     <td>{@code ucs4}</td></tr>
+     *       <tr><td>{@code UTF-7}</td>     <td>{@code utf7}</td></tr>
+     *       <tr><td>{@code UTF-8}</td>     <td>{@code utf8}</td></tr>
+     *       <tr><td>{@code UTF-16}</td>    <td>{@code utf16}</td></tr>
+     *       <tr><td>{@code JIS_X0201}</td> <td>{@code jis}</td></tr>
+     *       <tr><td>{@code Shift_JIS}</td> <td>{@code shiftJIS}</td></tr>
+     *       <tr><td>{@code EUC-JP}</td>    <td>{@code eucJP}</td></tr>
+     *       <tr><td>{@code US-ASCII}</td>  <td>{@code usAscii}</td></tr>
+     *       <tr><td>{@code EBCDIC}</td>    <td>{@code ebcdic}</td></tr>
+     *       <tr><td>{@code EUC-KR}</td>    <td>{@code eucKR}</td></tr>
+     *       <tr><td>{@code Big5}</td>      <td>{@code big5}</td></tr>
+     *       <tr><td>{@code GB2312}</td>    <td>{@code GB2312}</td></tr>
+     *     </table></td>
+     *   </tr>
+     * </table>
+     *
+     * @param  context Context (GML version, locale, <i>etc.</i>) of the (un)marshalling process.
+     * @param  value The locale to convert to a character set code, or {@code null}.
+     * @return The country code, or {@code null} if the given value was null.
+     *
+     * @see Charset#name()
+     *
+     * @since 0.5
+     */
+    public String toCharsetCode(final MarshalContext context, final Charset value) {
+        if (value != null) {
+            return LegacyCodes.fromIANA(value.name());
+        }
+        return null;
+    }
+
+    /**
      * Converts the given string to a locale. The string is the language code either as the 2
      * letters or the 3 letters ISO code. It can optionally be followed by the {@code '_'}
      * character and the country code (again either as 2 or 3 letters), optionally followed
@@ -206,6 +271,36 @@ public class ValueConverter {
     }
 
     /**
+     * Converts the given string to a character set. The string can be either a
+     * <a href="http://www.iana.org/assignments/character-sets">IANA</a> identifier,
+     * or one of the ISO 19115:2003 {@code MD_CharacterSetCode} identifier.
+     *
+     * @param  context Context (GML version, locale, <i>etc.</i>) of the (un)marshalling process.
+     * @param  value The string to convert to a character set, or {@code null}.
+     * @return The converted character set, or {@code null} if the given value was null or empty, or
+     *         if an exception was thrown and {@code exceptionOccured(…)} returned {@code true}.
+     * @throws IllegalCharsetNameException If the given string can not be converted to a character set.
+     *
+     * @see Charset#forName(String)
+     *
+     * @since 0.5
+     */
+    public Charset toCharset(final MarshalContext context, String value) throws IllegalCharsetNameException {
+        value = trimWhitespaces(value);
+        if (value != null && !value.isEmpty()) {
+            value = LegacyCodes.toIANA(value);
+            try {
+                return Charset.forName(value);
+            } catch (IllegalCharsetNameException e) {
+                if (!exceptionOccured(context, value, String.class, Charset.class, e)) {
+                    throw e;
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
      * Converts the given string to a unit. The default implementation is as below, omitting
      * the check for null value and the call to {@link #exceptionOccured exceptionOccured(…)}
      * in case of error:

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/mock/MetadataMock.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/mock/MetadataMock.java?rev=1615100&r1=1615099&r2=1615100&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/mock/MetadataMock.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/mock/MetadataMock.java [UTF-8] Fri Aug  1 13:49:29 2014
@@ -19,6 +19,7 @@ package org.apache.sis.test.mock;
 import java.util.Date;
 import java.util.Locale;
 import java.util.Collection;
+import java.nio.charset.Charset;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
@@ -31,7 +32,6 @@ import org.opengis.metadata.citation.Res
 import org.opengis.metadata.constraint.Constraints;
 import org.opengis.metadata.content.ContentInformation;
 import org.opengis.metadata.distribution.Distribution;
-import org.opengis.metadata.identification.CharacterSet;
 import org.opengis.metadata.identification.Identification;
 import org.opengis.metadata.maintenance.MaintenanceInformation;
 import org.opengis.metadata.maintenance.ScopeCode;
@@ -100,7 +100,7 @@ public final strictfp class MetadataMock
      * @return {@code null}.
      */
     @Override
-    public CharacterSet getCharacterSet() {
+    public Charset getCharacterSet() {
         return null;
     }
 

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java?rev=1615100&r1=1615099&r2=1615100&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java [UTF-8] Fri Aug  1 13:49:29 2014
@@ -125,6 +125,7 @@ import org.junit.BeforeClass;
     // XML most basic types.
     org.apache.sis.xml.XLinkTest.class,
     org.apache.sis.xml.NilReasonTest.class,
+    org.apache.sis.xml.LegacyCodesTest.class,
     org.apache.sis.xml.ValueConverterTest.class,
     org.apache.sis.xml.OGCNamespacePrefixMapperTest.class,
     org.apache.sis.xml.MarshallerPoolTest.class,

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/TypesTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/TypesTest.java?rev=1615100&r1=1615099&r2=1615100&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/TypesTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/TypesTest.java [UTF-8] Fri Aug  1 13:49:29 2014
@@ -26,7 +26,6 @@ import org.opengis.metadata.citation.Add
 import org.opengis.metadata.citation.Citation;
 import org.opengis.metadata.citation.OnLineFunction;
 import org.opengis.metadata.content.ImagingCondition;
-import org.opengis.metadata.identification.CharacterSet;
 import org.opengis.metadata.service.ParameterDirection;
 import org.opengis.referencing.datum.Datum;
 import org.opengis.referencing.cs.AxisDirection;
@@ -131,12 +130,12 @@ public final strictfp class TypesTest ex
      */
     @Test
     public void testGetDescription() {
-        final InternationalString description = Types.getDescription(CharacterSet.class);
-        assertEquals("Name of the character coding standard used in the resource.",
+        final InternationalString description = Types.getDescription(OnLineFunction.class);
+        assertEquals("Function performed by the resource.",
                 description.toString(Locale.ROOT));
-        assertEquals("Name of the character coding standard used in the resource.",
+        assertEquals("Function performed by the resource.",
                 description.toString(Locale.ENGLISH));
-        assertEquals("Jeu de caractères.",
+        assertEquals("Fonctionnalité offerte par la ressource.",
                 description.toString(Locale.FRENCH));
     }
 
@@ -156,12 +155,12 @@ public final strictfp class TypesTest ex
      */
     @Test
     public void testGetCodeDescription() {
-        final InternationalString description = Types.getDescription(CharacterSet.ISO_8859_1);
-        assertEquals("ISO/IEC 8859-1, Information technology - 8-bit single byte coded graphic character sets - Part 1 : Latin alphabet No.1.",
+        final InternationalString description = Types.getDescription(OnLineFunction.DOWNLOAD);
+        assertEquals("Online instructions for transferring data from one storage device or system to another.",
                 description.toString(Locale.ROOT));
-        assertEquals("ISO/IEC 8859-1, Information technology - 8-bit single byte coded graphic character sets - Part 1 : Latin alphabet No.1.",
+        assertEquals("Online instructions for transferring data from one storage device or system to another.",
                 description.toString(Locale.ENGLISH));
-        assertEquals("ISO/IEC 8859-1, alphabet latin 1.",
+        assertEquals("Transfert de la ressource d'un système à un autre.",
                 description.toString(Locale.FRENCH));
     }
 
@@ -172,7 +171,7 @@ public final strictfp class TypesTest ex
     public void testGetListName() {
         assertEquals("SV_ParameterDirection",   Types.getListName(ParameterDirection.IN_OUT));
         assertEquals("CS_AxisDirection",        Types.getListName(AxisDirection     .NORTH));
-        assertEquals("MD_CharacterSetCode",     Types.getListName(CharacterSet      .UTF_8));
+        assertEquals("CI_OnLineFunctionCode",   Types.getListName(OnLineFunction    .DOWNLOAD));
         assertEquals("MD_ImagingConditionCode", Types.getListName(ImagingCondition  .BLURRED_IMAGE));
     }
 
@@ -183,7 +182,7 @@ public final strictfp class TypesTest ex
     public void testGetCodeName() {
         assertEquals("in/out",       Types.getCodeName(ParameterDirection.IN_OUT));
         assertEquals("north",        Types.getCodeName(AxisDirection     .NORTH));
-        assertEquals("utf8",         Types.getCodeName(CharacterSet      .UTF_8));
+        assertEquals("download",     Types.getCodeName(OnLineFunction    .DOWNLOAD));
         assertEquals("blurredImage", Types.getCodeName(ImagingCondition  .BLURRED_IMAGE));
     }
 
@@ -193,7 +192,7 @@ public final strictfp class TypesTest ex
     @Test
     public void testGetCodeLabel() {
         assertEquals("North",         Types.getCodeLabel(AxisDirection   .NORTH));
-        assertEquals("UTF-8",         Types.getCodeLabel(CharacterSet    .UTF_8));
+        assertEquals("Download",      Types.getCodeLabel(OnLineFunction  .DOWNLOAD));
         assertEquals("Blurred image", Types.getCodeLabel(ImagingCondition.BLURRED_IMAGE));
     }
 

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/xml/ValueConverterTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/xml/ValueConverterTest.java?rev=1615100&r1=1615099&r2=1615100&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/xml/ValueConverterTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/xml/ValueConverterTest.java [UTF-8] Fri Aug  1 13:49:29 2014
@@ -17,10 +17,12 @@
 package org.apache.sis.xml;
 
 import java.util.Locale;
+import java.nio.charset.StandardCharsets;
+import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
-import static org.apache.sis.test.Assert.*;
+import static org.junit.Assert.*;
 
 
 /**
@@ -28,9 +30,10 @@ import static org.apache.sis.test.Assert
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.5
  * @module
  */
+@DependsOn(LegacyCodesTest.class)
 public final strictfp class ValueConverterTest extends TestCase {
     /**
      * Tests {@link ValueConverter#toLanguageCode(MarshalContext, Locale)}.
@@ -66,4 +69,26 @@ public final strictfp class ValueConvert
         assertEquals("JP", ValueConverter.DEFAULT.toCountryCode(null, Locale.JAPAN));
         assertNull  (      ValueConverter.DEFAULT.toCountryCode(null, Locale.JAPANESE));
     }
+
+    /**
+     * Tests {@link ValueConverter#toCharsetCode(MarshalContext, Charset)}.
+     */
+    @Test
+    public void testToCharsetCode() {
+        assertEquals("utf8",      ValueConverter.DEFAULT.toCharsetCode(null, StandardCharsets.UTF_8));
+        assertEquals("utf16",     ValueConverter.DEFAULT.toCharsetCode(null, StandardCharsets.UTF_16));
+        assertEquals("8859part1", ValueConverter.DEFAULT.toCharsetCode(null, StandardCharsets.ISO_8859_1));
+    }
+
+    /**
+     * Tests {@link ValueConverter#toCharset(MarshalContext, String)}.
+     */
+    @Test
+    public void testToCharset() {
+        assertEquals(StandardCharsets.UTF_8,      ValueConverter.DEFAULT.toCharset(null, "utf8"));
+        assertEquals(StandardCharsets.UTF_8,      ValueConverter.DEFAULT.toCharset(null, "UTF-8"));
+        assertEquals(StandardCharsets.UTF_16,     ValueConverter.DEFAULT.toCharset(null, "utf16"));
+        assertEquals(StandardCharsets.ISO_8859_1, ValueConverter.DEFAULT.toCharset(null, "8859part1"));
+        assertEquals(StandardCharsets.ISO_8859_1, ValueConverter.DEFAULT.toCharset(null, "ISO-8859-1"));
+    }
 }

Modified: sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/XMLStoreTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/XMLStoreTest.java?rev=1615100&r1=1615099&r2=1615100&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/XMLStoreTest.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/XMLStoreTest.java [UTF-8] Fri Aug  1 13:49:29 2014
@@ -18,12 +18,12 @@ package org.apache.sis.internal.storage.
 
 import java.util.Locale;
 import java.io.StringReader;
+import java.nio.charset.StandardCharsets;
 import org.opengis.metadata.Metadata;
 import org.opengis.metadata.citation.Role;
 import org.opengis.metadata.citation.OnLineFunction;
 import org.opengis.metadata.citation.OnlineResource;
 import org.opengis.metadata.citation.ResponsibleParty;
-import org.opengis.metadata.identification.CharacterSet;
 import org.apache.sis.xml.Namespaces;
 import org.apache.sis.storage.StorageConnector;
 import org.apache.sis.storage.DataStoreException;
@@ -100,7 +100,7 @@ public final strictfp class XMLStoreTest
         final OnlineResource resource = party.getContactInfo().getOnlineResource();
 
         assertEquals(Locale.ENGLISH,              metadata.getLanguage());
-        assertEquals(CharacterSet.UTF_8,          metadata.getCharacterSet());
+        assertEquals(StandardCharsets.UTF_8,      metadata.getCharacterSet());
         assertEquals(Role.PRINCIPAL_INVESTIGATOR, party.getRole());
         assertEquals("Apache SIS",                String.valueOf(party.getOrganisationName()));
         assertEquals("http://sis.apache.org",     String.valueOf(resource.getLinkage()));



Mime
View raw message