FileDocCategorySizeDatePackage
UploadDownloadMgr.javaAPI DocGlassfish v2 API5173Fri May 04 22:30:30 BST 2007com.sun.appserv.management.base

UploadDownloadMgr

public interface UploadDownloadMgr implements com.sun.appserv.management.base.Utility, com.sun.appserv.management.base.Singleton, com.sun.appserv.management.base.AMX
Manages uploading or downloading of files to/from the server. Generally for internal use only.

Fields Summary
public static final String
J2EE_TYPE
The j2eeType as returned by {@link com.sun.appserv.management.base.AMX#getJ2EEType}.
Constructors Summary
Methods Summary
public byte[]downloadBytes(java.lang.Object downloadID, int requestSize)
Download bytes from the server using the downloadID obtained from initiateDownload().

The bufferSize is the requested number of bytes to be received. If the size of the returned byte[] is less than the requestSize, then the transfer has completed, and the downloadID is no longer valid. An attempt to read more than the allowed maximum size will throw an exception. The caller can check the total download size in advance via getDownloadLength().

param
downloadID the id from initiateDownload()
return
bytes remaining bytes, up to the request size

public longgetDownloadLength(java.lang.Object downloadID)
Get the total length the download will be, in bytes.

param
downloadID the dowloadID, as obtained from initiateDownload()

public intgetMaxDownloadChunkSize()

return
the maximum allowable request size for downloading bytes

public java.lang.ObjectinitiateDownload(java.io.File theFile, boolean deleteWhenDone)
Initiates a file download with the given filename. This operation may be used locally or remotely, but the File specified must exist and be readable on the server.

param
theFile an accessible File
param
deleteWhenDone whether to delete the file when done
return
the downloadID to be used for subequent calls to downloadBytes()

public java.lang.ObjectinitiateUpload(java.lang.String name, long totalSize)
Initiate an upload operation. The supplied name is intended as a prefix; if it contains file system separators such as ":", "/" or "\", they are converted into the "_" character.

param
name name to use for the temp file, may be null
param
totalSize total size of the file to upload
return
an opaque identifier describing this file upload

public java.io.FiletakeUpload(java.lang.Object uploadID)
Ownership of transferred bytes (now in a File) are transferred to the caller.

param
uploadID the id obtained from initiateUpload()
return
a File object for a file containing the uploaded bytes
throws
an Exception if the uploadID doesn't exist, or has not finished.

public booleanuploadBytes(java.lang.Object uploadID, byte[] bytes)
Upload bytes for the specified upload

param
uploadID the id obtained from initiateUpload()
param
bytes more bytes to be uploaded
return
true if the total upload has been completed, false otherwise
throws
an Exception if a problem occurred