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 * 006 */ 007package org.fcrepo.migration.foxml; 008 009import java.io.File; 010import java.io.IOException; 011 012/** 013 * An extension of DirectoryScanningIDResolver for datastream directories of fedora 014 * repositories using the legacy-fs storage implementation. 015 * 016 * @author mdurbin 017 */ 018public class LegacyFSIDResolver extends DirectoryScanningIDResolver { 019 020 /** 021 * Basic constructor. 022 * @param indexDir A directory that will serve as a lucene index directory to cache ID resolution. 023 * @param dsRoot the root directory of the AkubraFS datastream store. 024 * @throws IOException IO exception creating temp and index files/directories 025 */ 026 public LegacyFSIDResolver(final File indexDir, final File dsRoot) throws IOException { 027 super(indexDir, dsRoot); 028 } 029 030 /** 031 * Basic constructor. 032 * @param dsRoot the root directory of the AkubraFS datastream store. 033 * @throws IOException IO exception creating temp and index files/directories 034 */ 035 public LegacyFSIDResolver(final File dsRoot) throws IOException { 036 super(null, dsRoot); 037 } 038 039 @Override 040 protected String getInternalIdForFile(final File f) { 041 return f.getName().replaceFirst("_", ":"); 042 } 043}