|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--net.larsan.urd.util.fileset.FileSet
A file set is an base class for monitored group of files. A file set is based on a folder and can recurse through subfolders if needed. A file set can created with a regular expression filter. Subclasses of this class is expected to be able to handle archives as well as plain files.
All paths to resources should be relative to their roots, e.g 'path/name' as opposed to '/path/name'.
FileSet inplements the ResourceLocator interface which is used by the Norna class loader.
All path uses the '/' as separator.
| Field Summary | |
protected java.io.File |
root
File set root folder, this folder will be checked on initiation so that it exists and is accessible. |
| Constructor Summary | |
protected |
FileSet(java.io.File root)
Construct a file set using a root folder. |
| Method Summary | |
abstract java.security.cert.Certificate[] |
getCertificates(Resource resource)
Get the certificates for a resource. |
ErrorHandler |
getErrorHandler()
Get the error handler for this file set. |
abstract Resource |
getResource(java.lang.String filePath)
Get a resource from the set. |
abstract java.lang.String[] |
getResourcePaths()
Get all available resources ids. |
boolean |
isRecursive()
Check if the file set recurses into subfolders or not. |
protected boolean |
matches(java.lang.String filePath)
Check if a given file name matches the provided regular expression pattern. |
protected java.lang.String |
resolvePath(java.io.File file)
Attempt to resolve a relative file path from the root of the file set. |
abstract void |
scan()
Perform a scan of available files for the set. |
void |
setErrorHandler(ErrorHandler errorHandler)
Set the error handler for this file set. |
void |
setIsRecursive(boolean isRecursive)
Determine if this file set should recurse into subfolders or not. |
protected void |
setRegexpPattern(java.lang.String pattern)
Set the regular expression pattern to filter this fileset by. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.io.File root
| Constructor Detail |
protected FileSet(java.io.File root)
throws java.io.IOException
java.io.IOException - If the root file does not exist, or is a file and not a folder| Method Detail |
public abstract void scan()
throws java.io.IOException
java.io.IOException - If the scan failspublic abstract java.lang.String[] getResourcePaths()
public abstract Resource getResource(java.lang.String filePath)
Resource if the resource is found
or null if not. The parameter should be a relative path as reparted by getResourcePaths.
Subclasses should hash resources by path for maximum speed.
getResource in interface ResourceLocatorfilePath - A relative path to the resource to get
FileSet.Resource object representing the resource or null if not foundpublic abstract java.security.cert.Certificate[] getCertificates(Resource resource)
resource - The resource to check for signing certificates
protected java.lang.String resolvePath(java.io.File file)
throws java.io.IOException
file - File to resolve relative path for
java.io.IOException - On IO Errorspublic void setIsRecursive(boolean isRecursive)
isRecursive - True if the file set should recurse into subfolders.public boolean isRecursive()
protected void setRegexpPattern(java.lang.String pattern)
throws java.util.regex.PatternSyntaxException
PatternSyntaxException if the pattern is invalid. All patterns are case sensitive.
pattern - Perl 5 regexp pattern
java.util.regex.PatternSyntaxException - If the regular expression pattern is invalidprotected boolean matches(java.lang.String filePath)
public ErrorHandler getErrorHandler()
public void setErrorHandler(ErrorHandler errorHandler)
errorHandler - Error handler for this file set
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||