001/*
002 * Licensed to DuraSpace under one or more contributor license agreements.
003 * See the NOTICE file distributed with this work for additional information
004 * regarding copyright ownership.
005 *
006 * DuraSpace licenses this file to you under the Apache License,
007 * Version 2.0 (the "License"); you may not use this file except in
008 * compliance with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.fcrepo.kernel.api.services;
019
020import org.apache.jena.rdf.model.Model;
021import org.fcrepo.kernel.api.Transaction;
022import org.fcrepo.kernel.api.identifiers.FedoraId;
023import org.fcrepo.kernel.api.models.ExternalContent;
024
025import java.io.InputStream;
026import java.net.URI;
027import java.util.Collection;
028import java.util.List;
029
030/**
031 * Interface for a service to create a new resource via a POST request.
032 * @author whikloj
033 * @since 2019-11-05
034 */
035public interface CreateResourceService {
036
037    /**
038     * Create a new NonRdfSource resource.
039     *
040     * @param tx The transaction for the request.
041     * @param userPrincipal the principal of the user performing the service
042     * @param fedoraId The internal identifier of the resource.
043     * @param contentType The content-type header or null if none.
044     * @param filename The original filename of the binary
045     * @param contentSize The size of the content stream
046     * @param linkHeaders The original LINK headers or null if none.
047     * @param digest The binary digest or null if none.
048     * @param requestBody The request body or null if none.
049     * @param externalContent The external content handler or null if none.
050     */
051    void perform(Transaction tx, String userPrincipal, FedoraId fedoraId,
052                 String contentType, String filename, long contentSize, List<String> linkHeaders,
053                 Collection<URI> digest, InputStream requestBody, ExternalContent externalContent);
054
055    /**
056     * Create a new RdfSource resource.
057     *
058     * @param tx The transaction for the request.
059     * @param userPrincipal the principal of the user performing the service
060     * @param fedoraId The internal identifier of the resource
061     * @param linkHeaders The original LINK headers or null if none.
062     * @param model The request body RDF as a Model
063     */
064    void perform(Transaction tx, String userPrincipal, FedoraId fedoraId,
065            List<String> linkHeaders, Model model);
066
067}