001/*
002 * Copyright 2016 DuraSpace, Inc.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.fcrepo.camel.ldpath;
017
018import org.apache.marmotta.commons.http.ContentType;
019import org.apache.marmotta.ldclient.api.endpoint.Endpoint;
020
021/**
022 * @author acoburn
023 * @since Aug 5, 2016
024 */
025public class FedoraEndpoint extends Endpoint {
026
027    /**
028     * Create a Fedora endpoint to be used with the Marmotta LDClient
029     * Note: the baseUrl defined here is used by the LDClient to determine
030     * what rules to apply when dereferencing URIs that start with the
031     * given namespace.
032     *
033     * @param namespace the namespace for the Fedora endpoint (e.g. http://localhost:8080/fcrepo/rest/)
034     */
035    public FedoraEndpoint(final String namespace) {
036        this(namespace, 0L);
037    }
038
039    /**
040     * Create a Fedora endpoint to be used with the Marmotta LDClient
041     * Note: the baseUrl defined here is used by the LDClient to determine
042     * what rules to apply when dereferencing URIs that start with the
043     * given namespace.
044     *
045     * @param namespace the namespace for the Fedora endpoint (e.g. http://localhost:8080/fcrepo/rest/)
046     * @param timeout the length of time (in seconds) to cache the data
047     */
048    public FedoraEndpoint(final String namespace, final Long timeout) {
049        super("Fedora Repository", "Linked Data", namespace + ".*", null, timeout);
050        setPriority(PRIORITY_HIGH);
051        addContentType(new ContentType("application", "rdf+xml", 0.8));
052        addContentType(new ContentType("text", "turtle", 1.0));
053        addContentType(new ContentType("text", "n3", 0.8));
054        addContentType(new ContentType("application", "ld+json", 0.5));
055    }
056}