org.cruxframework.crux.core.server.rest.state
Class NoClusteredResourceStateHandler

java.lang.Object
  extended by org.cruxframework.crux.core.server.rest.state.NoClusteredResourceStateHandler
All Implemented Interfaces:
ResourceStateHandler

public class NoClusteredResourceStateHandler
extends Object
implements ResourceStateHandler

It is a very basic implementation for ResourceStateHandler interface that is designed to run only on NO CUSTERED environment. It uses a simple LRUMap to keep the resource state into local machine's memory. To configure the cache, you can create a file named NoClusteredCacheConfig.properties and configure the property maxNumberOfEntries to set the max number of entries into the map.

Author:
Thiago da Rosa de Bustamante

Nested Class Summary
static class NoClusteredResourceStateHandler.CacheEntry
           
static class NoClusteredResourceStateHandler.LRUMap<K,V>
           
 
Nested classes/interfaces inherited from interface org.cruxframework.crux.core.server.rest.state.ResourceStateHandler
ResourceStateHandler.ResourceState
 
Constructor Summary
NoClusteredResourceStateHandler()
           
 
Method Summary
 ResourceStateHandler.ResourceState add(String uri, long dateModified, long expires, String etag)
          Add state information about one rest URI
 void clear()
          Clear all state information from rest URIs
 ResourceStateHandler.ResourceState get(String uri)
          Retrieve state information about one rest URI
 void remove(String uri)
          Clear the state information about one rest URI
 void removeSegments(String... baseURIs)
          Clear the state information about any rest URI that starts with one of the baseURIs provided
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NoClusteredResourceStateHandler

public NoClusteredResourceStateHandler()
Method Detail

add

public ResourceStateHandler.ResourceState add(String uri,
                                              long dateModified,
                                              long expires,
                                              String etag)
Description copied from interface: ResourceStateHandler
Add state information about one rest URI

Specified by:
add in interface ResourceStateHandler
Returns:

get

public ResourceStateHandler.ResourceState get(String uri)
Description copied from interface: ResourceStateHandler
Retrieve state information about one rest URI

Specified by:
get in interface ResourceStateHandler
Returns:

remove

public void remove(String uri)
Description copied from interface: ResourceStateHandler
Clear the state information about one rest URI

Specified by:
remove in interface ResourceStateHandler

clear

public void clear()
Description copied from interface: ResourceStateHandler
Clear all state information from rest URIs

Specified by:
clear in interface ResourceStateHandler

removeSegments

public void removeSegments(String... baseURIs)
Description copied from interface: ResourceStateHandler
Clear the state information about any rest URI that starts with one of the baseURIs provided

Specified by:
removeSegments in interface ResourceStateHandler


Copyright © 2014. All rights reserved.