io.nosqlbench.nb.api.content.ContentResolver Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nb-api Show documentation
Show all versions of nb-api Show documentation
The top level API module for NoSQLBench. This module should have no internal
module dependencies other than the mvn-default module.
All modules within NoSQLBench can safely depend on this module with circular
dependencies. This module provides cross-cutting code infrastracture, such as
path utilities and ways of describing services used between modules.
It is also the transitive aggregation point for system-wide library dependencies
for logging and testing or similar needs.
package io.nosqlbench.nb.api.content;
import java.net.URI;
import java.nio.file.Path;
import java.util.List;
public interface ContentResolver {
/**
* Locate the content referenced by the specified name. Content is any
* URL or file path which contains data to be loaded.
*
* Implementors should take care to ensure the following conditions are met:
*
*
* - For URL style content, resolution is only successful if a stream to download the content
* is acquired.
* - For file paths, resolution is only successful if the filesystem does a standard access
* check for readability of a file that is present.
*
*
* A content resolver may be given a path which is fundamentally incompatible with the
* schemes supported by the resolver implementation. It is
* required that the resolver return null for such URI values.
*
* @param uri The URI of a content location, like a file name or URL.
* @return A content element which may then be used to access the content
*/
List> resolve(URI uri);
default List> resolve(String uri) {
return resolve(URI.create(uri));
}
/**
* Return a list of matching directory Paths for the {@link URI} which are accessible under
* the scheme of the implementing resolver. It is possible that a logical path can return
* more than one physical directory path, such as with jar files.
* @param uri
* @return A list of accessible paths matching the uri, or an empty list
*/
List resolveDirectory(URI uri);
default List resolveDirectory(String uri) {
return resolveDirectory(URI.create(uri));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy