<questionid="arch-what"> Whatisthisprojectgoodfor? <hint> Pleaseprovideherefewlinesdescribingthetheproject, whatproblemitshouldsolve,providelinkstodocumentation, specifications,etc. </hint> </question>
-->
<answer id="arch-what">
Settings are persistent objects with a set of properties, that should be available via lookup.
Properties are expected to be changed. Implementation of setting doesn't care about persistence issues, which
is responsibility of settings infrastructure. XML persistence support is provided in a standalone autoload module core-settings.jar.
Also service types must be mentioned here.
Service type can be desribed as typed a named settings.
<ul>
<li>
<api group="java" name="SettingsAPI"type="export" category="official"url="@org-openide-util-ui@/org/openide/util/doc-files/api.html#settings"/>
</li><li>
<api group="java" name="ServicesAPI"type="export" category="official"url="@org-openide-util-ui@/org/openide/util/doc-files/api.html#service-lookup"/>
</li><li>
<api group="java" name="XmlSettingsPersistence"type="export" category="official"url="@org-netbeans-modules-settings@/org/netbeans/spi/settings/package-summary.html"/>
</li>
</ul>
</answer>
<!-- <questionid="deploy-jar"> DoyoudeployjustmoduleJARfile(s)orotherfilesaswell? <hint> IfyourmoduleconsistjustfromonemoduleJARfile,justconfirmthat. IfitusesmorethanoneJAR,describewheretherearelocated,how theyrefertoeachother. IfitconsistofmoduleJAR(s)andotherfiles,pleasedescribe whatistheirpurpose,whyotherfilesarenecessary.Please makesurethatinstallation/deinstallationleavesthesystem instateasitwasbeforeinstallation. </hint> </question>
-->
<answer id="deploy-jar">
Complicated.
Instead of <code>ServiceType</code> can be used arbitrary object , that
cooperate with convertor. Infrastracture for convertos is in <samp>core-settings.jar</samp>.
</answer>
<!-- <questionid="deploy-nbm"> CanyoudeployanNBMviatheUpdateCenter? <hint> Ifnotwhy? </hint> </question>
-->
<answer id="deploy-nbm">
<samp>openide.nbm</samp> and <samp>core.nbm</samp>) are reachable via the Update Center .
</answer>
<!-- <questionid="deploy-packages"> Arepackagesofyourmodulemadeinaccessiblebynotdeclaringthem public? <hint> NetBeansmodulesystemallowsrestrictionofaccessrightsto publicclassesofyourmodulefromothermodules.Thisprevents unwanteddependenciesofothersonyourcodeandshouldbeused wheneverpossible(<ahref="http://www.netbeans.org/download/apis/org/openide/doc-files/upgrade.html#3.4-public-packages"> publicpackages </a>). </hint> </question>
-->
<answer id="deploy-packages">
<code>ServiceType</code> is publicly accessible.
The settings infrastructure resides in core
and is considered private except <code>InstanceDataObject</code> which is in Datasystems, which
is public. Infrastracture for convertos is in <samp>core-settings.jar</samp> exposes some packages explicitly declaring them in manifest,
which means that all other packages are inaccessible.
</answer>
<!-- <questionid="deploy-shared"> Doyouneedtobeinstalledinthesharedlocationonly,orintheuserdirectoryonly, orcanyourmodulebeinstalledanywhere? <hint> Installationlocationshallnotmatter,ifitdoesexplainwhy. Consideralsowhether<code>InstalledFileLocator</code>canhelp. </hint> </question>
-->
<answer id="deploy-shared">
<samp>openide.jar</samp> and <samp>core.jar</samp> must be in the shared location as it is part of the core of NetBeans.
<samp>core-settings.jar.jar</samp> can be anywhere.
</answer>
<!-- <questionid="exec-privateaccess"> Areyouawareofanyotherpartsofthesystemcallingsomeof yourmethodsbyreflection? <hint> Ifso,describethe"contract"asanAPI.Likelyprivateorfriendone,but stillAPIandconsiderrewriteofit. </hint> </question>
-->
<answer id="exec-privateaccess">
There are method invocations between parts of setting infrastructure.
<ul>
<li>
If there is created new persistent instance of setting object in the runtime,
then <code>InstanceDataObject</code> that comes from <samp>openide.jar</samp>, calls
method responsible for storing setting on disk. This method is expected to have
following decaration <code>public void methodName (java.io.Writer w, Object inst)</code>. Which
method and from which module is invoked depends on configuration.
</li>
<li>
If new persistent instances of setting was created, then infrastructure must be notified about it, to be able to listen
on changes and ensure , that all changes will be stored. Then from <code>InstanceDataObject</code>
is used <code>Lookup</code> to find <code>InstanceCookie</code>. Then method <code>setInstance</code>
is invoked on instance of <code>InstanceCookie</code>. This binds instance of setting to setting infrastructure.
Which <code>Lookup</code> and then also which <code>InstanceCookie</code> is used depends again on configuration.
<a href="@org-netbeans-modules-settings@/org/netbeans/spi/settings/package-summary.html">description of configuration</a>.
</li>
<li>
Also org.openide.util.SharedClassObject.reset is called from org.netbeans.modules.settings.convertors.XMLSettingsSupport.SettingsRecognizer.
</li>
</ul>
</answer>
<!-- <questionid="exec-property"> Isexecutionofyourcodeinfluencedbyanyenvironmentor Javasystem(<code>System.getProperty</code>)property? <hint> Ifthereisapropertythatcanchangethebehaviourofyour code,somebodywilllikelyuseit.Youshoulddescribewhatitdoes andthestabilitycategoryofthisAPI.Youmayuse <pre> <propertyname="id"category="private"> descriptionoftheproperty,whereitisused,whatitinfluence,etc. </property> </pre> </hint> </question>
-->
<answer id="exec-property">
Neither java system nor (<code>System.getProperty</code>) property. But attributes
attached to <code>FileObject</code> are used for configuration. This configuration is too complex
and can't be separated from entity registration and so on. So, here is
<a href="@org-netbeans-modules-settings@/org/netbeans/spi/settings/package-summary.html#use-own">
description of configuration</a>.
</answer>
<!-- <questionid="exec-reflection"> DoesyourcodeuseJavaReflectiontoexecuteothercode? <hint> ThisusuallyindicatesamissingorunsufficientAPIintheother partofthesystem.Iftheothersideisnotawareofyourdependency thiscontractcanbeeasilybroken. </hint> </question>
-->
<answer id="exec-reflection">
Yes reflection is used heavily.
<ul>
<li>
There is used reflection to create new instance of setting. Either direcltly <code>newInstance</code> or factory method, that
is defined in setting <a href="http://www.netbeans.org/dtds/sessionsettings-1_0.dtd"> file</a>.
</li>
<li>
Setting infrastructure registers its
own PropertyChangeListener to know about changes and calls <code>addPropertyChangeListener </code> on
setting instances. There is also called pair method <code> removePropertChangeListener</code>.
</li>
<li>
For synchronization of file name with instance name is called on setting instance method <code>getDisplayName</code> and
<code>getName</code>.
</li>
<li>
If <code>XMLPropertiesConvertor</code> is used for settings based on xml with grammar defined by
<a href="http://www.netbeans.org/dtds/properties-1_0.dtd">
<code>-//NetBeans org.netbeans.modules.settings.examples//DTD XML ProxySettings 1.0//EN</code></a>, then methods
<code>readProperties</code> and <code>writeProperties</code> is used on instance of setting.
</li></ul>
</answer>
<!-- <questionid="format-clipboard"> Whichdataflavors(ifany)doesyourcodereadfromorinsertto theclipboard? </question>
-->
<answer id="format-clipboard">
No special implementation.
</answer>
<!-- <questionid="format-dnd"> Whichprotocols(ifany)doesyourcodeunderstandduringDrag&Drop? </question>
-->
<answer id="format-dnd">
No special implementation.
</answer>
<!-- <questionid="lookup-lookup"> Doesyourmoduleuse<code>org.openide.util.Lookup</code> tofindanycomponentstocommunicatewith?Whichones? <hint> Pleasedescribetheinterfacesyouaresearchingfor,where aredefined,whetheryouaresearchingforjustoneormoreofthem, iftheorderisimportant,etc.Alsoclasifythestabilityofsuch APIcontract. </hint> </question>
-->
<answer id="lookup-lookup">
<ul>
<li>
In <code>InstanceDataObject.createSettingsFile</code> is looked up <code>ServiceType.Registry</code> to be sure,
that ServiceType is unique.
</li>
<li>
Also <code>ClassLoader</code> is looked up often to find <code>ModuleManager.SystemClassLoader</code> .
</li>
</ul>
</answer>
<!-- <questionid="lookup-register"> Doyouregisteranythingintolookupforothercodetofind? <hint> Doyouregisterusinglayerfileorusing<code>META-INF/services</code>? Whoissupposedtofindyourcomponent? </hint> </question>
-->
<answer id="lookup-register">
Yes. There is registered <code>Environment.Provider</code> which is ultimately
used to provide <code>Lookup</code>, that provides <code>InstanceCookie</code>.
This is a second way how can mainly <code>InstanceDataObject</code> call
outside implementation (first one are method calls by reflection).
</answer>
<!-- <questionid="perf-menus"> Doesyourmoduleusedynamicallyupdatedcontextmenus,or context-sensitiveactionswithcomplicatedenablementlogic? </question>
-->
<answer id="perf-menus">
No
</answer>
<!-- <questionid="perf-progress"> Doesyourmoduleexecuteanylong-runningtasks? <hint>Typicallytheyaretaskslikeconnectingover network,computinghugeamountofdata,compilation. Suchcommunicationshouldbedoneasynchronously(forexample using<code>RequestProcessor</code>),definitivelyitshould notblockAWTthread. </hint> </question>
-->
<answer id="perf-progress">
No. Perhaps if ToolsOption is showed, then createing of nodes defined
in UI/Services may take relatively enough time, but not sure if this should be
considered as part of setting infrastructure.
</answer>
<!-- <questionid="perf-scale"> Whichexternalcriteriainfluencetheperformanceofyour program(sizeoffileineditor,numberoffilesinmenu, insourcedirectory,etc.)andhowwellyourcodescales? Pleaseincludesomeestimates. </question>
-->
<answer id="perf-scale">
Not completely relevant questin in this case. There is not so much important how many settings will be defined,
but how heavily will be used.
</answer>
<!-- <questionid="perf-startup"> Doesyourmodulerunanycodeonstartup? </question>
-->
<answer id="perf-startup">
No. Instances are provided on request, the same is true for activity of infrastructure.
</answer>
<p></p>
Provided folderes:
<ul>
<li><api name="RuntimeInstancesRegistry" group="layer"type="export" category="official"url="@org-netbeans-modules-settings@/org/netbeans/spi/settings/package-summary.html#use-memory">
<b>xml/memory</b>: Associates runtime instance with environment provider. </api><p></p></li>
<li><api name="ServicesDisplayRegistry" group="layer"type="export" category="official"url="@org-openide-util-ui@/org/openide/util/doc-files/api.html#lookup-ui">
<b>UI/Services</b>: The root folder for displaying options in the deprecated Advanced dialog.</api><p></p></li>
</ul>
</answer>
<!-- <questionid="resources-mask"> Doesyourmodulemask/hide/overrideanyresourcesprovidedbyothermodulesin theirlayers? <hint> Ifyoumaskafileprovidedbyanothermodule,youprobablydepend onthatanddonotwanttheothermoduleto(forexample)change thefile'sname.ThatmoduleshallthusmakethatfileavailableasanAPI ofsomestabilitycategory. </hint> </question>
-->
<answer id="resources-mask">
Yes <samp>core-settings.jar</samp> override <samp>xml/lookup/Netbeans/DTD_Session_settings_1_0.instance</samp> in
<samp>core.jar</samp> and mainly its attributes. So, if is <samp>core-settings.jar</samp> present, then take over functionality of settings
infrastructure implemented in <samp>core.jar</samp>.
</answer>
<!-- <questionid="resources-read"> Doesyourmodulereadanyresourcesfromlayers?Forwhatpurpose? <hint> Asthisissomekindofintermoduledependency,itisakindofAPI. Pleasedescribeitandclasifyaccordingto <ahref="http://openide.netbeans.org/tutorial/api-design.html#categories"> commonstabilitycategories</a>. </hint> </question>
-->
<answer id="resources-read">
Many times mentioned in this document. See
<a href="@org-netbeans-modules-settings@/org/netbeans/spi/settings/package-summary.html"> this document</a>.
</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.