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

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

Introduction

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

Prototype

public static void cleanup(UserAuthenticationData authData) 

Source Link

Document

cleanup the data in the UerAuthenticationData (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.  c o  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);
}