Hi all,
In SLING-583 I propose ResourceProvider to access filesystem resources
and also committed an initial version of it to the samples/fsprovider
folder in trunk.
Regards
Felix
[1] https://issues.apache.org/jira/browse/SLING-583
PS: From the issue:
The idea is to implement a ResourceProvider to access files and folders
in the platform filesystem through the virtual Resource tree. This
functionality will serve multiple purposes: (1) It shows how to
implement a ResourceProvider easily, (2) supports simple development and
(3) may be used for support.
The following use cases for such a resource provider exist (maybe more):
Rapid Development
-----------------------
The goal is to implement a Sling application, where the scripts are not
stored in the repository but will be loaded from the OSGi bundle which
is part of the application. Without filesystem resource provider, the
scripts have to be stored in the bundle from the start or be stored in
the repository and moved to the bundle later. The first approach is
tedious as it requires bundle-redeployment on each script change and the
second is tedious as it is easy to forget about copying the file out of
the repository into the bundle when done.
With the filesystem resource provider, the scripts may be developed with
your favourite IDE, persisted at the exact location, you later use them
anyway (for bundle inclusion or source control system), that is your
project location. You simply create a configuration for the filesystem
provider, which maps the scripts into the resource tree at the exact
same location you will later provide them in the bundle.
Each change in the script through the IDE is immediately visible in Sling.
Support
---------
Have you ever wanted to access the sling log file of a remote server ?
Or wanted to inspect the actual sling.properties file ? Or even wanted
to have a look at the actual Configuration Admin configuration files ?
The filesystem resource provider is your friend: Create a configuration
mapping sling.home into the resource tree and start looking at it.
Simple Remote Filesystem Browsing
------------------------------------------
Browsing the remote filesystem was at the beginning of this idea: I have
tons of pictures, I would like to access in a Sling application. Instead
of copying all pictures into the repository (something, which might make
sense in the future, but not now), the filesystem resource provider
allows mapping the folder containing the pictures into the resource tree
view.....