[jboss-dev-forums] [Design of POJO Server] - VFS isLeaf() vs isDirectory()/isFile()

adrian@jboss.org do-not-reply at jboss.com
Thu Sep 28 06:04:28 EDT 2006


To avoid the confusion around the isDirectory()/isFile
I've modified the VFS api to have the single method
isLeaf() which is effectively isCannotHaveChildren()

I also fixed the isArchive() so that it means either:
1) It is an archive
2) It is a structure pretending to be an archive, e.g. an unpacked directory

While I was doing this I reworked the VisitorAttribues to
remove the notions of directory.
I also changed it so all the defaults are false to make it less
confusing.

The mappings are as follows (if you have uncommitted code):
isFile() -> isLeaf()
isDirectory() -> isLeaf() == false

VisitorAttributes.NO_DIRECTORIES -> VisitorAttributes.LEAVES_ONLY
VisitorAttributes.RECURSE_DIRECTORIES -> VisitorAttributes.RECURSE
VisitorAttributes.RECURSE_NO_DIRECTORIES -> VisitorAttributes.RECURSE_LEAVES_ONLY

setIncludeDirectories(false) -> setLeavesOnly(true)
setIgnoreHidden(false) -> setIncludeHidden(true)

Hopefully this should avoid some of the confusion that has crept into
the api? Especially in the jar handlers.

Finally, I think the VFSScanner should be changed according
the TODO I added to the code, if it is doing what I think it is doing?

  |          // TODO replace . in the name with isArchive() == false?
  |          else if (component.getName().indexOf('.') == -1 && this.doRecursiveSearch)
  |          {
  |             // recurse if not '.' in name and recursive search is enabled
  |             addDeployments(list, component);
  |          }
  | 

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

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



More information about the jboss-dev-forums mailing list