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.camel.ldpath;
007
008import org.apache.marmotta.commons.http.ContentType;
009import org.apache.marmotta.ldclient.api.endpoint.Endpoint;
010
011/**
012 * @author acoburn
013 * @since Aug 5, 2016
014 */
015public class FedoraEndpoint extends Endpoint {
016
017    /**
018     * Create a Fedora endpoint to be used with the Marmotta LDClient
019     * Note: the baseUrl defined here is used by the LDClient to determine
020     * what rules to apply when dereferencing URIs that start with the
021     * given namespace.
022     *
023     * @param namespace the namespace for the Fedora endpoint (e.g. http://localhost:8080/fcrepo/rest/)
024     */
025    public FedoraEndpoint(final String namespace) {
026        this(namespace, 0L);
027    }
028
029    /**
030     * Create a Fedora endpoint to be used with the Marmotta LDClient
031     * Note: the baseUrl defined here is used by the LDClient to determine
032     * what rules to apply when dereferencing URIs that start with the
033     * given namespace.
034     *
035     * @param namespace the namespace for the Fedora endpoint (e.g. http://localhost:8080/fcrepo/rest/)
036     * @param timeout the length of time (in seconds) to cache the data
037     */
038    public FedoraEndpoint(final String namespace, final Long timeout) {
039        super("Fedora Repository", FedoraProvider.PROVIDER_NAME, namespace + ".*", null, timeout);
040        setPriority(PRIORITY_HIGH);
041        addContentType(new ContentType("application", "rdf+xml", 0.8));
042        addContentType(new ContentType("text", "turtle", 1.0));
043        addContentType(new ContentType("text", "n3", 0.8));
044        addContentType(new ContentType("application", "ld+json", 0.5));
045    }
046}