com.emarsys.ecommon.files
Class ScpTransferHelper

java.lang.Object
  extended by com.emarsys.ecommon.files.ScpTransferHelper

public class ScpTransferHelper
extends java.lang.Object

A helper for transfering files via scp. Currently it supports only public/private-key-authentication. This could be done with the command-line client or with a java-client (this class wraps the implementation of trilead-ssh2) Be aware that those two implementations may behave different. Creationdate: Jan 25, 2008

Author:
Matthias Marchart
See Also:
http://www.trilead.com/Products/Trilead%2DSSH%2D2%2DJava/

Nested Class Summary
 class ScpTransferHelper.AcceptOnlyKnownHosts
          Accepts only known hosts in the known_hosts - file Creationdate: Jan 25, 2008
static class ScpTransferHelper.DefaultPrivateKeyFile
          The DEFAULT-KEY-FILE to use for authentication.
static class ScpTransferHelper.Implementation
          The implementation to use.
 class ScpTransferHelper.ScpTransferException
          Will be thrown iff the scp-transfer fails Creationdate: Jan 25, 2008
 
Field Summary
static java.lang.String DEFAULT_KNOWN_HOSTS
          The default place to look for the known_hosts - file is the home-directory of the user given in the constructor + DEFAULT_KNOWN_HOSTS
 
Constructor Summary
ScpTransferHelper(java.lang.String host, java.lang.Integer port, java.lang.String user)
          Constructs an ScpTransferHelper for transfer of files with PublicKey-Authentication.
ScpTransferHelper(java.lang.String host, java.lang.Integer port, java.lang.String user, java.lang.String identityFile)
          Constructs an ScpTransferHelper for transfer of files with PublicKey-Authentication.
ScpTransferHelper(java.lang.String host, java.lang.Integer port, java.lang.String user, java.lang.String identityFile, java.lang.String knownHostsFile)
          Constructs an ScpTransferHelper for transfer of files with PublicKey-Authentication.
 
Method Summary
 void transferFile(ScpTransferHelper.Implementation i, java.lang.String path, java.lang.String filename)
          Transfers the file with implementation i to the current directory on the server.
 void transferFile(ScpTransferHelper.Implementation i, java.lang.String path, java.lang.String filename, java.lang.String target)
          Transfers the file with implementation i to the given target on the server.
 void transferFileWithCmdLineScp(java.lang.String path, java.lang.String filename)
          Deprecated. 
 boolean transferFileWithCmdLineScp(java.lang.String path, java.lang.String filename, java.lang.String target)
          Deprecated. 
 void transferFileWithTrileadJavaScp(java.lang.String path, java.lang.String filename)
          Deprecated. 
 void transferFileWithTrileadJavaScp(java.lang.String path, java.lang.String filename, java.lang.String target)
          Deprecated. 
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_KNOWN_HOSTS

public static final java.lang.String DEFAULT_KNOWN_HOSTS
The default place to look for the known_hosts - file is the home-directory of the user given in the constructor + DEFAULT_KNOWN_HOSTS

See Also:
Constant Field Values
Constructor Detail

ScpTransferHelper

public ScpTransferHelper(java.lang.String host,
                         java.lang.Integer port,
                         java.lang.String user)
Constructs an ScpTransferHelper for transfer of files with PublicKey-Authentication. The Implementation uses the default-keyfile (this has to be placed in the users .ssh - directory. The keyfile existing will be used in the order resulting from the enum ScpTransferHelper.DefaultPrivateKeyFile) The Implementation verifies the serverkey against the knownHostsFile. A server not contained in the knownHostsFile is not accepted.

Parameters:
host -
port -
user -

ScpTransferHelper

public ScpTransferHelper(java.lang.String host,
                         java.lang.Integer port,
                         java.lang.String user,
                         java.lang.String identityFile)
Constructs an ScpTransferHelper for transfer of files with PublicKey-Authentication. The Implementation uses the keyfile given to the constructor and verifies the serverkey against the knownHostsFile. A server not contained in the knownHostsFile is not accepted.

Parameters:
host -
port -
user -
identityFile -

ScpTransferHelper

public ScpTransferHelper(java.lang.String host,
                         java.lang.Integer port,
                         java.lang.String user,
                         java.lang.String identityFile,
                         java.lang.String knownHostsFile)
Constructs an ScpTransferHelper for transfer of files with PublicKey-Authentication. The Implementation uses the keyfile given to the constructor and verifies the serverkey against the knownHostsFile. A server not contained in the knownHostsFile is not accepted.

Parameters:
host -
port -
user -
identityFile -
knownHostsFile -
Method Detail

transferFile

public void transferFile(ScpTransferHelper.Implementation i,
                         java.lang.String path,
                         java.lang.String filename)
                  throws ScpTransferHelper.ScpTransferException
Transfers the file with implementation i to the current directory on the server.

Parameters:
i -
path -
filename -
Throws:
ScpTransferHelper.ScpTransferException

transferFile

public void transferFile(ScpTransferHelper.Implementation i,
                         java.lang.String path,
                         java.lang.String filename,
                         java.lang.String target)
                  throws ScpTransferHelper.ScpTransferException
Transfers the file with implementation i to the given target on the server.

Parameters:
i -
path -
filename -
target -
Throws:
ScpTransferHelper.ScpTransferException

transferFileWithTrileadJavaScp

@Deprecated
public void transferFileWithTrileadJavaScp(java.lang.String path,
                                                      java.lang.String filename)
                                    throws ScpTransferHelper.ScpTransferException
Deprecated. 

Throws:
ScpTransferHelper.ScpTransferException

transferFileWithCmdLineScp

@Deprecated
public void transferFileWithCmdLineScp(java.lang.String path,
                                                  java.lang.String filename)
                                throws ScpTransferHelper.ScpTransferException
Deprecated. 

Throws:
ScpTransferHelper.ScpTransferException

transferFileWithTrileadJavaScp

@Deprecated
public void transferFileWithTrileadJavaScp(java.lang.String path,
                                                      java.lang.String filename,
                                                      java.lang.String target)
                                    throws ScpTransferHelper.ScpTransferException
Deprecated. 

Throws:
ScpTransferHelper.ScpTransferException

transferFileWithCmdLineScp

@Deprecated
public boolean transferFileWithCmdLineScp(java.lang.String path,
                                                     java.lang.String filename,
                                                     java.lang.String target)
                                   throws ScpTransferHelper.ScpTransferException
Deprecated. 

Throws:
ScpTransferHelper.ScpTransferException


Copyright © 2010 emarsys AG. All Rights Reserved.