Overview | Package | Class | Tree | Deprecated | Index | Help
| J2EE1.4 SDK
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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 java.lang.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, NAME_KEY, NO_NAME, NULL_NAME`

Fields inherited from interface com.sun.appserv.management.base.AMXMBeanLogging
`LOG_RECORD_KEY, LOG_RECORD_NOTIFICATION_TYPE`

Method Summary
`byte[]` | `downloadBytes(java.lang.Object downloadID, int requestSize)` Download bytes from the server using the downloadID obtained from initiateDownload().
`long` | `getDownloadLength(java.lang.Object downloadID)` Get the total length the download will be, in bytes.
`int` | `getMaxDownloadChunkSize()`
`java.lang.Object` | `initiateDownload(java.io.File theFile, boolean deleteWhenDone)` Initiates a file download with the given filename.
`java.lang.Object` | `initiateUpload(java.lang.String name, long totalSize)` Initiate an upload operation.
`java.io.File` | `takeUpload(java.lang.Object uploadID)` Ownership of transferred bytes (now in a File) are transferred to the caller.
`boolean` | `uploadBytes(java.lang.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`

Methods inherited from interface com.sun.appserv.management.base.AMXMBeanLogging
`getMBeanEmitLogNotifications, getMBeanLoggerName, getMBeanLogLevel, setMBeanEmitLogNotifications, setMBeanLogLevel`

Methods inherited from interface javax.management.NotificationEmitter
`removeNotificationListener`

Methods inherited from interface javax.management.NotificationBroadcaster
`addNotificationListener, getNotificationInfo, removeNotificationListener`

Field Detail

### J2EE_TYPE

    public static final java.lang.String J2EE_TYPE

  The j2eeType as returned by `AMX.getJ2EEType()`.

  See Also:
    Constant Field Values

Method Detail

### initiateUpload

    public java.lang.Object initiateUpload(java.lang.String name,
                                           long totalSize)
                                    throws java.io.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:
    `java.io.IOException`

### uploadBytes

    public boolean uploadBytes(java.lang.Object uploadID,
                               byte[] bytes)
                        throws java.io.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
    `java.io.IOException`

### takeUpload

    public java.io.File takeUpload(java.lang.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

    public java.lang.Object initiateDownload(java.io.File theFile,
                                             boolean deleteWhenDone)
                                      throws java.io.IOException

  Initiates a file download with the given filename. This operation is only useful to local callers; using it remotely will always fail as the File will not be available.

  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:
    `java.io.IOException`

### getDownloadLength

    public long getDownloadLength(java.lang.Object downloadID)

  Get the total length the download will be, in bytes.

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

### getMaxDownloadChunkSize

    public int getMaxDownloadChunkSize()

  Returns:
    the maximum allowable request size for downloading bytes

### downloadBytes

    public byte[] downloadBytes(java.lang.Object downloadID,
                                int requestSize)
                         throws java.io.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:
    `java.io.IOException`

Overview | Package | Class | Tree | Deprecated | Index | Help
| J2EE1.4 SDK
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Submit a bug or feature

Copyright 2003 Sun Microsystems, Inc. All rights reserved.