Class AbstractBindingHarness
java.lang.Object
com.inductiveautomation.perspective.gateway.model.AbstractBindingHarness
- All Implemented Interfaces:
AuditingContext,BindingContext,LoggingContext
- Direct Known Subclasses:
ElementBindingHarness
Wraps up the logic of creating bindings and transform chains, and linking up the values as they get created,
eventually making their way back onto the target property.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Bindingprotected booleanprotected final PerspectiveElementprotected final PropertyKeyprotected final Transform[]List of transforms or null if no transforms (never empty)protected final String -
Method Summary
Modifier and TypeMethodDescriptionvoidmdcSetup()Set up the MDC keys for this contextvoidTear down the MDC keys that are added in #mdcSetupprotected voidonBindingProducedValue(long sequence, QualifiedValue value) protected voidonTransformProducedValue(int transformIndex, long sequence, QualifiedValue transformedValue) voidTakes the most recently published value from the binding and runs it through the transforms or delivers it to the target if there are no transforms.voidpublish(QualifiedValue value, boolean pending) Called from the binding when it has a value to push onto the target property ( or through its transforms )voidrefresh()voidshutdown()Must be called on-queuevoidstartup()Must be called on-queueprotected abstract RunnablesubscribeToTarget(Consumer<PropertyTreeChangeEvent> callback) Attempt to subscribe to the target property.protected abstract voidwriteToTarget(QualifiedValue value) Write the given value to the target property.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.inductiveautomation.perspective.gateway.api.AuditingContext
auditMethods inherited from interface com.inductiveautomation.perspective.gateway.api.BindingContext
getAuditProfile, getDiagnosticPath, getExecutorService, getMutabilityMode, getScheduler, getSession, publishMethods inherited from interface com.inductiveautomation.perspective.gateway.api.LoggingContext
mdc, mdcSetupTree, mdcTeardownTree, mdcWrap
-
Field Details
-
typeCode
-
binding
-
targetComponent
-
targetProperty
-
transforms
List of transforms or null if no transforms (never empty) -
shutdown
protected boolean shutdown
-
-
Method Details
-
getTargetElement
- Specified by:
getTargetElementin interfaceBindingContext
-
getLogger
- Specified by:
getLoggerin interfaceLoggingContext
-
getMdcParent
- Specified by:
getMdcParentin interfaceLoggingContext
-
mdcSetup
public void mdcSetup()Description copied from interface:LoggingContextSet up the MDC keys for this context- Specified by:
mdcSetupin interfaceLoggingContext
-
mdcTeardown
public void mdcTeardown()Description copied from interface:LoggingContextTear down the MDC keys that are added in #mdcSetup- Specified by:
mdcTeardownin interfaceLoggingContext
-
getTargetProperty
- Specified by:
getTargetPropertyin interfaceBindingContext
-
resolveReferences
-
startup
public void startup()Must be called on-queue -
subscribeToTarget
Attempt to subscribe to the target property.- Parameters:
callback- When the target property changes, call this consumer and give it a way to fetch the new value- Returns:
- A runnable which when called will tear down the subscription. May be null if the subscription wasn't able to be established.
-
shutdown
public void shutdown()Must be called on-queue -
publish
Description copied from interface:BindingContextCalled from the binding when it has a value to push onto the target property ( or through its transforms )- Specified by:
publishin interfaceBindingContextpending- true if this value is temporary and will be replaced (within a reasonable span of time) with a new value
-
processPublishedValue
public void processPublishedValue()Description copied from interface:BindingContextTakes the most recently published value from the binding and runs it through the transforms or delivers it to the target if there are no transforms.- Specified by:
processPublishedValuein interfaceBindingContext
-
getLastValue
- Specified by:
getLastValuein interfaceBindingContext
-
refresh
public void refresh() -
onBindingProducedValue
-
onTransformProducedValue
protected void onTransformProducedValue(int transformIndex, long sequence, QualifiedValue transformedValue) -
writeToTarget
Write the given value to the target property. -
getInitialValueFuture
-
getAuditSnapshot
- Specified by:
getAuditSnapshotin interfaceAuditingContext- Returns:
- A new, or extended,
AuditContext.Builder, with qualified information about the current scope.
-