Package org.fcrepo.server.errors

Examples of org.fcrepo.server.errors.StorageDeviceException


            if (obj.hasContentModel(Models.SERVICE_DEPLOYMENT_3_0)){
                updateDeploymentMap(obj, conn);
            }
        } catch (SQLException sqle) {
            throw new StorageDeviceException("Unexpected error from SQL database while registering object: "
                    + sqle.getMessage(), sqle);
        } finally {
            try {
                if (s1 != null) {
                    s1.close();
                }
            } catch (Exception sqle) {
                throw new StorageDeviceException("Unexpected error from SQL database while registering object: "
                        + sqle.getMessage(), sqle);
            } finally {
                s1 = null;
            }
        }

        PreparedStatement s2 = null;
        ResultSet results = null;
        try {
            // REGISTRY:
            // update systemVersion in doRegistry (add one)
            logger.debug("COMMIT: Updating registry...");
            String query =
                    "SELECT systemVersion FROM doRegistry WHERE doPID=?";
            s2 = conn.prepareStatement(query);
            s2.setString(1, pid);
            results = s2.executeQuery();
            if (!results.next()) {
                throw new ObjectNotFoundException("Error creating replication job: The requested object doesn't exist in the registry.");
            }
            int systemVersion = results.getInt("systemVersion");
            systemVersion++;
            query = "UPDATE doRegistry SET systemVersion=? WHERE doPID=?";
            s2 = conn.prepareStatement(query);
            s2.setInt(1, systemVersion);
            s2.setString(2,pid);
            s2.executeUpdate();
        } catch (SQLException sqle) {
            throw new StorageDeviceException("Error creating replication job: "
                    + sqle.getMessage());
        } catch (ObjectNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } finally {
            try {
                if (results != null) {
                    results.close();
                }
                if (s2 != null) {
                    s2.close();
                }
                if (conn != null) {
                    m_connectionPool.free(conn);
                }
            } catch (SQLException sqle) {
                throw new StorageDeviceException("Unexpected error from SQL database: "
                        + sqle.getMessage());
            } finally {
                results = null;
                s2 = null;
            }
View Full Code Here


                                       dbRowValues,
                                       "pid",
                                       s_dbColumnNumericNoDC);
            }
        } catch (SQLException sqle) {
            throw new StorageDeviceException("Error attempting FieldSearch "
                    + "update of " + pid, sqle);
        } finally {
            try {
                if (st != null) {
                    st.close();
                }
                if (conn != null) {
                    m_cPool.free(conn);
                }
            } catch (SQLException sqle2) {
                throw new StorageDeviceException("Error closing statement "
                        + "while attempting update of object"
                        + sqle2.getMessage());
            } finally {
                st = null;
                logger.debug("Exiting update(DOReader)");
View Full Code Here

            st = conn.prepareStatement("DELETE FROM dcDates WHERE pid=?");
            st.setString(1, pid);
            st.executeUpdate();
            return true;
        } catch (SQLException sqle) {
            throw new StorageDeviceException("Error attempting delete of "
                    + "object with pid '" + pid + "': " + sqle.getMessage());
        } finally {
            try {
                if (st != null) {
                    st.close();
                }
                if (conn != null) {
                    m_cPool.free(conn);
                }
            } catch (SQLException sqle2) {
                throw new StorageDeviceException("Error closing statement "
                        + "while attempting update of object"
                        + sqle2.getMessage());
            } finally {
                st = null;
                logger.debug("Exiting delete(String)");
View Full Code Here

                                                                resultFields,
                                                                actualMax,
                                                                m_maxSecondsPerSession,
                                                                query));
        } catch (SQLException sqle) {
            throw new StorageDeviceException("Error querying sql db: "
                    + sqle.getMessage(), sqle);
        }
    }
View Full Code Here

                    }
                    if (m_conn != null) {
                        m_cPool.free(m_conn);
                    }
                } catch (SQLException sqle2) {
                    throw new StorageDeviceException("Error closing statement "
                            + "or result set." + sqle2.getMessage());
                } finally {
                    m_resultSet = null;
                    m_statement = null;
                }
            }
        } catch (SQLException sqle) {
            try {
                if (m_resultSet != null) {
                    m_resultSet.close();
                }
                if (m_statement != null) {
                    m_statement.close();
                }
                if (m_conn != null) {
                    m_cPool.free(m_conn);
                }
                throw new StorageDeviceException("Error with sql database. "
                        + sqle.getMessage());
            } catch (SQLException sqle2) {
                throw new StorageDeviceException("Error closing statement "
                        + "or result set." + sqle.getMessage()
                        + sqle2.getMessage());
            } finally {
                m_resultSet = null;
                m_statement = null;
View Full Code Here

        m_exportFormat = exportFormat;
        m_storageFormat = storageFormat;
        m_encoding = encoding;
        File[] files = directory.listFiles();
        if (!directory.isDirectory()) {
            throw new StorageDeviceException("Repository storage directory not found.");
        }
        try {
            for (File thisFile : files) {
                try {
                    FileInputStream in = new FileInputStream(thisFile);
View Full Code Here

            int len;
            while ((len = in.read(buf)) != -1) {
                out.write(buf, 0, len);
            }
        } catch (IOException ioe) {
            throw new StorageDeviceException("Error writing to stream");
        } finally {
            try {
                out.close();
                in.close();
            } catch (IOException closeProb) {
View Full Code Here

                    //TODO hasModel
                    if (obj.hasContentModel(Models.SERVICE_DEPLOYMENT_3_0)) {
                        updateDeploymentMap(obj, conn, false);
                    }
                } catch (SQLException sqle) {
                    throw new StorageDeviceException(
                            "Error creating replication job for " + pid + ": " +
                                    sqle.getMessage(), sqle);
                } finally {
                    try {
                        if (results != null) {
                            results.close();
                        }
                        if (s != null) {
                            s.close();
                        }
                        if (conn != null) {
                            m_connectionPool.free(conn);
                        }
                    } catch (SQLException sqle) {
                        throw new StorageDeviceException(
                                "Unexpected error from SQL database for " +
                                        pid + ": " + sqle.getMessage(), sqle);
                    } finally {
                        results = null;
                        s = null;
View Full Code Here

        boolean exists = false;
        if (!registered && m_checkableStore) {
            try {
                exists = ((ICheckable)m_permanentStore).objectExists(pid);
            } catch (LowlevelStorageException e) {
                throw new StorageDeviceException(e.getMessage(), e);
            }
        }
        if (exists && !registered) {
            logger.warn("{} was not in the registry, but appears to be in store." +
                        " Registry db may be in inconsistent state.", pid);
View Full Code Here

            s = conn.prepareStatement(REGISTERED_PID_QUERY);
            s.setString(1, pid);
            results = s.executeQuery();
            return results.next(); // 'true' if match found, else 'false'
        } catch (SQLException sqle) {
            throw new StorageDeviceException(
                    "Unexpected error from SQL database: " + sqle.getMessage(),
                    sqle);
        } finally {
            try {
                if (results != null) {
                    results.close();
                }
                if (s != null) {
                    s.close();
                }
                if (conn != null) {
                    m_connectionPool.free(conn);
                }
            } catch (SQLException sqle) {
                throw new StorageDeviceException(
                        "Unexpected error from SQL database: " +
                                sqle.getMessage(), sqle);
            } finally {
                results = null;
                s = null;
View Full Code Here

TOP

Related Classes of org.fcrepo.server.errors.StorageDeviceException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.