com.prosysopc.ua.client.nodes
Class UaObjectImpl

java.lang.Object
  extended by com.prosysopc.ua.nodes.AbstractUaNode
      extended by com.prosysopc.ua.client.nodes.UaNodeImpl
          extended by com.prosysopc.ua.client.nodes.UaInstanceImpl
              extended by com.prosysopc.ua.client.nodes.UaObjectImpl
All Implemented Interfaces:
UaInstance, UaNode, UaObject
Direct Known Subclasses:
BaseObjectTypeImpl, UaFolder

public class UaObjectImpl
extends UaInstanceImpl
implements UaObject

Straight forward implementation of UaObject.

It keeps all attributes in memory.


Field Summary
 
Fields inherited from class com.prosysopc.ua.client.nodes.UaNodeImpl
addressSpace, references, supportedAttributesMap
 
Constructor Summary
UaObjectImpl(AddressSpace addressSpace, org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.core.NodeClass nodeClass, org.opcfoundation.ua.builtintypes.QualifiedName browseName, org.opcfoundation.ua.builtintypes.LocalizedText displayName, org.opcfoundation.ua.builtintypes.LocalizedText description, EnumSet<WriteAccess> writeMask, EnumSet<WriteAccess> userWriteMask, UaClientReference[] references, UaProperty[] properties, EnumSet<EventNotifierClass> eventNotifier)
           
UaObjectImpl(AddressSpace addressSpace, org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.builtintypes.QualifiedName browseName, org.opcfoundation.ua.builtintypes.LocalizedText displayName)
          Create a new object node
UaObjectImpl(AddressSpace addressSpace, org.opcfoundation.ua.builtintypes.NodeId nodeId, String name, Locale locale)
          Create a new object node with name.
 
Method Summary
 UaReference addComponent(UaNode node)
          Adds a new component to the Object.
protected
<T> T
call(org.opcfoundation.ua.builtintypes.NodeId methodId, MethodArgumentTransformer<T> outputTransformer, Object... inputArgs)
          Helper method for generated code.
 org.opcfoundation.ua.builtintypes.Variant[] call(org.opcfoundation.ua.builtintypes.NodeId methodId, Object... args)
          Call a method for this object in the server.
 org.opcfoundation.ua.builtintypes.Variant[] call(org.opcfoundation.ua.builtintypes.NodeId methodId, org.opcfoundation.ua.builtintypes.Variant[] variantArgs)
          Call a method for this object in the server.
protected
<T> org.opcfoundation.ua.transport.AsyncResult<T>
callAsync(org.opcfoundation.ua.builtintypes.NodeId methodId, MethodArgumentTransformer<T> outputTransformer, Object... inputArgs)
          Helper method for generated code.
 org.opcfoundation.ua.transport.AsyncResult<Object[]> callAsync(org.opcfoundation.ua.builtintypes.NodeId nodeId, Object... inputArgs)
          Call a method on the object asynchronously.
 org.opcfoundation.ua.transport.AsyncResult<Object[]> callAsync(org.opcfoundation.ua.builtintypes.NodeId methodId, org.opcfoundation.ua.builtintypes.Variant[] variantArgs)
          Call a method for this object in the server.
 Object[] callMethod(org.opcfoundation.ua.builtintypes.NodeId methodId, Object... inputArgs)
          Call a method on the object.
 org.opcfoundation.ua.core.NodeAttributes getAttributes()
           
protected  org.opcfoundation.ua.core.NodeAttributes getAttributes(org.opcfoundation.ua.core.ObjectAttributes attributes)
           
 EnumSet<EventNotifierClass> getEventNotifier()
          Defines whether the node can be used to subscribe to events.
 UaProperty getIcon()
          The Icon Property provides an image that can be used by clients when displaying the Node.
 org.opcfoundation.ua.core.NodeClass getNodeClass()
          The NodeClass Attribute identifies the NodeClass of a Node.
protected  void initSupportedAttributes(List<org.opcfoundation.ua.builtintypes.UnsignedInteger> l)
           
protected  void readAttributeValue(org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId, org.opcfoundation.ua.builtintypes.DataValue dataValue)
          Read the value of an attribute.
 void setAttributes(org.opcfoundation.ua.core.ObjectAttributes objectAttributes)
           
 void setEventNotifier(EnumSet<EventNotifierClass> eventNotifier)
          Define which kind of events the object generates.
 void setIcon(UaProperty icon)
          Set the value of the Icon property.
 String toString()
           
protected  void writeAttributeValue(org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId, Object value, org.opcfoundation.ua.builtintypes.StatusCode statusCode, org.opcfoundation.ua.builtintypes.DateTime sourceTime, org.opcfoundation.ua.builtintypes.UnsignedShort sourcePicoseconds)
           
 
Methods inherited from class com.prosysopc.ua.client.nodes.UaInstanceImpl
getTypeDefinition, getTypeDefinitionId, setTypeDefinition, setTypeDefinitionId, setTypeDefinitionId
 
Methods inherited from class com.prosysopc.ua.client.nodes.UaNodeImpl
addProperties, addProperty, addReference, addReference, addReference, addReference, afterAddReference, afterDeleteReference, assertTypeSupport, assertTypeSupport, beforeAddReference, deleteReference, deleteReference, deleteReference, deleteReference, deleteReferences, doAddProperty, equals, findPlaceholders, getAddressSpace, getAttributes, getBrowseName, getComponent, getComponents, getDescription, getDescription, getDisplayName, getDisplayName, getMethod, getNodeId, getNodeVersion, getNodeVersionString, getProperties, getProperty, getPropertyValue, getReference, getReferenceList, getReferences, getSupportedAttributes, getUserWriteMask, getWriteMask, hashCode, hasProperty, hasTypeDefinition, hasUserWriteAccess, hasWriteAccess, readAttribute, readAttribute, referenceTypeInherits, removeComponent, removeProperty, setAttribute, setAttributes, setBrowseName, setDescription, setDisplayName, setNodeVersion, setPropertyValue, setReferences, setUserWriteMask, setWriteMask, supportsAttribute, writeAttribute
 
Methods inherited from class com.prosysopc.ua.nodes.AbstractUaNode
getForwardReferences, getInverseReferences, getReferences, getReferences, getReferencesAsList, referenceTypeInherits
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.prosysopc.ua.nodes.UaInstance
getTypeDefinition, getTypeDefinitionId, setTypeDefinition, setTypeDefinitionId, setTypeDefinitionId
 
Methods inherited from interface com.prosysopc.ua.nodes.UaNode
addProperty, addReference, addReference, addReference, deleteReference, deleteReference, deleteReference, deleteReference, getAddressSpace, getBrowseName, getComponent, getComponents, getDescription, getDisplayName, getForwardReferences, getInverseReferences, getMethod, getNodeId, getNodeVersion, getProperties, getProperty, getReference, getReferences, getReferences, getSupportedAttributes, getUserWriteMask, getWriteMask, hasUserWriteAccess, hasWriteAccess, readAttribute, readAttribute, removeComponent, removeProperty, setAttribute, setAttributes, setBrowseName, setDescription, setDisplayName, setReferences, setUserWriteMask, setWriteMask, supportsAttribute, writeAttribute
 

Constructor Detail

UaObjectImpl

public UaObjectImpl(AddressSpace addressSpace,
                    org.opcfoundation.ua.builtintypes.NodeId nodeId,
                    org.opcfoundation.ua.core.NodeClass nodeClass,
                    org.opcfoundation.ua.builtintypes.QualifiedName browseName,
                    org.opcfoundation.ua.builtintypes.LocalizedText displayName,
                    org.opcfoundation.ua.builtintypes.LocalizedText description,
                    EnumSet<WriteAccess> writeMask,
                    EnumSet<WriteAccess> userWriteMask,
                    UaClientReference[] references,
                    UaProperty[] properties,
                    EnumSet<EventNotifierClass> eventNotifier)

UaObjectImpl

public UaObjectImpl(AddressSpace addressSpace,
                    org.opcfoundation.ua.builtintypes.NodeId nodeId,
                    org.opcfoundation.ua.builtintypes.QualifiedName browseName,
                    org.opcfoundation.ua.builtintypes.LocalizedText displayName)
Create a new object node

Parameters:
nodeId - The node identifier
browseName - The BrowseName of the node
displayName - The DisplayName of the node

UaObjectImpl

public UaObjectImpl(AddressSpace addressSpace,
                    org.opcfoundation.ua.builtintypes.NodeId nodeId,
                    String name,
                    Locale locale)
Create a new object node with name.

Parameters:
nodeId - The node identifier
name - The browse and display name of the object. The NamespaceIndex of the nodeId is also used for the BrowseName.
locale - The locale of the name, used for the DisplayName
Method Detail

addComponent

public UaReference addComponent(UaNode node)
                         throws IllegalArgumentException
Adds a new component to the Object. Creates a new HasComponent reference with target set to the node. The node must be a data variable, object or method.

Specified by:
addComponent in interface UaNode
Overrides:
addComponent in class UaNodeImpl
Parameters:
node - the component node
Returns:
the HasComponent reference that was added (or existed already)
Throws:
IllegalArgumentException - if the node is not of the correct class (see above)
See Also:
UaNode.addReference(UaNode, NodeId, boolean)

call

public org.opcfoundation.ua.builtintypes.Variant[] call(org.opcfoundation.ua.builtintypes.NodeId methodId,
                                                        Object... args)
                                                 throws MethodCallStatusException,
                                                        ServiceException
Call a method for this object in the server.

This is a shortcut to UaClient.call(NodeId, NodeId, Variant...).

Parameters:
methodId - the method to call
args - values for the method input arguments: they will be converted to variants before making the call.
Returns:
the output arguments if the method call succeeds
Throws:
ServiceException - if the call fails due to connection problems, etc.
MethodCallStatusException - if the call fails due to invalid arguments or something like that.

call

public org.opcfoundation.ua.builtintypes.Variant[] call(org.opcfoundation.ua.builtintypes.NodeId methodId,
                                                        org.opcfoundation.ua.builtintypes.Variant[] variantArgs)
                                                 throws ServiceException,
                                                        MethodCallStatusException
Call a method for this object in the server.

This is a shortcut to UaClient.call(NodeId, NodeId, Variant...).

Parameters:
methodId - the method to call
variantArgs - values for the method input arguments
Returns:
the output arguments if the method call succeeds
Throws:
ServiceException - if the call fails due to connection problems, etc.
MethodCallStatusException - if the call fails due to invalid arguments or something like that.

callAsync

public org.opcfoundation.ua.transport.AsyncResult<Object[]> callAsync(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                                                      Object... inputArgs)
Call a method on the object asynchronously.

Parameters:
methodId - id of the method
inputArgs - input arguments for the method call
Returns:
AsyncResult, which can be monitored for the return of the call. The response is provided as and Object array, which contains the Variant values returned by the server to objects that can be used directly. If the method call fails, the error contains the respective ServiceResultException.

callAsync

public org.opcfoundation.ua.transport.AsyncResult<Object[]> callAsync(org.opcfoundation.ua.builtintypes.NodeId methodId,
                                                                      org.opcfoundation.ua.builtintypes.Variant[] variantArgs)
Call a method for this object in the server.

This is a shortcut to UaClient.call(NodeId, NodeId, Variant...).

Parameters:
methodId - the method to call
variantArgs - values for the method input arguments
Returns:
AsyncResult, which can be monitored for the return of the call. The response is provided as and Object array, which contains the Variant values returned by the server to objects that can be used directly. If the method call fails, the error contains the respective ServiceResultException.

callMethod

public Object[] callMethod(org.opcfoundation.ua.builtintypes.NodeId methodId,
                           Object... inputArgs)
                    throws MethodCallStatusException,
                           ServiceException
Call a method on the object.

Specified by:
callMethod in interface UaObject
Parameters:
methodId - id of the method
inputArgs - input arguments for the method call
Returns:
output arguments for the method call
Throws:
ServiceException - if the call fails due to connection problems, etc.
MethodCallStatusException - if the call fails due to invalid arguments or something like that.

getAttributes

public org.opcfoundation.ua.core.NodeAttributes getAttributes()
Specified by:
getAttributes in interface UaNode
Returns:
the current attribute values of the node in a NodeAttributes structure.

getEventNotifier

public EnumSet<EventNotifierClass> getEventNotifier()
Description copied from interface: UaObject
Defines whether the node can be used to subscribe to events. The set can contain one or several of the following values.
Value Description
SubscribeToEvents Indicates if it can be used to subscribe to Events (0 means cannot be used to subscribe to Events, 1 means can be used to subscribe to Events).
HistoryRead Indicates if the history of the Events is readable (0 means not readable, 1 means readable).
HistoryWrite Indicates if the history of the Events is writable (0 means not writable, 1 means writable).
HistoryRead and HistoryWrite also indicate if the history of the Events is available via the OPC UA server.

Specified by:
getEventNotifier in interface UaObject
Returns:
the current value of the EventNotifier attribute

getIcon

public UaProperty getIcon()
Description copied from interface: UaObject
The Icon Property provides an image that can be used by clients when displaying the Node.

Specified by:
getIcon in interface UaObject
Returns:
the Icon property. This is an optional property, so it may be null, if the property is not defined.

getNodeClass

public final org.opcfoundation.ua.core.NodeClass getNodeClass()
Description copied from interface: UaNode
The NodeClass Attribute identifies the NodeClass of a Node.

Specified by:
getNodeClass in interface UaNode
Overrides:
getNodeClass in class UaNodeImpl
Returns:
the Node Class of the node. This is hard-coded and cannot be changed.

setAttributes

public void setAttributes(org.opcfoundation.ua.core.ObjectAttributes objectAttributes)

setEventNotifier

public void setEventNotifier(EnumSet<EventNotifierClass> eventNotifier)
Description copied from interface: UaObject
Define which kind of events the object generates.

Specified by:
setEventNotifier in interface UaObject
Parameters:
eventNotifier - the set of event types that the object generates

setIcon

public void setIcon(UaProperty icon)
             throws StatusException
Description copied from interface: UaObject
Set the value of the Icon property. If the property already exists, the value is copied from the parameter.

Specified by:
setIcon in interface UaObject
Parameters:
icon - the Icon to set
Throws:
StatusException
See Also:
UaObject.getIcon()

toString

public String toString()
Overrides:
toString in class UaInstanceImpl

call

protected <T> T call(org.opcfoundation.ua.builtintypes.NodeId methodId,
                     MethodArgumentTransformer<T> outputTransformer,
                     Object... inputArgs)
          throws MethodCallStatusException,
                 ServiceException
Helper method for generated code.

Throws:
MethodCallStatusException
ServiceException

callAsync

protected <T> org.opcfoundation.ua.transport.AsyncResult<T> callAsync(org.opcfoundation.ua.builtintypes.NodeId methodId,
                                                                      MethodArgumentTransformer<T> outputTransformer,
                                                                      Object... inputArgs)
Helper method for generated code.


getAttributes

protected org.opcfoundation.ua.core.NodeAttributes getAttributes(org.opcfoundation.ua.core.ObjectAttributes attributes)

initSupportedAttributes

protected void initSupportedAttributes(List<org.opcfoundation.ua.builtintypes.UnsignedInteger> l)
Overrides:
initSupportedAttributes in class UaNodeImpl

readAttributeValue

protected void readAttributeValue(org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
                                  org.opcfoundation.ua.builtintypes.DataValue dataValue)
                           throws StatusException
Description copied from class: UaNodeImpl
Read the value of an attribute.

Overrides:
readAttributeValue in class UaNodeImpl
Parameters:
attributeId - the ID of the attribute to read.
dataValue - the DataValue structure in which the value is set.
Throws:
StatusException

writeAttributeValue

protected void writeAttributeValue(org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
                                   Object value,
                                   org.opcfoundation.ua.builtintypes.StatusCode statusCode,
                                   org.opcfoundation.ua.builtintypes.DateTime sourceTime,
                                   org.opcfoundation.ua.builtintypes.UnsignedShort sourcePicoseconds)
                            throws StatusException
Overrides:
writeAttributeValue in class UaNodeImpl
Throws:
StatusException


Copyright © 2018. All rights reserved.