org.gcube.common.clients
Class BaseEndpointCache<E>

java.lang.Object
  extended by org.gcube.common.clients.BaseEndpointCache<E>
Type Parameters:
E - the type of the cached endpoints
All Implemented Interfaces:
EndpointCache<E>

public class BaseEndpointCache<E>
extends Object
implements EndpointCache<E>

Implements EndpointCache.

Author:
Fabio Simeoni

Constructor Summary
BaseEndpointCache()
           
 
Method Summary
 void clear()
          Reset the cache.
 void clear(String name)
          Reset the cache for a given service.
 E get(String name)
          Returns the endpoint cached for a given service
 void put(String name, E endpoint)
          Caches the endpoint of a given service
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseEndpointCache

public BaseEndpointCache()
Method Detail

clear

public void clear()
Reset the cache.

Specified by:
clear in interface EndpointCache<E>

clear

public void clear(String name)
Reset the cache for a given service.

Specified by:
clear in interface EndpointCache<E>
Parameters:
name - the service name

get

public E get(String name)
      throws IllegalArgumentException
Returns the endpoint cached for a given service

Specified by:
get in interface EndpointCache<E>
Parameters:
name - the name of the service
Returns:
the endpoint, or null if there is no endpoint cached for the service
Throws:
IllegalArgumentException - if the name is null

put

public void put(String name,
                E endpoint)
         throws IllegalArgumentException
Caches the endpoint of a given service

Specified by:
put in interface EndpointCache<E>
Parameters:
name - the service name
endpoint - the endpoint
Throws:
IllegalArgumentException - if the name or the endpoint are null


Copyright © 2012. All Rights Reserved.