public class FileHistoryServiceImpl extends java.lang.Object implements FileHistoryService, org.osgi.framework.ServiceListener, FileTransferStatusListener, FileTransferListener
Constructor and Description |
---|
FileHistoryServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
eraseLocallyStoredHistory()
Permanently removes all locally stored file history.
|
void |
eraseLocallyStoredHistory(MetaContact contact)
Permanently removes locally stored file history for the metacontact.
|
void |
fileTransferCreated(FileTransferCreatedEvent event)
New file transfer was created.
|
void |
fileTransferRequestCanceled(FileTransferRequestEvent event)
Called when an IncomingFileTransferRequest has been canceled
from the contact who sent it.
|
void |
fileTransferRequestReceived(FileTransferRequestEvent event)
We ignore filetransfer requests.
|
void |
fileTransferRequestRejected(FileTransferRequestEvent event)
Called when a new IncomingFileTransferRequest has been rejected.
|
java.util.Collection<FileRecord> |
findByEndDate(MetaContact contact,
java.util.Date endDate)
Returns all the file transfers made before the given date
|
java.util.Collection<FileRecord> |
findByKeyword(MetaContact contact,
java.lang.String keyword)
Returns all the file transfers having the given keyword in the filename
|
java.util.Collection<FileRecord> |
findByKeyword(MetaContact contact,
java.lang.String keyword,
boolean caseSensitive)
Returns all the file transfers having the given keyword in the filename
|
java.util.Collection<FileRecord> |
findByKeywords(MetaContact contact,
java.lang.String[] keywords)
Returns all the file transfers having the given keywords in the filename
|
java.util.Collection<FileRecord> |
findByKeywords(MetaContact contact,
java.lang.String[] keywords,
boolean caseSensitive)
Returns all the file transfershaving the given keywords in the filename
|
java.util.Collection<FileRecord> |
findByPeriod(MetaContact contact,
java.util.Date startDate,
java.util.Date endDate)
Returns all the file transfers made between the given dates
|
java.util.Collection<FileRecord> |
findByPeriod(MetaContact contact,
java.util.Date startDate,
java.util.Date endDate,
java.lang.String[] keywords)
Returns all the file transfers made between the given dates and
having the given keywords in the filename
|
java.util.Collection<FileRecord> |
findByPeriod(MetaContact contact,
java.util.Date startDate,
java.util.Date endDate,
java.lang.String[] keywords,
boolean caseSensitive)
Returns all the file transfers made between the given dates
and having the given keywords in the filename
|
java.util.Collection<FileRecord> |
findByStartDate(MetaContact contact,
java.util.Date startDate)
Returns all the file transfers made after the given date
|
java.util.Collection<FileRecord> |
findFirstRecordsAfter(MetaContact contact,
java.util.Date date,
int count)
Returns the supplied number of recent file transfers after the given date
|
java.util.Collection<FileRecord> |
findLast(MetaContact contact,
int count)
Returns the supplied number of file transfers
|
java.util.Collection<FileRecord> |
findLastRecordsBefore(MetaContact contact,
java.util.Date date,
int count)
Returns the supplied number of recent file transfers before the given date
|
void |
serviceChanged(org.osgi.framework.ServiceEvent serviceEvent)
When new protocol provider is registered we check
does it supports FileTransfer and if so add a listener to it
|
void |
setHistoryService(HistoryService historyService)
Set the history service.
|
void |
start(org.osgi.framework.BundleContext bc)
Starts the service.
|
void |
statusChanged(FileTransferStatusChangeEvent event)
Listens for changes in file transfers.
|
void |
stop(org.osgi.framework.BundleContext bc)
Stops the service.
|
public void start(org.osgi.framework.BundleContext bc)
bc
- BundleContextpublic void stop(org.osgi.framework.BundleContext bc)
bc
- BundleContextpublic void setHistoryService(HistoryService historyService)
historyService
- HistoryServicepublic java.util.Collection<FileRecord> findByStartDate(MetaContact contact, java.util.Date startDate) throws java.lang.RuntimeException
findByStartDate
in interface FileHistoryService
contact
- MetaContact the receiver or sender of the filestartDate
- Date the start date of the transfersjava.lang.RuntimeException
public java.util.Collection<FileRecord> findByEndDate(MetaContact contact, java.util.Date endDate) throws java.lang.RuntimeException
findByEndDate
in interface FileHistoryService
contact
- MetaContact the receiver or sender of the fileendDate
- Date the end date of the transfersjava.lang.RuntimeException
public java.util.Collection<FileRecord> findByPeriod(MetaContact contact, java.util.Date startDate, java.util.Date endDate, java.lang.String[] keywords) throws java.lang.RuntimeException
findByPeriod
in interface FileHistoryService
contact
- MetaContact the receiver or sender of the filestartDate
- Date the start date of the transfersendDate
- Date the end date of the transferskeywords
- array of keywordsjava.lang.RuntimeException
public java.util.Collection<FileRecord> findByPeriod(MetaContact contact, java.util.Date startDate, java.util.Date endDate, java.lang.String[] keywords, boolean caseSensitive) throws java.lang.RuntimeException
findByPeriod
in interface FileHistoryService
contact
- MetaContact the receiver or sender of the filestartDate
- Date the start date of the transfersendDate
- Date the end date of the transferskeywords
- array of keywordscaseSensitive
- is keywords search case sensitivejava.lang.RuntimeException
public java.util.Collection<FileRecord> findByPeriod(MetaContact contact, java.util.Date startDate, java.util.Date endDate) throws java.lang.RuntimeException
findByPeriod
in interface FileHistoryService
contact
- MetaContact the receiver or sender of the filestartDate
- Date the start date of the transfersendDate
- Date the end date of the transfersjava.lang.RuntimeException
public java.util.Collection<FileRecord> findLast(MetaContact contact, int count) throws java.lang.RuntimeException
findLast
in interface FileHistoryService
contact
- MetaContact the receiver or sender of the filecount
- filetransfer countjava.lang.RuntimeException
public java.util.Collection<FileRecord> findByKeyword(MetaContact contact, java.lang.String keyword) throws java.lang.RuntimeException
findByKeyword
in interface FileHistoryService
contact
- MetaContact the receiver or sender of the filekeyword
- keywordjava.lang.RuntimeException
public java.util.Collection<FileRecord> findByKeyword(MetaContact contact, java.lang.String keyword, boolean caseSensitive) throws java.lang.RuntimeException
findByKeyword
in interface FileHistoryService
contact
- MetaContact the receiver or sender of the filekeyword
- keywordcaseSensitive
- is keywords search case sensitivejava.lang.RuntimeException
public java.util.Collection<FileRecord> findByKeywords(MetaContact contact, java.lang.String[] keywords) throws java.lang.RuntimeException
findByKeywords
in interface FileHistoryService
contact
- MetaContact the receiver or sender of the filekeywords
- keywordjava.lang.RuntimeException
public java.util.Collection<FileRecord> findByKeywords(MetaContact contact, java.lang.String[] keywords, boolean caseSensitive) throws java.lang.RuntimeException
findByKeywords
in interface FileHistoryService
contact
- MetaContact the receiver or sender of the filekeywords
- keywordcaseSensitive
- is keywords search case sensitivejava.lang.RuntimeException
public java.util.Collection<FileRecord> findFirstRecordsAfter(MetaContact contact, java.util.Date date, int count) throws java.lang.RuntimeException
findFirstRecordsAfter
in interface FileHistoryService
contact
- MetaContact the receiver or sender of the filedate
- transfers after datecount
- transfers countjava.lang.RuntimeException
public java.util.Collection<FileRecord> findLastRecordsBefore(MetaContact contact, java.util.Date date, int count) throws java.lang.RuntimeException
findLastRecordsBefore
in interface FileHistoryService
contact
- MetaContact the receiver or sender of the filedate
- transfers before datecount
- transfers countjava.lang.RuntimeException
public void serviceChanged(org.osgi.framework.ServiceEvent serviceEvent)
serviceChanged
in interface org.osgi.framework.ServiceListener
serviceEvent
- ServiceEventpublic void statusChanged(FileTransferStatusChangeEvent event)
statusChanged
in interface FileTransferStatusListener
event
- public void fileTransferRequestReceived(FileTransferRequestEvent event)
fileTransferRequestReceived
in interface FileTransferListener
event
- public void fileTransferCreated(FileTransferCreatedEvent event)
fileTransferCreated
in interface FileTransferListener
event
- fileTransferpublic void fileTransferRequestRejected(FileTransferRequestEvent event)
fileTransferRequestRejected
in interface FileTransferListener
event
- the FileTransferRequestEvent containing the
received request which was rejected.public void fileTransferRequestCanceled(FileTransferRequestEvent event)
FileTransferListener
fileTransferRequestCanceled
in interface FileTransferListener
event
- the FileTransferRequestEvent containing the
request which was canceled.public void eraseLocallyStoredHistory() throws java.io.IOException
eraseLocallyStoredHistory
in interface FileHistoryService
java.io.IOException
- Thrown if the history could not be removed due to a IO error.public void eraseLocallyStoredHistory(MetaContact contact) throws java.io.IOException
eraseLocallyStoredHistory
in interface FileHistoryService
java.io.IOException
- Thrown if the history could not be removed due to a IO error.
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.