|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.soa.esb.util.FtpClientUtil
public class FtpClientUtil
Simplified FTP transfers
Description: Implements a simple set of FTP functionality
Parameters to establish the FTP connection are provided at construction time
and cannot change during the lifetime of the object
Hides low level details. Current implementation is based on the
"Entreprise Distributed Technology edtFTPj" library
but this can be changed with no impact to existing code, just by changing
this class without modifying the signature of it's public methods
Nested Class Summary | |
---|---|
static class |
FtpClientUtil.XFER_TYPE
|
Field Summary | |
---|---|
static java.lang.String |
PARMS_ASCII
|
static java.lang.String |
PARMS_FTP_SERVER
|
static java.lang.String |
PARMS_LOCAL_DIR
|
static java.lang.String |
PARMS_PASSIVE
|
static java.lang.String |
PARMS_PASSWD
|
static java.lang.String |
PARMS_PORT
|
static java.lang.String |
PARMS_REMOTE_DIR
|
static java.lang.String |
PARMS_USER
|
Constructor Summary | |
---|---|
FtpClientUtil(ConfigTree p_oP,
boolean p_bConnect)
Checks validity and completeness of parameters, and keeps the info internally for subsequent FTP requests |
|
FtpClientUtil(java.util.List<KeyValuePair> attribs,
boolean connect)
|
Method Summary | |
---|---|
void |
deleteRemoteFile(java.lang.String p_sFile)
Deletes specified file in remote directory |
void |
downloadFile(java.lang.String p_sFile,
java.lang.String p_sFinalName)
Downloads specified file from remote directory (remoteDirURI) to local directory (localDirURI) |
static java.lang.String |
fileToFtpString(java.io.File p_oF)
|
java.lang.String[] |
getFileListFromRemoteDir(java.lang.String p_sSuffix)
Gets the list of files in the remote directory that end with arg0 |
java.lang.String |
getRemoteDir()
|
void |
quit()
Terminates ftp session and frees resources Well behaved programs should make sure to call this method |
void |
remoteDelete(java.io.File p_oFile)
|
void |
remoteRename(java.io.File p_oFrom,
java.io.File p_oTo)
|
void |
renameInRemoteDir(java.lang.String p_sFrom,
java.lang.String p_sTo)
Renames specified file in remote directory to specified new name |
void |
setRemoteDir(java.lang.String p_sDir)
Change remote directory |
void |
uploadFile(java.io.File p_oFile,
java.lang.String p_sRemoteName)
Uploads specified file from local directory (localDirURI) to remote directory (remoteDirURI) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String PARMS_FTP_SERVER
public static final java.lang.String PARMS_USER
public static final java.lang.String PARMS_PASSWD
public static final java.lang.String PARMS_PORT
public static final java.lang.String PARMS_REMOTE_DIR
public static final java.lang.String PARMS_LOCAL_DIR
public static final java.lang.String PARMS_ASCII
public static final java.lang.String PARMS_PASSIVE
Constructor Detail |
---|
public FtpClientUtil(ConfigTree p_oP, boolean p_bConnect) throws java.lang.Exception
p_oP
- ConfigTree
java.lang.Exception
- : if parameters are invalid or incomplete
public FtpClientUtil(java.util.List<KeyValuePair> attribs, boolean connect) throws java.lang.Exception
java.lang.Exception
Method Detail |
---|
public java.lang.String getRemoteDir()
public void quit()
public void deleteRemoteFile(java.lang.String p_sFile) throws java.lang.Exception
p_sFile
- String : filename to delete. Method will attempt to delete
file with rightmost node of argument within remote directory specified in 'remoteDirURI'
java.lang.Exception
- : if ftp connection cannot be established, or file
cannot be deleted in remote directorypublic void remoteDelete(java.io.File p_oFile) throws java.lang.Exception
java.lang.Exception
public java.lang.String[] getFileListFromRemoteDir(java.lang.String p_sSuffix) throws java.lang.Exception
p_sSuffix
- String : retrieve only files that end with that suffix - all files if null
java.lang.Exception
- : if ftp connection cannot be established, or problems encounteredpublic void setRemoteDir(java.lang.String p_sDir) throws java.lang.Exception
p_sDir
- String : directory to set
java.lang.Exception
- : if ftp connection cannot be established, or problems encounteredpublic void renameInRemoteDir(java.lang.String p_sFrom, java.lang.String p_sTo) throws java.lang.Exception
p_sFrom
- String : filename to renamep_sTo
- String : new filename
java.lang.Exception
- : if ftp connection cannot be established, or file
cannot be renamed to new name in remote directory
public void remoteRename(java.io.File p_oFrom, java.io.File p_oTo) throws java.lang.Exception
java.lang.Exception
public void uploadFile(java.io.File p_oFile, java.lang.String p_sRemoteName) throws java.lang.Exception
p_sFile
- String : filename to upload
java.lang.Exception
- : if ftp connection cannot be established, or file
cannot be uploaded
public void downloadFile(java.lang.String p_sFile, java.lang.String p_sFinalName) throws java.lang.Exception
p_sFile
- String : filename to download
java.lang.Exception
- : if ftp connection cannot be established, or file
cannot be downloaded
public static java.lang.String fileToFtpString(java.io.File p_oF)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |