public class AttributeServiceHandler extends ServiceHandler
| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
logger |
stringTable| Constructor and Description |
|---|
AttributeServiceHandler(SessionManager sessionManager,
NodeManagerTable nodeManagerTable) |
| Modifier and Type | Method and Description |
|---|---|
protected org.slf4j.Logger |
getLogger() |
int |
getMaxNodesPerHistoryReadData() |
int |
getMaxNodesPerHistoryReadEvents() |
int |
getMaxNodesPerHistoryUpdateData() |
int |
getMaxNodesPerHistoryUpdateEvents() |
int |
getMaxNodesPerRead() |
int |
getMaxNodesPerWrite() |
protected void |
historyRead(ServiceContext serviceContext,
HistoryReadRequest request,
HistoryReadResponse response)
Handle the onHistoryRead service call.
|
protected void |
historyUpdate(ServiceContext serviceContext,
HistoryUpdateRequest request,
HistoryUpdateResponse response)
Handle the onHistoryUpdate service call.
|
void |
onHistoryRead(EndpointServiceRequest<HistoryReadRequest,HistoryReadResponse> req) |
void |
onHistoryUpdate(EndpointServiceRequest<HistoryUpdateRequest,HistoryUpdateResponse> req) |
void |
onRead(EndpointServiceRequest<ReadRequest,ReadResponse> req) |
void |
onWrite(EndpointServiceRequest<WriteRequest,WriteResponse> req) |
protected void |
read(ServiceContext serviceContext,
ReadRequest request,
ReadResponse response)
Handle the onRead service call.
|
protected void |
readAttribute(ServiceContext serviceContext,
Object dataset,
NodeId nodeId,
UnsignedInteger attributeId,
NumericRange indexRange,
TimestampsToReturn timestampsToReturn,
DateTime minTimestamp,
DataValue dataValue)
Read the value of a single node attribute.
|
protected HistoryResult |
readNodeHistory(ServiceContext serviceContext,
Object dataset,
TimestampsToReturn timestampsToReturn,
NodeId nodeId,
NumericRange indexRange,
HistoryContinuationPoint continuationPoint,
HistoryReadDetails details,
int aggregateIndex)
Read history of a single node.
|
protected void |
releaseHistoryContinuationPoint(ServiceContext serviceContext,
NodeId nodeId,
ByteString continuationPoint) |
void |
setMaxNodesPerHistoryReadData(int maxNodesPerHistoryReadData)
Safety limit for the maximum request size for history reads (data).
|
void |
setMaxNodesPerHistoryReadEvents(int maxNodesPerHistoryReadEvents)
Safety limit for the maximum request size for history reads (events).
|
void |
setMaxNodesPerHistoryUpdateData(int maxNodesPerHistoryUpdateData)
Safety limit for the maximum request size for history updates containing data updates.
|
void |
setMaxNodesPerHistoryUpdateEvents(int maxNodesPerHistoryUpdateEvents)
Safety limit for the maximum request size for history updates containing event updates.
|
void |
setMaxNodesPerRead(int maxNodesPerRead)
Safety limit for the maximum request size for reads.
|
void |
setMaxNodesPerWrite(int maxNodesPerWrite)
Safety limit for the maximum request size for writes.
|
protected void |
updateNodeHistory(ServiceContext serviceContext,
Object dataset,
HistoryUpdateDetails details,
HistoryUpdateResult historyUpdateResult) |
protected void |
write(ServiceContext serviceContext,
WriteRequest request,
WriteResponse response)
Handle the onWrite service call.
|
protected boolean |
writeAttribute(ServiceContext serviceContext,
Object operationContext,
NodeId nodeId,
UnsignedInteger attributeId,
NumericRange indexRange,
DataValue value)
Write the value of a single node attribute.
|
checkRequestLength, createServiceContext, fireRequestResponse, getEncoderContext, getMaxOperationsPerRequest, getNode, getNodeManagerTable, getOperationLimits, getServer, getSessionManager, handleServiceResultException, hasNode, localizationHintsForServiceContext, setMaxOperationsPerRequest, setRequestResponseListener, toExtensionObject, validateEncoding, validateEncoding, validateOperationalDiagnostics, validateRequest, validateRequest, validateResponse, validateResponse, validateServiceDiagnosticspublic AttributeServiceHandler(SessionManager sessionManager, NodeManagerTable nodeManagerTable)
public int getMaxNodesPerHistoryReadData()
setMaxNodesPerHistoryReadData(int)public int getMaxNodesPerHistoryReadEvents()
setMaxNodesPerHistoryReadEvents(int)public int getMaxNodesPerHistoryUpdateData()
setMaxNodesPerHistoryUpdateData(int)public int getMaxNodesPerHistoryUpdateEvents()
setMaxNodesPerHistoryUpdateEvents(int)public int getMaxNodesPerRead()
setMaxNodesPerRead(int)public int getMaxNodesPerWrite()
setMaxNodesPerWrite(int)public final void onHistoryRead(EndpointServiceRequest<HistoryReadRequest,HistoryReadResponse> req) throws ServiceFaultException
ServiceFaultExceptionpublic final void onHistoryUpdate(EndpointServiceRequest<HistoryUpdateRequest,HistoryUpdateResponse> req) throws ServiceFaultException
ServiceFaultExceptionpublic final void onRead(EndpointServiceRequest<ReadRequest,ReadResponse> req) throws ServiceFaultException
ServiceFaultExceptionpublic final void onWrite(EndpointServiceRequest<WriteRequest,WriteResponse> req) throws ServiceFaultException
ServiceFaultExceptionpublic void setMaxNodesPerHistoryReadData(int maxNodesPerHistoryReadData)
If the value is 0 or negative, the limit is not used. In this case, the
ServiceHandler#setMaxOperationsPerRequest() is used to limit the request size.
The value is reflected to ServerCapabilities/OperationLimits.
maxNodesPerHistoryReadData - the maxNodesPerHistoryReadData to setpublic void setMaxNodesPerHistoryReadEvents(int maxNodesPerHistoryReadEvents)
If the value is 0 or negative, the limit is not used. In this case, the
ServiceHandler#setMaxOperationsPerRequest() is used to limit the request size.
The value is reflected to ServerCapabilities/OperationLimits.
maxNodesPerHistoryReadEvents - the maxNodesPerHistoryReadEvents to setpublic void setMaxNodesPerHistoryUpdateData(int maxNodesPerHistoryUpdateData)
If the value is 0 or negative, the limit is not used. In this case, the
ServiceHandler#setMaxOperationsPerRequest() is used to limit the request size.
The value is reflected to ServerCapabilities/OperationLimits.
maxNodesPerHistoryUpdateData - the maxNodesPerHistoryUpdateData to setpublic void setMaxNodesPerHistoryUpdateEvents(int maxNodesPerHistoryUpdateEvents)
If the value is 0 or negative, the limit is not used. In this case, the
ServiceHandler#setMaxOperationsPerRequest() is used to limit the request size.
The value is reflected to ServerCapabilities/OperationLimits.
maxNodesPerHistoryUpdateEvents - the maxNodesPerHistoryUpdateData to setpublic void setMaxNodesPerRead(int maxNodesPerRead)
If the value is 0 or negative, the limit is not used. In this case, the
ServiceHandler#setMaxOperationsPerRequest() is used to limit the request size.
The value is reflected to ServerCapabilities/OperationLimits.
maxNodesPerRead - the maxNodesPerRead to setpublic void setMaxNodesPerWrite(int maxNodesPerWrite)
The value is reflected to ServerCapabilities/OperationLimits.
maxNodesPerWrite - the maxNodesPerWrite to setprotected org.slf4j.Logger getLogger()
getLogger in class ServiceHandlerprotected void historyRead(ServiceContext serviceContext, HistoryReadRequest request, HistoryReadResponse response) throws ServiceException
serviceContext - The serviceContext of the client connection used to call this service.request - The request message.response - The response message. Fill in here the results. Make sure that for each node a
new DataValue object is created and initialized with current timestamps. The actual data
is read in readAttribute, which may return DiagnosticInfo, when necessary.ServiceException - When the request is invalid or the call fails for some other reason.
The following error StatusCodes are expected: Bad_NothingToDo, Bad_TooManyOperations,
Bad_MaxAgeInvalid, Bad_TimestampsToReturnInvalidprotected void historyUpdate(ServiceContext serviceContext, HistoryUpdateRequest request, HistoryUpdateResponse response) throws ServiceException
serviceContext - The serviceContext of the client connection used to call this service.request - The request message.response - The response message. Fill in here the results. Make sure that for each node a
new DataValue object is created and initialized with current timestamps. The actual data
is read in readAttribute, which may return DiagnosticInfo, when necessary.ServiceException - When the request is invalid or the call fails for some other reason.
The following error StatusCodes are expected: Bad_NothingToDo, Bad_TooManyOperations,
Bad_MaxAgeInvalid, Bad_TimestampsToReturnInvalidprotected void read(ServiceContext serviceContext, ReadRequest request, ReadResponse response) throws ServiceException
serviceContext - The serviceContext of the client connection used to call this service.request - The request message.response - The response message. Fill in here the results. Make sure that for each node a
new DataValue object is created and initialized with current timestamps. The actual data
is read in readAttribute, which may return DiagnosticInfo, when necessary.ServiceException - When the request is invalid or the call fails for some other reason.
The following error StatusCodes are expected: Bad_NothingToDo, Bad_TooManyOperations,
Bad_MaxAgeInvalid, Bad_TimestampsToReturnInvalidprotected void readAttribute(ServiceContext serviceContext, Object dataset, NodeId nodeId, UnsignedInteger attributeId, NumericRange indexRange, TimestampsToReturn timestampsToReturn, DateTime minTimestamp, DataValue dataValue) throws StatusException
serviceContext - The serviceContext of the client connection used to call this service.dataset - the possible dataset prepared in beginRead(int, com.prosysopc.ua.server.ServiceContext, com.prosysopc.ua.stack.core.ReadValueId[], com.prosysopc.ua.stack.core.TimestampsToReturn, com.prosysopc.ua.stack.builtintypes.DateTime, com.prosysopc.ua.stack.builtintypes.DataValue[], com.prosysopc.ua.stack.builtintypes.DiagnosticInfo[])nodeId - The node to read.attributeId - The attribute to read.indexRange - The requested index range for an array value. May be null.timestampsToReturn - Which timestamps were requested by the client.minTimestamp - Minimum value of the ServerTimestamp of the value to be read. If there is
no value available that is new enough already available (in the server cache), the
server should attempt to read a new value from the actual data source, instead of using
the cached value. If a new value cannot be read, the best value available is returned.
If minTimestamp == DateTime.MAX_VALUE a new value should be read from the source.dataValue - The data value to return. Set Value, and for Value attribute also StatusCode
and the Timestamps.StatusException - If the read fails. Expected result codes: Bad_NodeIdInvalid,
Bad_NodeIdUnknown, Bad_AttributeIdInvalid, Bad_IndexRangeInvalid, Bad_IndexRangeNoData,
Bad_DataEncodingInvalid, Bad_DataEncodingUnsupported, Bad_NotReadable,
Bad_UserAccessDeniedprotected HistoryResult readNodeHistory(ServiceContext serviceContext, Object dataset, TimestampsToReturn timestampsToReturn, NodeId nodeId, NumericRange indexRange, HistoryContinuationPoint continuationPoint, HistoryReadDetails details, int aggregateIndex) throws StatusException
serviceContext - dataset - the possible dataset prepared in beginHistoryRead(int, com.prosysopc.ua.server.ServiceContext, com.prosysopc.ua.stack.core.HistoryReadDetails, com.prosysopc.ua.stack.core.HistoryReadValueId[], com.prosysopc.ua.server.HistoryContinuationPoint[], com.prosysopc.ua.stack.core.TimestampsToReturn, com.prosysopc.ua.server.HistoryResult[])timestampsToReturn - nodeId - indexRange - continuationPoint - details - aggregateIndex - the aggregate that should be used from the AggregateType array in
ReadProcessedDetails (if such is provided)StatusException - If the read fails. Expected result codes: Bad_NodeIdInvalid,
Bad_NodeIdUnknown, Bad_AttributeIdInvalid, Bad_DataEncodingInvalid,
Bad_DataEncodingUnsupported, Bad_ContinuationPointInvalid, Bad_UserAccessDeniedprotected void releaseHistoryContinuationPoint(ServiceContext serviceContext, NodeId nodeId, ByteString continuationPoint) throws StatusException
serviceContext - nodeId - continuationPoint - StatusExceptionprotected void updateNodeHistory(ServiceContext serviceContext, Object dataset, HistoryUpdateDetails details, HistoryUpdateResult historyUpdateResult) throws StatusException
serviceContext - dataset - details - historyUpdateResult - ServiceExceptionStatusExceptionprotected void write(ServiceContext serviceContext, WriteRequest request, WriteResponse response) throws ServiceException
serviceContext - The serviceContext of the client connection used to call this service.request - The request message.response - The response message. Fill in here the result codes. Make sure that for each
node a new StatusCode object is created and initialized to StatusCode.Good. The actual
data is written in writeAttribute, which may return DiagnosticInfo, when necessary.ServiceException - When the request is invalid or the call fails for some other reason.
The following error StatusCodes are expected: Bad_NothingToDo, Bad_TooManyOperations,
Bad_MaxAgeInvalid, Bad_TimestampsToReturnInvalidprotected boolean writeAttribute(ServiceContext serviceContext, Object operationContext, NodeId nodeId, UnsignedInteger attributeId, NumericRange indexRange, DataValue value) throws StatusException
serviceContext - The serviceContext of the client connection used to call this service.operationContext - The possible operationContext prepared in beginWrite(int, com.prosysopc.ua.server.ServiceContext, com.prosysopc.ua.stack.core.WriteValue[], com.prosysopc.ua.stack.builtintypes.StatusCode[], com.prosysopc.ua.stack.builtintypes.DiagnosticInfo[]).nodeId - The node to write.attributeId - The attribute to write.indexRange - The index range to set for an array value. May be null.value - The data value to write.StatusException - If the write fails. Expected result codes: Bad_NodeIdInvalid,
Bad_NodeIdUnknown, Bad_AttributeIdInvalid, Bad_IndexRangeInvalid, Bad_IndexRangeNoData,
Bad_DataEncodingInvalid, Bad_DataEncodingUnsupported, Bad_NotWriteable,
Bad_UserAccessDenied, Bad_OutOfRange, Bad_TypeMismatch, Bad_WriteNotSupportedCopyright © 2026. All rights reserved.