001/*
002 * Copyright 2015 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.migration;
017
018/**
019 * An interface whose implementations represent methods to
020 * convert Fedora 3 PIDs into fedora 4 paths.
021 *
022 * At one point it was thought that this should be more sophisticated
023 * to support more advanced mapping (ie, passing more information about
024 * the object, but in order to use this to resolve the "fedora:info/pid"
025 * URI's within fedora's RELS-EXT we only have the pid.  Therefore
026 * implementations that need to do something more sophisticated, should
027 * build a mapping using whatever tooling it needs (and has available)
028 * such that it can return the result with just the PID.
029 *
030 * @author mdurbin
031 */
032public interface MigrationIDMapper {
033
034    /**
035     * Takes a Fedora 3 pid and returns the path
036     * that object would have in Fedora 4.
037     * @param pid a PID for a Fedora 3 object.
038     * @return a path suitable for use in Fedora 4.
039     */
040    public String mapObjectPath(String pid);
041
042    /**
043     * Takes a Fedora 3 PID and DSID and returns the path
044     * that datastream would have in Fedora 4.
045     * @param pid a PID for the Fedora 3 object
046     * @param dsid the DS id for the Fedora 3 datastream
047     * @return a path suitable for use in Fedora 4.
048     */
049    public String mapDatastreamPath(String pid, String dsid);
050
051    /**
052     * @return  the fedora 4 base URL.  Paths returned by
053     * {@link #mapDatastreamPath} and {@link #mapObjectPath}
054     * appended to this value will be resolvable URLs in the
055     * fedora 4 repository.
056     */
057    public String getBaseURL();
058
059}