Class UploadBean
java.lang.Object
se.datadosen.jalbum.UploadBean
- All Implemented Interfaces:
AutoCloseable,RemoteFSProgressMonitor
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
Nested ClassesModifier and TypeClassDescriptionclassUtility class that helps resolving (figuring out) paths and URLs to published albums -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAlbumBeanListener used to track and control file deletionvoidvoidaddPropertyChangeListener(String propertyName, PropertyChangeListener listener) voidEvent dispatching codevoidbytesTransferred(long bytes) Implements RemoteFSProgressMonitorbooleanCancels the preprocessing stage prior to uploading files (cancels calculation of what files to upload)voidclose()voidconnect()voiddeleteAlbum(AlbumObject root, String remoteDir) Remove all files and directories from remote album, then update properties for root album objectvoiddeleteDirectory(String remoteDir) Remove all files and directories from remote albumvoidvoiddownloadFile(RemoteFSNode node, File destination) voiddownloadFiles(String remotePath, File destination) protected voidfireErrorOccured(Exception param1, File param2) protected voidprotected voidprotected voidprotected voidprotected voidprotected voidprotected voidfirePropertyChange(String propertyName, Object oldValue, Object newValue) Support for reporting bound property changes for Object properties.The current directory when just logged in.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 directorygetExistingAlbumFiles(AlbumBean engine, String remoteDirectory, Consumer<RemoteFile> consumer) Same as above, but calls callback consumer for each remote file found, in case slow traversal is neededintgetPathFinder(AccountProfile account, AlbumBean engine) Return utility class that helps resolving (figuring out) paths and URLs to published albumsgetPathFinder(AlbumObject root, AlbumBean engine) static longgetTotalSize(Set<RemoteFile> files, int clusterSize) booleanbooleanbooleanbooleanvoidvoidRemoves a PropertyChangeListener from the listener list.voidvoidsetAccountProperties(AccountProfile account) voidsetFtpForceUTF8(boolean force) voidsetFtpPassword(String newFtpPassword) voidsetFtpPort(int newFtpPort) voidsetFtpServer(String newFtpServer) voidsetFtpUser(String newFtpUser) voidsetMyjalbum(boolean myjalbum) voidsetPassiveMode(boolean newPassiveMode) voidsetProtocol(TransferProtocol protocol) voidsetRemoteDirectory(String remoteDirectory) static voidshowErrorDialog(Component owner, RemoteFSException ex, String messagePrefix, String title) Convenience methodvoidtestConnection(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<RemoteFile> existingFiles) voiduploadFiles(File[] filesDirs, String remotePath)
-
Field Details
-
WEB_ROOT_PROPERTY
- See Also:
-
-
Constructor Details
-
UploadBean
public UploadBean() -
UploadBean
-
-
Method Details
-
addPropertyChangeListener
-
removePropertyChangeListener
Removes a PropertyChangeListener from the listener list. This method should be used to remove PropertyChangeListeners that were registered for all bound properties of this class.If listener is null, no exception is thrown and no action is performed.
- Parameters:
listener- the PropertyChangeListener to be removed- See Also:
-
addPropertyChangeListener
-
firePropertyChange
Support for reporting bound property changes for Object properties. This method can be called when a bound property has changed and it will send the appropriate PropertyChangeEvent to any registered PropertyChangeListeners.- Parameters:
propertyName- the property whose value has changedoldValue- the property's previous valuenewValue- the property's new value
-
getStopwatch
-
showErrorDialog
public static void showErrorDialog(Component owner, 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
-
deleteAlbum
public void deleteAlbum(AlbumObject root, String remoteDir) throws ParameterException, RemoteFSException, IOException Remove all files and directories from remote album, then update properties for root album object -
deleteDirectory
public void deleteDirectory(String remoteDir) throws ParameterException, RemoteFSException, IOException Remove all files and directories from remote album -
setFtpServer
-
getFtpServer
-
setFtpPort
- Throws:
RemoteFSException
-
getFtpPort
- Throws:
RemoteFSException
-
setFtpUser
-
getFtpUser
-
setFtpPassword
-
getFtpPassword
-
isMyjalbum
public boolean isMyjalbum() -
setMyjalbum
public void setMyjalbum(boolean myjalbum) -
isFtpForceUTF8
- Throws:
RemoteFSException
-
setFtpForceUTF8
- Throws:
RemoteFSException
-
getProtocol
-
setProtocol
-
setPassiveMode
- Throws:
RemoteFSException
-
isPassiveMode
- Throws:
RemoteFSException
-
setAccountProperties
-
connect
public void connect() throws RemoteFSException, IOException, AccountExpiredException, FailedLoginException- Throws:
RemoteFSExceptionIOExceptionAccountExpiredExceptionFailedLoginException- Since:
- 7.0
-
getRemoteDirectory
-
setRemoteDirectory
-
disconnect
public void disconnect()- Since:
- 7.0
-
isConnected
public boolean isConnected() -
testConnection
Test a connection to a remote filesystem Exceptions are thrown if connection could not be established. New in version 1.1- Throws:
RemoteFSExceptionIOException
-
getPrintableAlbumURL
-
getAlbumURL
-
getBaseDirectory
The current directory when just logged in. Relative paths should be relative to this directory -
getTotalSize
-
getExistingAlbumFiles
public NavigableSet<RemoteFile> getExistingAlbumFiles(AlbumBean engine, String remoteDirectory) throws IOException, 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:
IOExceptionRemoteFSException
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
getExistingAlbumFiles
public NavigableSet<RemoteFile> getExistingAlbumFiles(AlbumBean engine, String remoteDirectory, Consumer<RemoteFile> consumer) throws IOException, 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:
IOExceptionRemoteFSException
-
uploadAlbum
public AlbumManifest uploadAlbum(AlbumBean engine, boolean fullUpdate) throws RemoteFSException, IOException Upload an album to a server- Parameters:
fullUpdate- Throws ParameterException- Throws:
RemoteFSExceptionIOExceptionOperationAbortedException
-
uploadFiles
public void uploadFiles(File[] filesDirs, String remotePath) throws RemoteFSException, IOException, OperationAbortedException -
downloadFile
public void downloadFile(RemoteFSNode node, File destination) throws RemoteFSException, IOException, OperationAbortedException -
downloadFiles
public void downloadFiles(String remotePath, File destination) throws 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:
bytesTransferredin interfaceRemoteFSProgressMonitor
-
getPathFinder
public UploadBean.PathFinder getPathFinder(AccountProfile account, AlbumBean engine) throws IOException, RemoteFSException Return utility class that helps resolving (figuring out) paths and URLs to published albums- Parameters:
account-engine-- Returns:
- Throws:
IOExceptionRemoteFSException
-
getPathFinder
public UploadBean.PathFinder getPathFinder(AlbumObject root, AlbumBean engine) throws IOException, RemoteFSException - Throws:
IOExceptionRemoteFSException
-