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.

Bug 250691 - Allow multiple Repositories for different execution contexts
Summary: Allow multiple Repositories for different execution contexts
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Filesystems (show other bugs)
Version: 8.1
Hardware: PC Linux
: P1 normal (vote)
Assignee: apireviews
URL:
Keywords: API, API_REVIEW_FAST
Depends on:
Blocks: 250873
  Show dependency tree
 
Reported: 2015-02-25 13:46 UTC by Svata Dedic
Modified: 2015-03-07 08:41 UTC (History)
4 users (show)

See Also:
Issue Type: TASK
Exception Reporter:


Attachments
Proposed patch (85.13 KB, patch)
2015-02-25 13:46 UTC, Svata Dedic
Details | Diff
Revised patch (98.54 KB, patch)
2015-02-26 08:56 UTC, Svata Dedic
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Svata Dedic 2015-02-25 13:46:31 UTC
Created attachment 152212 [details]
Proposed patch

The org.openide.filesystems.Repository holds the default Filesystem, which is used not only to register services, but also to hold user configuration.

If multiple users would use the same NetBeans instance, it becomes difficult to separate their configurations. We can separate their services using special Lookups and Lookup.executeWith, but we do not have similar feature for their configuration - and NetBeans techniques to access cfg (FileUtil.getConfigFile, NbPreferences) fully depend on the default FileSystem to be 'private' to the executing user.

Therefore I propose an API change, which would:

a/ allow to create more Repositories
b/ allow to pick up the "correct" Repository instance from FileUtil.getConfigRoot()
c/ separate implementation of layers to allow construction in a different environment than standard NB distribution.

A few notes explaining the patch:

* the core.startup.base contains impl of layered filesystem and NbPreferences. A LayerFactory SPI was defined, so that core.startup can bind the layered Filesystems to a correct location using e.g. system properties. Different implementations/bindings are made possible for different platform needs.

* RecognizeInstanceFiles and MetaInfServicesLookup contains a defect, their Lookup.Items do not prevent reentrant object creation: it's possible to recursively create an object, and the Lookup remembers a different object than it is potentially remembered by other code. The diff changes implementation so that the *first* (innermost) creation is remembered and returned from the outer lookup() queries.

* Some calls to FileUtil.getConfig* was replaced by FileUtil.getSystemConfig* to access the shared configuration / services.
Comment 1 Svata Dedic 2015-02-26 08:56:36 UTC
Created attachment 152240 [details]
Revised patch

Revised patch - added version number/dependency changes automatic dependency injection during build; IO API, Intent API, Progress Swing and Core Base turned to autoloads (commit-validation complaints)
Comment 2 Tomas Zezula 2015-03-05 09:09:09 UTC
The patch seem good to me.
Comment 3 Svata Dedic 2015-03-05 19:56:35 UTC
Feature committed as jet-main#04a063e2b4f3

Simple unit test added.
Comment 4 Quality Engineering 2015-03-07 08:41:45 UTC
Integrated into 'main-silver', will be available in build *201503070001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/04a063e2b4f3
User: Svata Dedic <sdedic@netbeans.org>
Log: #250691: Allowed creation of local Repositories