sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1490056 - in /sis/trunk: ./ application/sis-app/ application/sis-webapp/ application/sis-webapp/src/main/webapp/ core/sis-build-helper/src/site/ core/sis-metadata/src/site/ core/sis-referencing/ core/sis-utility/src/main/java/org/apache/si...
Date Wed, 05 Jun 2013 22:47:23 GMT
Author: desruisseaux
Date: Wed Jun  5 22:47:22 2013
New Revision: 1490056

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

Added:
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/AutoCloseable.java
      - copied unchanged from r1490053, sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/AutoCloseable.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/setup/
      - copied from r1490053, sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/setup/
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListener.java
      - copied unchanged from r1490053, sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListener.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java
      - copied unchanged from r1490053, sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java
    sis/trunk/core/sis-utility/src/test/java/org/apache/sis/setup/
      - copied from r1490053, sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/setup/
    sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/logging/EmptyWarningListeners.java
      - copied unchanged from r1490053, sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/logging/EmptyWarningListeners.java
    sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/logging/WarningListenersTest.java
      - copied unchanged from r1490053, sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/logging/WarningListenersTest.java
    sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStore.java
      - copied unchanged from r1490053, sis/branches/JDK6/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStore.java
    sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java
      - copied unchanged from r1490053, sis/branches/JDK6/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java
    sis/trunk/storage/sis-netcdf/src/site/site.xml
      - copied unchanged from r1490053, sis/branches/JDK6/storage/sis-netcdf/src/site/site.xml
    sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreProviderTest.java
      - copied, changed from r1490053, sis/branches/JDK6/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreProviderTest.java
    sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreTest.java
      - copied, changed from r1490053, sis/branches/JDK6/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreTest.java
    sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/IOUtilities.java
      - copied unchanged from r1490053, sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/IOUtilities.java
    sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/AbstractDataStore.java
      - copied unchanged from r1490053, sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/storage/AbstractDataStore.java
    sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStore.java
      - copied unchanged from r1490053, sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStore.java
    sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreConnection.java
      - copied unchanged from r1490053, sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreConnection.java
    sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreProvider.java
      - copied unchanged from r1490053, sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreProvider.java
    sis/trunk/storage/sis-storage/src/site/
      - copied from r1490053, sis/branches/JDK6/storage/sis-storage/src/site/
    sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/IOUtilitiesTest.java
      - copied unchanged from r1490053, sis/branches/JDK6/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/IOUtilitiesTest.java
    sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/storage/
      - copied from r1490053, sis/branches/JDK6/storage/sis-storage/src/test/java/org/apache/sis/storage/
    sis/trunk/storage/src/site/site.xml
      - copied unchanged from r1490053, sis/branches/JDK6/storage/src/site/site.xml
Removed:
    sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/WarningProducer.java
Modified:
    sis/trunk/   (props changed)
    sis/trunk/README
    sis/trunk/application/sis-app/pom.xml
    sis/trunk/application/sis-webapp/pom.xml
    sis/trunk/application/sis-webapp/src/main/webapp/demo.jsp
    sis/trunk/core/sis-build-helper/src/site/site.xml
    sis/trunk/core/sis-metadata/src/site/site.xml
    sis/trunk/core/sis-referencing/pom.xml
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/JDK7.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Exceptions.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
    sis/trunk/core/sis-utility/src/site/site.xml
    sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java
    sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
    sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/NumbersTest.java
    sis/trunk/core/src/site/site.xml
    sis/trunk/pom.xml
    sis/trunk/src/main/docbook/fr.xml
    sis/trunk/src/site/site.xml
    sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Decoder.java
    sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
    sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/DecoderWrapper.java
    sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
    sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/IOTestCase.java
    sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java
    sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/ChannelDecoderTest.java
    sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java
    sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/test/suite/NetcdfTestSuite.java
    sis/trunk/storage/sis-storage/pom.xml
    sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/ChannelDataInput.java
    sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/ChannelImageInputStream.java
    sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreException.java
    sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/package-info.java
    sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/ChannelDataInputTest.java
    sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/test/suite/StorageTestSuite.java

Propchange: sis/trunk/
------------------------------------------------------------------------------
  Merged /sis/branches/JDK7:r1486991-1490042
  Merged /sis/branches/JDK6:r1486997-1490053

Modified: sis/trunk/README
URL: http://svn.apache.org/viewvc/sis/trunk/README?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/README (original)
+++ sis/trunk/README Wed Jun  5 22:47:22 2013
@@ -1,6 +1,6 @@
-========================================================
-Welcome to Apache SIS <http://incubator.apache.org/sis/>
-========================================================
+=============================================
+Welcome to Apache SIS <http://sis.apache.org>
+=============================================
 
 Apache SIS(TM) is a spatial framework that enables better representation
 of coordinates for searching, data clustering, archiving, or any other

Modified: sis/trunk/application/sis-app/pom.xml
URL: http://svn.apache.org/viewvc/sis/trunk/application/sis-app/pom.xml?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/application/sis-app/pom.xml (original)
+++ sis/trunk/application/sis-app/pom.xml Wed Jun  5 22:47:22 2013
@@ -34,7 +34,7 @@
   <artifactId>sis-app</artifactId>
   <packaging>bundle</packaging>
   <name>Apache SIS app</name>
-  <url>http://incubator.apache.org/sis/</url>
+  <url>http://sis.apache.org</url>
 
   <build>
     <plugins>

Modified: sis/trunk/application/sis-webapp/pom.xml
URL: http://svn.apache.org/viewvc/sis/trunk/application/sis-webapp/pom.xml?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/application/sis-webapp/pom.xml (original)
+++ sis/trunk/application/sis-webapp/pom.xml Wed Jun  5 22:47:22 2013
@@ -34,7 +34,7 @@
   <artifactId>sis-webapp</artifactId>
   <packaging>war</packaging>
   <name>Apache SIS web services layer</name>
-  <url>http://incubator.apache.org/sis/</url>
+  <url>http://sis.apache.org</url>
 
   <dependencies>
     <dependency>

Modified: sis/trunk/application/sis-webapp/src/main/webapp/demo.jsp
URL: http://svn.apache.org/viewvc/sis/trunk/application/sis-webapp/src/main/webapp/demo.jsp?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/application/sis-webapp/src/main/webapp/demo.jsp (original)
+++ sis/trunk/application/sis-webapp/src/main/webapp/demo.jsp Wed Jun  5 22:47:22 2013
@@ -1,14 +1,14 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<!-- 
+<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at
- 
+
       http://www.apache.org/licenses/LICENSE-2.0
- 
+
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -64,7 +64,7 @@ body {
 <script type="text/javascript">
 	var map;
 	var req;
-	
+
 	function initialize() {
 		map = new L.Map('map_canvas', {scrollWheelZoom:false});
 		var tileURL = 'http://{s}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png';
@@ -147,7 +147,7 @@ body {
 				}
 
 				document.getElementById("result").innerHTML = ids.length + " results (" + ( parseInt(time[0].firstChild.nodeValue)  / 1000 ) + " seconds)";
-				
+
 				for ( var i = 0; i < ids.length; i++) {
 					var latLon = new L.LatLng(
 							parseFloat(lats[i].firstChild.nodeValue),
@@ -207,11 +207,11 @@ body {
 			req.send("filename=" + filename);
 		}
 	}
-	
+
 	function createMarker(latLon, filename) {
 		var marker = new L.Marker(latLon);
 		map.addLayer(marker);
-		marker.on('click', function(event) 
+		marker.on('click', function(event)
 		{
 			getHTMLDescription(filename, marker);
 		});
@@ -227,7 +227,7 @@ body {
 			}
 		}
 	}
-	
+
 	function switchType()
 	{
 
@@ -269,12 +269,12 @@ body {
 				return false;
 			}
 		}
-		
+
 	}
 </script>
 </head>
 <body onload="initialize()">
-<div class="center" ><a href="http://incubator.apache.org/sis/"><image src="images/sis_logo_small.png" alt="Apache SIS: Spatial Information System" border="0"/></a></div>
+<div class="center" ><a href="http://sis.apache.org"><image src="images/sis_logo_small.png" alt="Apache SIS: Spatial Information System" border="0"/></a></div>
 <form method="get"
 	onsubmit="return validate()" class="center">
 

Modified: sis/trunk/core/sis-build-helper/src/site/site.xml
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-build-helper/src/site/site.xml?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/core/sis-build-helper/src/site/site.xml (original)
+++ sis/trunk/core/sis-build-helper/src/site/site.xml Wed Jun  5 22:47:22 2013
@@ -19,10 +19,10 @@
   under the License.
 -->
 
-<project xmlns="http://maven.apache.org/DECORATION/1.0.0"
+<project xmlns="http://maven.apache.org/DECORATION/1.3.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0
-                             http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+         xsi:schemaLocation="http://maven.apache.org/DECORATION/1.3.0
+                             http://maven.apache.org/xsd/decoration-1.3.0.xsd">
 
   <!-- ====================================================
            Site descriptor for Apache SIS build helper

Modified: sis/trunk/core/sis-metadata/src/site/site.xml
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/site/site.xml?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/site/site.xml (original)
+++ sis/trunk/core/sis-metadata/src/site/site.xml Wed Jun  5 22:47:22 2013
@@ -19,10 +19,10 @@
   under the License.
 -->
 
-<project xmlns="http://maven.apache.org/DECORATION/1.0.0"
+<project xmlns="http://maven.apache.org/DECORATION/1.3.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0
-                             http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+         xsi:schemaLocation="http://maven.apache.org/DECORATION/1.3.0
+                             http://maven.apache.org/xsd/decoration-1.3.0.xsd">
 
   <!-- ====================================================
            Site descriptor for Apache SIS metadata module

Modified: sis/trunk/core/sis-referencing/pom.xml
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/pom.xml?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/pom.xml (original)
+++ sis/trunk/core/sis-referencing/pom.xml Wed Jun  5 22:47:22 2013
@@ -34,7 +34,7 @@
   <artifactId>sis-referencing</artifactId>
   <packaging>bundle</packaging>
   <name>Apache SIS referencing</name>
-  <url>http://incubator.apache.org/sis/</url>
+  <url>http://sis.apache.org</url>
 
 
   <!-- ===========================================================

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/JDK7.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/JDK7.java?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/JDK7.java (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/JDK7.java Wed Jun  5 22:47:22 2013
@@ -16,6 +16,12 @@
  */
 package org.apache.sis.internal.jdk7;
 
+import java.io.Closeable;
+import java.sql.Connection;
+import java.sql.Statement;
+import java.sql.ResultSet;
+import javax.imageio.stream.ImageInputStream;
+
 
 /**
  * Place holder for methods defined only in JDK7. Those methods are defined in existing classes,
@@ -85,4 +91,30 @@ public final class JDK7 {
         c += Character.MIN_LOW_SURROGATE;
         return (char) c;
     }
+
+    /**
+     * Simulates the {@code object instanceof AutoCloseable} code.
+     *
+     * @param  object The object to check, or {@code null}.
+     * @return {@code true} if the given object is closeable.
+     */
+    public static boolean isAutoCloseable(final Object object) {
+        return (object instanceof AutoCloseable) || (object instanceof Closeable) || (object instanceof ImageInputStream) ||
+                (object instanceof Connection) || (object instanceof Statement) || (object instanceof ResultSet);
+    }
+
+    /**
+     * Simulates the {@code ((AutoCloseable) object).close()} method call.
+     *
+     * @param  object The object to close.
+     * @throws Exception If an error occurred while closing the object.
+     */
+    public static void close(final Object object) throws Exception {
+             if (object instanceof Closeable)        ((Closeable)        object).close();
+        else if (object instanceof ImageInputStream) ((ImageInputStream) object).close();
+        else if (object instanceof Connection)       ((Connection)       object).close();
+        else if (object instanceof Statement)        ((Statement)        object).close();
+        else if (object instanceof ResultSet)        ((ResultSet)        object).close();
+        else ((AutoCloseable) object).close(); // Intentionally no 'instanceof' check.
+    }
 }

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Exceptions.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Exceptions.java?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Exceptions.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Exceptions.java [UTF-8] Wed Jun  5 22:47:22 2013
@@ -113,7 +113,7 @@ public final class Exceptions extends St
      * {@linkplain Throwable#getLocalizedMessage() localized message} of the given exception
      * on the next line. If the exception has a {@linkplain Throwable#getCause() causes}, then
      * the localized message of the cause is formatted on the next line and the process is
-     * repeated for the whole cause chain.
+     * repeated for the whole cause chain, omitting duplicated messages.
      *
      * <p>{@link SQLException} is handled especially in order to process the
      * {@linkplain SQLException#getNextException() next exception} instead than the cause.</p>

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] Wed Jun  5 22:47:22 2013
@@ -89,6 +89,11 @@ public final class Errors extends Indexe
         public static final int CanNotInstantiate_1 = 81;
 
         /**
+         * Can not open “{0}”.
+         */
+        public static final int CanNotOpen_1 = 97;
+
+        /**
          * Can not parse “{1}” as a file in the {0} format.
          */
         public static final int CanNotParseFile_2 = 79;
@@ -311,6 +316,11 @@ public final class Errors extends Indexe
         public static final int NegativeArrayLength_1 = 78;
 
         /**
+         * Element “{0}” has not been found.
+         */
+        public static final int NoSuchElement_1 = 96;
+
+        /**
          * No property named “{0}” has been found in “{1}”.
          */
         public static final int NoSuchProperty_2 = 73;

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] Wed Jun  5 22:47:22 2013
@@ -29,6 +29,7 @@ CanNotConvertFromType_2         = Can no
 CanNotConvertValue_2            = Can not convert value \u201c{0}\u201d to type \u2018{1}\u2019.
 CanNotComputeDerivative         = Can not compute the derivative.
 CanNotInstantiate_1             = Can not instantiate an object of type \u2018{0}\u2019.
+CanNotOpen_1                    = Can not open \u201c{0}\u201d.
 CanNotParseFile_2               = Can not parse \u201c{1}\u201d as a file in the {0} format.
 CanNotSetPropertyValue_1        = Can not set a value for property \u201c{0}\u201d.
 ClassNotFinal_1                 = Class \u2018{0}\u2019 is not final.
@@ -88,6 +89,7 @@ NonTemporalUnit_1               = \u201c
 NotANumber_1                    = Argument \u2018{0}\u2019 shall not be NaN (Not-a-Number).
 NotAPrimitiveWrapper_1          = Class \u2018{0}\u2019 is not a primitive type wrapper.
 NotComparableClass_1            = Class \u2018{0}\u2019 is not a comparable.
+NoSuchElement_1                 = Element \u201c{0}\u201d has not been found.
 NoSuchProperty_2                = No property named \u201c{0}\u201d has been found in \u201c{1}\u201d.
 NoUnit                          = No unit of measurement has been specified.
 NullArgument_1                  = Argument \u2018{0}\u2019 shall not be null.

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] Wed Jun  5 22:47:22 2013
@@ -19,6 +19,7 @@ CanNotConvertFromType_2         = Ne peu
 CanNotConvertValue_2            = La valeur \u201c{0}\u201d ne peut pas \u00eatre convertie vers le type \u2018{1}\u2019.
 CanNotComputeDerivative         = La d\u00e9riv\u00e9 ne peut pas \u00eatre calcul\u00e9e.
 CanNotInstantiate_1             = Ne peut pas cr\u00e9er un objet de type \u2018{0}\u2019.
+CanNotOpen_1                    = Ne peut pas ouvrir \u201c{0}\u201d.
 CanNotParseFile_2               = Ne peut pas lire \u201c{1}\u201d comme un fichier au format {0}.
 CanNotSetPropertyValue_1        = Ne peut pas d\u00e9finir une valeur pour la propri\u00e9t\u00e9 \u201c{0}\u201d.
 ClassNotFinal_1                 = La classe \u2018{0}\u2019 n\u2019est pas finale.
@@ -78,6 +79,7 @@ NonTemporalUnit_1               = \u201c
 NotANumber_1                    = L\u2019argument \u2018{0}\u2019 ne doit pas \u00eatre NaN (Not-a-Number).
 NotAPrimitiveWrapper_1          = La classe \u2018{0}\u2019 n\u2019est pas un adaptateur d\u2019un type primitif.
 NotComparableClass_1            = La classe \u2018{0}\u2019 n\u2019est pas comparable.
+NoSuchElement_1                 = L\u2019\u00e9lement \u201c{0}\u201d n\u2019a pas \u00e9t\u00e9 trouv\u00e9.
 NoSuchProperty_2                = Aucune propri\u00e9t\u00e9 nomm\u00e9e \u201c{0}\u201d n\u2019a \u00e9t\u00e9 trouv\u00e9e dans \u201c{1}\u201d.
 NoUnit                          = Aucune unit\u00e9 de mesure n\u2019a \u00e9t\u00e9 sp\u00e9cifi\u00e9e.
 NullArgument_1                  = L\u2019argument \u2018{0}\u2019 ne doit pas \u00eatre nul.

Modified: sis/trunk/core/sis-utility/src/site/site.xml
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/site/site.xml?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/site/site.xml (original)
+++ sis/trunk/core/sis-utility/src/site/site.xml Wed Jun  5 22:47:22 2013
@@ -19,10 +19,10 @@
   under the License.
 -->
 
-<project xmlns="http://maven.apache.org/DECORATION/1.0.0"
+<project xmlns="http://maven.apache.org/DECORATION/1.3.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0
-                             http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+         xsi:schemaLocation="http://maven.apache.org/DECORATION/1.3.0
+                             http://maven.apache.org/xsd/decoration-1.3.0.xsd">
 
   <!-- ====================================================
            Site descriptor for Apache SIS utility module

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java [UTF-8] Wed Jun  5 22:47:22 2013
@@ -138,7 +138,7 @@ public final strictfp class TestUtilitie
      * @return A new random number generator initialized with a random seed.
      */
     public static Random createRandomNumberGenerator(final String testMethod) {
-        final long seed = Math.round(Math.random() * (1L << 48));
+        final long seed = StrictMath.round(StrictMath.random() * (1L << 48));
         final PrintWriter out = TestCase.out;
         out.print("Random number generator for “");
         out.print(testMethod);

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java [UTF-8] Wed Jun  5 22:47:22 2013
@@ -35,6 +35,7 @@ import org.junit.BeforeClass;
     org.apache.sis.internal.test.XMLComparatorTest.class,
 
     // Most basic functions of SIS library.
+    org.apache.sis.setup.OptionKeyTest.class,
     org.apache.sis.util.ArraysExtTest.class,
     org.apache.sis.util.CharactersTest.class,
     org.apache.sis.util.CharSequencesTest.class,
@@ -47,6 +48,7 @@ import org.junit.BeforeClass;
     org.apache.sis.util.resources.LoaderTest.class,
     org.apache.sis.util.resources.IndexedResourceBundleTest.class,
     org.apache.sis.util.logging.PerformanceLevelTest.class,
+    org.apache.sis.util.logging.WarningListenersTest.class,
     org.apache.sis.math.MathFunctionsTest.class,
     org.apache.sis.math.StatisticsTest.class,
     org.apache.sis.math.StatisticsFormatTest.class,

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/NumbersTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/NumbersTest.java?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/NumbersTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/NumbersTest.java [UTF-8] Wed Jun  5 22:47:22 2013
@@ -31,7 +31,7 @@ import static org.apache.sis.util.Number
  * @version 0.3
  * @module
  */
-public final class NumbersTest extends TestCase {
+public final strictfp class NumbersTest extends TestCase {
     /**
      * Tests {@link Numbers#isInteger(Class)}.
      */
@@ -161,7 +161,7 @@ public final class NumbersTest extends T
         assertEquals(Integer.class, narrowestClass(-100000  ));
         assertEquals(Integer.class, narrowestClass((double) (1L << 30)));
         assertEquals(Float  .class, narrowestClass((double) (1L << 40)));
-        assertEquals(Double .class, narrowestClass(Math.PI));
+        assertEquals(Double .class, narrowestClass(StrictMath.PI));
     }
 
     /**
@@ -169,16 +169,16 @@ public final class NumbersTest extends T
      */
     @Test
     public void testNarrowestNumber() {
-        assertEquals(Byte   .valueOf((byte)   127), narrowestNumber(    127.0));
-        assertEquals(Short  .valueOf((short)  128), narrowestNumber(    128.0));
-        assertEquals(Integer.valueOf(      100000), narrowestNumber( 100000.0));
-        assertEquals(Float  .valueOf(       10.5f), narrowestNumber(     10.5));
-        assertEquals(Byte   .valueOf((byte)  -128), narrowestNumber(   -128  ));
-        assertEquals(Short  .valueOf((short) -129), narrowestNumber(   -129  ));
-        assertEquals(Integer.valueOf(     -100000), narrowestNumber(-100000  ));
-        assertEquals(Integer.valueOf(1  << 30),     narrowestNumber((double) (1L << 30)));
-        assertEquals(Float  .valueOf(1L << 40),     narrowestNumber((double) (1L << 40)));
-        assertEquals(Double .valueOf(Math.PI),      narrowestNumber(Math.PI));
+        assertEquals(Byte   .valueOf((byte)   127),  narrowestNumber(    127.0));
+        assertEquals(Short  .valueOf((short)  128),  narrowestNumber(    128.0));
+        assertEquals(Integer.valueOf(      100000),  narrowestNumber( 100000.0));
+        assertEquals(Float  .valueOf(       10.5f),  narrowestNumber(     10.5));
+        assertEquals(Byte   .valueOf((byte)  -128),  narrowestNumber(   -128  ));
+        assertEquals(Short  .valueOf((short) -129),  narrowestNumber(   -129  ));
+        assertEquals(Integer.valueOf(     -100000),  narrowestNumber(-100000  ));
+        assertEquals(Integer.valueOf(1  << 30),      narrowestNumber((double) (1L << 30)));
+        assertEquals(Float  .valueOf(1L << 40),      narrowestNumber((double) (1L << 40)));
+        assertEquals(Double .valueOf(StrictMath.PI), narrowestNumber(StrictMath.PI));
     }
 
     /**

Modified: sis/trunk/core/src/site/site.xml
URL: http://svn.apache.org/viewvc/sis/trunk/core/src/site/site.xml?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/core/src/site/site.xml (original)
+++ sis/trunk/core/src/site/site.xml Wed Jun  5 22:47:22 2013
@@ -19,10 +19,10 @@
   under the License.
 -->
 
-<project xmlns="http://maven.apache.org/DECORATION/1.0.0"
+<project xmlns="http://maven.apache.org/DECORATION/1.3.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0
-                             http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+         xsi:schemaLocation="http://maven.apache.org/DECORATION/1.3.0
+                             http://maven.apache.org/xsd/decoration-1.3.0.xsd">
 
   <!-- ====================================================
            Site descriptor for Apache SIS core modules

Modified: sis/trunk/pom.xml
URL: http://svn.apache.org/viewvc/sis/trunk/pom.xml?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/pom.xml (original)
+++ sis/trunk/pom.xml Wed Jun  5 22:47:22 2013
@@ -43,7 +43,7 @@
   <packaging>pom</packaging>
 
   <name>Apache SIS</name>
-  <url>http://incubator.apache.org/sis/</url>
+  <url>http://sis.apache.org</url>
   <description>
   <!-- Left alignment because this description will be copied in META-INF/MANIFEST.MF
        The leading space after the first line is necessary for proper formatting. -->

Modified: sis/trunk/src/main/docbook/fr.xml
URL: http://svn.apache.org/viewvc/sis/trunk/src/main/docbook/fr.xml?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/src/main/docbook/fr.xml (original)
+++ sis/trunk/src/main/docbook/fr.xml Wed Jun  5 22:47:22 2013
@@ -17,7 +17,7 @@
     <abstract><para>
       Introduction aux standards internationaux utilisées en information géographique,
       et à l’approche choisie pour les implémenter dans la bibliothèque
-      <link xlink:href="http://incubator.apache.org/sis">Apache SIS</link> &sis-release;.
+      <link xlink:href="http://sis.apache.org">Apache SIS</link> &sis-release;.
       Ce document couvre les outils de développement, structures, conventions et
       principales classes Java.
     </para></abstract>

Modified: sis/trunk/src/site/site.xml
URL: http://svn.apache.org/viewvc/sis/trunk/src/site/site.xml?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/src/site/site.xml (original)
+++ sis/trunk/src/site/site.xml Wed Jun  5 22:47:22 2013
@@ -19,10 +19,10 @@
   under the License.
 -->
 
-<project xmlns="http://maven.apache.org/DECORATION/1.0.0"
+<project xmlns="http://maven.apache.org/DECORATION/1.3.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0
-                             http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+         xsi:schemaLocation="http://maven.apache.org/DECORATION/1.3.0
+                             http://maven.apache.org/xsd/decoration-1.3.0.xsd">
 
   <!-- ====================================================
            Root site descriptor for Apache SIS project

Modified: sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Decoder.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Decoder.java?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Decoder.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Decoder.java [UTF-8] Wed Jun  5 22:47:22 2013
@@ -21,6 +21,10 @@ import java.io.Closeable;
 import java.io.IOException;
 import javax.measure.unit.Unit;
 import org.apache.sis.measure.Units;
+import org.apache.sis.util.logging.WarningListeners;
+
+// Related to JDK7.
+import org.apache.sis.internal.jdk7.Objects;
 
 
 /**
@@ -31,14 +35,26 @@ import org.apache.sis.measure.Units;
  * @version 0.3
  * @module
  */
-public abstract class Decoder extends WarningProducer implements Closeable {
+public abstract class Decoder implements Closeable {
+    /**
+     * Where to send the warnings.
+     */
+    public final WarningListeners<?> listeners;
+
+    /**
+     * Sets to {@code true} for canceling a reading process.
+     * This flag is honored on a <cite>best effort</cite> basis only.
+     */
+    public volatile boolean canceled;
+
     /**
      * Creates a new decoder.
      *
-     * @param parent Where to send the warnings, or {@code null} if none.
+     * @param listeners Where to send the warnings.
      */
-    protected Decoder(final WarningProducer parent) {
-        super(parent);
+    protected Decoder(final WarningListeners<?> listeners) {
+        Objects.requireNonNull(listeners);
+        this.listeners = listeners;
     }
 
     /**
@@ -96,7 +112,7 @@ public abstract class Decoder extends Wa
         try {
             return Double.valueOf(value);
         } catch (NumberFormatException e) {
-            warning("numericValue", e);
+            listeners.warning(null, e);
         }
         return null;
     }
@@ -126,7 +142,7 @@ public abstract class Decoder extends Wa
         if (unit != null) try {
             return Units.valueOf(unit);
         } catch (IllegalArgumentException e) {
-            warning("unitValue", e);
+            listeners.warning(null, e);
         }
         return null;
     }

Modified: sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java [UTF-8] Wed Jun  5 22:47:22 2013
@@ -37,7 +37,6 @@ import org.apache.sis.internal.jdk8.Func
 import org.apache.sis.internal.netcdf.Decoder;
 import org.apache.sis.internal.netcdf.Variable;
 import org.apache.sis.internal.netcdf.GridGeometry;
-import org.apache.sis.internal.netcdf.WarningProducer;
 import org.apache.sis.internal.storage.ChannelDataInput;
 import org.apache.sis.internal.util.CollectionsExt;
 import org.apache.sis.internal.jdk8.JDK8;
@@ -45,6 +44,7 @@ import org.apache.sis.storage.DataStoreE
 import org.apache.sis.util.iso.DefaultNameSpace;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.resources.Vocabulary;
+import org.apache.sis.util.logging.WarningListeners;
 import org.apache.sis.util.ArraysExt;
 import org.apache.sis.measure.Units;
 
@@ -64,6 +64,17 @@ import org.apache.sis.measure.Units;
  */
 public final class ChannelDecoder extends Decoder {
     /**
+     * The NetCDF magic number expected in the first integer of the stream.
+     * The comparison shall ignore the 8 lowest bits, as in the following example:
+     *
+     * {@preformat java
+     *     int header = ...; // The first integer in the stream.
+     *     boolean isNetCDF = (header & 0xFFFFFF00) == MAGIC_NUMBER;
+     * }
+     */
+    public static final int MAGIC_NUMBER = ('C' << 24) | ('D' << 16) | ('F' <<  8);
+
+    /**
      * The encoding of dimension, variable and attribute names. This is fixed to {@value} by the
      * NetCDF specification. Note however that the encoding of attribute values may be different.
      *
@@ -173,26 +184,23 @@ public final class ChannelDecoder extend
      * Creates a new decoder for the given file.
      * This constructor parses immediately the header.
      *
-     * @param  parent   Where to send the warnings, or {@code null} if none.
-     * @param  filename A file identifier used only for formatting error message.
-     * @param  channel  The channel from where data are read.
+     * @param  listeners Where to send the warnings.
+     * @param  input     The channel and the buffer from where data are read.
      * @throws IOException If an error occurred while reading the channel.
      * @throws DataStoreException If the content of the given channel is not a NetCDF file.
      */
-    public ChannelDecoder(final WarningProducer parent, final String filename, final ReadableByteChannel channel)
+    public ChannelDecoder(final WarningListeners<?> listeners, final ChannelDataInput input)
             throws IOException, DataStoreException
     {
-        super(parent);
-        // The buffer must be backed by a Java {@code byte[]} array,
-        // because we will occasionally reference that array.
-        input = new ChannelDataInput(filename, channel, ByteBuffer.allocate(4096), false);
+        super(listeners);
+        this.input = input;
         /*
          * Check the magic number, which is expected to be exactly 3 bytes forming the "CDF" string.
          * The 4th byte is the version number, which we opportunistically use after the magic number check.
          */
         int version = input.readInt();
-        if ((version & 0xFFFFFF00) != (('C' << 24) | ('D' << 16) | ('F' <<  8))) {
-            throw new DataStoreException(Errors.format(Errors.Keys.UnexpectedFileFormat_2, "NetCDF", filename));
+        if ((version & 0xFFFFFF00) != MAGIC_NUMBER) {
+            throw new DataStoreException(errors().getString(Errors.Keys.UnexpectedFileFormat_2, "NetCDF", input.filename));
         }
         /*
          * Check the version number.
@@ -201,7 +209,7 @@ public final class ChannelDecoder extend
         switch (version) {
             case 1:  is64bits = false; break;
             case 2:  is64bits = true;  break;
-            default: throw new DataStoreException(Errors.format(Errors.Keys.UnsupportedVersion_1, version));
+            default: throw new DataStoreException(errors().getString(Errors.Keys.UnsupportedVersion_1, version));
         }
         numrecs = input.readInt();
         /*
@@ -248,11 +256,20 @@ public final class ChannelDecoder extend
     }
 
     /**
+     * Returns the localized error resource bundle for the locale given by {@link #getLocale()}.
+     *
+     * @return The localized error resource bundle.
+     */
+    private Errors errors() {
+        return Errors.getResources(listeners.getLocale());
+    }
+
+    /**
      * Returns an exception for a malformed header. This is used only after we have determined
      * that the file should be a NetCDF one, but we found some inconsistency or unknown tags.
      */
     private DataStoreException malformedHeader() {
-        return new DataStoreException(Errors.format(Errors.Keys.CanNotParseFile_2, "NetCDF", input.filename));
+        return new DataStoreException(errors().getString(Errors.Keys.CanNotParseFile_2, "NetCDF", input.filename));
     }
 
     /**
@@ -260,7 +277,7 @@ public final class ChannelDecoder extend
      */
     private void ensureNonNegative(final int nelems, final int tag) throws DataStoreException {
         if (nelems < 0) {
-            throw new DataStoreException(Errors.format(Errors.Keys.NegativeArrayLength_1,
+            throw new DataStoreException(errors().getString(Errors.Keys.NegativeArrayLength_1,
                     input.filename + DefaultNameSpace.DEFAULT_SEPARATOR + tagName(tag)));
         }
     }
@@ -284,9 +301,10 @@ public final class ChannelDecoder extend
         final long size = ((n & 0xFFFFFFFFL) * dataSize + 3) & ~3;
         if (size > input.buffer.capacity()) {
             name = input.filename + DefaultNameSpace.DEFAULT_SEPARATOR + name;
+            final Errors errors = errors();
             throw new DataStoreException(n < 0 ?
-                    Errors.format(Errors.Keys.NegativeArrayLength_1, name) :
-                    Errors.format(Errors.Keys.ExcessiveListSize_2, name, n));
+                    errors.getString(Errors.Keys.NegativeArrayLength_1, name) :
+                    errors.getString(Errors.Keys.ExcessiveListSize_2, name, n));
         }
         input.ensureBufferContains((int) size);
         return (int) size;
@@ -310,9 +328,8 @@ public final class ChannelDecoder extend
         }
         final ByteBuffer buffer = input.buffer;
         final int size = ensureBufferContains(length, 1, "<name>");
-        final int position = buffer.position(); // Must be after 'require'
-        final String text = new String(buffer.array(), position, length, NAME_ENCODING);
-        buffer.position(position + size);
+        final String text = input.readString(length, NAME_ENCODING);
+        buffer.position(buffer.position() + (size - length));
         return text;
     }
 
@@ -329,11 +346,11 @@ public final class ChannelDecoder extend
         }
         final ByteBuffer buffer = input.buffer;
         final int size = ensureBufferContains(length, VariableInfo.sizeOf(type), name);
-        final int position = buffer.position(); // Must be after 'require'
+        final int position = buffer.position(); // Must be after 'ensureBufferContains'
         final Object result;
         switch (type) {
             case VariableInfo.CHAR: {
-                final String text = new String(buffer.array(), position, length, encoding).trim();
+                final String text = input.readString(length, encoding).trim();
                 result = text.isEmpty() ? null : text;
                 break;
             }
@@ -394,7 +411,7 @@ public final class ChannelDecoder extend
             if (length == 0) {
                 length = numrecs;
                 if (length == STREAMING) {
-                    throw new DataStoreException(Errors.format(Errors.Keys.MissingValueForProperty_1, "numrecs"));
+                    throw new DataStoreException(errors().getString(Errors.Keys.MissingValueForProperty_1, "numrecs"));
                 }
             }
             dimensions[i] = new Dimension(name, length);
@@ -506,11 +523,11 @@ public final class ChannelDecoder extend
      *
      * @see #findAttribute(String)
      */
-    private static <E> Map<String,E> toMap(final E[] elements, final Function<E,String> nameFunction) throws DataStoreException {
+    private <E> Map<String,E> toMap(final E[] elements, final Function<E,String> nameFunction) throws DataStoreException {
         try {
             return CollectionsExt.toCaseInsensitiveNameMap(Arrays.asList(elements), nameFunction, NAME_LOCALE);
         } catch (InvalidParameterCardinalityException e) {
-            throw new DataStoreException(Errors.format(Errors.Keys.ValueAlreadyDefined_1, e.getParameterName()));
+            throw new DataStoreException(errors().getString(Errors.Keys.ValueAlreadyDefined_1, e.getParameterName()));
         }
     }
 
@@ -603,7 +620,7 @@ public final class ChannelDecoder extend
             if (attribute.value instanceof String) try {
                 return JDK8.parseDateTime((String) attribute.value, DEFAULT_TIMEZONE_IS_UTC);
             } catch (IllegalArgumentException e) {
-                warning("dateValue", e);
+                listeners.warning(null, e);
             }
         }
         return null;
@@ -630,9 +647,9 @@ public final class ChannelDecoder extend
                 }
             }
         } catch (ConversionException e) {
-            warning("numberToDate", e);
+            listeners.warning(null, e);
         } catch (IllegalArgumentException e) {
-            warning("numberToDate", e);
+            listeners.warning(null, e);
         }
         return dates;
     }
@@ -714,4 +731,18 @@ nextVar:    for (final VariableInfo vari
     public void close() throws IOException {
         input.channel.close();
     }
+
+    /**
+     * Returns a string representation to be inserted in {@link org.apache.sis.storage.netcdf.NetcdfStore#toString()}
+     * result. This is for debugging purpose only any may change in any future SIS version.
+     */
+    @Override
+    public String toString() {
+        final StringBuilder buffer = new StringBuilder();
+        buffer.append("SIS driver: “").append(input.filename).append('”');
+        if (!input.channel.isOpen()) {
+            buffer.append(" (closed)");
+        }
+        return buffer.toString();
+    }
 }

Modified: sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/DecoderWrapper.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/DecoderWrapper.java?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/DecoderWrapper.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/DecoderWrapper.java [UTF-8] Wed Jun  5 22:47:22 2013
@@ -21,21 +21,22 @@ import java.util.List;
 import java.util.EnumSet;
 import java.io.IOException;
 import ucar.nc2.Group;
+import ucar.nc2.Dimension;
 import ucar.nc2.Attribute;
 import ucar.nc2.VariableIF;
 import ucar.nc2.NetcdfFile;
 import ucar.nc2.dataset.NetcdfDataset;
 import ucar.nc2.dataset.CoordinateSystem;
+import ucar.nc2.util.CancelTask;
 import ucar.nc2.units.DateUnit;
 import ucar.nc2.time.Calendar;
 import ucar.nc2.time.CalendarDate;
 import ucar.nc2.time.CalendarDateFormatter;
 import org.apache.sis.util.ArraysExt;
+import org.apache.sis.util.logging.WarningListeners;
 import org.apache.sis.internal.netcdf.Decoder;
 import org.apache.sis.internal.netcdf.Variable;
 import org.apache.sis.internal.netcdf.GridGeometry;
-import org.apache.sis.internal.netcdf.WarningProducer;
-import ucar.nc2.Dimension;
 
 
 /**
@@ -46,7 +47,7 @@ import ucar.nc2.Dimension;
  * @version 0.3
  * @module
  */
-public final class DecoderWrapper extends Decoder {
+public final class DecoderWrapper extends Decoder implements CancelTask {
     /**
      * The NetCDF file to read.
      * This file is set at construction time.
@@ -85,15 +86,27 @@ public final class DecoderWrapper extend
      * {@link NetcdfFile} instance, the {@link NetcdfDataset} subclass is necessary in order to
      * get coordinate system information.
      *
-     * @param parent Where to send the warnings, or {@code null} if none.
-     * @param file The NetCDF file from which to parse metadata.
+     * @param listeners Where to send the warnings.
+     * @param file The NetCDF file from which to read data.
      */
-    public DecoderWrapper(final WarningProducer parent, final NetcdfFile file) {
-        super(parent);
+    public DecoderWrapper(final WarningListeners<?> listeners, final NetcdfFile file) {
+        super(listeners);
         this.file = file;
     }
 
     /**
+     * Creates a new decoder for the given filename.
+     *
+     * @param  listeners Where to send the warnings.
+     * @param  filename  The name of the NetCDF file from which to read data.
+     * @throws IOException If an error occurred while opening the NetCDF file.
+     */
+    public DecoderWrapper(final WarningListeners<?> listeners, final String filename) throws IOException {
+        super(listeners);
+        file = NetcdfDataset.openDataset(filename, false, this);
+    }
+
+    /**
      * Defines the groups where to search for named attributes, in preference order.
      * The {@code null} group name stands for the global attributes.
      */
@@ -216,7 +229,7 @@ public final class DecoderWrapper extend
                         try {
                             date = CalendarDateFormatter.isoStringToCalendarDate(Calendar.proleptic_gregorian, value);
                         } catch (IllegalArgumentException e) {
-                            warning("dateValue", e);
+                            listeners.warning(null, e);
                             continue;
                         }
                         return new Date(date.getMillis());
@@ -241,7 +254,7 @@ public final class DecoderWrapper extend
         try {
             unit = new DateUnit(symbol);
         } catch (Exception e) { // Declared by the DateUnit constructor.
-            warning("numberToDate", e);
+            listeners.warning(null, e);
             return dates;
         }
         for (int i=0; i<values.length; i++) {
@@ -311,6 +324,27 @@ public final class DecoderWrapper extend
     }
 
     /**
+     * Invoked by the UCAR NetCDF library for checking if the reading process has been canceled.
+     * This method returns the {@link #canceled} flag.
+     *
+     * @return The {@link #canceled} flag.
+     */
+    @Override
+    public boolean isCancel() {
+        return canceled;
+    }
+
+    /**
+     * Invoked by the UCAR NetCDF library when an error occurred.
+     *
+     * @param message The error message.
+     */
+    @Override
+    public void setError(final String message) {
+        listeners.warning(message, null);
+    }
+
+    /**
      * Closes the NetCDF file.
      *
      * @throws IOException If an error occurred while closing the file.
@@ -319,4 +353,13 @@ public final class DecoderWrapper extend
     public void close() throws IOException {
         file.close();
     }
+
+    /**
+     * Returns a string representation to be inserted in {@link org.apache.sis.storage.netcdf.NetcdfStore#toString()}
+     * result. This is for debugging purpose only any may change in any future SIS version.
+     */
+    @Override
+    public String toString() {
+        return "UCAR driver: “" + file.getLocation() + '”';
+    }
 }

Modified: sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java [UTF-8] Wed Jun  5 22:47:22 2013
@@ -65,7 +65,6 @@ import org.apache.sis.internal.netcdf.Ax
 import org.apache.sis.internal.netcdf.Decoder;
 import org.apache.sis.internal.netcdf.Variable;
 import org.apache.sis.internal.netcdf.GridGeometry;
-import org.apache.sis.internal.netcdf.WarningProducer;
 import org.apache.sis.internal.util.DefaultFactories;
 import org.apache.sis.internal.metadata.MetadataUtilities;
 
@@ -106,7 +105,7 @@ import static org.apache.sis.storage.net
  * @version 0.3
  * @module
  */
-final class MetadataReader extends WarningProducer {
+final class MetadataReader {
     /**
      * Names of groups where to search for metadata, in precedence order.
      * The {@code null} value stands for global attributes.
@@ -173,12 +172,10 @@ final class MetadataReader extends Warni
     /**
      * Creates a new <cite>NetCDF to ISO</cite> mapper for the given source.
      *
-     * @param  parent Where to send the warnings, or {@code null} if none.
      * @param  decoder The source of NetCDF attributes.
      * @throws IOException If an I/O operation was necessary but failed.
      */
-    MetadataReader(final WarningProducer parent, final Decoder decoder) throws IOException {
-        super(parent);
+    MetadataReader(final Decoder decoder) throws IOException {
         this.decoder = decoder;
         decoder.setSearchPath(SEARCH_PATH);
         searchPath = decoder.getSearchPath();
@@ -277,7 +274,7 @@ final class MetadataReader extends Warni
             resource.setFunction(OnLineFunction.INFORMATION);
             return resource;
         } catch (URISyntaxException e) {
-            warning("createOnlineResource", e);
+            decoder.listeners.warning(null, e);
         }
         return null;
     }
@@ -682,7 +679,7 @@ final class MetadataReader extends Warni
             }
             extent.getTemporalElements().add(t);
         } catch (UnsupportedOperationException e) {
-            warning("createExtent", e);
+            decoder.listeners.warning(null, e);
         }
         /*
          * Add the geographic identifier, if present.
@@ -705,7 +702,7 @@ final class MetadataReader extends Warni
         if (source != null) try {
             return source.getConverterToAny(target);
         } catch (ConversionException e) {
-            warning("getConverterTo", e);
+            decoder.listeners.warning(null, e);
         }
         return null;
     }
@@ -836,6 +833,7 @@ final class MetadataReader extends Warni
 
     /**
      * Creates an ISO {@code Metadata} object from the information found in the NetCDF file.
+     * The returned metadata will be unmodifiable in order to allow the caller to cache it.
      *
      * @return The ISO metadata object.
      * @throws IOException If an I/O operation was necessary but failed.
@@ -925,6 +923,7 @@ final class MetadataReader extends Warni
                 metadata.getSpatialRepresentationInfo().add(createSpatialRepresentationInfo(cs));
             }
         }
+        metadata.freeze();
         return metadata;
     }
 }

Modified: sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/IOTestCase.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/IOTestCase.java?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/IOTestCase.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/IOTestCase.java [UTF-8] Wed Jun  5 22:47:22 2013
@@ -18,6 +18,7 @@ package org.apache.sis.internal.netcdf;
 
 import java.io.File;
 import java.io.IOException;
+import java.io.InputStream;
 import java.net.URL;
 import java.net.MalformedURLException;
 import java.net.URISyntaxException;
@@ -47,6 +48,30 @@ public abstract strictfp class IOTestCas
     }
 
     /**
+     * Returns the given resource as a URL.
+     *
+     * @param  name The name of the resource.
+     * @return The resource as a URL.
+     */
+    public static URL getResource(final String name) {
+        final URL r = IOTestCase.class.getResource(name);
+        assumeNotNull(r);
+        return r;
+    }
+
+    /**
+     * Returns the given resource as an input stream.
+     *
+     * @param  name The name of the resource.
+     * @return The resource as an input stream.
+     */
+    public static InputStream getResourceAsStream(final String name) {
+        final InputStream in = IOTestCase.class.getResourceAsStream(name);
+        assumeNotNull(in);
+        return in;
+    }
+
+    /**
      * Opens the given NetCDF file.
      *
      * @param  file The file name, typically one of the {@link #NCEP} or {@link #CIP} constants.

Modified: sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java [UTF-8] Wed Jun  5 22:47:22 2013
@@ -22,6 +22,7 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.io.IOException;
 import java.lang.reflect.UndeclaredThrowableException;
+import org.apache.sis.util.logging.EmptyWarningListeners;
 import org.apache.sis.internal.netcdf.ucar.DecoderWrapper;
 import ucar.nc2.dataset.NetcdfDataset;
 import org.junit.AfterClass;
@@ -41,6 +42,12 @@ import static org.junit.Assert.*;
  */
 public abstract strictfp class TestCase extends IOTestCase {
     /**
+     * A dummy list of listeners which can be given to the {@link Decoder} constructor.
+     */
+    public static EmptyWarningListeners<Decoder> LISTENERS =
+            new EmptyWarningListeners<Decoder>("org.apache.sis.storage.netcdf");
+
+    /**
      * The {@code searchPath} argument value to be given to the {@link Decoder#setSearchPath(String[])}
      * method when the decoder shall search only in global attributes.
      */
@@ -97,7 +104,7 @@ public abstract strictfp class TestCase 
      * @throws IOException If an error occurred while opening the file.
      */
     protected Decoder createDecoder(final String name) throws IOException {
-        return new DecoderWrapper(null, new NetcdfDataset(open(name)));
+        return new DecoderWrapper(LISTENERS, new NetcdfDataset(open(name)));
     }
 
     /**

Modified: sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/ChannelDecoderTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/ChannelDecoderTest.java?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/ChannelDecoderTest.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/ChannelDecoderTest.java [UTF-8] Wed Jun  5 22:47:22 2013
@@ -18,10 +18,12 @@ package org.apache.sis.internal.netcdf.i
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.nio.ByteBuffer;
 import java.nio.channels.Channels;
 import org.apache.sis.internal.netcdf.IOTestCase;
 import org.apache.sis.internal.netcdf.Decoder;
 import org.apache.sis.internal.netcdf.DecoderTest;
+import org.apache.sis.internal.storage.ChannelDataInput;
 import org.apache.sis.storage.DataStoreException;
 import org.apache.sis.test.DependsOn;
 
@@ -66,8 +68,10 @@ public final strictfp class ChannelDecod
     public static Decoder createChannelDecoder(final String name) throws IOException {
         final InputStream in = IOTestCase.class.getResourceAsStream(name);
         assumeNotNull(name, in);
+        final ChannelDataInput input = new ChannelDataInput(name,
+                Channels.newChannel(in), ByteBuffer.allocate(4096), false);
         try {
-            return new ChannelDecoder(null, name, Channels.newChannel(in));
+            return new ChannelDecoder(LISTENERS, input);
         } catch (DataStoreException e) {
             throw new AssertionError(e);
         }

Modified: sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java [UTF-8] Wed Jun  5 22:47:22 2013
@@ -19,6 +19,7 @@ package org.apache.sis.storage.netcdf;
 import java.io.IOException;
 import ucar.nc2.dataset.NetcdfDataset;
 import org.opengis.metadata.Metadata;
+import org.apache.sis.internal.netcdf.TestCase;
 import org.apache.sis.internal.netcdf.Decoder;
 import org.apache.sis.internal.netcdf.IOTestCase;
 import org.apache.sis.internal.netcdf.ucar.DecoderWrapper;
@@ -54,7 +55,7 @@ public final strictfp class MetadataRead
         final Metadata metadata;
         final Decoder input = ChannelDecoderTest.createChannelDecoder(NCEP);
         try {
-            metadata = new MetadataReader(null, input).read();
+            metadata = new MetadataReader(input).read();
         } finally {
             input.close();
         }
@@ -70,9 +71,9 @@ public final strictfp class MetadataRead
     @Test
     public void testUCAR() throws IOException {
         final Metadata metadata;
-        final Decoder input = new DecoderWrapper(null, new NetcdfDataset(open(NCEP)));
+        final Decoder input = new DecoderWrapper(TestCase.LISTENERS, new NetcdfDataset(open(NCEP)));
         try {
-            metadata = new MetadataReader(null, input).read();
+            metadata = new MetadataReader(input).read();
         } finally {
             input.close();
         }
@@ -81,8 +82,9 @@ public final strictfp class MetadataRead
 
     /**
      * Compares the string representation of the given metadata object with the expected one.
+     * The given metadata shall have been created from the {@link #NCEP} dataset.
      */
-    private static void compareToExpected(final Metadata actual) {
+    static void compareToExpected(final Metadata actual) {
         assertMultilinesEquals(
             "DefaultMetadata\n" +
             "  ├─File identifier………………………………………………………………………… edu.ucar.unidata:NCEP/SST/Global_5x2p5deg/SST_Global_5x2p5deg_20050922_0000.nc\n" +

Copied: sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreProviderTest.java (from r1490053, sis/branches/JDK6/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreProviderTest.java)
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreProviderTest.java?p2=sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreProviderTest.java&p1=sis/branches/JDK6/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreProviderTest.java&r1=1490053&r2=1490056&rev=1490056&view=diff
==============================================================================
--- sis/branches/JDK6/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreProviderTest.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreProviderTest.java [UTF-8] Wed Jun  5 22:47:22 2013
@@ -18,7 +18,7 @@ package org.apache.sis.storage.netcdf;
 
 import java.io.IOException;
 import ucar.nc2.NetcdfFile;
-import org.opengis.wrapper.netcdf.IOTestCase;
+import org.apache.sis.internal.netcdf.IOTestCase;
 import org.apache.sis.internal.netcdf.TestCase;
 import org.apache.sis.internal.netcdf.Decoder;
 import org.apache.sis.internal.netcdf.ucar.DecoderWrapper;
@@ -52,7 +52,7 @@ public final strictfp class NetcdfStoreP
      */
     @Test
     public void testCanOpenFromStream() throws DataStoreException {
-        final DataStoreConnection c = new DataStoreConnection(IOTestCase.class.getResourceAsStream(NCEP));
+        final DataStoreConnection c = new DataStoreConnection(IOTestCase.getResourceAsStream(NCEP));
         final NetcdfStoreProvider provider = new NetcdfStoreProvider();
         assertTrue(provider.canOpen(c));
         c.closeAllExcept(null);
@@ -82,7 +82,7 @@ public final strictfp class NetcdfStoreP
      */
     @Test
     public void testDecoderFromStream() throws IOException, DataStoreException {
-        final DataStoreConnection c = new DataStoreConnection(IOTestCase.class.getResourceAsStream(NCEP));
+        final DataStoreConnection c = new DataStoreConnection(IOTestCase.getResourceAsStream(NCEP));
         final Decoder decoder = NetcdfStoreProvider.decoder(TestCase.LISTENERS, c);
         assertInstanceOf(NCEP, ChannelDecoder.class, decoder);
         decoder.close();

Copied: sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreTest.java (from r1490053, sis/branches/JDK6/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreTest.java)
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreTest.java?p2=sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreTest.java&p1=sis/branches/JDK6/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreTest.java&r1=1490053&r2=1490056&rev=1490056&view=diff
==============================================================================
--- sis/branches/JDK6/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreTest.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreTest.java [UTF-8] Wed Jun  5 22:47:22 2013
@@ -17,7 +17,7 @@
 package org.apache.sis.storage.netcdf;
 
 import org.opengis.metadata.Metadata;
-import org.opengis.wrapper.netcdf.IOTestCase;
+import org.apache.sis.internal.netcdf.IOTestCase;
 import org.apache.sis.storage.DataStoreConnection;
 import org.apache.sis.storage.DataStoreException;
 import org.apache.sis.test.DependsOn;
@@ -46,7 +46,7 @@ public final strictfp class NetcdfStoreT
      * @throws DataStoreException If an error occurred while reading the NetCDF file.
      */
     private static NetcdfStore create(final String dataset) throws DataStoreException {
-        return new NetcdfStore(new DataStoreConnection(IOTestCase.class.getResource(dataset)));
+        return new NetcdfStore(new DataStoreConnection(IOTestCase.getResource(dataset)));
     }
 
     /**

Modified: sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/test/suite/NetcdfTestSuite.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/test/suite/NetcdfTestSuite.java?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/test/suite/NetcdfTestSuite.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/test/suite/NetcdfTestSuite.java [UTF-8] Wed Jun  5 22:47:22 2013
@@ -38,7 +38,9 @@ import org.junit.BeforeClass;
     org.apache.sis.internal.netcdf.impl.ChannelDecoderTest.class,
     org.apache.sis.internal.netcdf.impl.VariableInfoTest.class,
     org.apache.sis.internal.netcdf.impl.GridGeometryInfoTest.class,
-    org.apache.sis.storage.netcdf.MetadataReaderTest.class
+    org.apache.sis.storage.netcdf.MetadataReaderTest.class,
+    org.apache.sis.storage.netcdf.NetcdfStoreProviderTest.class,
+    org.apache.sis.storage.netcdf.NetcdfStoreTest.class
 })
 public final strictfp class NetcdfTestSuite extends TestSuite {
     /**

Modified: sis/trunk/storage/sis-storage/pom.xml
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/pom.xml?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/pom.xml (original)
+++ sis/trunk/storage/sis-storage/pom.xml Wed Jun  5 22:47:22 2013
@@ -42,7 +42,7 @@
   <description>
   <!-- Left alignment because this description will be copied in META-INF/MANIFEST.MF
        The leading space after the first line is necessary for proper formatting. -->
-DataStore API and base storage classes.
+Provides the interfaces and base classes to be implemented by various storage formats.
   </description>
 
 

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/ChannelDataInput.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/ChannelDataInput.java?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/ChannelDataInput.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/ChannelDataInput.java [UTF-8] Wed Jun  5 22:47:22 2013
@@ -117,6 +117,7 @@ public class ChannelDataInput {
         this.buffer        = buffer;
         this.channelOffset = (channel instanceof FileChannel) ? ((FileChannel) channel).position() : 0;
         if (!filled) {
+            buffer.clear();
             channel.read(buffer);
             buffer.flip();
         }
@@ -181,7 +182,7 @@ public class ChannelDataInput {
      * @throws EOFException If the channel has reached the end of stream.
      * @throws IOException If an other kind of error occurred while reading.
      */
-    public final void ensureBufferContains(int n) throws IOException {
+    public final void ensureBufferContains(int n) throws EOFException, IOException {
         assert n <= buffer.capacity() : n;
         n -= buffer.remaining();
         if (n > 0) {
@@ -643,6 +644,30 @@ public class ChannelDataInput {
     }
 
     /**
+     * Decodes a string from a sequence of bytes in the given encoding. This method tries to avoid the creation
+     * of a temporary {@code byte[]} array when possible.
+     *
+     * <p>This convenience method shall be used only for relatively small amount of {@link String} instances
+     * to decode, for example attribute values in the file header. For large amount of data, consider using
+     * {@link java.nio.charset.CharsetDecoder} instead.</p>
+     *
+     * @param  length   Number of bytes to read.
+     * @param  encoding The character encoding.
+     * @return The string decoded from the {@code length} next bytes.
+     * @throws IOException If an error occurred while reading the bytes, or if the given encoding is invalid.
+     */
+    public final String readString(final int length, final String encoding) throws IOException {
+        if (buffer.hasArray() && length <= buffer.capacity()) {
+            ensureBufferContains(length);
+            final int position = buffer.position(); // Must be after 'ensureBufferContains(int)'.
+            buffer.position(position + length);     // Before 'new String' for consistency with the 'else' block in case of UnsupportedEncodingException.
+            return new String(buffer.array(), buffer.arrayOffset() + position, length, encoding);
+        } else {
+            return new String(readBytes(length), encoding);
+        }
+    }
+
+    /**
      * Moves to the given position in the stream, relative to the stream position at construction time.
      *
      * @param  position The position where to move.
@@ -658,7 +683,9 @@ public class ChannelDataInput {
         } else if (channel instanceof FileChannel) {
             /*
              * Requested position is outside the current limits of the buffer,
-             * but we can set the new position directly in the channel.
+             * but we can set the new position directly in the channel. Note
+             * that DataStoreConnection.rewind() needs the buffer content to
+             * be valid as a result of this seek, so we reload it immediately.
              */
             ((FileChannel) channel).position(channelOffset + position);
             bufferOffset = position;

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/ChannelImageInputStream.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/ChannelImageInputStream.java?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/ChannelImageInputStream.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/ChannelImageInputStream.java [UTF-8] Wed Jun  5 22:47:22 2013
@@ -88,10 +88,10 @@ public class ChannelImageInputStream ext
      */
     private static final class Mark {
         final long position;
-        final int  bitOffset;
-        final Mark next;
+        final byte bitOffset;
+        Mark next;
 
-        Mark(long position, int bitOffset, Mark next) {
+        Mark(long position, byte bitOffset, Mark next) {
             this.position  = position;
             this.bitOffset = bitOffset;
             this.next      = next;
@@ -115,6 +115,18 @@ public class ChannelImageInputStream ext
     }
 
     /**
+     * Creates a new input source from the given {@code ChannelDataInput}.
+     * This constructor is invoked when we need to change the implementation class
+     * from {@code ChannelDataInput} to {@code ChannelImageInputStream}.
+     *
+     * @param  input The existing instance from which to takes the channel and buffer.
+     * @throws IOException If an error occurred while reading the channel.
+     */
+    public ChannelImageInputStream(final ChannelDataInput input) throws IOException {
+        super(input.filename, input.channel, input.buffer, true);
+    }
+
+    /**
      * Sets the desired byte order for future reads of data values from this stream.
      * The default value is {@link ByteOrder#BIG_ENDIAN BIG_ENDIAN}.
      */
@@ -418,7 +430,7 @@ loop:   while ((c = read()) >= 0) {
      */
     @Override
     public final void mark() {
-        mark = new Mark(getStreamPosition(), getBitOffset(), mark);
+        mark = new Mark(getStreamPosition(), (byte) getBitOffset(), mark);
     }
 
     /**
@@ -458,6 +470,9 @@ loop:   while ((c = read()) >= 0) {
      * Attempting to {@linkplain #seek(long) seek} to an offset within the flushed
      * portion of the stream will result in an {@link IndexOutOfBoundsException}.
      *
+     * <p>This method moves the data starting at the given position to the beginning of the {@link #buffer},
+     * thus making more room for new data before the data at the given position is discarded.</p>
+     *
      * @param  position The length of the stream prefix that may be flushed.
      * @throws IOException If an I/O error occurred.
      */
@@ -475,27 +490,42 @@ loop:   while ((c = read()) >= 0) {
         buffer.position(n); // Number of bytes to forget.
         buffer.compact().position(p).limit(r);
         setStreamPosition(currentPosition);
+
+        // Discard obolete marks.
+        Mark parent = null;
+        for (Mark m = mark; m != null; m = m.next) {
+            if (m.position < position) {
+                if (parent != null) {
+                    parent.next = null;
+                } else {
+                    mark = null;
+                }
+                break;
+            }
+            parent = m;
+        }
     }
 
     /**
-     * Returns {@code true} if this {@code ImageInputStream} caches data itself in order to
-     * allow {@linkplain #seek(long) seeking} backwards.
-     *
-     * @return {@code true} If this {@code ImageInputStream} caches data.
+     * Synonymous of {@link #isCachedMemory()} since the caching behavior of this class is uniquely determined
+     * by the policy that we choose for {@code isCachedMemory()}. This class never creates temporary files.
      *
      * @see #isCachedMemory()
      * @see #isCachedFile()
      */
     @Override
     public final boolean isCached() {
-        return false;
+        return isCachedMemory();
     }
 
     /**
-     * Returns {@code true} if this {@code ImageInputStream} caches data itself in order to
-     * allow {@linkplain #seek(long) seeking} backwards, and the cache is kept in main memory.
+     * Returns {@code false} since this {@code ImageInputStream} does not cache data itself in order to
+     * allow {@linkplain #seek(long) seeking} backwards. Actually, we could consider the {@link #buffer}
+     * as a cache in main memory. But this buffer has a maximal capacity, which would be a violation of
+     * {@code ImageInputStream} contract.
      *
-     * @return {@code true} if this {@code ImageInputStream} caches data in main memory.
+     * @return {@code false} since this {@code ImageInputStream} does not caches data in main memory
+     *         (ignoring the {@link #buffer}).
      */
     @Override
     public final boolean isCachedMemory() {
@@ -503,10 +533,9 @@ loop:   while ((c = read()) >= 0) {
     }
 
     /**
-     * Returns {@code true} if this {@code ImageInputStream} caches data itself in order to allow
-     * {@linkplain #seek(long) seeking} backwards, and the cache is kept in a temporary file.
+     * Returns {@code false} since this {@code ImageInputStream} does not cache data in a temporary file.
      *
-     * @return {@code true} if this {@code ImageInputStream} caches data in a temporary file.
+     * @return {@code false} since this {@code ImageInputStream} does not cache data in a temporary file.
      */
     @Override
     public final boolean isCachedFile() {

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreException.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreException.java?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreException.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreException.java [UTF-8] Wed Jun  5 22:47:22 2013
@@ -18,7 +18,7 @@ package org.apache.sis.storage;
 
 
 /**
- * Throws when a {@link DataStore} can not completed a read or write operation.
+ * Thrown when a {@link DataStore} can not complete a read or write operation.
  *
  * @author  Johann Sorel (Geomatys)
  * @since   0.3 (derived from geotk-3.10)

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/package-info.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/package-info.java?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/package-info.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/package-info.java [UTF-8] Wed Jun  5 22:47:22 2013
@@ -16,9 +16,11 @@
  */
 
 /**
- * Place holder for future {@code DataStore} services.
+ * {@linkplain org.apache.sis.storage.DataStore Data store} base types for retrieving and saving geospatial data
+ * in various storage formats.
  *
  * @author  Johann Sorel (Geomatys)
+ * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-3.10)
  * @version 0.3
  * @module

Modified: sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/ChannelDataInputTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/ChannelDataInputTest.java?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/ChannelDataInputTest.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/ChannelDataInputTest.java [UTF-8] Wed Jun  5 22:47:22 2013
@@ -143,6 +143,23 @@ public final strictfp class ChannelDataI
     }
 
     /**
+     * Tests the {@link ChannelDataInput#readString(int, String)} method.
+     *
+     * @throws IOException Should never happen.
+     */
+    @Test
+    public void testReadString() throws IOException {
+        final String expected = "お元気ですか";
+        final byte[] array = expected.getBytes("UTF-8");
+        assertEquals(expected.length()*3, array.length); // Sanity check.
+        final ChannelDataInput input = new ChannelDataInput("testReadString",
+                Channels.newChannel(new ByteArrayInputStream(array)),
+                ByteBuffer.allocate(array.length + 4), false);
+        assertEquals(expected, input.readString(array.length, "UTF-8"));
+        assertFalse(input.buffer.hasRemaining());
+    }
+
+    /**
      * Tests {@link ChannelDataInput#seek(long)} on a channel that do not implement
      * {@link java.nio.channels.SeekableByteChannel}.
      *

Modified: sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/test/suite/StorageTestSuite.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/test/suite/StorageTestSuite.java?rev=1490056&r1=1490055&r2=1490056&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/test/suite/StorageTestSuite.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/test/suite/StorageTestSuite.java [UTF-8] Wed Jun  5 22:47:22 2013
@@ -30,8 +30,10 @@ import org.junit.BeforeClass;
  * @module
  */
 @Suite.SuiteClasses({
+    org.apache.sis.internal.storage.IOUtilitiesTest.class,
     org.apache.sis.internal.storage.ChannelDataInputTest.class,
-    org.apache.sis.internal.storage.ChannelImageInputStreamTest.class
+    org.apache.sis.internal.storage.ChannelImageInputStreamTest.class,
+    org.apache.sis.storage.DataStoreConnectionTest.class
 })
 public final strictfp class StorageTestSuite extends TestSuite {
     /**



Mime
View raw message