public class PathResolverImpl extends java.lang.Object implements PathResolver
Modifier and Type | Class and Description |
---|---|
(package private) class |
PathResolverImpl.PathTree
Defines a tree node container.
|
PathResolver.UnresolvedPathException
Modifier and Type | Field and Description |
---|---|
private static java.util.regex.Pattern |
ANY_PATH_SEPARATOR
Regexp pattern for matching any path separators
|
private boolean |
caseInsensitive
The case insensitive mode on the legacy system
|
private static java.lang.String |
CURRENT_DIR_REFERENCE
Defines a current directory reference in the path name
|
private java.util.Map<PathResolverImpl.PathTree,java.lang.String> |
mountedPaths
A map from the given directory subset on the legacy system to the host system
|
private static java.lang.String |
PARENT_REFERENCE
Defines a parent reference in the path name
|
private PathResolverImpl.PathTree |
root
The artificial root for the legacy file system
|
UNRESOLVED_ERROR
Constructor and Description |
---|
PathResolverImpl(java.lang.String fileSeparator,
boolean caseInsensitive)
Builds this path resolver for the given legacy file separator for the given
case insensitive mode.
|
Modifier and Type | Method and Description |
---|---|
private PathResolverImpl.PathTree |
addPathTree(java.lang.String path)
Builds the tree node for the given legacy system path.
|
private java.lang.String |
doCaseInsensitive(java.lang.String path)
Builds a case insensitive key if the current legacy system mode is insensitive.
|
void |
mount(java.lang.String path,
java.lang.String mappedPath)
Mounts the given legacy system path to its host system path.
|
java.lang.String |
resolvePath(java.lang.String path)
Resolve the given legacy path to the path on the host system.
|
void |
setPathMap(java.util.Map<java.lang.String,java.lang.String> pathMap)
Mounts the legacy system paths in the given map to their host system paths.
|
private static final java.util.regex.Pattern ANY_PATH_SEPARATOR
private static final java.lang.String PARENT_REFERENCE
private static final java.lang.String CURRENT_DIR_REFERENCE
private PathResolverImpl.PathTree root
private java.util.Map<PathResolverImpl.PathTree,java.lang.String> mountedPaths
private boolean caseInsensitive
public PathResolverImpl(java.lang.String fileSeparator, boolean caseInsensitive)
fileSeparator
- The given legacy file separatorcaseInsensitive
- The given case insensitive modepublic java.lang.String resolvePath(java.lang.String path) throws PathResolver.UnresolvedPathException
resolvePath
in interface PathResolver
path
- The given legacy path to be resolved on the host systemUnresolvedPathException
- If the given path can't be resolvedPathResolver.UnresolvedPathException
public void setPathMap(java.util.Map<java.lang.String,java.lang.String> pathMap)
pathMap
- Map of legacy system paths to host system paths.public void mount(java.lang.String path, java.lang.String mappedPath)
path
- The given legacy system pathmappedPath
- The host system pathprivate java.lang.String doCaseInsensitive(java.lang.String path)
path
- The given legacy system path or path componentprivate PathResolverImpl.PathTree addPathTree(java.lang.String path)
path
- The given legacy system path