Class S3StorageFileService

  • All Implemented Interfaces:
    fr.paris.lutece.portal.service.file.IFileStoreServiceProvider, Serializable

    public class S3StorageFileService
    extends Object
    implements fr.paris.lutece.portal.service.file.IFileStoreServiceProvider
    S3StorageFileService.
    See Also:
    Serialized Form
    • Constructor Detail

      • S3StorageFileService

        public S3StorageFileService​(fr.paris.lutece.portal.service.file.IFileDownloadUrlService _fileDownloadUrlService,
                                    fr.paris.lutece.portal.service.file.IFileRBACService _fileRBACService,
                                    String s3Url,
                                    String s3Bucket,
                                    String s3Key,
                                    String s3Password,
                                    String s3DefaultFilePath,
                                    String s3ForcePathStyle,
                                    String s3Region,
                                    String s3ChecksumAlgorithm,
                                    String s3ProxyHost,
                                    String s3ProxyUsername,
                                    String s3ProxyPassword,
                                    String s3RequestTimeout,
                                    String s3ConnectionTimeout)
        init
        Parameters:
        _fileDownloadUrlService -
        _fileRBACService -
        s3Url - : the URL of the S3 server
        s3Bucket - : the name of the S3 bucket
        s3Key - : the key to access the S3 bucket
        s3Password - : the password to access the S3 bucket
    • Method Detail

      • getFileRBACService

        public fr.paris.lutece.portal.service.file.IFileRBACService getFileRBACService()
        get the FileRBACService
        Returns:
        the FileRBACService
      • setFileRBACService

        public void setFileRBACService​(fr.paris.lutece.portal.service.file.IFileRBACService fileRBACService)
        set the FileRBACService
        Parameters:
        fileRBACService -
      • getDownloadUrlService

        public fr.paris.lutece.portal.service.file.IFileDownloadUrlService getDownloadUrlService()
        Get the downloadService
        Returns:
        the downloadService
      • setDownloadUrlService

        public void setDownloadUrlService​(fr.paris.lutece.portal.service.file.IFileDownloadUrlService downloadUrlService)
        Sets the downloadService
        Parameters:
        downloadUrlService - downloadService
      • getName

        public String getName()
        Specified by:
        getName in interface fr.paris.lutece.portal.service.file.IFileStoreServiceProvider
      • delete

        public void delete​(String strPath)
                    throws fr.paris.lutece.portal.service.file.FileServiceException
        Specified by:
        delete in interface fr.paris.lutece.portal.service.file.IFileStoreServiceProvider
        Throws:
        fr.paris.lutece.portal.service.file.FileServiceException
      • getFile

        public fr.paris.lutece.portal.business.file.File getFile​(String strPath)
                                                          throws fr.paris.lutece.portal.service.file.FileServiceException
        Specified by:
        getFile in interface fr.paris.lutece.portal.service.file.IFileStoreServiceProvider
        Throws:
        fr.paris.lutece.portal.service.file.FileServiceException
      • getFileMetaData

        public fr.paris.lutece.portal.business.file.File getFileMetaData​(String strPath)
                                                                  throws fr.paris.lutece.portal.service.file.FileServiceException
        Specified by:
        getFileMetaData in interface fr.paris.lutece.portal.service.file.IFileStoreServiceProvider
        Throws:
        fr.paris.lutece.portal.service.file.FileServiceException
      • getFile

        public fr.paris.lutece.portal.business.file.File getFile​(String strPath,
                                                                 boolean withPhysicalFile)
                                                          throws fr.paris.lutece.portal.service.file.FileServiceException
        get file from database
        Parameters:
        strKey -
        withPhysicalFile -
        Returns:
        the file with the physical file content if withPhysicalFile is true, null otherwise
        Throws:
        fr.paris.lutece.portal.service.file.FileServiceException
      • storeBytes

        public String storeBytes​(byte[] blob)
                          throws fr.paris.lutece.portal.service.file.FileServiceException
        Specified by:
        storeBytes in interface fr.paris.lutece.portal.service.file.IFileStoreServiceProvider
        Throws:
        fr.paris.lutece.portal.service.file.FileServiceException
      • storeInputStream

        public String storeInputStream​(InputStream inputStream)
                                throws fr.paris.lutece.portal.service.file.FileServiceException
        Specified by:
        storeInputStream in interface fr.paris.lutece.portal.service.file.IFileStoreServiceProvider
        Throws:
        fr.paris.lutece.portal.service.file.FileServiceException
      • storeFileItem

        public String storeFileItem​(org.apache.commons.fileupload.FileItem fileItem)
                             throws fr.paris.lutece.portal.service.file.FileServiceException
        Specified by:
        storeFileItem in interface fr.paris.lutece.portal.service.file.IFileStoreServiceProvider
        Throws:
        fr.paris.lutece.portal.service.file.FileServiceException
      • storeFile

        public String storeFile​(fr.paris.lutece.portal.business.file.File file)
                         throws fr.paris.lutece.portal.service.file.FileServiceException
        Specified by:
        storeFile in interface fr.paris.lutece.portal.service.file.IFileStoreServiceProvider
        Throws:
        fr.paris.lutece.portal.service.file.FileServiceException
      • setDefault

        public void setDefault​(boolean bDefault)
      • setName

        public void setName​(String strName)
      • isDefault

        public boolean isDefault()
        Specified by:
        isDefault in interface fr.paris.lutece.portal.service.file.IFileStoreServiceProvider
      • getInputStream

        public InputStream getInputStream​(String strKey)
                                   throws fr.paris.lutece.portal.service.file.FileServiceException
        Specified by:
        getInputStream in interface fr.paris.lutece.portal.service.file.IFileStoreServiceProvider
        Throws:
        fr.paris.lutece.portal.service.file.FileServiceException
      • getFileDownloadUrlFO

        public String getFileDownloadUrlFO​(String strKey)
        Specified by:
        getFileDownloadUrlFO in interface fr.paris.lutece.portal.service.file.IFileStoreServiceProvider
      • getFileDownloadUrlFO

        public String getFileDownloadUrlFO​(String strKey,
                                           Map<String,​String> additionnalData)
        Specified by:
        getFileDownloadUrlFO in interface fr.paris.lutece.portal.service.file.IFileStoreServiceProvider
      • getFileDownloadUrlBO

        public String getFileDownloadUrlBO​(String strKey)
        Specified by:
        getFileDownloadUrlBO in interface fr.paris.lutece.portal.service.file.IFileStoreServiceProvider
      • getFileDownloadUrlBO

        public String getFileDownloadUrlBO​(String strKey,
                                           Map<String,​String> additionnalData)
        Specified by:
        getFileDownloadUrlBO in interface fr.paris.lutece.portal.service.file.IFileStoreServiceProvider
      • checkAccessRights

        public void checkAccessRights​(Map<String,​String> fileData,
                                      fr.paris.lutece.api.user.User user)
                               throws fr.paris.lutece.portal.service.admin.AccessDeniedException,
                                      fr.paris.lutece.portal.service.security.UserNotSignedException
        Specified by:
        checkAccessRights in interface fr.paris.lutece.portal.service.file.IFileStoreServiceProvider
        Throws:
        fr.paris.lutece.portal.service.admin.AccessDeniedException
        fr.paris.lutece.portal.service.security.UserNotSignedException
      • checkLinkValidity

        public void checkLinkValidity​(Map<String,​String> fileData)
                               throws fr.paris.lutece.portal.service.file.ExpiredLinkException
        Specified by:
        checkLinkValidity in interface fr.paris.lutece.portal.service.file.IFileStoreServiceProvider
        Throws:
        fr.paris.lutece.portal.service.file.ExpiredLinkException
      • getFileFromRequestBO

        public fr.paris.lutece.portal.business.file.File getFileFromRequestBO​(javax.servlet.http.HttpServletRequest request)
                                                                       throws fr.paris.lutece.portal.service.admin.AccessDeniedException,
                                                                              fr.paris.lutece.portal.service.file.ExpiredLinkException,
                                                                              fr.paris.lutece.portal.service.security.UserNotSignedException,
                                                                              fr.paris.lutece.portal.service.file.FileServiceException
        Specified by:
        getFileFromRequestBO in interface fr.paris.lutece.portal.service.file.IFileStoreServiceProvider
        Throws:
        fr.paris.lutece.portal.service.file.FileServiceException
        fr.paris.lutece.portal.service.admin.AccessDeniedException
        fr.paris.lutece.portal.service.file.ExpiredLinkException
        fr.paris.lutece.portal.service.security.UserNotSignedException
      • getFileFromRequestFO

        public fr.paris.lutece.portal.business.file.File getFileFromRequestFO​(javax.servlet.http.HttpServletRequest request)
                                                                       throws fr.paris.lutece.portal.service.admin.AccessDeniedException,
                                                                              fr.paris.lutece.portal.service.file.ExpiredLinkException,
                                                                              fr.paris.lutece.portal.service.security.UserNotSignedException,
                                                                              fr.paris.lutece.portal.service.file.FileServiceException
        Specified by:
        getFileFromRequestFO in interface fr.paris.lutece.portal.service.file.IFileStoreServiceProvider
        Throws:
        fr.paris.lutece.portal.service.file.FileServiceException
        fr.paris.lutece.portal.service.admin.AccessDeniedException
        fr.paris.lutece.portal.service.file.ExpiredLinkException
        fr.paris.lutece.portal.service.security.UserNotSignedException
      • healthCheck

        public boolean healthCheck()
        Specified by:
        healthCheck in interface fr.paris.lutece.portal.service.file.IFileStoreServiceProvider