[jboss-cvs] JBossAS SVN: r97971 - projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Dec 17 16:23:14 EST 2009
Author: johnbailey
Date: 2009-12-17 16:23:14 -0500 (Thu, 17 Dec 2009)
New Revision: 97971
Modified:
projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFile.java
projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFileAssembly.java
Log:
More tweaks the VirtualFileAssembly to porperly support children within the assembly
Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFile.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFile.java 2009-12-17 21:04:49 UTC (rev 97970)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFile.java 2009-12-17 21:23:14 UTC (rev 97971)
@@ -305,6 +305,10 @@
virtualFiles.add(child);
submounts.remove(name);
}
+ for (String name : submounts) {
+ final VirtualFile child = new VirtualFile(name, this);
+ virtualFiles.add(child);
+ }
return virtualFiles;
}
Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFileAssembly.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFileAssembly.java 2009-12-17 21:04:49 UTC (rev 97970)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFileAssembly.java 2009-12-17 21:23:14 UTC (rev 97971)
@@ -49,7 +49,7 @@
private static final Random RANDOM_NUM_GEN = new SecureRandom();
- private final AssemblyNode rootNode = new AssemblyNode();
+ private final AssemblyNode rootNode = new AssemblyNode("");
private final List<Closeable> mountHandles = new CopyOnWriteArrayList<Closeable>();
@@ -111,15 +111,20 @@
* Returns a list of all the names of the children in the assembly.
* @return
*/
- public Set<String> getChildNames(VirtualFile mountPoint, VirtualFile target) {
+ public List<String> getChildNames(VirtualFile mountPoint, VirtualFile target) {
+ List<String> names = new LinkedList<String>();
+ AssemblyNode targetNode = null;
if(mountPoint.equals(target)) {
- return rootNode.children.keySet();
+ targetNode = rootNode;
+ } else {
+ targetNode = rootNode.find(new Path(VFSUtils.getRelativePath(mountPoint, target)));
}
- AssemblyNode node = rootNode.find(new Path(VFSUtils.getRelativePath(mountPoint, target)));
- if(node != null) {
- return node.children.keySet();
+ if(targetNode != null) {
+ for(AssemblyNode childNode : targetNode.children.values()) {
+ names.add(childNode.realName);
+ }
}
- return Collections.emptySet();
+ return names;
}
public boolean contains(VirtualFile mountPoint, VirtualFile target) {
@@ -180,10 +185,13 @@
*/
private static class AssemblyNode {
private final Map<String, AssemblyNode> children = new ConcurrentHashMap<String, AssemblyNode>();
+
+ private final String realName;
private VirtualFile target;
- public AssemblyNode() {
+ public AssemblyNode(String realName) {
+ this.realName = realName;
}
/**
@@ -223,7 +231,7 @@
if (!createIfMissing) {
return null;
}
- childNode = new AssemblyNode();
+ childNode = new AssemblyNode(current);
addChild(current, childNode);
}
return childNode.find(path, createIfMissing);
More information about the jboss-cvs-commits
mailing list