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