se.datadosen.jalbum
Class UploadBean

java.lang.Object
  extended by se.datadosen.jalbum.UploadBean

public class UploadBean
extends java.lang.Object

Version 1.0
Glue between the JAlbum user interface and the RemoteFSBean ftp component. Also adds the "smart" upload feature by comparing file sizes.


Nested Class Summary
 class UploadBean.PathFinder
          Utility class that helps resolving (figuring out) paths and URLs to published albums
 
Constructor Summary
UploadBean()
           
 
Method Summary
 void addAlbumBeanListener(AlbumBeanListener l)
          AlbumBeanListener used to track and control file deletion
 void addTransferListener(TransferListener l)
          Event dispatching code
 void bytesTransferred(long bytes)
          Implements RemoteFSProgressMonitor
 void connect()
           
 void deleteDirectory(java.lang.String remoteDir)
          Remove all files and directories from remote album
 void disconnect()
           
 void downloadFile(RemoteFSNode node, java.io.File destination)
           
 void downloadFiles(java.lang.String remotePath, java.io.File destination)
           
protected  void finalize()
          Make sure UploadBean disconnects if finalized (security)
protected  void fireErrorOccured(java.lang.Exception param1, java.io.File param2)
           
protected  void fireFileProcessingFinished(ProgressEvent e)
           
protected  void fireFileProcessingProgress(ProgressEvent e)
           
protected  void fireFileProcessingStarted(ProgressEvent e)
           
protected  void fireImageProcessingFinished(AlbumBeanEvent e)
           
protected  void fireImageProcessingStarted(AlbumBeanEvent e)
           
 java.lang.String getAbsoluteURL()
           
 java.lang.String getBaseDirectory()
          The current directory when just logged in.
 java.util.Set<RemoteFile> getExistingAlbumFiles(java.lang.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 directory
 java.lang.String getFtpPassword()
           
 int getFtpPort()
           
 java.lang.String getFtpServer()
           
 java.lang.String getFtpUser()
           
 UploadBean.PathFinder getPathFinder(AccountProfile account, AlbumBean engine)
          Return utility class that helps resolving (figuring out) paths and URLs to published albums
 TransferProtocol getProtocol()
           
 RemoteFSDelegate getRemoteFS()
           
static long getTotalSize(java.util.Set<RemoteFile> files, int clusterSize)
           
 boolean isConnected()
           
 boolean isFtpForceUTF8()
           
 boolean isMyjalbum()
           
 boolean isPassiveMode()
           
 void removeAlbumBeanListener(AlbumBeanListener l)
           
 void removeTransferListener(TransferListener l)
           
 void setAbsoluteURL(java.lang.String absoluteURL)
           
 void setAccountProperties(AccountProfile account)
           
 void setFtpForceUTF8(boolean force)
           
 void setFtpPassword(java.lang.String newFtpPassword)
           
 void setFtpPort(int newFtpPort)
           
 void setFtpServer(java.lang.String newFtpServer)
           
 void setFtpUser(java.lang.String newFtpUser)
           
 void setMyjalbum(boolean myjalbum)
           
 void setPassiveMode(boolean newPassiveMode)
           
 void setProtocol(TransferProtocol protocol)
           
 void setSecureFtp(boolean newSecureFtp)
          Deprecated. use setProtocol instead
static void showErrorDialog(java.awt.Component owner, RemoteFSException ex, java.lang.String messagePrefix, java.lang.String title)
          Convenience method
 void testConnection(AlbumBean engine)
          Test a connection to a remote filesystem Exceptions are thrown if connection could not be established.
 AlbumManifest uploadAlbum(JAlbumContext context, boolean fullUpdate)
          Upload an album to a server
 AlbumManifest uploadAlbum(JAlbumContext context, boolean fullUpdate, java.util.Set<RemoteFile> existingFiles)
           
 void uploadFiles(java.io.File[] filesDirs, java.lang.String remotePath)
           
 void uploadHiresFiles(AlbumObject root, AlbumManifest manifest, java.lang.Long spaceLeft)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UploadBean

public UploadBean()
Method Detail

getAbsoluteURL

public java.lang.String getAbsoluteURL()

setAbsoluteURL

public void setAbsoluteURL(java.lang.String absoluteURL)

showErrorDialog

public static void showErrorDialog(java.awt.Component owner,
                                   RemoteFSException ex,
                                   java.lang.String messagePrefix,
                                   java.lang.String title)
Convenience method


finalize

protected void finalize()
                 throws java.lang.Throwable
Make sure UploadBean disconnects if finalized (security)

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

getRemoteFS

public RemoteFSDelegate getRemoteFS()

deleteDirectory

public void deleteDirectory(java.lang.String remoteDir)
                     throws ParameterException,
                            RemoteFSException,
                            java.io.IOException
Remove all files and directories from remote album

Throws:
ParameterException
RemoteFSException
java.io.IOException

setFtpServer

public void setFtpServer(java.lang.String newFtpServer)

getFtpServer

public java.lang.String getFtpServer()

setFtpPort

public void setFtpPort(int newFtpPort)
                throws RemoteFSException
Throws:
RemoteFSException

getFtpPort

public int getFtpPort()
               throws RemoteFSException
Throws:
RemoteFSException

setFtpUser

public void setFtpUser(java.lang.String newFtpUser)

getFtpUser

public java.lang.String getFtpUser()

setFtpPassword

public void setFtpPassword(java.lang.String newFtpPassword)

getFtpPassword

public java.lang.String getFtpPassword()

isMyjalbum

public boolean isMyjalbum()

setMyjalbum

public void setMyjalbum(boolean myjalbum)

isFtpForceUTF8

public boolean isFtpForceUTF8()
                       throws RemoteFSException
Throws:
RemoteFSException

setFtpForceUTF8

public void setFtpForceUTF8(boolean force)
                     throws RemoteFSException
Throws:
RemoteFSException

setSecureFtp

public void setSecureFtp(boolean newSecureFtp)
Deprecated. use setProtocol instead


getProtocol

public TransferProtocol getProtocol()

setProtocol

public void setProtocol(TransferProtocol protocol)

setPassiveMode

public void setPassiveMode(boolean newPassiveMode)
                    throws RemoteFSException
Throws:
RemoteFSException

isPassiveMode

public boolean isPassiveMode()
                      throws RemoteFSException
Throws:
RemoteFSException

setAccountProperties

public void setAccountProperties(AccountProfile account)

connect

public void connect()
             throws RemoteFSException,
                    java.io.IOException
Throws:
RemoteFSException
java.io.IOException
Since:
7.0

disconnect

public void disconnect()
Since:
7.0

isConnected

public boolean isConnected()

testConnection

public void testConnection(AlbumBean engine)
                    throws java.io.IOException,
                           RemoteFSException
Test a connection to a remote filesystem Exceptions are thrown if connection could not be established. New in version 1.1

Throws:
RemoteFSException
java.io.IOException

getBaseDirectory

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


getTotalSize

public static long getTotalSize(java.util.Set<RemoteFile> files,
                                int clusterSize)

getExistingAlbumFiles

public java.util.Set<RemoteFile> getExistingAlbumFiles(java.lang.String remoteDirectory)
                                                throws java.io.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:
java.io.IOException
RemoteFSException

uploadAlbum

public AlbumManifest uploadAlbum(JAlbumContext context,
                                 boolean fullUpdate)
                          throws RemoteFSException,
                                 java.io.IOException
Upload an album to a server

Parameters:
engine -
fullUpdate -
Throws:
ParameterException
RemoteFSException
java.io.IOException
OperationAbortedException

uploadAlbum

public AlbumManifest uploadAlbum(JAlbumContext context,
                                 boolean fullUpdate,
                                 java.util.Set<RemoteFile> existingFiles)
                          throws RemoteFSException,
                                 java.io.IOException,
                                 OperationAbortedException
Throws:
RemoteFSException
java.io.IOException
OperationAbortedException

uploadFiles

public void uploadFiles(java.io.File[] filesDirs,
                        java.lang.String remotePath)
                 throws RemoteFSException,
                        java.io.IOException,
                        OperationAbortedException
Throws:
RemoteFSException
java.io.IOException
OperationAbortedException

downloadFile

public void downloadFile(RemoteFSNode node,
                         java.io.File destination)
                  throws RemoteFSException,
                         java.io.IOException,
                         OperationAbortedException
Throws:
RemoteFSException
java.io.IOException
OperationAbortedException

downloadFiles

public void downloadFiles(java.lang.String remotePath,
                          java.io.File destination)
                   throws RemoteFSException,
                          java.io.IOException,
                          OperationAbortedException
Throws:
RemoteFSException
java.io.IOException
OperationAbortedException

uploadHiresFiles

public void uploadHiresFiles(AlbumObject root,
                             AlbumManifest manifest,
                             java.lang.Long spaceLeft)
                      throws RemoteFSException,
                             java.io.IOException,
                             OperationAbortedException
Throws:
RemoteFSException
java.io.IOException
OperationAbortedException

addTransferListener

public void addTransferListener(TransferListener l)
Event dispatching code


removeTransferListener

public void removeTransferListener(TransferListener l)

fireFileProcessingStarted

protected void fireFileProcessingStarted(ProgressEvent e)

fireFileProcessingProgress

protected void fireFileProcessingProgress(ProgressEvent e)

fireFileProcessingFinished

protected void fireFileProcessingFinished(ProgressEvent e)

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)

fireErrorOccured

protected void fireErrorOccured(java.lang.Exception param1,
                                java.io.File param2)

bytesTransferred

public void bytesTransferred(long bytes)
Implements RemoteFSProgressMonitor


getPathFinder

public UploadBean.PathFinder getPathFinder(AccountProfile account,
                                           AlbumBean engine)
                                    throws java.io.IOException,
                                           RemoteFSException
Return utility class that helps resolving (figuring out) paths and URLs to published albums

Parameters:
account -
engine -
Returns:
Throws:
java.io.IOException
RemoteFSException