org.mmbase.module.builders.vwms
Class SCPcopy

java.lang.Object
  extended byorg.mmbase.module.builders.vwms.SCPcopy

public class SCPcopy
extends java.lang.Object

Performs a transfer of a file from the current server to a host. Uses invocation of ssh on the commandline to achieve its ends. Since no password is used, the client machine (this server) has to be configured to gain access (i.e. through the use of public keys). Also note that the client needs execute rights on ssh.
A system that directlky acecsses ssh, and does not make use of Execute is being developed.

Version:
$Id: SCPcopy.java,v 1.6 2003/03/10 11:50:24 pierre Exp $
Author:
Rico Jansen, Pierre van Rooden (javadocs)

Constructor Summary
SCPcopy()
          Deprecated. vpro-specific
SCPcopy(java.lang.String sshpath)
          Deprecated. vpro-specific
SCPcopy(java.lang.String sshpath, java.lang.String user)
          Deprecated. vpro-specific
SCPcopy(java.lang.String sshpath, java.lang.String user, java.lang.String host)
          Deprecated. vpro-specific
SCPcopy(java.lang.String sshpath, java.lang.String user, java.lang.String host, java.lang.String path)
          SCPCopy Constructor.
 
Method Summary
 void copy(java.lang.String base, java.lang.String src)
          Transfers a file from this server to the host.
 void copy(java.lang.String base, java.lang.String src, java.lang.String dst)
          Transfers a file from this server to a host.
 java.lang.String getHost()
          Get name of the destination host
 java.lang.String getPath()
          Get root-path of the file at the destination host
 java.lang.String getSSHpath()
          Get path to ssh command
 java.lang.String getUser()
          Get name of the destination user.
static void main(java.lang.String[] args)
          Deprecated. VPRO-specific
 boolean mkdir(java.lang.String path)
          Creates a directory at the host.
 boolean mkdirs(java.lang.String path)
          Creates a full directory path at the host.
 boolean realcopy(java.lang.String src, java.lang.String dst)
          Transfers a file at this server to the host.
 boolean remove(java.lang.String path)
          Removes a file at the host.
 boolean removedir(java.lang.String path)
          Removes a directory at the host.
 boolean rename(java.lang.String src, java.lang.String dst)
          Renames a file at the host.
 void setHost(java.lang.String host)
          Set name of the destination host
 void setPath(java.lang.String path)
          Set root-path of the file at the destination host
 void setSSHpath(java.lang.String path)
          Set path to ssh command
 void setUser(java.lang.String user)
          Set name of the destination user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SCPcopy

public SCPcopy()
Deprecated. vpro-specific

SCPCopy Constructor.


SCPcopy

public SCPcopy(java.lang.String sshpath)
Deprecated. vpro-specific

SCPCopy Constructor.

Parameters:
sshpath - Path to ssh command

SCPcopy

public SCPcopy(java.lang.String sshpath,
               java.lang.String user)
Deprecated. vpro-specific

SCPCopy Constructor.

Parameters:
sshpath - Path to ssh command
user - User name needed to log on at the destination host

SCPcopy

public SCPcopy(java.lang.String sshpath,
               java.lang.String user,
               java.lang.String host)
Deprecated. vpro-specific

SCPCopy Constructor.

Parameters:
sshpath - Path to ssh command
user - User name needed to log on at the destination host
host - Name of the destination host

SCPcopy

public SCPcopy(java.lang.String sshpath,
               java.lang.String user,
               java.lang.String host,
               java.lang.String path)
SCPCopy Constructor.

Parameters:
sshpath - Path to ssh command
user - User name needed to log on at the destination host
host - Name of the destination host
path - Root path of the file at the destination host
Method Detail

copy

public void copy(java.lang.String base,
                 java.lang.String src,
                 java.lang.String dst)
Transfers a file from this server to a host. Creates directories if needed.

Parameters:
base - Root path of the file on this server
src - The actual file to transfer (includes path info)
dst - Name of the destination host

copy

public void copy(java.lang.String base,
                 java.lang.String src)
Transfers a file from this server to the host. Creates directories if needed.

Parameters:
base - Root path of the file on this server
src - The actual file to transfer (includes path info)

mkdir

public boolean mkdir(java.lang.String path)
Creates a directory at the host.

Parameters:
path - directory to create
Returns:
true if successful

mkdirs

public boolean mkdirs(java.lang.String path)
Creates a full directory path at the host.

Parameters:
path - path to create
Returns:
true if successful

rename

public boolean rename(java.lang.String src,
                      java.lang.String dst)
Renames a file at the host.

Parameters:
src - Original file name
dst - New file name
Returns:
true if successful

realcopy

public boolean realcopy(java.lang.String src,
                        java.lang.String dst)
Transfers a file at this server to the host. Directories should already exist.

Parameters:
src - file path at this server
dst - new file path at the host
Returns:
true if successful

remove

public boolean remove(java.lang.String path)
Removes a file at the host.

Parameters:
path - path of the file to remove
Returns:
true if successful

removedir

public boolean removedir(java.lang.String path)
Removes a directory at the host.

Parameters:
path - path of the directory to remove
Returns:
true if successful

getSSHpath

public java.lang.String getSSHpath()
Get path to ssh command


getPath

public java.lang.String getPath()
Get root-path of the file at the destination host


getHost

public java.lang.String getHost()
Get name of the destination host


getUser

public java.lang.String getUser()
Get name of the destination user.


setSSHpath

public void setSSHpath(java.lang.String path)
Set path to ssh command


setPath

public void setPath(java.lang.String path)
Set root-path of the file at the destination host


setHost

public void setHost(java.lang.String host)
Set name of the destination host


setUser

public void setUser(java.lang.String user)
Set name of the destination user.


main

public static void main(java.lang.String[] args)
Deprecated. VPRO-specific

Entry for direct invocation from the commandline. Usage:
java SCPCopy [basedir],[filepath],[destinationhost]

Parameters:
args - The commandline arguments


MMBase build 1.7.4.20050922