org.openide.filesystems
Class FileSystemCapability

java.lang.Object
  |
  +--org.openide.filesystems.FileSystemCapability
Direct Known Subclasses:
FileSystemCapability.Bean

public class FileSystemCapability
extends Object

This class defines the capabilities of a file system to take part in different operations. Some file systems are not designed to allow compilation on them, some do not want to be present in class path when executing or debugging a program.

Moreover there can be additional capabilities to check and this class defines ways how one can communicated with a file system to find out whether the system is "capable" enough to be used in the operation.


Inner Class Summary
static class FileSystemCapability.Bean
          Default implementation of capabilities, that behaves like JavaBean and allows to set whether the well known capabilities (like compile, execute) should be enabled or not.
 
Field Summary
static FileSystemCapability ALL
          Object that is capable of every thing.
static FileSystemCapability COMPILE
          Well known capability of being compiled
static FileSystemCapability DEBUG
          Well known ability to be debugged
static FileSystemCapability DOC
          Well known ability to contain documentation files
static FileSystemCapability EXECUTE
          Well known ability to be executed
 
Constructor Summary
FileSystemCapability()
           
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener l)
          Adds PropertyChange listener.
 boolean capableOf(FileSystemCapability c)
          Basic operation that tests whether this object is capable to do different capability.
 Enumeration fileSystems()
          All filesystems that are capable of this capability.
 FileObject find(String aPackage, String name, String ext)
          Finds file when its name is provided.
 Enumeration findAll(String aPackage, String name, String ext)
          Finds all files among all file systems with this capability that match a given name, returning all matches.
 Enumeration findAllResources(String name)
          Searches for the given resource among all file systems that satifies this capability, returning all matches.
 FileObject findResource(String resName)
          Find a resource in repository, ignoring not capable file systems.
 void removePropertyChangeListener(PropertyChangeListener l)
          Removes PropertyChange listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALL

public static final FileSystemCapability ALL
Object that is capable of every thing.

COMPILE

public static final FileSystemCapability COMPILE
Well known capability of being compiled

EXECUTE

public static final FileSystemCapability EXECUTE
Well known ability to be executed

DEBUG

public static final FileSystemCapability DEBUG
Well known ability to be debugged

DOC

public static final FileSystemCapability DOC
Well known ability to contain documentation files
Constructor Detail

FileSystemCapability

public FileSystemCapability()
Method Detail

capableOf

public boolean capableOf(FileSystemCapability c)
Basic operation that tests whether this object is capable to do different capability.

The default implementation claims that it is capable to handle only identical capability (==).

Parameters:
c - capability to test
Returns:
true if yes

fileSystems

public Enumeration fileSystems()
All filesystems that are capable of this capability.
Returns:
enumeration of FileSystems that satifies this capability

findResource

public FileObject findResource(String resName)
Find a resource in repository, ignoring not capable file systems.
Parameters:
resName - name of the resource

findAllResources

public Enumeration findAllResources(String name)
Searches for the given resource among all file systems that satifies this capability, returning all matches.
Parameters:
name - name of the resource
Returns:
enumeration of FileObjects

find

public final FileObject find(String aPackage,
                             String name,
                             String ext)
Finds file when its name is provided. It scans in the list of file systems and asks them for the specified file by a call to find. The first object that is found is returned or null if none of the file systems contain such a file.
Parameters:
aPackage - package name where each package is separated by a dot
name - name of the file (without dots) or null if one wants to obtain the name of a package and not a file in it
ext - extension of the file or null if one needs a package and not a file name
Returns:
FileObject that represents file with given name or null if the file does not exist

findAll

public final Enumeration findAll(String aPackage,
                                 String name,
                                 String ext)
Finds all files among all file systems with this capability that match a given name, returning all matches. All file systems are queried with FileSystem.find(java.lang.String, java.lang.String, java.lang.String).
Parameters:
aPackage - package name where each package is separated by a dot
name - name of the file (without dots) or null if one wants to obtain the name of a package and not a file in it
ext - extension of the file or null if one needs a package and not a file name
Returns:
enumeration of FileObjects

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)
Adds PropertyChange listener. Every class which implements changes of capabilities has to implement it's property change support.
Parameters:
l - the listener to be added.

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)
Removes PropertyChange listener. Every class which implements changes of capabilities has to implement it's property change support.
Parameters:
l - the listener to be removed.


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.