sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1429461 [1/2] - in /sis/branches/JDK6: ./ sis-build-helper/src/main/java/org/apache/sis/internal/maven/ sis-build-helper/src/site/apt/ sis-utility/ sis-utility/src/main/java/org/apache/sis/internal/jaxb/ sis-utility/src/main/java/org/apach...
Date Sun, 06 Jan 2013 04:48:22 GMT
Author: desruisseaux
Date: Sun Jan  6 04:48:21 2013
New Revision: 1429461

URL: http://svn.apache.org/viewvc?rev=1429461&view=rev
Log:
Merge from the JDK7 branch.

Added:
    sis/branches/JDK6/sis-build-helper/src/main/java/org/apache/sis/internal/maven/
      - copied from r1429460, sis/branches/JDK7/sis-build-helper/src/main/java/org/apache/sis/internal/maven/
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/AdapterReplacement.java
      - copied unchanged from r1429460, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/AdapterReplacement.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/InternationalStringAdapter.java
      - copied unchanged from r1429460, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/InternationalStringAdapter.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java
      - copied unchanged from r1429460, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/URIAdapter.java
      - copied unchanged from r1429460, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/URIAdapter.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LocaleAdapter.java
      - copied unchanged from r1429460, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LocaleAdapter.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/About.java
      - copied, changed from r1429460, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/About.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTables.java
      - copied, changed from r1429460, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTables.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/MarshallerPool.java
      - copied, changed from r1429460, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/xml/MarshallerPool.java
    sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/util/collection/TreeTablesTest.java
      - copied, changed from r1429460, sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/collection/TreeTablesTest.java
Modified:
    sis/branches/JDK6/   (props changed)
    sis/branches/JDK6/pom.xml
    sis/branches/JDK6/sis-build-helper/src/main/java/org/apache/sis/internal/maven/JarCollector.java
    sis/branches/JDK6/sis-build-helper/src/site/apt/index.apt
    sis/branches/JDK6/sis-utility/pom.xml
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/MarshalContext.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/CharSequenceAdapter.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LanguageCode.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/Anchor.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/Supervisor.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/SupervisorMBean.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/Version.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/TableColumn.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTable.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java
    sis/branches/JDK6/sis-utility/src/main/resources/org/apache/sis/internal/util/Descriptions.properties
    sis/branches/JDK6/sis-utility/src/main/resources/org/apache/sis/internal/util/Descriptions_fr.properties
    sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
    sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/util/collection/DefaultTreeTableTest.java

Propchange: sis/branches/JDK6/
------------------------------------------------------------------------------
  Merged /sis/branches/JDK7:r1425611-1429460

Modified: sis/branches/JDK6/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/pom.xml?rev=1429461&r1=1429460&r2=1429461&view=diff
==============================================================================
--- sis/branches/JDK6/pom.xml (original)
+++ sis/branches/JDK6/pom.xml Sun Jan  6 04:48:21 2013
@@ -274,17 +274,21 @@ Apache SIS is a toolkit for describing l
 
 
 
-  <!-- ==============================================================
-         Properties, used in dependency management and build
-         configuration.
-       ============================================================== -->
+  <!-- ===================================================================
+         Properties used in dependency management and build configuration.
+         The last properties in this list depend on the Apache SIS branch.
+       =================================================================== -->
   <properties>
     <geoapi.version>3.1-M04</geoapi.version>
-    <maven.compile.source>1.6</maven.compile.source>
-    <maven.compile.target>1.6</maven.compile.target>
+    <findbugs.version>2.5.2</findbugs.version>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <website.encoding>UTF-8</website.encoding>
     <website.locale>en</website.locale>
+
+    <!-- Following properties are branch-specific -->
+    <maven.compile.source>1.6</maven.compile.source>
+    <maven.compile.target>1.6</maven.compile.target>
+    <sis.plugin.version>${project.version}</sis.plugin.version>
   </properties>
 
   <profiles>
@@ -330,6 +334,7 @@ Apache SIS is a toolkit for describing l
             <index>false</index>
             <manifest>
               <addClasspath>true</addClasspath>
+              <mainClass>org.apache.sis.util.About</mainClass>
               <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
             </manifest>
             <manifestEntries>
@@ -422,12 +427,12 @@ Apache SIS is a toolkit for describing l
       <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>findbugs-maven-plugin</artifactId>
-        <version>2.5.2</version>
+        <version>${findbugs.version}</version>
         <dependencies>
           <dependency>
             <groupId>org.apache.sis</groupId>
             <artifactId>sis-build-helper</artifactId>
-            <version>${project.version}</version>
+            <version>${sis.plugin.version}</version>
           </dependency>
         </dependencies>
       </plugin>
@@ -528,7 +533,7 @@ Apache SIS is a toolkit for describing l
           <tagletArtifact>
             <groupId>org.apache.sis</groupId>
             <artifactId>sis-build-helper</artifactId>
-            <version>${project.version}</version>
+            <version>${sis.plugin.version}</version>
           </tagletArtifact>
         </configuration>
       </plugin>
@@ -558,7 +563,7 @@ Apache SIS is a toolkit for describing l
       <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>findbugs-maven-plugin</artifactId>
-        <version>2.5.2</version> <!-- See also the same plugin in the <build> section. -->
+        <version>${findbugs.version}</version> <!-- See also the same plugin in the <build> section. -->
         <configuration>
           <threshold>Normal</threshold>
           <effort>Default</effort>

Modified: sis/branches/JDK6/sis-build-helper/src/main/java/org/apache/sis/internal/maven/JarCollector.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-build-helper/src/main/java/org/apache/sis/internal/maven/JarCollector.java?rev=1429461&r1=1429460&r2=1429461&view=diff
==============================================================================
--- sis/branches/JDK6/sis-build-helper/src/main/java/org/apache/sis/internal/maven/JarCollector.java (original)
+++ sis/branches/JDK6/sis-build-helper/src/main/java/org/apache/sis/internal/maven/JarCollector.java Sun Jan  6 04:48:21 2013
@@ -19,8 +19,8 @@ package org.apache.sis.internal.maven;
 import java.io.File;
 import java.io.FileFilter;
 import java.io.IOException;
-import java.nio.file.Path;
-import java.nio.file.Files;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
 import java.util.Set;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
@@ -213,19 +213,19 @@ public final class JarCollector extends 
 
     /**
      * Copies the given file to the given target file.
-     * Since JDK 7, this method actually creates a hard link.
      *
      * @param file The source file to read.
      * @param copy The destination file to create.
      */
     private static void copyFileToDirectory(final File file, final File copy) throws IOException {
-        final Path source = file.toPath();
-        final Path target = copy.toPath();
-        try {
-            Files.createLink(target, source);
-        } catch (UnsupportedOperationException e) {
-            // If hard links are not supported, do a plain copy.
-            Files.copy(source, target);
+        final FileInputStream in = new FileInputStream(file);
+        final FileOutputStream out = new FileOutputStream(copy);
+        final byte[] buffer = new byte[4096];
+        int c;
+        while ((c = in.read(buffer)) >= 0) {
+            out.write(buffer, 0, c);
         }
+        out.close();
+        in.close();
     }
 }

Modified: sis/branches/JDK6/sis-build-helper/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-build-helper/src/site/apt/index.apt?rev=1429461&r1=1429460&r2=1429461&view=diff
==============================================================================
--- sis/branches/JDK6/sis-build-helper/src/site/apt/index.apt (original)
+++ sis/branches/JDK6/sis-build-helper/src/site/apt/index.apt Sun Jan  6 04:48:21 2013
@@ -8,6 +8,14 @@ Building Apache SIS
   resource files or formatting the Javadoc. While any project could use it, this module is
   primarily for internal use by Apache SIS and may change in any future version.
 
+  Content:
+
+  * Javadoc taglets
+
+  * Localized resources compiler
+
+  * JAR files collector
+
 
 * Javadoc taglets
 
@@ -58,7 +66,7 @@ Building Apache SIS
     <plugin>
       <groupId>org.apache.sis</groupId>
       <artifactId>sis-build-helper</artifactId>
-      <version>${project.version}</version>
+      <version>${sis.plugin.version}</version>
       <executions>
         <execution>
           <goals>
@@ -74,8 +82,45 @@ Building Apache SIS
   The resources compilation is part of the build process and does not need to be run explicitly.
   However, if necessary the resources compiler can be invoked alone by the following command line
   in the module containing the resources to recompile. This is sometime useful for regenerating
-  the constants in the <<<Keys>>> inner class.
+  the constants in the <<<Keys>>> inner class in a feaster way than building the project.
 
 +-----------------------------------------------------
 mvn org.apache.sis:sis-build-helper:compile-resources
 +-----------------------------------------------------
+
+
+* JAR files collector
+
+  Links or copies all JAR files (including dependencies) in the <<<target/binaries>>> directory of the parent project.
+  This plugin performs a work similar to the standard Maven assembly plugin work, with the following differences:
+
+  * In multi-modules projects, this plugin does not create anything in the <<<target>>> directory of sub-modules.
+    Instead, this plugin groups everything in the <<<target/binaries>>> directory of the parent module.
+
+  * This plugin does not create any ZIP file. It only links or copies JAR files.
+    The JDK7 and above versions of this plugin use hard links on platforms that support them,
+    so execution of this plugin should be very cheap and consume few disk space.
+
+  * Dependencies already present in the <<<target/binaries>>> directory are presumed stables and
+    are not overwritten. Only artefacts produced by the Maven build are unconditionally overwritten.
+
+  This plugin can be activated by the following fragment in the parent <<<pom.xml>>> file:
+
++-----------------------------------------------------
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.sis</groupId>
+        <artifactId>sis-build-helper</artifactId>
+        <version>${sis.plugin.version}</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>collect-jars</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
++-----------------------------------------------------

Modified: sis/branches/JDK6/sis-utility/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/pom.xml?rev=1429461&r1=1429460&r2=1429461&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/pom.xml (original)
+++ sis/branches/JDK6/sis-utility/pom.xml Sun Jan  6 04:48:21 2013
@@ -94,18 +94,22 @@ Miscellaneous utilities.
 
 
   <!-- ===========================================================
-           Compile properties files into resources UTF files
+           Build configuration
        =========================================================== -->
   <build>
     <plugins>
+
+      <!-- Compile properties files into resources UTF files. -->
       <plugin>
         <groupId>org.apache.sis</groupId>
         <artifactId>sis-build-helper</artifactId>
-        <version>${project.version}</version>
+        <version>${sis.plugin.version}</version>
         <executions>
           <execution>
             <goals>
               <goal>compile-resources</goal>
+              <!-- The "collect-jars" goal declared in the JDK7 branch is omitted
+                   in the JDK6 branch, because much more costly on JDK6 platforms. -->
             </goals>
           </execution>
         </executions>

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/MarshalContext.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/MarshalContext.java?rev=1429461&r1=1429460&r2=1429461&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/MarshalContext.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/MarshalContext.java Sun Jan  6 04:48:21 2013
@@ -29,7 +29,10 @@ import org.apache.sis.util.collection.Un
 
 /**
  * Thread-local status of a marshalling or unmarshalling process.
- * Contains also static methods for managing the collections to be marshalled.
+ * All non-static methods in this class except {@link #finish()} are implementation of public API.
+ * All static methods are internal API. Those methods expect a {@code MarshalContext} instance as
+ * their first argument. They should be though as if they were normal member methods, except that
+ * they accept {@code null} instance if no (un)marshalling is in progress.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-3.07)
@@ -45,16 +48,22 @@ public final class MarshalContext extend
 
     /**
      * The bit flag for enabling substitution of language codes by character strings.
+     *
+     * @see org.apache.sis.xml.XML#STRING_SUBSTITUTES
      */
     public static final int SUBSTITUTE_LANGUAGE = 2;
 
     /**
      * The bit flag for enabling substitution of country codes by character strings.
+     *
+     * @see org.apache.sis.xml.XML#STRING_SUBSTITUTES
      */
     public static final int SUBSTITUTE_COUNTRY = 4;
 
     /**
-     * The thread-local context.
+     * The thread-local context. Elements are created in the constructor, and removed in a
+     * {@code finally} block by the {@link #finish()} method. This {@code ThreadLocal} shall
+     * not contain any value when no (un)marshalling is in progress.
      */
     private static final ThreadLocal<MarshalContext> CURRENT = new ThreadLocal<MarshalContext>();
 
@@ -162,6 +171,45 @@ public final class MarshalContext extend
     }
 
     /**
+     * Returns the schema version of the XML document being (un)marshalled.
+     * See the super-class javadoc for the list of prefix that we shall support.
+     */
+    @Override
+    public final Version getVersion(final String prefix) {
+        if (prefix.equals("gml")) {
+            return versionGML;
+        }
+        // Future SIS versions may add more cases here.
+        return null;
+    }
+
+    /**
+     * Returns the locale to use for marshalling, or {@code null} if no locale were explicitly
+     * specified. A {@code null} value means that some locale-neutral language should be used
+     * if available, or an implementation-default locale (typically English) otherwise.
+     */
+    @Override
+    public final Locale getLocale() {
+        return locale;
+    }
+
+    /**
+     * Returns the timezone, or {@code null} if none were explicitely defined.
+     * In the later case, an implementation-default (typically UTC) timezone is used.
+     */
+    @Override
+    public final TimeZone getTimeZone() {
+        return timezone;
+    }
+
+    /*
+     * ---- END OF PUBLIC API --------------------------------------------------------------
+     *
+     * Following are internal API. They are provided as static methods with a MarshalContext
+     * argument rather than normal member methods in order to accept null context.
+     */
+
+    /**
      * Returns the context of the XML (un)marshalling currently progressing in the current thread,
      * or {@code null} if none.
      *
@@ -174,13 +222,13 @@ public final class MarshalContext extend
     /**
      * Returns {@code true} if the given flag is set.
      *
+     * @param  context The current context, or {@code null} if none.
      * @param  flag One of {@link #MARSHALING}, {@link #SUBSTITUTE_LANGUAGE},
      *         {@link #SUBSTITUTE_COUNTRY} or other bit masks.
      * @return {@code true} if the given flag is set.
      */
-    public static boolean isFlagSet(final int flag) {
-        final MarshalContext current = current();
-        return (current != null) && (current.bitMasks & flag) != 0;
+    public static boolean isFlagSet(final MarshalContext context, final int flag) {
+        return (context != null) && (context.bitMasks & flag) != 0;
     }
 
     /**
@@ -189,12 +237,12 @@ public final class MarshalContext extend
      *
      * {@note This method is static for the convenience of performing the check for null context.}
      *
-     * @param  current The current context, or {@code null} if none.
+     * @param  context The current context, or {@code null} if none.
      * @return The current value converter (never null).
      */
-    public static ValueConverter converter(final MarshalContext current) {
-        if (current != null) {
-            final ValueConverter converter = current.converter;
+    public static ValueConverter converter(final MarshalContext context) {
+        if (context != null) {
+            final ValueConverter converter = context.converter;
             if (converter != null) {
                 return converter;
             }
@@ -208,12 +256,12 @@ public final class MarshalContext extend
      *
      * {@note This method is static for the convenience of performing the check for null context.}
      *
-     * @param  current The current context, or {@code null} if none.
+     * @param  context The current context, or {@code null} if none.
      * @return The current reference resolver (never null).
      */
-    public static ReferenceResolver resolver(final MarshalContext current) {
-        if (current != null) {
-            final ReferenceResolver resolver = current.resolver;
+    public static ReferenceResolver resolver(final MarshalContext context) {
+        if (context != null) {
+            final ReferenceResolver resolver = context.resolver;
             if (resolver != null) {
                 return resolver;
             }
@@ -227,15 +275,15 @@ public final class MarshalContext extend
      *
      * {@note This method is static for the convenience of performing the check for null context.}
      *
-     * @param  current The current context, or {@code null} if none.
+     * @param  context The current context, or {@code null} if none.
      * @param  key One of the value documented in the "<cite>Map key</cite>" column of
      *         {@link org.apache.sis.xml.XML#SCHEMAS}.
      * @param  defaultSchema The value to return if no schema is found for the given key.
      * @return The base URL of the schema, or {@code null} if none were specified.
      */
-    public static String schema(final MarshalContext current, final String key, final String defaultSchema) {
-        if (current != null) {
-            final Map<String,String> schemas = current.schemas;
+    public static String schema(final MarshalContext context, final String key, final String defaultSchema) {
+        if (context != null) {
+            final Map<String,String> schemas = context.schemas;
             if (schemas != null) {
                 final String schema = schemas.get(key);
                 if (schema != null) {
@@ -253,15 +301,15 @@ public final class MarshalContext extend
      *
      * {@note This method is static for the convenience of performing the check for null context.}
      *
-     * @param  current The current context, or {@code null} if none.
+     * @param  context The current context, or {@code null} if none.
      * @param  version The version to compare to.
      * @return {@code true} if the GML version is equals or newer than the specified version.
      *
      * @see #getVersion(String)
      */
-    public static boolean isGMLVersion(final MarshalContext current, final Version version) {
-        if (current != null) {
-            final Version versionGML = current.versionGML;
+    public static boolean isGMLVersion(final MarshalContext context, final Version version) {
+        if (context != null) {
+            final Version versionGML = context.versionGML;
             if (versionGML != null) {
                 return versionGML.compareTo(version) >= 0;
             }
@@ -270,53 +318,59 @@ public final class MarshalContext extend
     }
 
     /**
-     * Returns the schema version of the XML document being (un)marshalled.
-     * See the super-class javadoc for the list of prefix that we shall support.
+     * If marshalling, filters the given collection of identifiers in order to omit any identifiers
+     * for which the authority is one of the {@link org.apache.sis.xml.IdentifierSpace} constants.
+     *
+     * @param  identifiers The identifiers to filter, or {@code null}.
+     * @return The identifiers to marshal, or {@code null} if none.
      */
-    @Override
-    public final Version getVersion(final String prefix) {
-        if (prefix.equals("gml")) {
-            return versionGML;
+    public static Collection<Identifier> filterIdentifiers(Collection<Identifier> identifiers) {
+        if (identifiers != null && isFlagSet(current(), MARSHALING)) {
+            int count = identifiers.size();
+            if (count != 0) {
+                final Identifier[] copy = identifiers.toArray(new Identifier[count]);
+                for (int i=count; --i>=0;) {
+                    final Identifier id = copy[i];
+                    if (id == null || (id.getAuthority() instanceof NonMarshalledAuthority)) {
+                        System.arraycopy(copy, i+1, copy, i, --count - i);
+                    }
+                }
+                identifiers = (count != 0) ? UnmodifiableArrayList.wrap(copy, 0, count) : null;
+            }
         }
-        // Future SIS versions may add more cases here.
-        return null;
-    }
-
-    /**
-     * Returns the timezone, or {@code null} if none were explicitely defined.
-     * In the later case, an implementation-default (typically UTC) timezone is used.
-     */
-    @Override
-    public final TimeZone getTimeZone() {
-        return timezone;
-    }
-
-    /**
-     * Returns the locale to use for marshalling, or {@code null} if no locale were explicitly
-     * specified. A {@code null} value means that some locale-neutral language should be used
-     * if available, or an implementation-default locale (typically English) otherwise.
-     */
-    @Override
-    public final Locale getLocale() {
-        return locale;
+        return identifiers;
     }
 
     /**
      * Sets the locale to the given value. The old locales are remembered and will
-     * be restored by the next call to {@link #pullLocale()}.
+     * be restored by the next call to {@link #pull()}. This method can be invoked
+     * when marshalling object that need to marshall their children in a different
+     * locale, like below:
+     *
+     * {@preformat java
+     *     private void beforeMarshal(Marshaller marshaller) {
+     *         MarshalContext.push(language);
+     *     }
+     *
+     *     private void afterMarshal(Marshaller marshaller) {
+     *         MarshalContext.pull();
+     *     }
+     * }
      *
      * @param locale The locale to set, or {@code null}.
      */
     public static void push(final Locale locale) {
-        final MarshalContext current = new MarshalContext(current());
+        final MarshalContext context = new MarshalContext(current());
         if (locale != null) {
-            current.locale = locale;
+            context.locale = locale;
         }
     }
 
     /**
-     * Restores the locale (or any other setting) which was used prior the call to
-     * {@link #push(Locale)}.
+     * Restores the locale (or any other setting) which was used prior the call
+     * to {@link #push(Locale)}. It is not necessary to invoke this method in a
+     * {@code finally} block if the parent {@code MarshalContext} is itself
+     * disposed in a {@code finally} block.
      */
     public static void pull() {
         final MarshalContext current = current();
@@ -326,30 +380,6 @@ public final class MarshalContext extend
     }
 
     /**
-     * If marshalling, filters the given collection of identifiers in order to omit any identifiers
-     * for which the authority is one of the {@link org.apache.sis.xml.IdentifierSpace} constants.
-     *
-     * @param  identifiers The identifiers to filter, or {@code null}.
-     * @return The identifiers to marshal, or {@code null} if none.
-     */
-    public static Collection<Identifier> filterIdentifiers(Collection<Identifier> identifiers) {
-        if (identifiers != null && isFlagSet(MARSHALING)) {
-            int count = identifiers.size();
-            if (count != 0) {
-                final Identifier[] copy = identifiers.toArray(new Identifier[count]);
-                for (int i=count; --i>=0;) {
-                    final Identifier id = copy[i];
-                    if (id == null || (id.getAuthority() instanceof NonMarshalledAuthority)) {
-                        System.arraycopy(copy, i+1, copy, i, --count - i);
-                    }
-                }
-                identifiers = (count != 0) ? UnmodifiableArrayList.wrap(copy, 0, count) : null;
-            }
-        }
-        return identifiers;
-    }
-
-    /**
      * Invoked in a {@code finally} block when a unmarshalling process is finished.
      */
     public final void finish() {

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/CharSequenceAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/CharSequenceAdapter.java?rev=1429461&r1=1429460&r2=1429461&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/CharSequenceAdapter.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/CharSequenceAdapter.java Sun Jan  6 04:48:21 2013
@@ -16,12 +16,11 @@
  */
 package org.apache.sis.internal.jaxb.gco;
 
-import java.net.URI;
-import java.util.Map;
-import java.util.HashMap;
 import javax.xml.bind.annotation.adapters.XmlAdapter;
 import org.opengis.util.InternationalString;
-import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.CharSequences;
+import org.apache.sis.xml.XLink;
+import org.apache.sis.xml.ReferenceResolver;
 import org.apache.sis.internal.jaxb.MarshalContext;
 import org.apache.sis.internal.jaxb.gmx.Anchor;
 import org.apache.sis.internal.jaxb.gmd.PT_FreeText;
@@ -29,21 +28,14 @@ import org.apache.sis.internal.jaxb.gmd.
 
 /**
  * JAXB adapter in order to wrap the string value with a {@code <gco:CharacterString>} element,
- * for ISO-19139 compliance. A {@link CharSequenceAdapter} can also substitute text by anchors.
- * At the difference of most adapters provided in {@code org.apache.sis.internal.jaxb} packages,
- * this adapter is <em>configurable</em>. It must be created explicitly with a map of bindings
- * between labels and URNs, and the configured adapter must be given to the mashaller as below:
+ * for ISO-19139 compliance. A {@link CharSequenceAdapter} can handle the following types:
  *
- * {@preformat java
- *     CharSequenceAdapter adapter = new CharSequenceAdapter();
- *     adapter.addLinkage(...);
- *     marshaller.setAdapter(adapter);
- *     marshaller.setAdapter(new StringAdapter(adapter));
- *     marshaller.setAdapter(new InternationalStringAdapter(adapter));
- * }
- *
- * This class can also handles {@link InternationalString}, which will be mapped to
- * {@link PT_FreeText} elements.
+ * <ul>
+ *   <li>{@link InternationalString}, which will be mapped to {@link PT_FreeText} elements.</li>
+ *   <li>{@link String} (actually any character sequences other than {@code InternationalString}).</li>
+ *   <li>{@link Anchor}, which can be substituted to any of the above if the {@link ReferenceResolver}
+ *       in the current marshalling context maps the given text to a {@code xlink}.</li>
+ * </ul>
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Guilhem Legal (Geomatys)
@@ -57,118 +49,45 @@ import org.apache.sis.internal.jaxb.gmd.
  */
 public final class CharSequenceAdapter extends XmlAdapter<GO_CharacterString, CharSequence> {
     /**
-     * Binds string labels with URNs or anchors. Values can be either {@link URI} or
-     * {@link Anchor} instances. The map is initially null and will be created
-     * when first needed.
-     *
-     * @see #addLinkage(String, URI)
-     * @see #addLinkage(Anchor)
+     * Constructor for JAXB only.
      */
-    private Map<String,Object> anchors;
-
-    /**
-     * Creates a uninitialized adapter.
-     */
-    public CharSequenceAdapter() {
+    private CharSequenceAdapter() {
     }
 
     /**
-     * Adds a label associated to the given URN.
-     *
-     * @param  label The label associated to the URN.
-     * @param  linkage The URN.
-     * @throws IllegalStateException If a URN is already associated to the given label.
-     */
-    public void addLinkage(final String label, final URI linkage) throws IllegalStateException {
-        add(label, linkage);
-    }
-
-    /**
-     * Adds an anchor (label associated to an URN).
-     *
-     * @param  anchor The anchor to add.
-     * @throws IllegalStateException If a URN is already associated to the anchor value.
-     */
-    public void addLinkage(final Anchor anchor) throws IllegalStateException {
-        add(anchor.toString(), anchor);
-    }
-
-    /**
-     * Implementation of {@code addLinkage} methods.
-     */
-    private synchronized void add(final String label, final Object linkage) throws IllegalStateException {
-        if (anchors == null) {
-            anchors = new HashMap<String,Object>();
-        }
-        final Object old = anchors.put(label, linkage);
-        if (old != null) {
-            anchors.put(label, old);
-            if (!old.equals(linkage)) {
-                throw new IllegalStateException(Errors.format(Errors.Keys.ValueAlreadyDefined_1, label));
-            }
-        }
-    }
-
-    /**
-     * Converts a string read from a XML stream to the object containing
-     * the value. JAXB calls automatically this method at unmarshalling time.
+     * Converts a string read from a XML stream to the object containing the value.
+     * JAXB calls automatically this method at unmarshalling time.
      *
      * @param value The adapter for this metadata value.
      * @return A {@link CharSequence} which represents the metadata value.
      */
     @Override
     public CharSequence unmarshal(final GO_CharacterString value) {
-        if (value != null) {
-            if (value instanceof PT_FreeText) {
-                final PT_FreeText freeText = (PT_FreeText) value;
-                String defaultValue = freeText.toString(); // May be null.
-                if (defaultValue != null && freeText.contains(defaultValue)) {
-                    /*
-                     * If the <gco:CharacterString> value is repeated in one of the
-                     * <gmd:LocalisedCharacterString> elements, keep only the localized
-                     * version  (because it specifies the locale, while the unlocalized
-                     * string saids nothing on that matter).
-                     */
-                    defaultValue = null;
-                }
-                /*
-                 * Create the international string with all locales found in the <gml:textGroup>
-                 * element. If the <gml:textGroup> element is missing or empty, then we will use
-                 * an instance of SimpleInternationalString instead than the more heavy
-                 * DefaultInternationalString.
-                 */
-                return freeText.toInternationalString(defaultValue);
-            }
-            /*
-             * Case where the value is an ordinary GO_CharacterString (not a PT_FreeText).
-             */
-            CharSequence text = value.text;
-            if (text != null) {
-                if (text instanceof String) {
-                    text = ((String) text).trim();
-                }
-                if (text.length() != 0 || text instanceof Anchor) { // Anchor may contain attributes.
-                    return text;
-                }
-            }
-        }
-        return null;
+        return (value != null) ? value.toCharSequence() : null;
     }
 
     /**
      * Converts a {@linkplain CharSequence character sequence} to the object to be marshalled
      * in a XML file or stream. JAXB calls automatically this method at marshalling time.
      *
-     * @param value The string value.
-     * @return The wrapper for the given string.
+     * @param  value The string value.
+     * @return The wrapper for the given character sequence.
      */
     @Override
-    public GO_CharacterString marshal(CharSequence value) {
+    public GO_CharacterString marshal(final CharSequence value) {
+        return wrap(value);
+    }
+
+    /**
+     * Converts a {@linkplain CharSequence character sequence} to the object to be marshalled
+     * in a XML file or stream.
+     *
+     * @param  value The character representation of the object being marshalled.
+     * @return The wrapper for the given character sequence.
+     */
+    public static GO_CharacterString wrap(CharSequence value) {
         if (value instanceof String) {
-            value = ((String) value).trim();
-        }
-        if (value == null || value.length() == 0) {
-            return null;
+            return wrap(value, (String) value); // Slightly more efficient variant of this method.
         }
         /*
          * <gmd:someElement xsi:type="gmd:PT_FreeText_PropertyType">
@@ -185,24 +104,27 @@ public final class CharSequenceAdapter e
             }
         }
         /*
+         * Invoking (indirectly) CharSequence.subSequence(…) may change the kind of object.
+         * We know that Anchor is safe, and that most InternationalString implementations
+         * lost the localized strings. This is why we trim the white spaces only here.
+         */
+        value = CharSequences.trimWhitespaces(value);
+        if (value == null || value.length() == 0) {
+            return null;
+        }
+        /*
          * Substitute <gco:CharacterString> by <gmx:Anchor> if a linkage is found.
          */
         if (!(value instanceof Anchor)) {
-            synchronized (this) {
-                if (anchors != null) {
-                    String key = value.toString();
-                    if (key != null) {
-                        key = key.trim();
-                        if (!key.isEmpty()) {
-                            final Object linkage = anchors.get(key);
-                            if (linkage != null) {
-                                if (linkage instanceof URI) {
-                                    value = new Anchor((URI) linkage, key);
-                                } else {
-                                    value = (Anchor) linkage;
-                                }
-                            }
-                        }
+            final String key = CharSequences.trimWhitespaces(value.toString());
+            if (key != null && !key.isEmpty()) {
+                final MarshalContext context = MarshalContext.current();
+                final XLink linkage = MarshalContext.resolver(context).anchor(context, value, key);
+                if (linkage != null) {
+                    if (linkage instanceof Anchor) {
+                        value = (Anchor) linkage;
+                    } else {
+                        value = new Anchor(linkage, key);
                     }
                 }
             }
@@ -219,4 +141,31 @@ public final class CharSequenceAdapter e
          */
         return new GO_CharacterString(value);
     }
+
+    /**
+     * Converts the string representation of an object to be marshalled in a XML file or stream.
+     * This method is a copy of {@link #wrap(CharSequence)} simplified for the case when we know
+     * that the character sequence being marshalled is a string.
+     *
+     * @param  object The object being marshalled (e.g. {@code URI} or {@code Locale}).
+     * @param  string The string representation of the object being marshalled.
+     * @return The wrapper for the given character sequence.
+     */
+    public static GO_CharacterString wrap(final Object object, String string) {
+        string = CharSequences.trimWhitespaces(string);
+        if (string == null || string.isEmpty()) {
+            return null;
+        }
+        CharSequence value = string;
+        final MarshalContext context = MarshalContext.current();
+        final XLink linkage = MarshalContext.resolver(context).anchor(context, object, string);
+        if (linkage != null) {
+            if (linkage instanceof Anchor) {
+                value = (Anchor) linkage;
+            } else {
+                value = new Anchor(linkage, string);
+            }
+        }
+        return new GO_CharacterString(value);
+    }
 }

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java?rev=1429461&r1=1429460&r2=1429461&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java Sun Jan  6 04:48:21 2013
@@ -46,7 +46,7 @@ public class GO_CharacterString {
      * The text or anchor value, or {@code null} if none. May be an instance
      * of {@link Anchor}, which needs to be handled in a special way.
      */
-    CharSequence text;
+    private CharSequence text;
 
     /**
      * Empty constructor for JAXB and subclasses.
@@ -121,8 +121,23 @@ public class GO_CharacterString {
     }
 
     /**
+     * Returns the content of this {@code <gco:CharacterString>} as a {@code String},
+     * an {@code InternationalString} or an {@code Anchor}. This method is overridden
+     * by {@code PT_FreeText} in order to handle the international string case.
+     *
+     * @return The character sequence for this {@code <gco:CharacterString>}.
+     */
+    public CharSequence toCharSequence() {
+        final CharSequence text = CharSequences.trimWhitespaces(this.text);
+        if (text != null && (text.length() != 0 || text instanceof Anchor)) { // Anchor may contain attributes.
+            return text;
+        }
+        return null;
+    }
+
+    /**
      * Returns the text as a string, or {@code null} if none.
-     * The null value is expected by various {@code unmarshal} methods.
+     * The null value is expected by various {@code PT_FreeText}.
      *
      * {@note Returning <code>null</code> is unusual and not a recommended practice.
      * But precedents exist (for example Swing <code>DefaultMutableTreeNode</code>)

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java?rev=1429461&r1=1429460&r2=1429461&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java Sun Jan  6 04:48:21 2013
@@ -64,7 +64,7 @@ public final class Country extends GO_Ch
 
     /**
      * Builds a {@code <gco:CharacterString>} element.
-     * For private use by {@link #create(MarshalContext, Locale, CharSequenceAdapter)} only.
+     * For private use by {@link #create(MarshalContext, Locale)} only.
      */
     private Country(final GO_CharacterString code) {
         super(code);
@@ -88,16 +88,18 @@ public final class Country extends GO_Ch
      *
      * @param context The current (un)marshalling context, or {@code null} if none.
      * @param locale  The value to marshal, or {@code null}.
-     * @paral anchors If non-null, marshal the locale as a {@code <gco:CharacterString>} instead
-     *                than {@code <Country>}, using the given anchors if any.
      * @return The country to marshal, or {@code null} if the given locale was null
      *         or if its {@link Locale#getCountry()} attribute is the empty string.
      */
-    static Country create(final MarshalContext context, final Locale locale, final CharSequenceAdapter anchors) {
+    static Country create(final MarshalContext context, final Locale locale) {
         if (locale != null) {
             final String codeListValue = MarshalContext.converter(context).toCountryCode(context, locale);
-            if (anchors != null && !codeListValue.isEmpty()) {
-                final GO_CharacterString string = anchors.marshal(codeListValue);
+            if (!codeListValue.isEmpty() && MarshalContext.isFlagSet(context, MarshalContext.SUBSTITUTE_COUNTRY)) {
+                /*
+                 * Marshal the locale as a <gco:CharacterString> instead than <Country>,
+                 * using the user-supplied anchors if any.
+                 */
+                final GO_CharacterString string = CharSequenceAdapter.wrap(locale, codeListValue);
                 if (string != null) {
                     return new Country(string);
                 }

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LanguageCode.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LanguageCode.java?rev=1429461&r1=1429460&r2=1429461&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LanguageCode.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LanguageCode.java Sun Jan  6 04:48:21 2013
@@ -62,7 +62,7 @@ public final class LanguageCode extends 
 
     /**
      * Builds a {@code <gco:CharacterString>} element.
-     * For private use by {@link #create(MarshalContext, Locale, CharSequenceAdapter)} only.
+     * For private use by {@link #create(MarshalContext, Locale)} only.
      */
     private LanguageCode(final GO_CharacterString code) {
         super(code);
@@ -70,7 +70,7 @@ public final class LanguageCode extends 
 
     /**
      * Builds a {@code <LanguageCode>} element.
-     * For private use by {@link #create(MarshalContext, Locale, CharSequenceAdapter)} only.
+     * For private use by {@link #create(MarshalContext, Locale)} only.
      *
      * @param context       The current (un)marshalling context, or {@code null} if none.
      * @param codeListValue The {@code codeListValue} attribute in the XML element.
@@ -86,16 +86,18 @@ public final class LanguageCode extends 
      *
      * @param context The current (un)marshalling context, or {@code null} if none.
      * @param locale  The value to marshal, or {@code null}.
-     * @paral anchors If non-null, marshal the locale as a {@code <gco:CharacterString>} instead
-     *                than {@code <LanguageCode>}, using the given anchors if any.
      * @return The language to marshal, or {@code null} if the given locale was null
      *         or if its {@link Locale#getLanguage()} attribute is the empty string.
      */
-    static LanguageCode create(final MarshalContext context, final Locale locale, final CharSequenceAdapter anchors) {
+    static LanguageCode create(final MarshalContext context, final Locale locale) {
         if (locale != null) {
             final String codeListValue = MarshalContext.converter(context).toLanguageCode(context, locale);
-            if (anchors != null && !codeListValue.isEmpty()) {
-                final GO_CharacterString string = anchors.marshal(codeListValue);
+            if (!codeListValue.isEmpty() && MarshalContext.isFlagSet(context, MarshalContext.SUBSTITUTE_LANGUAGE)) {
+                /*
+                 * Marshal the locale as a <gco:CharacterString> instead than <LanguageCode>,
+                 * using the user-supplied anchors if any.
+                 */
+                final GO_CharacterString string = CharSequenceAdapter.wrap(locale, codeListValue);
                 if (string != null) {
                     return new LanguageCode(string);
                 }

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java?rev=1429461&r1=1429460&r2=1429461&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java Sun Jan  6 04:48:21 2013
@@ -76,7 +76,7 @@ public final class PT_FreeText extends G
     /**
      * Empty constructor used only by JAXB.
      */
-    public PT_FreeText() {
+    private PT_FreeText() {
     }
 
     /**
@@ -147,7 +147,7 @@ public final class PT_FreeText extends G
      * @param  search The text to search (usually the {@link #text} value).
      * @return {@code true} if the given text has been found.
      */
-    public boolean contains(final String search) {
+    private boolean contains(final String search) {
         final TextGroup[] textGroup = this.textGroup;
         if (textGroup != null) {
             for (final TextGroup group : textGroup) {
@@ -167,14 +167,26 @@ public final class PT_FreeText extends G
     }
 
     /**
-     * Returns the international string for this {@code PT_FreeText}.
-     *
-     * @param  defaultValue The unlocalized string to give to {@link DefaultInternationalString},
-     *         or {@code null} if none.
-     * @return The international string, or {@code null} if none.
-     *         This is usually the {@link #text} value.
+     * Returns the content of this {@code <gco:CharacterString>} as an {@code InternationalString}.
      */
-    public InternationalString toInternationalString(final String defaultValue) {
+    @Override
+    public CharSequence toCharSequence() {
+        String defaultValue = toString(); // May be null.
+        if (defaultValue != null && contains(defaultValue)) {
+            /*
+             * If the <gco:CharacterString> value is repeated in one of the
+             * <gmd:LocalisedCharacterString> elements, keep only the localized
+             * version  (because it specifies the locale, while the unlocalized
+             * string saids nothing on that matter).
+             */
+            defaultValue = null;
+        }
+        /*
+         * Create the international string with all locales found in the <gml:textGroup>
+         * element. If the <gml:textGroup> element is missing or empty, then we will use
+         * an instance of SimpleInternationalString instead than the more heavy
+         * DefaultInternationalString.
+         */
         DefaultInternationalString i18n = null;
         final TextGroup[] textGroup = this.textGroup;
         if (textGroup != null) {

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/Anchor.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/Anchor.java?rev=1429461&r1=1429460&r2=1429461&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/Anchor.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/Anchor.java Sun Jan  6 04:48:21 2013
@@ -29,19 +29,20 @@ import org.apache.sis.internal.util.Obje
 
 /**
  * The {@code Anchor} element, which is included in {@code CharacterString} elements.
- * This class extends {@link InternationalString} in an opportunist way, in order to allow
- * direct usage with public API expecting {@link CharSequence} or {@link InternationalString}
- * object.
+ * In XML documents,  anchors are values with {@code XLink} attributes used in places
+ * where we would normally expect a character sequence. Since Java properties of type
+ * {@code CharSequence} can not return {@code XLink},  we workaround that restriction
+ * by providing this {@code Anchor} class as a {@code XLink} subtype implementing the
+ * {@link InternationalString} interface, so it can be used with the above-cited Java
+ * properties.
  *
  * @author  Guilhem Legal (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.5)
  * @version 0.3
  * @module
- *
- * @see <a href="http://www.xml.com/pub/a/2000/09/xlink/part2.html">XLink introduction</a>
  */
-@XmlType(name = "AnchorType")
+@XmlType(name = "Anchor_Type")
 public final class Anchor extends XLink implements InternationalString {
     /**
      * Defined as a matter of principle (this class is not expected to be serialized).
@@ -49,7 +50,7 @@ public final class Anchor extends XLink 
     private static final long serialVersionUID = -6101324942683322597L;
 
     /**
-     * Often a short textual description of the URN target.
+     * Often a short textual description of the URI target.
      * This is the value returned by {@link #toString()}.
      */
     @XmlValue
@@ -63,10 +64,21 @@ public final class Anchor extends XLink 
     }
 
     /**
-     * Creates an {@code Anchor} initialized to the given value.
+     * Creates an {@code Anchor} initialized to the given {@code xlink} value.
+     *
+     * @param xlink The {@code xlink} from which to copy the attributes.
+     * @param value Often a short textual description of the URI target.
+     */
+    public Anchor(final XLink xlink, final String value) {
+        super(xlink);
+        this.value = value;
+    }
+
+    /**
+     * Creates an {@code Anchor} initialized to the given {@code href} value.
      *
-     * @param href  A URN to an external resources or an identifier.
-     * @param value Often a short textual description of the URN target.
+     * @param href  A URI to an external resources or an identifier.
+     * @param value Often a short textual description of the URI target.
      */
     public Anchor(final URI href, final String value) {
         setHRef(href);
@@ -74,8 +86,8 @@ public final class Anchor extends XLink 
     }
 
     /**
-     * Returns the text as a string, or {@code null} if none.
-     * The null value is expected by {@link GO_CharacterString#toString()}.
+     * Returns the text as a string, or {@code null} if none. The null value is needed for proper
+     * working of {@link org.apache.sis.internal.jaxb.gco.GO_CharacterString#toString()} method.
      */
     @Override
     public String toString() {
@@ -108,10 +120,21 @@ public final class Anchor extends XLink 
 
     /**
      * Returns the sequence of characters in the given range of index.
+     * The returned object still an anchor with the same attribute values.
+     * It is caller responsibility to determine if those attributes are still
+     * appropriate for the sub-sequence.
      */
     @Override
     public CharSequence subSequence(final int start, final int end) {
-        return (value != null ? value : "").subSequence(start, end);
+        String original = value;
+        if (original == null) {
+            original = "";
+        }
+        final String substring = original.substring(start, end);
+        if (substring == original) {
+            return this;
+        }
+        return new Anchor(this, substring);
     }
 
     /**

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/Supervisor.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/Supervisor.java?rev=1429461&r1=1429460&r2=1429461&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/Supervisor.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/Supervisor.java Sun Jan  6 04:48:21 2013
@@ -32,9 +32,11 @@ import javax.management.JMException;
 import javax.management.NotCompliantMBeanException;
 import java.lang.management.ManagementFactory;
 
+import org.apache.sis.util.About;
 import org.apache.sis.util.Localized;
 import org.apache.sis.util.logging.Logging;
 import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.collection.TreeTable;
 
 
 /**
@@ -126,22 +128,6 @@ public final class Supervisor extends St
     }
 
     /**
-     * If there is something wrong with the current Apache Supervisor status,
-     * returns descriptions of the problems. Otherwise returns {@code null}.
-     */
-    @Override
-    public List<String> warnings() {
-        final List<String> warnings = Threads.listDeadThreads();
-        if (warnings != null) {
-            final Errors resources = Errors.getResources(locale);
-            for (int i=warnings.size(); --i>=0;) {
-                warnings.set(i, resources.getString(Errors.Keys.DeadThread_1, warnings.get(i)));
-            }
-        }
-        return warnings;
-    }
-
-    /**
      * Returns the operations impact, which is {@code INFO}.
      */
     @Override
@@ -196,4 +182,31 @@ public final class Supervisor extends St
         return ResourceBundle.getBundle("org.apache.sis.internal.util.Descriptions",
                 locale, Supervisor.class.getClassLoader()).getString(resourceKey);
     }
+
+    // -----------------------------------------------------------------------
+    //               Implementation of SupervisorMBean interface
+    // -----------------------------------------------------------------------
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public TreeTable configuration() {
+        return About.configuration(locale);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public List<String> warnings() {
+        final List<String> warnings = Threads.listDeadThreads();
+        if (warnings != null) {
+            final Errors resources = Errors.getResources(locale);
+            for (int i=warnings.size(); --i>=0;) {
+                warnings.set(i, resources.getString(Errors.Keys.DeadThread_1, warnings.get(i)));
+            }
+        }
+        return warnings;
+    }
 }

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/SupervisorMBean.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/SupervisorMBean.java?rev=1429461&r1=1429460&r2=1429461&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/SupervisorMBean.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/SupervisorMBean.java Sun Jan  6 04:48:21 2013
@@ -17,6 +17,7 @@
 package org.apache.sis.internal.util;
 
 import java.util.List;
+import org.apache.sis.util.collection.TreeTable;
 
 
 /**
@@ -29,6 +30,17 @@ import java.util.List;
  */
 public interface SupervisorMBean {
     /**
+     * Returns information about the current configuration.
+     * This method tries to focus on the information that are the most relevant to SIS.
+     * Those information are grouped in sections: a "Versions" section containing the
+     * Apache SIS version, Java version and operation system version; a "Classpath"
+     * section containing bootstrap, extension and user classpath, <i>etc</i>.
+     *
+     * @return Configuration information, as a tree for grouping some configuration by sections.
+     */
+    TreeTable configuration();
+
+    /**
      * If there is something wrong with the current Apache SIS status,
      * returns descriptions of the problems. Otherwise returns {@code null}.
      *

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java?rev=1429461&r1=1429460&r2=1429461&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java Sun Jan  6 04:48:21 2013
@@ -197,7 +197,7 @@ class SexagesimalConverter extends UnitC
                     if (min >= 0) deg++; else deg--;
                     min = 0;
                 } else {
-                    throw illegalField(angle, min, Vocabulary.Keys.Minutes);
+                    throw illegalField(angle, min, Vocabulary.Keys.AngularMinutes);
                 }
             }
             if (sec <= -60 || sec >= 60) { // Do not enter for NaN
@@ -205,7 +205,7 @@ class SexagesimalConverter extends UnitC
                     if (sec >= 0) min++; else min--;
                     sec = 0;
                 } else {
-                    throw illegalField(angle, sec, Vocabulary.Keys.Seconds);
+                    throw illegalField(angle, sec, Vocabulary.Keys.AngularSeconds);
                 }
             }
             return (sec/60 + min)/60 + deg;

Copied: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/About.java (from r1429460, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/About.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/About.java?p2=sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/About.java&p1=sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/About.java&r1=1429460&r2=1429461&rev=1429461&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/About.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/About.java Sun Jan  6 04:48:21 2013
@@ -51,6 +51,9 @@ import static java.lang.System.getProper
 import static org.apache.sis.util.collection.TableColumn.NAME;
 import static org.apache.sis.util.collection.TableColumn.VALUE_AS_TEXT;
 
+// JDK7 related
+import org.apache.sis.internal.util.JDK7;
+
 
 /**
  * Provides information about the Apache SIS running environment.
@@ -191,7 +194,7 @@ public enum About {
         if (console != null) {
             final PrintWriter out = console.writer();
             out.write(configuration);
-            out.write(System.lineSeparator());
+            out.write(JDK7.lineSeparator());
             out.flush();
         } else {
             final PrintStream out = System.out;
@@ -513,7 +516,8 @@ pathTree:   for (int j=0; ; j++) {
             }
             final File file = entry.getKey();
             if (file.isFile() && file.canRead()) {
-                try (final JarFile jar = new JarFile(file)) {
+                try {
+                    final JarFile jar = new JarFile(file);
                     final Manifest manifest = jar.getManifest();
                     if (manifest != null) {
                         final Attributes attributes = manifest.getMainAttributes();
@@ -529,11 +533,10 @@ pathTree:   for (int j=0; ; j++) {
                                     file.getParentFile(), false, files);
                         }
                     }
+                    jar.close();
                 } catch (IOException e) {
                     if (error == null) {
                         error = e;
-                    } else {
-                        error.addSuppressed(e);
                     }
                 }
             }
@@ -554,7 +557,7 @@ pathTree:   for (int j=0; ; j++) {
      */
     private static Map<File,CharSequence> put(Map<File,CharSequence> files, final File file) {
         if (files == null) {
-            files = new LinkedHashMap<>();
+            files = new LinkedHashMap<File,CharSequence>();
         }
         final CharSequence old = files.put(file, null);
         if (old != null) {

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/Version.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/Version.java?rev=1429461&r1=1429460&r2=1429461&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/Version.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/Version.java Sun Jan  6 04:48:21 2013
@@ -146,7 +146,7 @@ public class Version implements CharSequ
         }
         Comparable<?> candidate = parsed[index];
         if (candidate == null) {
-            final String value = components[index].trim();
+            final String value = CharSequences.trimWhitespaces(components[index]);
             try {
                 candidate = Integer.valueOf(value);
             } catch (NumberFormatException e) {

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java?rev=1429461&r1=1429460&r2=1429461&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java Sun Jan  6 04:48:21 2013
@@ -21,7 +21,6 @@ import java.util.Map;
 import java.util.LinkedHashMap;
 import java.util.Collections;
 import java.io.Serializable;
-import java.text.Format;
 import net.jcip.annotations.NotThreadSafe;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
@@ -50,19 +49,18 @@ import org.apache.sis.internal.util.Obje
  *
  *         public TreeTable createTable() {
  *             DefaultTreeTable table = new DefaultTreeTable(CITY_NAME, LATITUDE, LONGITUDE);
- *             TreeTable.Node   city  = new DefaultTreeTable.Node(table);
+ *             TreeTable.Node   city  = table.getRoot();
  *             city.setValue(CITY_NAME, "Rimouski");
  *             city.setValue(LATITUDE,   48.470417);
  *             city.setValue(LONGITUDE, -68.521385);
- *             table.setRoot(city);
  *             return table;
  *         }
  *     }
  * }
  *
- * {@code DefaultTreeTable} accepts arbitrary {@link TreeTable.Node} implementations.
- * However it is likely to be safer and more memory efficient when used together with
- * the implementation provided in the {@link Node} inner class.
+ * The {@code setRoot(…)} method accepts arbitrary {@link TreeTable.Node} implementations.
+ * However it is likely to be safer and more memory efficient when used together with the
+ * implementation provided in the {@link Node} inner class.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
@@ -77,11 +75,6 @@ public class DefaultTreeTable implements
     private static final long serialVersionUID = 1951201018202846555L;
 
     /**
-     * Shared {@code TreeTableFormat} instance for {@link #toString()} implementation.
-     */
-    private static Format format;
-
-    /**
      * The root node, or {@code null} if not yet specified.
      *
      * @see #getRoot()
@@ -103,8 +96,8 @@ public class DefaultTreeTable implements
      * map shall be read-only since many {@code Node} instances may share it.
      *
      * {@note This field and the {@link #columns} field could be computed from each other.
-     *        We serialize this field because children nodes will typically hold a reference
-     *        to that map, and we want to preserve the references tree.}
+     *        But we serialize this field anyway because children nodes will typically hold
+     *        a reference to that map, and we want to preserve the references tree.}
      *
      * @see DefaultTreeTable.Node#columnIndices
      */
@@ -121,9 +114,6 @@ public class DefaultTreeTable implements
      * Creates a new tree table with the given columns. The given array shall not be null or
      * empty, and shall not contain null or duplicated elements.
      *
-     * <p>The {@linkplain #getRoot() root} node is initially {@code null}. Callers can initialize
-     * it after construction time by a call to the {@link #setRoot(TreeTable.Node)} method.</p>
-     *
      * @param columns The list of table columns.
      */
     public DefaultTreeTable(TableColumn<?>... columns) {
@@ -202,13 +192,11 @@ public class DefaultTreeTable implements
      * Returns the root node. This method returns the node specified at
      * {@linkplain #DefaultTreeTable(Node) construction time} or to the
      * last call of the {@link #setRoot(TreeTable.Node)} method.
-     *
-     * @throws IllegalStateException If the root node has not yet been specified.
      */
     @Override
     public TreeTable.Node getRoot() {
         if (root == null) {
-            throw new IllegalStateException(Errors.format(Errors.Keys.NodeNotFound_1, "root"));
+            root = new Node(this);
         }
         return root;
     }
@@ -287,7 +275,7 @@ public class DefaultTreeTable implements
 
     /**
      * Returns a string representation of this tree table.
-     * The default implementation delegates to {@link #toString(TreeTable)}.
+     * The default implementation performs the same work than {@link TreeTables#toString(TreeTable)}.
      * This is okay for debugging or occasional usages. However for more extensive usages,
      * developers are encouraged to create and configure their own {@link TreeTableFormat}
      * instance.
@@ -296,25 +284,9 @@ public class DefaultTreeTable implements
      */
     @Override
     public String toString() {
-        return toString(this);
-    }
-
-    /**
-     * Returns a string representation of the given tree table.
-     * The default implementation uses a shared instance of {@link TreeTableFormat}.
-     * This is okay for debugging or occasional usages. However for more extensive usages,
-     * developers are encouraged to create and configure their own {@code TreeTableFormat}
-     * instance.
-     *
-     * @param  table The tree table to format.
-     * @return A string representation of the given tree table.
-     */
-    public static synchronized String toString(final TreeTable table) {
-        ArgumentChecks.ensureNonNull("table", table);
-        if (format == null) {
-            format = new TreeTableFormat(null, null);
+        synchronized (TreeTableFormat.INSTANCE) {
+            return TreeTableFormat.INSTANCE.format(this);
         }
-        return format.format(table);
     }
 
 
@@ -533,6 +505,24 @@ public class DefaultTreeTable implements
         }
 
         /**
+         * Adds a new child in the {@linkplain #getChildren() children list}.
+         * The default implementation delegates to {@link #Node(Node)}, which
+         * has the following implications:
+         *
+         * <ul>
+         *   <li>The new node inherits the columns of this node, on the assumption that
+         *       they are the same set of columns than other children nodes.</li>
+         *   <li>The new node is appended at the end of the children list.</li>
+         * </ul>
+         *
+         * Subclasses may override this method with different behavior.
+         */
+        @Override
+        public Node newChild() {
+            return new Node(this);
+        }
+
+        /**
          * Returns the value in the given column, or {@code null} if none.
          *
          * @param  <V>    The base type of values in the given column.

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/TableColumn.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/TableColumn.java?rev=1429461&r1=1429460&r2=1429461&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/TableColumn.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/TableColumn.java Sun Jan  6 04:48:21 2013
@@ -100,7 +100,8 @@ import org.apache.sis.util.resources.Voc
 public class TableColumn<V> implements CheckedContainer<V> {
     /**
      * Frequently-used constant for a column of object names.
-     * The values are typically instances of {@link String} or {@link InternationalString},
+     * The column {@linkplain #getHeader() header} is "<cite>Name</cite>" (eventually localized) and
+     * the column elements are typically instances of {@link String} or {@link InternationalString},
      * depending on whether the data provide localization support or not.
      */
     public static final TableColumn<CharSequence> NAME = new Constant<CharSequence>("NAME",
@@ -108,12 +109,31 @@ public class TableColumn<V> implements C
 
     /**
      * Frequently-used constant for a column of object types.
+     * The column {@linkplain #getHeader() header} is "<cite>Type</cite>" (eventually localized).
      */
     @SuppressWarnings("unchecked")
     public static final TableColumn<Class<?>> TYPE = new Constant<Class<?>>("TYPE",
             (Class) Class.class, Vocabulary.Keys.Type);
 
     /**
+     * Frequently-used constant for a column of object textual values.
+     * The column {@linkplain #getHeader() header} is "<cite>Value</cite>" (eventually localized) and
+     * the column elements are typically instances of {@link String} or {@link InternationalString},
+     * depending on whether the data provide localization support or not.
+     */
+    @SuppressWarnings("unchecked")
+    public static final TableColumn<CharSequence> VALUE_AS_TEXT = new Constant<CharSequence>("VALUE_AS_TEXT",
+            CharSequence.class, Vocabulary.Keys.Value);
+
+    /**
+     * Frequently-used constant for a column of object numerical values.
+     * The column {@linkplain #getHeader() header} is "<cite>Value</cite>" (eventually localized).
+     */
+    @SuppressWarnings("unchecked")
+    public static final TableColumn<Number> VALUE_AS_NUMBER = new Constant<Number>("VALUE_AS_NUMBER",
+            Number.class, Vocabulary.Keys.Value);
+
+    /**
      * A map containing only the {@link #NAME} column.
      * This is the default set of columns when parsing a table tree.
      */

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTable.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTable.java?rev=1429461&r1=1429460&r2=1429461&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTable.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTable.java Sun Jan  6 04:48:21 2013
@@ -103,7 +103,7 @@ public interface TreeTable {
      * <tr><td><ul>
      *   <li>{@link #getParent()}</li>
      *   <li>{@link #getChildren()}</li>
-     *   <li>{@link #getUserObject()}</li>
+     *   <li>{@link #newChild()}</li>
      * </ul></td>
      * <td><ul>
      *   <li>{@link #getValue(TableColumn)}</li>
@@ -112,6 +112,9 @@ public interface TreeTable {
      * </ul></td></tr>
      * </table>
      *
+     * In addition, each {@code Node} can be associated to an arbitrary object by the
+     * {@link #getUserObject()} method. This object is not used directly by the tree tables.
+     *
      * @author  Martin Desruisseaux (IRD, Geomatys)
      * @since   0.3 (derived from geotk-3.19)
      * @version 0.3
@@ -148,6 +151,16 @@ public interface TreeTable {
         List<Node> getChildren();
 
         /**
+         * Creates a new child with the same columns than the other children, and add it to
+         * the {@linkplain #getChildren() children list}. The new child is typically added at
+         * the end of the list, but this is not mandatory: implementations can add the child
+         * at whatever position they see fit.
+         *
+         * @return The new child.
+         */
+        Node newChild();
+
+        /**
          * Returns the value in the given column, or {@code null} if none.
          *
          * @param  <V>    The base type of values in the given column.

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java?rev=1429461&r1=1429460&r2=1429461&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java Sun Jan  6 04:48:21 2013
@@ -92,6 +92,12 @@ public class TreeTableFormat extends Tab
     private static final long serialVersionUID = -4476366905386037025L;
 
     /**
+     * Shared {@code TreeTableFormat} instance for {@link TreeTable#toString()} implementation.
+     * Usage of this instance shall be done in a synchronized block.
+     */
+    static final TreeTableFormat INSTANCE = new TreeTableFormat(null, null);
+
+    /**
      * The table columns to format, or {@code null} for formatting all of them.
      * This map shall not be modified after creation, because it may be shared
      * by many tables.

Copied: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTables.java (from r1429460, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTables.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTables.java?p2=sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTables.java&p1=sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTables.java&r1=1429460&r2=1429461&rev=1429461&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTables.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTables.java Sun Jan  6 04:48:21 2013
@@ -21,7 +21,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Locale;
 import java.io.File;
-import java.nio.file.Path;
 import java.text.ParseException;
 import org.opengis.util.InternationalString;
 import org.apache.sis.util.Static;
@@ -129,38 +128,6 @@ public final class TreeTables extends St
      *
      * @param  from   The root node from which to start the search.
      * @param  column The column containing the file name.
-     * @param  path   The path for which to find or create a node.
-     * @return The node for the given path, either as an existing node or a new node.
-     */
-    public static TreeTable.Node nodeForPath(TreeTable.Node from,
-            final TableColumn<? super String> column, final Path path)
-    {
-        final Path parent = path.getParent();
-        if (parent != null) {
-            from = nodeForPath(from, column, parent);
-        }
-        Path filename = path.getFileName();
-        if (filename == null) {
-            filename = path.getRoot();
-        }
-        final String name = filename.toString();
-        for (final TreeTable.Node child : from.getChildren()) {
-            if (name.equals(child.getValue(column))) {
-                return child;
-            }
-        }
-        from = from.newChild();
-        from.setValue(column, name);
-        return from;
-    }
-
-    /**
-     * Finds the node for the given file, or creates a new node if none exists.
-     * This method performs the same work than the above variant, but working on
-     * {@code File} instances rather than {@code Path}.
-     *
-     * @param  from   The root node from which to start the search.
-     * @param  column The column containing the file name.
      * @param  path   The file for which to find or create a node.
      * @return The node for the given file, either as an existing node or a new node.
      */

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java?rev=1429461&r1=1429460&r2=1429461&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java Sun Jan  6 04:48:21 2013
@@ -61,7 +61,82 @@ public final class Vocabulary extends In
         /**
          * Degrees
          */
-        public static final int Degrees = 10;
+        public static final int AngularDegrees = 10;
+
+        /**
+         * Minutes
+         */
+        public static final int AngularMinutes = 11;
+
+        /**
+         * Seconds
+         */
+        public static final int AngularSeconds = 12;
+
+        /**
+         * Character encoding
+         */
+        public static final int CharacterEncoding = 17;
+
+        /**
+         * Classpath
+         */
+        public static final int Classpath = 29;
+
+        /**
+         * {0} code
+         */
+        public static final int Code_1 = 21;
+
+        /**
+         * Current date and time
+         */
+        public static final int CurrentDateTime = 25;
+
+        /**
+         * Current directory
+         */
+        public static final int CurrentDirectory = 33;
+
+        /**
+         * Daylight time
+         */
+        public static final int DaylightTime = 24;
+
+        /**
+         * Directory
+         */
+        public static final int Directory = 36;
+
+        /**
+         * Java extensions
+         */
+        public static final int JavaExtensions = 26;
+
+        /**
+         * Java home directory
+         */
+        public static final int JavaHome = 30;
+
+        /**
+         * Libraries
+         */
+        public static final int Libraries = 35;
+
+        /**
+         * Local configuration
+         */
+        public static final int LocalConfiguration = 14;
+
+        /**
+         * Locale
+         */
+        public static final int Locale = 18;
+
+        /**
+         * Localization
+         */
+        public static final int Localization = 19;
 
         /**
          * Maximum value
@@ -79,11 +154,6 @@ public final class Vocabulary extends In
         public static final int MinimumValue = 4;
 
         /**
-         * Minutes
-         */
-        public static final int Minutes = 11;
-
-        /**
          * Name
          */
         public static final int Name = 0;
@@ -99,14 +169,39 @@ public final class Vocabulary extends In
         public static final int NumberOfValues = 2;
 
         /**
+         * Offset
+         */
+        public static final int Offset = 22;
+
+        /**
+         * Operating system
+         */
+        public static final int OperatingSystem = 16;
+
+        /**
+         * Others
+         */
+        public static final int Others = 34;
+
+        /**
+         * Paths
+         */
+        public static final int Paths = 27;
+
+        /**
+         * Root
+         */
+        public static final int Root = 28;
+
+        /**
          * Root Mean Square
          */
         public static final int RootMeanSquare = 7;
 
         /**
-         * Seconds
+         * Scale
          */
-        public static final int Seconds = 12;
+        public static final int Scale = 23;
 
         /**
          * Standard deviation
@@ -114,9 +209,39 @@ public final class Vocabulary extends In
         public static final int StandardDeviation = 8;
 
         /**
+         * Temporary files
+         */
+        public static final int TemporaryFiles = 31;
+
+        /**
+         * Timezone
+         */
+        public static final int Timezone = 20;
+
+        /**
          * Type
          */
         public static final int Type = 1;
+
+        /**
+         * Untitled
+         */
+        public static final int Untitled = 37;
+
+        /**
+         * User home directory
+         */
+        public static final int UserHome = 32;
+
+        /**
+         * Value
+         */
+        public static final int Value = 13;
+
+        /**
+         * Versions
+         */
+        public static final int Versions = 15;
     }
 
     /**

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties?rev=1429461&r1=1429460&r2=1429461&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties Sun Jan  6 04:48:21 2013
@@ -14,16 +14,41 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-Angle             = Angle
-Degrees           = Degrees
-MaximumValue      = Maximum value
-MeanValue         = Mean value
-MinimumValue      = Minimum value
-Minutes           = Minutes
-Name              = Name
-NumberOfValues    = Number of values
-NumberOfNaN       = Number of \u2018NaN\u2019
-RootMeanSquare    = Root Mean Square
-Seconds           = Seconds
-StandardDeviation = Standard deviation
-Type              = Type
+Angle              = Angle
+AngularDegrees     = Degrees
+AngularMinutes     = Minutes
+AngularSeconds     = Seconds
+CharacterEncoding  = Character encoding
+Classpath          = Classpath
+Code_1             = {0} code
+CurrentDateTime    = Current date and time
+CurrentDirectory   = Current directory
+DaylightTime       = Daylight time
+Directory          = Directory
+JavaExtensions     = Java extensions
+JavaHome           = Java home directory
+Libraries          = Libraries
+LocalConfiguration = Local configuration
+Locale             = Locale
+Localization       = Localization
+MaximumValue       = Maximum value
+MeanValue          = Mean value
+MinimumValue       = Minimum value
+Name               = Name
+NumberOfValues     = Number of values
+NumberOfNaN        = Number of \u2018NaN\u2019
+Offset             = Offset
+OperatingSystem    = Operating system
+Others             = Others
+Paths              = Paths
+Root               = Root
+RootMeanSquare     = Root Mean Square
+Scale              = Scale
+StandardDeviation  = Standard deviation
+TemporaryFiles     = Temporary files
+Timezone           = Timezone
+Type               = Type
+Untitled           = Untitled
+UserHome           = User home directory
+Value              = Value
+Versions           = Versions



Mime
View raw message