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:
java.rmi.Remote, IRemoteCacheService, IRemoteHttpCacheClient, ICacheService

public class RemoteHttpCacheClient
extends java.lang.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(java.lang.String cacheName)
          Frees the specified cache.
 ICacheElement get(java.lang.String cacheName, java.io.Serializable key)
          Create a request, process, extract the payload.
 ICacheElement get(java.lang.String cacheName, java.io.Serializable key, long requesterId)
          Create a request, process, extract the payload.
 java.util.Set getGroupKeys(java.lang.String cacheName, java.lang.String groupName)
           
 java.util.Map getMatching(java.lang.String cacheName, java.lang.String pattern)
          Gets multiple items from the cache matching the pattern.
 java.util.Map getMatching(java.lang.String cacheName, java.lang.String pattern, long requesterId)
          Gets multiple items from the cache matching the pattern.
 java.util.Map getMultiple(java.lang.String cacheName, java.util.Set keys)
          Gets multiple items from the cache based on the given set of keys.
 java.util.Map getMultiple(java.lang.String cacheName, java.util.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(java.lang.String cacheName, java.io.Serializable key)
          Removes the given key from the specified cache.
 void remove(java.lang.String cacheName, java.io.Serializable key, long requesterId)
          Removes the given key from the specified cache.
 void removeAll(java.lang.String cacheName)
          Remove all keys from the sepcified cache.
 void removeAll(java.lang.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(java.lang.String cacheName,
                         java.io.Serializable key)
                  throws java.io.IOException
Create a request, process, extract the payload.

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

get

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

Specified by:
get in interface IRemoteCacheService
Parameters:
cacheName -
key -
requesterId -
Returns:
ICacheElement
Throws:
java.io.IOException

getMatching

public java.util.Map getMatching(java.lang.String cacheName,
                                 java.lang.String pattern)
                          throws java.io.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:
java.io.IOException

getMatching

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

Specified by:
getMatching in interface IRemoteCacheService
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:
java.io.IOException

getMultiple

public java.util.Map getMultiple(java.lang.String cacheName,
                                 java.util.Set keys)
                          throws java.io.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:
java.io.IOException

getMultiple

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

Specified by:
getMultiple in interface IRemoteCacheService
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:
java.io.IOException

remove

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

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

remove

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

Specified by:
remove in interface IRemoteCacheService
Parameters:
cacheName -
key -
requesterId -
Throws:
java.io.IOException

removeAll

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

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

removeAll

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

Specified by:
removeAll in interface IRemoteCacheService
Parameters:
cacheName -
requesterId -
Throws:
java.io.IOException

update

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

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

update

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

Specified by:
update in interface IRemoteCacheService
Parameters:
cacheElement -
requesterId -
Throws:
java.io.IOException

dispose

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

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

release

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

Specified by:
release in interface ICacheService
Throws:
java.io.IOException

getGroupKeys

public java.util.Set getGroupKeys(java.lang.String cacheName,
                                  java.lang.String groupName)
                           throws java.io.IOException
Specified by:
getGroupKeys in interface IRemoteCacheService
Parameters:
cacheName -
groupName -
Returns:
A Set of keys
Throws:
java.io.IOException
java.rmi.RemoteException

isAlive

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

Specified by:
isAlive in interface IRemoteHttpCacheClient
Returns:
true if we make a successful alive request.
Throws:
java.io.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-2010 Apache Software Foundation. All Rights Reserved.