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 Mon, 23 Aug 2010 07:01:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/9/1/_/styles/combined.css?spaceKey=SLINGxSITE&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/SLINGxSITE/Accessing+Filesystem+Resources+%28extensions.fsresource%29">Accessing
Filesystem Resources (extensions.fsresource)</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~mykee">Mike
Mueller</a>
    </h4>
        <br/>
                         <h4>Changes (1)</h4>
                                 
    
<div id="page-diffs">
            <table class="diff" cellpadding="0" cellspacing="0">
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >h2. Adapters <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >Filesystem resources extend from
Sling&#39;s <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">{{SlingAdaptable}}</span>
<span class="diff-added-words"style="background-color: #dfd;">{{AbstractResource}}</span>
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:
<br></td></tr>
            <tr><td class="diff-unchanged" > <br>   * {{java.io.File}} --
The Java file object providing access to the filesystem file <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
        </table>
</div>                            <h4>Full Content</h4>
                    <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>AbstractResource</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://"
class="external-link" 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>

<div class='table-wrap'>
<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>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/SLINGxSITE/Accessing+Filesystem+Resources+%28extensions.fsresource%29">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=5965347&revisedVersion=2&originalVersion=1">View
Changes</a>
                |
        <a href="https://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