com.shephertz.app42.paas.sdk.android.upload
Class UploadService

java.lang.Object
  extended by com.shephertz.app42.paas.sdk.android.upload.UploadService

public class UploadService
extends java.lang.Object

Uploads file on the cloud. Allows access to the files through url. Its especially useful for Mobile/Device apps. It minimizes the App footprint on the device.

See Also:
Upload, App42Response

Constructor Summary
UploadService(java.lang.String apiKey, java.lang.String secretKey, java.lang.String baseURL)
          This is a constructor that takes
 
Method Summary
 Upload getAllFiles()
          Gets all the files for the App
 Upload getAllFiles(int max, int offset)
          Gets all the files By Paging for the App
 Upload getAllFilesByUser(java.lang.String userName)
          Gets the file based on user name.
 Upload getAllFilesByUser(java.lang.String userName, int max, int offset)
          Gets the file based on user name by Paging.
 App42Response getAllFilesCount()
          Gets count of all the files for the App
 App42Response getAllFilesCountByUser(java.lang.String userName)
          Gets the count of file based on user name.
 Upload getFileByName(java.lang.String name)
          Gets the file based on file name.
 Upload getFileByUser(java.lang.String name, java.lang.String userName)
          Gets the file based on user and file name.
 Upload getFilesByType(UploadFileType uploadFileType)
          Get the files based on file type.
 Upload getFilesByType(UploadFileType uploadFileType, int max, int offset)
          Get the files based on file type by Paging.
 App42Response getFilesCountByType(UploadFileType uploadFileType)
          Get the count of files based on file type.
 App42Response removeAllFiles()
          Removes all the files for the App
 App42Response removeAllFilesByUser(java.lang.String userName)
          Removes the file based on user name.
 App42Response removeFileByName(java.lang.String name)
          Removes the file based on file name.
 App42Response removeFileByUser(java.lang.String name, java.lang.String userName)
          Removes the file based on file name and user name.
 Upload uploadFile(java.lang.String name, java.io.InputStream inputStream, UploadFileType fileType, java.lang.String description)
          Uploads file on the cloud.
 Upload uploadFile(java.lang.String name, java.lang.String filePath, UploadFileType fileType, java.lang.String description)
          Uploads file on the cloud.
 Upload uploadFileForUser(java.lang.String name, java.lang.String userName, java.io.InputStream inputStream, UploadFileType fileType, java.lang.String description)
          Uploads file on the cloud for given user.
 Upload uploadFileForUser(java.lang.String name, java.lang.String userName, java.lang.String filePath, UploadFileType fileType, java.lang.String description)
          Uploads file on the cloud for given user.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UploadService

public UploadService(java.lang.String apiKey,
                     java.lang.String secretKey,
                     java.lang.String baseURL)
This is a constructor that takes

Parameters:
apiKey -
secretKey -
baseURL -
Method Detail

uploadFile

public Upload uploadFile(java.lang.String name,
                         java.lang.String filePath,
                         UploadFileType fileType,
                         java.lang.String description)
                  throws App42Exception
Uploads file on the cloud.

Parameters:
name - The name for the file which has to be saved. It is used to retrieve the file
filePath - The local path for the file
fileType - The type of the file. File can be either Audio, Video, Image, Binary, Txt, xml, json, csv or other Use the static constants e.g. Upload.AUDIO, Upload.XML etc.
description - Description of the file to be uploaded.
Returns:
Upload object
Throws:
App42Exception

uploadFile

public Upload uploadFile(java.lang.String name,
                         java.io.InputStream inputStream,
                         UploadFileType fileType,
                         java.lang.String description)
                  throws App42Exception
Uploads file on the cloud.

Parameters:
name - The name for the file which has to be saved. It is used to retrieve the file
inputStream - InputStream of the file to be uploaded.
fileType - The type of the file. File can be either Audio, Video, Image, Binary, Txt, xml, json, csv or other Use the static constants e.g. Upload.AUDIO, Upload.XML etc.
description - Description of the file to be uploaded.
Returns:
Upload object
Throws:
App42Exception

uploadFileForUser

public Upload uploadFileForUser(java.lang.String name,
                                java.lang.String userName,
                                java.lang.String filePath,
                                UploadFileType fileType,
                                java.lang.String description)
                         throws App42Exception
Uploads file on the cloud for given user.

Parameters:
name - The name for the file which has to be saved. It is used to retrieve the file
userName - The name for the user for which file has to be saved.
filePath - The local path for the file
fileType - The type of the file. File can be either Audio, Video, Image, Binary, Txt, xml, json, csv or other Use the static constants e.g. Upload.AUDIO, Upload.XML etc.
description - Description of the file to be uploaded.
Returns:
Upload object
Throws:
App42Exception

uploadFileForUser

public Upload uploadFileForUser(java.lang.String name,
                                java.lang.String userName,
                                java.io.InputStream inputStream,
                                UploadFileType fileType,
                                java.lang.String description)
                         throws App42Exception
Uploads file on the cloud for given user.

Parameters:
name - The name for the file which has to be saved. It is used to retrieve the file
userName - The name for the user for which file has to be saved.
inputStream - InputStream of the file to be uploaded.
fileType - The type of the file. File can be either Audio, Video, Image, Binary, Txt, xml, json, csv or other Use the static constants e.g. Upload.AUDIO, Upload.XML etc.
description - Description of the file to be uploaded.
Returns:
Upload object
Throws:
App42Exception

getAllFilesCount

public App42Response getAllFilesCount()
                               throws App42Exception
Gets count of all the files for the App

Returns:
App42Response object
Throws:
App42Exception

getAllFiles

public Upload getAllFiles()
                   throws App42Exception
Gets all the files for the App

Returns:
Upload object
Throws:
App42Exception

getAllFiles

public Upload getAllFiles(int max,
                          int offset)
                   throws App42Exception
Gets all the files By Paging for the App

Parameters:
max - Maximum number of records to be fetched
offset - From where the records are to be fetched
Returns:
Upload object
Throws:
App42Exception

getFileByUser

public Upload getFileByUser(java.lang.String name,
                            java.lang.String userName)
                     throws App42Exception
Gets the file based on user and file name.

Parameters:
name - The name of the file which has to be retrieved
userName - The name of the user for which file has to be retrieved
Returns:
Upload object
Throws:
App42Exception

getAllFilesCountByUser

public App42Response getAllFilesCountByUser(java.lang.String userName)
                                     throws App42Exception
Gets the count of file based on user name.

Parameters:
userName - The name of the user for which count of the file has to be retrieved
Returns:
App42Response object
Throws:
App42Exception

getAllFilesByUser

public Upload getAllFilesByUser(java.lang.String userName)
                         throws App42Exception
Gets the file based on user name.

Parameters:
userName - The name of the user for which file has to be retrieved
Returns:
Upload object
Throws:
App42Exception

getAllFilesByUser

public Upload getAllFilesByUser(java.lang.String userName,
                                int max,
                                int offset)
                         throws App42Exception
Gets the file based on user name by Paging.

Parameters:
userName - The name of the user for which file has to be retrieved
max - Maximum number of records to be fetched
offset - From where the records are to be fetched
Returns:
Upload object
Throws:
App42Exception

getFileByName

public Upload getFileByName(java.lang.String name)
                     throws App42Exception
Gets the file based on file name.

Parameters:
name - The name of the file which has to be retrieved
Returns:
Upload object
Throws:
App42Exception

removeFileByUser

public App42Response removeFileByUser(java.lang.String name,
                                      java.lang.String userName)
                               throws App42Exception
Removes the file based on file name and user name.

Parameters:
name - The name of the file which has to be removed
userName - The name of the user for which file has to be removed
Returns:
App42Response if deleted successfully
Throws:
App42Exception

removeAllFilesByUser

public App42Response removeAllFilesByUser(java.lang.String userName)
                                   throws App42Exception
Removes the file based on user name.

Parameters:
userName - The name of the user for which file has to be removed
Returns:
App42Response if deleted successfully
Throws:
App42Exception

removeFileByName

public App42Response removeFileByName(java.lang.String name)
                               throws App42Exception
Removes the file based on file name.

Parameters:
name - The name of the file which has to be removed
Returns:
App42Response if deleted successfully
Throws:
App42Exception

removeAllFiles

public App42Response removeAllFiles()
                             throws App42Exception
Removes all the files for the App

Returns:
App42Response if deleted successfully
Throws:
App42Exception

getFilesCountByType

public App42Response getFilesCountByType(UploadFileType uploadFileType)
                                  throws App42Exception
Get the count of files based on file type.

Parameters:
uploadFileType - Type of the file e.g. Upload.AUDIO, Upload.XML etc.
Returns:
App42Response object
Throws:
App42Exception

getFilesByType

public Upload getFilesByType(UploadFileType uploadFileType)
                      throws App42Exception
Get the files based on file type.

Parameters:
uploadFileType - Type of the file e.g. Upload.AUDIO, Upload.XML etc.
Returns:
Upload object
Throws:
App42Exception

getFilesByType

public Upload getFilesByType(UploadFileType uploadFileType,
                             int max,
                             int offset)
                      throws App42Exception
Get the files based on file type by Paging.

Parameters:
uploadFileType - Type of the file e.g. Upload.AUDIO, Upload.XML etc.
max - Maximum number of records to be fetched
offset - From where the records are to be fetched
Returns:
Upload object
Throws:
App42Exception