org.hd.d.pg2k.test.dev
Class SystemVariablesTest.EventValueRequestMonitor

java.lang.Object
  extended by org.hd.d.pg2k.svrCore.datasource.SimpleExhibitPipelineFilter
      extended by org.hd.d.pg2k.test.dev.SystemVariablesTest.EventValueRequestMonitor
All Implemented Interfaces:
SimpleExhibitPipelineIF, BasicVarMgrInterface, SimpleVariablePipelineIF
Enclosing class:
SystemVariablesTest

static final class SystemVariablesTest.EventValueRequestMonitor
extends SimpleExhibitPipelineFilter

Observe upstream accesses to event values. This can optionally veto redundant reads that indicate that a cacheing stage is not working properly.

The EventVariableValue.equals() and hashCode() methods allow us to simply keep a Set of authorised values returned; any duplicate is an error.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.hd.d.pg2k.svrCore.datasource.SimpleExhibitPipelineIF
SimpleExhibitPipelineIF.PropsKey
 
Field Summary
private  java.util.Set<EventVariableValue> authValueSeen
          Set of authoritative responses so far passed downstream; never null.
private  boolean vetoRedundantReads
          If true, veto attempts to read authoritative values more than once, ie redunantly.
 
Fields inherited from class org.hd.d.pg2k.svrCore.datasource.SimpleExhibitPipelineFilter
source
 
Fields inherited from interface org.hd.d.pg2k.svrCore.datasource.SimpleExhibitPipelineIF
MAX_USER_READ_SIZE
 
Constructor Summary
SystemVariablesTest.EventValueRequestMonitor(SimpleExhibitPipelineIF upstream, boolean vetoRedundantReads)
          Construct instance wrapped round upstream source.
 
Method Summary
 EventVariableValue getEventValue(SimpleVariableDefinition def, EventPeriod intervalSelector, boolean current)
          Intercept event requests and look for incorrect redundancy.
 EventVariableValue[] getEventValues(SimpleVariableDefinition def, EventPeriod intervalSelector, long intervalNumber, java.util.BitSet whichValues)
          Intercept event requests and look for incorrect redundancy.
 
Methods inherited from class org.hd.d.pg2k.svrCore.datasource.SimpleExhibitPipelineFilter
destroy, getAllExhibitImmutableData, getAllExhibitProperties, getGenProps, getGenSecProps, getProperties, getRawFile, getStaticAttr, getThumbnails, getVariable, getVariables, poll, setVariable, setVariables, syncVariables
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vetoRedundantReads

private final boolean vetoRedundantReads
If true, veto attempts to read authoritative values more than once, ie redunantly.


authValueSeen

private final java.util.Set<EventVariableValue> authValueSeen
Set of authoritative responses so far passed downstream; never null.

Constructor Detail

SystemVariablesTest.EventValueRequestMonitor

SystemVariablesTest.EventValueRequestMonitor(SimpleExhibitPipelineIF upstream,
                                             boolean vetoRedundantReads)
Construct instance wrapped round upstream source.

Parameters:
upstream - datasource; never null
vetoRedundantReads - if true, veto attempts to read authoritative values more than once, ie redunantly; should be safe to use only behind a cache stage
Method Detail

getEventValue

public EventVariableValue getEventValue(SimpleVariableDefinition def,
                                        EventPeriod intervalSelector,
                                        boolean current)
Intercept event requests and look for incorrect redundancy.

Specified by:
getEventValue in interface BasicVarMgrInterface
Overrides:
getEventValue in class SimpleExhibitPipelineFilter
Parameters:
def - event definition (must be for an event); never null
intervalSelector - one of EVENT_INTERVAL_SELECTOR_xxx values
current - if true the current event set is returned, else the previous complete set is returned
Returns:
requested event set; may be null if requested set not available

getEventValues

public EventVariableValue[] getEventValues(SimpleVariableDefinition def,
                                           EventPeriod intervalSelector,
                                           long intervalNumber,
                                           java.util.BitSet whichValues)
Intercept event requests and look for incorrect redundancy.

Specified by:
getEventValues in interface BasicVarMgrInterface
Overrides:
getEventValues in class SimpleExhibitPipelineFilter
Parameters:
def - event definition (must be for an event); never null
intervalSelector - one of EVENT_INTERVAL_SELECTOR_xxx values
intervalNumber - a time (as from System.currentTimeMillis()) which identifies the first interval for which data is potentially required; if too far in the past or future then possibly no data will be available, zero is used to access the "all" bucket
whichValues - each true bit represents a slot for which data is required, bit 0 indicating data from the slot within which firstIntervalTime is located, bit 1 the previous slot, etc; null is treated as the common case equivalent to just bit 0 set
Returns:
as many of the requested values as available, at least long enough to return all the available values, with [0] corresponding to bit 0 in the BitSet; may contain nulls or be zero-length but is never null

DHD Multimedia Gallery V1.53.0

Copyright (c) 1996-2009, Damon Hart-Davis. All rights reserved.