Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.0.0)

E17493-01

oracle.ide.file
Class AbstractFileScope

java.lang.Object
  extended by oracle.ide.file.AbstractFileScope
All Implemented Interfaces:
FileScope
Direct Known Subclasses:
ContentSetScope

public abstract class AbstractFileScope
extends java.lang.Object
implements FileScope

Base class for file scope implementations.

Since:
11.1.2

Constructor Summary
AbstractFileScope()
           
 
Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractFileScope

public AbstractFileScope()
Method Detail

activate

protected abstract void activate()
Activate this scope. A scope is active when there are active listeners on the scope. Typically, implementations of this method should add whatever listeners are necessary to determine if scope path has changed.


deactivate

protected abstract void deactivate()
Deactivate this scope. A scope is deactivated when there are no more active listeners. Typically, implementations of this method should remove any listeners were added by the activate() method.


getStorage

protected abstract Storage getStorage()
Get the storage where data for this scope should be stored.

Returns:
the storage used to store data for this scope

getPath

protected abstract Path getPath()
Get the current path of this scope.

Returns:
the current path of this scope

getLogger

protected java.util.logging.Logger getLogger()
Get the logger to use for this scope.

Returns:
the logger to use for this scope

notifyPathChanged

protected final void notifyPathChanged()
Called by subclasses when the path for this scope has changed.


addFileChangeListener

public void addFileChangeListener(FileChangeListener listener)
Description copied from interface: FileScope
Add a file change listener to receive events about the files in this scope.

Specified by:
addFileChangeListener in interface FileScope
Parameters:
listener - the listener to be added

removeFileChangeListener

public void removeFileChangeListener(FileChangeListener listener)
Description copied from interface: FileScope
Remove a file change listener from this scope.

Specified by:
removeFileChangeListener in interface FileScope
Parameters:
listener - the listener to be removed

getFileTables

public java.util.Collection<FileTable> getFileTables()
Description copied from interface: FileScope
Get the file tables currently used by this scope. A scope may span multiple file tables.

Specified by:
getFileTables in interface FileScope
Returns:
the file tables used by this scope

getFileTable

public FileTable getFileTable(java.net.URL url)
Description copied from interface: FileScope
Get the file table in this scope containing a particular URL.

Specified by:
getFileTable in interface FileScope
Parameters:
url - the URL
Returns:
the storage containing the URL, or null if no storages contain that URL

contains

public boolean contains(java.net.URL url)
Description copied from interface: FileScope
Determine whether this scope contains a URL. This does not check for existance of the URL.

Specified by:
contains in interface FileScope
Parameters:
url - the URL
Returns:
true if this scope contains the URL, false otherwise

locate

public java.net.URL locate(java.lang.String relativePath)
                    throws java.lang.InterruptedException,
                           java.io.IOException
Description copied from interface: FileScope
Locate a file in this scope.

Specified by:
locate in interface FileScope
Parameters:
relativePath - the relative path to the file
Returns:
the full URL of the file, or null if the file was not found in this scope
Throws:
java.lang.InterruptedException - if the calling thread is interrupted
java.io.IOException

getFiles

public java.util.Collection<java.net.URL> getFiles()
                                            throws java.io.IOException,
                                                   java.lang.InterruptedException
Description copied from interface: FileScope
Get the URLs of all files in this scope.

Specified by:
getFiles in interface FileScope
Returns:
the URLs of all files in this scope
Throws:
java.io.IOException - if the list of URLs could not be obtained
java.lang.InterruptedException - if the calling thread is interrupted

getDirectories

public java.util.Collection<java.net.URL> getDirectories()
                                                  throws java.io.IOException,
                                                         java.lang.InterruptedException
Description copied from interface: FileScope
Get the URLs of all directories in this scope.

Specified by:
getDirectories in interface FileScope
Returns:
the URLs of all directories in this scope
Throws:
java.io.IOException - if the list of URLs could not be obtained
java.lang.InterruptedException - if the calling thread is interrupted

refresh

public void refresh()
             throws java.lang.InterruptedException,
                    java.io.IOException
Description copied from interface: FileScope
Refresh this scope. This brings the scope up to date with the current state of the files on disk. This is a very time consuming operation, and should not be called unless necesary. Clients of the File Change API should rarely, if ever, have a reason to call this method. It should typically only be called if the user has specifically requested that the files be refreshed. This should never be called on the event thread.

Specified by:
refresh in interface FileScope
Throws:
java.lang.InterruptedException - if the calling thread is interrupted
java.io.IOException - if the refresh fails

refresh

public void refresh(FileChangeListener listener)
             throws java.lang.InterruptedException,
                    java.io.IOException
Description copied from interface: FileScope
Refresh this scope and invoke a listener with any changes found. This brings the scope up to date with the current state of the files on disk. This is a very time consuming operation, and should not be called unless necesary. Clients of the File Change API should rarely, if ever, have a reason to call this method. It should typically only be called if the user has specifically requested that the files be refreshed. This should never be called on the event thread.

Specified by:
refresh in interface FileScope
Throws:
java.lang.InterruptedException - if the calling thread is interrupted
java.io.IOException - if the refresh fails

update

public void update()
            throws java.lang.InterruptedException,
                   java.io.IOException
Description copied from interface: FileScope
Update this scope. This brings the scope up to date with the current state of the files on disk, if necessary. Unlike FileScope.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.

Specified by:
update in interface FileScope
Throws:
java.lang.InterruptedException - if the calling thread is interrupted
java.io.IOException - if the update fails

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.0.0)

E17493-01

Copyright © 1997, 2011, Oracle. All rights reserved.