com.prosysopc.ua.server
Class SubscriptionServiceHandler

java.lang.Object
  extended by com.prosysopc.ua.server.ServiceHandler
      extended by com.prosysopc.ua.server.SubscriptionServiceHandler
All Implemented Interfaces:
org.opcfoundation.ua.core.MonitoredItemServiceSetHandler, org.opcfoundation.ua.core.SubscriptionServiceSetHandler

public class SubscriptionServiceHandler
extends ServiceHandler
implements org.opcfoundation.ua.core.SubscriptionServiceSetHandler, org.opcfoundation.ua.core.MonitoredItemServiceSetHandler

A base implementation of SubscriptionServiceSetHandler.

This base class adds a small layer of abstraction by handling the OPC UA request messages and dispatched responses. It delegates the operation to virtual methods, which by default only return "Not implemented" service results.

You can normally use the standard implementation, SubscriptionManager , which provides a basic implementation of actual node management.

If you wish to create a completely customized subscription manager, you can override this class and override the protected methods that you wish to implement.


Field Summary
 
Fields inherited from class com.prosysopc.ua.server.ServiceHandler
stringTable
 
Constructor Summary
SubscriptionServiceHandler(SubscriptionManager subscriptionManager)
           
 
Method Summary
protected  void createMonitoredItems(ServiceContext serviceContext, org.opcfoundation.ua.core.CreateMonitoredItemsRequest request, org.opcfoundation.ua.core.CreateMonitoredItemsResponse response, List<org.opcfoundation.ua.core.ReadValueId> itemsToRead, List<MonitoredDataItem> items)
           
protected  void createSubscription(ServiceContext serviceContext, org.opcfoundation.ua.core.CreateSubscriptionRequest request, org.opcfoundation.ua.core.CreateSubscriptionResponse response)
           
protected  void deleteMonitoredItems(ServiceContext serviceContext, org.opcfoundation.ua.core.DeleteMonitoredItemsRequest request, org.opcfoundation.ua.core.DeleteMonitoredItemsResponse response)
           
protected  void deleteSubscriptions(ServiceContext serviceContext, org.opcfoundation.ua.core.DeleteSubscriptionsRequest request, org.opcfoundation.ua.core.DeleteSubscriptionsResponse response)
           
protected  org.slf4j.Logger getLogger()
           
 int getMaxMonitoredItemsPerCall()
           
protected  void modifyMonitoredItems(ServiceContext serviceContext, org.opcfoundation.ua.core.ModifyMonitoredItemsRequest request, org.opcfoundation.ua.core.ModifyMonitoredItemsResponse response)
           
protected  void modifySubscription(ServiceContext serviceContext, org.opcfoundation.ua.core.ModifySubscriptionRequest request, org.opcfoundation.ua.core.ModifySubscriptionResponse response)
           
 void onCreateMonitoredItems(org.opcfoundation.ua.transport.endpoint.EndpointServiceRequest<org.opcfoundation.ua.core.CreateMonitoredItemsRequest,org.opcfoundation.ua.core.CreateMonitoredItemsResponse> req)
           
 void onCreateSubscription(org.opcfoundation.ua.transport.endpoint.EndpointServiceRequest<org.opcfoundation.ua.core.CreateSubscriptionRequest,org.opcfoundation.ua.core.CreateSubscriptionResponse> req)
           
 void onDeleteMonitoredItems(org.opcfoundation.ua.transport.endpoint.EndpointServiceRequest<org.opcfoundation.ua.core.DeleteMonitoredItemsRequest,org.opcfoundation.ua.core.DeleteMonitoredItemsResponse> req)
           
 void onDeleteSubscriptions(org.opcfoundation.ua.transport.endpoint.EndpointServiceRequest<org.opcfoundation.ua.core.DeleteSubscriptionsRequest,org.opcfoundation.ua.core.DeleteSubscriptionsResponse> req)
           
 void onModifyMonitoredItems(org.opcfoundation.ua.transport.endpoint.EndpointServiceRequest<org.opcfoundation.ua.core.ModifyMonitoredItemsRequest,org.opcfoundation.ua.core.ModifyMonitoredItemsResponse> req)
           
 void onModifySubscription(org.opcfoundation.ua.transport.endpoint.EndpointServiceRequest<org.opcfoundation.ua.core.ModifySubscriptionRequest,org.opcfoundation.ua.core.ModifySubscriptionResponse> req)
           
 void onPublish(org.opcfoundation.ua.transport.endpoint.EndpointServiceRequest<org.opcfoundation.ua.core.PublishRequest,org.opcfoundation.ua.core.PublishResponse> req)
           
 void onRepublish(org.opcfoundation.ua.transport.endpoint.EndpointServiceRequest<org.opcfoundation.ua.core.RepublishRequest,org.opcfoundation.ua.core.RepublishResponse> req)
           
 void onSetMonitoringMode(org.opcfoundation.ua.transport.endpoint.EndpointServiceRequest<org.opcfoundation.ua.core.SetMonitoringModeRequest,org.opcfoundation.ua.core.SetMonitoringModeResponse> req)
           
 void onSetPublishingMode(org.opcfoundation.ua.transport.endpoint.EndpointServiceRequest<org.opcfoundation.ua.core.SetPublishingModeRequest,org.opcfoundation.ua.core.SetPublishingModeResponse> req)
           
 void onSetTriggering(org.opcfoundation.ua.transport.endpoint.EndpointServiceRequest<org.opcfoundation.ua.core.SetTriggeringRequest,org.opcfoundation.ua.core.SetTriggeringResponse> req)
           
 void onTransferSubscriptions(org.opcfoundation.ua.transport.endpoint.EndpointServiceRequest<org.opcfoundation.ua.core.TransferSubscriptionsRequest,org.opcfoundation.ua.core.TransferSubscriptionsResponse> req)
           
 void setMaxMonitoredItemsPerCall(int maxMonitoredItemsPerCall)
          Safety limit for the maximum request size for monitored item related requests.
protected  void setMonitoringMode(ServiceContext serviceContext, org.opcfoundation.ua.core.SetMonitoringModeRequest request, org.opcfoundation.ua.core.SetMonitoringModeResponse response)
           
protected  void setPublishingMode(ServiceContext serviceContext, org.opcfoundation.ua.core.SetPublishingModeRequest request, org.opcfoundation.ua.core.SetPublishingModeResponse response)
           
protected  void transferSubscriptions(ServiceContext serviceContext, org.opcfoundation.ua.core.TransferSubscriptionsRequest request, org.opcfoundation.ua.core.TransferSubscriptionsResponse response)
           
 
Methods inherited from class com.prosysopc.ua.server.ServiceHandler
checkRequestLength, createServiceContext, fireRequestResponse, getEncoderContext, getMaxOperationsPerRequest, getNode, getNodeManagerTable, getOperationLimits, getServer, getSessionManager, handleServiceResultException, hasNode, setMaxOperationsPerRequest, setRequestResponseListener, toExtensionObject, validateEncoding, validateOperationalDiagnostics, validateRequest, validateResponse, validateResponse, validateServiceDiagnostics
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubscriptionServiceHandler

public SubscriptionServiceHandler(SubscriptionManager subscriptionManager)
Parameters:
subscriptionManager -
Method Detail

getMaxMonitoredItemsPerCall

public int getMaxMonitoredItemsPerCall()
Returns:
the maxMonitoredItemsPerCall
See Also:
setMaxMonitoredItemsPerCall(int)

onCreateMonitoredItems

public final void onCreateMonitoredItems(org.opcfoundation.ua.transport.endpoint.EndpointServiceRequest<org.opcfoundation.ua.core.CreateMonitoredItemsRequest,org.opcfoundation.ua.core.CreateMonitoredItemsResponse> req)
                                  throws org.opcfoundation.ua.common.ServiceFaultException
Specified by:
onCreateMonitoredItems in interface org.opcfoundation.ua.core.MonitoredItemServiceSetHandler
Throws:
org.opcfoundation.ua.common.ServiceFaultException

onCreateSubscription

public final void onCreateSubscription(org.opcfoundation.ua.transport.endpoint.EndpointServiceRequest<org.opcfoundation.ua.core.CreateSubscriptionRequest,org.opcfoundation.ua.core.CreateSubscriptionResponse> req)
                                throws org.opcfoundation.ua.common.ServiceFaultException
Specified by:
onCreateSubscription in interface org.opcfoundation.ua.core.SubscriptionServiceSetHandler
Throws:
org.opcfoundation.ua.common.ServiceFaultException

onDeleteMonitoredItems

public final void onDeleteMonitoredItems(org.opcfoundation.ua.transport.endpoint.EndpointServiceRequest<org.opcfoundation.ua.core.DeleteMonitoredItemsRequest,org.opcfoundation.ua.core.DeleteMonitoredItemsResponse> req)
                                  throws org.opcfoundation.ua.common.ServiceFaultException
Specified by:
onDeleteMonitoredItems in interface org.opcfoundation.ua.core.MonitoredItemServiceSetHandler
Throws:
org.opcfoundation.ua.common.ServiceFaultException

onDeleteSubscriptions

public final void onDeleteSubscriptions(org.opcfoundation.ua.transport.endpoint.EndpointServiceRequest<org.opcfoundation.ua.core.DeleteSubscriptionsRequest,org.opcfoundation.ua.core.DeleteSubscriptionsResponse> req)
                                 throws org.opcfoundation.ua.common.ServiceFaultException
Specified by:
onDeleteSubscriptions in interface org.opcfoundation.ua.core.SubscriptionServiceSetHandler
Throws:
org.opcfoundation.ua.common.ServiceFaultException

onModifyMonitoredItems

public final void onModifyMonitoredItems(org.opcfoundation.ua.transport.endpoint.EndpointServiceRequest<org.opcfoundation.ua.core.ModifyMonitoredItemsRequest,org.opcfoundation.ua.core.ModifyMonitoredItemsResponse> req)
                                  throws org.opcfoundation.ua.common.ServiceFaultException
Specified by:
onModifyMonitoredItems in interface org.opcfoundation.ua.core.MonitoredItemServiceSetHandler
Throws:
org.opcfoundation.ua.common.ServiceFaultException

onModifySubscription

public final void onModifySubscription(org.opcfoundation.ua.transport.endpoint.EndpointServiceRequest<org.opcfoundation.ua.core.ModifySubscriptionRequest,org.opcfoundation.ua.core.ModifySubscriptionResponse> req)
                                throws org.opcfoundation.ua.common.ServiceFaultException
Specified by:
onModifySubscription in interface org.opcfoundation.ua.core.SubscriptionServiceSetHandler
Throws:
org.opcfoundation.ua.common.ServiceFaultException

onPublish

public final void onPublish(org.opcfoundation.ua.transport.endpoint.EndpointServiceRequest<org.opcfoundation.ua.core.PublishRequest,org.opcfoundation.ua.core.PublishResponse> req)
                     throws org.opcfoundation.ua.common.ServiceFaultException
Specified by:
onPublish in interface org.opcfoundation.ua.core.SubscriptionServiceSetHandler
Throws:
org.opcfoundation.ua.common.ServiceFaultException

onRepublish

public final void onRepublish(org.opcfoundation.ua.transport.endpoint.EndpointServiceRequest<org.opcfoundation.ua.core.RepublishRequest,org.opcfoundation.ua.core.RepublishResponse> req)
                       throws org.opcfoundation.ua.common.ServiceFaultException
Specified by:
onRepublish in interface org.opcfoundation.ua.core.SubscriptionServiceSetHandler
Throws:
org.opcfoundation.ua.common.ServiceFaultException

onSetMonitoringMode

public final void onSetMonitoringMode(org.opcfoundation.ua.transport.endpoint.EndpointServiceRequest<org.opcfoundation.ua.core.SetMonitoringModeRequest,org.opcfoundation.ua.core.SetMonitoringModeResponse> req)
                               throws org.opcfoundation.ua.common.ServiceFaultException
Specified by:
onSetMonitoringMode in interface org.opcfoundation.ua.core.MonitoredItemServiceSetHandler
Throws:
org.opcfoundation.ua.common.ServiceFaultException

onSetPublishingMode

public final void onSetPublishingMode(org.opcfoundation.ua.transport.endpoint.EndpointServiceRequest<org.opcfoundation.ua.core.SetPublishingModeRequest,org.opcfoundation.ua.core.SetPublishingModeResponse> req)
                               throws org.opcfoundation.ua.common.ServiceFaultException
Specified by:
onSetPublishingMode in interface org.opcfoundation.ua.core.SubscriptionServiceSetHandler
Throws:
org.opcfoundation.ua.common.ServiceFaultException

onSetTriggering

public final void onSetTriggering(org.opcfoundation.ua.transport.endpoint.EndpointServiceRequest<org.opcfoundation.ua.core.SetTriggeringRequest,org.opcfoundation.ua.core.SetTriggeringResponse> req)
                           throws org.opcfoundation.ua.common.ServiceFaultException
Specified by:
onSetTriggering in interface org.opcfoundation.ua.core.MonitoredItemServiceSetHandler
Throws:
org.opcfoundation.ua.common.ServiceFaultException

onTransferSubscriptions

public final void onTransferSubscriptions(org.opcfoundation.ua.transport.endpoint.EndpointServiceRequest<org.opcfoundation.ua.core.TransferSubscriptionsRequest,org.opcfoundation.ua.core.TransferSubscriptionsResponse> req)
                                   throws org.opcfoundation.ua.common.ServiceFaultException
Specified by:
onTransferSubscriptions in interface org.opcfoundation.ua.core.SubscriptionServiceSetHandler
Throws:
org.opcfoundation.ua.common.ServiceFaultException

setMaxMonitoredItemsPerCall

public void setMaxMonitoredItemsPerCall(int maxMonitoredItemsPerCall)
Safety limit for the maximum request size for monitored item related requests. Limits the number of nodes that can be requested in one call.

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.

Parameters:
maxMonitoredItemsPerCall - the maxMonitoredItemsPerCall to set

createMonitoredItems

protected void createMonitoredItems(ServiceContext serviceContext,
                                    org.opcfoundation.ua.core.CreateMonitoredItemsRequest request,
                                    org.opcfoundation.ua.core.CreateMonitoredItemsResponse response,
                                    List<org.opcfoundation.ua.core.ReadValueId> itemsToRead,
                                    List<MonitoredDataItem> items)
                             throws ServiceException
Throws:
ServiceException

createSubscription

protected void createSubscription(ServiceContext serviceContext,
                                  org.opcfoundation.ua.core.CreateSubscriptionRequest request,
                                  org.opcfoundation.ua.core.CreateSubscriptionResponse response)
                           throws ServiceException
Throws:
ServiceException

deleteMonitoredItems

protected void deleteMonitoredItems(ServiceContext serviceContext,
                                    org.opcfoundation.ua.core.DeleteMonitoredItemsRequest request,
                                    org.opcfoundation.ua.core.DeleteMonitoredItemsResponse response)
                             throws ServiceException
Throws:
ServiceException

deleteSubscriptions

protected void deleteSubscriptions(ServiceContext serviceContext,
                                   org.opcfoundation.ua.core.DeleteSubscriptionsRequest request,
                                   org.opcfoundation.ua.core.DeleteSubscriptionsResponse response)
                            throws ServiceException
Throws:
ServiceException

getLogger

protected org.slf4j.Logger getLogger()
Overrides:
getLogger in class ServiceHandler
Returns:
the logger

modifyMonitoredItems

protected void modifyMonitoredItems(ServiceContext serviceContext,
                                    org.opcfoundation.ua.core.ModifyMonitoredItemsRequest request,
                                    org.opcfoundation.ua.core.ModifyMonitoredItemsResponse response)
                             throws ServiceException
Throws:
ServiceException

modifySubscription

protected void modifySubscription(ServiceContext serviceContext,
                                  org.opcfoundation.ua.core.ModifySubscriptionRequest request,
                                  org.opcfoundation.ua.core.ModifySubscriptionResponse response)
                           throws ServiceException
Throws:
ServiceException

setMonitoringMode

protected void setMonitoringMode(ServiceContext serviceContext,
                                 org.opcfoundation.ua.core.SetMonitoringModeRequest request,
                                 org.opcfoundation.ua.core.SetMonitoringModeResponse response)
                          throws ServiceException
Throws:
ServiceException

setPublishingMode

protected void setPublishingMode(ServiceContext serviceContext,
                                 org.opcfoundation.ua.core.SetPublishingModeRequest request,
                                 org.opcfoundation.ua.core.SetPublishingModeResponse response)
                          throws ServiceException
Throws:
ServiceException

transferSubscriptions

protected void transferSubscriptions(ServiceContext serviceContext,
                                     org.opcfoundation.ua.core.TransferSubscriptionsRequest request,
                                     org.opcfoundation.ua.core.TransferSubscriptionsResponse response)
                              throws ServiceException
Throws:
ServiceException


Copyright © 2018. All rights reserved.