This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Get rid of deficiencies connected with NetBeans settings infrastructure represented by SystemOption for developers by adopting java Preferences API standard to use in NetBeans as a replacement.
Created attachment 29200 [details] Preferences API in NetBeans
Created attachment 29201 [details] NetBeans specific implementation
Opinions: http://openide.netbeans.org/tutorial/reviews/opinions_73474.html
Created attachment 29230 [details] Motivation
If I'm not wrong this would allow JNLP deployed platform applications to use the JNLP Preferences implementation insteaf of the UserDir implementation of NetBeans, right? If that's true it would be really good so .... in some time .... platform applications can run in the JNLP sandbox without needing all-privileges. When I'm not wrong the UserDir is one of the major stoppers for this. Regards Torsten
Re. last comment: 1. Last I checked, JNLP doesn't provide a special Preferences impl that would work in a sandbox, but this is being worked on (maybe for JDK 7, don't remember). Anyway, if and when Preferences in JNLP is treated sensibly (i.e. made available to all JNLP apps) then that would benefit NB if you omit the NB-specific preferences impl module. This may however break modules relying on default values expressed in the NB impl. 2. Re. use of userdir in a sandbox - see contrib/zeroadmin and ask on dev@openide.netbeans.org for assistance if needed (David Strupl is maintainer of this neat utility).
1.) I thought it works also in JNLP, bad. But it isn't really a stopper for it, as the PreferencesFactory is pluggable. So it can be replaced by a implementation working with JNLP Persistence. Default values can also be handled this way, simply by chaining implementations (requires you know the name of the above implementation). 2.) I already took a look on it. The problem is that it requires remote storage, Preferences or JNLP Persistence or whatever work locally.
JNLP: running NetBeans in restricted environment like sandbox must be considered in wider context than just in implementation of Preferences API. SystemFileSystem is probably the central key to userdir in NetBeans. From this perspective seems to be right decision to implement preferences on top of SystemFileSystem.
Comments on nbdev: http://www.netbeans.org/servlets/BrowseList?list=nbdev&by=thread&from=404125
Created attachment 34793 [details] preferences guide
Created attachment 34854 [details] sligthly modified preferences guide
I have another API use-case: Preferences API will perfectly fit for storing of paths of recently closed files, which I am working on now. See issue 2710 for details.
Created attachment 34855 [details] API change: NbPreferences
I would like to announce that I'm ready to integrate fixes for #77031, #73794 as a part of #73474 into trunk. Integration includes : - NbPreferences API + implementation - support in ide/launcher/upgrade for import systemoptions into preferences - simple view of preferences trees in Runtime tab - extension of arch questions If I don't receive any objection by Tuesday next week, I'm going to integrate it into milestone 4. Issue #77030 (SystemOptions migration) - will be fixed gradually in next milestones. links: http://openide.netbeans.org/tutorial/reviews/opinions_73474.html http://www.netbeans.org/nonav/issues/showattachment.cgi/34854/nbprefs.html http://www.netbeans.org/nonav/issues/showattachment.cgi/34855/apichanges.diff
Can I confirm that in the current impl, Preferences.user/systemRoot() will behave as in any application (using default JDK impl) while NbPreferences always uses the userdir storage? config/Preferences/UserRoot/ can be simplified to just config/Preferences/ I think. "How to migrate from SystemOptions into Preferences API ?" - delete space before '?' in questions, it looks bad. Step #4 should suggest deleting the entire block. BTW step #4 is misindented and missing a final </folder>. Step #6 should say "...if still needed". Step #8 should simply recommend deleting the BeanInfo in most cases. The reference to "deserialization" is misleading (BeanInfo is not even typically used for SystemOption deserialization, just for display). "Hints how to replace SystemOption?" is not a question. Step #2 could be simplified to remove the singleton and just use static methods. In fact you can delete your whole settings class in most cases and just inline the preferences methods into their use points. Step #3: this should not be in the code IMHO. Shouldn't the upgrade tool handle this? "How to document usage of Preferences API?": url="http://java.sun.com/j2se/1.4.2/docs/api/java/util/prefs/Preferences.html" is gratuitous, delete. typo: "emtpy" "How to ensure import from previous version?" : s/overwritten/overridden/ http://www.netbeans.org/source/browse/ide/launcher/upgrade/src/org/netbeans/upgrade/systemoptions/Attic/TaskTagsProcessor.java?rev=1.1.2.2&only_with_tag=preferences_prototype&view=markup and http://www.netbeans.org/source/browse/ide/launcher/upgrade/test/unit/src/org/netbeans/upgrade/systemoptions/Attic/ExampleSettingsTest.java?rev=1.1.2.1&only_with_tag=preferences_prototype&view=markup links will need to be changed when these are merged to trunk.
Modified document according to Jesse's coments and fixed into trunk: /cvs/core/startup/nbproject/project.xml,v <-- project.xml new revision: 1.12; previous revision: 1.11 /cvs/core/startup/src/META-INF/services/org.netbeans.modules.openide.util.PreferencesProvider,v <-- org.netbeans.modules.openide.util.PreferencesProvider new revision: 1.2; previous revision: 1.1 new revision: 1.2; previous revision: 1.1 /cvs/core/startup/src/org/netbeans/core/startup/preferences/NbPreferencesFactory.java,v <-- NbPreferencesFactory.java new revision: 1.2; previous revision: 1.1 /cvs/core/startup/src/org/netbeans/core/startup/preferences/PreferencesProviderImpl.java,v <-- PreferencesProviderImpl.java new revision: 1.2; previous revision: 1.1 /cvs/core/startup/src/org/netbeans/core/startup/preferences/PropertiesStorage.java,v <-- PropertiesStorage.java new revision: 1.2; previous revision: 1.1 /cvs/core/startup/src/org/netbeans/core/startup/preferences/Statistics.java,v <-- Statistics.java new revision: 1.2; previous revision: 1.1 /cvs/core/startup/test/unit/src/org/netbeans/core/startup/preferences/NbPreferencesTest.java,v <-- NbPreferencesTest.java new revision: 1.2; previous revision: 1.1 /cvs/core/startup/test/unit/src/org/netbeans/core/startup/preferences/PreferencesProviderImplTest.java,v <-- PreferencesProviderImplTest.java initial revision: 1.1 /cvs/core/startup/test/unit/src/org/netbeans/core/startup/preferences/TestFileStorage.java,v <-- TestFileStorage.java new revision: 1.2; previous revision: 1.1 /cvs/core/startup/test/unit/src/org/netbeans/core/startup/preferences/TestNbPreferencesFactory.java,v <-- TestNbPreferencesFactory.java new revision: 1.2; previous revision: 1.1 /cvs/core/startup/test/unit/src/org/netbeans/core/startup/preferences/TestPreferences.java,v <-- TestPreferences.java new revision: 1.2; previous revision: 1.1 /cvs/core/startup/test/unit/src/org/netbeans/core/startup/preferences/TestPropertiesStorage.java,v <-- TestPropertiesStorage.java new revision: 1.2; previous revision: 1.1 /cvs/ide/golden/impl-deps.txt,v <-- impl-deps.txt new revision: 1.50; previous revision: 1.49 /cvs/ide/launcher/upgrade/nbproject/project.xml,v <-- project.xml new revision: 1.10; previous revision: 1.9 /cvs/ide/launcher/upgrade/src/org/netbeans/upgrade/AutoUpgrade.java,v <-- AutoUpgrade.java new revision: 1.23; previous revision: 1.22 /cvs/ide/launcher/upgrade/src/org/netbeans/upgrade/systemoptions/ContentProcessor.java,v <-- ContentProcessor.java initial revision: 1.1 /cvs/ide/launcher/upgrade/src/org/netbeans/upgrade/systemoptions/DefaultResult.java,v <-- DefaultResult.java initial revision: 1.1 /cvs/ide/launcher/upgrade/src/org/netbeans/upgrade/systemoptions/FileProcessor.java,v <-- FileProcessor.java initial revision: 1.1 /cvs/ide/launcher/upgrade/src/org/netbeans/upgrade/systemoptions/HashMapProcessor.java,v <-- HashMapProcessor.java initial revision: 1.1 /cvs/ide/launcher/upgrade/src/org/netbeans/upgrade/systemoptions/HostPropertyProcessor.java,v <-- HostPropertyProcessor.java initial revision: 1.1 /cvs/ide/launcher/upgrade/src/org/netbeans/upgrade/systemoptions/Importer.java,v <-- Importer.java new revision: 1.2; previous revision: 1.1 /cvs/ide/launcher/upgrade/src/org/netbeans/upgrade/systemoptions/IntrospectedInfoProcessor.java,v <-- IntrospectedInfoProcessor.java initial revision: 1.1 /cvs/ide/launcher/upgrade/src/org/netbeans/upgrade/systemoptions/JUnitContentProcessor.java,v <-- JUnitContentProcessor.java initial revision: 1.1 /cvs/ide/launcher/upgrade/src/org/netbeans/upgrade/systemoptions/NbClassPathProcessor.java,v <-- NbClassPathProcessor.java initial revision: 1.1 /cvs/ide/launcher/upgrade/src/org/netbeans/upgrade/systemoptions/PropertiesStorage.java,v <-- PropertiesStorage.java new revision: 1.2; previous revision: 1.1 /cvs/ide/launcher/upgrade/src/org/netbeans/upgrade/systemoptions/PropertyProcessor.java,v <-- PropertyProcessor.java new revision: 1.2; previous revision: 1.1 /cvs/ide/launcher/upgrade/src/org/netbeans/upgrade/systemoptions/Result.java,v <-- Result.java new revision: 1.2; previous revision: 1.1 /cvs/ide/launcher/upgrade/src/org/netbeans/upgrade/systemoptions/SerParser.java,v <-- SerParser.java new revision: 1.2; previous revision: 1.1 /cvs/ide/launcher/upgrade/src/org/netbeans/upgrade/systemoptions/SettingsRecognizer.java,v <-- SettingsRecognizer.java new revision: 1.2; previous revision: 1.1 /cvs/ide/launcher/upgrade/src/org/netbeans/upgrade/systemoptions/SystemOptionsParser.java,v <-- SystemOptionsParser.java new revision: 1.2; previous revision: 1.1 /cvs/ide/launcher/upgrade/src/org/netbeans/upgrade/systemoptions/TaskTagsProcessor.java,v <-- TaskTagsProcessor.java new revision: 1.2; previous revision: 1.1 /cvs/ide/launcher/upgrade/src/org/netbeans/upgrade/systemoptions/Utils.java,v <-- Utils.java new revision: 1.2; previous revision: 1.1 /cvs/ide/launcher/upgrade/src/org/netbeans/upgrade/systemoptions/systemoptionsimport,v <-- systemoptionsimport new revision: 1.2; previous revision: 1.1 /cvs/ide/launcher/upgrade/test/unit/src/org/netbeans/upgrade/systemoptions/AntSettingsTest.java,v <-- AntSettingsTest.java initial revision: 1.1 /cvs/ide/launcher/upgrade/test/unit/src/org/netbeans/upgrade/systemoptions/BasicTestForImport.java,v <-- BasicTestForImport.java new revision: 1.2; previous revision: 1.1 /cvs/ide/launcher/upgrade/test/unit/src/org/netbeans/upgrade/systemoptions/CoreSettingsTest.java,v <-- CoreSettingsTest.java initial revision: 1.1 /cvs/ide/launcher/upgrade/test/unit/src/org/netbeans/upgrade/systemoptions/DataBaseOptionTest.java,v <-- DataBaseOptionTest.java initial revision: 1.1 /cvs/ide/launcher/upgrade/test/unit/src/org/netbeans/upgrade/systemoptions/DerbyOptionsTest.java,v <-- DerbyOptionsTest.java initial revision: 1.1 /cvs/ide/launcher/upgrade/test/unit/src/org/netbeans/upgrade/systemoptions/ExampleSettingsTest.java,v <-- ExampleSettingsTest.java new revision: 1.2; previous revision: 1.1 /cvs/ide/launcher/upgrade/test/unit/src/org/netbeans/upgrade/systemoptions/HttpServerSettingsTest.java,v <-- HttpServerSettingsTest.java initial revision: 1.1 /cvs/ide/launcher/upgrade/test/unit/src/org/netbeans/upgrade/systemoptions/I18nOptionsTest.java,v <-- I18nOptionsTest.java initial revision: 1.1 /cvs/ide/launcher/upgrade/test/unit/src/org/netbeans/upgrade/systemoptions/IDESettingsTest.java,v <-- IDESettingsTest.java new revision: 1.2; previous revision: 1.1 /cvs/ide/launcher/upgrade/test/unit/src/org/netbeans/upgrade/systemoptions/JUnitSettingsTest.java,v <-- JUnitSettingsTest.java initial revision: 1.1 /cvs/ide/launcher/upgrade/test/unit/src/org/netbeans/upgrade/systemoptions/org-apache-tools-ant-module-AntSettings.settings,v <-- org-apache-tools-ant-module-AntSettings.settings initial revision: 1.1 /cvs/ide/launcher/upgrade/test/unit/src/org/netbeans/upgrade/systemoptions/org-netbeans-core-IDESettings.settings,v <-- org-netbeans-core-IDESettings.settings new revision: 1.2; previous revision: 1.1 /cvs/ide/launcher/upgrade/test/unit/src/org/netbeans/upgrade/systemoptions/org-netbeans-modules-derby-DerbyOptions.settings,v <-- org-netbeans-modules-derby-DerbyOptions.settings initial revision: 1.1 /cvs/ide/launcher/upgrade/test/unit/src/org/netbeans/upgrade/systemoptions/org-netbeans-modules-httpserver-HttpServerSettings.settings,v <-- org-netbeans-modules-httpserver-HttpServerSettings.settings initial revision: 1.1 /cvs/ide/launcher/upgrade/test/unit/src/org/netbeans/upgrade/systemoptions/org-netbeans-modules-i18n-I18nOptions.settings,v <-- org-netbeans-modules-i18n-I18nOptions.settings initial revision: 1.1 /cvs/ide/launcher/upgrade/test/unit/src/org/netbeans/upgrade/systemoptions/org-netbeans-modules-junit-JUnitSettings.settings,v <-- org-netbeans-modules-junit-JUnitSettings.settings initial revision: 1.1 /cvs/ide/launcher/upgrade/test/unit/src/org/netbeans/upgrade/systemoptions/org-netbeans-modules-xml-core-settings-CoreSettings.settings,v <-- org-netbeans-modules-xml-core-settings-CoreSettings.settings initial revision: 1.1 /cvs/ide/launcher/upgrade/test/unit/src/org/netbeans/upgrade/systemoptions/org-netbeans-upgrade-systemoptions-ExampleSettings.settings,v <-- org-netbeans-upgrade-systemoptions-ExampleSettings.settings new revision: 1.2; previous revision: 1.1 /cvs/openide/util/apichanges.xml,v <-- apichanges.xml new revision: 1.18; previous revision: 1.17 /cvs/openide/util/nbproject/project.properties,v <-- project.properties new revision: 1.22; previous revision: 1.21 /cvs/openide/util/src/org/netbeans/modules/openide/util/PreferencesProvider.java,v <-- PreferencesProvider.java new revision: 1.2; previous revision: 1.1 /cvs/openide/util/src/org/openide/util/NbPreferences.java,v <-- NbPreferences.java new revision: 1.2; previous revision: 1.1 /cvs/openide/util/src/org/openide/util/doc-files/preferences.html,v <-- preferences.html initial revision: 1.1 /cvs/apisupport/beanbrowser/src/org/netbeans/modules/apisupport/beanbrowser/PreferencesNode.java,v <-- PreferencesNode.java new revision: 1.2; previous revision: 1.1 /cvs/apisupport/beanbrowser/src/org/netbeans/modules/apisupport/beanbrowser/layer.xml,v <-- layer.xml new revision: 1.3; previous revision: 1.2 /cvs/nbbuild/antsrc/org/netbeans/nbbuild/Arch-api-questions.xml,v <-- Arch-api-questions.xml new revision: 1.43; previous revision: 1.42 /cvs/nbbuild/antsrc/org/netbeans/nbbuild/Arch.dtd,v <-- Arch.dtd new revision: 1.25; previous revision: 1.24 /cvs/nbbuild/test/unit/src/org/netbeans/nbbuild/ArchQuestionsTest.java,v <-- ArchQuestionsTest.java new revision: 1.14; previous revision: 1.13 /cvs/nbbuild/test/unit/src/org/netbeans/nbbuild/arch-preferences.xml,v <-- arch-preferences.xml initial revision: 1.1
So this is then FIXED w/ TM = Dev? or what?
Fixed
This suggestion re. the preferences guide was neither implemented nor explicitly rejected: "Step #3: this should not be in the code IMHO. Shouldn't the upgrade tool handle this?"
I think its handled by upgrade tool. After upgrade process is finished all *.settings files are not deleted but renamed not to be recognized by InstanceDataObject anymore. Is it OK for you?
It's fine for .settings files to be either deleted or renamed by the upgrade tool. The problem is that http://www.netbeans.org/download/dev/javadoc/org-openide-util/org/openide/util/doc-files/preferences.html says in "Hints how to replace SystemOption" item #3 that you should write code in your module to delete the old .settings file. If this is to be done by the upgrade tool then I don't understand why you would clutter your module code with it.
Nothing like "Hints how to replace SystemOption" item #3 .." is there anymore. I'm sorry, but javadoc build probably fails everyday.
This issue had *2 votes* before move to platform component