org.webmacro.resource
Class ReloadDelayDecorator

java.lang.Object
  extended byorg.webmacro.resource.ReloadDelayDecorator

public class ReloadDelayDecorator
extends java.lang.Object

Utility class to handle creation of TimedReloadContext.
TimedReloadContext objects are used to prevent a cached resource of being checked for modification all the time, but only checks for in given intervals.
This class stores a mapping of protocol types to delay values. When a provider requests to decorate a reload context it looks up the delay for this protocol and eventually creates a suitable TimedReloadContext.

Author:
Sebastian Kanthak

Constructor Summary
ReloadDelayDecorator()
           
 
Method Summary
 CacheReloadContext decorate(java.lang.String protocol, CacheReloadContext reloadContext)
          Looks up the "check for reload delay" for protocol and creates a suitable TimedReloadContext or passes back the original reload context if delay <= 0
 void init(Broker b, Settings config)
          Initialize object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReloadDelayDecorator

public ReloadDelayDecorator()
Method Detail

init

public void init(Broker b,
                 Settings config)
          throws InitException
Initialize object. Reads config settings from key "CheckForReloadDelay"

Throws:
InitException

decorate

public CacheReloadContext decorate(java.lang.String protocol,
                                   CacheReloadContext reloadContext)
Looks up the "check for reload delay" for protocol and creates a suitable TimedReloadContext or passes back the original reload context if delay <= 0

Parameters:
protocol - protocl to look up delay for
reloadContext - reloadContext to decorate
Returns:
eventually decorated reload context