sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1634098 [4/4] - in /sis/branches/JDK7: ./ core/sis-build-helper/src/main/java/org/apache/sis/util/resources/ core/sis-build-helper/src/test/ core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ core/sis-metadata/src/test/java/org/a...
Date Fri, 24 Oct 2014 17:11:17 GMT
Modified: sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractStatement.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractStatement.java?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractStatement.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractStatement.java [UTF-8] Fri Oct 24 17:11:16 2014
@@ -18,317 +18,328 @@ package org.apache.sis.internal.shapefil
 
 import java.sql.*;
 
+
 /**
- * This base class holds all the unimplemented feature of a Statement.
- * (In order to avoid having a Statement implementation of thousand lines and unreadable).
+ * This base class holds most of the unimplemented feature of a {@code Statement}.
+ * This is used in order to avoid having a Statement implementation of thousand lines and unreadable.
+ *
+ * <table class="sis">
+ *   <caption>Connection default values</caption>
+ *   <tr><th>Property</th>                           <th>Value</th></tr>
+ *   <tr><td>{@link #getResultSetType()}</td>        <td>{@link ResultSet#TYPE_SCROLL_SENSITIVE}</td></tr>
+ *   <tr><td>{@link #getResultSetConcurrency()}</td> <td>{@link ResultSet#CONCUR_READ_ONLY}</td></tr>
+ *   <tr><td>{@link #getResultSetHoldability()}</td> <td>{@link ResultSet#CLOSE_CURSORS_AT_COMMIT}</td></tr>
+ *   <tr><td>{@link #getFetchDirection()}</td>       <td>{@link ResultSet#FETCH_FORWARD}</td></tr>
+ *   <tr><td>{@link #getQueryTimeout()}</td>         <td>0</td></tr>
+ *   <tr><td>{@link #isPoolable()}</td>              <td>{@code false}</td></tr>
+ *   <tr><td>{@link #setPoolable(boolean)}</td>      <td>Ignored</td></tr>
+ *   <tr><td>{@link #getWarnings()}</td>             <td>{@code null}</td></tr>
+ *   <tr><td>{@link #clearWarnings()}</td>           <td>Ignored</td></tr>
+ * </table>
  *
  * @author  Marc Le Bihan
+ * @author  Martin Desruisseaux (Geomatys)
  * @version 0.5
  * @since   0.5
  * @module
  */
-abstract public class AbstractStatement extends AbstractJDBC implements Statement {
+@SuppressWarnings("unused")
+abstract class AbstractStatement extends AbstractJDBC implements Statement {
     /**
-     * @see java.sql.Wrapper#unwrap(java.lang.Class)
+     * Constructs a new {@code Statement} instance.
      */
-    @Override
-    public <T> T unwrap(@SuppressWarnings("unused") Class<T> iface) throws SQLException {
-        throw unsupportedOperation(Statement.class, "unwrap");
+    AbstractStatement() {
     }
 
     /**
-     * @see java.sql.Wrapper#isWrapperFor(java.lang.Class)
+     * Returns the JDBC interface implemented by this class.
+     * This is used for formatting error messages.
      */
     @Override
-    public boolean isWrapperFor(@SuppressWarnings("unused") Class<?> iface) throws SQLException {
-        throw unsupportedOperation(Statement.class, "isWrapperFor");
+    final Class<?> getInterface() {
+        return Statement.class;
     }
 
     /**
-     * @see java.sql.Statement#executeUpdate(java.lang.String)
+     * Default to {@link ResultSet#TYPE_SCROLL_SENSITIVE}, meaning that a change in the underlying
+     * database may affect the result set.
      */
     @Override
-    public int executeUpdate(@SuppressWarnings("unused") String sql) throws SQLException {
-        throw unsupportedOperation(Statement.class, "executeUpdate");
-    }
-
-    /**
-     * @see java.sql.Statement#getMaxFieldSize()
-     */
-    @Override
-    public int getMaxFieldSize() throws SQLException {
-        throw unsupportedOperation(Statement.class, "getMaxFieldSize");
+    public int getResultSetType() throws SQLException {
+        return ResultSet.TYPE_SCROLL_SENSITIVE;
     }
 
     /**
-     * @see java.sql.Statement#setMaxFieldSize(int)
+     * Default to {@link ResultSet#CONCUR_READ_ONLY}, which is a conservative vale meaning
+     * that the underlying database should not be updated while we iterate in a result set.
      */
     @Override
-    public void setMaxFieldSize(@SuppressWarnings("unused") int max) throws SQLException {
-        throw unsupportedOperation(Statement.class, "setMaxFieldSize");
+    public int getResultSetConcurrency() throws SQLException {
+        return ResultSet.CONCUR_READ_ONLY;
     }
 
     /**
-     * @see java.sql.Statement#getMaxRows()
+     * Defaults to {@link ResultSet#CLOSE_CURSORS_AT_COMMIT}, which seems the most conservative option.
      */
     @Override
-    public int getMaxRows() throws SQLException {
-        throw unsupportedOperation(Statement.class, "getMaxRows");
+    public int getResultSetHoldability() throws SQLException {
+        return ResultSet.CLOSE_CURSORS_AT_COMMIT;
     }
 
     /**
-     * @see java.sql.Statement#setMaxRows(int)
+     * Unsupported by default.
      */
     @Override
-    public void setMaxRows(@SuppressWarnings("unused") int max) throws SQLException {
-        throw unsupportedOperation(Statement.class, "setMaxRows");
+    public int getMaxFieldSize() throws SQLException {
+        throw unsupportedOperation("getMaxFieldSize");
     }
 
     /**
-     * @see java.sql.Statement#setEscapeProcessing(boolean)
+     * Unsupported by default.
      */
     @Override
-    public void setEscapeProcessing(@SuppressWarnings("unused") boolean enable) throws SQLException {
-        throw unsupportedOperation(Statement.class, "setEscapeProcessing");
+    public void setMaxFieldSize(int max) throws SQLException {
+        throw unsupportedOperation("setMaxFieldSize");
     }
 
     /**
-     * @see java.sql.Statement#getQueryTimeout()
+     * Unsupported by default.
      */
     @Override
-    public int getQueryTimeout() throws SQLException {
-        throw unsupportedOperation(Statement.class, "getQueryTimeout");
+    public int getFetchSize() throws SQLException {
+        throw unsupportedOperation("getFetchSize");
     }
 
     /**
-     * @see java.sql.Statement#setQueryTimeout(int)
+     * Unsupported by default.
      */
     @Override
-    public void setQueryTimeout(@SuppressWarnings("unused") int seconds) throws SQLException {
-        throw unsupportedOperation(Statement.class, "setQueryTimeout");
+    public void setFetchSize(int rows) throws SQLException {
+        throw unsupportedOperation("setFetchSize");
     }
 
     /**
-     * @see java.sql.Statement#cancel()
+     * Defaults to {@link ResultSet#FETCH_FORWARD}.
      */
     @Override
-    public void cancel() throws SQLException {
-        throw unsupportedOperation(Statement.class, "cancel");
+    public int getFetchDirection() throws SQLException {
+        return ResultSet.FETCH_FORWARD;
     }
 
     /**
-     * @see java.sql.Statement#getWarnings()
+     * Unsupported by default.
      */
     @Override
-    public SQLWarning getWarnings() throws SQLException {
-        throw unsupportedOperation(Statement.class, "getWarnings");
+    public void setFetchDirection(int direction) throws SQLException {
+        if (direction != ResultSet.FETCH_FORWARD) {
+            throw unsupportedOperation("setFetchDirection");
+        }
     }
 
     /**
-     * @see java.sql.Statement#clearWarnings()
+     * Unsupported by default.
      */
     @Override
-    public void clearWarnings() throws SQLException {
-        throw unsupportedOperation(Statement.class, "clearWarnings");
+    public int getMaxRows() throws SQLException {
+        throw unsupportedOperation("getMaxRows");
     }
 
     /**
-     * @see java.sql.Statement#setCursorName(java.lang.String)
+     * Unsupported by default.
      */
     @Override
-    public void setCursorName(@SuppressWarnings("unused") String name) throws SQLException {
-        throw unsupportedOperation(Statement.class, "setCursorName");
+    public void setMaxRows(int max) throws SQLException {
+        throw unsupportedOperation("setMaxRows");
     }
 
     /**
-     * @see java.sql.Statement#getUpdateCount()
+     * Defaults to 0, meaning to limit.
      */
     @Override
-    public int getUpdateCount() throws SQLException {
-        throw unsupportedOperation(Statement.class, "getUpdateCount");
+    public int getQueryTimeout() throws SQLException {
+        return 0;
     }
 
     /**
-     * @see java.sql.Statement#setFetchDirection(int)
+     * Unsupported by default.
      */
     @Override
-    public void setFetchDirection(@SuppressWarnings("unused") int direction) throws SQLException {
-        throw unsupportedOperation(Statement.class, "setFetchDirection");
+    public void setQueryTimeout(int seconds) throws SQLException {
+        throw unsupportedOperation("setQueryTimeout");
     }
 
     /**
-     * @see java.sql.Statement#getFetchDirection()
+     * Unsupported by default.
      */
     @Override
-    public int getFetchDirection() throws SQLException {
-        throw unsupportedOperation(Statement.class, "getFetchDirection");
+    public void setEscapeProcessing(boolean enable) throws SQLException {
+        throw unsupportedOperation("setEscapeProcessing");
     }
 
     /**
-     * @see java.sql.Statement#setFetchSize(int)
+     * Unsupported by default.
      */
     @Override
-    public void setFetchSize(@SuppressWarnings("unused") int rows) throws SQLException {
-        throw unsupportedOperation(Statement.class, "setFetchSize");
+    public void setCursorName(String name) throws SQLException {
+        throw unsupportedOperation("setCursorName");
     }
 
     /**
-     * @see java.sql.Statement#getFetchSize()
+     * Unsupported by default.
      */
     @Override
-    public int getFetchSize() throws SQLException {
-        throw unsupportedOperation(Statement.class, "getFetchSize");
+    public boolean execute(String sql) throws SQLException {
+        throw unsupportedOperation("execute");
     }
 
     /**
-     * @see java.sql.Statement#getResultSetConcurrency()
+     * Unsupported by default.
      */
     @Override
-    public int getResultSetConcurrency() throws SQLException {
-        throw unsupportedOperation(Statement.class, "getResultSetConcurrency");
+    public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
+        throw unsupportedOperation("execute");
     }
 
     /**
-     * @see java.sql.Statement#addBatch(java.lang.String)
+     * Unsupported by default.
      */
     @Override
-    public void addBatch(@SuppressWarnings("unused") String sql) throws SQLException {
-        throw unsupportedOperation(Statement.class, "addBatch");
+    public boolean execute(String sql, int[] columnIndexes) throws SQLException {
+        throw unsupportedOperation("execute");
     }
 
     /**
-     * @see java.sql.Statement#clearBatch()
+     * Unsupported by default.
      */
     @Override
-    public void clearBatch() throws SQLException {
-        throw unsupportedOperation(Statement.class, "clearBatch");
+    public boolean execute(String sql, String[] columnNames) throws SQLException {
+        throw unsupportedOperation("execute");
     }
 
     /**
-     * @see java.sql.Statement#executeBatch()
+     * Unsupported by default.
      */
     @Override
-    public int[] executeBatch() throws SQLException {
-        throw unsupportedOperation(Statement.class, "executeBatch");
+    public int executeUpdate(String sql) throws SQLException {
+        throw unsupportedOperation("executeUpdate");
     }
 
     /**
-     * @see java.sql.Statement#getMoreResults(int)
+     * Unsupported by default.
      */
     @Override
-    public boolean getMoreResults(@SuppressWarnings("unused") int current) throws SQLException {
-        throw unsupportedOperation(Statement.class, "getMoreResults");
+    public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
+        throw unsupportedOperation("executeUpdate");
     }
 
     /**
-     * @see java.sql.Statement#getGeneratedKeys()
+     * Unsupported by default.
      */
     @Override
-    public ResultSet getGeneratedKeys() throws SQLException {
-        throw unsupportedOperation(Statement.class, "getGeneratedKeys");
+    public int executeUpdate(String sql, int[] columnIndexes) throws SQLException {
+        throw unsupportedOperation("executeUpdate");
     }
 
     /**
-     * @see java.sql.Statement#executeUpdate(java.lang.String, int)
+     * Unsupported by default.
      */
     @Override
-    public int executeUpdate(@SuppressWarnings("unused") String sql, @SuppressWarnings("unused") int autoGeneratedKeys) throws SQLException {
-        throw unsupportedOperation(Statement.class, "executeUpdate");
+    public int executeUpdate(String sql, String[] columnNames) throws SQLException {
+        throw unsupportedOperation("executeUpdate");
     }
 
     /**
-     * @see java.sql.Statement#executeUpdate(java.lang.String, int[])
+     * Unsupported by default.
      */
     @Override
-    public int executeUpdate(@SuppressWarnings("unused") String sql, @SuppressWarnings("unused") int[] columnIndexes) throws SQLException {
-        throw unsupportedOperation(Statement.class, "executeUpdate");
+    public int getUpdateCount() throws SQLException {
+        throw unsupportedOperation("getUpdateCount");
     }
 
     /**
-     * @see java.sql.Statement#executeUpdate(java.lang.String, java.lang.String[])
+     * Unsupported by default.
      */
     @Override
-    public int executeUpdate(@SuppressWarnings("unused") String sql, @SuppressWarnings("unused") String[] columnNames) throws SQLException {
-        throw unsupportedOperation(Statement.class, "executeUpdate");
+    public void addBatch(String sql) throws SQLException {
+        throw unsupportedOperation("addBatch");
     }
 
     /**
-     * @see java.sql.Statement#getResultSetHoldability()
+     * Unsupported by default.
      */
     @Override
-    public int getResultSetHoldability() throws SQLException {
-        throw unsupportedOperation(Statement.class, "getResultSetHoldability");
+    public void clearBatch() throws SQLException {
+        throw unsupportedOperation("clearBatch");
     }
 
     /**
-     * @see java.sql.Statement#setPoolable(boolean)
+     * Unsupported by default.
      */
     @Override
-    public void setPoolable(@SuppressWarnings("unused") boolean poolable) throws SQLException {
-        throw unsupportedOperation(Statement.class, "setPoolable");
+    public int[] executeBatch() throws SQLException {
+        throw unsupportedOperation("executeBatch");
     }
 
     /**
-     * @see java.sql.Statement#isPoolable()
+     * Unsupported by default.
      */
     @Override
-    public boolean isPoolable() throws SQLException {
-        throw unsupportedOperation(Statement.class, "isPoolable");
+    public boolean getMoreResults() throws SQLException {
+        throw unsupportedOperation("getMoreResults");
     }
 
     /**
-     * @see java.sql.Statement#closeOnCompletion()
+     * Unsupported by default.
      */
     @Override
-    public void closeOnCompletion() throws SQLException {
-        throw unsupportedOperation(Statement.class, "closeOnCompletion");
+    public boolean getMoreResults(int current) throws SQLException {
+        throw unsupportedOperation("getMoreResults");
     }
 
     /**
-     * @see java.sql.Statement#isCloseOnCompletion()
+     * Unsupported by default.
      */
     @Override
-    public boolean isCloseOnCompletion() throws SQLException {
-        throw unsupportedOperation(Statement.class, "isCloseOnCompletion");
+    public ResultSet getGeneratedKeys() throws SQLException {
+        throw unsupportedOperation("getGeneratedKeys");
     }
 
     /**
-     * @see java.sql.Statement#getMoreResults()
+     * Defaults to {@code false} since simple statement imlementations are not poolable.
      */
     @Override
-    public boolean getMoreResults() throws SQLException {
-        throw unsupportedOperation(Statement.class, "getMoreResults");
+    public boolean isPoolable() throws SQLException {
+        return false;
     }
 
     /**
-     * @see java.sql.Statement#getResultSetType()
+     * Ignored by default since this method is only a hint.
      */
     @Override
-    public int getResultSetType() throws SQLException {
-        throw unsupportedOperation(Statement.class, "getResultSetType");
+    public void setPoolable(boolean poolable) throws SQLException {
     }
 
     /**
-     * @see java.sql.Statement#execute(java.lang.String, int)
+     * Unsupported by default.
      */
     @Override
-    public boolean execute(@SuppressWarnings("unused") String sql, @SuppressWarnings("unused") int autoGeneratedKeys) throws SQLException {
-        throw unsupportedOperation(Statement.class, "execute");
+    public void cancel() throws SQLException {
+        throw unsupportedOperation("cancel");
     }
 
     /**
-     * @see java.sql.Statement#execute(java.lang.String, int[])
+     * Unsupported by default.
      */
     @Override
-    public boolean execute(@SuppressWarnings("unused") String sql, @SuppressWarnings("unused") int[] columnIndexes) throws SQLException {
-        throw unsupportedOperation(Statement.class, "execute");
+    public void closeOnCompletion() throws SQLException {
+        throw unsupportedOperation("closeOnCompletion");
     }
 
     /**
-     * @see java.sql.Statement#execute(java.lang.String, java.lang.String[])
+     * Unsupported by default.
      */
     @Override
-    public boolean execute(@SuppressWarnings("unused") String sql, @SuppressWarnings("unused") String[] columnNames) throws SQLException {
-        throw unsupportedOperation(Statement.class, "execute");
+    public boolean isCloseOnCompletion() throws SQLException {
+        throw unsupportedOperation("isCloseOnCompletion");
     }
 }

Modified: sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFConnection.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFConnection.java?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFConnection.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFConnection.java [UTF-8] Fri Oct 24 17:11:16 2014
@@ -16,109 +16,92 @@
  */
 package org.apache.sis.internal.shapefile.jdbc;
 
-import org.apache.sis.storage.shapefile.Database;
-import static java.util.logging.Level.*;
-
-import java.io.*;
 import java.sql.*;
-import java.util.*;
-import java.util.logging.*;
+import java.io.File;
+import java.io.IOException;
+import org.apache.sis.util.resources.Errors;
+import org.apache.sis.storage.shapefile.Database;
 
 
 /**
- * DBF Connection.
+ * Connection to a DBF database.
  *
  * @author  Marc Le Bihan
  * @version 0.5
  * @since   0.5
  * @module
  */
-public class DBFConnection extends AbstractConnection {
-    /** Database file. */
-    private File m_dataFile;
-
-    /** Database file. */
-    private Database m_database;
-
+final class DBFConnection extends AbstractConnection {
     /**
-     * Return the binary representation of the database.
-     * @return Database.
+     * The object to use for reading the database content.
      */
-    public Database getDatabase() {
-        return m_database;
-    }
+    final Database database;
 
     /**
-     * Return the data part file of this Dbase.
-     * @return *.dbf part of the database.
+     * Constructs a connection to the given database.
+     *
+     * @param  datafile Data file ({@code .dbf} extension).
+     * @throws IOException if the given file is invalid.
      */
-    public File getDataFile() {
-        return m_dataFile;
-    }
-
-    /**
-     * Construct a connection.
-     * @param datafile Data file (.dbf extension).
-     * @throws SQLException if the given file is invalid.
-     */
-    DBFConnection(File datafile) throws SQLException {
-        Objects.requireNonNull(datafile, "the database file to connect to cannot be null.");
-
+    DBFConnection(final File datafile) throws SQLException, IOException {
         // Check that file exists.
-        if (datafile.exists() == false)
-            throw(new SQLException(format(SEVERE, "excp.file_not_found", datafile.getAbsolutePath())));
-
+        if (!datafile.exists()) {
+            throw new SQLException(Errors.format(Errors.Keys.FileNotFound_1, datafile.getAbsolutePath()));
+        }
         // Check that its not a directory.
-        if (datafile.isDirectory())
-            throw(new SQLException(format(SEVERE, "excp.directory_not_expected", datafile.getAbsolutePath())));
-
-        m_dataFile = datafile;
-
-        try {
-            m_database = new Database(m_dataFile.getAbsolutePath());
-            m_database.loadDescriptor();
-        } catch (FileNotFoundException e) {
-            throw new RuntimeException("Bug : File existence has been checked before.");
-        } catch(IOException e) {
-            String message = format(Level.SEVERE, "excp.invalid_dbf_format_descriptor", datafile.getAbsolutePath(), e.getMessage());
-            throw new InvalidDbaseFileFormatException(message);
+        if (datafile.isDirectory()) {
+            throw new SQLException(Errors.format(Errors.Keys.DirectoryNotExpected_1, datafile.getAbsolutePath()));
         }
+        database = new Database(datafile.getAbsolutePath());
+        database.loadDescriptor();
     }
 
     /**
-     * @see java.sql.Connection#createStatement()
+     * Creates an object for sending SQL statements to the database.
      */
     @Override
-    public Statement createStatement() {
+    public Statement createStatement() throws SQLException {
+        assertNotClosed();
         return new DBFStatement(this);
     }
 
     /**
-     * @see java.sql.Connection#close()
+     * Closes the connection to the database.
      */
     @Override
     public void close() throws SQLException {
         try {
-            m_database.close();
-        } catch(IOException e) {
-            throw new SQLException(e.getMessage(), e);
+            database.close();
+        } catch (IOException e) {
+            throw new SQLException(e.getLocalizedMessage(), e);
         }
     }
 
     /**
-     * @see java.sql.Connection#isClosed()
+     * Returns {@code true} if this connection has been closed.
      */
     @Override
     public boolean isClosed() {
-        return m_database.isClosed();
+        return database.isClosed();
+    }
+
+    /**
+     * Asserts that the connection is opened.
+     *
+     * @throws SQLException if the connection is closed.
+     */
+    final void assertNotClosed() throws SQLException {
+        if (isClosed()) {
+            throw new SQLNonTransientException(Resources.format(Resources.Keys.ClosedConnection));
+        }
     }
 
     /**
-     * @see java.sql.Connection#isValid(int)
+     * Returns {@code true} if the connection has not been closed and is still valid.
+     * The timeout parameter is ignored and this method bases itself only on {@link #isClosed()} state.
      */
     @Override
     public boolean isValid(@SuppressWarnings("unused") int timeout) {
-        this.getLogger().log(WARNING, "Connection.isValid(..) timeout parameter is ignored and the function bases itself only on isClosed state.");
-        return isClosed() == false;
+        return !isClosed();
     }
 }

Modified: sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFDriver.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFDriver.java?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFDriver.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFDriver.java [UTF-8] Fri Oct 24 17:11:16 2014
@@ -16,10 +16,14 @@
  */
 package org.apache.sis.internal.shapefile.jdbc;
 
-import java.io.*;
 import java.sql.*;
-import java.util.*;
-import java.util.logging.*;
+import java.io.File;
+import java.io.IOException;
+import java.util.Properties;
+import java.util.logging.Logger;
+import org.apache.sis.util.ArgumentChecks;
+import org.apache.sis.internal.system.Modules;
+
 
 /**
  * Database driver for DBF 3.
@@ -31,48 +35,82 @@ import java.util.logging.*;
  */
 public class DBFDriver extends AbstractJDBC implements Driver {
     /**
-     * @see java.sql.Driver#connect(java.lang.String, java.util.Properties)
+     * Creates a new driver.
+     */
+    public DBFDriver() {
+    }
+
+    /**
+     * Returns the JDBC interface implemented by this class.
+     * This is used for formatting error messages.
+     */
+    @Override
+    final Class<?> getInterface() {
+        return Driver.class;
+    }
+
+    /**
+     * Attempts to make a database connection to the given filename.
+     *
+     * @param  url  The path to a {@code .dbf} file.
+     * @param  info Ignored in current implementation.
+     * @return A connection to the given DBF file.
+     * @throws SQLException if this method can not create a connection to the given file.
      */
     @Override
-    public Connection connect(String url, @SuppressWarnings("unused") Properties info) throws SQLException {
-        return new DBFConnection(new File(url));
+    public Connection connect(final String url, @SuppressWarnings("unused") Properties info) throws SQLException {
+        ArgumentChecks.ensureNonNull("url", url);
+        try {
+            return new DBFConnection(new File(url));
+        } catch (IOException e) {
+            throw new SQLNonTransientConnectionException(Resources.format(
+                    Resources.Keys.InvalidDBFFormatDescriptor_2, url, e.getLocalizedMessage()));
+        }
     }
 
     /**
-     * @see java.sql.Driver#acceptsURL(java.lang.String)
+     * Returns {@code true} if this driver thinks that it can open the given URL.
      */
     @Override
-    public boolean acceptsURL(@SuppressWarnings("unused") String url) {
-        return true;
+    public boolean acceptsURL(final String url) {
+        if (!url.endsWith(".dbf")) {
+            return false;
+        }
+        final File datafile = new File(url);
+        return datafile.isFile(); // Future version should check for magic number.
     }
 
     /**
-     * @see java.sql.Driver#getPropertyInfo(java.lang.String, java.util.Properties)
+     * Gets information about the possible properties for this driver.
+     * The current version has none.
      */
     @Override
-    public DriverPropertyInfo[] getPropertyInfo(@SuppressWarnings("unused") String url, @SuppressWarnings("unused") Properties info) {
-        return new DriverPropertyInfo[]{};
+    public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) {
+        return new DriverPropertyInfo[0];
     }
 
     /**
-     * @see java.sql.Driver#getMajorVersion()
+     * The major version number of this driver.
+     * This is set to the Apache SIS version.
      */
     @Override
     public int getMajorVersion() {
-        return 0;
+        return Modules.MAJOR_VERSION;
     }
 
     /**
-     * @see java.sql.Driver#getMinorVersion()
+     * The minor version number of this driver.
+     * This is set to the Apache SIS version.
      */
     @Override
     public int getMinorVersion() {
-        return 1;
+        return Modules.MINOR_VERSION;
     }
 
     /**
-     * This driver is currently not compliant. It has to succeed these tests first : <a href="http://www.oracle.com/technetwork/java/jdbctestsuite-1-3-1-140675.html">Compliance tests</a>
-     * @see java.sql.Driver#jdbcCompliant()
+     * This driver is currently not compliant.
+     * It has to succeed these tests first:
+     * <a href="http://www.oracle.com/technetwork/java/jdbctestsuite-1-3-1-140675.html">Compliance tests</a>.
      */
     @Override
     public boolean jdbcCompliant() {
@@ -80,10 +118,10 @@ public class DBFDriver extends AbstractJ
     }
 
     /**
-     * @see java.sql.Driver#getParentLogger()
+     * The logger used by this driver.
      */
     @Override
     public Logger getParentLogger() {
-        return getLogger();
+        return LOGGER;
     }
 }

Modified: sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFResultSet.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFResultSet.java?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFResultSet.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFResultSet.java [UTF-8] Fri Oct 24 17:11:16 2014
@@ -16,14 +16,9 @@
  */
 package org.apache.sis.internal.shapefile.jdbc;
 
-import org.apache.sis.storage.shapefile.Database;
-import static java.util.logging.Level.*;
-
-import java.math.*;
 import java.sql.*;
-import java.sql.Date;
-import java.util.*;
-import java.util.logging.*;
+import java.util.Map;
+import org.apache.sis.storage.shapefile.Database;
 
 
 /**
@@ -34,371 +29,104 @@ import java.util.logging.*;
  * @since   0.5
  * @module
  */
-public class DBFResultSet extends AbstractResultSet {
-    /** Parent statement. */
-    private DBFStatement m_parentStatement;
-
-    /** Indicate if the ResultSet is closed. */
-    private boolean m_closed;
-
-    /** Current record. */
-    private HashMap<String, Object> m_currentRecord;
-
-    /**
-     * Constructs a ResultSet.
-     * @param parentStatement Parent statement.
-     */
-    DBFResultSet(DBFStatement parentStatement) {
-        Objects.requireNonNull(parentStatement, "The parent Statement of the ResulSet cannot be null.");
-
-        m_parentStatement = parentStatement;
-        m_closed = false;
-    }
-
-    /**
-     * @see java.sql.ResultSet#next()
-     */
-    @Override
-    public boolean next() throws SQLException {
-        assertNotClosed();
-
-        // Check that we aren't at the end of the Database file.
-        if (getDatabase().getRowNum() >= getDatabase().getRecordCount()) {
-            String message = format(Level.SEVERE, "excp.no_more_results");
-            throw new SQLException(message);
-        }
-
-        // TODO : Currently this function is only able to return String objects.
-        m_currentRecord = getDatabase().readNextRowAsObjects();
-
-        // Return the availability of a next record.
-        boolean nextRecord = getDatabase().getRowNum() < getDatabase().getRecordCount();
-        return nextRecord;
-    }
-
-    /**
-     * @see java.sql.ResultSet#close()
-     */
-    @Override
-    public void close() {
-        m_closed = true;
-    }
-
-    /**
-     * @see java.sql.ResultSet#isClosed()
-     */
-    @Override
-    public boolean isClosed() {
-        return m_closed || this.m_parentStatement.isClosed();
-    }
-
-    /**
-     * @see java.sql.ResultSet#getString(int)
-     */
-    @Override
-    public String getString(int columnIndex) throws SQLException {
-        assertNotClosed();
-
-        return null;
-    }
-
-    /**
-     * @see java.sql.ResultSet#getBoolean(int)
-     */
-    @Override
-    public boolean getBoolean(int columnIndex) throws SQLException {
-        assertNotClosed();
-        return false;
-    }
-
+final class DBFResultSet extends AbstractResultSet {
     /**
-     * @see java.sql.ResultSet#getByte(int)
+     * Parent statement.
      */
-    @Override
-    public byte getByte(int columnIndex) throws SQLException {
-        assertNotClosed();
-        return 0;
-    }
+    private final DBFStatement statement;
 
     /**
-     * @see java.sql.ResultSet#getShort(int)
+     * A copy of the {@link DBFConnection#database} reference, copied here for efficiency.
      */
-    @Override
-    public short getShort(int columnIndex) throws SQLException {
-        assertNotClosed();
-        return 0;
-    }
+    private final Database database;
 
     /**
-     * @see java.sql.ResultSet#getInt(int)
+     * Indicates if the ResultSet is closed.
      */
-    @Override
-    public int getInt(int columnIndex) throws SQLException {
-        assertNotClosed();
-        return 0;
-    }
+    private boolean isClosed;
 
     /**
-     * @see java.sql.ResultSet#getLong(int)
+     * The current records.
      */
-    @Override
-    public long getLong(int columnIndex) throws SQLException {
-        assertNotClosed();
-        return 0;
-    }
+    private Map<String, Object> records;
 
     /**
-     * @see java.sql.ResultSet#getFloat(int)
+     * Constructs a result set.
+     *
+     * @param statement Parent statement.
      */
-    @Override
-    public float getFloat(int columnIndex) throws SQLException {
-        assertNotClosed();
-        return 0;
-    }
-
-    /**
-     * @see java.sql.ResultSet#getDouble(int)
-     */
-    @Override
-    public double getDouble(int columnIndex) throws SQLException {
-        assertNotClosed();
-        return 0;
+    DBFResultSet(final DBFStatement statement) {
+        this.statement = statement;
+        database = statement.connection.database;
     }
 
     /**
-     * @see java.sql.ResultSet#getBigDecimal(int, int)
+     * Returns the parent statement.
      */
     @Override
-    public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException {
+    public Statement getStatement() throws SQLException {
         assertNotClosed();
-        return null;
+        return statement;
     }
 
     /**
-     * @see java.sql.ResultSet#getBytes(int)
+     * Moves the cursor forward one row from its current position.
      */
     @Override
-    public byte[] getBytes(int columnIndex) throws SQLException {
+    public boolean next() throws SQLException {
         assertNotClosed();
-        return null;
-    }
 
-    /**
-     * @see java.sql.ResultSet#getDate(int)
-     */
-    @Override
-    public Date getDate(int columnIndex) throws SQLException {
-        assertNotClosed();
-        return null;
-    }
+        // Check that we aren't at the end of the Database file.
+        final int remaining = database.getRecordCount() - database.getRowNum();
+        if (remaining <= 0) {
+            throw new SQLNonTransientException(Resources.format(Resources.Keys.NoMoreResults));
+        }
 
-    /**
-     * @see java.sql.ResultSet#getTime(int)
-     */
-    @Override
-    public Time getTime(int columnIndex) throws SQLException {
-        assertNotClosed();
-        return null;
-    }
+        // TODO : Currently this function is only able to return String objects.
+        records = database.readNextRowAsObjects();
 
-    /**
-     * @see java.sql.ResultSet#getTimestamp(int)
-     */
-    @Override
-    public Timestamp getTimestamp(int columnIndex) throws SQLException {
-        assertNotClosed();
-        return null;
+        // Return the availability of a next record.
+        return remaining > 1;
     }
 
     /**
-     * @see java.sql.ResultSet#getString(java.lang.String)
+     * Returns the value in the current row for the given column.
      */
     @Override
     public String getString(String columnLabel) throws SQLException {
         assertNotClosed();
-        return (String)m_currentRecord.get(columnLabel);
-    }
-
-    /**
-     * @see java.sql.ResultSet#getBoolean(java.lang.String)
-     */
-    @Override
-    public boolean getBoolean(String columnLabel) throws SQLException {
-        assertNotClosed();
-        return false;
-    }
-
-    /**
-     * @see java.sql.ResultSet#getByte(java.lang.String)
-     */
-    @Override
-    public byte getByte(String columnLabel) throws SQLException {
-        assertNotClosed();
-        return 0;
-    }
-
-    /**
-     * @see java.sql.ResultSet#getShort(java.lang.String)
-     */
-    @Override
-    public short getShort(String columnLabel) throws SQLException {
-        assertNotClosed();
-        return 0;
-    }
-
-    /**
-     * @see java.sql.ResultSet#getInt(java.lang.String)
-     */
-    @Override
-    public int getInt(String columnLabel) throws SQLException {
-        assertNotClosed();
-        return 0;
-    }
-
-    /**
-     * @see java.sql.ResultSet#getLong(java.lang.String)
-     */
-    @Override
-    public long getLong(String columnLabel) throws SQLException {
-        assertNotClosed();
-        return 0;
-    }
-
-    /**
-     * @see java.sql.ResultSet#getFloat(java.lang.String)
-     */
-    @Override
-    public float getFloat(String columnLabel) throws SQLException {
-        assertNotClosed();
-        return 0;
-    }
-
-    /**
-     * @see java.sql.ResultSet#getDouble(java.lang.String)
-     */
-    @Override
-    public double getDouble(String columnLabel) throws SQLException {
-        assertNotClosed();
-        // TODO Auto-generated method stub
-        return 0;
-    }
-
-    /**
-     * @see java.sql.ResultSet#getBigDecimal(java.lang.String, int)
-     */
-    @Override
-    public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException {
-        assertNotClosed();
-        return null;
-    }
-
-    /**
-     * @see java.sql.ResultSet#getBytes(java.lang.String)
-     */
-    @Override
-    public byte[] getBytes(String columnLabel) throws SQLException {
-        assertNotClosed();
-        return null;
-    }
-
-    /**
-     * @see java.sql.ResultSet#getDate(java.lang.String)
-     */
-    @Override
-    public Date getDate(String columnLabel) throws SQLException {
-        assertNotClosed();
-        return null;
-    }
-
-    /**
-     * @see java.sql.ResultSet#getTime(java.lang.String)
-     */
-    @Override
-    public Time getTime(String columnLabel) throws SQLException {
-        assertNotClosed();
-        return null;
-    }
-
-    /**
-     * @see java.sql.ResultSet#getTimestamp(java.lang.String)
-     */
-    @Override
-    public Timestamp getTimestamp(String columnLabel) throws SQLException {
-        assertNotClosed();
-        return null;
-    }
-
-
-    /**
-     * @see java.sql.ResultSet#getMetaData()
-     */
-    @Override
-    public ResultSetMetaData getMetaData() throws SQLException {
-        assertNotClosed();
-        return null;
-    }
-
-    /**
-     * @see java.sql.ResultSet#getObject(int)
-     */
-    @Override
-    public Object getObject(int columnIndex) throws SQLException {
-        assertNotClosed();
-        return null;
-    }
-
-    /**
-     * @see java.sql.ResultSet#getObject(java.lang.String)
-     */
-    @Override
-    public Object getObject(String columnLabel) throws SQLException {
-        assertNotClosed();
-        return null;
-    }
-
-    /**
-     * @see java.sql.ResultSet#getBigDecimal(int)
-     */
-    @Override
-    public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
-        assertNotClosed();
-        return null;
+        final Object value = records.get(columnLabel);
+        if (value != null) {
+            return (String) value;
+        }
+        throw new SQLNonTransientException(Resources.format(Resources.Keys.NoSuchColumn_1, columnLabel));
     }
 
     /**
-     * @see java.sql.ResultSet#getBigDecimal(java.lang.String)
+     * Closes this result set.
      */
     @Override
-    public BigDecimal getBigDecimal(String columnLabel) throws SQLException {
-        assertNotClosed();
-        return null;
+    public void close() {
+        isClosed = true;
     }
 
     /**
-     * @see java.sql.ResultSet#getStatement()
+     * Returns {@code true} if this result set has been closed.
      */
     @Override
-    public Statement getStatement() throws SQLException {
-        assertNotClosed();
-        return m_parentStatement;
+    public boolean isClosed() {
+        return isClosed || statement.isClosed();
     }
 
     /**
-     * Asserts that the connection and the statement are together opened.
+     * Asserts that the connection, statement and result set are together opened.
+     *
      * @throws SQLException if one of them is closed.
      */
     private void assertNotClosed() throws SQLException {
-        if (isClosed())
-            throw new SQLException(this.format(SEVERE, "excp.closed_connection"));
-    }
-
-    /**
-     * Return the underlying database binary representation.
-     * @return Database.
-     * @throws SQLException if the database is closed.
-     */
-    private Database getDatabase() throws SQLException {
-        assertNotClosed();
-        return ((DBFConnection)m_parentStatement.getConnection()).getDatabase();
+        statement.assertNotClosed();
+        if (isClosed) {
+            throw new SQLNonTransientException(Resources.format(Resources.Keys.ClosedResultSet));
+        }
     }
 }

Modified: sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFStatement.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFStatement.java?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFStatement.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFStatement.java [UTF-8] Fri Oct 24 17:11:16 2014
@@ -16,10 +16,9 @@
  */
 package org.apache.sis.internal.shapefile.jdbc;
 
-import static java.util.logging.Level.*;
-
 import java.sql.*;
-import java.util.*;
+import org.apache.sis.util.ArgumentChecks;
+
 
 /**
  * DBF Statement.
@@ -29,88 +28,91 @@ import java.util.*;
  * @since   0.5
  * @module
  */
-public class DBFStatement extends AbstractStatement {
-    /** Connection this statement is relying on. */
-    private DBFConnection m_parentConnection;
-
-    /** Indicate if the statement is currently closed. */
-    boolean m_closed;
-
+final class DBFStatement extends AbstractStatement {
     /**
-     * Create a statement.
-     * @param connection Connection associated to this statement.
+     * Connection this statement is relying on.
      */
-    DBFStatement(DBFConnection connection) {
-        Objects.requireNonNull(connection, "The parent Connection of the ResulSet cannot be null.");
+    final DBFConnection connection;
 
-        m_parentConnection = connection;
-        m_closed = false;
-    }
+    /**
+     * The current result set, or {@code null} if none.
+     */
+    private DBFResultSet resultSet;
 
     /**
-     * @see java.sql.Statement#executeQuery(java.lang.String)
+     * Indicates if the statement is currently closed.
      */
-    @Override
-    public ResultSet executeQuery(String sql) throws SQLException {
-        Objects.requireNonNull(sql, "The SQL query for executeQuery cannot be null.");
+    private boolean isClosed;
 
-        assertNotClosed();
-        return new DBFResultSet(this);
+    /**
+     * Constructs a statement.
+     *
+     * @param connection Connection associated to this statement.
+     */
+    DBFStatement(final DBFConnection connection) {
+        this.connection = connection;
     }
 
     /**
-     * @see java.sql.Statement#close()
+     * Returns the connection.
      */
     @Override
-    public void close() {
-        m_closed = true;
+    public Connection getConnection() throws SQLException {
+        assertNotClosed();
+        return connection;
     }
 
     /**
-     * @see java.sql.Statement#execute(java.lang.String)
+     * Executes the given SQL statement.
      */
     @Override
-    public boolean execute(String sql) throws SQLException {
-        Objects.requireNonNull(sql, "The SQL query for execute cannot be null.");
-        return false;
+    public ResultSet executeQuery(final String sql) throws SQLException {
+        ArgumentChecks.ensureNonNull("sql", sql);
+        assertNotClosed();
+        if (resultSet != null) {
+            resultSet.close();
+        }
+        return resultSet = new DBFResultSet(this);
     }
 
     /**
-     * @see java.sql.Statement#getResultSet()
+     * Returns the result set created by the last call to {@link #executeQuery(String)}.
      */
     @Override
     public ResultSet getResultSet() throws SQLException {
         assertNotClosed();
-        return new DBFResultSet(this);
+        return resultSet;
     }
 
-
     /**
-     * @see java.sql.Statement#getConnection()
+     * Closes this statement.
      */
     @Override
-    public Connection getConnection() throws SQLException {
-        if (m_parentConnection.isClosed())
-            throw new SQLException(this.format(SEVERE, "excp.closed_connection"));
-        else
-            return m_parentConnection;
+    public void close() {
+        if (resultSet != null) {
+            resultSet.close();
+        }
+        isClosed = true;
     }
 
     /**
-     * @see java.sql.Statement#isClosed()
+     * Returns {@code true} if this statement has been closed
+     * or if the underlying connection is closed.
      */
     @Override
     public boolean isClosed() {
-        assert(m_parentConnection != null);
-        return m_parentConnection.isClosed() || m_closed;
+        return isClosed || connection.isClosed();
     }
 
     /**
      * Asserts that the connection and the statement are together opened.
+     *
      * @throws SQLException if one of them is closed.
      */
-    private void assertNotClosed() throws SQLException {
-        if (isClosed())
-            throw new SQLException(this.format(SEVERE, "excp.closed_connection"));
+    final void assertNotClosed() throws SQLException {
+        connection.assertNotClosed();
+        if (isClosed) {
+            throw new SQLNonTransientException(Resources.format(Resources.Keys.ClosedStatement));
+        }
     }
 }

Modified: sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/package-info.java?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/package-info.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/package-info.java [UTF-8] Fri Oct 24 17:11:16 2014
@@ -15,7 +15,6 @@
  * limitations under the License.
  */
 
-
 /**
  * Shapefile.
  *

Modified: sis/branches/JDK7/storage/sis-shapefile/src/test/java/org/apache/sis/test/suite/ShapefileTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-shapefile/src/test/java/org/apache/sis/test/suite/ShapefileTestSuite.java?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-shapefile/src/test/java/org/apache/sis/test/suite/ShapefileTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-shapefile/src/test/java/org/apache/sis/test/suite/ShapefileTestSuite.java [UTF-8] Fri Oct 24 17:11:16 2014
@@ -26,8 +26,7 @@ import org.junit.BeforeClass;
  */
 @Suite.SuiteClasses({
     org.apache.sis.storage.shapefile.ShapeFileTest.class,
-    org.apache.sis.internal.shapefile.jdbc.ConnectionTest.class,
-    org.apache.sis.internal.shapefile.jdbc.ResultSetTest.class
+    org.apache.sis.internal.shapefile.jdbc.DBFResultSetTest.class
 })
 public final strictfp class ShapefileTestSuite extends TestSuite {
     /**

Modified: sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/XMLStoreTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/XMLStoreTest.java?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/XMLStoreTest.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/XMLStoreTest.java [UTF-8] Fri Oct 24 17:11:16 2014
@@ -19,17 +19,14 @@ package org.apache.sis.internal.storage.
 import java.util.Locale;
 import java.io.StringReader;
 import org.opengis.metadata.Metadata;
-import org.opengis.metadata.citation.Role;
-import org.opengis.metadata.citation.OnLineFunction;
-import org.opengis.metadata.citation.OnlineResource;
-import org.opengis.metadata.citation.ResponsibleParty;
+import org.opengis.metadata.citation.*;
 import org.apache.sis.xml.Namespaces;
 import org.apache.sis.storage.StorageConnector;
 import org.apache.sis.storage.DataStoreException;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
-import static org.junit.Assert.*;
+import static org.opengis.test.Assert.*;
 import static org.apache.sis.test.TestUtilities.getSingleton;
 
 // Branch-dependent imports
@@ -41,7 +38,7 @@ import java.nio.charset.StandardCharsets
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.5
  * @module
  */
 public final strictfp class XMLStoreTest extends TestCase {
@@ -98,13 +95,16 @@ public final strictfp class XMLStoreTest
             metadata = store.getMetadata();
             assertSame("Expected cached value.", metadata, store.getMetadata());
         }
-        final ResponsibleParty party  = (ResponsibleParty) getSingleton(metadata.getContacts());
-        final OnlineResource resource = party.getContactInfo().getOnlineResource();
-
-        assertEquals(Locale.ENGLISH,              metadata.getLanguage());
-        assertEquals(StandardCharsets.UTF_8,      metadata.getCharacterSet());
-        assertEquals(Role.PRINCIPAL_INVESTIGATOR, party.getRole());
-        assertEquals("Apache SIS",                String.valueOf(party.getOrganisationName()));
+        final Responsibility resp     = getSingleton(metadata.getContacts());
+        final Party          party    = getSingleton(resp.getParties());
+        final Contact        contact  = getSingleton(party.getContactInfo());
+        final OnlineResource resource = getSingleton(contact.getOnlineResources());
+
+        assertInstanceOf("party", Organisation.class, party);
+        assertEquals(Locale.ENGLISH,              getSingleton(metadata.getLanguages()));
+        assertEquals(StandardCharsets.UTF_8,      getSingleton(metadata.getCharacterSets()));
+        assertEquals(Role.PRINCIPAL_INVESTIGATOR, resp.getRole());
+        assertEquals("Apache SIS",                String.valueOf(party.getName()));
         assertEquals("http://sis.apache.org",     String.valueOf(resource.getLinkage()));
         assertEquals(OnLineFunction.INFORMATION,  resource.getFunction());
     }



Mime
View raw message