protected final File createFile() throws DataCacheException {
// TODO: Do this here? Or wait until we actually create the file on
// disk and try to write to it?
if (parentDirectory.exists() && !parentDirectory.isDirectory()) {
throw new DataCacheException("The specified parent directory is not a directory: " +
parentDirectory.getAbsolutePath());
}
if (!parentDirectory.exists() && !parentDirectory.mkdirs()) {
throw new DataCacheException("Failed to create the specified parent directory: " +
parentDirectory.getAbsolutePath());
}
return new File(parentDirectory, getFileName());
}