Examples of KiWiVersioningConnection


Examples of org.apache.marmotta.kiwi.versioning.persistence.KiWiVersioningConnection

     * @return the latest version of the resource at the given date, or null if such a version does not exist
     * @throws SQLException
     */
    public Version getLatestVersion(Resource r, Date date) throws SailException {
        try {
            final KiWiVersioningConnection connection = persistence.getConnection();

            KiWiResource kr = (KiWiResource) ((r instanceof URI) ? getValueFactory().createURI(r.stringValue()) : getValueFactory().createBNode(r.stringValue()));

            try {
                return connection.getLatestVersion(kr,date);
            } finally {
                connection.commit();
                connection.close();
            }

        } catch(SQLException ex) {
            throw new SailException("database error while listing versions",ex);
        }
View Full Code Here

Examples of org.apache.marmotta.kiwi.versioning.persistence.KiWiVersioningConnection

     * @return
     */
    @Override
    public RepositoryResult<Version> listVersions(Resource rthrows SailException {
        try {
            final KiWiVersioningConnection connection = persistence.getConnection();

            KiWiResource kr = (KiWiResource) ((r instanceof URI) ? getValueFactory().createURI(r.stringValue()) : getValueFactory().createBNode(r.stringValue()));

            return new RepositoryResult<Version>(connection.listVersions(kr)) {
                @Override
                protected void handleClose() throws RepositoryException {
                    super.handleClose();

                    try {
                        connection.commit();
                        connection.close();
                    } catch (SQLException ex) {
                        throw new RepositoryException("database error while committing/closing connection");
                    }
                }
            };
View Full Code Here

Examples of org.apache.marmotta.kiwi.versioning.persistence.KiWiVersioningConnection

     * @return
     */
    @Override
    public RepositoryResult<Version> listVersions(Resource r, Date from, Date to) throws SailException {
        try {
            final KiWiVersioningConnection connection = persistence.getConnection();

            KiWiResource kr = (KiWiResource) ((r instanceof URI) ? getValueFactory().createURI(r.stringValue()) : getValueFactory().createBNode(r.stringValue()));

            return new RepositoryResult<Version>(connection.listVersions(kr,from,to)) {
                @Override
                protected void handleClose() throws RepositoryException {
                    super.handleClose();

                    try {
                        connection.commit();
                        connection.close();
                    } catch (SQLException ex) {
                        throw new RepositoryException("database error while committing/closing connection");
                    }
                }
            };
View Full Code Here

Examples of org.apache.marmotta.kiwi.versioning.persistence.KiWiVersioningConnection

            }

            if(version.getAddedTriples().size() > 0 || version.getRemovedTriples().size() > 0) {

                try {
                    final KiWiVersioningConnection connection = persistence.getConnection();
                    try {
                        connection.storeVersion(version);
                        connection.commit();
                    } catch (SQLException ex) {
                        log.warn("could not store versioning information (error: {}); rolling back...", ex.getMessage());
                        connection.rollback();
                    } finally {
                        connection.close();
                    }
                } catch(SQLException ex) {
                    log.warn("could not store versioning information (error: {})", ex.getMessage());
                }
            }
View Full Code Here

Examples of org.apache.marmotta.kiwi.versioning.persistence.KiWiVersioningConnection

     * @return
     */
    @Override
    public RepositoryResult<Version> listVersions()  throws SailException {
        try {
            final KiWiVersioningConnection connection = persistence.getConnection();
            return new RepositoryResult<Version>(connection.listVersions()) {
                @Override
                protected void handleClose() throws RepositoryException {
                    super.handleClose();

                    try {
                        connection.commit();
                        connection.close();
                    } catch (SQLException ex) {
                        throw new RepositoryException("database error while committing/closing connection");
                    }
                }
            };
View Full Code Here

Examples of org.apache.marmotta.kiwi.versioning.persistence.KiWiVersioningConnection

     * @return
     */
    @Override
    public RepositoryResult<Version> listVersions(Date from, Date to) throws SailException {
        try {
            final KiWiVersioningConnection connection = persistence.getConnection();
            return new RepositoryResult<Version>(connection.listVersions(from,to)) {
                @Override
                protected void handleClose() throws RepositoryException {
                    super.handleClose();

                    try {
                        connection.commit();
                        connection.close();
                    } catch (SQLException ex) {
                        throw new RepositoryException("database error while committing/closing connection");
                    }
                }
            };
View Full Code Here

Examples of org.apache.marmotta.kiwi.versioning.persistence.KiWiVersioningConnection



    public Version getVersion(Long id) throws SailException {
        try {
            final KiWiVersioningConnection connection = persistence.getConnection();
            try {
                return connection.getVersion(id);
            } finally {
                connection.commit();
                connection.close();
            }

        } catch(SQLException ex) {
            throw new SailException("database error while listing versions",ex);
        }
View Full Code Here

Examples of org.apache.marmotta.kiwi.versioning.persistence.KiWiVersioningConnection

     * @param id  the database ID of the version (see {@link Version#getId()})
     * @throws SailException
     */
    public void removeVersion(Long id) throws SailException {
        try {
            final KiWiVersioningConnection connection = persistence.getConnection();
            try {
                connection.removeVersion(id);
                connection.commit();
            } finally {
                connection.close();
            }

        } catch(SQLException ex) {
            throw new SailException("database error while listing versions",ex);
        }
View Full Code Here

Examples of org.apache.marmotta.kiwi.versioning.persistence.KiWiVersioningConnection

     * @param until date until when to delete versions
     * @throws SailException
     */
    public void removeVersions(Date until) throws SailException {
        try {
            final KiWiVersioningConnection connection = persistence.getConnection();
            try {
                connection.removeVersions(until);
                connection.commit();
            } finally {
                connection.close();
            }

        } catch(SQLException ex) {
            throw new SailException("database error while listing versions",ex);
        }
View Full Code Here

Examples of org.apache.marmotta.kiwi.versioning.persistence.KiWiVersioningConnection

     * @param to   date before which versions will be deleted
     * @throws SailException
     */
    public void removeVersions(Date from, Date to) throws SailException {
        try {
            final KiWiVersioningConnection connection = persistence.getConnection();
            try {
                connection.removeVersions(from, to);
                connection.commit();
            } finally {
                connection.close();
            }

        } catch(SQLException ex) {
            throw new SailException("database error while listing versions",ex);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.