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 222202 - Reveal deleted or changed files on MultiFileSystem
Summary: Reveal deleted or changed files on MultiFileSystem
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Filesystems (show other bugs)
Version: 7.3
Hardware: PC Linux
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords: API, API_REVIEW_FAST
Depends on:
Blocks: 213591
  Show dependency tree
 
Reported: 2012-11-15 11:54 UTC by Svata Dedic
Modified: 2012-11-24 13:07 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Proposed changes - initial version (24.69 KB, patch)
2012-11-15 11:54 UTC, Svata Dedic
Details | Diff
Testcases (10.25 KB, text/x-java)
2012-11-15 12:31 UTC, Svata Dedic
Details
processed Y01 (37.15 KB, patch)
2012-11-20 11:57 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 2012-11-15 11:54:47 UTC
Created attachment 127863 [details]
Proposed changes - initial version

Currently we have FileObject.revert(), which can discard user changes for existing files on writable layer of MFS among other things. But if the files does not exist at all, there's no FileObject to call revert() on.
In addition, it may be useful to be able to read attributes and contents of the deleted file (or the original version of the file) in order to decide whether the file should be revert()ed or not. The current FS API does not allow such inspection.

I propose to add a 'development' stability pseudo API - an additional FileObject attribute "revealEntries" on FileObjects representing folders. The value of such attribute would be typed Collection<? extends FileObject>. If the FS does not support the feature (i.e. not MultiFileSystem, or MultiFileSystem without writable layer - effectively unable to revert() changes), the returned value would be null.

In addition, the returned FileObjects would implement Callable<FileObject> interface - 
public FileObject call(). If called, the changes for the file will be reverted on the writable layer, and the revived MultiFileObject will be returned to the caller (if exists).

Those FileObjects should be guarded against DataObject creation, as there could be 2 DataObjects for the same path, which would do no good - I propose that the returned FileObjects should be isValid() == false from the start.
Next, references to the fileObject.getParent() or getChildren() should not reveal lower layers of the MultiFileSystem; so I propose that the returned FileObjects would be formally part of the MultiFileSytem, under a proper parent, and with appropriate MFS children.

As the information for deleted/original content is represented as FileObject, the caller may inspect any attribute, content or flags; this would be hard to achive with other API type - only a subset of information could be exposed.

See the attached patch against openide.filesystems for proposed API/implementation/tests.
Comment 1 Svata Dedic 2012-11-15 12:31:30 UTC
Created attachment 127869 [details]
Testcases

Sorry, I've forgot to include tests in the patch, only changed test infrastructure was present. See the additional attachment.
Comment 2 Jaroslav Tulach 2012-11-16 09:15:08 UTC
Y01 Jesse used to say apichanges.xml is just for a short note about the change, not about describing the behavior. In this case I think the description should be in arch.xml <api group="property/layer">...

Btw. nice fluent testing infrastructure improvement "add(...).withContent(...)"
Comment 3 Svata Dedic 2012-11-20 11:57:59 UTC
Created attachment 128123 [details]
processed Y01

Y01: noted in arch.xml, shortened entry in apichanges.xml, linked to and explained in MFS javadoc.
Comment 4 Svata Dedic 2012-11-23 16:12:21 UTC
No further input, will commit
Comment 5 Svata Dedic 2012-11-23 16:12:34 UTC
Changeset: 5f829ca35154
Author:    Svata Dedic <sdedic@netbeans.org>
Date:      2012-11-23 17:12
Message:   Attempt to sync NB eclipse keymap with Eclipse Indigo release.
Comment 6 Svata Dedic 2012-11-23 16:14:42 UTC
aargh, please disregard the last comment; I'll recommit with the correct message.
Comment 7 Svata Dedic 2012-11-23 16:15:24 UTC
Changeset: 0ee9a484eb9f
Author:    Svata Dedic <sdedic@netbeans.org>
Date:      2012-11-23 17:15
Message:   Implemented "revealEntries" attribute on MFObject
Comment 8 Quality Engineering 2012-11-24 13:07:23 UTC
Integrated into 'main-golden', will be available in build *201211240959* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/0ee9a484eb9f
User: Svata Dedic <sdedic@netbeans.org>
Log: Issue #222202 - Reveal deleted or changed files on MultiFileSystem: fixed
Implemented "revealEntries" attribute on MFObject