You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Rai Singh - PA <Ra...@GMACM.COM> on 2006/02/20 21:41:07 UTC

[VFS] Some basic questions

I am trying to understand the correct usage of VFS such that I can
connect to different servers via SFTP and return a single view across
all servers. 

For instance, given that a directory (/home/foo/bar) exists on several
servers (distinctly different machines) I want to perform the following
against this directory:

1)       search and retrieve attributes on several jar files across
select servers

2)       overwrite and delete jar files across select servers.

 

Following an example posted on the Commons Wiki, I am able to see how I
might do this for a single filesystem:

                                defFileSysMgr = new
DefaultFileSystemManager();

                                try {

 
defFileSysMgr.addProvider("file", new DefaultLocalFileProvider());

 
defFileSysMgr.addProvider("zip", new ZipFileProvider());

 
defFileSysMgr.addProvider("jar", new JarFileProvider());

                                                defFileSysMgr.init();

 

                                                // Create the virtual
file system

                                                VirtualFileSystem vfs =
(VirtualFileSystem)defFileSysMgr.createVirtualFileSystem("vfs://")

 
.getFileSystem();

                                                searchableVfs = new
SearchableVirtualFileSystem(vfs);

 

                                } catch (FileSystemException e) {

                                                throw new
SearchException("Unable to initialize the FileSystemManager.", e);

                                }

 

Where SearchableVirtualFileSystem simply adds filter and search
capabilities. Is this usage recommended?

 Is there a way to: 

"connect to servers A, B, C, and D via SFTP, retrieve file information
across all servers at one time and return FileObject instances for files
in each SFTP session"?

 

 

The reason for wanting to do this is so that I might be able to manage
jar files that are deployed across several servers (not a cluster) in a
given environment (development, staging, production).

 

I would appreciate your help.

 

Thanks,

Rai