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 Wed, 18 Nov 2009 08:38:00 GMT
    <base href="">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=SLINGxSITE&amp;forWysiwyg=true"
<body style="background-color: white" bgcolor="white">
<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>added</b> by             <a href="">Felix
    <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>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

	<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://"
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>

<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=";showCommentArea=true#addcomment">Add

View raw message