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.apache.jena.rdf.model.Model;
009import org.fcrepo.kernel.api.Transaction;
010import org.fcrepo.kernel.api.identifiers.FedoraId;
011import org.fcrepo.kernel.api.models.ExternalContent;
012
013import java.io.InputStream;
014import java.net.URI;
015import java.util.Collection;
016import java.util.List;
017
018/**
019 * Interface for a service to create a new resource via a POST request.
020 * @author whikloj
021 * @since 2019-11-05
022 */
023public interface CreateResourceService {
024
025    /**
026     * Create a new NonRdfSource resource.
027     *
028     * @param tx The transaction for the request.
029     * @param userPrincipal the principal of the user performing the service
030     * @param fedoraId The internal identifier of the resource.
031     * @param contentType The content-type header or null if none.
032     * @param filename The original filename of the binary
033     * @param contentSize The size of the content stream
034     * @param linkHeaders The original LINK headers or null if none.
035     * @param digest The binary digest or null if none.
036     * @param requestBody The request body or null if none.
037     * @param externalContent The external content handler or null if none.
038     */
039    void perform(Transaction tx, String userPrincipal, FedoraId fedoraId,
040                 String contentType, String filename, long contentSize, List<String> linkHeaders,
041                 Collection<URI> digest, InputStream requestBody, ExternalContent externalContent);
042
043    /**
044     * Create a new RdfSource resource.
045     *
046     * @param tx The transaction for the request.
047     * @param userPrincipal the principal of the user performing the service
048     * @param fedoraId The internal identifier of the resource
049     * @param linkHeaders The original LINK headers or null if none.
050     * @param model The request body RDF as a Model
051     */
052    void perform(Transaction tx, String userPrincipal, FedoraId fedoraId,
053            List<String> linkHeaders, Model model);
054
055}