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))); }
/** * @see #setUserAuthenticator * @param opts The FileSystemOptions. * @return The UserAuthenticator. */ public UserAuthenticator getUserAuthenticator(final FileSystemOptions opts) { return (UserAuthenticator) getParam(opts, "userAuthenticator"); }
/** * Sets the user authenticator to get authentication informations. * * @param opts The FileSystemOptions. * @param userAuthenticator The UserAuthenticator. * @throws FileSystemException if an error occurs setting the UserAuthenticator. */ public void setUserAuthenticator(final FileSystemOptions opts, final UserAuthenticator userAuthenticator) throws FileSystemException { setParam(opts, "userAuthenticator", userAuthenticator); }
/** * Authenticates if there is an authenticator, else returns null. * * @param opts The FileSystemOptions. * @param authenticatorTypes An array of types describing the data to be retrieved. * @return A UserAuthenticationData object containing the data requested. */ public static UserAuthenticationData authenticate(final FileSystemOptions opts, final UserAuthenticationData.Type[] authenticatorTypes) { final UserAuthenticator auth = DefaultFileSystemConfigBuilder.getInstance().getUserAuthenticator(opts); return authenticate(auth, authenticatorTypes); }
protected AbstractFileSystem(final FileName rootName, final FileObject parentLayer, final FileSystemOptions fileSystemOptions) { this.parentLayer = parentLayer; this.rootName = rootName; this.fileSystemOptions = fileSystemOptions; final FileSystemConfigBuilder builder = DefaultFileSystemConfigBuilder.getInstance(); String uri = builder.getRootURI(fileSystemOptions); if (uri == null) { uri = rootName.getURI(); } this.rootURI = uri; }
/** * Authenticates if there is an authenticator, else returns null. * * @param opts The FileSystemOptions. * @param authenticatorTypes An array of types describing the data to be retrieved. * @return A UserAuthenticationData object containing the data requested. */ public static UserAuthenticationData authenticate(final FileSystemOptions opts, final UserAuthenticationData.Type[] authenticatorTypes) { final UserAuthenticator auth = DefaultFileSystemConfigBuilder.getInstance().getUserAuthenticator(opts); return authenticate(auth, authenticatorTypes); }
protected AbstractFileSystem(final FileName rootName, final FileObject parentLayer, final FileSystemOptions fileSystemOptions) { this.parentLayer = parentLayer; this.rootName = rootName; this.fileSystemOptions = fileSystemOptions; final FileSystemConfigBuilder builder = DefaultFileSystemConfigBuilder.getInstance(); String uri = builder.getRootURI(fileSystemOptions); if (uri == null) { uri = rootName.getURI(); } this.rootURI = uri; }
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; } }
/** * Authenticates if there is an authenticator, else returns null. * * @param opts The FileSystemOptions. * @param authenticatorTypes An array of types describing the data to be retrieved. * @return A UserAuthenticationData object containing the data requested. */ public static UserAuthenticationData authenticate(final FileSystemOptions opts, final UserAuthenticationData.Type[] authenticatorTypes) { final UserAuthenticator auth = DefaultFileSystemConfigBuilder.getInstance().getUserAuthenticator(opts); return authenticate(auth, authenticatorTypes); }
protected AbstractFileSystem(final FileName rootName, final FileObject parentLayer, final FileSystemOptions fileSystemOptions) { this.parentLayer = parentLayer; this.rootName = rootName; this.fileSystemOptions = fileSystemOptions; final FileSystemConfigBuilder builder = DefaultFileSystemConfigBuilder.getInstance(); String uri = builder.getRootURI(fileSystemOptions); if (uri == null) { uri = rootName.getURI(); } this.rootURI = uri; }
/** * Sets the user authenticator to get authentication informations. * * @param opts The FileSystemOptions. * @param userAuthenticator The UserAuthenticator. * @throws FileSystemException if an error occurs setting the UserAuthenticator. */ public void setUserAuthenticator(final FileSystemOptions opts, final UserAuthenticator userAuthenticator) throws FileSystemException { setParam(opts, "userAuthenticator", userAuthenticator); }
/** * @see #setUserAuthenticator * @param opts The FileSystemOptions. * @return The UserAuthenticator. */ public UserAuthenticator getUserAuthenticator(final FileSystemOptions opts) { return (UserAuthenticator) getParam(opts, "userAuthenticator"); }
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; }
/** * Authenticates if there is an authenticator, else returns null. * * @param opts The FileSystemOptions. * @param authenticatorTypes An array of types describing the data to be retrieved. * @return A UserAuthenticationData object containing the data requested. */ public static UserAuthenticationData authenticate(final FileSystemOptions opts, final UserAuthenticationData.Type[] authenticatorTypes) { final UserAuthenticator auth = DefaultFileSystemConfigBuilder.getInstance().getUserAuthenticator(opts); return authenticate(auth, authenticatorTypes); }
protected AbstractFileSystem(final FileName rootName, final FileObject parentLayer, final FileSystemOptions fileSystemOptions) { this.parentLayer = parentLayer; this.rootName = rootName; this.fileSystemOptions = fileSystemOptions; final FileSystemConfigBuilder builder = DefaultFileSystemConfigBuilder.getInstance(); String uri = builder.getRootURI(fileSystemOptions); if (uri == null) { uri = rootName.getURI(); } this.rootURI = uri; }
/** * Sets the user authenticator to get authentication informations. * * @param opts The FileSystemOptions. * @param userAuthenticator The UserAuthenticator. * @throws FileSystemException if an error occurs setting the UserAuthenticator. */ public void setUserAuthenticator(final FileSystemOptions opts, final UserAuthenticator userAuthenticator) throws FileSystemException { setParam(opts, "userAuthenticator", userAuthenticator); }
/** * @see #setUserAuthenticator * @param opts The FileSystemOptions. * @return The UserAuthenticator. */ public UserAuthenticator getUserAuthenticator(final FileSystemOptions opts) { return (UserAuthenticator) getParam(opts, "userAuthenticator"); }
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; }
SshClient con = provider.createClient(config); if (username == null || password == null) { UserAuthenticator ua = DefaultFileSystemConfigBuilder.getInstance().getUserAuthenticator(fileSystemOptions); UserAuthenticationData data = ua.requestAuthentication(new UserAuthenticationData.Type[] { UserAuthenticationData.USERNAME, UserAuthenticationData.PASSWORD });
/** * Sets the user authenticator to get authentication informations. * @param opts The FileSystemOptions. * @param userAuthenticator The UserAuthenticator. * @throws FileSystemException if an error occurs setting the UserAuthenticator. */ public void setUserAuthenticator(final FileSystemOptions opts, final UserAuthenticator userAuthenticator) throws FileSystemException { setParam(opts, "userAuthenticator", userAuthenticator); }