net.sourceforge.cruisecontrol.util
Class AbstractFTPClass

java.lang.Object
  extended bynet.sourceforge.cruisecontrol.util.AbstractFTPClass
Direct Known Subclasses:
CurrentBuildStatusFTPBootstrapper, CurrentBuildStatusFTPListener, CurrentBuildStatusFTPPublisher, FTPPublisher

public abstract class AbstractFTPClass
extends java.lang.Object

Generic class that acts as a parent to FTP related tasks to push files out to a host.

Author:
Matt Albrecht

Constructor Summary
AbstractFTPClass()
           
 
Method Summary
protected  void closeFTP(org.apache.commons.net.ftp.FTPClient ftp)
           
protected  void makeDir(org.apache.commons.net.ftp.FTPClient ftp, java.lang.String dir, boolean ignoreFailures)
           
protected  void makeDirs(org.apache.commons.net.ftp.FTPClient ftp, java.lang.String pathname, java.util.Vector knownPaths)
          Creates all parent directories specified in a complete relative pathname.
protected  void makeDirsForFile(org.apache.commons.net.ftp.FTPClient ftp, java.lang.String filename, java.util.Vector knownPaths)
           
protected  org.apache.commons.net.ftp.FTPClient openFTP()
           
protected  java.lang.String resolveFile(java.lang.String file)
           
protected  void sendFile(org.apache.commons.net.ftp.FTPClient ftp, java.io.File infile, java.lang.String outfilename)
          The parent directories need to exist before putting this file.
protected  void sendFileToFTPPath(java.lang.String text, java.lang.String path)
          Sends the specified text into the specified path on the FTP server
protected  void sendStream(org.apache.commons.net.ftp.FTPClient ftp, java.io.InputStream instream, java.lang.String outfilename)
          The parent directories need to exist before putting this file.
protected  void setBinary(org.apache.commons.net.ftp.FTPClient ftp)
           
 void setPassive(boolean p)
           
 void setTargetDir(java.lang.String targetDir)
           
 void setTargetHost(java.lang.String targetHost)
           
 void setTargetPasswd(java.lang.String targetPasswd)
           
 void setTargetPort(int targetPort)
           
 void setTargetSeparator(java.lang.String targetSeparator)
           
 void setTargetUser(java.lang.String targetUser)
           
 void validate()
          Called after the configuration is read to make sure that all the mandatory parameters were specified..
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractFTPClass

public AbstractFTPClass()
Method Detail

setTargetUser

public void setTargetUser(java.lang.String targetUser)

setTargetHost

public void setTargetHost(java.lang.String targetHost)

setTargetPort

public void setTargetPort(int targetPort)

setTargetPasswd

public void setTargetPasswd(java.lang.String targetPasswd)

setTargetDir

public void setTargetDir(java.lang.String targetDir)

setTargetSeparator

public void setTargetSeparator(java.lang.String targetSeparator)

setPassive

public void setPassive(boolean p)

validate

public void validate()
              throws CruiseControlException
Called after the configuration is read to make sure that all the mandatory parameters were specified..

Throws:
CruiseControlException - if there was a configuration error.

openFTP

protected org.apache.commons.net.ftp.FTPClient openFTP()
                                                throws CruiseControlException
Throws:
CruiseControlException

closeFTP

protected void closeFTP(org.apache.commons.net.ftp.FTPClient ftp)

setBinary

protected void setBinary(org.apache.commons.net.ftp.FTPClient ftp)
                  throws CruiseControlException
Throws:
CruiseControlException

makeDir

protected void makeDir(org.apache.commons.net.ftp.FTPClient ftp,
                       java.lang.String dir,
                       boolean ignoreFailures)
                throws CruiseControlException
Throws:
CruiseControlException

sendFile

protected void sendFile(org.apache.commons.net.ftp.FTPClient ftp,
                        java.io.File infile,
                        java.lang.String outfilename)
                 throws CruiseControlException
The parent directories need to exist before putting this file.

Throws:
CruiseControlException

sendStream

protected void sendStream(org.apache.commons.net.ftp.FTPClient ftp,
                          java.io.InputStream instream,
                          java.lang.String outfilename)
                   throws CruiseControlException
The parent directories need to exist before putting this file.

Throws:
CruiseControlException

resolveFile

protected java.lang.String resolveFile(java.lang.String file)

makeDirsForFile

protected void makeDirsForFile(org.apache.commons.net.ftp.FTPClient ftp,
                               java.lang.String filename,
                               java.util.Vector knownPaths)
                        throws CruiseControlException
Throws:
CruiseControlException

makeDirs

protected void makeDirs(org.apache.commons.net.ftp.FTPClient ftp,
                        java.lang.String pathname,
                        java.util.Vector knownPaths)
                 throws CruiseControlException
Creates all parent directories specified in a complete relative pathname. Attempts to create existing directories will not cause errors.

Throws:
CruiseControlException

sendFileToFTPPath

protected void sendFileToFTPPath(java.lang.String text,
                                 java.lang.String path)
                          throws CruiseControlException
Sends the specified text into the specified path on the FTP server

Parameters:
text -
path -
Throws:
CruiseControlException