Class CommonsFtpAdapter
java.lang.Object
net.jalbum.remotefs.commons.ftp.CommonsFtpAdapter
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected RemoteFSProgressMonitorprotected booleanprotected int -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCommonsFtpAdapter(org.apache.commons.net.ftp.FTPClient client) -
Method Summary
Modifier and TypeMethodDescriptionvoidAbort a connection attemptvoidConnect to remote server using user and passwordvoidcreateDirectory(String name) Create directory on remote filesystemvoidDisconnect from remote serverbooleanCheck the existence of a filebooleanexistsDirectory(String path) Check the existence of a directory (the ftp protocol can't determine existence of both files and directories in one call)voidget(String path, OutputStream out) protected org.apache.commons.net.ftp.FTPClientGet current remote directorygetFiles()Return all files in current remote directory.Return all files in spefified remote directory.intgetPort()Return port numbervoidgetUnmonitored(String path, OutputStream out) Allows us to get :filetree on CrushFTP (avoids stat call)booleanCheck if connected to remote systembooleanReturn whether UTF8 is forcedbooleanReturn if passive mode is usedvoidnoop()voidput(InputStream in, String path) voidPut file to remote systemvoidvoidremoveDirectory(String name) Remove directory from remote filesystemvoidremoveFile(String filename) Remove file from remote systemvoidvoidsetDirectory(String directory) Set remote directoryvoidsetForceUTF8(boolean force) Force using UTF8 to remote filesystemvoidsetPassiveMode(boolean passive) Set access mode to passivevoidsetPort(int port) Set port to use to access remote filesystemvoidGet reports on file currently being transferredvoidGo to parent directory of current remote directory
-
Field Details
-
port
protected int port -
forceUTF8
protected boolean forceUTF8 -
passive
protected boolean passive -
monitor
-
-
Constructor Details
-
CommonsFtpAdapter
public CommonsFtpAdapter() -
CommonsFtpAdapter
protected CommonsFtpAdapter(org.apache.commons.net.ftp.FTPClient client)
-
-
Method Details
-
getClient
protected org.apache.commons.net.ftp.FTPClient getClient() -
setPort
Description copied from interface:RemoteFSSet port to use to access remote filesystem- Specified by:
setPortin interfaceRemoteFS- Parameters:
port- port number to access remote filesystem- Throws:
RemoteFSException
-
getPort
Description copied from interface:RemoteFSReturn port number- Specified by:
getPortin interfaceRemoteFS- Returns:
- port number
- Throws:
RemoteFSException
-
setForceUTF8
Description copied from interface:RemoteFSForce using UTF8 to remote filesystem- Specified by:
setForceUTF8in interfaceRemoteFS- Parameters:
force- Use UTF8 if true- Throws:
RemoteFSException
-
isForceUTF8
Description copied from interface:RemoteFSReturn whether UTF8 is forced- Specified by:
isForceUTF8in interfaceRemoteFS- Returns:
- true if UTF8 forced
- Throws:
RemoteFSException
-
setPassiveMode
Description copied from interface:RemoteFSSet access mode to passive- Specified by:
setPassiveModein interfaceRemoteFS- Parameters:
passive- Use passive mode if true- Throws:
RemoteFSException
-
isPassiveMode
Description copied from interface:RemoteFSReturn if passive mode is used- Specified by:
isPassiveModein interfaceRemoteFS- Returns:
- true if passive mode
- Throws:
RemoteFSException
-
getDirectory
Description copied from interface:RemoteFSGet current remote directory- Specified by:
getDirectoryin interfaceRemoteFS- Returns:
- Current remote directory
- Throws:
RemoteFSExceptionIOException
-
setDirectory
Description copied from interface:RemoteFSSet remote directory- Specified by:
setDirectoryin interfaceRemoteFS- Parameters:
directory- Change remote directory to this directory- Throws:
RemoteFSExceptionIOException
-
toParentDirectory
Description copied from interface:RemoteFSGo to parent directory of current remote directory- Specified by:
toParentDirectoryin interfaceRemoteFS- Throws:
RemoteFSExceptionIOException
-
createDirectory
Description copied from interface:RemoteFSCreate directory on remote filesystem- Specified by:
createDirectoryin interfaceRemoteFS- Parameters:
name- Create directory with this name- Throws:
IOExceptionRemoteFSException
-
removeDirectory
Description copied from interface:RemoteFSRemove directory from remote filesystem- Specified by:
removeDirectoryin interfaceRemoteFS- Parameters:
name- Remove directory with this name- Throws:
IOExceptionRemoteFSException
-
connect
public void connect(String server, String user, String password) throws IOException, RemoteFSException Description copied from interface:RemoteFSConnect to remote server using user and password- Specified by:
connectin interfaceRemoteFS- Parameters:
server- server to connect touser- user to use for authenticationpassword- password for authenticating user- Throws:
IOExceptionRemoteFSException
-
abortConnect
Description copied from interface:RemoteFSAbort a connection attempt- Specified by:
abortConnectin interfaceRemoteFS- Throws:
RemoteFSExceptionIOException
-
disconnect
Description copied from interface:RemoteFSDisconnect from remote server- Specified by:
disconnectin interfaceRemoteFS- Throws:
IOExceptionRemoteFSException
-
isConnected
Description copied from interface:RemoteFSCheck if connected to remote system- Specified by:
isConnectedin interfaceRemoteFS- Returns:
- true if connected to remote system
- Throws:
RemoteFSException
-
getFiles
Description copied from interface:RemoteFSReturn all files in current remote directory.- Specified by:
getFilesin interfaceRemoteFS- Returns:
- Array of RemoteFiles
- Throws:
IOExceptionRemoteFSException
-
getFiles
Description copied from interface:RemoteFSReturn all files in spefified remote directory.- Specified by:
getFilesin interfaceRemoteFS- Returns:
- Array of RemoteFiles
- Throws:
IOExceptionRemoteFSException- deprecated unsafe with spaces in directories on ftp servers
-
noop
- Specified by:
noopin interfaceRemoteFS- Throws:
IOExceptionRemoteFSException
-
putFile
Description copied from interface:RemoteFSPut file to remote system- Specified by:
putFilein interfaceRemoteFS- Parameters:
file- File to copy to remote system- Throws:
IOExceptionRemoteFSException
-
putFile
- Specified by:
putFilein interfaceRemoteFS- Throws:
IOExceptionRemoteFSException
-
put
- Specified by:
putin interfaceRemoteFS- Throws:
IOExceptionRemoteFSException
-
get
- Specified by:
getin interfaceRemoteFS- Throws:
IOExceptionRemoteFSException
-
getUnmonitored
Description copied from interface:RemoteFSAllows us to get :filetree on CrushFTP (avoids stat call)- Specified by:
getUnmonitoredin interfaceRemoteFS- Throws:
IOExceptionRemoteFSException
-
removeFile
Description copied from interface:RemoteFSRemove file from remote system- Specified by:
removeFilein interfaceRemoteFS- Parameters:
filename- File te remove from remote system- Throws:
IOExceptionRemoteFSException
-
rename
- Specified by:
renamein interfaceRemoteFS- Throws:
IOExceptionRemoteFSException- See Also:
-
setProgressMonitor
Description copied from interface:RemoteFSGet reports on file currently being transferred- Specified by:
setProgressMonitorin interfaceRemoteFS
-
exists
Description copied from interface:RemoteFSCheck the existence of a file- Specified by:
existsin interfaceRemoteFS- Throws:
IOExceptionRemoteFSException
-
existsDirectory
Description copied from interface:RemoteFSCheck the existence of a directory (the ftp protocol can't determine existence of both files and directories in one call)- Specified by:
existsDirectoryin interfaceRemoteFS- Throws:
IOExceptionRemoteFSException
-