Class HashMapEvent
- java.lang.Object
-
- org.epics.archiverappliance.retrieval.channelarchiver.HashMapEvent
-
- All Implemented Interfaces:
AlarmInfo
,DBRTimeEvent
,FieldValues
,SamplingInfo
,Event
public class HashMapEvent extends Object implements DBRTimeEvent
We get a HashMap of NVPairs from the Channel Archiver - this class exposes these as an archiver Event We typically get secs=1250696265, value=70.9337, sevr=0, nano=267115322, stat=0- Author:
- mshankar
-
-
Field Summary
Fields Modifier and Type Field Description static String
FIELD_VALUES_ACTUAL_CHANGE
static String
FIELD_VALUES_FIELD_NAME
static String
NANO_FIELD_NAME
static String
SECS_FIELD_NAME
static String
SEVR_FIELD_NAME
static String
STAT_FIELD_NAME
static String
VALUE_FIELD_NAME
-
Constructor Summary
Constructors Constructor Description HashMapEvent(ArchDBRTypes type, HashMap<String,Object> values)
HashMapEvent(ArchDBRTypes type, DBRTimeEvent event)
-
Method Summary
Modifier and Type Method Description void
addFieldValue(String fieldName, String fieldValue)
ArchDBRTypes
getDBRType()
long
getEpochSeconds()
Get java epoch seconds of the timestamp of this event.Timestamp
getEventTimeStamp()
Get the epoch seconds and the nanos..HashMap<String,String>
getFields()
Get the fields as a HashMap.String
getFieldValue(String fieldName)
ByteArray
getRawForm()
Return a serialized form of this event in the internal currency of the archiver appliance.int
getRepeatCount()
SampleValue
getSampleValue()
Get this event's value.int
getSeverity()
int
getStatus()
boolean
hasFieldValues()
Not all events have field values.boolean
isActualChange()
Do the field values in this event represent an actual change?Event
makeClone()
Make a clone of this event free from the confines of its containing stream.void
markAsActualChange()
Mark this event as containing actual changes to field values.void
setFieldValues(HashMap<String,String> fieldValues, boolean markAsActualChange)
void
setRepeatCount(int repeatCount)
void
setSeverity(int severity)
void
setStatus(int status)
void
setValue(String name, String newValue)
-
-
-
Field Detail
-
SECS_FIELD_NAME
public static final String SECS_FIELD_NAME
- See Also:
- Constant Field Values
-
NANO_FIELD_NAME
public static final String NANO_FIELD_NAME
- See Also:
- Constant Field Values
-
VALUE_FIELD_NAME
public static final String VALUE_FIELD_NAME
- See Also:
- Constant Field Values
-
STAT_FIELD_NAME
public static final String STAT_FIELD_NAME
- See Also:
- Constant Field Values
-
SEVR_FIELD_NAME
public static final String SEVR_FIELD_NAME
- See Also:
- Constant Field Values
-
FIELD_VALUES_FIELD_NAME
public static final String FIELD_VALUES_FIELD_NAME
- See Also:
- Constant Field Values
-
FIELD_VALUES_ACTUAL_CHANGE
public static final String FIELD_VALUES_ACTUAL_CHANGE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
HashMapEvent
public HashMapEvent(ArchDBRTypes type, HashMap<String,Object> values)
-
HashMapEvent
public HashMapEvent(ArchDBRTypes type, DBRTimeEvent event)
-
-
Method Detail
-
makeClone
public Event makeClone()
Description copied from interface:Event
Make a clone of this event free from the confines of its containing stream.
-
getRepeatCount
public int getRepeatCount()
- Specified by:
getRepeatCount
in interfaceSamplingInfo
-
setRepeatCount
public void setRepeatCount(int repeatCount)
- Specified by:
setRepeatCount
in interfaceSamplingInfo
-
getSeverity
public int getSeverity()
- Specified by:
getSeverity
in interfaceAlarmInfo
-
getEpochSeconds
public long getEpochSeconds()
Description copied from interface:Event
Get java epoch seconds of the timestamp of this event. Note that we are skipping nanos. To get to the nanos use the getEventTimeStamp method.- Specified by:
getEpochSeconds
in interfaceEvent
- Returns:
- The java epoch seconds of this event.
-
getEventTimeStamp
public Timestamp getEventTimeStamp()
Description copied from interface:Event
Get the epoch seconds and the nanos.. We use java.sql.Timestamp as the main timestamp class. See TimeUtils for more time related utilities.- Specified by:
getEventTimeStamp
in interfaceEvent
- Returns:
- The java epoch seconds and the nanos of this event
-
getRawForm
public ByteArray getRawForm()
Description copied from interface:Event
Return a serialized form of this event in the internal currency of the archiver appliance. For now, this is Google's Protocol Buffers Note that the raw form is always escaped according to the archiver specification. This is to have a minimum of conversion overhead when streaming data out to servers.- Specified by:
getRawForm
in interfaceEvent
- Returns:
- A serialization of this event in the internal currency of the archiver appliance.
-
getSampleValue
public SampleValue getSampleValue()
Description copied from interface:Event
Get this event's value. The value for an EPICS sample is a complex thing and can be scalars and vectors of numbers and strings. With EPICS v4, this can get even more complicated.- Specified by:
getSampleValue
in interfaceEvent
- Returns:
- The valus of this event
-
hasFieldValues
public boolean hasFieldValues()
Description copied from interface:FieldValues
Not all events have field values. Does this event have any field values?- Specified by:
hasFieldValues
in interfaceFieldValues
- Returns:
- true or false
-
isActualChange
public boolean isActualChange()
Description copied from interface:FieldValues
Do the field values in this event represent an actual change?- Specified by:
isActualChange
in interfaceFieldValues
- Returns:
- true or false
-
getFields
public HashMap<String,String> getFields()
Description copied from interface:FieldValues
Get the fields as a HashMap. If we have more than one entry with the same key, one of the entries is returned.- Specified by:
getFields
in interfaceFieldValues
- Returns:
- The fields as a HashMap
-
getFieldValue
public String getFieldValue(String fieldName)
- Specified by:
getFieldValue
in interfaceFieldValues
- Parameters:
fieldName
- the field name- Returns:
- The field value as a string
-
addFieldValue
public void addFieldValue(String fieldName, String fieldValue)
- Specified by:
addFieldValue
in interfaceFieldValues
- Parameters:
fieldName
- the field namefieldValue
- the field value
-
markAsActualChange
public void markAsActualChange()
Description copied from interface:FieldValues
Mark this event as containing actual changes to field values.- Specified by:
markAsActualChange
in interfaceFieldValues
-
setFieldValues
public void setFieldValues(HashMap<String,String> fieldValues, boolean markAsActualChange)
- Specified by:
setFieldValues
in interfaceFieldValues
- Parameters:
fieldValues
- the field values as HashMapmarkAsActualChange
- true or false
-
getDBRType
public ArchDBRTypes getDBRType()
- Specified by:
getDBRType
in interfaceEvent
-
setSeverity
public void setSeverity(int severity)
- Specified by:
setSeverity
in interfaceAlarmInfo
-
-