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;
009
010/**
011 * @author bbpennel
012 * @author barmintor
013 * @since Feb 21, 2014
014 */
015public interface Service<T> {
016    /**
017     * Test whether T exists at the given path in the
018     * repository
019     *
020     * @param path the path
021     * @param transaction the transaction
022     * @return whether T exists at the given path
023     */
024    boolean exists(final Transaction transaction, final String path);
025    /**
026     * Retrieve an existing T instance by transaction and path
027     *
028     * @param path the path to the node
029     * @param transaction the transaction
030     * @return retrieved T
031     */
032    T find(final Transaction transaction, final String path);
033    /**
034     * Retrieve a T instance by transaction and path
035     *
036     * @param transaction the transaction
037     * @param path the path to the node
038     * @return retrieved T
039     */
040    T findOrCreate(final Transaction transaction, final String path);
041}