Package tigase.http.upload.db
Class FileUploadRepositoryPool<R extends FileUploadRepository<tigase.db.DataSource>>
java.lang.Object
tigase.db.beans.MDRepositoryBean<R>
tigase.http.upload.db.FileUploadRepositoryPool<R>
- All Implemented Interfaces:
tigase.db.DataSourceAware
,FileUploadRepository
,tigase.kernel.beans.Initializable
,tigase.kernel.beans.RegistrarBean
,tigase.kernel.beans.RegistrarBeanWithDefaultBeanClass
,tigase.kernel.beans.UnregisterAware
@Bean(name="repositoryPool",
parent=FileUploadComponent.class,
active=true,
exportable=true)
public class FileUploadRepositoryPool<R extends FileUploadRepository<tigase.db.DataSource>>
extends tigase.db.beans.MDRepositoryBean<R>
implements FileUploadRepository
Created by andrzej on 10.08.2016.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Nested classes/interfaces inherited from class tigase.db.beans.MDRepositoryBean
tigase.db.beans.MDRepositoryBean.MDRepositoryConfigBean<A extends tigase.db.DataSourceAware>, tigase.db.beans.MDRepositoryBean.SelectorType
Nested classes/interfaces inherited from interface tigase.http.upload.db.FileUploadRepository
FileUploadRepository.Slot
-
Field Summary
Fields inherited from class tigase.db.beans.MDRepositoryBean
aliases, dataSourceSelection
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionallocateSlot
(tigase.xmpp.jid.BareJID sender, String slotId, String filename, long filesize, String contentType) Create slot in database for file upload.allocateSlot
(tigase.xmpp.jid.JID sender, String slotId, String filename, long filesize, String contentType) Create slot in database for file upload.protected Class
findClassForDataSource
(tigase.db.DataSource dataSource) Class<?>
Retrieves information from database about slotlong
getUsedSpaceForDomain
(String domain) Calculates space used by files upload by all users from domainlong
getUsedSpaceForUser
(tigase.xmpp.jid.BareJID user) Calculates space used by files upload by the userlistExpiredSlots
(tigase.xmpp.jid.BareJID domain, LocalDateTime before, int limit) Retrieves list of ids of expired slotsquerySlots
(String domain, String afterId, int limit) Retrieves list of slots after slot with provided id.querySlots
(tigase.xmpp.jid.BareJID user, String afterId, int limit) Retrieves list of slots after slot with provided id.void
removeExpiredSlots
(tigase.xmpp.jid.BareJID domain, LocalDateTime before, int limit) Removes metadata of expired slotsvoid
removeSlot
(tigase.xmpp.jid.BareJID user, String slotId) Removes slot with idvoid
setDataSource
(tigase.db.DataSource dataSource) void
updateSlot
(tigase.xmpp.jid.BareJID sender, String slotId) Looks for slot for particular sender with exact slot id, file name and file sizeMethods inherited from class tigase.db.beans.MDRepositoryBean
beforeUnregister, getName, getRepositories, getRepository, initialize, initializeRepository, onDataSourceChange, register, registerIfNotExists, repositoriesStream, setDataSourceBean, unregister, updateDataSourceAware
-
Constructor Details
-
FileUploadRepositoryPool
public FileUploadRepositoryPool()
-
-
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 interfaceFileUploadRepository<R extends FileUploadRepository<tigase.db.DataSource>>
- Throws:
tigase.db.TigaseDBException
-
allocateSlot
public FileUploadRepository.Slot allocateSlot(tigase.xmpp.jid.JID 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 interfaceFileUploadRepository<R extends FileUploadRepository<tigase.db.DataSource>>
- Throws:
tigase.db.TigaseDBException
-
updateSlot
public void updateSlot(tigase.xmpp.jid.BareJID sender, 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 interfaceFileUploadRepository<R extends FileUploadRepository<tigase.db.DataSource>>
- 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 interfaceFileUploadRepository<R extends FileUploadRepository<tigase.db.DataSource>>
- 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 interfaceFileUploadRepository<R extends FileUploadRepository<tigase.db.DataSource>>
- 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 interfaceFileUploadRepository<R extends FileUploadRepository<tigase.db.DataSource>>
- Throws:
tigase.db.TigaseDBException
-
getUsedSpaceForDomain
Description copied from interface:FileUploadRepository
Calculates space used by files upload by all users from domain- Specified by:
getUsedSpaceForDomain
in interfaceFileUploadRepository<R extends FileUploadRepository<tigase.db.DataSource>>
- 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 interfaceFileUploadRepository<R extends FileUploadRepository<tigase.db.DataSource>>
- 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 interfaceFileUploadRepository<R extends FileUploadRepository<tigase.db.DataSource>>
- 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 interfaceFileUploadRepository<R extends FileUploadRepository<tigase.db.DataSource>>
- 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 interfaceFileUploadRepository<R extends FileUploadRepository<tigase.db.DataSource>>
- Throws:
tigase.db.TigaseDBException
-
setDataSource
public void setDataSource(tigase.db.DataSource dataSource) - Specified by:
setDataSource
in interfacetigase.db.DataSourceAware<R extends FileUploadRepository<tigase.db.DataSource>>
-
getDefaultBeanClass
- Specified by:
getDefaultBeanClass
in interfacetigase.kernel.beans.RegistrarBeanWithDefaultBeanClass
-
findClassForDataSource
protected Class findClassForDataSource(tigase.db.DataSource dataSource) throws tigase.db.DBInitException - Specified by:
findClassForDataSource
in classtigase.db.beans.MDRepositoryBean<R extends FileUploadRepository<tigase.db.DataSource>>
- Throws:
tigase.db.DBInitException
-