org.mycore.frontend.fileupload
Class MCRUploadCommunicator

java.lang.Object
  extended by org.mycore.frontend.fileupload.MCRUploadCommunicator

public class MCRUploadCommunicator
extends Object

This class is used by applets to communicate with the corresponding MCRUploadServlet servlet to execute tasks on the server. For example, the applet may invoke the createDocument method and pass it a document instance to create this document in the persistent datastore on the server side. The MCRUploadCommunicator does some marshalling etc. and sends the request to the MCRUploadServlet servlet that does the job.

Version:
$Revision: 13085 $ $Date: 2008-02-06 18:27:24 +0100 (Mi, 06 Feb 2008) $
Author:
Frank Lützenkirchen, Harald Richter, Jens Kupferschmidt, Thomas Scheffler (yagee)
See Also:
MCRUploadServlet

Field Summary
protected  MCRUploadApplet applet
           
protected static int bufferSize
           
protected  String uid
           
protected  MCRUploadProgressMonitor upm
           
protected  String url
           
 
Constructor Summary
MCRUploadCommunicator(String url, String uploadId, MCRUploadApplet applet)
           
 
Method Summary
protected  String buildMD5String(File file)
          Calculates the MD5 checksum of the given local file *
protected  void cancelUploadSession()
           
protected  long countTotalBytes(Vector files)
           
protected  InputStream doPost(Hashtable parameters)
           
protected  String encodeParameters(Hashtable parameters)
           
protected  void endUploadSession()
           
protected  Hashtable getResponse(InputStream is)
           
protected  Vector[] listFiles(File[] selectedFiles)
          Creates a list of all files in the given directories
 void loadFiles(Vector[] list)
           
protected  Object send(Hashtable parameters)
           
protected  void startUploadSession(int numFiles)
           
 void uploadFile(String path, File file)
           
 void uploadFiles(File[] selectedFiles)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

url

protected String url

uid

protected String uid

upm

protected MCRUploadProgressMonitor upm

applet

protected MCRUploadApplet applet

bufferSize

protected static final int bufferSize
See Also:
Constant Field Values
Constructor Detail

MCRUploadCommunicator

public MCRUploadCommunicator(String url,
                             String uploadId,
                             MCRUploadApplet applet)
Method Detail

uploadFiles

public void uploadFiles(File[] selectedFiles)

countTotalBytes

protected long countTotalBytes(Vector files)

loadFiles

public void loadFiles(Vector[] list)
               throws Exception
Throws:
Exception

uploadFile

public void uploadFile(String path,
                       File file)
                throws Exception
Throws:
Exception

listFiles

protected Vector[] listFiles(File[] selectedFiles)
                      throws Exception
Creates a list of all files in the given directories

Parameters:
selectedFiles - list of selected files or directories from filechooser
Throws:
Exception

startUploadSession

protected void startUploadSession(int numFiles)
                           throws IOException,
                                  MCRUploadException
Throws:
IOException
MCRUploadException

endUploadSession

protected void endUploadSession()
                         throws IOException,
                                MCRUploadException
Throws:
IOException
MCRUploadException

cancelUploadSession

protected void cancelUploadSession()
                            throws IOException,
                                   MCRUploadException
Throws:
IOException
MCRUploadException

send

protected Object send(Hashtable parameters)
               throws IOException,
                      MCRUploadException
Throws:
IOException
MCRUploadException

doPost

protected InputStream doPost(Hashtable parameters)
                      throws IOException
Throws:
IOException

encodeParameters

protected String encodeParameters(Hashtable parameters)

getResponse

protected Hashtable getResponse(InputStream is)
                         throws IOException,
                                MCRUploadException
Throws:
IOException
MCRUploadException

buildMD5String

protected String buildMD5String(File file)
                         throws Exception
Calculates the MD5 checksum of the given local file *

Throws:
Exception