public class GlobusPathMatchingResourcePatternResolver
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.regex.Pattern |
locationPattern |
private java.lang.String |
mainClassPath
Path from root directory to the directory at the beginning of a classpath.
|
private java.util.Vector<GlobusResource> |
pathsMatchingLocationPattern |
Constructor and Description |
---|
GlobusPathMatchingResourcePatternResolver() |
Modifier and Type | Method and Description |
---|---|
private java.lang.String |
antToRegexConverter(java.lang.String antStyleLocationPattern)
Converts an Ant-style pattern to a regex pattern by replacing (.
|
private java.lang.String |
getPathUntilWildcard(java.lang.String locationPatternString,
boolean defaultToLocaldir)
Returns a substring of the locationPattern from the beginning
to the first occurrence of * or ?
If this is unsuccessful, start at current directory ./
|
GlobusResource |
getResource(java.lang.String location)
This method takes a location string and returns a GlobusResource of the
corresponding location.
|
GlobusResource[] |
getResources(java.lang.String locationPattern)
Finds all the resources that match the Ant-Style locationPattern
|
private void |
parseDirectoryStructure(java.io.File currentDirectory)
Recursive variant of parseFilesInDirectory.
|
private void |
parseFilesInDirectory(java.io.File currentDirectory)
Compares every file's Absolute Path against the locationPattern, if they match
a GlobusResource is created with the file's Absolute Path and added to pathsMatchingLocationPattern.
|
private java.util.regex.Pattern locationPattern
private java.lang.String mainClassPath
private java.util.Vector<GlobusResource> pathsMatchingLocationPattern
public GlobusPathMatchingResourcePatternResolver()
public GlobusResource getResource(java.lang.String location)
location
- An absolute or relative location in the style classpath:/folder/className.class,
file:/folder/fileName.ext, or folder/folder/fileName.extpublic GlobusResource[] getResources(java.lang.String locationPattern)
locationPattern
- Ant-Style location pattern which may be prefixed with
classpath:/, file:/, or describe a relative path.private java.lang.String antToRegexConverter(java.lang.String antStyleLocationPattern)
antStyleLocationPattern
- An Ant-Stlye location pattern.private java.lang.String getPathUntilWildcard(java.lang.String locationPatternString, boolean defaultToLocaldir)
locationPatternString
- The Ant-Style location pattern.private void parseDirectoryStructure(java.io.File currentDirectory)
currentDirectory
- The currentDirectory to explore.private void parseFilesInDirectory(java.io.File currentDirectory)
currentDirectory
- The directory whose files to parse.