use of org.pentaho.di.core.vfs.configuration.IKettleFileSystemConfigBuilder in project pentaho-kettle by pentaho.
the class KettleVFS method buildFsOptions.
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;
}
Aggregations