Package se.datadosen.jalbum
Class UploadBean
java.lang.Object
se.datadosen.jalbum.UploadBean
- All Implemented Interfaces:
info.cqs.remotefs.RemoteFSProgressMonitor
,AutoCloseable
public class UploadBean
extends Object
implements info.cqs.remotefs.RemoteFSProgressMonitor, AutoCloseable
Version 1.0
Glue between the JAlbum user interface and the RemoteFSBean ftp component. Also adds the "smart" upload feature by comparing file sizes.
Glue between the JAlbum user interface and the RemoteFSBean ftp component. Also adds the "smart" upload feature by comparing file sizes.
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
Utility class that helps resolving (figuring out) paths and URLs to published albums -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
AlbumBeanListener used to track and control file deletionvoid
Event dispatching codevoid
bytesTransferred
(long bytes) Implements RemoteFSProgressMonitorboolean
Cancels the preprocessing stage prior to uploading files (cancels calculation of what files to upload)void
close()
void
connect()
void
deleteAlbum
(AlbumObject root, String remoteDir) Remove all files and directories from remote album, then update properties for root album objectvoid
deleteDirectory
(String remoteDir) Remove all files and directories from remote albumvoid
void
downloadFile
(RemoteFSNode node, File destination) void
downloadFiles
(String remotePath, File destination) protected void
fireErrorOccured
(Exception param1, File param2) protected void
protected void
protected void
protected void
protected void
protected void
The current directory when just logged in.NavigableSet<info.cqs.remotefs.RemoteFile>
getExistingAlbumFiles
(AlbumBean engine, String remoteDirectory) Attempt to gather the file contents under the specified remoteDirectory First try to grab the manifest.jmf file Then try CrushFTP's :filetree method Finally gather the contents by manually traversing the album directoryNavigableSet<info.cqs.remotefs.RemoteFile>
getExistingAlbumFiles
(AlbumBean engine, String remoteDirectory, Consumer<info.cqs.remotefs.RemoteFile> consumer) Same as above, but calls callback consumer for each remote file found, in case slow traversal is neededint
getPathFinder
(AccountProfile account, AlbumBean engine) Return utility class that helps resolving (figuring out) paths and URLs to published albumsgetPathFinder
(AlbumObject root, AlbumBean engine) info.cqs.remotefs.RemoteFSDelegate
static long
getTotalSize
(Set<info.cqs.remotefs.RemoteFile> files, int clusterSize) boolean
boolean
boolean
boolean
void
void
void
setAccountProperties
(AccountProfile account) void
setFtpForceUTF8
(boolean force) void
setFtpPassword
(String newFtpPassword) void
setFtpPort
(int newFtpPort) void
setFtpServer
(String newFtpServer) void
setFtpUser
(String newFtpUser) void
setMyjalbum
(boolean myjalbum) void
setPassiveMode
(boolean newPassiveMode) void
setProtocol
(TransferProtocol protocol) static void
showErrorDialog
(Component owner, info.cqs.remotefs.RemoteFSException ex, String messagePrefix, String title) Convenience methodvoid
testConnection
(AlbumBean engine) Test a connection to a remote filesystem Exceptions are thrown if connection could not be established.uploadAlbum
(AlbumBean engine, boolean fullUpdate) Upload an album to a serveruploadAlbum
(AlbumBean engine, boolean fullUpdate, Set<File> localAlbumFiles, NavigableSet<info.cqs.remotefs.RemoteFile> existingFiles) void
uploadFiles
(File[] filesDirs, String remotePath)
-
Constructor Details
-
UploadBean
public UploadBean()
-
-
Method Details
-
getStopwatch
-
showErrorDialog
public static void showErrorDialog(Component owner, info.cqs.remotefs.RemoteFSException ex, String messagePrefix, String title) Convenience method -
cancelUpload
public boolean cancelUpload()Cancels the preprocessing stage prior to uploading files (cancels calculation of what files to upload)- Returns:
- true if successful
- Since:
- 26.1
-
getRemoteFS
public info.cqs.remotefs.RemoteFSDelegate getRemoteFS() -
deleteAlbum
public void deleteAlbum(AlbumObject root, String remoteDir) throws ParameterException, info.cqs.remotefs.RemoteFSException, IOException Remove all files and directories from remote album, then update properties for root album object- Throws:
ParameterException
info.cqs.remotefs.RemoteFSException
IOException
-
deleteDirectory
public void deleteDirectory(String remoteDir) throws ParameterException, info.cqs.remotefs.RemoteFSException, IOException Remove all files and directories from remote album- Throws:
ParameterException
info.cqs.remotefs.RemoteFSException
IOException
-
setFtpServer
-
getFtpServer
-
setFtpPort
public void setFtpPort(int newFtpPort) throws info.cqs.remotefs.RemoteFSException - Throws:
info.cqs.remotefs.RemoteFSException
-
getFtpPort
public int getFtpPort() throws info.cqs.remotefs.RemoteFSException- Throws:
info.cqs.remotefs.RemoteFSException
-
setFtpUser
-
getFtpUser
-
setFtpPassword
-
getFtpPassword
-
isMyjalbum
public boolean isMyjalbum() -
setMyjalbum
public void setMyjalbum(boolean myjalbum) -
isFtpForceUTF8
public boolean isFtpForceUTF8() throws info.cqs.remotefs.RemoteFSException- Throws:
info.cqs.remotefs.RemoteFSException
-
setFtpForceUTF8
public void setFtpForceUTF8(boolean force) throws info.cqs.remotefs.RemoteFSException - Throws:
info.cqs.remotefs.RemoteFSException
-
getProtocol
-
setProtocol
-
setPassiveMode
public void setPassiveMode(boolean newPassiveMode) throws info.cqs.remotefs.RemoteFSException - Throws:
info.cqs.remotefs.RemoteFSException
-
isPassiveMode
public boolean isPassiveMode() throws info.cqs.remotefs.RemoteFSException- Throws:
info.cqs.remotefs.RemoteFSException
-
setAccountProperties
-
connect
public void connect() throws info.cqs.remotefs.RemoteFSException, IOException, AccountExpiredException, FailedLoginException- Throws:
info.cqs.remotefs.RemoteFSException
IOException
AccountExpiredException
FailedLoginException
- Since:
- 7.0
-
disconnect
public void disconnect()- Since:
- 7.0
-
isConnected
public boolean isConnected() -
testConnection
public void testConnection(AlbumBean engine) throws IOException, info.cqs.remotefs.RemoteFSException Test a connection to a remote filesystem Exceptions are thrown if connection could not be established. New in version 1.1- Throws:
info.cqs.remotefs.RemoteFSException
IOException
-
getPrintableAlbumURL
-
getAlbumURL
-
getBaseDirectory
The current directory when just logged in. Relative paths should be relative to this directory -
getTotalSize
-
getExistingAlbumFiles
public NavigableSet<info.cqs.remotefs.RemoteFile> getExistingAlbumFiles(AlbumBean engine, String remoteDirectory) throws IOException, info.cqs.remotefs.RemoteFSException Attempt to gather the file contents under the specified remoteDirectory First try to grab the manifest.jmf file Then try CrushFTP's :filetree method Finally gather the contents by manually traversing the album directory- Throws:
IOException
info.cqs.remotefs.RemoteFSException
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
getExistingAlbumFiles
public NavigableSet<info.cqs.remotefs.RemoteFile> getExistingAlbumFiles(AlbumBean engine, String remoteDirectory, Consumer<info.cqs.remotefs.RemoteFile> consumer) throws IOException, info.cqs.remotefs.RemoteFSException Same as above, but calls callback consumer for each remote file found, in case slow traversal is needed- Parameters:
engine
-remoteDirectory
-consumer
-- Returns:
- Throws:
IOException
info.cqs.remotefs.RemoteFSException
-
uploadAlbum
public AlbumManifest uploadAlbum(AlbumBean engine, boolean fullUpdate) throws info.cqs.remotefs.RemoteFSException, IOException Upload an album to a server- Parameters:
fullUpdate
- Throws ParameterException- Throws:
info.cqs.remotefs.RemoteFSException
IOException
OperationAbortedException
-
uploadFiles
public void uploadFiles(File[] filesDirs, String remotePath) throws info.cqs.remotefs.RemoteFSException, IOException, OperationAbortedException - Throws:
info.cqs.remotefs.RemoteFSException
IOException
OperationAbortedException
-
downloadFile
public void downloadFile(RemoteFSNode node, File destination) throws info.cqs.remotefs.RemoteFSException, IOException, OperationAbortedException - Throws:
info.cqs.remotefs.RemoteFSException
IOException
OperationAbortedException
-
downloadFiles
public void downloadFiles(String remotePath, File destination) throws info.cqs.remotefs.RemoteFSException, IOException, OperationAbortedException - Throws:
info.cqs.remotefs.RemoteFSException
IOException
OperationAbortedException
-
addTransferListener
Event dispatching code -
removeTransferListener
-
fireProgress
-
fireFileProcessingStarted
-
fireFileProcessingProgress
-
fireFileProcessingFinished
-
fireErrorOccured
-
addAlbumBeanListener
AlbumBeanListener used to track and control file deletion -
removeAlbumBeanListener
-
fireImageProcessingStarted
-
fireImageProcessingFinished
-
bytesTransferred
public void bytesTransferred(long bytes) Implements RemoteFSProgressMonitor- Specified by:
bytesTransferred
in interfaceinfo.cqs.remotefs.RemoteFSProgressMonitor
-
getPathFinder
public UploadBean.PathFinder getPathFinder(AccountProfile account, AlbumBean engine) throws IOException, info.cqs.remotefs.RemoteFSException Return utility class that helps resolving (figuring out) paths and URLs to published albums- Parameters:
account
-engine
-- Returns:
- Throws:
IOException
info.cqs.remotefs.RemoteFSException
-
getPathFinder
public UploadBean.PathFinder getPathFinder(AlbumObject root, AlbumBean engine) throws IOException, info.cqs.remotefs.RemoteFSException - Throws:
IOException
info.cqs.remotefs.RemoteFSException
-