What is the System Filesystem?

Apache NetBeans Wiki Index

Note: These pages are being reviewed.

The system filesystem is the central repository for configuration data in NetBeans. It is composed at runtime of a stack of XML layers (DevFaqModulesLayerFile) supplied by modules in the system. Modules use folders in the system filesystem to define extension points - a module can define a folder and document what files or objects (typically instance files: DevFaqInstanceDataObject) other modules can put there, and then, at runtime, scan the contents and do something with the result.

The top layer of the System Filesystem is the config/ subfolder of the user directory. (DevFaqUserDir) That is what makes the System Filesystem read-write - diffs are written there, and there are semantics for programmatically deleting files by creating an empty file called, e.g., TheFile.instance_hidden.

Any type of file can be put into the System Filesystem; what is done with those files is a contract between the module that defines a folder and documents what can be put there, and the modules that put things there. You can use FileUtil.getConfigFile to access entries at runtime.

The same mechanism for file recognition that recognizes user files on disk recognizes files in the system filesystem - so you can put a .java file in the system filesystem, and it can be opened in the editor and edited just as a file on disk can (if saved, it will be written to the user dir on disk, and the newly written file will then be the actual content. In fact, this is why file templates in the IDE can be edited.

Some folders have special meaning to the system, because they are defined by modules that are part of the NetBeans Platform. Some of them are:

  • Actions/ - A global repository for actions in the system, it contains subfolders which categorize actions into ad-hoc categories. This folder supplies raw actions for the Key Bindings part of the Options dialog. If you install actions, the typical pattern is to put an *.instance files here.

  • Menu - The contents of the menu bar in the main window - it has a folder for each menu; subfolders of these represent submenus, and *.instance files represent `Action`s to be shown on the menus.

  • Loaders - Contains subfolders that define mime types (e.g. Loaders/text/x-java) which are used to define various attributes such as popup menu items that should appear when the user right clicks on a file of a given MIME type.

There are several things which affect how objects are used, all or some of which may be specified by a module’s API:

  • The location of a file - a module may define a folder that modules put objects directly into, or request that client modules create subfolders in that folder in cases where the entire path to the file has semantic meaning (see below).

  • The type of the file - very often you will install *.instance files that represent Java objects; typically the module will specify what classes or interfaces objects in a folder should be assignable from.

  • File attributes (DevFaqFileAttributes) - for cases where additional information is required to describe what to do with the files that client modules add to the folder, some optional or mandatory key/value attributes may be specified.

Available documentation on System Filesystem contents

List of files and folders in the system filesystem in NetBeans API Javadoc lists some locations. Feel free to file documentation bugs for modules you know read other locations but which fail to list them in their arch.xml file.

Applies to: NetBeans 6.5 and newer