File System metadata

Elliotte Harold elharo at
Sun May 25 17:07:22 PDT 2008

I'm still working through the details, but the current implementation of 
FileSystem attributes seems way too limited. It's basically giving us 
what we have already, just in a new form.

I was really hoping for a system that would allow for arbitrary 
properties on files without tieing the API to any one operating system. 
For instance,

int permissions = file.getIntProperty("permissions");
boolean readonly = file.getBooleanProperty("readonly"):

We can certainly debate exactly what sort of syntax for such generic 
metadata is appropriate. Java's strong typing makes this really hard to 
design elegantly. Perhaps they should all just be Object. Perhaps they 
shoudl just be strings. Maybe we need methods that return default values 
and maybe we don't. Those details can be worked out.

Nonetheless the current approach of supporting only POSIX and DOS 
attributes, and then naming those attributes explicitly seems very rigid 
and not very useful. What about NTFS and Mac OS X attributes? and 
whatever comes next? What about virtual file systems based on HTTP or a 
source code control system?

I think a filesystem should be able to provide whichever attributes make 
sense to it, and these should be queryable through a standard interface. 
  Perhaps we can still have Basic and Space attributes, but we need a 
much more generic system that does not attempt to enumerate all possible 
attributes up front.

Elliotte Rusty Harold  elharo at
Java I/O 2nd Edition Just Published!

More information about the nio-discuss mailing list