Example usage for org.apache.commons.vfs2.provider GenericFileName getPath

List of usage examples for org.apache.commons.vfs2.provider GenericFileName getPath

Introduction

In this page you can find the example usage for org.apache.commons.vfs2.provider GenericFileName 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:fr.cls.atoll.motu.library.misc.vfs.provider.gsiftp.GsiFtpFileSystem.java

/**
 * Creates an FTP client to use.//from   w w w  .j a  va2  s.  c  om
 * 
 * @return the client
 * 
 * @throws FileSystemException the file system exception
 */
public GridFTPClient getClient() throws FileSystemException {
    synchronized (idleClientSync) {
        if (idleClient == null) {
            final GenericFileName rootName = (GenericFileName) getRoot().getName();

            LOG.debug("Creating connection to GSIFTP Host: " + rootName.getHostName() + " Port:"
                    + rootName.getPort() + " User:" + rootName.getUserName() + " Path: " + rootName.getPath());

            return GsiFtpClientFactory.createConnection(rootName.getHostName(), rootName.getPort(),
                    rootName.getUserName(), rootName.getPassword(),
                    // rootName.getPath(),
                    getFileSystemOptions());
        } else {
            final GridFTPClient client = idleClient;
            idleClient = null;
            return client;
        }
    }
}

From source file:org.pentaho.big.data.impl.vfs.hdfs.nc.NamedClusterProvider.java

@Override
protected FileSystem doCreateFileSystem(FileName name, FileSystemOptions fileSystemOptions)
        throws FileSystemException {
    GenericFileName genericFileName = (GenericFileName) name.getRoot();
    String clusterName = genericFileName.getHostName();
    String path = genericFileName.getPath();
    NamedCluster namedCluster = getNamedClusterByName(clusterName, fileSystemOptions);
    try {/*ww  w.  j a v a  2s . co  m*/
        if (namedCluster == null) {
            namedCluster = namedClusterService.getClusterTemplate();
        }
        String generatedUrl = namedCluster.processURLsubstitution(path == null ? "" : path,
                getMetastore(clusterName, fileSystemOptions), new Variables());
        URI uri = URI.create(generatedUrl);

        return new NamedClusterFileSystem(name, uri, fileSystemOptions,
                hadoopFileSystemLocator.getHadoopFilesystem(namedCluster, uri));
    } catch (ClusterInitializationException e) {
        throw new FileSystemException(e);
    }
}