Class FileServiceImpl

java.lang.Object
org.exoplatform.commons.file.services.impl.FileServiceImpl
All Implemented Interfaces:
FileService

public class FileServiceImpl extends Object implements FileService
File Service which stores the file metadata in a database, and uses a BinaryProvider to store the file binary. Created by The eXo Platform SAS Author : eXoPlatform exo@exoplatform.com
  • Constructor Details

    • FileServiceImpl

      public FileServiceImpl(DataStorage dataStorage, BinaryProvider resourceProvider, NameSpaceService nameSpaceService, org.exoplatform.services.listener.ListenerService listenerService)
  • Method Details

    • getFileInfo

      public FileInfo getFileInfo(long id)
      Description copied from interface: FileService
      Get only the file info of the given id
      Specified by:
      getFileInfo in interface FileService
      Parameters:
      id - file id
      Returns:
      file info
    • getFileInfoListByChecksum

      public List<FileInfo> getFileInfoListByChecksum(String checksum)
      Description copied from interface: FileService
      Get the files info of the given checksum
      Specified by:
      getFileInfoListByChecksum in interface FileService
      Parameters:
      checksum - files checksum
      Returns:
      list file info
    • getFile

      public FileItem getFile(long id) throws FileStorageException
      Description copied from interface: FileService
      Get the file (info + binary) of the given id
      Specified by:
      getFile in interface FileService
      Parameters:
      id - file id
      Returns:
      fileItem
      Throws:
      FileStorageException - signals that an I/O exception of some sort has occurred.
    • writeFile

      public FileItem writeFile(FileItem file) throws FileStorageException, IOException
      Description copied from interface: FileService
      Store the file using the provided DAO and binary provider. This method is transactional, meaning that if the write of the info or of the binary fails, nothing must be persisted.
      Specified by:
      writeFile in interface FileService
      Parameters:
      file - file item
      Returns:
      updated file item
      Throws:
      FileStorageException - signals that an error occur on save resource.
      IOException - signals that an I/O exception of some sort has occurred.
    • updateFile

      public FileItem updateFile(FileItem file) throws FileStorageException, IOException
      Description copied from interface: FileService
      Update the stored file using the provided DAO and binary provider. This method is transactional, meaning that if the write of the info or of the binary fails, nothing must be persisted.
      Specified by:
      updateFile in interface FileService
      Parameters:
      file - file item
      Returns:
      updated file item
      Throws:
      FileStorageException - signals that an error occur on save resource.
      IOException - signals that an I/O exception of some sort has occurred.
    • deleteFile

      public FileInfo deleteFile(long id)
      Description copied from interface: FileService
      Delete file with the given id The file is not physically deleted, it is only a logical deletion
      Specified by:
      deleteFile in interface FileService
      Parameters:
      id - Id of the file to delete
      Returns:
      file Info
    • getFilesByChecksum

      public List<FileItem> getFilesByChecksum(String checksum) throws FileStorageException
      Description copied from interface: FileService
      Get the files (info + binary) of the given checksum
      Specified by:
      getFilesByChecksum in interface FileService
      Parameters:
      checksum - files checksum
      Returns:
      list fileItem
      Throws:
      FileStorageException - signals that an I/O exception of some sort has occurred.