Class DummyFileUploadRepository

  • All Implemented Interfaces:
    tigase.db.DataSourceAware, FileUploadRepository

    @Bean(name="repo",
          exportable=true,
          active=true)
    public class DummyFileUploadRepository
    extends java.lang.Object
    implements FileUploadRepository
    Created by andrzej on 08.08.2016.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      DummyFileUploadRepository.Slot allocateSlot​(tigase.xmpp.jid.JID sender, java.lang.String slotId, java.lang.String filename, long filesize, java.lang.String contentType)
      Create slot in database for file upload.
      DummyFileUploadRepository.Slot getSlot​(tigase.xmpp.jid.BareJID sender, java.lang.String slotId)
      Retrieves information from database about slot
      long getUsedSpaceForDomain​(java.lang.String domain)
      Calculates space used by files upload by all users from domain
      long getUsedSpaceForUser​(tigase.xmpp.jid.BareJID user)
      Calculates space used by files upload by the user
      java.util.List<FileUploadRepository.Slot> listExpiredSlots​(tigase.xmpp.jid.BareJID domain, java.time.LocalDateTime before, int limit)
      Retrieves list of ids of expired slots
      java.util.List<FileUploadRepository.Slot> querySlots​(java.lang.String domain, java.lang.String afterId, int limit)
      Retrieves list of slots after slot with provided id.
      java.util.List<FileUploadRepository.Slot> querySlots​(tigase.xmpp.jid.BareJID user, java.lang.String afterId, int limit)
      Retrieves list of slots after slot with provided id.
      void removeExpiredSlots​(tigase.xmpp.jid.BareJID domain, java.time.LocalDateTime before, int limit)
      Removes metadata of expired slots
      void removeSlot​(tigase.xmpp.jid.BareJID user, java.lang.String slotId)
      Removes slot with id
      void setDataSource​(tigase.db.DataSource dataSource)  
      void updateSlot​(tigase.xmpp.jid.BareJID sender, java.lang.String slotId)
      Looks for slot for particular sender with exact slot id, file name and file size
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DummyFileUploadRepository

        public DummyFileUploadRepository()
    • Method Detail

      • allocateSlot

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

        public void updateSlot​(tigase.xmpp.jid.BareJID sender,
                               java.lang.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
        Throws:
        tigase.db.TigaseDBException
      • removeExpiredSlots

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

        public long getUsedSpaceForDomain​(java.lang.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
        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
        Returns:
        Throws:
        tigase.db.TigaseDBException
      • querySlots

        public java.util.List<FileUploadRepository.Slot> querySlots​(tigase.xmpp.jid.BareJID user,
                                                                    java.lang.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
        Returns:
        Throws:
        tigase.db.TigaseDBException
      • querySlots

        public java.util.List<FileUploadRepository.Slot> querySlots​(java.lang.String domain,
                                                                    java.lang.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
        Returns:
        Throws:
        tigase.db.TigaseDBException
      • removeSlot

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

        public void setDataSource​(tigase.db.DataSource dataSource)
        Specified by:
        setDataSource in interface tigase.db.DataSourceAware