Example usage for org.apache.commons.vfs FileSystem getAttribute

List of usage examples for org.apache.commons.vfs FileSystem getAttribute

Introduction

In this page you can find the example usage for org.apache.commons.vfs FileSystem getAttribute.

Prototype

Object getAttribute(String attrName) throws FileSystemException;

Source Link

Document

Gets the value of an attribute of the file system.

Usage

From source file:org.kalypso.simulation.grid.SimpleGridProcess.java

private FileObject createSandbox(final String tempDirName) throws FileSystemException {
    final String gridFtpRoot = "gridftp://" + m_targetHostName;
    final FileObject remoteRoot = m_manager.resolveFile(gridFtpRoot);
    final FileSystem fileSystem = remoteRoot.getFileSystem();

    // get home directory of user who created this job
    final String homeDirString = (String) fileSystem.getAttribute("HOME_DIRECTORY");
    final FileObject homeDir = remoteRoot.resolveFile(homeDirString);
    final FileObject workingDir = homeDir.resolveFile(tempDirName);
    workingDir.createFolder();//from   w  w  w  .  ja v a 2 s.com
    return workingDir;
}

From source file:org.kalypso.simulation.grid.TestGridFTP.java

public void testGridFTP() throws Exception {
    final FileSystemManager manager = VFSUtilities.getManager();

    final FileObject remoteRoot = manager.resolveFile("gsiftp://gramd1.gridlab.uni-hannover.de");
    final FileSystem fileSystem = remoteRoot.getFileSystem();
    final String homeDirString = (String) fileSystem.getAttribute(GsiFtpFileProvider.ATTR_HOME_DIR);
    final FileObject homeDir = remoteRoot.resolveFile(homeDirString);
    final String testDirName = "test";
    final FileObject localDir = manager.toFileObject(new File(testDirName));
    final FileObject remoteDir = homeDir.resolveFile(testDirName);
    final FileSynchronizer fileSynchronizer = new FileSynchronizer(localDir, remoteDir);
    fileSynchronizer.updateRemote();//  w  w  w .j ava2 s .co  m
    fileSynchronizer.updateLocal();
}