001package co.codewizards.cloudstore.core.repo.local; 002 003import co.codewizards.cloudstore.core.oio.File; 004 005 006/** 007 * Thrown if a {@link LocalRepoManager} could not be created for a given {@link File}, because the file 008 * is not yet a repository. 009 * <p> 010 * Note, that the path denotes an existing directory in the file system, though. However, it was expected 011 * to be a repository and not only a simple directory. A repository contains appropriate meta-data, while 012 * a simple directory does not. 013 * @author Marco หงุ่ยตระกูล-Schulze - marco at codewizards dot co 014 */ 015public class FileNoRepositoryException extends LocalRepoManagerException { 016 private static final long serialVersionUID = 1L; 017 018 private final File file; 019 020 public FileNoRepositoryException(final File file) { 021 super(createMessage(file)); 022 this.file = file; 023 } 024 025 public FileNoRepositoryException(final File file, final Throwable cause) { 026 super(createMessage(file), cause); 027 this.file = file; 028 } 029 030 public File getFile() { 031 return file; 032 } 033 034 private static String createMessage(final File file) { 035 return String.format("File is an existing directory, but it is not a repository: %s", file == null ? null : file.getAbsolutePath()); 036 } 037}