[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: JarEntry as VFS root does not return empty vfspath

adrian@jboss.org do-not-reply at jboss.com
Wed Mar 19 08:24:14 EDT 2008


"scott.stark at jboss.org" wrote : Right, the test is wrong if JarContext(entry) is no longer simply returning the JarEntry name, and it should not be.
  | 

The VFS "name" should never be the empty string.

This is used in many places, e.g. VFSDeployment.getSimpleName()
and will break things if it is empty.

The idea of the "name" is say what artifact you are referring to without the path.

If you want to add a "contextName" which is just the relevant section used
to construct the pathName then that is fine, but don't change the "name".

Suppose you have

url://some/path/outer.jar/lib/inner.jar
and construct a vfs context from (context name obviously doesn't exist)

root = VFS.getRoot("url://some/path");

root.getName() : "path" (this should not be empty)
root.getPathName() : ""
root.getContextName() : "" (this would be empty because it is the root of the vfs)

outer = root.getChild("outer.jar");
outer.getName() : "outer.jar");
outer.getPathName() : "outer.jar"
outer.getContextName() : "outer.jar")

inner = get.findChild("lib/inner.jar");
inner.getName() : "inner.jar"
inner.getPathName() : "outer.jar/lib/inner.jar"
inner.getContextName() : "inner.jar"

As you can see the ContextName is the same as the Name
except when it is the root of the VFS (i.e. no parent), so I'm not sure the ContextName
is really necessary. Or if it is, it could easily be written in the abstract

public String getContextName()
{
   if (getParent() == null)
     return "";
   return getName();
}

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

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



More information about the jboss-dev-forums mailing list