站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 5.5.1

Repository (NetBeans File Systems API) - NetBeans API Javadoc 5.5.1

org.openide.filesystems 6.4.31

org.openide.filesystems
Class Repository

java.lang.Object
  extended by org.openide.filesystems.Repository
All Implemented Interfaces:
Serializable

public class Repository
extends Object
implements Serializable

Holder for system filesystem, used for most of NetBeans' runtime configuration. There is only one useful thing to do with this class:

 FileSystem sfs = Repository.getDefault().getDefaultFileSystem();
 // now use somehow, e.g.
 FileObject menus = sfs.findResource("Menu");
 // ...
 
Formerly (NB 3.x) contained a list of mounted filesystems. This functionality is no longer used and is now deprecated.

See Also:
Serialized Form

Constructor Summary
Repository(FileSystem def)
          Creates new instance of filesystem pool and registers it as the default one.
 
Method Summary
 void addFileChangeListener(FileChangeListener fcl)
          Deprecated. useless because there is no filesystem but only default filesystem in Repository. Add new listener directly to default filesystem getDefaultFileSystem().
 void addFileSystem(FileSystem fs)
          Deprecated. Please use the ClassPath API instead.
 void addRepositoryListener(RepositoryListener list)
          Deprecated. Please use the ClassPath API instead.
 Enumeration fileSystems()
          Deprecated. Please use the ClassPath API instead.
 FileObject find(String aPackage, String name, String ext)
          Deprecated. Please use the ClassPath API instead.
 Enumeration findAll(String aPackage, String name, String ext)
          Deprecated. Please use the ClassPath API instead.
 Enumeration findAllResources(String name)
          Deprecated. Please use the ClassPath API instead.
 FileSystem findFileSystem(String systemName)
          Deprecated. Please use the ClassPath API instead.
 FileObject findResource(String name)
          Deprecated. Please use the ClassPath API instead.
static Repository getDefault()
          Access method to get default instance of repository in the system.
 FileSystem getDefaultFileSystem()
          Gets the default filesystem of the IDE.
 Enumeration getFileSystems()
          Deprecated. Please use the ClassPath API instead.
 void readExternal(ObjectInput ois)
          Deprecated. Unused.
 void removeFileChangeListener(FileChangeListener fcl)
          Deprecated. useless because there is no filesystem but only default filesystem in Repository. Add new listener directly to default filesystem getDefaultFileSystem().
 void removeFileSystem(FileSystem fs)
          Deprecated. Please use the ClassPath API instead.
 void removeRepositoryListener(RepositoryListener list)
          Deprecated. Please use the ClassPath API instead.
 void reorder(int[] perm)
          Deprecated. Please use the ClassPath API instead.
 FileSystem[] toArray()
          Deprecated. Please use the ClassPath API instead.
 void writeExternal(ObjectOutput oos)
          Deprecated. Unused.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Repository

public Repository(FileSystem def)
Creates new instance of filesystem pool and registers it as the default one. Also registers the default filesystem.

Parameters:
def - the default filesystem
Method Detail

getDefault

public static Repository getDefault()
Access method to get default instance of repository in the system. The instance is either taken as a result of org.openide.util.Lookup.getDefault ().lookup (Repository.class) or (if the lookup query returns null) a default instance is created.

Returns:
default repository for the system

getDefaultFileSystem

public final FileSystem getDefaultFileSystem()
Gets the default filesystem of the IDE.

Returns:
the default filesystem

addFileSystem

public final void addFileSystem(FileSystem fs)
Deprecated. Please use the ClassPath API instead.

Adds new filesystem to the pool. Note that a filesystem cannot be assigned to more than one file system pool at one time (though currently there is only one pool anyway). At any given time, no two filesystems in the pool may share the same name (unless all but one are invalid). To be sure, that filesystem was really added in Repository, then test that FileSystem is valid.

Parameters:
fs - filesystem to add

removeFileSystem

public final void removeFileSystem(FileSystem fs)
Deprecated. Please use the ClassPath API instead.

Removes a filesystem from the pool.

Parameters:
fs - filesystem to remove

reorder

public final void reorder(int[] perm)
Deprecated. Please use the ClassPath API instead.

Reorders FileSystems by given permutation. For example, if there are three filesystems, new int[] {2, 0, 1} cycles the filesystems forwards.

Parameters:
perm - an array of integers
Throws:
IllegalArgumentException - if the array is not a permutation, or is not the same length as the current number of filesystems in the pool

getFileSystems

public final Enumeration getFileSystems()
Deprecated. Please use the ClassPath API instead.

Returns enumeration of all filesystems.

Returns:
enumeration of type FileSystem

fileSystems

public final Enumeration fileSystems()
Deprecated. Please use the ClassPath API instead.

Returns enumeration of all filesystems.

Returns:
enumeration of type FileSystem

toArray

public final FileSystem[] toArray()
Deprecated. Please use the ClassPath API instead.

Returns a sorted array of filesystems.

Returns:
a sorted array of filesystems

findFileSystem

public final FileSystem findFileSystem(String systemName)
Deprecated. Please use the ClassPath API instead.

Finds filesystem when only its system name is known.

Parameters:
systemName - name of the filesystem
Returns:
the filesystem or null if there is no such filesystem

writeExternal

public final void writeExternal(ObjectOutput oos)
                         throws IOException
Deprecated. Unused.

Saves pool to stream by saving all filesystems. The default (system) filesystem, or any persistent filesystems, are skipped.

Parameters:
oos - object output stream
Throws:
IOException - if an error occures

readExternal

public final void readExternal(ObjectInput ois)
                        throws IOException,
                               ClassNotFoundException
Deprecated. Unused.

Reads object from stream. Reads all filesystems. Persistent and system filesystems are untouched; all others are removed and possibly reread.

Parameters:
ois - object input stream
Throws:
IOException - if an error occures
ClassNotFoundException - if read class is not found

find

public final FileObject find(String aPackage,
                             String name,
                             String ext)
Deprecated. Please use the ClassPath API instead.

Finds file when its name is provided. It scans in the list of filesystems 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 filesystems 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

findResource

public final FileObject findResource(String name)
Deprecated. Please use the ClassPath API instead.

Searches for the given resource among all filesystems.

Parameters:
name - a name of the resource
Returns:
file object or null if the resource can not be found
See Also:
FileSystem.findResource(java.lang.String)

findAllResources

public final Enumeration findAllResources(String name)
Deprecated. Please use the ClassPath API instead.

Searches for the given resource among all filesystems, returning all matches.

Parameters:
name - name of the resource
Returns:
enumeration of FileObjects

findAll

public final Enumeration findAll(String aPackage,
                                 String name,
                                 String ext)
Deprecated. Please use the ClassPath API instead.

Finds all files among all filesystems matching a given name, returning all matches. All filesystems 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

addRepositoryListener

public final void addRepositoryListener(RepositoryListener list)
Deprecated. Please use the ClassPath API instead.

Adds new listener.

Parameters:
list - the listener

removeRepositoryListener

public final void removeRepositoryListener(RepositoryListener list)
Deprecated. Please use the ClassPath API instead.

Removes listener.

Parameters:
list - the listener

addFileChangeListener

public final void addFileChangeListener(FileChangeListener fcl)
Deprecated. useless because there is no filesystem but only default filesystem in Repository. Add new listener directly to default filesystem getDefaultFileSystem().

Add new listener to this object.

Parameters:
fcl - the listener
Since:
2.8

removeFileChangeListener

public final void removeFileChangeListener(FileChangeListener fcl)
Deprecated. useless because there is no filesystem but only default filesystem in Repository. Add new listener directly to default filesystem getDefaultFileSystem().

Remove listener from this object.

Parameters:
fcl - the listener
Since:
2.8

org.openide.filesystems 6.4.31

Built on March 26 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.