org.apache.jcs.auxiliary.remote.http.client
Class RemoteHttpCacheClient

java.lang.Object
  extended by org.apache.jcs.auxiliary.remote.http.client.RemoteHttpCacheClient
All Implemented Interfaces:
Remote, IRemoteCacheService, IRemoteHttpCacheClient, ICacheService, ICacheServiceNonLocal

public class RemoteHttpCacheClient
extends Object
implements IRemoteHttpCacheClient

This is the service used by the remote http auxiliary cache.


Constructor Summary
RemoteHttpCacheClient()
          For factory construction.
RemoteHttpCacheClient(RemoteHttpCacheAttributes attributes)
          Constructs a client.
 
Method Summary
 void dispose(String cacheName)
          Frees the specified cache.
 ICacheElement get(String cacheName, Serializable key)
          Create a request, process, extract the payload.
 ICacheElement get(String cacheName, Serializable key, long requesterId)
          Create a request, process, extract the payload.
 Set getGroupKeys(String cacheName, String groupName)
          Likely not implemented.
 Map getMatching(String cacheName, String pattern)
          Gets multiple items from the cache matching the pattern.
 Map getMatching(String cacheName, String pattern, long requesterId)
          Gets multiple items from the cache matching the pattern.
 Map getMultiple(String cacheName, Set keys)
          Gets multiple items from the cache based on the given set of keys.
 Map getMultiple(String cacheName, Set keys, long requesterId)
          Gets multiple items from the cache based on the given set of keys.
 IRemoteCacheDispatcher getRemoteDispatcher()
           
 RemoteHttpCacheAttributes getRemoteHttpCacheAttributes()
           
 void initialize(RemoteHttpCacheAttributes attributes)
          The provides an extension point.
 boolean isAlive()
          Make and alive request.
protected  boolean isInitialized()
           
 void release()
          Frees the specified cache.
 void remove(String cacheName, Serializable key)
          Removes the given key from the specified cache.
 void remove(String cacheName, Serializable key, long requesterId)
          Removes the given key from the specified cache.
 void removeAll(String cacheName)
          Remove all keys from the sepcified cache.
 void removeAll(String cacheName, long requesterId)
          Remove all keys from the sepcified cache.
protected  void setInitialized(boolean initialized)
           
 void setRemoteDispatcher(IRemoteCacheDispatcher remoteDispatcher)
           
 void setRemoteHttpCacheAttributes(RemoteHttpCacheAttributes remoteHttpCacheAttributes)
           
 void update(ICacheElement item)
          Puts a cache item to the cache.
 void update(ICacheElement cacheElement, long requesterId)
          Puts a cache item to the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteHttpCacheClient

public RemoteHttpCacheClient()
For factory construction.


RemoteHttpCacheClient

public RemoteHttpCacheClient(RemoteHttpCacheAttributes attributes)
Constructs a client.

Parameters:
attributes -
Method Detail

initialize

public void initialize(RemoteHttpCacheAttributes attributes)
The provides an extension point. If you want to extend this and use a special dispatcher, here is the place to do it.

Specified by:
initialize in interface IRemoteHttpCacheClient
Parameters:
attributes -

get

public ICacheElement get(String cacheName,
                         Serializable key)
                  throws IOException
Create a request, process, extract the payload.

Specified by:
get in interface ICacheService
Parameters:
cacheName -
key -
Returns:
ICacheElement
Throws:
IOException

get

public ICacheElement get(String cacheName,
                         Serializable key,
                         long requesterId)
                  throws IOException
Create a request, process, extract the payload.

Specified by:
get in interface ICacheServiceNonLocal
Parameters:
cacheName -
key -
requesterId -
Returns:
ICacheElement
Throws:
IOException

getMatching

public Map getMatching(String cacheName,
                       String pattern)
                throws IOException
Gets multiple items from the cache matching the pattern.

Specified by:
getMatching in interface ICacheService
Parameters:
cacheName -
pattern -
Returns:
a map of Serializable key to ICacheElement element, or an empty map if there is no data in cache matching the pattern.
Throws:
IOException

getMatching

public Map getMatching(String cacheName,
                       String pattern,
                       long requesterId)
                throws IOException
Gets multiple items from the cache matching the pattern.

Specified by:
getMatching in interface ICacheServiceNonLocal
Parameters:
cacheName -
pattern -
requesterId -
Returns:
a map of Serializable key to ICacheElement element, or an empty map if there is no data in cache matching the pattern.
Throws:
IOException

getMultiple

public Map getMultiple(String cacheName,
                       Set keys)
                throws IOException
Gets multiple items from the cache based on the given set of keys.

Specified by:
getMultiple in interface ICacheService
Parameters:
cacheName -
keys -
Returns:
a map of Serializable key to ICacheElement element, or an empty map if there is no data in cache for any of these keys
Throws:
IOException

getMultiple

public Map getMultiple(String cacheName,
                       Set keys,
                       long requesterId)
                throws IOException
Gets multiple items from the cache based on the given set of keys.

Specified by:
getMultiple in interface ICacheServiceNonLocal
Parameters:
cacheName -
keys -
requesterId -
Returns:
a map of Serializable key to ICacheElement element, or an empty map if there is no data in cache for any of these keys
Throws:
IOException

remove

public void remove(String cacheName,
                   Serializable key)
            throws IOException
Removes the given key from the specified cache.

Specified by:
remove in interface ICacheService
Parameters:
cacheName -
key -
Throws:
IOException

remove

public void remove(String cacheName,
                   Serializable key,
                   long requesterId)
            throws IOException
Removes the given key from the specified cache.

Specified by:
remove in interface ICacheServiceNonLocal
Parameters:
cacheName -
key -
requesterId -
Throws:
IOException

removeAll

public void removeAll(String cacheName)
               throws IOException
Remove all keys from the sepcified cache.

Specified by:
removeAll in interface ICacheService
Parameters:
cacheName -
Throws:
IOException

removeAll

public void removeAll(String cacheName,
                      long requesterId)
               throws IOException
Remove all keys from the sepcified cache.

Specified by:
removeAll in interface ICacheServiceNonLocal
Parameters:
cacheName -
requesterId -
Throws:
IOException

update

public void update(ICacheElement item)
            throws IOException
Puts a cache item to the cache.

Specified by:
update in interface ICacheService
Parameters:
item -
Throws:
IOException

update

public void update(ICacheElement cacheElement,
                   long requesterId)
            throws IOException
Puts a cache item to the cache.

Specified by:
update in interface ICacheServiceNonLocal
Parameters:
cacheElement -
requesterId -
Throws:
IOException

dispose

public void dispose(String cacheName)
             throws IOException
Frees the specified cache.

Specified by:
dispose in interface ICacheService
Parameters:
cacheName -
Throws:
IOException

release

public void release()
             throws IOException
Frees the specified cache.

Specified by:
release in interface ICacheService
Throws:
IOException

getGroupKeys

public Set getGroupKeys(String cacheName,
                        String groupName)
                 throws IOException
Description copied from interface: ICacheServiceNonLocal
Likely not implemented. This probably should be deprecated.

Specified by:
getGroupKeys in interface ICacheServiceNonLocal
Parameters:
cacheName -
groupName -
Returns:
A Set of keys
Throws:
IOException

isAlive

public boolean isAlive()
                throws IOException
Make and alive request.

Specified by:
isAlive in interface IRemoteHttpCacheClient
Returns:
true if we make a successful alive request.
Throws:
IOException

setRemoteDispatcher

public void setRemoteDispatcher(IRemoteCacheDispatcher remoteDispatcher)
Parameters:
remoteDispatcher - the remoteDispatcher to set

getRemoteDispatcher

public IRemoteCacheDispatcher getRemoteDispatcher()
Returns:
the remoteDispatcher

setRemoteHttpCacheAttributes

public void setRemoteHttpCacheAttributes(RemoteHttpCacheAttributes remoteHttpCacheAttributes)
Parameters:
remoteHttpCacheAttributes - the remoteHttpCacheAttributes to set

getRemoteHttpCacheAttributes

public RemoteHttpCacheAttributes getRemoteHttpCacheAttributes()
Returns:
the remoteHttpCacheAttributes

setInitialized

protected void setInitialized(boolean initialized)
Parameters:
initialized - the initialized to set

isInitialized

protected boolean isInitialized()
Returns:
the initialized


Copyright © 2002-2012 Apache Software Foundation. All Rights Reserved.