Interface DataNodeSession
- All Known Implementing Classes:
DataCollectorDelegate.NodeSessionDelegate
,DataCollectorFactory.AbstractDataCollector.AbstractNodeSession
,DataCollectorFactory.AbstractDataCollector.ManualNodeSession
,DataCollectorFactory.AbstractDataCollector.StreamingNodeSession
,ErroredNodeSession
public interface DataNodeSession
Represents the session for interacting with a data node.
Provides operations for managing changes to data, metadata,
and source as well as managing the lifecycle of the node session.
DataNodeSession implementations are responsible for ensuring proper handling of resources
and state transitions in the life cycle of the node session.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enum
Enum representing the availability status of the node. -
Method Summary
Modifier and TypeMethodDescriptionboolean
attachObserver
(NodeSessionObserver observer) Attaches aNodeSessionObserver
to the node session.boolean
detachObserver
(NodeSessionObserver observer) Detaches aNodeSessionObserver
from the node session.Gets the current availability status of the node.processDataChange
(DataPoint<?> dataPoint) Processes a data change for the node.processMetadataChange
(MetadataPoint metadata) Processes a metadata change for the node.processSourceChange
(SourceChangePoint sourceChange) Processes a change in the source configuration or state for the node.void
release()
Closes the session, releasing any resources associated with it.reset()
Resets the current session for the node to its initial state.Retires the node, indicating no further data changes are expected.
-
Method Details
-
getAvailabilityStatus
DataNodeSession.AvailabilityStatus getAvailabilityStatus()Gets the current availability status of the node.- Returns:
- The current
DataNodeSession.AvailabilityStatus
of the node.
-
processDataChange
Processes a data change for the node.- Parameters:
dataPoint
- The newDataPoint
containing the data change for the node.- Returns:
- A
CompletionStage
that, when completed, provides theQualityCode
of the operation. If the node's availability status isUNSUPPORTED
, this will complete withQualityCode.Bad_Unsupported
. - Throws:
SourcePathMismatchException
- If the source path in the data point doesn't match the path this session represents.
-
processSourceChange
Processes a change in the source configuration or state for the node.- Parameters:
sourceChange
- TheSourceChangePoint
representing the source change to process.- Returns:
- A
CompletionStage
that, when completed, provides theQualityCode
of the operation. If the node's availability status isUNSUPPORTED
, this will complete withQualityCode.Bad_Unsupported
. - Throws:
SourcePathMismatchException
- If the old source path in the source change doesn't match the path this session represents.
-
retireNode
CompletionStage<QualityCode> retireNode()Retires the node, indicating no further data changes are expected. After calling this method, it is expected thatrelease()
will be called subsequently to properly clean up resources.- Returns:
- A
CompletionStage
that, when completed, provides theQualityCode
of the operation. If the node's availability status isUNSUPPORTED
, this will complete withQualityCode.Bad_Unsupported
. - See Also:
-
processMetadataChange
Processes a metadata change for the node.- Parameters:
metadata
- TheMetadataPoint
containing the metadata change to process.- Returns:
- A
CompletionStage
that, when completed, provides theQualityCode
of the operation. If the node's availability status isUNSUPPORTED
, this will complete withQualityCode.Bad_Unsupported
. - Throws:
SourcePathMismatchException
- If the source path in the metadata point doesn't match the path this session represents.
-
reset
CompletionStage<QualityCode> reset()Resets the current session for the node to its initial state. This operation may involve clearing any cached data.- Returns:
- A
CompletionStage
that, when completed, provides theQualityCode
indicating the result of the reset operation. If the node's availability status isUNSUPPORTED
, this will complete withQualityCode.Bad_Unsupported
.
-
release
void release()Closes the session, releasing any resources associated with it.This method ensures that any resources allocated during the session's lifecycle are properly released. It should be called after
retireNode()
to complete the cleanup process and prevent resource leaks. -
attachObserver
Attaches aNodeSessionObserver
to the node session. This allows the observer to receive updates about the session's state and events.- Parameters:
observer
- TheNodeSessionObserver
to attach.- Returns:
true
if the observer was successfully attached,false
if already attached or if attachment failed.
-
detachObserver
Detaches aNodeSessionObserver
from the node session. This stops the observer from receiving further updates about the session's state and events.- Parameters:
observer
- TheNodeSessionObserver
to detach.- Returns:
true
if the observer was successfully detached,false
if not attached or if detachment failed.
-