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.api.services;
017
018import javax.jcr.Session;
019
020/**
021 * @author bbpennel
022 * @since Feb 19, 2014
023 */
024public interface VersionService {
025
026    /**
027     * Explicitly creates a version for the nodes at each path provided.
028     *
029     * @param session the session in which the node resides
030     * @param absPath absolute paths to the node
031     * @param label a label to be applied to the new version
032     * @return the identifier
033     */
034    String createVersion(Session session, String absPath, String label);
035
036    /**
037     * Reverts the node to the version identified by the label.  This method
038     * will throw a PathNotFoundException if no version with the given label is
039     * found.
040     *
041     * @param session the session in which the node resides
042     * @param absPath the path to the node whose version is to be reverted
043     * @param label identifies the historic version
044     */
045    void revertToVersion(Session session, String absPath, String label);
046
047    /**
048     * Remove a version of a node.  This method will throw a PathNotFoundException
049     * if no version with the given label is found.
050     *
051     * @param session the session in which the node resides
052     * @param absPath the path to the node whose version is to be removed
053     * @param label identifies the historic version by label or id
054     */
055    void removeVersion(Session session, String absPath, String label);
056
057}