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.
  • Constructor Details

    • UploadBean

      public UploadBean()
  • Method Details

    • getStopwatch

      public Stopwatch 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

      public void setFtpServer(String newFtpServer)
    • getFtpServer

      public String 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

      public void setFtpUser(String newFtpUser)
    • getFtpUser

      public String getFtpUser()
    • setFtpPassword

      public void setFtpPassword(String newFtpPassword)
    • getFtpPassword

      public String 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

      public TransferProtocol getProtocol()
    • setProtocol

      public void setProtocol(TransferProtocol protocol)
    • 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

      public void setAccountProperties(AccountProfile account)
    • 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

      public String getPrintableAlbumURL()
    • getAlbumURL

      public String getAlbumURL()
    • getBaseDirectory

      public String getBaseDirectory()
      The current directory when just logged in. Relative paths should be relative to this directory
    • getTotalSize

      public static long getTotalSize(Set<info.cqs.remotefs.RemoteFile> files, int clusterSize)
    • 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 interface AutoCloseable
    • 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
    • uploadAlbum

      public AlbumManifest uploadAlbum(AlbumBean engine, boolean fullUpdate, Set<File> localAlbumFiles, NavigableSet<info.cqs.remotefs.RemoteFile> existingFiles) throws info.cqs.remotefs.RemoteFSException, IOException, OperationAbortedException
      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

      public void addTransferListener(TransferListener l)
      Event dispatching code
    • removeTransferListener

      public void removeTransferListener(TransferListener l)
    • fireProgress

      protected void fireProgress(ProgressEvent e)
    • fireFileProcessingStarted

      protected void fireFileProcessingStarted(ProgressEvent e)
    • fireFileProcessingProgress

      protected void fireFileProcessingProgress(ProgressEvent e)
    • fireFileProcessingFinished

      protected void fireFileProcessingFinished(ProgressEvent e)
    • fireErrorOccured

      protected void fireErrorOccured(Exception param1, File param2)
    • addAlbumBeanListener

      public void addAlbumBeanListener(AlbumBeanListener l)
      AlbumBeanListener used to track and control file deletion
    • removeAlbumBeanListener

      public void removeAlbumBeanListener(AlbumBeanListener l)
    • fireImageProcessingStarted

      protected void fireImageProcessingStarted(AlbumBeanEvent e)
    • fireImageProcessingFinished

      protected void fireImageProcessingFinished(AlbumBeanEvent e)
    • bytesTransferred

      public void bytesTransferred(long bytes)
      Implements RemoteFSProgressMonitor
      Specified by:
      bytesTransferred in interface info.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