<!-- <questionid="arch-what"> Whatisthisprojectgoodfor? <hint> Pleaseprovidehereafewlinesdescribingtheproject, whatproblemitshouldsolve,providelinkstodocumentation, specifications,etc. </hint> </question>
-->
<answer id="arch-what">
In summary, the <api name="LoadersAPI" group="java"type="export" category="official"url="@TOP@org/openide/loaders/doc-files/api.html" />
is responsible for scanning files in a directory on disk,
weeding out irrelevant files of no interest to the IDE,
and grouping the rest into logical chunks, or just determining
what type of data each represents. It does this scanning by asking each registered
data loader whether or not the given file(s) should be handled. The first
loader to recognize a file takes ownership of it, and creates a matching data object to represent it to the rest of the IDE.
</answer>
<answer id="arch-usecases" >
A lot of usecases is described <a href="@TOP@/org/openide/loaders/doc-files/api.html" >in the javadoc</a>. Here
is the list of some faqs:
<usecase id="loaders-script" name="Using Scripting and Templating Languages" >
<p>
Often many people require ability to create a "clever" template - e.g.
write piece of simple text and at the time of its
<a href="@TOP@/org/openide/loaders/DataObject.html#createFromTemplate(org.openide.loaders.DataFolder,java.lang.String,java.util.Map)">
processing
</a>
do some advanced changes to it using either
<a id="loaders-script">scripting or templating</a> languages.
</p>
<p>
This traditionally used to be a bit complicated task, however since version6.1 there are new interfaces
<api name="org.openide.loaders.CreateFromTemplateHandler" category="deprecated" group="lookup"type="export" url="@TOP@/org/openide/loaders/CreateFromTemplateHandler.html">
can be registered as a services in a lookup and it is reponsible
for handling the whole copy of the template file(s) to the destination
folder.
</api> and
<api name="org.openide.loaders.CreateFromTemplateAttributesProvider" category="deprecated" group="lookup"type="export" url="@TOP@/org/openide/loaders/CreateFromTemplateAttributesProvider.html">
can be registered as a services in a lookup and it is reponsible
for providing "hints" - e.g. map mapping strings to various objects.
</api> and these interfaces allow anyone to extend the behaviour during
creation of new files without writing new
<a href="@TOP@/org/openide/loaders/DataLoader.html">DataLoader</a> and co.
</p>
<p>
The support was moved to a new module; please see <a href="@org-netbeans-api-templates@/architecture-summary.html">api.templates</a>
module for more information.
</p>
</usecase>
<usecase id="add-action-to-folder" name="How to add action to folder's popup menu?" >
<api name="Loaders-folder-any-Actions" category="stable" group="layer"type="export" >
The actions that the default folder loader shows in its popup menu are read from
a layer folder <code>Loaders/folder/any/Actions</code>
so if any module wishes
to extend, hide or reorder some of them it can just register its actions there.</api>
As code like this does:
<pre>
<folder name="Loaders" >
<folder name="folder" >
<folder name="any" >
<folder name="Actions" >
<file name="org-mymodule-MyAction.instance" >
<attr name="instanceCreate" stringvalue="org.mymodule.MyAction" />
</file>
</folder>
</folder>
</folder>
</folder>
</pre>
As described in general <a href="@org-openide-actions@/org/openide/actions/doc-files/api.html#adv-install">
actions registration tutorial</a>.
<p/>
This functionality is available since version5.0 of the loaders module. Please use
<code>OpenIDE-Module-Module-Dependencies: org.openide.loaders > 5.0</code> in your
module dependencies.
<p>
In version5.8 all the standard loaders were changed to read actions
from layer:
</p>
<ul>
<li><api name="Loaders-text-xml-Actions" category="stable" group="layer"type="export" >
The actions that the standard XML loader shows in its popup menu are read from
a layer folder <code>Loaders/text/xml/Actions</code></api></li>
<li><api name="Loaders-content-unknown-Actions" category="stable" group="layer"type="export" >
The actions that the loader for unrecognized files shows in its popup menu are read from
a layer folder <code>Loaders/content/unknown/Actions</code></api></li>
<li><api name="Loaders-application-x-nbsettings-Actions" category="stable" group="layer"type="export" >
The actions that the loader for instance and settings files shows in its popup menu are read from
a layer folder <code>Loaders/application/x-nbsettings/Actions</code></api></li>
</ul>
</usecase>
<usecase id="let-others-to-add-actions-to-loader" name="How to allow others to enhance actions of your loader?" >
If you want other modules to enhance or modify actions that are visible on
<code>DataObject</code>s produced by your <code>DataLoader</code> and you
are either using <code>DataNode</code> or its subclass, you can just override
<code>protected String actionsContext()</code> method to return non-null
location of context in layers from where to read the actions.
<p/>
The usual value should match <code>Loaders/mime/type/Actions</code> scheme,
for example java is using <code>Loaders/text/x-java/Actions</code>, but
the name can be arbitrary.
<p/>
This functionality is available since version5.0 of the loaders module. Please use
<code>OpenIDE-Module-Module-Dependencies: org.openide.loaders > 5.0</code> in your
module dependencies.
</usecase>
</answer>
<questionid="dep-non-nb"> Whatothernon-NetBeansprojectsthisonedependson? <hint> Somenon-NetBeansprojectsarepackagedasNetBeansmodules and itispreferedtousethisapproachwhenmoremodulesmay dependonsuchthird-partylibrary. </hint> </question>
-->
<answer id="dep-non-nb">
It does not depend on any external library.
</answer>
<!-- Question: dep-platform
<questionid="dep-platform"> Onwhichplatformsyourmodulerun?Any?Doesitruninthesame way? </question>
-->
<answer id="dep-platform">
It runs on any platform.
</answer>
<!-- Question: deploy-jar
<questionid="deploy-jar"> DoyoudeployjustmoduleJARfile(s)orsomeotherfiles? </question>
-->
<answer id="deploy-jar">
Data Systems are integral part of openide.jar.
</answer>
<!-- Question: deploy-nbm
<questionid="deploy-nbm"> CanyoudeployNBMviaAutoUpdatecenter? </question>
-->
<answer id="deploy-nbm">
Yes. openide.jar can be deployed via AutoUpdate.
</answer>
<questionid="deploy-shared"> Doyouneedtobeinstalledinsharedlocationoronlyinuserdirectory? </question>
-->
<answer id="deploy-shared">
openide.jar needs to be in the system directory.
</answer>
<questionid="exec-component"> Isexecutionofyourcodeinfluencedby(string)property ofanyofyourcomponents? </question>
-->
<answer id="exec-component">
The data system stores some of its vital information in file attributes. Those
attributes are accessible via calls to
org.openide.filesystems.FileObject.getAttribute(name)
org.openide.filesystems.FileObject.setAttribute(name, value)
They can also be stored in the module layer. Please see filesystems
for more information about this.
<api type="export" group="property" name="NetBeansAttrAssignedLoader" category="stable" >
Extended attribute for holding the class of the loader that should
be used to recognize a file object before the normal processing takes
place.
</api>
<api type="export" group="property" name="NetBeansAttrAssignedLoaderModule" category="private" >
Extended attribute which may be used in addition to EA_ASSIGNED_LOADER
which indicates the code name base of the module that installed that preferred
loader. If the indicated module is not installed, ignore the loader request.
See #13816.
</api>
<api type="export" group="property" name="template" category="stable" >
If set to Boolean.TRUE the file is recognized as template and
its instantiation is allowed.
</api>
<!-- TemplateWizard: -->
<api type="export" group="property" name="isRemoteAndSlow" category="friend">
If the file attribute <code>isRemoteAndSlow</code> is <code>true</code> on a folder,
the New File wizard will avoid asking for its children.
</api>
<api type="export" group="property" name="templateWizardURL" category="stable" >
Attribute that defines a template wizard description page (type <code>URL</code> to HTML).
</api>
<api type="export" group="property" name="templateWizardIterator" category="stable" >
Attribute that defines a custom template wizard iterator (type <code>TemplateWizard.Iterator</code>).
</api>
<!-- DataShadow: -->
<api type="export" group="property" name="originalFile" category="stable" >
Path to the target file in its filesystem (type <code>String</code>).
</api>
<api type="export" group="property" name="originalFileSystem" category="stable" >
System name of filesystem of target file (type <code>String</code>; default is same as that of shadow).
</api>
<api type="export" group="property" name="UseOwnName" category="private" >
if true, the DataShadow name is used instead of original's name,
affects DataShadows of filesystem roots only
</api>
<api type="export" group="property" name="simple" category="stable" >
templates and folders under <code>Templates/</code>
folder can be annotated with <attr name="simple" boolvalue="false"<
if they are supposed to be hidden in <em>Template Manager</em>.
If a folder is annotated with this attribute, it is also hidden
in standard <em>New File wizard</em>.
</api>
<!-- FolderOrder: -->
<api type="export" group="property" name="PartialOrders" category="stable" >
Read the list of intended partial orders from disk.
Each element is a string of the form <samp>a/b</samp> for <samp>a</samp>, <samp>b</samp> filenames
with extension, where <samp>a</samp> should come before <samp>b</samp>.
The value of the attribute must be of type <code>Boolean</code>; ignored unless <code>true</code>.
</api>
<!-- DataFolder: -->
<api type="export" group="property" name="OpenIDE-Folder-SortMode" category="private" >
Extended attribute for order of children. The values
are "F", "N", "C", "0" (type <code>String</code>).
</api>
<api type="export" group="property" name="OpenIDE-Folder-Order" category="private" >
Extended attribute for order of children - stores list
of file names separated by '/' (type <code>String</code>).
</api>
<!-- FolderChildren -->
<api type="export" group="systemproperty" name="org.openide.loaders.FolderChildren.delayedCreation" category="devel">
<p>
Since 7.25 the <code>DataFolder.getNodeDelegate()</code> tries to prevent
creation of <a href="@TOP@/org/openide/loaders/DataObject.html">DataObject</a>
in AWT dispatch thread. Rather it creates dummy node with name
derived from the name of the file and simplified content of lookup:
</p>
<ul>
<li><a href="@org-openide-filesystems@/org/openide/filesystems/FileObject.html">FileObject</a>
- the file that the node represents</li>
<li><a href="@org-openide-nodes@/org/openide/nodes/Node.html">Node</a>
- the node itself, but without any important properties</li>
<li><a href="@TOP@/org/openide/loaders/DataObject.html">DataObject</a>
- created on the fly, very <b>inefficient</b>, if requested from
AWT dispatch thread, it prints a warning. Consider using
just <a href="@org-openide-filesystems@/org/openide/filesystems/FileObject.html">FileObject</a>.</li>
</ul>
<p>
The creation of real node is scheduled to background and as soon as
the
<a href="@TOP@/org/openide/loaders/DataObject.html">DataObject</a>
and its
<a href="@org-openide-nodes@/org/openide/nodes/Node.html">Node</a> are
ready, the initial dummy node is replaced by the real one.
</p>
<p>
This whole system is slightly incompatible and may complicate creation
of filtered views over the node hierarchy (one needs to be ready to
really dynamics changes). That is why it is possible to disable
the new <q>delayed</q> system by starting the system with
<code>-Dorg.openide.loaders.FolderChildren.delayedCreation=false</code>.
Use this property as a temporary fix for your problems, but consider
fixing your code to support the <q>delayed mode</q> in the future.
</p>
</api>
<!-- ConnectionSupport: -->
<api type="export" group="property" name="EA-OpenIDE-Connection" category="private" >
Extended attribute to store (ArrayList of Type and Node.Handle).
Used by Java synchronization feature at least; generally, <code>ConnectionCookie</code>.
</api>
<api type="export" group="property" name="DataFolder.Index.reorderable" category="friend">
If set to <code>Boolean.TRUE</code> on a folder not in the system filesystem, make its node reorderable.
</api>
<api type="import" group="property" name="expectedTime" category="friend" >
When the DataObject is moved to new location, we
we need to adjust the time to the new file object.
<a href="@org-openide-text@/org/openide/text/CloneableEditorSupport.html">CloneableEditorSupport</a>
exports special "expectedTime" property for this purpose. Tested
in <code>DataEditorSupportTest.testChangeFileWhileOpen</code>.
</api>
</answer>
<!-- Question: exec-property
<questionid="exec-property"> Isexecutionofyourcodeinfluencedbyanyenvironmentof system(<code>System.getProperty</code>)property? </question>
-->
<answer id="exec-property"> <!-- XMLDataObject: -->
<api type="import" group="property" name="org.xml.sax.driver" category="private" >
This is a standard way to find a class of a SAX2 driver. See
<a href="http://www.saxproject.org"> SAX2 documentation </a>
</api>
<api type="import" group="property" name="netbeans.profile.memory" category="private" >
Boolean.TRUE means to dettach from shared impl of parser, it is static!?
</api>
<api type="export" group="systemproperty" name="org.openide.loaders.FolderList.refresh.interval" category="private" >
The value of type integer determines the number of milliseconds
between successive refreshes of contents of a folder. Can be used to tweak
performance of folder refresh. Defaults to 10.
</api>
<api group="systemproperty" category="friend" name="netbeans.dataobject.insecure.operation"type="export" >
If set to <b>true</b>, the <code>DataObject.copy, move, createFromTemplate</code>
are executed in insecure way. That means that other threads can access the
products of such operation before it finishes. This is a friend contract
with projects, that need to do such strange things. Will be removed when they
fix it.
</api>
<api group="javax.swing.UIManager" category="devel" name="Nb.Explorer.Folder.icon"type="export" >
Icon or Image for closed folder.
</api>
<api group="javax.swing.UIManager" category="devel" name="Nb.Explorer.Folder.openedIcon"type="export" >
Icon or Image for opened folder.
</api>
<api group="javax.swing.UIManager" category="devel" name="Tree.openedIcon"type="export" >
Fallback Icon or Image for opened folder.
</api>
<api group="javax.swing.UIManager" category="devel" name="Tree.closedIcon"type="export" >
Fallback Icon or Image for folder.
</api>
<api group="property" category="stable" name="wizard.anything"type="export" >
When <a href="@TOP@/org/openide/loaders/TemplateWizard.html">TemplateWizard</a> invokes
<a href="@TOP@/org/openide/loaders/DataObject.html">DataObject</a>.createFromTemplate,
it passes as argument all its <a href="@org-openide-dialogs@/org/openide/WizardDescriptor.html#getProperties()">properties</a>
to it with prefix <code>wizard.</code>. That way they are available to
underlaying <a href="@TOP@/architecture-summary.html#loaders-script">scripting and templating
engines</a>.
</api>
<api name="org.netbeans.modules.openide.loaders.ASK_OnSaving" group="branding"type="export" category="stable">
Control on save yes/no dialog in
<a href="@TOP@/org/openide/text/DataEditorSupport.html">DataEditorSupport</a>
by setting the <code>ASK_OnSaving</code> key in
<code>org/netbeans/modules/openide/loaders/Bundle.properties</code>
to <code>yes</code> or <code>no</code> in a branding file in your application.
</api>
<api name="org.netbeans.modules.openide.loaders.ASK_OnClosing" group="branding"type="export" category="stable">
Control on close yes/no dialog in
<a href="@TOP@/org/openide/text/DataEditorSupport.html">DataEditorSupport</a>
by setting the <code>ASK_OnClosing</code> key in
<code>org/netbeans/modules/openide/loaders/Bundle.properties</code>
to <code>yes</code> or <code>no</code> in a branding file in your application.
</api>
</answer>
<!-- Question: format-clipboard
<questionid="format-clipboard"> Whichprotocolsyourcodereads/insertswhencommunicatingwith clipboard? </question>
-->
<answer id="format-clipboard">
We use following MIME type:
application/x-java-openide-dataobjectdnd;class=org.openide.loaders.DataObject;mask={0}
</answer>
<!-- Question: format-dnd
<questionid="format-dnd"> Whichprotocolsyourcodeunderstandsduringdrag-n-drop? </question>
-->
<answer id="format-dnd">
We use following MIME type:
application/x-java-openide-dataobjectdnd;class=org.openide.loaders.DataObject;mask={0}
</answer>
<!-- Question: format-types
<questionid="format-types"> Whichfileformatsyourcodereadsorwritesondisk? </question>
-->
<answer id="format-types">
Any file format.
</answer>
<!-- Question: lookup-lookup
<questionid="lookup-lookup"> Doesyourmoduleused<code>org.openide.util.Lookup</code> tofindanycomponentstocommunicateto?Whichones? </question>
-->
<answer id="lookup-lookup">
<ul>
<li>DataLoaderPool.class </li>
<li>ActionManager.class</li>
<li>(in XMLDataObject) Node.Cookie.class</li>
<li>RepositoryNodeFactory.class</li>
<li>ModuleInfo.class</li>
<li>ClassLoader.class</li>
</ul>
<p>
If there is no <code>DataLoaderPool</code> available in default
lookup, the fallback is to use a simple loader pool that contains
just the fixed <q>system</q> loaders, and any
<code>DataLoader</code>s that can be found in default lookup.
</p>
DataFolder.FolderNode.setName() looks for one instance of org.openide.loaders.FolderRenameHandler.
</answer>
<!-- Question: lookup-register
<questionid="lookup-register"> Doyouregisteranythingintothelookupforothertofind?Whoare theothers? </question>
-->
<answer id="lookup-register">
Registration of
<ul>
<li>DataLoaderPool.class</li>
<li>Environment.Provider.class</li>
<li>RepositoryNodeFactory.class</li>
</ul>
is done in core in META-INF/services.
</answer>
<questionid="perf-progress"> Doesyourmoduleexecutessomelongrunningtask? <hint>Typicallytheyaretaskslikeconnectingover network,computinghugeamountofdata,compilation. Suchcommunicationshouldbedoneasynchronously(forexample using<code>RequestProcessor</code>),definitivelyitshould notblockAWTthread. </hint> </question>
-->
<answer id="perf-progress">
The module uses its own RequestProcessors to handle long running
tasks.
</answer>
<!-- Question: perf-scale
<questionid="perf-scale"> Whichexternalcriteriainfluencetheperformanceofyour program(sizeoffileineditor,numberoffilesinmenu, insourcedirectory,etc.)andhowwellyourcodescales? Pleaseincludesomeestimates. </question>
-->
<answer id="perf-scale">
Performance of some operations
is lineary proportional to number of files in a given
folder times number of registered data loaders in
the pool.
</answer>
<!-- Question: perf-startup
<questionid="perf-startup"> Doesyourmoduleexecutesanythingonstartup? </question>
-->
<answer id="perf-startup">
Yes. The list of loaders is read from the disk to memory.
</answer>
<questionid="resources-layer"> Doesyourmoduleprovideownlayer?Doesitcreatesomefilesor foldersonit?Whatitistryingtocommunicatebythatandwithwhich component? <hint> NetBeansallowsautomaticanddeclarativeinstallationofresources bymodulelayers.Moduleregisterfilesintoappropriateplaces andothercomponentsusethatinformationtoperformtheirtask (buildmenu,toolbar,windowlayout,listoftemplates,setof options,etc.). </hint> </question>
-->
<answer id="resources-layer">
<p>
<api name="Loaders-mime-type-Factories" group="layer"type="export" category="stable" url="@TOP@/org/openide/loaders/doc-files/api.html#register"
>
Loaders are registered in the layer in folder <code>Loaders/mime/type/Factories</code>.
</api>
</p>
<p>
Yes, module creates the folders in layer <samp>org/netbeans/core/ui/resources/layer.xml</samp>
in <samp>core-ui.jar</samp>. The folders are instrumental to store information
about used templates.
<b>Provided folders: </b>
</p>
<ul>
<li>
<api name="PrivilegedTemplates" group="layer"type="export" category="devel">
A folder Privileged offers to other module possibility add own templates.
</api><p></p>
</li>
<li>
<api name="RecentTemplates" group="layer"type="export" category="private">
A folder Recent stores a set of recently used templates, it's not open to other module.
</api><p></p>
</li>
<li>
<api name="Menu" group="layer"type="export" category="stable"><p>
The main menu of the application is composed by reading <code>Menu/</code>
folder in the layer. A sub folder is treated as a sub menu.
Instances of individual files (usually <code>.instance</code>
or <code>.shadow</code>) may then represent <a href="@JDK@@JDKMODULE_JAVA_DESKTOP@/javax/swing/Action.html">Action</a>
or <a href="@JDK@@JDKMODULE_JAVA_DESKTOP@/javax/swing/JMenuItem.html">JMenuItem</a>
or <a href="@JDK@@JDKMODULE_JAVA_DESKTOP@/javax/swing/JSeparator.html">JSeparator</a>.
</p>
<p>
Since version7.44 one can attach <code>property-prefix</code> attribute
to every folder. Then all the file attributes are scanned and if some
of them start with the specified prefix they are placed a
<a href="@JDK@@JDKMODULE_JAVA_DESKTOP@/javax/swing/JComponent.html#putClientProperty(java.lang.Object,java.lang.Object)">
client
properties</a> on the <a href="@JDK@@JDKMODULE_JAVA_DESKTOP@/javax/swing/JMenu.html">JMenu</a>
instance (after stripping the prefix off).
</p>
</api><p></p>
</li>
</ul>
<p>
None of them is forced to found.
</p>
</answer>
<questionid="resources-read"> Doesyourmodulereadanyresourcesfromlayers?Forwhatpurpose? </question>
-->
<answer id="resources-read">
NewTemplateAction reads a list of templates from folders Privileged and Recent.
This list is exposed in a popup menu.
</answer>
<!-- <questionid="arch-overall"when="init"> Describetheoverallarchitecture. <hint> WhatwillbeAPIfor <ahref="http://openide.netbeans.org/tutorial/api-design.html#design.apiandspi"shape="rect"> clientsandwhatsupportAPI</a>? Whatpartswillbepluggable? Howwillplug-insberegistered?Pleaseuse<code><apitype="export"/></code> todescribeyourgeneralAPIsandspecifytheir <ahref="http://openide.netbeans.org/tutorial/api-design.html#category-private"shape="rect"> stabilitycategories</a>. Ifpossiblepleaseprovidesimplediagrams. </hint> </question>
-->
<answer id="arch-overall">
<p>
This module provides API (read <a href="@TOP@org/openide/loaders/doc-files/api.html">more</a>)
that works on top of <a href="@org-openide-filesystems@/overview-summary.html">file objects</a>
and gives each file a logical behaviour - icon, name, operations, etc.
</p>
</answer>
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.