use of org.apache.commons.vfs2.auth.StaticUserAuthenticator in project big-data-plugin by pentaho.
the class AbstractAmazonJobExecutorController method resolveFile.
public FileObject resolveFile(String fileUri) throws FileSystemException, KettleFileException {
VariableSpace vs = getVariableSpace();
FileSystemOptions opts = new FileSystemOptions();
DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts, new StaticUserAuthenticator(null, getAccessKey(), getSecretKey()));
FileObject file = KettleVFS.getFileObject(fileUri, vs, opts);
return file;
}
use of org.apache.commons.vfs2.auth.StaticUserAuthenticator in project meveo by meveo-org.
the class FtpAdapterJobBean method initialize.
/**
* Creates the download directory localDir if it does not exist and makes a connection to the remote SFTP server.
*
* @param localDir the local dir
* @param userName the user name
* @param password the password
* @param filePatternString the file pattern string
* @param isSftp the is sftp
* @throws FileSystemException the file system exception
*/
private void initialize(String localDir, String userName, String password, String filePatternString, boolean isSftp) throws FileSystemException {
localDirFile = new File(localDir);
if (!localDirFile.exists()) {
localDirFile.mkdirs();
}
try {
fsManager = VFS.getManager();
} catch (FileSystemException ex) {
throw new RuntimeException("failed to get fsManager from VFS", ex);
}
UserAuthenticator auth = new StaticUserAuthenticator(null, userName, password);
opts = getSftpOptions(isSftp);
try {
DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts, auth);
} catch (FileSystemException ex) {
throw new RuntimeException("setUserAuthenticator failed", ex);
}
if ("false".equals(paramBeanFactory.getInstance().getProperty("ftpAdapter.useExtentionAsRegex", "false"))) {
filePattern = Pattern.compile(".*" + filePatternString);
} else {
filePattern = Pattern.compile(filePatternString);
}
}
Aggregations