|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.voidsearch.voidbase.apps.cache.CacheModule
public class CacheModule
CacheModule is a generic cache module which implements strategies for containing and routing to cache handlers and handling a high-level atomicity of operations on cache implementations based on individual cache handler configurations.
| Field Summary | |
|---|---|
protected VoidBaseConfig |
config
|
protected static java.lang.String |
CONFIG_PATH
|
protected static VoidBaseResponseType |
DEFAULT_TYPE
|
protected java.lang.String |
defaultHandler
|
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,VoidBaseCache> |
handlers
|
protected static org.slf4j.Logger |
logger
|
protected java.lang.String |
name
|
| Constructor Summary | |
|---|---|
CacheModule()
Creates a new instance of CacheModule |
|
| Method Summary | |
|---|---|
protected java.lang.String |
getContent(java.lang.String content,
java.util.Map<java.lang.String,java.lang.String> params)
Returns a content from request params |
protected java.lang.String |
getJSON(java.lang.String message,
CacheResponseStatus status)
Builds JSON from a cache result response |
protected java.lang.String |
getKey(java.util.List<java.lang.String> route,
java.util.Map<java.lang.String,java.lang.String> params)
Returns a key from request params |
protected java.lang.String |
getResource()
Returns a CacheModule's resource |
protected java.util.List<java.lang.String> |
getRoute(java.util.List<java.lang.String> route)
Returns a Cache specific route from original request route |
CacheResponse |
handle(java.lang.String method,
java.lang.String key,
java.lang.String content)
Handler for all cache requests which are further proxied down to specific cache handler |
CacheResponse |
handle(java.lang.String handler,
java.lang.String method,
java.lang.String key,
java.lang.String content)
Handler for all cache requests which are further proxied down to specific cache handler |
CacheResponse |
handle(java.lang.String handler,
java.lang.String method,
java.lang.String name,
java.lang.String key,
java.lang.String content)
Handler for all cache requests which are further proxied down to specific cache handler |
VoidBaseModuleResponse |
handle(VoidBaseModuleRequest request)
Handler for all cache requests which are further proxied down to specific cache handler |
void |
initialize(java.lang.String name)
Initializes CacheModule and all configured cache handlers |
protected void |
initializeCacheModules(java.util.Map<java.lang.String,java.lang.String> modules)
Initializes specific cache modules/handlers |
protected VoidBaseModuleResponse |
renderResponse(CacheValue value,
java.lang.String format,
CacheResponseStatus status)
Returns rendered Cache response from CacheValue object |
protected VoidBaseModuleResponse |
renderResponse(java.lang.String message,
java.lang.String format,
CacheResponseStatus status)
Returns rendered Cache response |
protected VoidBaseResponseStatus |
renderStatus(CacheResponseStatus status)
Returnds response status from a cache response |
void |
run()
Currently just logs when CacheModule starts |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String name
protected java.lang.String defaultHandler
protected VoidBaseConfig config
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,VoidBaseCache> handlers
protected static final java.lang.String CONFIG_PATH
protected static final VoidBaseResponseType DEFAULT_TYPE
protected static final org.slf4j.Logger logger
| Constructor Detail |
|---|
public CacheModule()
| Method Detail |
|---|
public void initialize(java.lang.String name)
throws VoidBaseModuleException
initialize in interface VoidBaseModulename -
VoidBaseModuleException
public VoidBaseModuleResponse handle(VoidBaseModuleRequest request)
throws VoidBaseModuleException
handle in interface VoidBaseModulerequest -
VoidBaseModuleException
public CacheResponse handle(java.lang.String method,
java.lang.String key,
java.lang.String content)
throws VoidBaseModuleException
method - key - content -
VoidBaseModuleException
public CacheResponse handle(java.lang.String handler,
java.lang.String method,
java.lang.String key,
java.lang.String content)
throws VoidBaseModuleException
handler - method - key - content -
VoidBaseModuleException
public CacheResponse handle(java.lang.String handler,
java.lang.String method,
java.lang.String name,
java.lang.String key,
java.lang.String content)
throws VoidBaseModuleException
handler - method - name - key - content -
VoidBaseModuleExceptionpublic void run()
run in interface java.lang.Runnable
protected void initializeCacheModules(java.util.Map<java.lang.String,java.lang.String> modules)
throws VoidBaseModuleException
modules -
VoidBaseModuleExceptionprotected java.util.List<java.lang.String> getRoute(java.util.List<java.lang.String> route)
route -
protected java.lang.String getResource()
protected VoidBaseModuleResponse renderResponse(CacheValue value,
java.lang.String format,
CacheResponseStatus status)
value - format - status -
protected VoidBaseModuleResponse renderResponse(java.lang.String message,
java.lang.String format,
CacheResponseStatus status)
message - format - status -
protected java.lang.String getKey(java.util.List<java.lang.String> route,
java.util.Map<java.lang.String,java.lang.String> params)
route - params -
protected java.lang.String getContent(java.lang.String content,
java.util.Map<java.lang.String,java.lang.String> params)
content - params -
protected java.lang.String getJSON(java.lang.String message,
CacheResponseStatus status)
message - status -
protected VoidBaseResponseStatus renderStatus(CacheResponseStatus status)
status -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||