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