Java EE 5 SDK

com.sun.appserv.management.base
Interface UploadDownloadMgr

All Superinterfaces:
AMX, AMXMBeanLogging, NotificationBroadcaster, NotificationEmitter, Singleton, Utility

public interface UploadDownloadMgr
extends AMX, Utility, Singleton

Manages uploading or downloading of files to/from the server. Generally for internal use only.


Field Summary
static String J2EE_TYPE
          The j2eeType as returned by AMX.getJ2EEType().
 
Fields inherited from interface com.sun.appserv.management.base.AMX
FULL_TYPE_DELIM, GROUP_CONFIGURATION, GROUP_JSR77, GROUP_MONITORING, GROUP_OTHER, GROUP_UTILITY, J2EE_TYPE_KEY, JMX_DOMAIN, NAME_KEY, NO_NAME, NOTIFICATION_PREFIX, NULL_NAME
 
Method Summary
 byte[] downloadBytes(Object downloadID, int requestSize)
          Download bytes from the server using the downloadID obtained from initiateDownload().
 long getDownloadLength(Object downloadID)
          Get the total length the download will be, in bytes.
 int getMaxDownloadChunkSize()
           
 Object initiateDownload(File theFile, boolean deleteWhenDone)
          Initiates a file download with the given filename.
 Object initiateUpload(String name, long totalSize)
          Initiate an upload operation.
 File takeUpload(Object uploadID)
          Ownership of transferred bytes (now in a File) are transferred to the caller.
 boolean uploadBytes(Object uploadID, byte[] bytes)
          Upload bytes for the specified upload
 
Methods inherited from interface com.sun.appserv.management.base.AMX
getContainer, getDomainRoot, getFullType, getGroup, getJ2EEType, getName, isDAS
 
Methods inherited from interface javax.management.NotificationEmitter
removeNotificationListener
 
Methods inherited from interface javax.management.NotificationBroadcaster
addNotificationListener, getNotificationInfo, removeNotificationListener
 
Methods inherited from interface com.sun.appserv.management.base.AMXMBeanLogging
getMBeanLoggerName, getMBeanLogLevel, setMBeanLogLevel
 

Field Detail

J2EE_TYPE

static final String J2EE_TYPE
The j2eeType as returned by AMX.getJ2EEType().

See Also:
Constant Field Values
Method Detail

initiateUpload

Object initiateUpload(String name,
                      long totalSize)
                      throws IOException
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.

Parameters:
name - name to use for the temp file, may be null
totalSize - total size of the file to upload
Returns:
an opaque identifier describing this file upload
Throws:
IOException

uploadBytes

boolean uploadBytes(Object uploadID,
                    byte[] bytes)
                    throws IOException
Upload bytes for the specified upload

Parameters:
uploadID - the id obtained from initiateUpload()
bytes - more bytes to be uploaded
Returns:
true if the total upload has been completed, false otherwise
Throws:
an - Exception if a problem occurred
IOException

takeUpload

File takeUpload(Object uploadID)
Ownership of transferred bytes (now in a File) are transferred to the caller.

Parameters:
uploadID - the id obtained from initiateUpload()
Returns:
a File object for a file containing the uploaded bytes
Throws:
an - Exception if the uploadID doesn't exist, or has not finished.

initiateDownload

Object initiateDownload(File theFile,
                        boolean deleteWhenDone)
                        throws IOException
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.

Parameters:
theFile - an accessible File
deleteWhenDone - whether to delete the file when done
Returns:
the downloadID to be used for subequent calls to downloadBytes()
Throws:
IOException

getDownloadLength

long getDownloadLength(Object downloadID)
Get the total length the download will be, in bytes.

Parameters:
downloadID - the dowloadID, as obtained from initiateDownload()

getMaxDownloadChunkSize

int getMaxDownloadChunkSize()
Returns:
the maximum allowable request size for downloading bytes

downloadBytes

byte[] downloadBytes(Object downloadID,
                     int requestSize)
                     throws IOException
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().

Parameters:
downloadID - the id from initiateDownload()
Returns:
bytes remaining bytes, up to the request size
Throws:
IOException

Java EE 5 SDK

Submit a bug or feature

Copyright 2006 Sun Microsystems, Inc. All rights reserved.