org.openide.filesystems 7.3.1

File System API
Official

See:
          Description

File System API
org.openide.filesystems NetBeans internally uses the concept of a virtual filesystem.

 

NetBeans internally uses the concept of a virtual filesystem. This module provide APIs for accessing such virtual files as well as some support classes to make writing of custom vitual filesystems easier.

What is New (see all changes)?

Use Cases

Many of the usecases are described at the overall documentation, in a way how to register a mime type. Some of the additional usecases are covered here.

How to change menus, etc. after login?

Since version 7.1 there is a way to change the content of system file system in a dynamic way. As system file systems contains various definitions (in NetBeans Platform menus, toolbars, layout of windows, etc.) it de-facto allows global change to these settings for example when user logs into some system.

First thing to do is to create an implementation of filesystem. It can be created either from scratch, or by subclassing AbstractFileSystem, or MultiFileSystem. In this example we will subclass the MultiFileSystem:

public class LoginFileSystem extends MultiFileSystem {
    private static LoginFileSystem INSTANCE;
    public LoginFileSystem() {
        // let's create the filesystem empty, because the user
        // is not yet logged in
        INSTANCE = this;
    }
    public static void assignURL(URL u) throws SAXException {
        INSTANCE.setDelegates(new XMLFileSystem(u));
    }
}
      

It is necessary to register this instance in lookup by creating the file:

with a single line containing the full name of your filesystem - e.g. your.module.LoginFileSystem. When done, the system will find out your registration of the filesystem on startup and will merge the content of the filesystem into the default system file system. You can show a dialog letting the user to log in to some system anytime later, and when the user is successfully in, just call LoginFileSystem.assignURL(url) where the URL is an XML file in the same format as used for regular layer files inside of many NetBeans modules. The system will notice the change in the content and notify all the config file listeners accordingly.

Of course, instead of XMLFileSystem you can use for example memory file system, or any other you write yourself.

Exported Interfaces

This table lists all of the module exported APIs with defined stability classifications. It is generated based on answers to questions about the architecture of the module. Read them all...
Group of java interfaces
Interface NameIn/OutStabilitySpecified in What Document?
FilesystemsAPIExportedOfficial .../openide/filesystems/doc-files/api.html

Group of property interfaces
Interface NameIn/OutStabilitySpecified in What Document?
org.openide.filesystems.DefaultAttributes.ATTR_NAME_EXT_XMLExportedPrivate

Name of attribute file can be changed , if .nbattrs can't be used.

org.openide.filesystems.LocalFileSystem.REFRESH_TIMEExportedPrivate

Periodic refresh can be set.

org.openide.filesystems.annotateUnclosedStreamsExportedPrivate

If true, better diagnostic information will be available as to when file input or output streams were opened that prevent a file from being deleted because they were not closed. This information comes at a performance cost, however.

Group of dtd interfaces
Interface NameIn/OutStabilitySpecified in What Document?
attributes-1_0.dtdExportedStable .../www.netbeans.org/dtds/attributes-1_0.dtd

-//NetBeans//DTD DefaultAttributes 1.0//EN

filesystem-1_0.dtdExportedStable .../www.netbeans.org/dtds/filesystem-1_0.dtd

-//NetBeans//DTD Filesystem 1.0//EN

Implementation Details

Where are the sources for the module?

The sources for the module are in NetBeans CVS in openide/fs directory.

What do other modules need to do to declare a dependency on this one, in addition to or instead of a plain module dependency?

XXX no answer for deploy-dependencies

Read more about the implementation in the answers to architecture questions.


org.openide.filesystems 7.3.1

Built on January 29 2008.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.