Apache
Home » Documentation » Bundles

Accessing Filesystem Resources (org.apache.sling.fsresource)

Introduction

The Filesystem Resource Provider provides access to the operating system's filesystem through the Sling ResourceResolver. Multiple locations may be mapped into the resource tree by configuring the filesystem location and the resource tree root path for each location to be mapped.

To activate this feature, install the org.apache.sling.fsresource bundle. You can get it from the Sling downloads page or build it yourself from the source code found under bundles/extensions/fsresource.

Resource Types

Files and directories are mapped into the resource tree as regular Resource instances whose resource type depends on the actual nature of the mapped filesystem resource:

Adapters

Filesystem resources extend from Sling's AbstractResource class and thus are adaptable to any type for which an AdapterFactory is registered supporting file system resources. In addition Filesystem Resources support the following adapters natively:

Configuration

The Filesystem Resource Provider is configured with OSGi Configuration Admin factory configurtions whose factory PID is org.apache.sling.fsprovider.internal.FsResourceProvider. Configuration can be managed using the OSGi Configuration Admin API, through the Web Console or by any other means supporting Configuration Admin configurations.

The following configuration properties must be specified:

Parameter Name Description
Provider Root provider.roots Location in the virtual resource tree where the filesystem resources are mapped in. This property must not be an empty string.
Filesystem Root provider.file Filesystem directory mapped to the virtual resource tree. This property must not be an empty string. If the path is relative it is resolved against sling.home or the current working directory. The path may be a file or folder. If the path does not address an existing file or folder, an empty folder is created.
Rev. 1484687 by bdelacretaz on Tue, 21 May 2013 08:12:24 +0000
Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.