public class SimpleExecutableScanClass extends BasicScanClassInstance implements java.lang.Runnable, ExecutableScanClass
Modifier and Type | Class and Description |
---|---|
protected class |
SimpleExecutableScanClass.DrivenTagListener |
protected class |
SimpleExecutableScanClass.ScanClassTagEvaluationContext
The scan class eval context processes most things immediately (inheriting from
DirectTagEvaluationContext
), except history. |
Modifier and Type | Field and Description |
---|---|
protected static int |
FLAG_IS_TRANSFER |
protected static int |
FLAG_PREVENT_INIT |
protected static int |
FLAG_RELEASE_ALARMS |
protected static int |
FLAG_SEND_ALARM_DEREG |
protected static int |
FLAG_SET_BAD_QUALITY |
protected org.apache.log4j.Logger |
log |
protected ScanclassListener |
scListener |
Constructor and Description |
---|
SimpleExecutableScanClass(ScanClass scDefinition,
java.lang.String driverName,
EntityId id) |
Modifier and Type | Method and Description |
---|---|
void |
addTags(java.util.Collection<ExecutableTag> tags)
Adds the tags to the scan class and initializes them.
|
protected void |
addTags(java.util.Collection<ExecutableTag> tags,
Flags initFlags)
Adds tags to the scan class, but only initializes them if doInit is true.
|
ExpressionParseContext |
createExpressionParseContext(TagPath owningTag)
Creates a parse context to be used by the owning tag to parse references.
|
protected SimpleExecutableScanClass.ScanClassTagEvaluationContext |
createTagEvalContext() |
protected int |
getCurrentUpdateRate() |
java.lang.String |
getDefaultDatasource() |
java.lang.String |
getDefaultTagSource()
Returns the default tag source to be used when parsing tag reference paths.
|
protected int |
getDesiredUpdateRate()
Calculates the appropriate update rate for this scan class.
|
java.lang.String |
getDisplayNameForPath(TagPath path)
Returns a friendly, fully qualified path for the given tag.
|
EntityId |
getEntityId() |
TagEvaluationContext |
getEvaluationContext() |
FunctionFactory |
getExpressionFunctionFactory() |
GatewayContext |
getGatewayContext() |
java.util.Date |
getLastEvaluationTime()
The last time the executor tried to run the tags.
|
java.lang.String |
getName() |
protected java.lang.String |
getNameForExecUnit() |
QualifiedPath |
getObjectPath() |
java.lang.String |
getOpcSubscriptionName()
Returns a subscription name for use with the OPC system.
|
SQLTagsExecutor |
getOwner() |
protected java.lang.String |
getOwnerNameForExecUnit()
The name to use for the "owner" field of any execution units.
|
ScriptManager |
getScriptManager()
Returns the ScriptManager that can be used to execute Python scripts.
|
java.util.List<BasicInformation> |
getStatusInformation() |
org.apache.log4j.Logger |
getTagErrorLogger() |
protected SimpleExecutableScanClass.ScanClassTagEvaluationContext |
getTagEvalContext() |
TagManagerBase |
getTagManager()
Returns a tagmanagerbase that can be used to look up tag references.
|
TagScriptManager |
getTagScriptManager() |
protected void |
initializeTags(java.util.Collection<ExecutableTag> tags,
Flags flags) |
boolean |
isAsyncExec()
Indicates whether the tags should execute asynchronously, whenever they can, or wait until evaluate is
called.
|
protected boolean |
isDrivingTagConditionHigh() |
protected boolean |
isOnChange() |
protected boolean |
isOneShot() |
protected boolean |
isPolledRead()
Returns whether we should read, instead of subscribed.
|
protected void |
notifyRateChange() |
protected void |
notifyStatistics() |
protected void |
processHistory(java.util.Map<java.lang.String,? extends HistoricalData> histValues) |
protected void |
processInitContext(TagInitializationContext context) |
protected void |
processTagContext(TagContext context)
The tagcontext base contains error messages for the tag.
|
protected void |
processUninitContext(TagUninitializeContext context) |
void |
removeTags(java.util.Collection<ExecutableTag> tags,
boolean deleted)
Removes the tags from the scan class.
|
protected void |
removeTags(java.util.Collection<ExecutableTag> tags,
Flags flags) |
protected void |
reportDebug(java.lang.String msg) |
void |
run()
Executes the scan class instance, processing all tags it contains.
|
protected boolean |
runTagEvaluation()
Actually evaluates tags, returns whether they ran or not.
|
void |
sampleDiagnostics(DiagnosticsSample sample)
Provides the sample upon which the object can set diagnostics information.
|
protected void |
setCurrentUpdateRate(int ms)
Setting this will change the rate at which the scan class executes.
|
protected void |
setDrivingTagPath(TagPath path)
Updates the driving tag reference of the scan class.
|
void |
setOwner(SQLTagsExecutor owner) |
void |
setScanClass(ScanClass scanClass) |
void |
setScanclassListener(ScanclassListener listener) |
protected boolean |
shouldRunRegularly()
Returns whether the scan class should be registered with the exec engine and run regularly.
|
void |
startExecution()
Begin executing this scan class instance.
|
void |
stopExecution()
Stop executing this scan class instance, unregisters the timer and the opc subscription.
|
protected void |
stopExecution(boolean stopOPCSub) |
void |
transferExecution(ExecutableScanClass target)
This function transfers all of its running state to the new scan class that's going to take over for it.
|
protected void |
uninitializeTags(java.util.Collection<ExecutableTag> tags,
Flags flags)
This version is used to give subclasses chance to set the parameters we want on the tag uninit context before we
call in.
|
protected void |
updateDrivingTag() |
void |
updateInstanceInfo(ScanClassInstance instance) |
void |
updateLease(long expirationMillis)
Sets the time, as a long, when the lease will expire.
|
protected void |
updateNextExec() |
protected void |
updateStatMetrics(java.util.Map<java.lang.String,StatMetric> statMetrics)
Gives sub classes the opportunity to add their own stat metrics onto the map that will be returned to
getStatusInformation.
|
protected void |
updateStatusProperties(java.util.List<NamedValue> properties)
Gives the chance to add properties onto the list that will be returned to the call to getStatusInformation.
|
boolean |
useOPCReadAfterWrite()
If true, opc values should be updated by reading immediately after they write.
|
addAllTagPaths, addHistoricalTags, copyStats, evaluateStaleness, evaluateTags, getAvgExecDuration, getCurrentHistTagSet, getCurrentTagSet, getDriverName, getExecCount, getHistoricalTags, getHistoryProviderSet, getLastExec, getLastExecDBReads, getLastExecDBWrites, getLastExecDelay, getLastExecDuration, getLastExecOPCReads, getLastExecOPCWrites, getLastExecRate, getNextExec, getScanClass, getTags, internalAddTags, isStale, removeHistoricalTags, removeTags, resetTagEvaluation, setAvgExecDuration, setDriverName, setExecCount, setLastExec, setLastExecDBReads, setLastExecDBWrites, setLastExecDelay, setLastExecDuration, setLastExecOPCReads, setLastExecOPCWrites, setLastExecRate, setNextExec, setStale, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addHistoricalTags, getHistoricalTags, getScanClass, getTags, removeHistoricalTags
getExecutionManager
copyStats, getAvgExecDuration, getDriverName, getExecCount, getLastExec, getLastExecDBReads, getLastExecDBWrites, getLastExecDelay, getLastExecDuration, getLastExecOPCReads, getLastExecOPCWrites, getLastExecRate, getNextExec, isStale
protected static final int FLAG_SEND_ALARM_DEREG
protected static final int FLAG_IS_TRANSFER
protected static final int FLAG_PREVENT_INIT
protected static final int FLAG_SET_BAD_QUALITY
protected static final int FLAG_RELEASE_ALARMS
protected ScanclassListener scListener
protected org.apache.log4j.Logger log
public boolean useOPCReadAfterWrite()
TagExecutor
useOPCReadAfterWrite
in interface TagExecutor
public SQLTagsExecutor getOwner()
getOwner
in interface ExecutableScanClass
public TagScriptManager getTagScriptManager()
getTagScriptManager
in interface SQLTagsExecutor
public QualifiedPath getObjectPath()
getObjectPath
in interface SQLTagsExecutor
public void setOwner(SQLTagsExecutor owner)
setOwner
in interface ExecutableScanClass
protected boolean isPolledRead()
protected boolean isOneShot()
protected boolean isOnChange()
protected boolean shouldRunRegularly()
public EntityId getEntityId()
getEntityId
in interface ExecutableScanClass
public FunctionFactory getExpressionFunctionFactory()
getExpressionFunctionFactory
in interface TagExecutor
public java.util.Date getLastEvaluationTime()
TagExecutor
getLastEvaluationTime
in interface TagExecutor
public java.lang.String getDefaultTagSource()
SQLTagsExecutor
getDefaultTagSource
in interface SQLTagsExecutor
public java.lang.String getDisplayNameForPath(TagPath path)
SQLTagsExecutor
getDisplayNameForPath
in interface SQLTagsExecutor
public java.util.List<BasicInformation> getStatusInformation()
getStatusInformation
in interface ExecutableScanClass
protected void updateStatusProperties(java.util.List<NamedValue> properties)
properties
- public void sampleDiagnostics(DiagnosticsSample sample)
Diagnosable
sampleDiagnostics
in interface Diagnosable
protected void updateStatMetrics(java.util.Map<java.lang.String,StatMetric> statMetrics)
statMetrics
- protected java.lang.String getOwnerNameForExecUnit()
protected java.lang.String getNameForExecUnit()
protected SimpleExecutableScanClass.ScanClassTagEvaluationContext createTagEvalContext()
protected SimpleExecutableScanClass.ScanClassTagEvaluationContext getTagEvalContext()
public TagEvaluationContext getEvaluationContext()
getEvaluationContext
in interface TagExecutor
public boolean isAsyncExec()
TagExecutor
isAsyncExec
in interface TagExecutor
public org.apache.log4j.Logger getTagErrorLogger()
getTagErrorLogger
in interface SQLTagsExecutor
public GatewayContext getGatewayContext()
getGatewayContext
in interface SQLTagsExecutor
public TagManagerBase getTagManager()
SQLTagsExecutor
getTagManager
in interface SQLTagsExecutor
public ScriptManager getScriptManager()
SQLTagsExecutor
getScriptManager
in interface SQLTagsExecutor
public java.lang.String getDefaultDatasource()
getDefaultDatasource
in interface SQLTagsExecutor
public void setScanclassListener(ScanclassListener listener)
setScanclassListener
in interface ExecutableScanClass
public void addTags(java.util.Collection<ExecutableTag> tags)
ExecutableScanClass
addTags
in interface ExecutableScanClass
protected void addTags(java.util.Collection<ExecutableTag> tags, Flags initFlags)
tags
- doInit
- public void removeTags(java.util.Collection<ExecutableTag> tags, boolean deleted)
ExecutableScanClass
removeTags
in interface ExecutableScanClass
protected void removeTags(java.util.Collection<ExecutableTag> tags, Flags flags)
protected void initializeTags(java.util.Collection<ExecutableTag> tags, Flags flags)
protected void uninitializeTags(java.util.Collection<ExecutableTag> tags, Flags flags)
tags
- tagWasDeleted
- context
- protected void notifyRateChange()
protected void notifyStatistics()
public java.lang.String getOpcSubscriptionName()
getOpcSubscriptionName
in interface ExecutableScanClass
getOpcSubscriptionName
in interface TagExecutor
public java.lang.String getName()
getName
in interface ExecutableScanClass
getName
in interface SQLTagsExecutor
public void setScanClass(ScanClass scanClass)
setScanClass
in class BasicScanClassInstance
protected void updateDrivingTag()
protected void setDrivingTagPath(TagPath path)
obj
- protected void setCurrentUpdateRate(int ms)
ms
- protected int getCurrentUpdateRate()
protected void updateNextExec()
protected int getDesiredUpdateRate()
protected boolean isDrivingTagConditionHigh()
public void updateLease(long expirationMillis)
ExecutableScanClass
updateLease
in interface ExecutableScanClass
public void startExecution()
startExecution
in interface ExecutableScanClass
public void stopExecution()
stopExecution
in interface ExecutableScanClass
protected void stopExecution(boolean stopOPCSub)
protected boolean runTagEvaluation()
runTagEvaluation
in class BasicScanClassInstance
evalContext
- protected void processTagContext(TagContext context)
context
- protected void processUninitContext(TagUninitializeContext context)
protected void processInitContext(TagInitializationContext context)
public void transferExecution(ExecutableScanClass target)
transferExecution
in interface ExecutableScanClass
public void run()
run
in interface java.lang.Runnable
protected void processHistory(java.util.Map<java.lang.String,? extends HistoricalData> histValues)
protected void reportDebug(java.lang.String msg)
public void updateInstanceInfo(ScanClassInstance instance)
updateInstanceInfo
in interface ExecutableScanClass
public ExpressionParseContext createExpressionParseContext(TagPath owningTag)
TagExecutor
createExpressionParseContext
in interface TagExecutor