incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [CONF] Apache Sling Website > Accessing Filesystem Resources (extensions.fsresource)
Date Mon, 23 Aug 2010 07:01:00 GMT
    <base href="">
            <link rel="stylesheet" href="/confluence/s/1810/9/1/_/styles/combined.css?spaceKey=SLINGxSITE&amp;forWysiwyg=true"
<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="">Accessing
Filesystem Resources (extensions.fsresource)</a></h2>
    <h4>Page <b>edited</b> by             <a href="">Mike
                         <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:
            <tr><td class="diff-unchanged" > <br>   * {{}} --
The Java file object providing access to the filesystem file <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
</div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h1><a name="AccessingFilesystemResources%28extensions.fsresource%29-AccessingFilesystemResources"></a>Accessing
Filesystem Resources</h1>

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

<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

<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>

	<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>

<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

	<li><tt></tt> &#8211; The Java file object providing access
to the filesystem file</li>
	<li><tt></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></tt> object by calling the <tt>File.toURI().toURL()</tt>
	<li><tt></tt> &#8211; If the <tt></tt>
can be read from (as per <tt>File.canRead()</tt> an <tt>InputStream</tt>
to read from the file is returned.</li>

<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></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>
<td class='confluenceTd'> Parameter </td>
<td class='confluenceTd'> Name </td>
<td class='confluenceTd'> Description </td>
<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>
<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.

        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href=""
class="grey">Change Notification Preferences</a>
        <a href="">View
        <a href="">View
        <a href=";showCommentArea=true#addcomment">Add

View raw message