boolean ftp, boolean sftp, boolean http, boolean gsiftp, boolean srb,
boolean file, boolean irods, String tmpDirPath) throws FileSystemException {
// note, fsManager is not a singleton here ! thus it is meant that
// a fsManager is created per thread and close the fsManager
DefaultFileSystemManager fsManager = new DefaultFileSystemManager();
if (ftp) {
fsManager.addProvider("ftp", new FtpFileProvider());
}
if (sftp) {
fsManager.addProvider("sftp", new SftpFileProvider());
}
if (http) {
fsManager.addProvider("http", new HttpFileProvider());
}
if (gsiftp) {
fsManager.addProvider("gsiftp", new GridFtpFileProvider());
}
if (srb) {
fsManager.addProvider("srb", new SRBFileProvider());
}
if (file) {
fsManager.addProvider("file", new DefaultLocalFileProvider());
}
if(irods){
fsManager.addProvider("irods", new IRODSFileProvider());
}
File xFile = null;
if (tmpDirPath != null) {
xFile = new File(tmpDirPath);
} else {
xFile = new File(System.getProperty("java.io.tmpdir", "/tmp"));
}
if (!xFile.exists()) {
throw new IllegalStateException("cannot allocate temporary directory. Please set java.io.tmpdir system property");
}
fsManager.addProvider("tmp", new TemporaryFileProvider(xFile));
fsManager.setTemporaryFileStore(new DefaultFileReplicator(xFile));
fsManager.init();
return fsManager;
}