|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.hd.d.pg2k.svrCore.datasource.SimpleExhibitPipelineFilter
public class SimpleExhibitPipelineFilter
Simple extendable base class which acts as a pipeline filter. Analogous to a FilterInputStream, a SimpleExhibitPipelineFilter wraps another data source/stage, which it uses as its basic source of data, possibly transforming the data along the way or providing additional functionality.
The class SimpleExhibitPipelineFilter itself simply implements all methods of SimpleExhibitPipelineIF with versions that pass all requests to the wrapped source. Subclasses of SimpleExhibitPipelineFilter may further override some of these methods and may also provide additional methods and fields.
A bare SimpleExhibitPipelineFilter is like a null/identity stage which leaves the semantics of a data pipeline intact.
One possible use of this is to build a "Mock Object" for testing purposes.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.hd.d.pg2k.svrCore.datasource.SimpleExhibitPipelineIF |
|---|
SimpleExhibitPipelineIF.PropsKey |
| Field Summary | |
|---|---|
protected SimpleExhibitPipelineIF |
source
The upstream source; never null. |
| Fields inherited from interface org.hd.d.pg2k.svrCore.datasource.SimpleExhibitPipelineIF |
|---|
MAX_USER_READ_SIZE |
| Constructor Summary | |
|---|---|
SimpleExhibitPipelineFilter(SimpleExhibitPipelineIF source)
Construct a new instance of this filter. |
|
| Method Summary | |
|---|---|
void |
destroy()
Shut down the data pipeline. |
AllExhibitImmutableData |
getAllExhibitImmutableData(long oldStamp)
Gets set of all static exhibit data if its timestamp is not that specified. |
AllExhibitProperties |
getAllExhibitProperties(long oldHash)
Gets set of all exhibit properties if its hash is not that specified. |
EventVariableValue |
getEventValue(SimpleVariableDefinition def,
EventPeriod intervalSelector,
boolean current)
Get the current partial, or previous full, event set at the specified interval. |
EventVariableValue[] |
getEventValues(SimpleVariableDefinition def,
EventPeriod intervalSelector,
long intervalNumber,
java.util.BitSet whichValues)
Get the specified event sets for the specified intervals; never null. |
GenProps |
getGenProps(long oldStamp)
Gets the general properties as a GenProps object if its timestamp is not that specified. |
java.util.Properties |
getGenSecProps(long oldStamp)
Gets the generic security properties as a Properties object if its timestamp is not that specified. |
java.util.Properties |
getProperties(SimpleExhibitPipelineIF.PropsKey key,
long versionID)
Get requested Properties selected by key and versionID. |
void |
getRawFile(java.nio.ByteBuffer buf,
Name.ExhibitFull exhibitName,
int position,
boolean dontCache)
Read a chunk of the raw exhibit binary into the given buffer. |
ExhibitStaticAttr |
getStaticAttr(Name.ExhibitFull name)
Get the static attributes for a given exhibit. |
Stratum |
getStratum()
Gets information about our stratum and upstream server; never null. |
ExhibitThumbnails |
getThumbnails(Name.ExhibitFull name,
boolean create)
Gets the thumbnails for an exhibit. |
SimpleVariableValue |
getVariable(SimpleVariableDefinition var)
Get a single variable value; returns null if no such value or wrong type. |
SimpleVariableValue[] |
getVariables(long changedSince)
Get set of variable values altered on or after specified time, or get all values with -1; never null. |
void |
poll(GenProps gp)
Poll periodically (of the order of seconds) to do bg work. |
void |
setVariable(SimpleVariableValue newValue)
Set variable to the given value (the variable name and definition are implicit). |
int |
setVariables(SimpleVariableValue[] newValues)
Update a number of variables at once for efficiency; returns the number of variables set. |
void |
syncVariables(boolean force)
Synchronise variables with upstream values. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final SimpleExhibitPipelineIF source
| Constructor Detail |
|---|
public SimpleExhibitPipelineFilter(SimpleExhibitPipelineIF source)
source - the upstream data source; never null| Method Detail |
|---|
public ExhibitStaticAttr getStaticAttr(Name.ExhibitFull name)
throws java.io.IOException
getStaticAttr in interface SimpleExhibitPipelineIFjava.io.IOException - if the operation cannot be completed due to I/O
restrictions or failure
public void getRawFile(java.nio.ByteBuffer buf,
Name.ExhibitFull exhibitName,
int position,
boolean dontCache)
throws java.io.IOException
This always reads all the bytes requested or throws an IOException.
getRawFile in interface SimpleExhibitPipelineIFdontCache - if true, this is a hint not to attempt to cache this
or displace anything from extant caches for this data
as it maqy for example be precaching or random activity;
by default callers should leave this false to allow cacheingbuf - the buffer into which to read the data;
must be non-null, in put()able state,
and with remaining capacity of at least the requested number of bytesexhibitName - the full name of the exhibit to read from;
never null and must be syntactically validposition - position/index of first byte in exhibitFile to read;
non-negative
java.lang.IllegalArgumentException - for invalid arguments such as
a null or invalid name,
a negative offset or start,
a negative (or in some cases, non-positive) len
java.io.IOException - for requests that cannot be fulfilled because of
I/O restrictions or problems, such as link failure or
an upper bound on the length of a request
public AllExhibitImmutableData getAllExhibitImmutableData(long oldStamp)
throws java.io.IOException
If no exhibits are currently installed a default set with a zero timestamp is returned.
If the caller's copy appears to be up-to-date (eg the oldStamp matches that that would have been returned) null is returned.
getAllExhibitImmutableData in interface SimpleExhibitPipelineIFjava.io.IOException - if the operation cannot be completed due to I/O
restrictions or failure
public AllExhibitProperties getAllExhibitProperties(long oldHash)
throws java.io.IOException
If no exhibits are currently installed a default set with a zero timestamp is returned.
If the caller's copy appears to be up-to-date (eg the oldHash matches that that would have been returned) null is returned.
getAllExhibitProperties in interface SimpleExhibitPipelineIFjava.io.IOException - if the operation cannot be completed due to I/O
restrictions or failure
public GenProps getGenProps(long oldStamp)
throws java.io.IOException
If no props are currently installed/available a default set with a zero timestamp is returned.
If the caller's copy appears to be up-to-date (eg the oldStamp matches that that would have been returned) null is returned.
getGenProps in interface SimpleExhibitPipelineIFjava.io.IOException - if the operation cannot be completed due to I/O
restrictions or failure
public java.util.Properties getGenSecProps(long oldStamp)
throws java.io.IOException
If no props are currently installed/available a default set with a zero timestamp is returned.
If the caller's copy appears to be up-to-date (eg the oldStamp matches that that would have been returned) null is returned.
getGenSecProps in interface SimpleExhibitPipelineIFjava.io.IOException - if the operation cannot be completed due to I/O
restrictions or failure
public ExhibitThumbnails getThumbnails(Name.ExhibitFull name,
boolean create)
throws java.io.IOException
getThumbnails in interface SimpleExhibitPipelineIFcreate - if true, and no thumbnail yet exists, try to
create one if possible, else if create is false
only return an existing one and return null if none is to hand
java.io.IOException - if the operation cannot be completed due to I/O
restrictions or failure
public void poll(GenProps gp)
throws java.io.IOException
poll in interface SimpleExhibitPipelineIFjava.io.IOException - in case of difficulty, but even if a sub-ordinate
call throws IOException the poll() call should make some effort
to do as much of its work as reasonably possible
public void syncVariables(boolean force)
throws java.io.IOException
When called with force==true, this acts like a full "memory barrier", flushing all write-cached items downstream immediately and afterwards getting the value of all upstream values with getVariables(-1), but may be expensive in terms of CPU or bandwidth, so use sparingly.
When called with force=false, this incrementally flushes outstanding writes and will then fetch all, or only new, values from upstream, so is potentally much less resource-intensive. In particular, this does not propagate the sync() upstream.
In any case, it is rarely the right thing for a casual user to vall this as it may be very expensive.
syncVariables in interface SimpleVariablePipelineIFforce - if true, this will force a full write flush,
a full sync upstream,
then full read with getVariables(-1),
to get the effect of a full "barrier";
otherwise, in general, a more incremental and non-propagating
mode is used which still does a write flush but may chose
to do a partial read of "new" upstream values
java.io.IOException - if one is received from upstream
public SimpleVariableValue[] getVariables(long changedSince)
throws java.io.IOException
getVariables in interface BasicVarMgrInterfacejava.io.IOException - in case of I/O difficulty
public SimpleVariableValue getVariable(SimpleVariableDefinition var)
throws java.io.IOException,
java.lang.UnsupportedOperationException
getVariable in interface BasicVarMgrInterfacevar - definition of variable to fetch; never null
java.io.IOException - in case of I/O difficulty
java.lang.UnsupportedOperationException - if a variable is requested that
we could never supply, eg a non-System-ID local variable at
the client end of a tunnel
public int setVariables(SimpleVariableValue[] newValues)
throws java.io.IOException
An implementation may "fail fast" on the first error/exception, or may attempt to continue and do as much as possible.
An implementation may throw an IllegalArgumentException on attempt to: set a variable with value of wrong type or incompatible definition, set a non-existent or read-only variable (or these may be ignored)
setVariables in interface BasicVarMgrInterfacejava.io.IOException
public void setVariable(SimpleVariableValue newValue)
throws java.io.IOException,
java.lang.UnsupportedOperationException
setVariable in interface BasicVarMgrInterfacejava.io.IOException - in case of I/O difficulty
java.lang.UnsupportedOperationException - if a variable is set that
we could never handle, eg a non-System-ID local variable at
the client end of a tunnel
public EventVariableValue getEventValue(SimpleVariableDefinition def,
EventPeriod intervalSelector,
boolean current)
The current set is the most timely, but may not contain enough data to be meaningful if the new interval has just started.
The previous set is complete and thus most likely to have enough samples to be useful, but is not completely current.
getEventValue in interface BasicVarMgrInterfacedef - event definition (must be for an event); never nullintervalSelector - one of EVENT_INTERVAL_SELECTOR_xxx valuescurrent - if true the current event set is returned,
else the previous complete set is returned
public EventVariableValue[] getEventValues(SimpleVariableDefinition def,
EventPeriod intervalSelector,
long intervalNumber,
java.util.BitSet whichValues)
Requests for more than SystemVariables.EVENT_SAMPLES_RETAINED in the past (or for the future!) cannot be satisfied and data will not be returned for them.
Usually not more than SystemVariables.EVENT_SAMPLES_RETAINED samples will be returned in response to any one request as a safety measure.
(An implementation that is not an end-point may go upstream to fetch missing values and cache them to satisfy future requests.)
getEventValues in interface BasicVarMgrInterfacedef - event definition (must be for an event); never nullintervalSelector - one of EVENT_INTERVAL_SELECTOR_xxx valuesintervalNumber - 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" bucketwhichValues - 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
public java.util.Properties getProperties(SimpleExhibitPipelineIF.PropsKey key,
long versionID)
throws java.io.IOException
getProperties in interface SimpleExhibitPipelineIFkey - selector (with possible embedded sub-key)
for desired properties set; never nullversionID - if -1 then map is always returned if available,
else must be non-negative and null is returned if the versionID
presented matches that of the current version
(ie if the caller has presumably got the up-to-date version);
may be a timestamp or a hash or other value,
and by convention is zero only for an empty properties set
java.io.IOException
public Stratum getStratum()
throws java.io.IOException
SimpleExhibitPipelineIF
getStratum in interface SimpleExhibitPipelineIFjava.io.IOExceptionpublic void destroy()
destroy in interface SimpleExhibitPipelineIF
|
DHD Multimedia Gallery V1.60.69 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||