net.netheos.pcsapi.providers.hubic
Class Hubic

java.lang.Object
  extended by net.netheos.pcsapi.storage.StorageProvider<OAuth2SessionManager>
      extended by net.netheos.pcsapi.providers.hubic.Hubic
All Implemented Interfaces:
IStorageProvider

public class Hubic
extends StorageProvider<OAuth2SessionManager>

Implements Hubic storage provider


Field Summary
static String PROVIDER_NAME
           
 
Fields inherited from class net.netheos.pcsapi.storage.StorageProvider
retryStrategy, sessionManager
 
Constructor Summary
Hubic(StorageBuilder builder)
           
 
Method Summary
 boolean createFolder(CPath path)
          Create a folder at given path, with intermediate folders if needed.
 boolean delete(CPath path)
          Deletes blob, or recursively delete folder at given path.
 void download(CDownloadRequest downloadRequest)
          Downloads a blob from provider to a byte sink, as defined by the download_request object.
 CFile getFile(CPath path)
          Return detailed file information at given path, or None if no object exists at this path
 CQuota getQuota()
          Returns a CQuota object
 String getUserId()
          Return user identifier (login in case of login/password, or email in case of OAuth
 CFolderContent listFolder(CFolder folder)
          Return a map of files present in given CFolder. keys of map are CPath objects, values are CFile objects (CFolder or CBlob).
 CFolderContent listFolder(CPath path)
          Return a map of files present in given CPath. keys of map are CPath objects, values are CFile objects (CFolder or CBlob).
 CFolderContent listRootFolder()
          Equivalent to IStorageProvider.listFolder(net.netheos.pcsapi.models.CPath) with "/"
 void upload(CUploadRequest uploadRequest)
          Uploads a byte source to provider, as defined by upload_request object.
 
Methods inherited from class net.netheos.pcsapi.storage.StorageProvider
close, getProviderName, getSessionManager, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROVIDER_NAME

public static final String PROVIDER_NAME
See Also:
Constant Field Values
Constructor Detail

Hubic

public Hubic(StorageBuilder builder)
Method Detail

getUserId

public String getUserId()
                 throws CStorageException
Description copied from interface: IStorageProvider
Return user identifier (login in case of login/password, or email in case of OAuth

Returns:
user identifier (login in case of login/password, or email in case of OAuth
Throws:
CStorageException - Error getting the user identifier

getQuota

public CQuota getQuota()
                throws CStorageException
Description copied from interface: IStorageProvider
Returns a CQuota object

Returns:
a tuple: used bytes, allowed bytes.
Throws:
CStorageException - Error getting the quota

listRootFolder

public CFolderContent listRootFolder()
                              throws CInvalidFileTypeException
Description copied from interface: IStorageProvider
Equivalent to IStorageProvider.listFolder(net.netheos.pcsapi.models.CPath) with "/"

Returns:
TODO
Throws:
CInvalidFileTypeException

listFolder

public CFolderContent listFolder(CPath path)
                          throws CStorageException
Description copied from interface: IStorageProvider
Return a map of files present in given CPath. keys of map are CPath objects, values are CFile objects (CFolder or CBlob). Return None if no folder exists at given path. Raise CInvalidFileTypeError if given path is a blob. Note : objects in returned map may have incomplete information

Parameters:
path - The folder path
Returns:
a map of files present at given CPath. keys of map are CPath objects, values are CFile objects (CFolder or CBlob). Return null if no folder exists at given path. Throws CInvalidFileTypeError if given path is a blob.
Throws:
CStorageException - Error getting the files in the folder

listFolder

public CFolderContent listFolder(CFolder folder)
                          throws CStorageException
Description copied from interface: IStorageProvider
Return a map of files present in given CFolder. keys of map are CPath objects, values are CFile objects (CFolder or CBlob). Return None if no folder exists at given path. Raise CInvalidFileTypeError if given path is a blob. Note : objects in returned map may have incomplete information

Parameters:
folder - The folder to get the files in
Returns:
a map of files present in given CFolder keys of map are CPath objects, values are CFile objects (CFolder or CBlob). Return null if no folder exists at given path. Note : objects in returned map may have incomplete information.
Throws:
CStorageException - Error getting the files in the folder

createFolder

public boolean createFolder(CPath path)
                     throws CStorageException
Description copied from interface: IStorageProvider
Create a folder at given path, with intermediate folders if needed. Throws CInvalidFileType error if a blob exists at this path.

Parameters:
path - The folder path to create
Returns:
true if folder has been created, false if it was already existing.
Throws:
CStorageException - Error creating the folder

delete

public boolean delete(CPath path)
               throws CStorageException
Description copied from interface: IStorageProvider
Deletes blob, or recursively delete folder at given path.

Parameters:
path - The file path to delete
Returns:
true if at least one file was deleted, false if no object was existing at this path.
Throws:
CStorageException - Error deleting the file

getFile

public CFile getFile(CPath path)
              throws CStorageException
Description copied from interface: IStorageProvider
Return detailed file information at given path, or None if no object exists at this path

Parameters:
path - The file path
Returns:
detailed file information at given path, or null if no object exists at this path
Throws:
CStorageException - Error getting the file

download

public void download(CDownloadRequest downloadRequest)
              throws CStorageException
Description copied from interface: IStorageProvider
Downloads a blob from provider to a byte sink, as defined by the download_request object. Throws CFileNotFoundError if no blob exists at this path. Throws CInvalidFileTypeError if a folder exists at specified path.

Parameters:
downloadRequest - The download request object
Throws:
CStorageException - Download error

upload

public void upload(CUploadRequest uploadRequest)
            throws CStorageException
Description copied from interface: IStorageProvider
Uploads a byte source to provider, as defined by upload_request object. If a blob already exists it is replaced. Throws CInvalidFileTypeError if a folder already exists at specified path.

Parameters:
uploadRequest - The upload resuest object
Throws:
CStorageException - Upload error


Copyright © 2014. All Rights Reserved.