protected FileSystemOptions getFileSystemOptions() throws FileSystemException { FileSystemOptions opts = new FileSystemOptions(); return opts; }
FileSystemOptions fsOptions = new FileSystemOptions(); SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(fsOptions, "no"); FileSystemManager fsManager = VFS.getManager(); String uri = "sftp://user:password@host:port/absolute-path"; FileObject fo = fsManager.resolveFile(uri, fsOptions);
private static FileSystemOptions buildFsOptions( VariableSpace varSpace, FileSystemOptions sourceOptions, String vfsFilename, String scheme ) throws IOException { if ( varSpace == null || vfsFilename == null ) { // We cannot extract settings from a non-existant variable space return null; } IKettleFileSystemConfigBuilder configBuilder = KettleFileSystemConfigBuilderFactory.getConfigBuilder( varSpace, scheme ); FileSystemOptions fsOptions = ( sourceOptions == null ) ? new FileSystemOptions() : sourceOptions; String[] varList = varSpace.listVariables(); for ( String var : varList ) { if ( var.startsWith( "vfs." ) ) { String param = configBuilder.parseParameterName( var, scheme ); String varScheme = KettleGenericFileSystemConfigBuilder.extractScheme( var ); if ( param != null ) { if ( varScheme == null || varScheme.equals( "sftp" ) || varScheme.equals( scheme ) ) { configBuilder.setParameter( fsOptions, param, varSpace.getVariable( var ), var, vfsFilename ); } } else { throw new IOException( "FileSystemConfigBuilder could not parse parameter: " + var ); } } } return fsOptions; }
public SimpleJsonExtractor(WorkUnitState workUnitState) throws FileSystemException { this.workUnitState = workUnitState; // Resolve the file to pull if (workUnitState.getPropAsBoolean(ConfigurationKeys.SOURCE_CONN_USE_AUTHENTICATION, false)) { // Add authentication credential if authentication is needed UserAuthenticator auth = new StaticUserAuthenticator(workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_DOMAIN, ""), workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_USERNAME), PasswordManager.getInstance(workUnitState) .readPassword(workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_PASSWORD))); FileSystemOptions opts = new FileSystemOptions(); DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts, auth); this.fileObject = VFS.getManager().resolveFile(workUnitState.getProp(SOURCE_FILE_KEY), opts); } else { this.fileObject = VFS.getManager().resolveFile(workUnitState.getProp(SOURCE_FILE_KEY)); } // Open the file for reading LOGGER.info("Opening file " + this.fileObject.getURL().toString()); this.bufferedReader = this.closer.register(new BufferedReader(new InputStreamReader(this.fileObject.getContent().getInputStream(), ConfigurationKeys.DEFAULT_CHARSET_ENCODING))); }
FileSystemOptions opts = new FileSystemOptions();
FileSystemOptions fsOptions = new FileSystemOptions(); FileSystemManager fsManager = null; String remoteURL = "sftp://" + userName + "@" + server + "/" + remoteDir + "/" + remoteFile;
FileSystemOptions opts = new FileSystemOptions(); SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking( opts, "no");
FileSystemOptions opts = new FileSystemOptions(); SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking( opts, "no");
FileSystemOptions opts = new FileSystemOptions(); SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking( opts, "no");
private FileSystemOptions getOptions(final String scheme) final FileSystemOptions opts = new FileSystemOptions(); FileSystemConfigBuilder builder; try
/** * {@inheritDoc} * * @since 2.0 */ @Override public Object clone() { return new FileSystemOptions(new TreeMap<>(options)); }
/** * {@inheritDoc} * * @since 2.0 */ @Override public Object clone() { return new FileSystemOptions(new TreeMap<FileSystemOptionKey, Object>(options)); }
/** * {@inheritDoc} * * @since 2.0 */ @Override public Object clone() { return new FileSystemOptions(new TreeMap<>(options)); }
protected FileSystemOptions getFileSystemOptions() { if (fileSystemOptions == null) { fileSystemOptions = new FileSystemOptions(); setupOptions(FtpsFileSystemConfigBuilder.getInstance()); } return fileSystemOptions; }
protected FileSystemOptions getFileSystemOptions() throws FileSystemException { FileSystemOptions opts = new FileSystemOptions(); AWSCredentials credentials = S3CredentialsProvider.getAWSCredentials(); if ( credentials != null ) { StaticUserAuthenticator userAuthenticator = new StaticUserAuthenticator( null, credentials.getAWSAccessKeyId(), credentials.getAWSSecretKey() ); DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator( opts, userAuthenticator ); } return opts; } }
private FileSystemOptions getFileSystemOptions() throws FileSystemException { FileSystemOptions opts = new FileSystemOptions(); AWSCredentials credentials = S3CredentialsProvider.getAWSCredentials(); if ( credentials != null ) { StaticUserAuthenticator userAuthenticator = new StaticUserAuthenticator( null, credentials.getAWSAccessKeyId(), credentials.getAWSSecretKey() ); DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator( opts, userAuthenticator ); } return opts; }
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; }
private String getS3FileObjectPath() throws FileSystemException, KettleFileException { FileSystemOptions opts = new FileSystemOptions(); DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator( opts, new StaticUserAuthenticator( null, getAWSAccessKeyId(), getAWSSecretKey() ) ); FileObject stagingDirFileObject = KettleVFS.getFileObject( stagingDir, getVariables(), opts ); return stagingDirFileObject.getName().getPath(); }
private void testResloveFolderSlash(final String uri, final boolean followRedirect) throws FileSystemException { VFS.getManager().getFilesCache().close(); final FileSystemOptions opts = new FileSystemOptions(); HttpFileSystemConfigBuilder.getInstance().setFollowRedirect(opts, followRedirect); final FileObject file = VFS.getManager().resolveFile(uri, opts); try { checkReadTestsFolder(file); } catch (final FileNotFolderException e) { // Expected: VFS HTTP does not support listing children yet. } }
private void testResloveFolderSlash(final String uri, final boolean followRedirect) throws FileSystemException { VFS.getManager().getFilesCache().close(); final FileSystemOptions opts = new FileSystemOptions(); HttpFileSystemConfigBuilder.getInstance().setFollowRedirect(opts, followRedirect); try (final FileObject file = VFS.getManager().resolveFile(uri, opts)) { checkReadTestsFolder(file); } catch (final FileNotFolderException e) { // Expected: VFS HTTP does not support listing children yet. } }