public class Repository extends Object implements Serializable
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.
Modifier and Type | Class and Description |
---|---|
static class |
Repository.LayerProvider
Contributes to content of
system file system
(which influences structure under FileUtil.getConfigRoot() ). |
static class |
Repository.LocalProvider
Provides local repositories, depending on the current execution environment.
|
Constructor and Description |
---|
Repository(FileSystem def)
Creates new instance of filesystem pool and
registers it as the default one.
|
Modifier and Type | Method and Description |
---|---|
void |
addFileChangeListener(FileChangeListener fcl)
Deprecated.
useless because there is no filesystem but only
default filesystem in Repository. Add new listener directly to
default filesystem
Repository.getDefaultFileSystem() . |
void |
addFileSystem(FileSystem fs)
Deprecated.
Please use the ClassPath API instead.
|
void |
addRepositoryListener(RepositoryListener list)
Deprecated.
Please use the ClassPath API instead.
|
Enumeration<? extends FileSystem> |
fileSystems()
Deprecated.
Please use the ClassPath API instead.
|
FileObject |
find(String aPackage,
String name,
String ext)
Deprecated.
Please use the ClassPath API instead.
|
Enumeration<? extends FileObject> |
findAll(String aPackage,
String name,
String ext)
Deprecated.
Please use the ClassPath API instead.
|
Enumeration<? extends FileObject> |
findAllResources(String name)
Deprecated.
Please use the ClassPath API instead.
|
FileSystem |
findFileSystem(String systemName)
Deprecated.
Please use the ClassPath API instead.
|
protected List<? extends URL> |
findLayers(Repository.LayerProvider p)
Allows subclasses registered as
Repository.getDefault() to
find out list of URLs for a given provider. |
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()
Deprecated.
Please use
FileUtil.getConfigFile(String) or
FileUtil.getConfigRoot() instead. |
Enumeration<? extends FileSystem> |
getFileSystems()
Deprecated.
Please use the ClassPath API instead.
|
protected static void |
provideLayers(ClassLoader l,
List<URL> layerUrls)
Allows subclasses to accept layer contributions from
Repository.LayerProvider s. |
void |
readExternal(ObjectInput ois)
Deprecated.
Unused.
|
protected void |
refreshAdditionalLayers()
Methods that tells
Repository subclasses to refresh list of
URLs provided by Repository.LayerProvider s. |
void |
removeFileChangeListener(FileChangeListener fcl)
Deprecated.
useless because there is no filesystem but only
default filesystem in Repository. Add new listener directly to
default filesystem
Repository.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.
|
public Repository(FileSystem def)
def
- the default filesystemprotected void refreshAdditionalLayers()
Repository
subclasses to refresh list of
URLs provided by Repository.LayerProvider
s.protected final List<? extends URL> findLayers(Repository.LayerProvider p)
Repository.getDefault()
to
find out list of URLs for a given provider. The method just calls
Repository.LayerProvider.registerLayers(java.util.Collection)
.p
- the provider.protected static final void provideLayers(ClassLoader l, List<URL> layerUrls) throws IOException
Repository.LayerProvider
s.
Layer XMLs will be collected from locations specified in manifests accessible by the
passed ClassLoader, including generated layers.
Finally Repository.LayerProvider
s will be consulted to append their
URLs to the list. If the passed classloader is null
, the classloader which
loaded the Repository class will be used.layerUrls
- out: collection which receives the URLs.IOException
- propagated if some I/O error occurs.public static Repository getDefault()
org.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 craeted.
@Deprecated public final FileSystem getDefaultFileSystem()
FileUtil.getConfigFile(String)
or
FileUtil.getConfigRoot()
instead.@Deprecated public final void addFileSystem(FileSystem fs)
name
(unless all but one are invalid
). To be sure, that
filesystem was really added in Repository, then test that FileSystem
is valid.fs
- filesystem to add@Deprecated public final void removeFileSystem(FileSystem fs)
fs
- filesystem to remove@Deprecated public final void reorder(int[] perm)
FileSystem
s by given permutation.
For example, if there are three filesystems, new int[] {2, 0, 1}
cycles the filesystems forwards.perm
- an array of integersIllegalArgumentException
- if the array is not a permutation, or is not the same length as the current number of filesystems in the pool@Deprecated public final Enumeration<? extends FileSystem> getFileSystems()
FileSystem
@Deprecated public final Enumeration<? extends FileSystem> fileSystems()
FileSystem
@Deprecated public final FileSystem[] toArray()
@Deprecated public final FileSystem findFileSystem(String systemName)
systemName
- name
of the filesystemnull
if there is no such
filesystem@Deprecated public final void writeExternal(ObjectOutput oos) throws IOException
oos
- object output streamIOException
- if an error occures@Deprecated public final void readExternal(ObjectInput ois) throws IOException, ClassNotFoundException
ois
- object input streamIOException
- if an error occuresClassNotFoundException
- if read class is not found@Deprecated public final FileObject find(String aPackage, String name, String ext)
find
. The first object that is found is returned or null
if none of the filesystems contain such a file.aPackage
- package name where each package is separated by a dotname
- name of the file (without dots) or null
if
one wants to obtain the name of a package and not a file in itext
- extension of the file or null
if one needs
a package and not a file nameFileObject
that represents file with given name or
null
if the file does not exist@Deprecated public final FileObject findResource(String name)
name
- a name of the resourcenull
if the resource can not be foundFileSystem.findResource(java.lang.String)
@Deprecated public final Enumeration<? extends FileObject> findAllResources(String name)
name
- name of the resourceFileObject
s@Deprecated public final Enumeration<? extends FileObject> findAll(String aPackage, String name, String ext)
FileSystem.find(java.lang.String, java.lang.String, java.lang.String)
.aPackage
- package name where each package is separated by a dotname
- name of the file (without dots) or null
if
one wants to obtain the name of a package and not a file in itext
- extension of the file or null
if one needs
a package and not a file nameFileObject
s@Deprecated public final void addRepositoryListener(RepositoryListener list)
list
- the listener@Deprecated public final void removeRepositoryListener(RepositoryListener list)
list
- the listener@Deprecated public final void addFileChangeListener(FileChangeListener fcl)
Repository.getDefaultFileSystem()
.fcl
- the listener@Deprecated public final void removeFileChangeListener(FileChangeListener fcl)
Repository.getDefaultFileSystem()
.fcl
- the listener