Class JDBCFileUploadRepository

java.lang.Object
tigase.http.upload.db.JDBCFileUploadRepository
All Implemented Interfaces:
tigase.db.DataSourceAware<tigase.db.DataRepository>, tigase.db.util.RepositoryVersionAware, FileUploadRepository<tigase.db.DataRepository>

public class JDBCFileUploadRepository extends Object implements FileUploadRepository<tigase.db.DataRepository>, tigase.db.util.RepositoryVersionAware
Created by andrzej on 07.08.2016.
  • Constructor Details

    • JDBCFileUploadRepository

      public JDBCFileUploadRepository()
  • Method Details

    • allocateSlot

      public FileUploadRepository.Slot allocateSlot(tigase.xmpp.jid.BareJID sender, String slotId, String filename, long filesize, String contentType) throws tigase.db.TigaseDBException
      Description copied from interface: FileUploadRepository
      Create slot in database for file upload.
      Specified by:
      allocateSlot in interface FileUploadRepository<tigase.db.DataRepository>
      Throws:
      tigase.db.TigaseDBException
    • updateSlot

      public void updateSlot(tigase.xmpp.jid.BareJID userJid, String slotId) throws tigase.db.TigaseDBException
      Description copied from interface: FileUploadRepository
      Looks for slot for particular sender with exact slot id, file name and file size
      Specified by:
      updateSlot in interface FileUploadRepository<tigase.db.DataRepository>
      Throws:
      tigase.db.TigaseDBException
    • getSlot

      public FileUploadRepository.Slot getSlot(tigase.xmpp.jid.BareJID sender, String slotId) throws tigase.db.TigaseDBException
      Description copied from interface: FileUploadRepository
      Retrieves information from database about slot
      Specified by:
      getSlot in interface FileUploadRepository<tigase.db.DataRepository>
      Throws:
      tigase.db.TigaseDBException
    • listExpiredSlots

      public List<FileUploadRepository.Slot> listExpiredSlots(tigase.xmpp.jid.BareJID domain, LocalDateTime before, int limit) throws tigase.db.TigaseDBException
      Description copied from interface: FileUploadRepository
      Retrieves list of ids of expired slots
      Specified by:
      listExpiredSlots in interface FileUploadRepository<tigase.db.DataRepository>
      Throws:
      tigase.db.TigaseDBException
    • removeExpiredSlots

      public void removeExpiredSlots(tigase.xmpp.jid.BareJID domain, LocalDateTime before, int limit) throws tigase.db.TigaseDBException
      Description copied from interface: FileUploadRepository
      Removes metadata of expired slots
      Specified by:
      removeExpiredSlots in interface FileUploadRepository<tigase.db.DataRepository>
      Throws:
      tigase.db.TigaseDBException
    • getUsedSpaceForDomain

      public long getUsedSpaceForDomain(String domain) throws tigase.db.TigaseDBException
      Description copied from interface: FileUploadRepository
      Calculates space used by files upload by all users from domain
      Specified by:
      getUsedSpaceForDomain in interface FileUploadRepository<tigase.db.DataRepository>
      Returns:
      Throws:
      tigase.db.TigaseDBException
    • getUsedSpaceForUser

      public long getUsedSpaceForUser(tigase.xmpp.jid.BareJID user) throws tigase.db.TigaseDBException
      Description copied from interface: FileUploadRepository
      Calculates space used by files upload by the user
      Specified by:
      getUsedSpaceForUser in interface FileUploadRepository<tigase.db.DataRepository>
      Returns:
      Throws:
      tigase.db.TigaseDBException
    • querySlots

      public List<FileUploadRepository.Slot> querySlots(String domain, String afterId, int limit) throws tigase.db.TigaseDBException
      Description copied from interface: FileUploadRepository
      Retrieves list of slots after slot with provided id. If id is null, first slots will be returned.
      Specified by:
      querySlots in interface FileUploadRepository<tigase.db.DataRepository>
      Returns:
      Throws:
      tigase.db.TigaseDBException
    • querySlots

      public List<FileUploadRepository.Slot> querySlots(tigase.xmpp.jid.BareJID user, String afterId, int limit) throws tigase.db.TigaseDBException
      Description copied from interface: FileUploadRepository
      Retrieves list of slots after slot with provided id. If id is null, first slots will be returned.
      Specified by:
      querySlots in interface FileUploadRepository<tigase.db.DataRepository>
      Returns:
      Throws:
      tigase.db.TigaseDBException
    • removeSlot

      public void removeSlot(tigase.xmpp.jid.BareJID user, String slotId) throws tigase.db.TigaseDBException
      Description copied from interface: FileUploadRepository
      Removes slot with id
      Specified by:
      removeSlot in interface FileUploadRepository<tigase.db.DataRepository>
      Throws:
      tigase.db.TigaseDBException
    • setDataSource

      public void setDataSource(tigase.db.DataRepository dataSource)
      Specified by:
      setDataSource in interface tigase.db.DataSourceAware<tigase.db.DataRepository>