Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.metahistory
Class MetaHistoryServiceImpl

java.lang.Object
  extended by net.java.sip.communicator.impl.metahistory.MetaHistoryServiceImpl
All Implemented Interfaces:
EventListener, MetaHistoryService, org.osgi.framework.ServiceListener

public class MetaHistoryServiceImpl
extends Object
implements MetaHistoryService, org.osgi.framework.ServiceListener

The Meta History Service is wrapper around the other known history services. Query them all at once, sort the result and return all merged records in one collection.

Author:
Damian Minkov

Constructor Summary
MetaHistoryServiceImpl()
           
 
Method Summary
 void addSearchProgressListener(HistorySearchProgressListener listener)
          Adding progress listener for monitoring progress of search process
 Collection<Object> findByEndDate(String[] services, Object descriptor, Date endDate)
          Returns all the records before the given date
 Collection<Object> findByKeyword(String[] services, Object descriptor, String keyword)
          Returns all the records having the given keyword
 Collection<Object> findByKeyword(String[] services, Object descriptor, String keyword, boolean caseSensitive)
          Returns all the records having the given keyword
 Collection<Object> findByKeywords(String[] services, Object descriptor, String[] keywords)
          Returns all the records having the given keywords
 Collection<Object> findByKeywords(String[] services, Object descriptor, String[] keywords, boolean caseSensitive)
          Returns all the records having the given keywords
 Collection<Object> findByPeriod(String[] services, Object descriptor, Date startDate, Date endDate)
          Returns all the records between the given dates
 Collection<Object> findByPeriod(String[] services, Object descriptor, Date startDate, Date endDate, String[] keywords)
          Returns all the records between the given dates and having the given keywords
 Collection<Object> findByPeriod(String[] services, Object descriptor, Date startDate, Date endDate, String[] keywords, boolean caseSensitive)
          Returns all the records between the given dates and having the given keywords
 Collection<Object> findByStartDate(String[] services, Object descriptor, Date startDate)
          Returns all the records for the descriptor after the given date.
 Collection<Object> findFirstMessagesAfter(String[] services, Object descriptor, Date date, int count)
          Returns the supplied number of recent records after the given date
 Collection<Object> findLast(String[] services, Object descriptor, int count)
          Returns the supplied number of recent records.
 Collection<Object> findLastMessagesBefore(String[] services, Object descriptor, Date date, int count)
          Returns the supplied number of recent records before the given date
 void removeSearchProgressListener(HistorySearchProgressListener listener)
          Removing progress listener
 void serviceChanged(org.osgi.framework.ServiceEvent serviceEvent)
           
 void start(org.osgi.framework.BundleContext bc)
          starts the service.
 void stop(org.osgi.framework.BundleContext bc)
          stops the service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetaHistoryServiceImpl

public MetaHistoryServiceImpl()
Method Detail

findByStartDate

public Collection<Object> findByStartDate(String[] services,
                                          Object descriptor,
                                          Date startDate)
                                   throws RuntimeException
Returns all the records for the descriptor after the given date.

Specified by:
findByStartDate in interface MetaHistoryService
Parameters:
services - the services classnames we will query
descriptor - CallPeer address(String), MetaContact or ChatRoom.
startDate - Date the date of the first record to return
Returns:
Collection sorted result that consists of records returned from the services we wrap
Throws:
RuntimeException

findByEndDate

public Collection<Object> findByEndDate(String[] services,
                                        Object descriptor,
                                        Date endDate)
                                 throws RuntimeException
Returns all the records before the given date

Specified by:
findByEndDate in interface MetaHistoryService
Parameters:
services - the services classnames we will query
descriptor - CallPeer address(String), MetaContact or ChatRoom.
endDate - Date the date of the last record to return
Returns:
Collection sorted result that conists of records returned from the services we wrap
Throws:
RuntimeException

findByPeriod

public Collection<Object> findByPeriod(String[] services,
                                       Object descriptor,
                                       Date startDate,
                                       Date endDate)
                                throws RuntimeException
Returns all the records between the given dates

Specified by:
findByPeriod in interface MetaHistoryService
Parameters:
services - the services classnames we will query
descriptor - CallPeer address(String), MetaContact or ChatRoom.
startDate - Date the date of the first record to return
endDate - Date the date of the last record to return
Returns:
Collection sorted result that conists of records returned from the services we wrap
Throws:
RuntimeException

findByPeriod

public Collection<Object> findByPeriod(String[] services,
                                       Object descriptor,
                                       Date startDate,
                                       Date endDate,
                                       String[] keywords)
                                throws RuntimeException
Returns all the records between the given dates and having the given keywords

Specified by:
findByPeriod in interface MetaHistoryService
Parameters:
services - the services classnames we will query
descriptor - CallPeer address(String), MetaContact or ChatRoom.
startDate - Date the date of the first record to return
endDate - Date the date of the last record to return
keywords - array of keywords
Returns:
Collection sorted result that conists of records returned from the services we wrap
Throws:
RuntimeException

findByPeriod

public Collection<Object> findByPeriod(String[] services,
                                       Object descriptor,
                                       Date startDate,
                                       Date endDate,
                                       String[] keywords,
                                       boolean caseSensitive)
                                throws RuntimeException
Returns all the records between the given dates and having the given keywords

Specified by:
findByPeriod in interface MetaHistoryService
Parameters:
services - the services classnames we will query
descriptor - CallPeer address(String), MetaContact or ChatRoom.
startDate - Date the date of the first record to return
endDate - Date the date of the last record to return
keywords - array of keywords
caseSensitive - is keywords search case sensitive
Returns:
Collection sorted result that conists of records returned from the services we wrap
Throws:
RuntimeException

findByKeyword

public Collection<Object> findByKeyword(String[] services,
                                        Object descriptor,
                                        String keyword)
                                 throws RuntimeException
Returns all the records having the given keyword

Specified by:
findByKeyword in interface MetaHistoryService
Parameters:
services - the services classnames we will query
descriptor - CallPeer address(String), MetaContact or ChatRoom.
keyword - keyword
Returns:
Collection sorted result that conists of records returned from the services we wrap
Throws:
RuntimeException

findByKeyword

public Collection<Object> findByKeyword(String[] services,
                                        Object descriptor,
                                        String keyword,
                                        boolean caseSensitive)
                                 throws RuntimeException
Returns all the records having the given keyword

Specified by:
findByKeyword in interface MetaHistoryService
Parameters:
services - the services classnames we will query
descriptor - CallPeer address(String), MetaContact or ChatRoom.
keyword - keyword
caseSensitive - is keywords search case sensitive
Returns:
Collection sorted result that conists of records returned from the services we wrap
Throws:
RuntimeException

findByKeywords

public Collection<Object> findByKeywords(String[] services,
                                         Object descriptor,
                                         String[] keywords)
                                  throws RuntimeException
Returns all the records having the given keywords

Specified by:
findByKeywords in interface MetaHistoryService
Parameters:
services - the services classnames we will query
descriptor - CallPeer address(String), MetaContact or ChatRoom.
keywords - keyword
Returns:
Collection sorted result that conists of records returned from the services we wrap
Throws:
RuntimeException

findByKeywords

public Collection<Object> findByKeywords(String[] services,
                                         Object descriptor,
                                         String[] keywords,
                                         boolean caseSensitive)
                                  throws RuntimeException
Returns all the records having the given keywords

Specified by:
findByKeywords in interface MetaHistoryService
Parameters:
services - the services classnames we will query
descriptor - CallPeer address(String), MetaContact or ChatRoom.
keywords - keyword
caseSensitive - is keywords search case sensitive
Returns:
Collection sorted result that conists of records returned from the services we wrap
Throws:
RuntimeException

findLast

public Collection<Object> findLast(String[] services,
                                   Object descriptor,
                                   int count)
                            throws RuntimeException
Returns the supplied number of recent records.

Specified by:
findLast in interface MetaHistoryService
Parameters:
services - the services classnames we will query
descriptor - CallPeer address(String), MetaContact or ChatRoom.
count - messages count
Returns:
Collection sorted result that conists of records returned from the services we wrap
Throws:
RuntimeException

findFirstMessagesAfter

public Collection<Object> findFirstMessagesAfter(String[] services,
                                                 Object descriptor,
                                                 Date date,
                                                 int count)
                                          throws RuntimeException
Returns the supplied number of recent records after the given date

Specified by:
findFirstMessagesAfter in interface MetaHistoryService
Parameters:
services - the services classnames we will query
descriptor - CallPeer address(String), MetaContact or ChatRoom.
date - messages after date
count - messages count
Returns:
Collection sorted result that conists of records returned from the services we wrap
Throws:
RuntimeException

findLastMessagesBefore

public Collection<Object> findLastMessagesBefore(String[] services,
                                                 Object descriptor,
                                                 Date date,
                                                 int count)
                                          throws RuntimeException
Returns the supplied number of recent records before the given date

Specified by:
findLastMessagesBefore in interface MetaHistoryService
Parameters:
services - the services classnames we will query
descriptor - CallPeer address(String), MetaContact or ChatRoom.
date - messages before date
count - messages count
Returns:
Collection sorted result that conists of records returned from the services we wrap
Throws:
RuntimeException

addSearchProgressListener

public void addSearchProgressListener(HistorySearchProgressListener listener)
Adding progress listener for monitoring progress of search process

Specified by:
addSearchProgressListener in interface MetaHistoryService
Parameters:
listener - HistorySearchProgressListener

removeSearchProgressListener

public void removeSearchProgressListener(HistorySearchProgressListener listener)
Removing progress listener

Specified by:
removeSearchProgressListener in interface MetaHistoryService
Parameters:
listener - HistorySearchProgressListener

serviceChanged

public void serviceChanged(org.osgi.framework.ServiceEvent serviceEvent)
Specified by:
serviceChanged in interface org.osgi.framework.ServiceListener

start

public void start(org.osgi.framework.BundleContext bc)
starts the service.

Parameters:
bc - BundleContext

stop

public void stop(org.osgi.framework.BundleContext bc)
stops the service.

Parameters:
bc - BundleContext

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.