org.mycore.frontend.fileupload
Class MCRUploadHandlerIFS
java.lang.Object
org.mycore.frontend.fileupload.MCRUploadHandler
org.mycore.frontend.fileupload.MCRUploadHandlerIFS
- Direct Known Subclasses:
- MCRSWFUploadHandlerIFS
public class MCRUploadHandlerIFS
- extends MCRUploadHandler
handles uploads via the UploadApplet and store files directly into the IFS.
- Version:
- $Revision: 14986 $ $Date: 2009-03-20 21:41:45 +0100 (Fri, 20 Mar 2009) $
- Author:
- Thomas Scheffler (yagee)
- See Also:
MCRUploadHandler
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
derivate
protected MCRDerivate derivate
rootDir
protected MCRDirectory rootDir
newDerivate
protected boolean newDerivate
MCRUploadHandlerIFS
public MCRUploadHandlerIFS(String docId,
String derId,
String url)
init
protected void init(String docId,
String derId)
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
acceptFile
public boolean acceptFile(String path,
String checksum,
long length)
throws Exception
- Message from UploadApplet If you want all files transfered omit this
method
- Overrides:
acceptFile in class MCRUploadHandler
- Parameters:
path - file namechecksum - md5 checksum of of filelength - the length of the file in bytes (file size)
- Returns:
- true transfer file false don't send file
- 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
createNewDerivate
protected void createNewDerivate(String docId,
MCRObjectID newDerID)
getMainFilePath
protected static String getMainFilePath(MCRDirectory root)
setDefaultPermissions
protected static void setDefaultPermissions(MCRObjectID derID)
startTransaction
protected void startTransaction()
commitTransaction
protected void commitTransaction()
rollbackTransaction
protected void rollbackTransaction()