blob: fe99bfba96630c9eacea344a9ee32e302ffc5015 [file] [log] [blame]
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
//
= DevFaqFileSystem
:jbake-type: wiki
:jbake-tags: wiki, devfaq, needsreview
:jbake-status: published
:keywords: Apache NetBeans wiki DevFaqFileSystem
:description: Apache NetBeans wiki DevFaqFileSystem
:toc: left
:toc-title:
:syntax: true
=== What is a FileSystem?
If you use a Unix-based operating system, this concept will be familiar; if not, it may require some explanation.
NetBeans uses link:DevFaqFileObject.asciidoc[virtual files] to refer to the users files on disk, and to refer to its own configuration files. If you used the NetBeans IDE 3.6 or earlier, you may remember that the way you constructed your classpath used to be by "mounting" filesystems - folders on your disk.
Filesystems are gone from the UI, but are alive and well under the hood in NetBeans.
A `FileSystem` is a hierarchical tree of folders and files. A filesystem has a "root folder", which may contain files and other folders. "Files" (link:DevFaqFileObject.asciidoc[FileObjects ]) in a Filesystem may be actual files on disk, or entries in JAR file, or entries in an XML file, or anything else that walks and talks like a file that someone has implemented the Filesystem interface for.
In the NetBeans Platform there are implementations of `FileSystem` for
* plain disk files and folders
* ZIP/JAR files
* XML files in a predefined format ("layers")
* a block of memory with no backing store
* proxies for merging other filesystems with optional behavior overrides
Filesystems are used both to represent user files on disk, and also to represent configuration data internal to NetBeans - the link:DevFaqSystemFilesystem.asciidoc[System Filesystem ]. This is one of the reason that it takes only minimal code to create a GUI view of the system filesystem - the same file recognition code that recognizes user files, gives them actions, icons and display names is what recognizes internal configuration data.
Especially in the case of the System Filesystem, it can be useful to think of a Filesystem as a "namespace" in which objects (which may contain data or represent Java objects) live - for the System Filesystem, the fact that the entries in it are referred to as files is incidental.
As of NetBeans 4.0 you will rarely work directly with the `FileSystem` class. `FileUtil.toFileObject` is the normal way of getting a file object from a disk file. `FileUtil.getArchiveRoot` is the normal way of getting file objects from a JAR or ZIP file. In NetBeans 4.x `FileSystem` implementations are also used for version control integration but the 5.0 CVS support no longer uses this system.
=== Apache Migration Information
The content in this page was kindly donated by Oracle Corp. to the
Apache Software Foundation.
This page was exported from link:http://wiki.netbeans.org/DevFaqFileSystem[http://wiki.netbeans.org/DevFaqFileSystem] ,
that was last modified by NetBeans user Jskrivanek
on 2009-12-03T10:34:33Z.
*NOTE:* This document was automatically converted to the AsciiDoc format on 2018-02-07, and needs to be reviewed.