public abstract class ServiceHandler extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static String[] |
stringTable |
| Modifier | Constructor and Description |
|---|---|
protected |
ServiceHandler(SessionManager sessionManager) |
|
ServiceHandler(SessionManager sessionManager,
NodeManagerTable nodeManagerTable)
Create a new ServiceManager attached to a serviceContext manager
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkRequestLength(Object[] requestObjects,
int maxOperations) |
protected ServiceContext |
createServiceContext(RequestHeader requestHeader,
ServiceRequest<?> serviceRequest)
Create the serviceContext object used to identify the session and other parameters of a service
call.
|
protected void |
fireRequestResponse(ServiceRequest request,
ServiceResponse response,
ServiceContext serviceContext)
This method should be called every time a response has been handled.
|
protected EncoderContext |
getEncoderContext() |
protected org.slf4j.Logger |
getLogger() |
static int |
getMaxOperationsPerRequest()
The maximum number of operations allowed per service request.
|
UaNode |
getNode(NodeId nodeId)
Find the Node for nodeId.
|
NodeManagerTable |
getNodeManagerTable() |
protected OperationLimitsTypeNode |
getOperationLimits() |
UaServer |
getServer() |
SessionManager |
getSessionManager() |
protected void |
handleServiceResultException(ServiceResponse response,
ServiceException e)
Handle the ServiceException by converting it to the ServiceResult in the response.
|
boolean |
hasNode(NodeId nodeId) |
protected static List<Locale> |
localizationHintsForServiceContext(ServiceContext serviceContext) |
static void |
setMaxOperationsPerRequest(int maxOperationsPerRequest)
Define the maximum number of operations allowed per service request.
|
void |
setRequestListener(RequestListener listener)
Sets the Request Listener.
|
void |
setRequestResponseListener(RequestResponseListener listener)
Sets the Request-Response Listener.
|
protected static ExtensionObject |
toExtensionObject(ServiceContext serviceContext,
Structure data,
QualifiedName dataEncoding,
EncoderContext encoderContext) |
static DiagnosticInfo[] |
validateOperationalDiagnostics(ServiceRequest request,
DiagnosticInfo[] diagnosticInfos) |
protected ServiceContext |
validateRequest(EndpointServiceRequest<?,?> endpointRequest)
If the given
EndpointServiceRequest is an instance of
UaLoopbackClient.InternalEndpointServiceRequest (i.e. |
protected ServiceContext |
validateRequest(ServiceRequest request,
ServerSecureChannel serverSecureChannel) |
protected void |
validateResponse(ServiceRequest request,
ServiceResponse response,
ServiceContext serviceContext)
Validates the service response by setting the timestamp to current.
|
protected DiagnosticInfo[] |
validateResponse(ServiceRequest request,
ServiceResponse response,
ServiceContext serviceContext,
DiagnosticInfo[] operationalDiagnosticInfos) |
protected DiagnosticInfo |
validateServiceDiagnostics(ServiceRequest request,
DiagnosticInfo diagnosticInfo) |
protected static final String[] stringTable
public ServiceHandler(SessionManager sessionManager, NodeManagerTable nodeManagerTable)
sessionManager - nodeManagerTable - protected ServiceHandler(SessionManager sessionManager)
public static int getMaxOperationsPerRequest()
StatusCodes.Bad_TooManyOperations is thrown.public static void setMaxOperationsPerRequest(int maxOperationsPerRequest)
StatusCodes.Bad_TooManyOperations is thrown.
Default: 10000
maxOperationsPerRequest - the maxOperationsPerRequest to set. If 0 or negative, no limit
is used.public static DiagnosticInfo[] validateOperationalDiagnostics(ServiceRequest request, DiagnosticInfo[] diagnosticInfos)
request - diagnosticInfos - protected static List<Locale> localizationHintsForServiceContext(ServiceContext serviceContext)
protected static ExtensionObject toExtensionObject(ServiceContext serviceContext, Structure data, QualifiedName dataEncoding, EncoderContext encoderContext) throws ServiceException
data - dataEncoding - ServiceExceptionpublic final UaNode getNode(NodeId nodeId) throws StatusException
nodeId - The ID of the node to look for.StatusException - Bad_NodeIdInvalid, if the nodeId is null. Bad_NodeIdUnknown, if the
node is not foundpublic NodeManagerTable getNodeManagerTable()
public UaServer getServer()
public SessionManager getSessionManager()
public boolean hasNode(NodeId nodeId)
public void setRequestListener(RequestListener listener)
RequestListener for more info.public void setRequestResponseListener(RequestResponseListener listener)
RequestResponseListener for more info.protected void checkRequestLength(Object[] requestObjects, int maxOperations) throws ServiceException
ServiceExceptionprotected ServiceContext createServiceContext(RequestHeader requestHeader, ServiceRequest<?> serviceRequest) throws ServiceException
RequestHeader.getAuthenticationToken(). Note
that when the ServiceRequest is CreateSessionRequest, this method returns a
ServiceContext whose Session is null, as the Session doesn't exist until the request is
handled.requestHeader - The session token used to identity the session during communicationsserviceRequest - The service request from which the requestHeader isServiceException - If the serviceContext is not found, StatusCode = Bad_SessionIdInvalidprotected void fireRequestResponse(ServiceRequest request, ServiceResponse response, ServiceContext serviceContext)
request - The Request from clientresponse - The Response to the request from serverserviceContext - protected EncoderContext getEncoderContext()
protected org.slf4j.Logger getLogger()
protected OperationLimitsTypeNode getOperationLimits()
protected void handleServiceResultException(ServiceResponse response, ServiceException e)
response - The response message to sete - The exception infoprotected ServiceContext validateRequest(EndpointServiceRequest<?,?> endpointRequest) throws ServiceException
EndpointServiceRequest is an instance of
UaLoopbackClient.InternalEndpointServiceRequest (i.e. it originates from the UaLoopbackClient),
returns ServiceContext.INTERNAL_OPERATION_CONTEXT, otherwise the return is based from
validateRequest(ServiceRequest, ServerSecureChannel) called with
(EndpointServiceRequest.getRequest() and EndpointServiceRequest.getChannel()).ServiceExceptionprotected ServiceContext validateRequest(ServiceRequest request, ServerSecureChannel serverSecureChannel) throws ServiceException
request - the request messageserverSecureChannel - ServiceExceptionprotected void validateResponse(ServiceRequest request, ServiceResponse response, ServiceContext serviceContext)
response - the response to validate - it must not be nullserviceContext - protected DiagnosticInfo[] validateResponse(ServiceRequest request, ServiceResponse response, ServiceContext serviceContext, DiagnosticInfo[] operationalDiagnosticInfos)
request - response - serviceContext - operationalDiagnosticInfos - protected DiagnosticInfo validateServiceDiagnostics(ServiceRequest request, DiagnosticInfo diagnosticInfo)
request - diagnosticInfo - Copyright © 2026. All rights reserved.