org.mycore.frontend.fileupload
Class MCRSWFUploadHandlerMyCoRe
java.lang.Object
org.mycore.frontend.fileupload.MCRUploadHandler
org.mycore.frontend.fileupload.MCRSWFUploadHandlerMyCoRe
public class MCRSWFUploadHandlerMyCoRe
- extends MCRUploadHandler
This class stores files uploaded from the client applet as derivates into the
workflow.
- Version:
- $Revision: 15270 $ $Date: 2009-05-25 17:27:57 +0200 (Mon, 25 May 2009) $
- Author:
- Harald Richter, Jens Kupferschmidt, Frank Lützenkirchen
- See Also:
MCRUploadHandler
|
Method Summary |
void |
finishUpload()
Finish upload, store derivate |
long |
receiveFile(String path,
InputStream in,
long length,
String md5)
When the applet uploads a file, this method is called so that the
UploadHandler subclass can store the file on the server side. |
void |
startUpload(int numFiles)
Start Upload for MyCoRe |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MCRSWFUploadHandlerMyCoRe
public MCRSWFUploadHandlerMyCoRe(String docId,
String derId,
String mode,
String url)
- Creates MCRUploadHandler for MyCoRe
- Parameters:
docId - document to which derivate belongsderId - derivate used to add files, if id="0" a new derivate is
createdmode - "append" add files to derivate, replace old files "replace"
add files to derivate, delete old files "create" add files to
new derivateurl - when MCRUploadApplet is finished this url will be shown
startUpload
public void startUpload(int numFiles)
throws Exception
- Start Upload for MyCoRe
- Specified by:
startUpload in class MCRUploadHandler
- Parameters:
numFiles - the number of files that the applet will upload
- Throws:
Exception
receiveFile
public long receiveFile(String path,
InputStream in,
long length,
String md5)
throws Exception
- Description copied from class:
MCRUploadHandler
- When the applet uploads a file, this method is called so that the
UploadHandler subclass can store the file on the server side.
When the UploadHandler could read less than length bytes from the
InputStream at the time the InputStream has no data any more, the user
at the remote side canceled upload during file transfer. The UploadHandler
then can decide to delete the file, but must return the number of
bytes stored. The UploadHandler can also compare the MD5 checksum calculated
at the client side with its own checksum, to detect magical transfer errors.
This method is not covered by a database transaction.
The implementation has to handle transactions by itself.
- Specified by:
receiveFile in class MCRUploadHandler
- Parameters:
path - the path and filename of the filein - the inputstream to read the content of the file fromlength - the total file size as number of bytes. This may be 0,
meaning that the file is empty or the file size is not known.md5 - the md5 checksum calculated at the client applet side. This
may be null, meaning that the md5 checksum is not known.
- Returns:
- the number of bytes that have been stored.
- Throws:
Exception
finishUpload
public void finishUpload()
throws Exception
- Finish upload, store derivate
- Specified by:
finishUpload in class MCRUploadHandler
- Throws:
Exception