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.models;
019
020import java.io.InputStream;
021import java.net.URI;
022
023/**
024 * Interface for the ExternalContent information class.
025 * @author bseeger
026 */
027public interface ExternalContent {
028
029    String PROXY = "proxy";
030    String REDIRECT = "redirect";
031    String COPY = "copy";
032
033    /**
034     * Returns the content type located in the link header.
035     * @return content type if in Link header, else null
036     */
037    public String getContentType();
038
039    /**
040     * Returns the size of the content located at the link header
041     * @return content size
042     */
043    public long getContentSize();
044
045    /**
046     * Retrieve handling information
047     * @return a String containing the type of handling requested ["proxy", "copy" or "redirect"]
048     */
049    public String getHandling();
050
051    /**
052     * Retrieve url in link header
053     * @return a String of the URL that was in the Link header
054     */
055    public String getURL();
056
057    /**
058     * Retrieve URI in link header
059     * @return a URI to the external content
060     */
061    public URI getURI();
062
063    /**
064     * Returns whether or not the handling parameter is "copy"
065     * @return boolean value representing whether or not the content handling is "copy"
066     */
067    public boolean isCopy();
068
069    /**
070     * Returns whether or not the handling parameter is "redirect"
071     * @return boolean value representing whether or not the content handling is "redirect"
072     */
073    public boolean isRedirect();
074
075    /**
076     * Returns whether or not the handling parameter is "proxy"
077     * @return boolean value representing whether or not the content handling is "proxy"
078     */
079    public boolean isProxy();
080
081    /**
082     * Fetch the external content
083     * @return InputStream containing the external content
084     */
085    public InputStream fetchExternalContent();
086}