Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipse-incubator-e4-dev] [resources] Java7 / JSR203 and EFS

Hi all,
 
I investigated a little bit more about JSR203 (nio2 / filesystem access),
and here's some data points:
  • The most current data about JSR203 is from the binary early
    access download [1]
    . Install this on your system, read the
    sources, try it out or generate Javadocs from it -- the original
    JSR203 document as from the JCP is outdated, e.g. the package
    name changed from java.nio.filesystem to java.nio.file.
    The full Jdk7 EA downloads also don't have nio2 in it yet!
  • A 1-hour YouTube video (from a techtalk at Google, May 1) is
    available here [2]
  • A nice list of additional pointers is here [3], with a (slightly outdated)
    HTML  overview here [4].
In terms of its relation to EFS, I think the more interesting bits are
  • Monitoring API, which Szymon has mentioned already
  • File Attribute Views, which allow requesting a set of file attributes
    with optimized operations. EFS only has IFileStore#fetchInfo(),
    which is OK right now (since all info to be fetched is available by
    means of a stat() call), but is less than optimal if we want to fetch
    other kinds of attribute information... since we wouldn't want to burden
    clients which only need the modtime, for instance, with a full fetchInfo()
    that fetches information not needed.
  • Creating Symbolic Links
  • Allowing URI for converting from/to File/Path -- nice for EFS :-)
  • DirectoryStream for async directory retrieval -- all other operations are
    synchronous, so I'm questioning whether we really need full async
    support in EFS for reading attributes etc. I haven't yet fully understood
    the AsynchronousFilechannel class.
  • Support for Locking files against other programs
  • Path.isSameFile(Path) basically a fast equals() without getCanonicalPath()
    I find this a very interesting feature for Alias Management, depending on the
    algorithms to be used... just imagine being able to use a very fast UNIX
    inode number for checking fiel equality, instead of doing getCanonicalPath().
  • Provider Interface, so if we're writing an EFS implementation based on
    JSR 203, adopters can implement a custom JSR203 filesystem beneath.
EFS is better than JSR203 when it comes to progress reporting and cancellation --
all the JSR203 operations seem atomic (readAttributes(), copyTo(),
moveTo()) whereas
EFS allows IProgressMonitor for these operations.
 
Attached is a little test program I wrote (under EPL), if you are interested.
Of course, this needs the JSR203 ea from [1] to run :-)
The output of my program is this:

Same!
p2URI: file:///C:/PROGRA~1/
realpath: C:\Program Files
canonical: C:\Program Files
compareTo: 0
attrs: {owner=BUILTIN\Administrators, acl=[BUILTIN\Users:READ_ACL/EXECUTE/READ_NAMED_ATTRS/READ_ATTRIBUTES/SYNCHRONIZE/READ_DATA:ALLOW, BUILTIN\Users:FILE_INHERIT/DIRECTORY_INHERIT/INHERIT_ONLY:ALLOW, ...]}

[1] http://download.java.net/jdk7/jsr203/
[2] http://dlinsin.blogspot.com/2008/07/jsr-203-more-new-io.html
[3] http://tech.puredanger.com/java7/#jsr203
[4] http://today.java.net/pub/a/today/2008/07/03/jsr-203-new-file-apis.html
 
Cheers,
--
Martin Oberhuber, Senior Member of Technical Staff, Wind River
Target Management Project Lead, DSDP PMC Member
http://www.eclipse.org/dsdp/tm
 
 

Attachment: jsr203test.zip
Description: jsr203test.zip


Back to the top