Class Repository
java.lang.Object
org.openide.filesystems.Repository
- All Implemented Interfaces:
Serializable
Holder for NetBeans default (system, configuration) filesystem, used for most
of NetBeans' runtime configuration. The default implementation is a merge
of all of the XML layer files provided by enabled modules, and
the
config
subfolder of the userdir on the user's disk.
If you just want to modify configuration data use e.g.
FileObject menus = FileUtil.getConfigFile("Menu"); // ...Formerly (NB 3.x) contained a list of mounted filesystems. This functionality is no longer used and is now deprecated.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Contributes to content ofsystem file system
(which influences structure underFileUtil.getConfigRoot()
).static class
Provides local repositories, depending on the current execution environment. -
Constructor Summary
ConstructorsConstructorDescriptionRepository
(FileSystem def) Creates new instance of filesystem pool and registers it as the default one. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
Deprecated.useless because there is no filesystem but only default filesystem in Repository.final void
Deprecated.Please use the ClassPath API instead.final void
Deprecated.Please use the ClassPath API instead.final Enumeration
<? extends FileSystem> Deprecated.Please use the ClassPath API instead.final FileObject
Deprecated.Please use the ClassPath API instead.final Enumeration
<? extends FileObject> Deprecated.Please use the ClassPath API instead.final Enumeration
<? extends FileObject> findAllResources
(String name) Deprecated.Please use the ClassPath API instead.final FileSystem
findFileSystem
(String systemName) Deprecated.Please use the ClassPath API instead.Allows subclasses registered asgetDefault()
to find out list of URLs for a given provider.final FileObject
findResource
(String name) Deprecated.Please use the ClassPath API instead.static Repository
Access method to get default instance of repository in the system.final FileSystem
Deprecated.Please useFileUtil.getConfigFile(String)
orFileUtil.getConfigRoot()
instead.final Enumeration
<? extends FileSystem> Deprecated.Please use the ClassPath API instead.protected static final void
provideLayers
(ClassLoader l, List<URL> layerUrls) Allows subclasses to accept layer contributions fromRepository.LayerProvider
s.final void
readExternal
(ObjectInput ois) Deprecated.Unused.protected void
Methods that tellsRepository
subclasses to refresh list of URLs provided byRepository.LayerProvider
s.final void
Deprecated.useless because there is no filesystem but only default filesystem in Repository.final void
Deprecated.Please use the ClassPath API instead.final void
Deprecated.Please use the ClassPath API instead.final void
reorder
(int[] perm) Deprecated.Please use the ClassPath API instead.final FileSystem[]
toArray()
Deprecated.Please use the ClassPath API instead.final void
Deprecated.Unused.
-
Constructor Details
-
Repository
Creates new instance of filesystem pool and registers it as the default one. Also registers the default filesystem.- Parameters:
def
- the default filesystem
-
-
Method Details
-
refreshAdditionalLayers
protected void refreshAdditionalLayers()Methods that tellsRepository
subclasses to refresh list of URLs provided byRepository.LayerProvider
s.- Since:
- 7.59
-
findLayers
Allows subclasses registered asgetDefault()
to find out list of URLs for a given provider. The method just callsRepository.LayerProvider.registerLayers(java.util.Collection)
.- Parameters:
p
- the provider.- Returns:
- ordered list of URLs
- Since:
- 7.59
-
provideLayers
Allows subclasses to accept layer contributions fromRepository.LayerProvider
s. Layer XMLs will be collected from locations specified in manifests accessible by the passed ClassLoader, including generated layers. FinallyRepository.LayerProvider
s will be consulted to append their URLs to the list. If the passed classloader isnull
, the classloader which loaded the Repository class will be used.- Parameters:
layerUrls
- out: collection which receives the URLs.- Throws:
IOException
- propagated if some I/O error occurs.- Since:
- 9.5
-
getDefault
Access method to get default instance of repository in the system. The instance is either taken as a result oforg.openide.util.Lookup.getDefault ().lookup (Repository.class)
or (if the lookup query returns null) a default instance is created.In a contextual environment, the method remembers the result of the default Lookup query, and will return the same instance as a system-wide Repository instance. Instances provided by
Lookup.getDefault().lookup(Repository.class)
may vary depending on the Lookup's implementation and context - be aware that multiple Repository instances may exist, possibly one for each contextual Lookup created.- Returns:
- default repository for the system
- Since:
- 9.5 support for multiple contexts
-
getDefaultFileSystem
Deprecated.Please useFileUtil.getConfigFile(String)
orFileUtil.getConfigRoot()
instead.Gets the NetBeans default (system, configuration) filesystem.- Returns:
- the default filesystem
-
addFileSystem
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 samename
(unless all but one areinvalid
). To be sure, that filesystem was really added in Repository, then test thatFileSystem
is valid.- Parameters:
fs
- filesystem to add
-
removeFileSystem
Deprecated.Please use the ClassPath API instead.Removes a filesystem from the pool.- Parameters:
fs
- filesystem to remove
-
reorder
Deprecated.Please use the ClassPath API instead.ReordersFileSystem
s 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
Deprecated.Please use the ClassPath API instead.Returns enumeration of all filesystems.- Returns:
- enumeration of type
FileSystem
-
fileSystems
Deprecated.Please use the ClassPath API instead.Returns enumeration of all filesystems.- Returns:
- enumeration of type
FileSystem
-
toArray
Deprecated.Please use the ClassPath API instead.Returns a sorted array of filesystems.- Returns:
- a sorted array of filesystems
-
findFileSystem
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
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
@Deprecated 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 occuresClassNotFoundException
- if read class is not found
-
find
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 tofind
. The first object that is found is returned ornull
if none of the filesystems contain such a file.- Parameters:
aPackage
- package name where each package is separated by a dotname
- name of the file (without dots) ornull
if one wants to obtain the name of a package and not a file in itext
- extension of the file ornull
if one needs a package and not a file name- Returns:
FileObject
that represents file with given name ornull
if the file does not exist
-
findResource
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:
-
findAllResources
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
FileObject
s
-
findAll
@Deprecated public final Enumeration<? extends FileObject> 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 withFileSystem.find(java.lang.String, java.lang.String, java.lang.String)
.- Parameters:
aPackage
- package name where each package is separated by a dotname
- name of the file (without dots) ornull
if one wants to obtain the name of a package and not a file in itext
- extension of the file ornull
if one needs a package and not a file name- Returns:
- enumeration of
FileObject
s
-
addRepositoryListener
Deprecated.Please use the ClassPath API instead.Adds new listener.- Parameters:
list
- the listener
-
removeRepositoryListener
-
addFileChangeListener
Deprecated.useless because there is no filesystem but only default filesystem in Repository. Add new listener directly to default filesystemgetDefaultFileSystem()
.Add new listener to this object.- Parameters:
fcl
- the listener- Since:
- 2.8
-
removeFileChangeListener
Deprecated.useless because there is no filesystem but only default filesystem in Repository. Add new listener directly to default filesystemgetDefaultFileSystem()
.Remove listener from this object.- Parameters:
fcl
- the listener- Since:
- 2.8
-