Example usage for org.apache.commons.vfs.provider URLFileName getPath

List of usage examples for org.apache.commons.vfs.provider URLFileName getPath

Introduction

In this page you can find the example usage for org.apache.commons.vfs.provider URLFileName getPath.

Prototype

public String getPath() 

Source Link

Document

Returns the absolute path of the file, relative to the root of the file system that the file belongs to.

Usage

From source file:org.pentaho.s3.vfs.S3FileNameParser.java

@Override
public FileName parseUri(VfsComponentContext vfsComponentContext, FileName fileName, String s)
        throws FileSystemException {
    if (fileName == null) {
        s = encodeAccessKeys(s);/*from  www  . j a  va  2 s  .c o m*/
    }
    URLFileName name = (URLFileName) super.parseUri(vfsComponentContext, fileName, s);
    FileType type = name.getType();

    /* There is a problem with parsing bucket uri which has not char "/" at the end.
     * In this case UrlParser parse URI and return filename with type file.
     * As S3 does not allow to store files without buckets - so bucket is always a folder
      */
    if (FileType.FILE.equals(type) && name.getPath().split("/").length == 2) {
        type = FileType.FOLDER;
    }
    String user = name.getUserName();
    String password = name.getPassword();
    return new S3FileName(name.getScheme(), name.getHostName(), name.getPort(), getDefaultPort(), user,
            password, name.getPath(), type, name.getQueryString());
}