Class AbstractBindingHarness
- java.lang.Object
- 
- com.inductiveautomation.perspective.gateway.model.AbstractBindingHarness
 
- 
- All Implemented Interfaces:
- AuditingContext,- BindingContext,- LoggingContext
 - Direct Known Subclasses:
- ElementBindingHarness
 
 public abstract class AbstractBindingHarness extends java.lang.Object implements BindingContext 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 SummaryFields Modifier and Type Field Description protected Bindingbindingprotected booleanshutdownprotected PerspectiveElementtargetComponentprotected PropertyKeytargetPropertyprotected Transform[]transformsList of transforms or null if no transforms (never empty)protected java.lang.StringtypeCode
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description AuditContext.BuildergetAuditSnapshot()java.util.concurrent.CompletableFuture<QualifiedValue>getInitialValueFuture()QualifiedValuegetLastValue()LoggerExgetLogger()LoggingContextgetMdcParent()PerspectiveElementgetTargetElement()PropertyKeygetTargetProperty()voidmdcSetup()Set up the MDC keys for this contextvoidmdcTeardown()Tear down the MDC keys that are added in #mdcSetupprotected voidonBindingProducedValue(long sequence, QualifiedValue value)protected voidonTransformProducedValue(int transformIndex, long sequence, QualifiedValue transformedValue)voidprocessPublishedValue()Takes 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()java.util.Collection<PropertyReference>resolveReferences()voidshutdown()Must be called on-queuevoidstartup()Must be called on-queueprotected abstract java.lang.RunnablesubscribeToTarget(java.util.function.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.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.AuditingContextaudit
 - 
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.BindingContextgetAuditProfile, getExecutorService, getScheduler, getSession, publish
 - 
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.LoggingContextmdc, mdcSetupTree, mdcTeardownTree, mdcWrap
 
- 
 
- 
- 
- 
Field Detail- 
typeCodeprotected final java.lang.String typeCode 
 - 
bindingprotected final Binding binding 
 - 
targetComponentprotected final PerspectiveElement targetComponent 
 - 
targetPropertyprotected final PropertyKey targetProperty 
 - 
transforms@Nullable protected final Transform[] transforms List of transforms or null if no transforms (never empty)
 - 
shutdownprotected boolean shutdown 
 
- 
 - 
Method Detail- 
getTargetElementpublic PerspectiveElement getTargetElement() - Specified by:
- getTargetElementin interface- BindingContext
 
 - 
getLoggerpublic LoggerEx getLogger() - Specified by:
- getLoggerin interface- LoggingContext
 
 - 
getMdcParent@Nullable public LoggingContext getMdcParent() - Specified by:
- getMdcParentin interface- LoggingContext
 
 - 
mdcSetuppublic void mdcSetup() Description copied from interface:LoggingContextSet up the MDC keys for this context- Specified by:
- mdcSetupin interface- LoggingContext
 
 - 
mdcTeardownpublic void mdcTeardown() Description copied from interface:LoggingContextTear down the MDC keys that are added in #mdcSetup- Specified by:
- mdcTeardownin interface- LoggingContext
 
 - 
getTargetPropertypublic PropertyKey getTargetProperty() - Specified by:
- getTargetPropertyin interface- BindingContext
 
 - 
resolveReferencespublic java.util.Collection<PropertyReference> resolveReferences() 
 - 
startuppublic void startup() Must be called on-queue
 - 
subscribeToTarget@Nullable protected abstract java.lang.Runnable subscribeToTarget(java.util.function.Consumer<PropertyTreeChangeEvent> callback) 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.
 
 - 
shutdownpublic void shutdown() Must be called on-queue
 - 
publishpublic void publish(QualifiedValue value, boolean pending) 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 interface- BindingContext
- pending- true if this value is temporary and will be replaced (within a reasonable span of time) with a new value
 
 - 
processPublishedValuepublic 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 interface- BindingContext
 
 - 
getLastValuepublic QualifiedValue getLastValue() - Specified by:
- getLastValuein interface- BindingContext
 
 - 
refreshpublic void refresh() 
 - 
onBindingProducedValueprotected void onBindingProducedValue(long sequence, QualifiedValue value)
 - 
onTransformProducedValueprotected void onTransformProducedValue(int transformIndex, long sequence, QualifiedValue transformedValue)
 - 
writeToTargetprotected abstract void writeToTarget(QualifiedValue value) Write the given value to the target property.
 - 
getInitialValueFuturepublic java.util.concurrent.CompletableFuture<QualifiedValue> getInitialValueFuture() 
 - 
getAuditSnapshot@Nonnull public AuditContext.Builder getAuditSnapshot() - Specified by:
- getAuditSnapshotin interface- AuditingContext
- Returns:
- A new, or extended, AuditContext.Builder, with qualified information about the current scope.
 
 
- 
 
-