|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.prosysopc.ua.server.ServiceManagerBase
com.prosysopc.ua.server.EventManager
public abstract class EventManager
OPC UA Event Manager interface. The Event Manager is the OPC UA server component that is responsible of handling event generation and client requests related to event handling.
The base implementation simply dispatches the calls to the registered listener.
| Field Summary | |
|---|---|
protected AtomicReference<EventManagerListener> |
listener
|
protected static org.slf4j.Logger |
logger
|
protected static org.opcfoundation.ua.core.EventFilterResult |
RESULT_OK
|
| Constructor Summary | |
|---|---|
EventManager(NodeManager nodeManager)
The constructor used to create a new EventManager. |
|
| Method Summary | |
|---|---|
protected void |
afterCreateMonitoredEventItem(ServiceContext serviceContext,
Subscription subscription,
MonitoredEventItem item)
|
protected void |
afterDeleteMonitoredEventItem(ServiceContext serviceContext,
Subscription subscription,
MonitoredEventItem item)
|
protected void |
afterModifyMonitoredEventItem(ServiceContext serviceContext,
Subscription subscription,
MonitoredEventItem item)
|
static org.opcfoundation.ua.builtintypes.ByteString |
createEventId(long l)
Create an event ID from a long value |
static org.opcfoundation.ua.builtintypes.ByteString |
createFullEventId(org.opcfoundation.ua.builtintypes.ByteString userEventId)
Creates a new eventId using a user specific ID. |
protected void |
createMonitoredEventItem(ServiceContext serviceContext,
Subscription subscription,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
org.opcfoundation.ua.core.EventFilter filter,
org.opcfoundation.ua.core.EventFilterResult eventFilterResult)
|
protected void |
deleteMonitoredEventItem(ServiceContext serviceContext,
Subscription subscription,
MonitoredEventItem monitoredItem)
|
static org.opcfoundation.ua.builtintypes.ByteString |
extractUserEventId(org.opcfoundation.ua.builtintypes.ByteString fullEventId)
Extract the custom part from the event ID. |
EventManagerListener |
getListener()
The listener implementation that gets notified about event manager related actions. |
NodeManager |
getNodeManager()
The NodeManager that the event manager is serving. |
protected boolean |
methodEqualsIdOrName(UaMethod method,
org.opcfoundation.ua.builtintypes.NodeId methodId,
String methodName)
|
protected void |
modifyMonitoredEventItem(ServiceContext serviceContext,
Subscription subscription,
MonitoredEventItem item,
org.opcfoundation.ua.core.EventFilter eventFilter,
org.opcfoundation.ua.core.EventFilterResult eventFilterResult)
|
boolean |
onCall(ServiceContext serviceContext,
org.opcfoundation.ua.builtintypes.NodeId objectId,
UaNode object,
org.opcfoundation.ua.builtintypes.NodeId methodId,
UaMethod method,
org.opcfoundation.ua.builtintypes.Variant[] inputArguments,
org.opcfoundation.ua.builtintypes.StatusCode[] inputArgumentResults,
org.opcfoundation.ua.builtintypes.DiagnosticInfo[] inputArgumentDiagnosticInfos,
org.opcfoundation.ua.builtintypes.Variant[] output)
A method call notification. |
protected boolean |
refresh(ServiceContext serviceContext,
Subscription subscription)
Handle a ConditionRefresh call from a client. |
protected boolean |
refresh(ServiceContext serviceContext,
Subscription subscription,
MonitoredEventItem monitoredItem)
|
protected void |
refreshEndEvent(MonitoredEventItem monitoredItem)
|
protected void |
refreshEndEvent(Subscription subscription)
Trigger a RefreshEndEventType. |
protected abstract void |
refreshItem(MonitoredEventItem item)
|
protected void |
refreshItems(ServiceContext serviceContext,
Subscription subscription)
Handles condition refresh for a subscription. |
protected void |
refreshStartEvent(MonitoredEventItem monitoredItem)
|
protected void |
refreshStartEvent(Subscription subscription)
Trigger a RefreshStartEventType. |
protected void |
refreshSubscription(ServiceContext serviceContext,
org.opcfoundation.ua.builtintypes.UnsignedInteger subscriptionId)
called internally |
void |
setListener(EventManagerListener l)
Define a listener to the Event Manager to get notifications about client actions. |
| Methods inherited from class com.prosysopc.ua.server.ServiceManagerBase |
|---|
arrayDimensionsMatch, checkIsMethod, checkIsValueNode, checkIsVariable, checkIsVariableOrVariableType, dataTypeEquals, getNode, getNode, getNode, getNode, getNodeManagerTable, getServer, getSubscriptionManager, isValueNode, isVariable, listenerError, requireUaNode |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final org.slf4j.Logger logger
protected static final org.opcfoundation.ua.core.EventFilterResult RESULT_OK
protected final AtomicReference<EventManagerListener> listener
| Constructor Detail |
|---|
public EventManager(NodeManager nodeManager)
The event manager is automatically connected to the node manager.
nodeManager - the node manager that the event manager is serving. Must not be null.| Method Detail |
|---|
public static org.opcfoundation.ua.builtintypes.ByteString createEventId(long l)
throws RuntimeException
RuntimeExceptionpublic static org.opcfoundation.ua.builtintypes.ByteString createFullEventId(org.opcfoundation.ua.builtintypes.ByteString userEventId)
createEventId(long) to create the user specific part which you can provide
to this method or to triggerEvent.
Use #extractUserEventId(byte[]) to get the userEventId out of a full event ID.
userEventId - your own ID for the event.
public static org.opcfoundation.ua.builtintypes.ByteString extractUserEventId(org.opcfoundation.ua.builtintypes.ByteString fullEventId)
fullEventId - the full eventId created by the SDK
public EventManagerListener getListener()
public NodeManager getNodeManager()
public boolean onCall(ServiceContext serviceContext,
org.opcfoundation.ua.builtintypes.NodeId objectId,
UaNode object,
org.opcfoundation.ua.builtintypes.NodeId methodId,
UaMethod method,
org.opcfoundation.ua.builtintypes.Variant[] inputArguments,
org.opcfoundation.ua.builtintypes.StatusCode[] inputArgumentResults,
org.opcfoundation.ua.builtintypes.DiagnosticInfo[] inputArgumentDiagnosticInfos,
org.opcfoundation.ua.builtintypes.Variant[] output)
throws StatusException
CallableListenerUse onCall to check whether the called method is the one that you handle. If so, return true, and set the outputs. Do not create a new array for the outputs, just assign your values in there - it is already created for the length defined by the OutputArguments of the UaMethod.
If you find errors in the inputArguments, fill in the inputArgumentResults and inputArgumentDiagnosticInfos respectively. They are also preallocated.
onCall in interface CallableListenerobjectId - the ID of the node whose method is being calledobject - the object node whose method is being called, if availablemethodId - the ID of the method being calledmethod - the method node being called, if availableinputArguments - input argument valuesinputArgumentResults - room for argument errors. Fill in the array if you encounter errors
in the values.inputArgumentDiagnosticInfos - room for diagnostic info, in case of errors.output - room for output values. The array is pre-created, so just fill in the values.
StatusException - if there are errors in the method handling. For example, if you set
inputArgumentResults, you should throw a StatusException with
StatusCodes.Bad_InvalidArgumentpublic void setListener(EventManagerListener l)
The listener gives you a simple mechanism to react to actions in any node manager. The alternative is to implement your own event manager, but the listener is typically a simpler way to do the same.
l - your EventManagerListener implementation. Use null to clear the setting (it will
change the listener to an internal NULL_LISTENER).EventManagerListener
protected void afterCreateMonitoredEventItem(ServiceContext serviceContext,
Subscription subscription,
MonitoredEventItem item)
serviceContext - subscription - item -
protected void afterDeleteMonitoredEventItem(ServiceContext serviceContext,
Subscription subscription,
MonitoredEventItem item)
serviceContext - subscription - item -
protected void afterModifyMonitoredEventItem(ServiceContext serviceContext,
Subscription subscription,
MonitoredEventItem item)
serviceContext - subscription - item -
protected void createMonitoredEventItem(ServiceContext serviceContext,
Subscription subscription,
org.opcfoundation.ua.builtintypes.NodeId nodeId,
org.opcfoundation.ua.core.EventFilter filter,
org.opcfoundation.ua.core.EventFilterResult eventFilterResult)
throws StatusException
StatusException
protected void deleteMonitoredEventItem(ServiceContext serviceContext,
Subscription subscription,
MonitoredEventItem monitoredItem)
protected boolean methodEqualsIdOrName(UaMethod method,
org.opcfoundation.ua.builtintypes.NodeId methodId,
String methodName)
method - methodId - methodName -
protected void modifyMonitoredEventItem(ServiceContext serviceContext,
Subscription subscription,
MonitoredEventItem item,
org.opcfoundation.ua.core.EventFilter eventFilter,
org.opcfoundation.ua.core.EventFilterResult eventFilterResult)
throws StatusException
StatusException
protected boolean refresh(ServiceContext serviceContext,
Subscription subscription)
throws StatusException
The method gets called for every Subscription in the server.
The method goes through all MonitoredEventItems of the Subscription and calls
refreshStartEvent(MonitoredEventItem), #refreshItems(MonitoredEventItem) and
refreshEndEvent(MonitoredEventItem) for every item.
serviceContext - the client calling context.subscription - the subscription to refresh
StatusException - if refresh is not allowed, for example
protected boolean refresh(ServiceContext serviceContext,
Subscription subscription,
MonitoredEventItem monitoredItem)
throws StatusException
StatusExceptionprotected void refreshEndEvent(MonitoredEventItem monitoredItem)
protected void refreshEndEvent(Subscription subscription)
#refreshItems() is called.
The default implementation triggers the standard event of type RefreshEndEventType for every
monitored event item.
subscription - must not be nullprotected abstract void refreshItem(MonitoredEventItem item)
item -
protected void refreshItems(ServiceContext serviceContext,
Subscription subscription)
throws StatusException
serviceContext - the client calling context.subscription - must not be null
StatusExceptionprotected void refreshStartEvent(MonitoredEventItem monitoredItem)
protected void refreshStartEvent(Subscription subscription)
#refreshItems() is
called. The default implementation triggers the standard event of type RefreshStartEventType
for every monitored event item.
subscription - must not be null
protected void refreshSubscription(ServiceContext serviceContext,
org.opcfoundation.ua.builtintypes.UnsignedInteger subscriptionId)
throws StatusException,
ServiceException
serviceContext - subscriptionId -
StatusException
ServiceException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||