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.kernel.exception; 017 018import org.fcrepo.kernel.models.FedoraResource; 019 020/** 021 * Exception when a Tombstone {@link org.fcrepo.kernel.models.FedoraResource} 022 * is used where a real object is expected 023 * 024 * @author cabeer 025 * @since 10/16/14 026 */ 027public class TombstoneException extends RepositoryRuntimeException { 028 029 private static final long serialVersionUID = 1L; 030 031 private final FedoraResource fedoraResource; 032 private final String uri; 033 034 /** 035 * Construct a new tombstone exception for a resource 036 * @param fedoraResource the fedora resource 037 */ 038 public TombstoneException(final FedoraResource fedoraResource) { 039 this(fedoraResource, null); 040 } 041 042 /** 043 * Create a new tombstone exception with a URI to the tombstone resource 044 * @param fedoraResource the fedora resource 045 * @param uri the uri to the tombstone resource 046 */ 047 public TombstoneException(final FedoraResource fedoraResource, final String uri) { 048 super("Discovered tombstone resource at " + fedoraResource); 049 this.fedoraResource = fedoraResource; 050 this.uri = uri; 051 } 052 053 /** 054 * Get the tombstone resource 055 * @return the tombstone resource 056 */ 057 public FedoraResource getResource() { 058 return fedoraResource; 059 } 060 061 /** 062 * Get a URI to the tombstone resource 063 * @return the URI to the tombstone resource 064 */ 065 public String getURI() { 066 return uri; 067 } 068}