[jboss-dev-forums] [Design the new POJO MicroContainer] - VFS cache as impl detail, to what extent

alesj do-not-reply at jboss.com
Wed Jan 21 10:10:10 EST 2009


WRT:
 - http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4203492#4203492

Afaics the VFS cache cannot be completely hidden from the user.
e.g. you want to create new roots that behave differently 
- diff ExceptionHandler, diff options (copy, case-sensitivity, ...), ...
And that's exactly what VFS::getVFS(URI|URL) does.

Where I now see VFS::getRoot(URI|URL) just as a shortcut to
previously mentioned VFS::getVSF::getRoot to actually do work on
a more familiar VirtualFile api (as you can see, VFS has a bunch of deprecated methods).

What's the diff between VFS::getVSF::getRoot and VFS:getRoot?
It's in the step in the middle. ;-)
You can eventually do this (possible optimizations):

VFS vfs = VFS.getVFS(url);
// set some options on it
VFSUtils.enableCopy(vfs);
...
VirtualFile root = vfs.getRoot();

where "VirtualFile root = VFS.getRoot(url)" comes with defaults.

The much disputed VFS::getCachedFile is a cached counter weight to previous VFS::getRoot.
It will first check the cache, only then create a new root.
Most of the time we should be using this cached lookup,
unless you explicitly want new VFS root.

What might be a feasible plan is to introduce just the opposite method:
 - VFS:createNewRoot(URI|URL)
and change the existing getRoot to use getCachedFile.

Wdyt?


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4203668#4203668

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4203668



More information about the jboss-dev-forums mailing list