public abstract class AbstractMethodInvocationHandler extends Object implements MethodInvocationHandler
MethodInvocationHandler that handles checking the Executable and UserExecutable
attributes as well as validating the supplied input values against the input Arguments.| Modifier and Type | Class and Description |
|---|---|
static interface |
AbstractMethodInvocationHandler.InvocationContext
Extends
AccessContext to provide additional context to implementations of
AbstractMethodInvocationHandler. |
MethodInvocationHandler.NodeIdUnknownHandler, MethodInvocationHandler.NotImplementedHandlerNODE_ID_UNKNOWN, NOT_IMPLEMENTED| Constructor and Description |
|---|
AbstractMethodInvocationHandler(UaMethodNode node) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkExecutableAttributes(AccessContext accessContext)
Check that the Executable and UserExecutable attributes are
true. |
abstract Argument[] |
getInputArguments()
Get the input
Arguments expected by the Method this handler is installed on. |
UaMethodNode |
getNode() |
abstract Argument[] |
getOutputArguments()
Get the output
Arguments expected by the Method this handler is installed on. |
protected abstract Variant[] |
invoke(AbstractMethodInvocationHandler.InvocationContext invocationContext,
Variant[] inputValues)
Invoke this method and return the values for its output arguments, if any.
|
CallMethodResult |
invoke(AccessContext accessContext,
CallMethodRequest request)
Invoke the given
CallMethodRequest and complete future when finished. |
protected void |
validateInputArgumentValues(Variant[] inputArgumentValues)
Validate the input values against the expected input arguments.
|
public AbstractMethodInvocationHandler(UaMethodNode node)
node - the UaMethodNode this handler will be installed on.public UaMethodNode getNode()
public final CallMethodResult invoke(AccessContext accessContext, CallMethodRequest request)
MethodInvocationHandlerCallMethodRequest and complete future when finished.
Under no circumstances should the future be completed exceptionally.
invoke in interface MethodInvocationHandleraccessContext - the AccessContext.request - the CallMethodRequest.CallMethodResult.protected void checkExecutableAttributes(AccessContext accessContext) throws UaException
true.accessContext - the AccessContext.UaException - if either Executable or UserExecutable attributes are not true.public abstract Argument[] getInputArguments()
Arguments expected by the Method this handler is installed on.Arguments expected by the Method this handler is installed on.public abstract Argument[] getOutputArguments()
Arguments expected by the Method this handler is installed on.Arguments expected by the Method this handler is installed on.protected abstract Variant[] invoke(AbstractMethodInvocationHandler.InvocationContext invocationContext, Variant[] inputValues) throws UaException
The Executable and UserExecutable attributes have already been checked to ensure this method is allowed to execute.
invocationContext - the AbstractMethodInvocationHandler.InvocationContext.inputValues - the user-supplied values for the input arguments. Each value has been verified to be of
the type specified by its Argument.UaException - if invocation has failed for some reason.protected void validateInputArgumentValues(Variant[] inputArgumentValues) throws InvalidArgumentException
The DataType of each input value has already been verified; implementations need only verify the value is "valid", if applicable, and throw InvalidArgumentException with a StatusCode of Bad_OutOfRange for any invalid input values.
inputArgumentValues - the input values provided by the client for the current method call.InvalidArgumentException - if one or more input argument values are invalid.Copyright © 2021. All rights reserved.