com.scand.vault
Class VaultApplet

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by java.applet.Applet
                  extended by com.scand.vault.VaultApplet
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class VaultApplet
extends java.applet.Applet
implements java.awt.event.ActionListener

Vault applet provides batch file uploading/downloading capabilities together with related file manipulation routines. It has user friendly interface, displays a progress bar during time consuming upload/download process and has warning/error messages system to inform the user about any collisions.
User has a possibility to add/remove files to the batch list, rename files and folders, cancel current job.
User may select files from both local and network-mapped folders, optionally including all sub-folders. Aditionally, he can enter any valid network path and browse it in the file selection dialog.

File transfer works over http, SSL (https) with or without proxy. This is achieved by using browser's native connection classes.
And the most attractive fieature is the possibility to upload huge files (unlimited file size) with no timeouts or memory lacks (known java bug).
We use all available network traffic, so the transfer will go as fast as your LAN/WAN allows.
You can submit your form data together with the file. It is usually required to send the state information back to the server.

What else can I do with Vault applet that I can't with a usual FILE form input field? - Well, you can control, filter and preprocess the file list that user has selected. You can enable or disable to transfer some file types basing on your application logic, and you can collect additional information related to those files. And finally, you don't need to reload your page while you transferring the files.

We use the standard "multipart/form-data" content encoding, so the applet is compatible with any server-side uploading component. The quality of the server-side component as well as the hard-drive performance will also affect the resulting transfer rate.

See Also:
Serialized Form

Field Summary
static java.lang.String pACTIONBUTTONLABEL
          Applet parameter.
static java.lang.String pBGCOLOR
          Applet parameter.
static java.lang.String pCHUNKSIZE
          Applet parameter.
static java.lang.String pDESTINATION
          Applet parameter.
static java.lang.String pDISABLEADDBUTTON
          Applet parameter.
static java.lang.String pMODE
          Applet parameter.
static java.lang.String pONBUTTONCLICK
          Applet parameter.
static java.lang.String pONEDIALOG
          Applet parameter.
static java.lang.String pSHOWMAP
          Applet parameter.
static java.lang.String pSTOPONERROR
          Applet parameter.
static java.lang.String pUPLOADERDOC
          Applet parameter.
static java.lang.String pWORKINGDIR
          Applet parameter.
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
VaultApplet()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Internal method.
 void addFilesToDownloadList(java.lang.String fileUrlList, java.lang.String displayNameList, java.lang.String separator)
          Add the specified list of files' URLs to the download list.
 void addFileToDownloadList(java.lang.String fileUrl, java.lang.String displayName)
          Add the specified file URL to the download list.
 void addToSelection(java.lang.String path)
          Adds the specified file or folder to the selection.
 void clearClientData()
          Clear all userdata values.
 void clearDownloadList()
          Clear the download list.
static boolean createNewFolder(java.lang.String path)
          Internal method.
 void downloadFiles(boolean doSelectFolder)
          Programmatically start the download process.
 java.lang.String getAllItems()
          To get all rows in the applet, pipe | delimited.
 java.lang.String getClientData(java.lang.String name)
          Get userdata (form fields) for uploading.
 java.lang.String getDelimiter()
          Get the delimiter used to separate files in the file lists.
 java.lang.String getDownloadReport()
          Get the download report.
 java.lang.String getFolderStructure(java.lang.String path)
          Returns the content of the specified folder with all sub-folders.
 java.awt.Frame getFrame()
          Internal method.
 java.lang.String getLastError()
          Get the error message from the last operation.
 java.lang.String getResponse()
          Returns the Response property, which is set with the server response data from the upload() method call.
 java.lang.String getSaveAsItem(java.lang.String fileUrl)
          To get "save as" column in the applet, pass fileUrl not the displayName.
 java.lang.String getSaveAsItems()
          To get "save as" column in the applet, pipe | delimited.
 java.lang.String getSelectedItems()
          To get the highlighted rows in the applet, pipe | delimited.
 java.lang.String getWorkingDir()
          Get applet's current working directory (where files are to be downloaded into).
 void init()
          Internal method.
static boolean isWin()
           
 boolean mkDir(java.lang.String dir)
          Creates a directory structure on the local file system.
 void removeFromSelection(java.lang.String path)
          Removes the specified file or folder from the selection.
 void setClientData(java.lang.String name, java.lang.String value)
          Set userdata (form fields) for uploading.
 void setDelimiter(java.lang.String delim)
          Set the delimiter used to separate files in the file lists.
 void setDownloadBaseURL(java.lang.String strUrl)
          Define the base URL, so the applet can build the relative directory structure.
 void setSaveAsItem(java.lang.String fileUrl, java.lang.String saveAs)
          To set "save as" column in the applet, pass fileUrl not the displayName.
 void setUploaderDoc(java.lang.String doc)
          Sets the server side uploader document name.
 boolean setWorkingDir(java.lang.String dir)
          Sets the local working directory for the applet (where files are to be downloaded into).
 void showInline(java.awt.Panel p, boolean f)
          Internal method.
 void start()
          Internal method.
 void stop()
          Internal method.
 void stopDownload()
          Cancel the curent download.
 void upload()
          Uploads the selected files to the server.
 
Methods inherited from class java.applet.Applet
destroy, getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pWORKINGDIR

public static final java.lang.String pWORKINGDIR
Applet parameter. Specifies initial value for WorkingDir property (where files are to be downloaded into).
Mode: download.

See Also:
Constant Field Values

pBGCOLOR

public static final java.lang.String pBGCOLOR
Applet parameter. Specifies the color of applet. Default value is white.
Mode: both.

See Also:
Constant Field Values

pONBUTTONCLICK

public static final java.lang.String pONBUTTONCLICK
Applet parameter. Specifies the event handler JavaScript function name.
Mode: both.

See Also:
Constant Field Values

pMODE

public static final java.lang.String pMODE
Applet parameter. Specifies the mode (0-upload,1-download).
Mode: both.

See Also:
Constant Field Values

pACTIONBUTTONLABEL

public static final java.lang.String pACTIONBUTTONLABEL
Applet parameter. Specifies label for the action button.
By default it is Upload or Download, depending on the current mode.
Mode: both.

See Also:
Constant Field Values

pDISABLEADDBUTTON

public static final java.lang.String pDISABLEADDBUTTON
Applet parameter. If specified, add button will be disabled.
Mode: upload.

See Also:
Constant Field Values

pCHUNKSIZE

public static final java.lang.String pCHUNKSIZE
Applet parameter. Chunk size in kilobytes.
Mode: upload.

See Also:
Constant Field Values

pUPLOADERDOC

public static final java.lang.String pUPLOADERDOC
Applet parameter. Server-side upload handler page.
Mode: upload.

See Also:
Constant Field Values

pONEDIALOG

public static final java.lang.String pONEDIALOG
Applet parameter. No popup dialog, use same panel for progress bar.
Mode: upload.

See Also:
Constant Field Values

pDESTINATION

public static final java.lang.String pDESTINATION
Applet parameter. Show this text in destination field.
Mode: upload.

See Also:
Constant Field Values

pSTOPONERROR

public static final java.lang.String pSTOPONERROR
Applet parameter. Upload will stop on first error, otherwise it will skip to the next file.
Mode: upload.

See Also:
Constant Field Values

pSHOWMAP

public static final java.lang.String pSHOWMAP
Applet parameter. {true|false} Show/hide "network map" option in file selection dialog.
Mode: upload.

See Also:
Constant Field Values
Constructor Detail

VaultApplet

public VaultApplet()
Method Detail

start

public void start()
Internal method.

Overrides:
start in class java.applet.Applet

isWin

public static boolean isWin()

stop

public void stop()
Internal method.

Overrides:
stop in class java.applet.Applet

init

public void init()
Internal method.

Overrides:
init in class java.applet.Applet

getFrame

public java.awt.Frame getFrame()
Internal method.


showInline

public void showInline(java.awt.Panel p,
                       boolean f)
Internal method.


getDelimiter

public java.lang.String getDelimiter()
Get the delimiter used to separate files in the file lists.
Mode: both.


setDelimiter

public void setDelimiter(java.lang.String delim)
Set the delimiter used to separate files in the file lists.
Default value is | (pipe).
Mode: both.


getResponse

public java.lang.String getResponse()
Returns the Response property, which is set with the server response data from the upload() method call.
Mode: upload.


getLastError

public java.lang.String getLastError()
Get the error message from the last operation.
Mode: both.


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Internal method.

Specified by:
actionPerformed in interface java.awt.event.ActionListener

getFolderStructure

public java.lang.String getFolderStructure(java.lang.String path)
Returns the content of the specified folder with all sub-folders. Returned list is pipe | delimited, contains the files with full paths.
Mode: both.

Parameters:
path - folder path, example - C:\Temp

addToSelection

public void addToSelection(java.lang.String path)
Adds the specified file or folder to the selection.
Mode: upload.


removeFromSelection

public void removeFromSelection(java.lang.String path)
Removes the specified file or folder from the selection.
Mode: both.


getSelectedItems

public java.lang.String getSelectedItems()
To get the highlighted rows in the applet, pipe | delimited.
Use JavaScript function split(list,"|") to convert into an array.
Mode: upload.


getAllItems

public java.lang.String getAllItems()
To get all rows in the applet, pipe | delimited.
Use JavaScript function split(list,"|") to convert into an array.
Mode: both.


getSaveAsItems

public java.lang.String getSaveAsItems()
To get "save as" column in the applet, pipe | delimited.
Use JavaScript function split(list,"|") to convert into an array.
Mode: download.


getSaveAsItem

public java.lang.String getSaveAsItem(java.lang.String fileUrl)
To get "save as" column in the applet, pass fileUrl not the displayName.

Mode: download.


setSaveAsItem

public void setSaveAsItem(java.lang.String fileUrl,
                          java.lang.String saveAs)
To set "save as" column in the applet, pass fileUrl not the displayName.

Mode: download.


setUploaderDoc

public void setUploaderDoc(java.lang.String doc)
Sets the server side uploader document name. Default is "uploader.jsp".
Mode: upload.


upload

public void upload()
Uploads the selected files to the server.
Mode: upload.


setClientData

public void setClientData(java.lang.String name,
                          java.lang.String value)
Set userdata (form fields) for uploading.
Mode: upload.


getClientData

public java.lang.String getClientData(java.lang.String name)
Get userdata (form fields) for uploading.
Mode: upload.


clearClientData

public void clearClientData()
Clear all userdata values.
Mode: upload.


setWorkingDir

public boolean setWorkingDir(java.lang.String dir)
Sets the local working directory for the applet (where files are to be downloaded into).
Initially working directory can be initialized from pWORKINGDIR parameter.
Mode: download.

Parameters:
dir - is a fully qualified path to a directory on the local file system.
Returns:
false if the directory does not exist.

getWorkingDir

public java.lang.String getWorkingDir()
Get applet's current working directory (where files are to be downloaded into).
Mode: download.

Returns:
working directory

mkDir

public boolean mkDir(java.lang.String dir)
Creates a directory structure on the local file system.
Mode: download.

Returns:
false if the directory cannot be created.

createNewFolder

public static boolean createNewFolder(java.lang.String path)
Internal method.


setDownloadBaseURL

public void setDownloadBaseURL(java.lang.String strUrl)
Define the base URL, so the applet can build the relative directory structure.
Mode: download.


addFileToDownloadList

public void addFileToDownloadList(java.lang.String fileUrl,
                                  java.lang.String displayName)
Add the specified file URL to the download list.
You may set other displayName, or set it to null to leave filename unchanged.
Mode: download.


addFilesToDownloadList

public void addFilesToDownloadList(java.lang.String fileUrlList,
                                   java.lang.String displayNameList,
                                   java.lang.String separator)
Add the specified list of files' URLs to the download list.
You may specify corresponding list of display names for each file, otherwise set displayNameList to null.
Mode: download.


clearDownloadList

public void clearDownloadList()
Clear the download list.
Mode: download.


downloadFiles

public void downloadFiles(boolean doSelectFolder)
Programmatically start the download process.
Same action is performed when you click Download button.
Pass true to popup folder selection dialog, and false instead.
Mode: download.


getDownloadReport

public java.lang.String getDownloadReport()
Get the download report.
Mode: download.


stopDownload

public void stopDownload()
Cancel the curent download.
Mode: download.