001/*
002 * The contents of this file are subject to the license and copyright
003 * detailed in the LICENSE and NOTICE files at the root of the source
004 * tree.
005 */
006package org.fcrepo.kernel.api.services;
007
008import org.fcrepo.kernel.api.Transaction;
009import org.fcrepo.kernel.api.identifiers.FedoraId;
010
011import java.time.format.DateTimeFormatter;
012
013import static java.time.ZoneOffset.UTC;
014import static java.time.format.DateTimeFormatter.RFC_1123_DATE_TIME;
015
016/**
017 * Service for creating versions of resources
018 *
019 * @author bbpennel
020 * @author whikloj
021 * @since Feb 19, 2014
022 */
023public interface VersionService {
024
025    /**
026     * To format a datetime for use as a Memento path.
027     */
028    DateTimeFormatter MEMENTO_LABEL_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMddHHmmss")
029            .withZone(UTC);
030
031    /**
032     * To format a datetime as RFC-1123 with correct timezone.
033     */
034    DateTimeFormatter MEMENTO_RFC_1123_FORMATTER = RFC_1123_DATE_TIME.withZone(UTC);
035
036    /**
037     * Explicitly creates a version for the resource at the path provided.
038     *
039     * @param transaction the transaction in which the resource resides
040     * @param fedoraId the internal resource id
041     * @param userPrincipal the user principal
042     */
043    void createVersion(Transaction transaction, FedoraId fedoraId, String userPrincipal);
044
045}