Example usage for org.apache.commons.vfs2 FileSystemException printStackTrace

List of usage examples for org.apache.commons.vfs2 FileSystemException printStackTrace

Introduction

In this page you can find the example usage for org.apache.commons.vfs2 FileSystemException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:tw.edu.sinica.iis.SSHadoop.SSHFSOptions.java

public SSHFSOptions() {
    opts = new FileSystemOptions();
    try {//  w  w  w.  j a  v  a  2s  .com
        SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(opts, "no");
        SftpFileSystemConfigBuilder.getInstance().setUserDirIsRoot(opts, true);
    } catch (FileSystemException e) {
        e.printStackTrace();
    }
}

From source file:tw.edu.sinica.iis.SSHadoop.SSHFSOptions.java

public void setKnownHosts(final String hostFile) {
    if (!"".equals(hostFile)) {
        try {//from w  w w. ja  v a2  s . co  m
            SftpFileSystemConfigBuilder.getInstance().setKnownHosts(opts, new File(hostFile));
        } catch (FileSystemException e) {
            e.printStackTrace();
        }
    }
}

From source file:tw.edu.sinica.iis.SSHadoop.SSHFSOptions.java

public void setIdentity(final String identFile) {
    if (!"".equals(identFile)) {
        try {/*from   w w w .  j  a v a  2 s  .  c o m*/
            SftpFileSystemConfigBuilder.getInstance().setIdentities(opts, new File[] { new File(identFile) });
        } catch (FileSystemException e) {
            e.printStackTrace();
        }
    }
}

From source file:tw.edu.sinica.iis.SSHadoop.SSHSftp.java

public boolean sftpUpload(final String localDir, final String remoteDir) {
    try {// w  ww .  j  a v  a 2s .co  m
        manager.init();

        FileObject local = manager.resolveFile(localDir);
        FileObject remote = manager.resolveFile(genConnectString() + remoteDir, opts.getOptions());

        remote.copyFrom(local, Selectors.SELECT_ALL);

    } catch (FileSystemException e) {
        e.printStackTrace();
        return false;
    } finally {
        manager.close();
    }
    return true;
}

From source file:tw.edu.sinica.iis.SSHadoop.SSHSftp.java

public void sftpDownload(final String remoteDir, final String localDir) {
    try {/*from   w  w w .  j  a va2 s  .  c  o m*/
        manager.init();

        FileObject local = manager.resolveFile(localDir);
        FileObject remote = manager.resolveFile(genConnectString() + remoteDir, opts.getOptions());

        local.copyFrom(remote, Selectors.SELECT_ALL);

    } catch (FileSystemException e) {
        e.printStackTrace();
    } finally {
        manager.close();
    }
}

From source file:tw.edu.sinica.iis.SSHadoop.SSHSftp.java

public void sftpDelete(final String remoteDir) {
    try {/*from  ww  w  .  jav  a  2  s .co  m*/
        manager.init();

        FileObject remote = manager.resolveFile(genConnectString() + remoteDir, opts.getOptions());

        if (remote.exists()) {
            remote.delete(Selectors.SELECT_ALL);
        }

    } catch (FileSystemException e) {
        e.printStackTrace();
    } finally {
        manager.close();
    }
}