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.persistence.ocfl.api; 007 008import org.fcrepo.kernel.api.operations.ResourceOperation; 009import org.fcrepo.persistence.api.exceptions.PersistentStorageException; 010import org.fcrepo.persistence.ocfl.impl.OcflPersistentStorageSession; 011 012/** 013 * @author dbernstein 014 * @since 6.0.0 015 */ 016public interface Persister { 017 018 /** 019 * The method returns true if the operation can be persisted by this persister. 020 * @param operation the operation to persist 021 * @return true or false 022 */ 023 boolean handle(ResourceOperation operation); 024 025 /** 026 * The persistence handling for the given operation. 027 * 028 * @param session The persistent storage session 029 * @param operation The operation and associated data need to perform the operation. 030 * @throws PersistentStorageException on failure 031 */ 032 void persist(final OcflPersistentStorageSession session, 033 final ResourceOperation operation) 034 throws PersistentStorageException; 035}