001/**
002 * Copyright 2015 DuraSpace, Inc.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.fcrepo.kernel.services;
017
018import javax.jcr.RepositoryException;
019import javax.jcr.Session;
020
021/**
022 * @author bbpennel
023 * @since Feb 19, 2014
024 */
025public interface VersionService {
026
027    /**
028     * Explicitly creates a version for the nodes at each path provided.
029     *
030     * @param session the session in which the node resides
031     * @param absPath absolute paths to the node
032     * @param label a label to be applied to the new version
033     * @throws RepositoryException if repository exception occurred
034     * @return the identifier
035     */
036    String createVersion(Session session, String absPath, String label) throws RepositoryException;
037
038    /**
039     * Reverts the node to the version identified by the label.  This method
040     * will throw a PathNotFoundException if no version with the given label is
041     * found.
042     *
043     * @param session the session in which the node resides
044     * @param absPath the path to the node whose version is to be reverted
045     * @param label identifies the historic version
046     * @throws RepositoryException if repository exception occurred
047     */
048    void revertToVersion(Session session, String absPath, String label)
049        throws RepositoryException;
050
051    /**
052     * Remove a version of a node.  This method will throw a PathNotFoundException
053     * if no version with the given label is found.
054     *
055     * @param session the session in which the node resides
056     * @param absPath the path to the node whose version is to be removed
057     * @param label identifies the historic version by label or id
058     * @throws RepositoryException if repository exception occurred
059     */
060    void removeVersion(Session session, String absPath, String label)
061        throws RepositoryException;
062
063}