Example usage for org.apache.commons.vfs.util UserAuthenticatorUtils toChar

List of usage examples for org.apache.commons.vfs.util UserAuthenticatorUtils toChar

Introduction

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

Prototype

public static char[] toChar(String string) 

Source Link

Document

converts a string to a char array (null safe)

Usage

From source file:org.jclouds.vfs.provider.blobstore.BlobStoreFileProvider.java

protected FileSystem doCreateFileSystem(final FileName name, final FileSystemOptions fileSystemOptions)
        throws FileSystemException {
    BlobStoreFileName rootName = (BlobStoreFileName) name;
    UserAuthenticationData authData = null;
    BlobStoreContext context;//from   w w  w .j  av  a  2 s. co  m
    try {
        String uriToParse = rootName.getFriendlyURI();
        authData = UserAuthenticatorUtils.authenticate(fileSystemOptions, AUTHENTICATOR_TYPES);
        URI location = HttpUtils.createUri(uriToParse);
        context = new BlobStoreContextFactory().createContext(location.getHost(),
                UserAuthenticatorUtils
                        .toString(UserAuthenticatorUtils.getData(authData, UserAuthenticationData.USERNAME,
                                UserAuthenticatorUtils.toChar(rootName.getUserName()))),
                UserAuthenticatorUtils
                        .toString(UserAuthenticatorUtils.getData(authData, UserAuthenticationData.PASSWORD,
                                UserAuthenticatorUtils.toChar(rootName.getPassword()))),
                modules, new Properties());
    } finally {
        UserAuthenticatorUtils.cleanup(authData);
    }

    return new BlobStoreFileSystem(rootName, context, fileSystemOptions);
}