|
||||||||||
| 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
|
+--net.larsan.urd.util.fileset.JarFileSet
A jar file set is a watchable file set that works on JAR archives. This file set is not recursive by default. The file set checks for modified dates on the jar archives.
This file set needs to be started for the automatic rescans to take effect. This means that the file set also needs to be stopped to cancel all pending threads.
This file set supports signed jar files.
This class can be extended to validate the JAR files before their inclusion using
the validate method.
This class pre-caches all files in the JAR file not to hold the file open.
| Nested Class Summary | |
static class |
JarFileSet.JarResource
Inner class for a resource within a jar archive. |
| Field Summary |
| Fields inherited from class net.larsan.urd.util.fileset.FileSet |
root |
| Constructor Summary | |
JarFileSet(java.io.File root,
java.util.Timer timer)
Contruct the file set with a root folder and a timer to use for the watch. |
|
| Method Summary | |
void |
addFileSetListener(FileSetListener listener)
Register file set listener. |
java.io.File[] |
getActiveFiles()
Get the active archves files in this file set. |
java.security.cert.Certificate[] |
getCertificates(Resource resource)
Get the certificates for a resource. |
Resource |
getResource(java.lang.String path)
Get a resource from the set. |
java.lang.String[] |
getResourcePaths()
Get all available resources ids. |
void |
removeFileSetListener(FileSetListener listener)
De-register file set listener |
void |
scan()
Perform a scan of available files for the set. |
void |
start(long interval)
Start watching this file set. |
void |
stop()
Stop watcing this file set. |
protected boolean |
validateJar(java.io.File file)
Check if a JAR file should be included in the file set. |
| Methods inherited from class net.larsan.urd.util.fileset.FileSet |
getErrorHandler, isRecursive, matches, resolvePath, setErrorHandler, setIsRecursive, setRegexpPattern |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public JarFileSet(java.io.File root,
java.util.Timer timer)
throws java.io.IOException
IOException if the root does not exist or denotes a file.
If the timer is set to null, the filet will not be watchable.
root - File set root folder, must existtimer - Timer to use for resource change checks, may be null
java.io.IOException - If the root folder does not exist| Method Detail |
public java.io.File[] getActiveFiles()
public void start(long interval)
interval - Interval in milliseconds between file set checks, must be bigger than 0public void stop()
public void scan()
throws java.io.IOException
scan in class FileSetAn - IOException should the scan fail
java.io.IOException - If the scan failspublic java.lang.String[] getResourcePaths()
getResourcePaths in class FileSetpublic Resource getResource(java.lang.String path)
getResourcePaths.
getResource in interface ResourceLocatorgetResource in class FileSetpath - A relative path to the resource to get
public java.security.cert.Certificate[] getCertificates(Resource resource)
getCertificates in class FileSetresource - The resource to check for signing certificates
public void addFileSetListener(FileSetListener listener)
addFileSetListener in interface WatchableFileSetlistener - File set listener to addpublic void removeFileSetListener(FileSetListener listener)
removeFileSetListener in interface WatchableFileSetlistener - File set listener to remove
protected boolean validateJar(java.io.File file)
throws java.io.IOException
file - Jar file to check
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||