incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Sling Website > Accessing Filesystem Resources (extensions.fsresource)
Date Wed, 18 Nov 2009 08:38:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=SLINGxSITE&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="http://cwiki.apache.org/confluence/display/SLINGxSITE/Accessing+Filesystem+Resources+%28extensions.fsresource%29">Accessing
Filesystem Resources (extensions.fsresource)</a></h2>
    <h4>Page  <b>added</b> by             <a href="http://cwiki.apache.org/confluence/display/~fmeschbe">Felix
Meschberger</a>
    </h4>
         <br/>
    <div class="notificationGreySide">
         <h1><a name="AccessingFilesystemResources%28extensions.fsresource%29-AccessingFilesystemResources"></a>Accessing
Filesystem Resources</h1>

<div>
<ul>
    <li><a href='#AccessingFilesystemResources%28extensions.fsresource%29-Introduction'>Introduction</a></li>
    <li><a href='#AccessingFilesystemResources%28extensions.fsresource%29-ResourceTypes'>Resource
Types</a></li>
    <li><a href='#AccessingFilesystemResources%28extensions.fsresource%29-Adapters'>Adapters</a></li>
    <li><a href='#AccessingFilesystemResources%28extensions.fsresource%29-Configuration'>Configuration</a></li>
</ul></div>


<h2><a name="AccessingFilesystemResources%28extensions.fsresource%29-Introduction"></a>Introduction</h2>

<p>The Filesystem Resource Provider provides access to the operating system's filesystem
through the Sling <tt>ResourceResolver</tt>. 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.</p>


<h2><a name="AccessingFilesystemResources%28extensions.fsresource%29-ResourceTypes"></a>Resource
Types</h2>

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

<ul>
	<li>Regular files are assigned the <tt>nt:file</tt> resource type</li>
	<li>Directories are assigned the <tt>nt:folder</tt> resource type</li>
</ul>



<h2><a name="AccessingFilesystemResources%28extensions.fsresource%29-Adapters"></a>Adapters</h2>

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

<ul>
	<li><tt>java.io.File</tt> &#8211; The Java file object providing access
to the filesystem file</li>
	<li><tt>java.net.URL</tt> &#8211; A valid <tt><a href="file://"
rel="nofollow">file://</a></tt> URL to the file. This URL is derived from the
<tt>java.io.File</tt> object by calling the <tt>File.toURI().toURL()</tt>
sequence.</li>
	<li><tt>java.io.InputStream</tt> &#8211; If the <tt>java.io.File</tt>
can be read from (as per <tt>File.canRead()</tt> an <tt>InputStream</tt>
to read from the file is returned.</li>
</ul>




<h2><a name="AccessingFilesystemResources%28extensions.fsresource%29-Configuration"></a>Configuration</h2>

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

<p>The following configuration properties must be specified:</p>

<table class='confluenceTable'><tbody>
<tr>
<td class='confluenceTd'> Parameter </td>
<td class='confluenceTd'> Name </td>
<td class='confluenceTd'> Description </td>
</tr>
<tr>
<td class='confluenceTd'> Provider Root	</td>
<td class='confluenceTd'> <tt>provider.roots</tt> </td>
<td class='confluenceTd'> Location in the virtual resource tree where the filesystem
resources are mapped in. This property must not be an empty string. </td>
</tr>
<tr>
<td class='confluenceTd'> Filesystem Root </td>
<td class='confluenceTd'> <tt>provider.file</tt> </td>
<td class='confluenceTd'> 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
<tt>sling.home</tt> 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.
</td>
</tr>
</tbody></table>
    </div>
    <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>
       <a href="http://cwiki.apache.org/confluence/display/SLINGxSITE/Accessing+Filesystem+Resources+%28extensions.fsresource%29">View
Online</a>
              |
       <a href="http://cwiki.apache.org/confluence/display/SLINGxSITE/Accessing+Filesystem+Resources+%28extensions.fsresource%29?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
           </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message