commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Spielmann <>
Subject [VFS] questions
Date Wed, 26 Apr 2006 12:24:16 GMT
HI everybody!

I have been playing around with VFS for a few days now because i have to
do a presentation about the jakarta commons projects on Friday in a
open-source software class i'm attending.

The prof said that we should concentrate on actual programming examples
so i tried to create a simple VFS-Program but i don't seem to be able to...

If i understood the sense of a VFS correctly i *should* be able to do
this with commons VFS:

1. I create a FileSystemManager-Object:

    this.defFSManager=new DefaultFileSystemManager();
    this.defFSManager.addProvider("file", new DefaultLocalFileProvider());
    this.defFSManager.addProvider("zip", new ZipFileProvider());
    this.defFSManager.addProvider("tar", new TarFileProvider());
    this.defFSManager.addProvider("http",new HttpFileProvider());
    (i tried it with this.defFSManager=VFS.getManager(); too but that
didn't change a thing...)

2. I create a VirtualFileSystem-Object:


3. I add a junction ("mount" a filesystem (a zip-file) if i understood
it correctly in terms of commons-vfs):

    File zipFile = new File("/mnt/downloads/");
    FileObject zipFileObject = this.defFSManager.toFileObject(zipFile);

So far everything works as expected and i should have the following
Virtual File System (again if i am correct maybe i completely
misunderstood VFS):


But now i'm out of ideas:

I wanted to write a method that accepts a FileObject as Parameter,
prints out the Filename) and then gets the children of the
FileObject-Parameter (if it has any) and calls the method again
recursively (so i would like to traverse my vfs-tree) but no matter what
i do i can't get the children of the root of my virtual filesystem. I
always get the following Exception:
org.apache.commons.vfs.FileSystemException: Could not list the contents
of folder "vfs:///". But that has to be possible somehow???!?

I would appreciate any idea how to get the children of the vfs-root!



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message