public FileSystemDataset<E> build() {
Preconditions.checkState(this.namespace != null, "No namespace defined");
Preconditions.checkState(this.name != null, "No dataset name defined");
Preconditions.checkState(this.descriptor != null,
"No dataset descriptor defined");
Preconditions.checkState((conf != null) || (fileSystem != null),
"Configuration or FileSystem must be set");
Preconditions.checkState(type != null, "No type specified");
this.directory = new Path(descriptor.getLocation().toString());
if (fileSystem == null) {
try {
this.fileSystem = directory.getFileSystem(conf);
} catch (IOException ex) {
throw new DatasetIOException("Cannot access FileSystem", ex);
}
}
Path absoluteDirectory = fileSystem.makeQualified(directory);
return new FileSystemDataset<E>(
fileSystem, absoluteDirectory, namespace, name, descriptor, uri,
partitionKey, partitionListener, type);
}
}