[Design the new POJO MicroContainer] - Re: JarEntry as VFS root does not return empty vfspath
by adrian@jboss.org
"mstruk" wrote :
| Lazy init of contextPath is also a mine that makes things blow up when you poke around and play with code. Things would be much more predictable if we just set it through constructor and make it non transient.
|
I don't remember the code being that difficult, but then I haven't worked on it for a while?
IIRC, the path originally was setup lazily, except for the now obsolete jar handler
that went through every entry up-front?
I don't understand why you can't fall back to getParent().getParent().etc.
at the worst?
anonymous wrote :
| To stick to the issue - I think it would be best to introduce non-transient field boolean isContextRoot to AbstractVirtualFileHandler and init it through constructor.
|
Sounds like a simple solution, but maybe not so good on memory usage?
anonymous wrote :
| BTW: Is there a wiki page I can use for a little VFS guide I'm putting together? Where others in-the-know can point out inaccuracies I commit :)
|
Besides this, I don't know? :-)
http://wiki.jboss.org/wiki/Wiki.jsp?page=JBoss5VirtualFileSystem
The original design(s) - it's been few a couple of iterations - were
mostly described in the forums. I don't know that anybody has collected the
implementation details into a more formal document?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4138216#4138216
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4138216
18 years
[Design the new POJO MicroContainer] - Re: JarEntry as VFS root does not return empty vfspath
by mstruk
Ok, I'm implementing the fix to work with root-name-not-an-empty-string contract.
Root node test:
| isContextRoot = parent == null
|
does not work for situations where context root is not the jar itself but a path within it (jar://some/path.jar!/child).
In the absence of isRoot field on AbstractVirtualFileHandler one approach is along the line:
| public boolean isContextRoot() {
|
| try
| {
| VirtualFileHandler ctxRoot = getVFSContext().getRoot();
| return this == ctxRoot;
| }
| catch (IOException e)
| {
| throw new RuntimeException("Failed to get context root: ", e);
| }
|
| }
|
but it blows up on getVFSContext() if handler has been closed - it goes into infinite recursion (because I call isContextRoot() inside initPath() which is called from getPathName() which is called from toString() which is called from Exception generating constructor within getVFSContext()... a mess :)
I think it's overkill to blow on getVFSContext() which is just a field retrieval - no logic invoked. We should let the code retrieve the context and let the context blow up later if some operation is invoked on it.
Lazy init of contextPath is also a mine that makes things blow up when you poke around and play with code. Things would be much more predictable if we just set it through constructor and make it non transient.
To stick to the issue - I think it would be best to introduce non-transient field boolean isContextRoot to AbstractVirtualFileHandler and init it through constructor.
BTW: Is there a wiki page I can use for a little VFS guide I'm putting together? Where others in-the-know can point out inaccuracies I commit :)
- marko
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4138206#4138206
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4138206
18 years