Package org.apache.slide.common

Examples of org.apache.slide.common.ServiceAccessException


        try {
            selectStatement = conn.prepareStatement(selectQuery);
            res = selectStatement.executeQuery();
            if (!res.next()) {
                throw new ServiceAccessException(service, "Could not increment sequence " + sequenceName);
            }
            long value = res.getLong(1);
            return value;
        } catch (SQLException e) {
            throw new ServiceAccessException(service, e);
        } finally {
            close(selectStatement, res);
        }
    }
View Full Code Here


    protected ServiceAccessException createException(SQLException e, String uri) {

        switch (e.getErrorCode()) {
            case 1205 : // thread was deadlock victim
                getLogger().log(e.getErrorCode() + ": Deadlock resolved on " + uri, LOG_CHANNEL, Logger.WARNING);
                return new ServiceAccessException(service, new ConflictException(uri));

            case 547 : // referential integraty constaint was violated (like in storeObject on table URI )
            case 2627 : // primary key constraint violation (like in storeContent on table VERSION_CONTENT)
                getLogger().log(e.getErrorCode() + ": Low isolation conflict for " + uri, LOG_CHANNEL, Logger.WARNING);
                return new ServiceAccessException(service, new ConflictException(uri));

            default :
                getLogger().log(
                    "SQL error " + e.getErrorCode() + " on " + uri + ": " + e.getMessage(),
                    LOG_CHANNEL,
                    Logger.ERROR);

                return new ServiceAccessException(service, e);
        }

    }
View Full Code Here

        try {
            statement = conn.prepareStatement(query);
            statement.executeUpdate();
            return true;
        } catch (SQLException e) {
            throw new ServiceAccessException(service, e);
        } finally {
            close(statement);
        }

    }
View Full Code Here

            statement.executeUpdate();

            selectStatement = conn.prepareStatement(selectQuery);
            res = selectStatement.executeQuery();
            if (!res.next()) {
                throw new ServiceAccessException(service, "Could not increment sequence " + sequenceName);
            }
            long value = res.getLong(1);
            return value;
        } catch (SQLException e) {
            throw new ServiceAccessException(service, e);
        } finally {
            close(statement);
            close(selectStatement, res);
        }
    }
View Full Code Here

        try {
            selectStatement = conn.prepareStatement(selectQuery);
            res = selectStatement.executeQuery();
            return res.next();
        } catch (SQLException e) {
            throw new ServiceAccessException(service, e);
        } finally {
            close(selectStatement, res);
        }
    }
View Full Code Here

    /**
     * @see org.apache.slide.store.SequenceStore#createSequence(java.lang.String)
     */
    public boolean createSequence(String sequenceName) throws ServiceAccessException {
        if (!isSequenceSupported()) {
            throw new ServiceAccessException(this, "Sequences not supported");
        }
        Connection connection = null;
        try {
            connection = getNewConnection();
            return ((SequenceAdapter) adapter).createSequence(connection, sequenceName);
        } catch (SQLException e) {
            throw new ServiceAccessException(this, e);
        } finally {
            if (connection != null) {
                try {
                    if (!tmCommits) {
                        connection.commit();
                    }
                } catch (SQLException e) {
                    throw new ServiceAccessException(this, e);
                } finally {
                    try {
                        connection.close();
                    } catch (SQLException e) {
                        getLogger().log(e, LOG_CHANNEL, Logger.WARNING);
View Full Code Here

    /**
     * @see org.apache.slide.store.SequenceStore#nextSequenceValue(java.lang.String)
     */
    public long nextSequenceValue(String sequenceName) throws ServiceAccessException {
        if (!isSequenceSupported()) {
            throw new ServiceAccessException(this, "Sequences not supported");
        }
        Connection connection = null;
        try {
            connection = getNewConnection();
            return ((SequenceAdapter) adapter).nextSequenceValue(connection, sequenceName);
        } catch (SQLException e) {
            throw new ServiceAccessException(this, e);
        } finally {
            if (connection != null) {
                try {
                    if (!tmCommits) {
                        connection.commit();
                    }
                } catch (SQLException e) {
                    throw new ServiceAccessException(this, e);
                } finally {
                    try {
                        connection.close();
                    } catch (SQLException e) {
                        getLogger().log(e, LOG_CHANNEL, Logger.WARNING);
View Full Code Here

    /**
     * @see org.apache.slide.store.SequenceStore#sequenceExists(java.lang.String)
     */
    public boolean sequenceExists(String sequenceName) throws ServiceAccessException {
        if (!isSequenceSupported()) {
            throw new ServiceAccessException(this, "Sequences not supported");
        }
        Connection connection = null;
        try {
            connection = getNewConnection();
            return ((SequenceAdapter) adapter).sequenceExists(connection, sequenceName);
        } catch (SQLException e) {
            throw new ServiceAccessException(this, e);
        } finally {
            if (connection != null) {
                try {
                    if (!tmCommits) {
                        connection.commit();
                    }
                } catch (SQLException e) {
                    throw new ServiceAccessException(this, e);
                } finally {
                    try {
                        connection.close();
                    } catch (SQLException e) {
                        getLogger().log(e, LOG_CHANNEL, Logger.WARNING);
View Full Code Here

            Connection connection = null;
            try {
                connection = getNewConnection();
                return adapter.retrieveObject(connection, uri);
            } catch (SQLException e) {
                throw new ServiceAccessException(this, e);
            } finally {
                if (connection != null) {
                    try {
                        if (!tmCommits) {
                            connection.commit();
                        }
                    } catch (SQLException e) {
                        throw new ServiceAccessException(this, e);
                    } finally {
                        try {
                            connection.close();
                        } catch (SQLException e) {
                            getLogger().log(e, LOG_CHANNEL, Logger.WARNING);
View Full Code Here

            Connection connection = null;
            try {
                connection = getNewConnection();
                return adapter.enumeratePermissions(connection, uri);
            } catch (SQLException e) {
                throw new ServiceAccessException(this, e);
            } finally {
                if (connection != null) {
                    try {
                        if (!tmCommits) {
                            connection.commit();
                        }
                    } catch (SQLException e) {
                        throw new ServiceAccessException(this, e);
                    } finally {
                        try {
                            connection.close();
                        } catch (SQLException e) {
                            getLogger().log(e, LOG_CHANNEL, Logger.WARNING);
View Full Code Here

TOP

Related Classes of org.apache.slide.common.ServiceAccessException

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.