public final class FileSystemHelper
extends java.lang.Object
Resource and WritableResource from a Hadoop
Path.| Modifier and Type | Method and Description |
|---|---|
static boolean |
delete(java.lang.String path,
boolean recursive,
java.util.Map<java.lang.String,java.lang.String> configuration)
Deletes given path using given configuration settings.
|
static boolean |
exists(java.lang.String path)
Check if the given path exists.
|
static boolean |
exists(java.lang.String path,
java.util.Map<java.lang.String,java.lang.String> configuration)
Check if the given path exists.
|
static java.util.List<org.openstreetmap.atlas.streaming.resource.Resource> |
listResourcesRecursively(java.lang.String directory,
java.util.Map<java.lang.String,java.lang.String> configuration,
org.apache.hadoop.fs.PathFilter filter) |
static boolean |
mkdir(java.lang.String path,
java.util.Map<java.lang.String,java.lang.String> configuration)
Creates a new directory for given path using given configuration settings.
|
static boolean |
rename(java.lang.String sourcePath,
java.lang.String destinationPath,
java.util.Map<java.lang.String,java.lang.String> configuration)
Renames a source path to a destination path using the given configuration settings.
|
static org.openstreetmap.atlas.streaming.resource.Resource |
resource(java.lang.String path) |
static org.openstreetmap.atlas.streaming.resource.Resource |
resource(java.lang.String path,
java.util.Map<java.lang.String,java.lang.String> configuration) |
static java.util.List<org.openstreetmap.atlas.streaming.resource.Resource> |
resources(java.lang.String directory,
java.util.Map<java.lang.String,java.lang.String> configuration)
List resources, but omit the hadoop "_SUCCESS" file.
|
static java.util.List<org.openstreetmap.atlas.streaming.resource.Resource> |
resources(java.lang.String directory,
java.util.Map<java.lang.String,java.lang.String> configuration,
org.apache.hadoop.fs.PathFilter filter) |
static java.util.stream.Stream<org.apache.hadoop.fs.Path> |
streamPathsRecursively(java.lang.String directory,
java.util.Map<java.lang.String,java.lang.String> configuration,
org.apache.hadoop.fs.PathFilter filter) |
static org.openstreetmap.atlas.streaming.resource.WritableResource |
writableResource(java.lang.String path) |
static org.openstreetmap.atlas.streaming.resource.WritableResource |
writableResource(java.lang.String path,
java.util.Map<java.lang.String,java.lang.String> configuration) |
public static boolean delete(java.lang.String path,
boolean recursive,
java.util.Map<java.lang.String,java.lang.String> configuration)
path - Path to deleterecursive - If given path is a directory and this is set, then directory and all child items
will be deleted, otherwise throws Exception.configuration - Configuration settings to use as contextpublic static boolean exists(java.lang.String path)
path - The path to checkpublic static boolean exists(java.lang.String path,
java.util.Map<java.lang.String,java.lang.String> configuration)
path - The path to checkconfiguration - The configuration mappublic static java.util.List<org.openstreetmap.atlas.streaming.resource.Resource> listResourcesRecursively(java.lang.String directory,
java.util.Map<java.lang.String,java.lang.String> configuration,
org.apache.hadoop.fs.PathFilter filter)
directory - The directory from which to recursively load filesconfiguration - The configuration (containing the filesystem definition)filter - The path filter. If null, all the files will be returned.Resourcespublic static boolean mkdir(java.lang.String path,
java.util.Map<java.lang.String,java.lang.String> configuration)
path - Path to use for directory creation operationconfiguration - Configuration settings to use as contextpublic static boolean rename(java.lang.String sourcePath,
java.lang.String destinationPath,
java.util.Map<java.lang.String,java.lang.String> configuration)
sourcePath - Path to rename fromdestinationPath - Path to rename toconfiguration - Configuration settings to use as contextpublic static org.openstreetmap.atlas.streaming.resource.Resource resource(java.lang.String path)
path - The path to create the resource fromResource coming from the default RawLocalFileSystempublic static org.openstreetmap.atlas.streaming.resource.Resource resource(java.lang.String path,
java.util.Map<java.lang.String,java.lang.String> configuration)
path - The path to create the resource fromconfiguration - The configuration defining the FileSystemResource coming from the appropriate FileSystempublic static java.util.List<org.openstreetmap.atlas.streaming.resource.Resource> resources(java.lang.String directory,
java.util.Map<java.lang.String,java.lang.String> configuration)
directory - The directory from which to load filesconfiguration - The configuration defining the FileSystemResources which contains all the files but the _SUCCESS filepublic static java.util.List<org.openstreetmap.atlas.streaming.resource.Resource> resources(java.lang.String directory,
java.util.Map<java.lang.String,java.lang.String> configuration,
org.apache.hadoop.fs.PathFilter filter)
directory - The directory from which to load filesconfiguration - The configuration defining the FileSystemfilter - The path filter. If null, all the files will be returned.Resourcespublic static java.util.stream.Stream<org.apache.hadoop.fs.Path> streamPathsRecursively(java.lang.String directory,
java.util.Map<java.lang.String,java.lang.String> configuration,
org.apache.hadoop.fs.PathFilter filter)
directory - The directory from which to recursively stream pathsconfiguration - The configuration (containing the filesystem definition)filter - The path filter. If null, all the paths will be returned.Pathspublic static org.openstreetmap.atlas.streaming.resource.WritableResource writableResource(java.lang.String path)
path - The path to create the resource fromWritableResource coming from the default RawLocalFileSystempublic static org.openstreetmap.atlas.streaming.resource.WritableResource writableResource(java.lang.String path,
java.util.Map<java.lang.String,java.lang.String> configuration)
path - The path to create the resource fromconfiguration - The configuration defining the FileSystemWritableResource coming from the appropriate FileSystem