sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1631808 [2/2] - in /sis/branches/JDK8/storage/sis-shapefile/src: main/java/org/apache/sis/internal/ main/java/org/apache/sis/internal/shapefile/ main/java/org/apache/sis/internal/shapefile/jdbc/ main/resources/ main/resources/org/ main/res...
Date Tue, 14 Oct 2014 16:12:45 GMT
Added: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFConnection.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFConnection.java?rev=1631808&view=auto
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFConnection.java (added)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFConnection.java [UTF-8] Tue Oct 14 16:12:44 2014
@@ -0,0 +1,125 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+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.*;
+
+
+/**
+ * DBF Connection.
+ *
+ * @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;
+
+    /**
+     * Return the binary representation of the database.
+     * @return Database.
+     */
+    public Database getDatabase() {
+        return m_database;
+    }
+
+    /**
+     * Return the data part file of this Dbase.
+     * @return *.dbf part of the database.
+     */
+    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.");
+
+        // Check that file exists.
+        if (datafile.exists() == false)
+            throw(new SQLException(format(SEVERE, "excp.file_not_found", 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);
+        }
+    }
+
+    /**
+     * @see java.sql.Connection#createStatement()
+     */
+    @Override
+    public Statement createStatement() {
+        return new DBFStatement(this);
+    }
+
+    /**
+     * @see java.sql.Connection#close()
+     */
+    @Override
+    public void close() throws SQLException {
+        try {
+            m_database.close();
+        } catch(IOException e) {
+            throw new SQLException(e.getMessage(), e);
+        }
+    }
+
+    /**
+     * @see java.sql.Connection#isClosed()
+     */
+    @Override
+    public boolean isClosed() {
+        return m_database.isClosed();
+    }
+
+    /**
+     * @see java.sql.Connection#isValid(int)
+     */
+    @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;
+    }
+}

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFConnection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFConnection.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Added: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFDriver.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFDriver.java?rev=1631808&view=auto
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFDriver.java (added)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFDriver.java [UTF-8] Tue Oct 14 16:12:44 2014
@@ -0,0 +1,89 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.shapefile.jdbc;
+
+import java.io.*;
+import java.sql.*;
+import java.util.*;
+import java.util.logging.*;
+
+/**
+ * Database driver for DBF 3.
+ *
+ * @author  Marc Le Bihan
+ * @version 0.5
+ * @since   0.5
+ * @module
+ */
+public class DBFDriver extends AbstractJDBC implements Driver {
+    /**
+     * @see java.sql.Driver#connect(java.lang.String, java.util.Properties)
+     */
+    @Override
+    public Connection connect(String url, @SuppressWarnings("unused") Properties info) throws SQLException {
+        return new DBFConnection(new File(url));
+    }
+
+    /**
+     * @see java.sql.Driver#acceptsURL(java.lang.String)
+     */
+    @Override
+    public boolean acceptsURL(@SuppressWarnings("unused") String url) {
+        return true;
+    }
+
+    /**
+     * @see java.sql.Driver#getPropertyInfo(java.lang.String, java.util.Properties)
+     */
+    @Override
+    public DriverPropertyInfo[] getPropertyInfo(@SuppressWarnings("unused") String url, @SuppressWarnings("unused") Properties info) {
+        return new DriverPropertyInfo[]{};
+    }
+
+    /**
+     * @see java.sql.Driver#getMajorVersion()
+     */
+    @Override
+    public int getMajorVersion() {
+        return 0;
+    }
+
+    /**
+     * @see java.sql.Driver#getMinorVersion()
+     */
+    @Override
+    public int getMinorVersion() {
+        return 1;
+    }
+
+    /**
+     * 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()
+     */
+    @Override
+    public boolean jdbcCompliant() {
+        return false; // No, and for some time...
+    }
+
+    /**
+     * @see java.sql.Driver#getParentLogger()
+     */
+    @Override
+    public Logger getParentLogger() {
+        return getLogger();
+    }
+}

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFDriver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFDriver.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Added: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFResultSet.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFResultSet.java?rev=1631808&view=auto
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFResultSet.java (added)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFResultSet.java [UTF-8] Tue Oct 14 16:12:44 2014
@@ -0,0 +1,405 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+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 org.apache.sis.storage.shapefile.*;
+
+/**
+ * DBF ResultSet.
+ *
+ * @author  Marc Le Bihan
+ * @version 0.5
+ * @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;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getByte(int)
+     */
+    @Override
+    public byte getByte(int columnIndex) throws SQLException {
+        assertNotClosed();
+        return 0;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getShort(int)
+     */
+    @Override
+    public short getShort(int columnIndex) throws SQLException {
+        assertNotClosed();
+        return 0;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getInt(int)
+     */
+    @Override
+    public int getInt(int columnIndex) throws SQLException {
+        assertNotClosed();
+        return 0;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getLong(int)
+     */
+    @Override
+    public long getLong(int columnIndex) throws SQLException {
+        assertNotClosed();
+        return 0;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getFloat(int)
+     */
+    @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;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getBigDecimal(int, int)
+     */
+    @Override
+    public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException {
+        assertNotClosed();
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getBytes(int)
+     */
+    @Override
+    public byte[] getBytes(int columnIndex) throws SQLException {
+        assertNotClosed();
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getDate(int)
+     */
+    @Override
+    public Date getDate(int columnIndex) throws SQLException {
+        assertNotClosed();
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getTime(int)
+     */
+    @Override
+    public Time getTime(int columnIndex) throws SQLException {
+        assertNotClosed();
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getTimestamp(int)
+     */
+    @Override
+    public Timestamp getTimestamp(int columnIndex) throws SQLException {
+        assertNotClosed();
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getString(java.lang.String)
+     */
+    @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;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getBigDecimal(java.lang.String)
+     */
+    @Override
+    public BigDecimal getBigDecimal(String columnLabel) throws SQLException {
+        assertNotClosed();
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getStatement()
+     */
+    @Override
+    public Statement getStatement() throws SQLException {
+        assertNotClosed();
+        return m_parentStatement;
+    }
+
+    /**
+     * 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"));
+    }
+
+    /**
+     * 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();
+    }
+}

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFResultSet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFResultSet.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Added: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFStatement.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFStatement.java?rev=1631808&view=auto
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFStatement.java (added)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFStatement.java [UTF-8] Tue Oct 14 16:12:44 2014
@@ -0,0 +1,116 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.shapefile.jdbc;
+
+import static java.util.logging.Level.*;
+
+import java.sql.*;
+import java.util.*;
+
+/**
+ * DBF Statement.
+ *
+ * @author  Marc Le Bihan
+ * @version 0.5
+ * @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;
+
+    /**
+     * Create a statement.
+     * @param connection Connection associated to this statement.
+     */
+    DBFStatement(DBFConnection connection) {
+        Objects.requireNonNull(connection, "The parent Connection of the ResulSet cannot be null.");
+
+        m_parentConnection = connection;
+        m_closed = false;
+    }
+
+    /**
+     * @see java.sql.Statement#executeQuery(java.lang.String)
+     */
+    @Override
+    public ResultSet executeQuery(String sql) throws SQLException {
+        Objects.requireNonNull(sql, "The SQL query for executeQuery cannot be null.");
+
+        assertNotClosed();
+        return new DBFResultSet(this);
+    }
+
+    /**
+     * @see java.sql.Statement#close()
+     */
+    @Override
+    public void close() {
+        m_closed = true;
+    }
+
+    /**
+     * @see java.sql.Statement#execute(java.lang.String)
+     */
+    @Override
+    public boolean execute(String sql) throws SQLException {
+        Objects.requireNonNull(sql, "The SQL query for execute cannot be null.");
+        return false;
+    }
+
+    /**
+     * @see java.sql.Statement#getResultSet()
+     */
+    @Override
+    public ResultSet getResultSet() throws SQLException {
+        assertNotClosed();
+        return new DBFResultSet(this);
+    }
+
+
+    /**
+     * @see java.sql.Statement#getConnection()
+     */
+    @Override
+    public Connection getConnection() throws SQLException {
+        if (m_parentConnection.isClosed())
+            throw new SQLException(this.format(SEVERE, "excp.closed_connection"));
+        else
+            return m_parentConnection;
+    }
+
+    /**
+     * @see java.sql.Statement#isClosed()
+     */
+    @Override
+    public boolean isClosed() {
+        assert(m_parentConnection != null);
+        return m_parentConnection.isClosed() || m_closed;
+    }
+
+    /**
+     * 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"));
+    }
+}

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFStatement.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFStatement.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Added: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/InvalidDbaseFileFormatException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/InvalidDbaseFileFormatException.java?rev=1631808&view=auto
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/InvalidDbaseFileFormatException.java (added)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/InvalidDbaseFileFormatException.java [UTF-8] Tue Oct 14 16:12:44 2014
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.shapefile.jdbc;
+
+import java.sql.SQLNonTransientException;
+
+
+/**
+ * Thrown when the DBF file format seems to be invalid.
+ *
+ * @author  Marc Le Bihan
+ * @version 0.5
+ * @since   0.5
+ * @module
+ */
+public class InvalidDbaseFileFormatException extends SQLNonTransientException {
+    /** Serial UID. */
+    private static final long serialVersionUID = 3924612615300490837L;
+
+    /**
+     * Construct an exception.
+     * @param message Message of the exception.
+     */
+    public InvalidDbaseFileFormatException(String message) {
+        super(message);
+    }
+
+    /**
+     * Construct an exception.
+     * @param message Message of the exception.
+     * @param cause Root cause of the exception.
+     */
+    public InvalidDbaseFileFormatException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/InvalidDbaseFileFormatException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/InvalidDbaseFileFormatException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Added: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/package-info.java?rev=1631808&view=auto
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/package-info.java (added)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/package-info.java [UTF-8] Tue Oct 14 16:12:44 2014
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Allows access to {@link org.apache.sis.storage.shapefile} storage through JDBC driver.
+ *
+ * @author  Marc Le Bihan
+ * @version 0.5
+ * @since   0.5
+ * @module
+ */
+package org.apache.sis.internal.shapefile.jdbc;

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/package-info.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Added: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC.properties?rev=1631808&view=auto
==============================================================================
    (empty)

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=ISO-8859-1

Added: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC_en.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC_en.properties?rev=1631808&view=auto
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC_en.properties (added)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC_en.properties [ISO-8859-1] Tue Oct 14 16:12:44 2014
@@ -0,0 +1,4 @@
+# Exception : our JDBC driver doesn't support this feature yet.
+#0 : Simple class name.
+#1 : Method name (or goal / feature asked for).
+excp.unsupported_driver_feature=Internal JDBC driver currently doesn''t support the {0}.{1} ability/calls.

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC_en.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC_en.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=ISO-8859-1

Added: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC_fr.properties?rev=1631808&view=auto
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC_fr.properties (added)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC_fr.properties [ISO-8859-1] Tue Oct 14 16:12:44 2014
@@ -0,0 +1,4 @@
+# Exception : our JDBC driver doesn't support this feature yet.
+#0 : Simple class name.
+#1 : Method name (or goal / feature asked for).
+excp.unsupported_driver_feature=Le driver JDBC interne n''a pas actuellement la capacité de, ou ne soutient pas les appels à {0}.{1}.
\ No newline at end of file

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC_fr.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC_fr.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=ISO-8859-1

Added: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFConnection.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFConnection.properties?rev=1631808&view=auto
==============================================================================
    (empty)

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFConnection.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFConnection.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=ISO-8859-1

Added: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFConnection_en.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFConnection_en.properties?rev=1631808&view=auto
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFConnection_en.properties (added)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFConnection_en.properties [ISO-8859-1] Tue Oct 14 16:12:44 2014
@@ -0,0 +1,19 @@
+# Exception : a directory has been given instead of a file.
+#0 : Directory name.
+excp.directory_not_expected=Your file ''{0}'' points to a directory instead of a file. 
+
+# Exception : the file has not been found.
+#0 : File that has not been found.
+excp.file_not_found=The DBF file ''{0}'' has not been found.
+
+# Exception : the dbf file seems to have an invalid format (descriptor unreadable).
+#0 : File that causes trouble.
+#1 : Message coming with the root cause. 
+excp.invalid_dbf_format_descriptor=The DBF file ''{0}'' seems having an invalid format, its descriptor could not be read : {1}
+
+# Warning : autocommit isn't implemented.
+#0 : true / false.
+log.autocommit_ignored=The autocommit {0} is currently ignored (not implemented) : autocommit is always true.
+
+# Warning : commit and rollback are not implemented : autocommit is always true.
+log.commit_rollback_ignored=Commit and rollback has no effect (currently not implemented) : autocommit is always true.

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFConnection_en.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFConnection_en.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=ISO-8859-1

Added: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFConnection_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFConnection_fr.properties?rev=1631808&view=auto
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFConnection_fr.properties (added)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFConnection_fr.properties [ISO-8859-1] Tue Oct 14 16:12:44 2014
@@ -0,0 +1,19 @@
+# Exception : a directory has been given instead of a file.
+#0 : Directory name.
+excp.directory_not_expected=Votre fichier ''{0}'' désigne un répertoire et non un fichier. 
+
+# Exception : the file has not been found.
+#0 : File that has not been found.
+excp.file_not_found=Le fichier DBF ''{0}'' n''a pas été trouvé.
+
+# Exception : the dbf file seems to have an invalid format (descriptor unreadable).
+#0 : File that causes trouble.
+#1 : Message coming with the root cause. 
+excp.invalid_dbf_format_descriptor=Le fichier DBF ''{0}'' semble avoir un format invalide, son descripteur n''a pas pu être lu : {1}
+
+# Warning : autocommit isn't implemented.
+#0 : true / false.
+log.autocommit_ignored=L''autocommit {0} est actuellement ignoré (non implémenté) : L''autocommit vaut toujours true.
+
+# Warning : commit and rollback are not implemented : autocommit is always true.
+log.commit_rollback_ignored=Les commit et rollback n'ont pas d''effet (ils ne sont pas actuellement implémentés) : l''autocommit vaut toujours true.

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFConnection_fr.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFConnection_fr.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=ISO-8859-1

Added: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFResultSet.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFResultSet.properties?rev=1631808&view=auto
==============================================================================
    (empty)

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFResultSet.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFResultSet.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=ISO-8859-1

Added: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFResultSet_en.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFResultSet_en.properties?rev=1631808&view=auto
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFResultSet_en.properties (added)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFResultSet_en.properties [ISO-8859-1] Tue Oct 14 16:12:44 2014
@@ -0,0 +1,8 @@
+# Exception : attempting to get a connection from a closed connection.
+excp.closed_connection=The connection is closed.
+
+# Exception : attempting to get a connection from a closed connection, statement or ResultSet.
+excp.closed_connection_or_statement_or_resultset=The connection, statement or ResultSet is closed.
+
+# Exception : the result set has no more results.
+excp.no_more_results=The ResultSet has no more results.
\ No newline at end of file

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFResultSet_en.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFResultSet_en.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=ISO-8859-1

Added: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFResultSet_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFResultSet_fr.properties?rev=1631808&view=auto
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFResultSet_fr.properties (added)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFResultSet_fr.properties [ISO-8859-1] Tue Oct 14 16:12:44 2014
@@ -0,0 +1,8 @@
+# Exception : attempting to get a connection from a closed connection.
+excp.closed_connection=La connexion est fermée.
+
+# Exception : attempting to get a connection from a closed connection, statement or ResultSet.
+excp.closed_connection_or_statement_or_resultset=La connexion, le statement ou le ResultSet sont fermés.
+
+# Exception : the result set has no more results.
+excp.no_more_results=The ResultSet n''a plus de résultats.

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFResultSet_fr.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFResultSet_fr.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=ISO-8859-1

Added: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFStatement.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFStatement.properties?rev=1631808&view=auto
==============================================================================
    (empty)

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFStatement.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFStatement.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=ISO-8859-1

Added: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFStatement_en.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFStatement_en.properties?rev=1631808&view=auto
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFStatement_en.properties (added)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFStatement_en.properties [ISO-8859-1] Tue Oct 14 16:12:44 2014
@@ -0,0 +1,5 @@
+# Exception : attempting to get a connection from a closed connection.
+excp.closed_connection=The connection is closed.
+
+# Exception : attempting to get a connection from a closed connection or statement.
+excp.closed_connection_or_statement=The connection or statement is closed.

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFStatement_en.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFStatement_en.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=ISO-8859-1

Added: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFStatement_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFStatement_fr.properties?rev=1631808&view=auto
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFStatement_fr.properties (added)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFStatement_fr.properties [ISO-8859-1] Tue Oct 14 16:12:44 2014
@@ -0,0 +1,5 @@
+# Exception : attempting to get a connection from a closed connection.
+excp.closed_connection=La connexion est fermée.
+
+# Exception : attempting to get a connection from a closed connection or statement.
+excp.closed_connection_or_statement=La connexion ou le statement sont fermés.

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFStatement_fr.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/DBFStatement_fr.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=ISO-8859-1

Added: sis/branches/JDK8/storage/sis-shapefile/src/test/java/org/apache/sis/internal/shapefile/jdbc/ConnectionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/test/java/org/apache/sis/internal/shapefile/jdbc/ConnectionTest.java?rev=1631808&view=auto
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/test/java/org/apache/sis/internal/shapefile/jdbc/ConnectionTest.java (added)
+++ sis/branches/JDK8/storage/sis-shapefile/src/test/java/org/apache/sis/internal/shapefile/jdbc/ConnectionTest.java [UTF-8] Tue Oct 14 16:12:44 2014
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.shapefile.jdbc;
+
+import static org.junit.Assert.*;
+
+import java.io.*;
+import java.sql.*;
+import java.text.*;
+
+import org.apache.sis.test.*;
+import org.junit.*;
+
+/**
+ * Connection tests.
+ *
+ * @author  Marc Le Bihan
+ * @version 0.5
+ * @since   0.5
+ * @module
+ */
+public class ConnectionTest extends TestCase {
+	/** Database file. */
+	private File dbfFile;
+
+	/**
+	 * Open and close a connection.
+	 * @throws SQLException if an SQL Exception occurs.
+	 */
+	@Test public void openCloseConnection() throws SQLException {
+		Driver driver = new DBFDriver();
+
+		Connection connection = driver.connect(dbfFile.getAbsolutePath(), null);
+		assertFalse("Connection should be opened", connection.isClosed());
+		assertTrue("Connection should be valid", connection.isValid(0));
+
+		connection.close();
+		assertTrue("Connection should be closed", connection.isClosed());
+		assertFalse("Connection should no more be valid", connection.isValid(0));
+	}
+
+	/**
+	 * Test setup.
+	 */
+	@Before public void setup() {
+		dbfFile = new File("src/test/resources/org/apache/sis/storage/shapefile/SignedBikeRoute_4326_clipped.dbf");
+		assertTrue(MessageFormat.format("The database file ''{0}'' used for testing doesn''t exist." , dbfFile.getAbsolutePath()), dbfFile.exists());
+	}
+}

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/test/java/org/apache/sis/internal/shapefile/jdbc/ConnectionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/test/java/org/apache/sis/internal/shapefile/jdbc/ConnectionTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Added: sis/branches/JDK8/storage/sis-shapefile/src/test/java/org/apache/sis/internal/shapefile/jdbc/ResultSetTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/test/java/org/apache/sis/internal/shapefile/jdbc/ResultSetTest.java?rev=1631808&view=auto
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/test/java/org/apache/sis/internal/shapefile/jdbc/ResultSetTest.java (added)
+++ sis/branches/JDK8/storage/sis-shapefile/src/test/java/org/apache/sis/internal/shapefile/jdbc/ResultSetTest.java [UTF-8] Tue Oct 14 16:12:44 2014
@@ -0,0 +1,90 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.shapefile.jdbc;
+
+import static org.junit.Assert.*;
+
+import java.io.*;
+import java.sql.*;
+import java.text.*;
+
+import org.junit.*;
+import org.opengis.test.*;
+
+/**
+ * ResultSet test.
+ *
+ * @author  Marc Le Bihan
+ * @version 0.5
+ * @since   0.5
+ * @module
+ */
+public class ResultSetTest extends TestCase {
+	/** Database file. */
+	private File dbfFile;
+
+	/**
+	 * Read the first record.
+	 * @throws SQLException if an SQL error occurs.
+	 */
+	@Test public void readFirstRecord() throws SQLException {
+		Driver driver = new DBFDriver();
+
+		Connection connection = driver.connect(dbfFile.getAbsolutePath(), null);
+		Statement stmt = connection.createStatement();
+		ResultSet rs = stmt.executeQuery("Dummy"); // We don't care currently of the request : we are returning everything each time.
+
+		rs.next();
+		assertEquals("The record has not the expected field value.", "336TH ST", rs.getString("ST_NAME"));
+
+		rs.close();
+		stmt.close();
+		connection.close();
+	}
+
+	/**
+	 * Read all the DBF records.
+	 * @throws SQLException if an SQL error occurs.
+	 */
+	@Test public void readAllRecords() throws SQLException {
+		Driver driver = new DBFDriver();
+
+		Connection connection = driver.connect(dbfFile.getAbsolutePath(), null);
+		Statement stmt = connection.createStatement();
+		ResultSet rs = stmt.executeQuery("Dummy"); // We don't care currently of the request : we are returning everything each time.
+
+		int count = 0;
+
+		while(rs.next())
+			count ++;
+
+		assertTrue("Less than one record was readed.", count > 1);
+
+		rs.close();
+		stmt.close();
+		connection.close();
+	}
+
+	/**
+	 * Test setup.
+	 */
+	@Before public void setup() {
+		dbfFile = new File("src/test/resources/org/apache/sis/storage/shapefile/SignedBikeRoute_4326_clipped.dbf");
+		assertTrue(MessageFormat.format("The database file ''{0}'' used for testing doesn''t exist." , dbfFile.getAbsolutePath()), dbfFile.exists());
+	}
+
+}

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/test/java/org/apache/sis/internal/shapefile/jdbc/ResultSetTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/test/java/org/apache/sis/internal/shapefile/jdbc/ResultSetTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK8/storage/sis-shapefile/src/test/java/org/apache/sis/test/suite/ShapefileTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/test/java/org/apache/sis/test/suite/ShapefileTestSuite.java?rev=1631808&r1=1631807&r2=1631808&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/test/java/org/apache/sis/test/suite/ShapefileTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-shapefile/src/test/java/org/apache/sis/test/suite/ShapefileTestSuite.java [UTF-8] Tue Oct 14 16:12:44 2014
@@ -26,6 +26,8 @@ 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
 })
 public final strictfp class ShapefileTestSuite extends TestSuite {
     /**



Mime
View raw message