org.livetribe.slp.spi
Class ServiceInfoCache

java.lang.Object
  extended by org.livetribe.slp.spi.ServiceInfoCache

public class ServiceInfoCache
extends Object

A cache for ServiceInfos, that provides facilities to store, update, remove and query.

Version:
$Rev: 258 $ $Date: 2006-08-23 15:45:17 +0200 (Wed, 23 Aug 2006) $

Constructor Summary
ServiceInfoCache()
           
 
Method Summary
 void clear()
           
 ServiceInfo get(ServiceInfo.Key key)
          Returns the service correspondent to the given ServiceInfo.Key.
 Collection getServiceInfos()
           
 int getSize()
           
 void lock()
           
 List match(ServiceType serviceType, Scopes scopes, Filter filter, String language)
           
 List purge()
          Purges from this cache entries whose registration time plus their lifetime is less than the current time; that is, entries that should have been renewed but for some reason they have not been.
 ServiceInfo put(ServiceInfo service)
          Adds the given service to this cache replacing an eventually existing entry.
 ServiceInfo remove(ServiceInfo.Key key)
          Removes an existing entry with the given ServiceInfo.Key; if the entry does not exist, does nothing.
 void unlock()
           
 ServiceInfo updateAdd(ServiceInfo service)
          Updates an existing entry with the given service, adding information contained in the given service; if the entry does not exist, does nothing.
 ServiceInfo updateRemove(ServiceInfo service)
          Updates an existing entry with the given service, removing information contained in the given service; if the entry does not exist, does nothing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceInfoCache

public ServiceInfoCache()
Method Detail

lock

public void lock()

unlock

public void unlock()

put

public ServiceInfo put(ServiceInfo service)
Adds the given service to this cache replacing an eventually existing entry.

Parameters:
service - The service to cache
Returns:
Null if no service already existed, or the replaced service.

getSize

public int getSize()

get

public ServiceInfo get(ServiceInfo.Key key)
Returns the service correspondent to the given ServiceInfo.Key.


updateAdd

public ServiceInfo updateAdd(ServiceInfo service)
Updates an existing entry with the given service, adding information contained in the given service; if the entry does not exist, does nothing.

Parameters:
service - The service containing the values that update an eventually existing service
Returns:
Null if no service already existed, or the existing service prior update.

updateRemove

public ServiceInfo updateRemove(ServiceInfo service)
Updates an existing entry with the given service, removing information contained in the given service; if the entry does not exist, does nothing.

Parameters:
service - The service containing the values that update an eventually existing service
Returns:
Null if no service already existed, or the existing service prior update.

remove

public ServiceInfo remove(ServiceInfo.Key key)
Removes an existing entry with the given ServiceInfo.Key; if the entry does not exist, does nothing.

Returns:
Null if no service existed, or the existing service.

match

public List match(ServiceType serviceType,
                  Scopes scopes,
                  Filter filter,
                  String language)

getServiceInfos

public Collection getServiceInfos()

clear

public void clear()

purge

public List purge()
Purges from this cache entries whose registration time plus their lifetime is less than the current time; that is, entries that should have been renewed but for some reason they have not been.

Returns:
The list of purged entries.


Copyright © 2006-2012 LiveTribe. All Rights Reserved.