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());
                     //dfs.setCacheStrategy(CacheStrategy.ON_RESOLVE);
                     dfs.init();
                     instance=dfs;
                 }
                 return instance;
         }
         public static void close(){
                 if (instance != null)
                 ((DefaultFileSystemManager)instance).close();
                 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
 [email protected]

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to