Package com.collabnet.ce.soap60.webservices.filestorage

# Class SimpleFileStorageAppSoap

java.lang.Object
com.collabnet.ce.soap60.webservices.WebService
com.collabnet.ce.soap60.webservices.filestorage.SimpleFileStorageAppSoap

All Implemented Interfaces:
  `ISimpleFileStorageAppSoap`

public class SimpleFileStorageAppSoap extends WebService implements ISimpleFileStorageAppSoap
Provides SOAP web service for uploading/downloading files. Uploaded files are assigned a "temporary file storage id" which must be used within the SOAP session to create a document/FRS file/etc. Otherwise, the uploaded file is simply discarded. This service is primarily meant for clients which are unable to use SOAP file attachments for uploading/downloading files. Uploading/downloading files as attachments is much more efficient than returning them in memory. The "FileStorageApp" service provides support for uploading/downloading files as attachments.

Change History
Version 16.3

- read2 New method, accepts long offset to support downloading large files

Version 4.3: No changes.

Since:
  4.1

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SimpleFileStorageAppSoap()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `endFileUpload(String sessionId, String fileStorageId)`
  Closes and saves uploaded file.
  `long`
  `getSize(String sessionId, String fileStorageId)`
  Returns size of the specified temporary storage file in bytes.
  `byte[]`
  `read(String sessionId, String fileStorageId, int offset, int length)`
  Reads from file a specified a number of bytes from the offset specified.
  `byte[]`
  `read2(String sessionId, String fileStorageId, long offset, int length)`
  Reads from file a specified a number of bytes from the offset specified.
  `String`
  `startFileUpload(String sessionId)`
  Opens a new file descriptor for uploading and returns the temporary storage id.
  `void`
  `write(String sessionId, String fileStorageId, byte[] data)`
  Appends data to the file being uploaded.

  ### Methods inherited from class com.collabnet.ce.soap60.webservices.WebService

  `assertNormalProject, assertProjectGroup, canGiveFullUserDetails, checkGeneralPermission, checkPermission, checkPermission, checkSiteWidePermission, createUserSessionKey, downloadFile, filterInvalidProjMembers, generateFolderName, getAccessControlService, getApplicationRegistryService, getAttachment, getAuthenticationService, getCategorization, getCoreService, getDiscussion, getDocMan, getDocumentRootFolder, getFileStorageService, getFolderKey, getFolderPath, getFolderPath, getFolderPath, getFrs, getIntegrationData, getItemPath, getItemPath, getLocale, getMonitoring, getNews, getNulledMinSoapDate, getObjectKey, getObjectPath, getOperation, getPages, getPlanning, getPluggableComponent, getProjectId, getProjectPath, getProjectPath, getRbac, getSearch, getStoredFileSize, getStoredFileText, getTagService, getTeam, getTemplate, getTracker, getUser, getUserData, getUsername, getUserService, getWiki, hasPermission, hasSiteWidePermission, isFolderResource, isProjectGroup, isProjectId, isStrEmpty, isSuperUser, isValidEmail, makeStoredFileDO, makeStoredFileDOs, requireProjectAdminPermission, setPartialOrFullUserData, setUserNameToResponse, storeFile, storeTextFile, validateChoice, validateChoice, validateIconFile, validateString, validateStringArray, validateStringWithTrim, validateTokenAndExactUsername, validateTokenAndExactUsername, validateWikiPageName, verifyLicense`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### SimpleFileStorageAppSoap

    public SimpleFileStorageAppSoap()

- ## Method Details

  - ### startFileUpload

    public String startFileUpload(String sessionId) throws InvalidSessionFault, SystemFault
    Opens a new file descriptor for uploading and returns the temporary storage id.
    Specified by:
      `startFileUpload` in interface `ISimpleFileStorageAppSoap`
    Parameters:
      `sessionId` - User session id.
    Returns:
      File storage id.
    Throws:
      `InvalidSessionFault` - when the specified session id is invalid.
      `SystemFault` - when an unexpected system level error is encountered.
    Since:
      4.1

  - ### write

    public void write(String sessionId, String fileStorageId, byte[] data) throws InvalidSessionFault, SystemFault, IllegalArgumentFault
    Appends data to the file being uploaded.
    Specified by:
      `write` in interface `ISimpleFileStorageAppSoap`
    Parameters:
      `sessionId` - User session id.
      `fileStorageId` - Id of temporary file storage for the file being uploaded.
      `data` - Data to be uploaded.
    Throws:
      `InvalidSessionFault` - when the specified session id is invalid.
      `SystemFault` - when an unexpected system level error is encountered.
      `IllegalArgumentFault` - when the specified fileStorageId is invalid.
    Since:
      4.1

  - ### endFileUpload

    public void endFileUpload(String sessionId, String fileStorageId) throws InvalidSessionFault, SystemFault, IllegalArgumentFault
    Closes and saves uploaded file.
    Specified by:
      `endFileUpload` in interface `ISimpleFileStorageAppSoap`
    Parameters:
      `sessionId` - User session id.
      `fileStorageId` - Id of temporary file storage for the file to finish uploading.
    Throws:
      `InvalidSessionFault` - when the specified session id is invalid.
      `SystemFault` - when an unexpected system level error is encountered.
      `IllegalArgumentFault` - when the specified fileStorageId is invalid.
    Since:
      4.1

  - ### getSize

    public long getSize(String sessionId, String fileStorageId) throws InvalidSessionFault, SystemFault, IllegalArgumentFault
    Returns size of the specified temporary storage file in bytes.
    Specified by:
      `getSize` in interface `ISimpleFileStorageAppSoap`
    Parameters:
      `sessionId` - User session id.
      `fileStorageId` - Id of temporary file storage.
    Returns:
      File size in number of bytes.
    Throws:
      `InvalidSessionFault` - when the specified session id is invalid.
      `SystemFault` - when an unexpected system level error is encountered.
      `IllegalArgumentFault` - when the specified fileStorageId is invalid.
    Since:
      4.1

  - ### read

    public byte[] read(String sessionId, String fileStorageId, int offset, int length) throws InvalidSessionFault, PermissionDeniedFault, SystemFault, IllegalArgumentFault
    Reads from file a specified a number of bytes from the offset specified.
    Specified by:
      `read` in interface `ISimpleFileStorageAppSoap`
    Parameters:
      `sessionId` - User session id.
      `fileStorageId` - Id of temporary file storage returned by DocmentApp.getDocumentFileId or FrsApp.getFrsFileId
      `offset` - Offset within file from where to read.
      `length` - Number of bytes to read.
    Returns:
      Data read from the file as a byte array. Returns null on file end.
    Throws:
      `InvalidSessionFault` - when the specified session id is invalid.
      `SystemFault` - when an unexpected system level error is encountered.
      `PermissionDeniedFault` - when the user doesn't have permission to view the file
      `IllegalArgumentFault` - when the specified fileStorageId is invalid.
    Since:
      4.1

  - ### read2

    public byte[] read2(String sessionId, String fileStorageId, long offset, int length) throws InvalidSessionFault, PermissionDeniedFault, SystemFault, IllegalArgumentFault
    Reads from file a specified a number of bytes from the offset specified.
    Specified by:
      `read2` in interface `ISimpleFileStorageAppSoap`
    Parameters:
      `sessionId` - User session id.
      `fileStorageId` - Id of temporary file storage returned by DocmentApp.getDocumentFileId or FrsApp.getFrsFileId
      `offset` - Offset within file from where to read (long).
      `length` - Number of bytes to read.
    Returns:
      Data read from the file as a byte array. Returns null on file end.
    Throws:
      `InvalidSessionFault` - when the specified session id is invalid.
      `SystemFault` - when an unexpected system level error is encountered.
      `PermissionDeniedFault` - when the user doesn't have permission to view the file
      `IllegalArgumentFault` - when the specified fileStorageId is invalid.
    Since:
      16.3