Example usage for org.apache.commons.vfs.util DelegatingFileSystemOptionsBuilder setConfigString

List of usage examples for org.apache.commons.vfs.util DelegatingFileSystemOptionsBuilder setConfigString

Introduction

In this page you can find the example usage for org.apache.commons.vfs.util DelegatingFileSystemOptionsBuilder setConfigString.

Prototype

public void setConfigString(final FileSystemOptions fso, final String scheme, final String name,
        final String value) throws FileSystemException 

Source Link

Document

Set a single string value.

Usage

From source file:org.pentaho.di.core.vfs.configuration.KettleGenericFileSystemConfigBuilder.java

@Override
public void setParameter(FileSystemOptions opts, String name, String value, String fullParameterName,
        String vfsUrl) throws IOException {
    // Use the DelgatingFileSystemOptionsBuilder to insert generic parameters
    // This must be done to assure the correct VFS FileSystem drivers will process the parameters
    String scheme = extractScheme(fullParameterName);
    try {/*from   ww  w  . jav a 2  s  .com*/
        DelegatingFileSystemOptionsBuilder delegateFSOptionsBuilder = new DelegatingFileSystemOptionsBuilder(
                KettleVFS.getInstance().getFileSystemManager());
        if (scheme != null) {
            delegateFSOptionsBuilder.setConfigString(opts, scheme, name, value);
        } else {
            log.logMinimal("Warning: Cannot process VFS parameters if no scheme is specified: " + vfsUrl);
        }
    } catch (FileSystemException e) {
        if (e.getCode().equalsIgnoreCase("vfs.provider/config-key-invalid.error")) {
            // This key is not supported by the default scheme config builder. This may be a custom key of another config
            // builder
            log.logMinimal("Warning: The configuration parameter [" + name
                    + "] is not supported by the default configuration builder for scheme: " + scheme);
        } else {
            // An unexpected error has occurred loading in parameters
            throw new IOException(e.getLocalizedMessage());
        }
    }
}