List of usage examples for org.apache.hadoop.fs Path SEPARATOR_CHAR
char SEPARATOR_CHAR
To view the source code for org.apache.hadoop.fs Path SEPARATOR_CHAR.
Click Source Link
From source file:org.kitesdk.data.spi.filesystem.FileSystemDatasetRepository.java
License:Apache License
/** * Returns the correct dataset path for the given name and root directory. * * @param root A Path//from w ww.j ava 2s . co m * @param name A String dataset name * @return the correct dataset Path */ @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE", justification = "Checked in precondition") static Path pathForDataset(Path root, @Nullable String namespace, @Nullable String name) { Preconditions.checkNotNull(namespace, "Namespace cannot be null"); Preconditions.checkNotNull(name, "Dataset name cannot be null"); // Why replace '.' here? Is this a namespacing hack? return new Path(root, new Path(namespace, name.replace('.', Path.SEPARATOR_CHAR))); }
From source file:org.kitesdk.data.spi.filesystem.FileSystemMetadataProvider.java
License:Apache License
/** * This method provides backward-compatibility for finding metadata. * <p>//w ww . j a va2s . co m * This handles the case where an existing program is opening a * DatasetRepository by URI. For example, the DatasetSink and maven plugin do * this. In that case, the repository URI will directly contain a directory * named for the dataset with .metadata in it. This checks for the updated * scheme and falls back to the old scheme if the namespace is "default". * * @param namespace the requested namespace. * @param name the dataset name. * @return a Path to the correct metadata directory * @throws DatasetNotFoundException if neither location has metadata */ private Path find(String namespace, String name) { Path expectedPath = pathForMetadata(namespace, name); if (DEFAULT_NAMESPACE.equals(namespace)) { // when using the default namespace, the namespace may not be in the path try { checkExists(rootFileSystem, expectedPath); return expectedPath; } catch (DatasetNotFoundException e) { try { Path backwardCompatiblePath = new Path(rootDirectory, new Path(name.replace('.', Path.SEPARATOR_CHAR), METADATA_DIRECTORY)); checkExists(rootFileSystem, backwardCompatiblePath); return backwardCompatiblePath; } catch (DatasetNotFoundException _) { throw e; // throw the original } } } else { // no need to check other locations checkExists(rootFileSystem, expectedPath); return expectedPath; } }
From source file:org.kitesdk.data.spi.filesystem.PathConversion.java
License:Apache License
public Path fromKey(StorageKey key) { final StringBuilder pathBuilder = new StringBuilder(); final List<FieldPartitioner> partitioners = Accessor.getDefault() .getFieldPartitioners(key.getPartitionStrategy()); for (int i = 0; i < partitioners.size(); i++) { final FieldPartitioner fp = partitioners.get(i); if (i != 0) { pathBuilder.append(Path.SEPARATOR_CHAR); }/* ww w. j a v a2 s . c o m*/ @SuppressWarnings("unchecked") String dirname = dirnameForValue(fp, key.get(i)); pathBuilder.append(dirname); } return new Path(pathBuilder.toString()); }
From source file:org.kitesdk.data.spi.hive.HiveUtils.java
License:Apache License
/** * Returns the correct dataset path for the given name and root directory. * * @param root A Path/*ww w .j a v a 2s. c o m*/ * @param namespace A String namespace, or logical group * @param name A String dataset name * @return the correct dataset Path */ static Path pathForDataset(Path root, String namespace, String name) { Preconditions.checkNotNull(namespace, "Namespace cannot be null"); Preconditions.checkNotNull(name, "Dataset name cannot be null"); // Why replace '.' here? Is this a namespacing hack? return new Path(root, new Path(namespace, name.replace('.', Path.SEPARATOR_CHAR))); }