Class RemoteFSBean
java.lang.Object
net.jalbum.remotefs.RemoteFSBean
- All Implemented Interfaces:
RemoteFS,RemoteFSDelegate
Bean implementation of RemoteFS.
Simplifies use of Remote filesystems. Functions as a proxy for the real RemoteFS implementation.
Currently only FTP and SFTP are supported.
This bean determines whether to use ftp or sftp depending on secure setting.
Has method testConnection to test connection to Remote FileSystem.
Simplifies use of Remote filesystems. Functions as a proxy for the real RemoteFS implementation.
Currently only FTP and SFTP are supported.
This bean determines whether to use ftp or sftp depending on secure setting.
Has method testConnection to test connection to Remote FileSystem.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidAbort a connection attemptstatic voidaddDiskSpaceListener(DiskSpaceListener listener) voidConnect to remote server using user and passwordvoidcreateDirectory(String name) Create directory on remote filesystemstatic RemoteFSDelegateFactory method that ensures we get a proxy in front of this class that handles logging and error retriesvoidDisconnect 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)static voidvoidget(String path, OutputStream out) Get current remote directorygetFiles()Return all files in current remote directory.Return all files in spefified remote directory.getFiles(String dir, RemoteFileFilter filter) getFiles(RemoteFileFilter filter) 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 usedbooleanvoidnoop()voidput(InputStream in, String path) voidPut file to remote systemvoidvoidvoidremoveDirectory(String name) Remove directory from remote filesystemstatic voidremoveDiskSpaceListener(DiskSpaceListener listener) voidremoveFile(String filename) Remove file from remote systemvoidrenamevoidsetDirectory(String directory) Set remote directoryvoidsetForceUTF8(boolean force) Force using UTF8 to remote filesystemvoidsetPassiveMode(boolean mode) Set access mode to passivevoidsetPort(int port) Set port to use to access remote filesystemvoidsetProgressMonitorvoidsetProtocol(TransferProtocol protocol) voidsetTrackDiskSpaceUsage(boolean trackDiskSpaceUsage) voidtestConnection(String server, String user, String password) Test connection to Remote FileSystemvoidGo to parent directory of current remote directory
-
Field Details
-
noDotDotDotFileFilter
-
-
Method Details
-
isTrackDiskSpaceUsage
public boolean isTrackDiskSpaceUsage()- Specified by:
isTrackDiskSpaceUsagein interfaceRemoteFSDelegate
-
setTrackDiskSpaceUsage
public void setTrackDiskSpaceUsage(boolean trackDiskSpaceUsage) - Specified by:
setTrackDiskSpaceUsagein interfaceRemoteFSDelegate
-
createInstance
Factory method that ensures we get a proxy in front of this class that handles logging and error retries- Returns:
-
getProtocol
-
setProtocol
- Specified by:
setProtocolin interfaceRemoteFSDelegate
-
testConnection
public void testConnection(String server, String user, String password) throws IOException, RemoteFSException Test connection to Remote FileSystem- Specified by:
testConnectionin interfaceRemoteFSDelegate- Throws:
IOExceptionRemoteFSException
-
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- See Also:
-
getPort
Description copied from interface:RemoteFSReturn port number- Specified by:
getPortin interfaceRemoteFS- Returns:
- port number
- Throws:
RemoteFSException- See Also:
-
setForceUTF8
Description copied from interface:RemoteFSForce using UTF8 to remote filesystem- Specified by:
setForceUTF8in interfaceRemoteFS- Parameters:
force- Use UTF8 if true- Throws:
RemoteFSException- See Also:
-
isForceUTF8
Description copied from interface:RemoteFSReturn whether UTF8 is forced- Specified by:
isForceUTF8in interfaceRemoteFS- Returns:
- true if UTF8 forced
- Throws:
RemoteFSException- See Also:
-
setPassiveMode
Description copied from interface:RemoteFSSet access mode to passive- Specified by:
setPassiveModein interfaceRemoteFS- Parameters:
mode- Use passive mode if true- Throws:
RemoteFSException- See Also:
-
isPassiveMode
Description copied from interface:RemoteFSReturn if passive mode is used- Specified by:
isPassiveModein interfaceRemoteFS- Returns:
- true if passive mode
- Throws:
RemoteFSException- See Also:
-
getDirectory
Description copied from interface:RemoteFSGet current remote directory- Specified by:
getDirectoryin interfaceRemoteFS- Returns:
- Current remote directory
- Throws:
IOExceptionRemoteFSException- See Also:
-
setDirectory
Description copied from interface:RemoteFSSet remote directory- Specified by:
setDirectoryin interfaceRemoteFS- Parameters:
directory- Change remote directory to this directory- Throws:
IOExceptionRemoteFSException- See Also:
-
toParentDirectory
Description copied from interface:RemoteFSGo to parent directory of current remote directory- Specified by:
toParentDirectoryin interfaceRemoteFS- Throws:
RemoteFSExceptionIOException- See Also:
-
createDirectory
Description copied from interface:RemoteFSCreate directory on remote filesystem- Specified by:
createDirectoryin interfaceRemoteFS- Parameters:
name- Create directory with this name- Throws:
IOExceptionRemoteFSException- See Also:
-
removeDirectory
Description copied from interface:RemoteFSRemove directory from remote filesystem- Specified by:
removeDirectoryin interfaceRemoteFS- Parameters:
name- Remove directory with this name- Throws:
IOExceptionRemoteFSException- See Also:
-
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- See Also:
-
abortConnect
Description copied from interface:RemoteFSAbort a connection attempt- Specified by:
abortConnectin interfaceRemoteFS- Throws:
RemoteFSExceptionIOException
-
reconnect
- Specified by:
reconnectin interfaceRemoteFSDelegate- Throws:
RemoteFSExceptionIOException
-
disconnect
Description copied from interface:RemoteFSDisconnect from remote server- Specified by:
disconnectin interfaceRemoteFS- Throws:
IOExceptionRemoteFSException- See Also:
-
isConnected
Description copied from interface:RemoteFSCheck if connected to remote system- Specified by:
isConnectedin interfaceRemoteFS- Returns:
- true if connected to remote system
- Throws:
RemoteFSException- See Also:
-
getFiles
Description copied from interface:RemoteFSReturn all files in current remote directory.- Specified by:
getFilesin interfaceRemoteFS- Returns:
- Array of RemoteFiles
- Throws:
IOExceptionRemoteFSException- See Also:
-
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
-
getFiles
- Specified by:
getFilesin interfaceRemoteFSDelegate- Throws:
IOExceptionRemoteFSException
-
getFiles
public RemoteFile[] getFiles(String dir, RemoteFileFilter filter) throws IOException, RemoteFSException - Specified by:
getFilesin interfaceRemoteFSDelegate- 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- See Also:
-
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- See Also:
-
setProgressMonitor
setProgressMonitor- Specified by:
setProgressMonitorin interfaceRemoteFS- Parameters:
monitor- RemoteFSProgressMonitor
-
rename
rename- Specified by:
renamein interfaceRemoteFS- Parameters:
from- Stringto- String- Throws:
IOExceptionRemoteFSException- See Also:
-
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
-
noop
- Specified by:
noopin interfaceRemoteFS- Throws:
IOExceptionRemoteFSException
-
addDiskSpaceListener
-
removeDiskSpaceListener
-
fireDiskSpaceAffected
-