commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Shifman <>
Subject Re:[VFS]how to programmatically create an instance of DefaultFileSystemManager
Date Wed, 18 Feb 2009 13:30:34 GMT
I made my own manager to do my own services.  This might help you.

package org.VFSManagers;

import org.apache.commons.vfs.FileSystemException;
import org.apache.commons.vfs.FileSystemManager;
import org.apache.commons.vfs.impl.DefaultFileSystemManager;
import org.apache.commons.vfs.provider.local.DefaultLocalFileProvider;
import org.apache.commons.vfs.provider.sftp.SftpFileProvider;
import org.apache.commons.vfs.provider.smb.SmbFileProvider;

public class VFS_YPED {
	private static FileSystemManager instance;

	private VFS_YPED()

	 public static synchronized FileSystemManager getManager() throws FileSystemException{
		 if (instance == null){
		     DefaultFileSystemManager dfs = new DefaultFileSystemManager();
		     dfs.addProvider("sftp", new SftpFileProvider());
		     dfs.addProvider("smb",new SmbFileProvider());
		     //dfs.addProvider("zip",new ZipFileProvider());
		     dfs.addProvider("local", new DefaultLocalFileProvider());
		 return instance;
	 public static void close(){
		 if (instance != null)

Suresh Pendap wrote:
> Hi,
>          I would like to programmatically create an instance of DefaultFileSystemManager
by setting all the providers, rather than use the singleton instance using the VFS.getManager().

> Can some one provide me the sample code which depicts how to achieve that?
> I just want to make sure that I do not miss any important step.
> Regards
> Suresh

 Mark Shifman MD. Ph.D.
 Yale Center for Medical Informatics
 Phone (203)737-5219

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

View raw message