public abstract class AbstractFileScope extends java.lang.Object implements FileScope
| Constructor and Description |
|---|
AbstractFileScope() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
activate()
Activate this scope.
|
void |
addFileChangeListener(FileChangeListener listener)
Add a file change listener to receive events about the files in this
scope.
|
boolean |
contains(java.net.URL url)
Determine whether this scope contains a URL.
|
protected abstract void |
deactivate()
Deactivate this scope.
|
java.util.Collection<java.net.URL> |
getDirectories()
Get the URLs of all directories in this scope.
|
java.util.Collection<java.net.URL> |
getFiles()
Get the URLs of all files in this scope.
|
FileTable |
getFileTable(java.net.URL url)
Get the file table in this scope containing a particular URL.
|
java.util.Collection<FileTable> |
getFileTables()
Get the file tables currently used by this scope.
|
protected java.util.logging.Logger |
getLogger()
Get the logger to use for this scope.
|
protected abstract Path |
getPath()
Get the current path of this scope.
|
protected abstract Storage |
getStorage()
Get the storage where data for this scope should be stored.
|
java.net.URL |
locate(java.lang.String relativePath)
Locate a file in this scope.
|
protected void |
notifyPathChanged()
Called by subclasses when the path for this scope has changed.
|
void |
refresh()
Refresh this scope.
|
void |
refresh(FileChangeListener listener)
Refresh this scope and invoke a listener with any changes found.
|
void |
removeFileChangeListener(FileChangeListener listener)
Remove a file change listener from this scope.
|
void |
update()
Update this scope.
|
protected abstract void activate()
protected abstract void deactivate()
activate() method.protected abstract Storage getStorage()
protected abstract Path getPath()
protected java.util.logging.Logger getLogger()
protected final void notifyPathChanged()
public void addFileChangeListener(FileChangeListener listener)
FileScopeaddFileChangeListener in interface FileScopelistener - the listener to be addedpublic void removeFileChangeListener(FileChangeListener listener)
FileScoperemoveFileChangeListener in interface FileScopelistener - the listener to be removedpublic java.util.Collection<FileTable> getFileTables()
FileScopegetFileTables in interface FileScopepublic FileTable getFileTable(java.net.URL url)
FileScopegetFileTable in interface FileScopeurl - the URLnull if no storages
contain that URLpublic boolean contains(java.net.URL url)
FileScopepublic java.net.URL locate(java.lang.String relativePath)
throws java.lang.InterruptedException,
java.io.IOException
FileScopepublic java.util.Collection<java.net.URL> getFiles()
throws java.io.IOException,
java.lang.InterruptedException
FileScopepublic java.util.Collection<java.net.URL> getDirectories()
throws java.io.IOException,
java.lang.InterruptedException
FileScopegetDirectories in interface FileScopejava.io.IOException - if the list of URLs could not be obtainedjava.lang.InterruptedException - if the calling thread is interruptedpublic void refresh()
throws java.lang.InterruptedException,
java.io.IOException
FileScopepublic void refresh(FileChangeListener listener) throws java.lang.InterruptedException, java.io.IOException
FileScopepublic void update()
throws java.lang.InterruptedException,
java.io.IOException
FileScopeFileScope.refresh(),
the files on disk are only scanned if the file table is known to require
a refresh. This is potentially a very time consuming operation, and
should never be called on the event thread. This method exists for
backward compatibility with older code that requires it. It should
rarely, if ever, be necessary to call this method. The file scope is
updated automatically whenever any method is called to access its data.