Package unlimited.fc.client.api
Interface DownloadAppletLiveConnect
-
public interface DownloadAppletLiveConnectTitle: FileCatalyst Download Applet LiveConnect API Spec
Description: The following methods are available via JavaScript
Basic workflow for utilizing Download applet using LIVE Javascript calls:
- Load and initialize applet. Callback value can be defined in Javascript parameter "callurlonload" to trigger a javascript call when the applet is ready for use, and calls can be made to the applet.
- Suggest where the directory browser windows will be initialized to via the call setRecommendedDir(). By default, the user home directory is chosen.
- Allow the user to select the download root path. This can be done via the browse() or browseLive() call.
- Set subdirectory paths if required by calling setCreateLocalDir
- Initiate transfer by calling downloadLive().
- Monitor status using various TransferHook methods.
Copyright: Copyright (c) 2009-2012
Company: Unlimi-Tech Software Inc.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidaddFilenamesForRename(java.lang.String filenames, java.lang.String delimiter)Specify a list of filenames to which the transferred files will be renamed.voidaddFilesToQueue(java.lang.String files, java.lang.String delimiter)Adds the specified files to the transfer queuevoidaddFileToQueueWithRename(java.lang.String file, java.lang.String newFilename)Adds the specified file to the transfer queue, and also specifies that it should be renamed to the specified new filename when it is downloaded.java.lang.StringbrowseLive()Select the user selected directory to be used as the root download folder chosen by the applet's browse dialog.booleancheckPermissions()Method can be called to see if the applet has required permissions to properly transfer filesvoidclearQueue()Clears the transfer queuevoiddownloadLive()Instantiates download.java.lang.StringgetCreateLocalDir()Get the current value found for the createLocalDirjava.lang.StringgetCurrentSavePath()Returns the current download directory.java.lang.StringgetQueueItems()Returns the list of files/directories currently in the queue (right pane).java.lang.StringgetRootDownloadPath()Returns the selected directory user has chosen as the root download path.longgetTransferDurationSeconds()Returns the transfer duration time in seconds.longgetTransferFullSizeBytes()Returns the transfer size.java.lang.StringgetTransferMode()Return the transfer mode selected for this transfer.longgetTransferSizeBytes()Returns the transfer size.booleanisCancelledStateCalledByPause()Pause and cancel share the same internal state (cancelled).booleanremoveFileFromQueue(java.lang.String item)Removes the specified item from the queue.voidrunAutoDetect()Initiates the auto-detect sequence, and automatically updates transfer modevoidsetCreateLocalDir(java.lang.String dir)This directory will be created as a sub-directory of the save path, whether set externally or selected by the user.voidsetRecommendedDir(java.lang.String dir)Set the recommended sub-directory shown to the user when they select the "browse" or "browseLive" dialog.voidsetRemoteDir(java.lang.String newRemoteDir)Sets the remote directory.voidsetSavePath(java.lang.String path)Deprecated.This method has been functionally removed from the LIVE API.voidsetServerHost(java.lang.String address)Allows the setting of the server host address via Javascript.voidsetServerPort(int port)Allows the setting of the server port.voidsetServletLoc(java.lang.String servletURL)Sets the servlet location for the server.voidsetSSL(java.lang.Boolean enableSSL)Enables SSL in transfers.voidsetUserName(java.lang.String username)Sets the username for the connection to be made.voidsetUserPassword(java.lang.String password)Sets the password credentials for the connection to be made.
-
-
-
Method Detail
-
browseLive
java.lang.String browseLive()
Select the user selected directory to be used as the root download folder chosen by the applet's browse dialog.- Returns:
- Returns the full save path selected by the user. Null String ("") if this has not been previously set and user has cancelled.
-
getRootDownloadPath
java.lang.String getRootDownloadPath()
Returns the selected directory user has chosen as the root download path. Returns null string ("") if browse() or browseLive() methods have not yet been called.- Returns:
- Path that the user has selected as the download root directory via the browse() or browseLive() method.
-
getCurrentSavePath
java.lang.String getCurrentSavePath()
Returns the current download directory. This is the combination of the user root download path plus additional sub-directory structures defined by setCreateLocalDir().- Returns:
- Current applet save path.
-
setRecommendedDir
void setRecommendedDir(java.lang.String dir)
Set the recommended sub-directory shown to the user when they select the "browse" or "browseLive" dialog. This is equivalent to setting the "localdir" in the javascript applet parameter- Parameters:
dir- Recommended directory for user to select when browse() or browseLive() dialogs are called.
-
setCreateLocalDir
void setCreateLocalDir(java.lang.String dir) throws java.lang.ExceptionThis directory will be created as a sub-directory of the save path, whether set externally or selected by the user. All downloaded files will be placed in this new sub-directory.- Parameters:
dir- Sub-directory to create in the save path.- Throws:
java.lang.Exception- thrown if the resulting save path value is found outside of the user selected download directory (ie: value "./../" entered)
-
getCreateLocalDir
java.lang.String getCreateLocalDir()
Get the current value found for the createLocalDir- Returns:
- dir Sub-directory to create in the save path.
-
setSavePath
void setSavePath(java.lang.String path) throws java.lang.ExceptionDeprecated.This method has been functionally removed from the LIVE API.NOTE: This method is deprecated. Calls made to the method now throw a javascript alert message informing the user that the call is disallowed, and that they need to contact their supplier to modify the website.- Parameters:
path- String- Throws:
java.lang.Exception- thrown when called.
-
downloadLive
void downloadLive() throws java.lang.ExceptionInstantiates download. Files must have previously been aded to the transfer queue.- Throws:
java.lang.Exception- thrown if the resulting save path value is found outside of the user selected download directory
-
addFilesToQueue
void addFilesToQueue(java.lang.String files, java.lang.String delimiter)Adds the specified files to the transfer queue- Parameters:
files- String Delimited list of absolute file pathsdelimiter- String Delimiter to use when parsing list of files
-
addFilenamesForRename
void addFilenamesForRename(java.lang.String filenames, java.lang.String delimiter)Specify a list of filenames to which the transferred files will be renamed. The number of filenames specified must match the number of files added to the queue or no renames will be performed. Values may be absolute paths (see note below), relative paths, or just filenames. Relative paths, or filenames will be appended to the user selected path.
For Example:
5 files have been added to the download queue using the following:document.filecatalyst.addFilesToQueue("file1.txt,file2.txt,file3.txt,file4.txt,file5.txt",",");To rename those files on download, prior to calling downloadLive(), the following call could be made:document.filecatalyst.addFilenamesForRename("renamefile1.txt,renamefile2.txt,renamefile3.txt,renamefile4.txt,renamefile5.txt",",");The 5 files will be downloaded to the user selected directory, and renamed on the fly to the filenames specified in the call to addFilenamesForRename().
NOTE: If an absolute path is found in the filenames parameter, a security check is performed to ensure that the file is within the path chosen by the user. If the path is outside the user's chosen path, a security exception is thrown.- Parameters:
filenames- String delimited list of filenamesdelimiter- String Delimiter to use when parsing list of filenames
-
addFileToQueueWithRename
void addFileToQueueWithRename(java.lang.String file, java.lang.String newFilename)Adds the specified file to the transfer queue, and also specifies that it should be renamed to the specified new filename when it is downloaded. Value for newFilename may be an absolute path (see note below), a relative path, or just a filename. Relative paths, or filenames will be appended to the user selected path.
For Example:
If you made the following call:document.filecatalyst.addFileToQueueWithRename("/dironserver/file1.txt","createdir/renamefile.txt")And assuming the user had selected c:\temp as the download directory, then file1.txt will be downloaded to c:\temp\createdir\renamefile.txt
NOTE: If an absolute path is specified for the newFilename parameter, a security check is performed to ensure that the file is within the path chosen by the user. If the path is outside the user's chosen path, a security exception is thrown.- Parameters:
file- The file to downloadnewFilename- the new name for the file when downloaded
-
clearQueue
void clearQueue()
Clears the transfer queue
-
setRemoteDir
void setRemoteDir(java.lang.String newRemoteDir)
Sets the remote directory. Must be set before the applet has connected for the value to take effect.- Parameters:
newRemoteDir-
-
getQueueItems
java.lang.String getQueueItems()
Returns the list of files/directories currently in the queue (right pane).- Returns:
- list of file names/directories separated by delimiter
-
removeFileFromQueue
boolean removeFileFromQueue(java.lang.String item)
Removes the specified item from the queue.- Parameters:
item- to remove- Returns:
- true if the item was removed, false if item was not present in the queue
-
isCancelledStateCalledByPause
boolean isCancelledStateCalledByPause()
Pause and cancel share the same internal state (cancelled). This value allows you to determine a cancelled state was derrived from the user applying a pause button or a cancel button.- Returns:
- if the current cancel state was called by pause action.
-
getTransferSizeBytes
long getTransferSizeBytes()
Returns the transfer size. Data is cumulative for all transfers done on the applet, and is not accurate until transfer is complete or cancelled. The data reflects the actual bytes transfered on the network, not the original tranfer size (if file was partially already there using incremental or resume)- Returns:
- Size of transfer in bytes.
-
getTransferFullSizeBytes
long getTransferFullSizeBytes()
Returns the transfer size. Data is cumulative for all transfers done on the applet, and is not accurate until transfer is complete or cancelled. The data reflects the original size of the files transferred even when deltas are utilized.- Returns:
- Size of transfer in bytes.
-
getTransferDurationSeconds
long getTransferDurationSeconds()
Returns the transfer duration time in seconds. Data is cumulative for all transfers done on the applet, and is not accurate until transfer is complete or cancelled.- Returns:
- 64 bit long, transfer duration time in seconds.
-
getTransferMode
java.lang.String getTransferMode()
Return the transfer mode selected for this transfer. Returns one of the following string values: - "FTP" for TCP transfers - "UDP" for UDP FileCatalyst transfers - "HTTP" for HTTP transfers via servlet - "UNKNOWN" Error condition -- protocol should never be unknown.- Returns:
- String value of protocol
-
setServerHost
void setServerHost(java.lang.String address)
Allows the setting of the server host address via Javascript. Must be a hostname or an IP address.- Parameters:
address- Hostname or IP Address
-
setServerPort
void setServerPort(int port)
Allows the setting of the server port.- Parameters:
port- Must be a valid port number (1-65536)
-
setUserName
void setUserName(java.lang.String username)
Sets the username for the connection to be made.- Parameters:
username- FTP Username
-
setUserPassword
void setUserPassword(java.lang.String password)
Sets the password credentials for the connection to be made.- Parameters:
password- FTP credentials
-
setSSL
void setSSL(java.lang.Boolean enableSSL)
Enables SSL in transfers. False by default.- Parameters:
enableSSL-
-
setServletLoc
void setServletLoc(java.lang.String servletURL)
Sets the servlet location for the server. http://:12480/servlet/ftpservlet ie: http://127.0.0.1:12480/servlet/ftpservlet - Parameters:
servlet- location URL
-
runAutoDetect
void runAutoDetect()
Initiates the auto-detect sequence, and automatically updates transfer mode- Since:
- 3.0.1 build 5
-
checkPermissions
boolean checkPermissions()
Method can be called to see if the applet has required permissions to properly transfer files- Returns:
- true if applet has proper permissions to transfer files.
- Since:
- 3.0.1 build 5
-
-