From 26ae3625c82ed8b70bcbc03afcec40de4d30137a Mon Sep 17 00:00:00 2001 From: Kevin Herron Date: Fri, 22 Nov 2019 19:05:19 -0800 Subject: [PATCH] Implement common Node Property accessors for client Nodes (#572) --- .../examples/server/ExampleNamespace.java | 8 +- .../sdk/client/api/nodes/MethodNode.java | 92 -------- .../sdk/client/nodes/UaDataTypeNode.java | 88 +++++++ .../opcua/sdk/client/nodes/UaMethodNode.java | 83 ++++++- .../milo/opcua/sdk/client/nodes/UaNode.java | 2 +- .../opcua/sdk/client/nodes/UaObjectNode.java | 66 ++++++ .../sdk/client/nodes/UaObjectTypeNode.java | 44 ++++ .../sdk/client/nodes/UaReferenceTypeNode.java | 22 ++ .../sdk/client/nodes/UaVariableNode.java | 194 +++++++++++++++ .../sdk/client/nodes/UaVariableTypeNode.java | 22 ++ .../opcua/sdk/client/nodes/UaViewNode.java | 44 ++++ .../core/nodes/DataTypeNodeProperties.java | 97 ++++++++ .../sdk/core/nodes/MethodNodeProperties.java | 68 ++++++ .../sdk/core/nodes/ObjectNodeProperties.java | 65 ++++++ .../core/nodes/ObjectTypeNodeProperties.java | 51 ++++ .../nodes/ReferenceTypeNodeProperties.java | 34 +++ .../core/nodes/VariableNodeProperties.java | 196 ++++++++++++++++ .../nodes/VariableTypeNodeProperties.java | 43 ++++ .../sdk/core/nodes/ViewNodeProperties.java | 54 +++++ .../sdk/server/nodes/UaDataTypeNode.java | 104 ++++++--- .../opcua/sdk/server/nodes/UaMethodNode.java | 86 ++++--- .../opcua/sdk/server/nodes/UaObjectNode.java | 82 ++++--- .../sdk/server/nodes/UaObjectTypeNode.java | 58 +++-- .../sdk/server/nodes/UaReferenceTypeNode.java | 31 +-- .../sdk/server/nodes/UaVariableNode.java | 221 ++++++++++-------- .../sdk/server/nodes/UaVariableTypeNode.java | 32 +-- .../opcua/sdk/server/nodes/UaViewNode.java | 57 +++-- 27 files changed, 1576 insertions(+), 368 deletions(-) create mode 100644 opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/DataTypeNodeProperties.java create mode 100644 opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/MethodNodeProperties.java create mode 100644 opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/ObjectNodeProperties.java create mode 100644 opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/ObjectTypeNodeProperties.java create mode 100644 opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/ReferenceTypeNodeProperties.java create mode 100644 opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/VariableNodeProperties.java create mode 100644 opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/VariableTypeNodeProperties.java create mode 100644 opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/ViewNodeProperties.java diff --git a/milo-examples/server-examples/src/main/java/org/eclipse/milo/examples/server/ExampleNamespace.java b/milo-examples/server-examples/src/main/java/org/eclipse/milo/examples/server/ExampleNamespace.java index cecec816f..0ed22bf77 100644 --- a/milo-examples/server-examples/src/main/java/org/eclipse/milo/examples/server/ExampleNamespace.java +++ b/milo-examples/server-examples/src/main/java/org/eclipse/milo/examples/server/ExampleNamespace.java @@ -527,8 +527,8 @@ private void addSqrtMethod(UaFolderNode folderNode) { .build(); SqrtMethod sqrtMethod = new SqrtMethod(methodNode); - methodNode.setProperty(UaMethodNode.InputArguments, sqrtMethod.getInputArguments()); - methodNode.setProperty(UaMethodNode.OutputArguments, sqrtMethod.getOutputArguments()); + methodNode.setInputArguments(sqrtMethod.getInputArguments()); + methodNode.setOutputArguments(sqrtMethod.getOutputArguments()); methodNode.setInvocationHandler(sqrtMethod); getNodeManager().addNode(methodNode); @@ -551,8 +551,8 @@ private void addGenerateEventMethod(UaFolderNode folderNode) { .build(); GenerateEventMethod generateEventMethod = new GenerateEventMethod(methodNode); - methodNode.setProperty(UaMethodNode.InputArguments, generateEventMethod.getInputArguments()); - methodNode.setProperty(UaMethodNode.OutputArguments, generateEventMethod.getOutputArguments()); + methodNode.setInputArguments(generateEventMethod.getInputArguments()); + methodNode.setOutputArguments(generateEventMethod.getOutputArguments()); methodNode.setInvocationHandler(generateEventMethod); getNodeManager().addNode(methodNode); diff --git a/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/api/nodes/MethodNode.java b/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/api/nodes/MethodNode.java index df99e0e79..d37040b44 100644 --- a/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/api/nodes/MethodNode.java +++ b/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/api/nodes/MethodNode.java @@ -12,62 +12,11 @@ import java.util.concurrent.CompletableFuture; -import org.eclipse.milo.opcua.sdk.core.QualifiedProperty; -import org.eclipse.milo.opcua.sdk.core.ValueRanks; -import org.eclipse.milo.opcua.stack.core.Identifiers; -import org.eclipse.milo.opcua.stack.core.StatusCodes; -import org.eclipse.milo.opcua.stack.core.UaException; import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue; import org.eclipse.milo.opcua.stack.core.types.builtin.StatusCode; -import org.eclipse.milo.opcua.stack.core.types.structured.Argument; -import org.eclipse.milo.opcua.stack.core.util.Namespaces; public interface MethodNode extends Node { - /** - * The NodeVersion Property is used to indicate the version of a Node. - *

- * The NodeVersion Property is updated each time a Reference is added or deleted to the Node the Property belongs - * to. Attribute value changes do not cause the NodeVersion to change. Clients may read the NodeVersion Property or - * subscribe to it to determine when the structure of a Node has changed. - * - * @see MethodNode#getNodeVersion() - */ - QualifiedProperty NodeVersion = new QualifiedProperty<>( - Namespaces.OPC_UA, - "NodeVersion", - Identifiers.String, - ValueRanks.Scalar, - String.class - ); - - /** - * The InputArguments Property is used to specify the arguments that shall be used by a client when calling the - * Method. - * - * @see MethodNode#getInputArguments() - */ - QualifiedProperty InputArguments = new QualifiedProperty<>( - Namespaces.OPC_UA, - "InputArguments", - Identifiers.Argument, - ValueRanks.OneDimension, - Argument[].class - ); - - /** - * The OutputArguments Property specifies the result returned from the Method call. - * - * @see MethodNode#getOutputArguments() - */ - QualifiedProperty OutputArguments = new QualifiedProperty<>( - Namespaces.OPC_UA, - "OutputArguments", - Identifiers.Argument, - ValueRanks.OneDimension, - Argument[].class - ); - /** * Get the Executable attribute. *

@@ -132,45 +81,4 @@ public interface MethodNode extends Node { */ CompletableFuture writeUserExecutable(DataValue value); - /** - * Get the value of the NodeVersion Property, if it exists. - *

- * The NodeVersion Property is used to indicate the version of a Node. - *

- * The NodeVersion Property is updated each time a Reference is added or deleted to the Node the Property belongs - * to. Attribute value changes do not cause the NodeVersion to change. Clients may read the NodeVersion Property or - * subscribe to it to determine when the structure of a Node has changed. - *

- * This Property is optional. If not present, the future will be completed exceptionally with a {@link UaException} - * indicating {@link StatusCodes#Bad_NotFound}. - * - * @return the value of the NodeVersion Property, if it exists. - */ - CompletableFuture getNodeVersion(); - - /** - * Get the value of the InputArguments Property, if it exists. - *

- * The InputArguments Property is used to specify the arguments that shall be used by a client when calling the - * Method. - *

- * This Property is optional. If not present, the future will be completed exceptionally with a {@link UaException} - * indicating {@link StatusCodes#Bad_NotFound}. - * - * @return the value of the InputArguments Property, if it exists. - */ - CompletableFuture getInputArguments(); - - /** - * Get the value of the OutputArguments Property, if it exists. - *

- * The OutputArguments Property specifies the result returned from the Method call. - *

- * This Property is optional. If not present, the future will be completed exceptionally with a {@link UaException} - * indicating {@link StatusCodes#Bad_NotFound}. - * - * @return the value of the OutputArguments Property, if it exists. - */ - CompletableFuture getOutputArguments(); - } diff --git a/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaDataTypeNode.java b/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaDataTypeNode.java index abe323a75..5ee00e46a 100644 --- a/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaDataTypeNode.java +++ b/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaDataTypeNode.java @@ -14,12 +14,16 @@ import org.eclipse.milo.opcua.sdk.client.OpcUaClient; import org.eclipse.milo.opcua.sdk.client.api.nodes.DataTypeNode; +import org.eclipse.milo.opcua.sdk.core.nodes.DataTypeNodeProperties; import org.eclipse.milo.opcua.stack.core.AttributeId; import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue; +import org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText; import org.eclipse.milo.opcua.stack.core.types.builtin.NodeId; import org.eclipse.milo.opcua.stack.core.types.builtin.StatusCode; import org.eclipse.milo.opcua.stack.core.types.builtin.Variant; +import org.eclipse.milo.opcua.stack.core.types.structured.EnumValueType; +import static org.eclipse.milo.opcua.sdk.core.nodes.DataTypeNodeProperties.NodeVersion; import static org.eclipse.milo.opcua.stack.core.types.builtin.DataValue.valueOnly; public class UaDataTypeNode extends UaNode implements DataTypeNode { @@ -48,4 +52,88 @@ public CompletableFuture writeIsAbstract(DataValue value) { return writeAttribute(AttributeId.IsAbstract, value); } + /** + * Get the value of the {@link DataTypeNodeProperties#NodeVersion} Property, if it exists. + * + * @return the value of the NodeVersion Property, if it exists. + * @see DataTypeNodeProperties + */ + public CompletableFuture getNodeVersion() { + return getProperty(DataTypeNodeProperties.NodeVersion); + } + + /** + * Get the value of the {@link DataTypeNodeProperties#EnumStrings} Property, if it exists. + * + * @return the value of the EnumStrings Property, if it exists. + * @see DataTypeNodeProperties + */ + public CompletableFuture getEnumStrings() { + return getProperty(DataTypeNodeProperties.EnumStrings); + } + + /** + * Get the value of the {@link DataTypeNodeProperties#EnumValues} Property, if it exists. + * + * @return the value of the EnumValues Property, if it exists. + * @see DataTypeNodeProperties + */ + public CompletableFuture getEnumValues() { + return getProperty(DataTypeNodeProperties.EnumValues); + } + + /** + * Get the value of the {@link DataTypeNodeProperties#OptionSetValues} Property, if it exists. + * + * @return the value of the OptionSetValues Property, if it exists. + * @see DataTypeNodeProperties + */ + public CompletableFuture getOptionSetValues() { + return getProperty(DataTypeNodeProperties.OptionSetValues); + } + + /** + * Set the value of the {@link DataTypeNodeProperties#NodeVersion} Property, if it exists. + * + * @param nodeVersion the value to set. + * @return a {@link CompletableFuture} that completes with the {@link StatusCode} of the write operation. + * @see DataTypeNodeProperties + */ + public CompletableFuture setNodeVersion(String nodeVersion) { + return setProperty(NodeVersion, nodeVersion); + } + + /** + * Set the value of the EnumStrings Property, if it exists. + * + * @param enumStrings the value to set. + * @return a {@link CompletableFuture} that completes with the {@link StatusCode} of the write operation. + * @see DataTypeNodeProperties + */ + public CompletableFuture setEnumStrings(LocalizedText[] enumStrings) { + return setProperty(DataTypeNodeProperties.EnumStrings, enumStrings); + } + + /** + * Set the value of the {@link DataTypeNodeProperties#EnumValues} Property, if it exists. + * + * @param enumValues the value to set. + * @return a {@link CompletableFuture} that completes with the {@link StatusCode} of the write operation. + * @see DataTypeNodeProperties + */ + public CompletableFuture setEnumValues(EnumValueType[] enumValues) { + return setProperty(DataTypeNodeProperties.EnumValues, enumValues); + } + + /** + * Set the value of the {@link DataTypeNodeProperties#OptionSetValues} Property, if it exists. + * + * @param optionSetValues the value to set. + * @return a {@link CompletableFuture} that completes with the {@link StatusCode} of the write operation. + * @see DataTypeNodeProperties + */ + public CompletableFuture setOptionSetValues(LocalizedText[] optionSetValues) { + return setProperty(DataTypeNodeProperties.OptionSetValues, optionSetValues); + } + } diff --git a/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaMethodNode.java b/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaMethodNode.java index 5254cd82b..7c92af619 100644 --- a/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaMethodNode.java +++ b/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaMethodNode.java @@ -14,7 +14,10 @@ import org.eclipse.milo.opcua.sdk.client.OpcUaClient; import org.eclipse.milo.opcua.sdk.client.api.nodes.MethodNode; +import org.eclipse.milo.opcua.sdk.core.nodes.MethodNodeProperties; import org.eclipse.milo.opcua.stack.core.AttributeId; +import org.eclipse.milo.opcua.stack.core.StatusCodes; +import org.eclipse.milo.opcua.stack.core.UaException; import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue; import org.eclipse.milo.opcua.stack.core.types.builtin.NodeId; import org.eclipse.milo.opcua.stack.core.types.builtin.StatusCode; @@ -69,19 +72,87 @@ public CompletableFuture writeUserExecutable(DataValue value) { return writeAttribute(AttributeId.UserExecutable, value); } - @Override + /** + * Get the value of the {@link MethodNodeProperties#NodeVersion} Property, if it exists. + *

+ * The NodeVersion Property is used to indicate the version of a Node. + *

+ * The NodeVersion Property is updated each time a Reference is added or deleted to the Node the Property belongs + * to. Attribute value changes do not cause the NodeVersion to change. Clients may read the NodeVersion Property or + * subscribe to it to determine when the structure of a Node has changed. + *

+ * This Property is optional. If not present, the future will be completed exceptionally with a {@link UaException} + * indicating {@link StatusCodes#Bad_NotFound}. + * + * @return the value of the NodeVersion Property, if it exists. + * @see MethodNodeProperties + */ public CompletableFuture getNodeVersion() { - return getProperty(MethodNode.NodeVersion); + return getProperty(MethodNodeProperties.NodeVersion); } - @Override + /** + * Get the value of the {@link MethodNodeProperties#InputArguments} Property, if it exists. + *

+ * The InputArguments Property is used to specify the arguments that shall be used by a client when calling the + * Method. + *

+ * This Property is optional. If not present, the future will be completed exceptionally with a {@link UaException} + * indicating {@link StatusCodes#Bad_NotFound}. + * + * @return the value of the InputArguments Property, if it exists. + * @see MethodNodeProperties + */ public CompletableFuture getInputArguments() { - return getProperty(MethodNode.InputArguments); + return getProperty(MethodNodeProperties.InputArguments); } - @Override + /** + * Get the value of the {@link MethodNodeProperties#OutputArguments} Property, if it exists. + *

+ * The OutputArguments Property specifies the result returned from the Method call. + *

+ * This Property is optional. If not present, the future will be completed exceptionally with a {@link UaException} + * indicating {@link StatusCodes#Bad_NotFound}. + * + * @return the value of the OutputArguments Property, if it exists. + * @see MethodNodeProperties + */ public CompletableFuture getOutputArguments() { - return getProperty(MethodNode.OutputArguments); + return getProperty(MethodNodeProperties.OutputArguments); + } + + /** + * Set the value of the {@link MethodNodeProperties#NodeVersion} Property, if it exists. + * + * @param nodeVersion the value to set. + * @return a {@link CompletableFuture} that completes with the {@link StatusCode} of the write operation. + * @see MethodNodeProperties + */ + public CompletableFuture setNodeVersion(String nodeVersion) { + return setProperty(MethodNodeProperties.NodeVersion, nodeVersion); + } + + /** + * Set the value of the {@link MethodNodeProperties#InputArguments} Property, if it exists. + * + * @param inputArguments the value to set. + * @return a {@link CompletableFuture} that completes with the {@link StatusCode} of the write operation. + * @see MethodNodeProperties + */ + public CompletableFuture setInputArguments(Argument[] inputArguments) { + return setProperty(MethodNodeProperties.InputArguments, inputArguments); + } + + /** + * Set the value of the {@link MethodNodeProperties#OutputArguments} Property, if it exists. + * + * @param outputArguments the value to set. + * @return a {@link CompletableFuture} that completes with the {@link StatusCode} of the write operation. + * @see MethodNodeProperties + */ + public CompletableFuture setOutputArguments(Argument[] outputArguments) { + return setProperty(MethodNodeProperties.OutputArguments, outputArguments); } } diff --git a/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaNode.java b/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaNode.java index 2c46790be..dba58fe24 100644 --- a/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaNode.java +++ b/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaNode.java @@ -109,7 +109,7 @@ protected CompletableFuture getPropertyNode(QualifiedName brow }); } - protected CompletableFuture getProperty(QualifiedProperty property) { + public CompletableFuture getProperty(QualifiedProperty property) { return getPropertyNode(property) .thenCompose(VariableNode::getValue) .thenApply(value -> cast(value, property.getJavaType())); diff --git a/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaObjectNode.java b/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaObjectNode.java index 076489404..e09dd095a 100644 --- a/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaObjectNode.java +++ b/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaObjectNode.java @@ -19,9 +19,11 @@ import org.eclipse.milo.opcua.sdk.client.api.nodes.ObjectNode; import org.eclipse.milo.opcua.sdk.client.api.nodes.ObjectTypeNode; import org.eclipse.milo.opcua.sdk.client.api.nodes.VariableNode; +import org.eclipse.milo.opcua.sdk.core.nodes.ObjectNodeProperties; import org.eclipse.milo.opcua.stack.core.AttributeId; import org.eclipse.milo.opcua.stack.core.Identifiers; import org.eclipse.milo.opcua.stack.core.StatusCodes; +import org.eclipse.milo.opcua.stack.core.types.builtin.ByteString; import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue; import org.eclipse.milo.opcua.stack.core.types.builtin.NodeId; import org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName; @@ -32,6 +34,7 @@ import org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UShort; import org.eclipse.milo.opcua.stack.core.types.enumerated.BrowseDirection; import org.eclipse.milo.opcua.stack.core.types.enumerated.BrowseResultMask; +import org.eclipse.milo.opcua.stack.core.types.enumerated.NamingRuleType; import org.eclipse.milo.opcua.stack.core.types.enumerated.NodeClass; import org.eclipse.milo.opcua.stack.core.types.structured.BrowseDescription; import org.eclipse.milo.opcua.stack.core.types.structured.BrowseResult; @@ -221,4 +224,67 @@ public CompletableFuture writeEventNotifier(DataValue value) { return writeAttribute(AttributeId.EventNotifier, value); } + /** + * Get the value of the {@link ObjectNodeProperties#NodeVersion} Property, if it exists. + * + * @return the value of the NodeVersion Property, if it exists. + * @see ObjectNodeProperties + */ + public CompletableFuture getNodeVersion() { + return getProperty(ObjectNodeProperties.NodeVersion); + } + + /** + * Get the value of the {@link ObjectNodeProperties#Icon} Property, if it exists. + * + * @return the value of the Icon Property, if it exists. + * @see ObjectNodeProperties + */ + public CompletableFuture getIcon() { + return getProperty(ObjectNodeProperties.Icon); + } + + /** + * Get the value of the {@link ObjectNodeProperties#NamingRule} Property, if it exists. + * + * @return the value of the NamingRule Property, if it exists. + * @see ObjectNodeProperties + */ + public CompletableFuture getNamingRule() { + return getProperty(ObjectNodeProperties.NamingRule); + } + + /** + * Set the value of the {@link ObjectNodeProperties#NodeVersion} Property, if it exists. + * + * @param nodeVersion the value to set. + * @return a {@link CompletableFuture} that completes with the {@link StatusCode} of the write operation. + * @see ObjectNodeProperties + */ + public CompletableFuture setNodeVersion(String nodeVersion) { + return setProperty(ObjectNodeProperties.NodeVersion, nodeVersion); + } + + /** + * Set the value of the {@link ObjectNodeProperties#Icon} Property, if it exists. + * + * @param icon the value to set. + * @return a {@link CompletableFuture} that completes with the {@link StatusCode} of the write operation. + * @see ObjectNodeProperties + */ + public CompletableFuture setIcon(ByteString icon) { + return setProperty(ObjectNodeProperties.Icon, icon); + } + + /** + * Set the value of the {@link ObjectNodeProperties#NamingRule} Property, if it exists. + * + * @param namingRule the value to set. + * @return a {@link CompletableFuture} that completes with the {@link StatusCode} of the write operation. + * @see ObjectNodeProperties + */ + public CompletableFuture setNamingRule(NamingRuleType namingRule) { + return setProperty(ObjectNodeProperties.NamingRule, namingRule); + } + } diff --git a/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaObjectTypeNode.java b/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaObjectTypeNode.java index c46eb1cab..11b84859d 100644 --- a/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaObjectTypeNode.java +++ b/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaObjectTypeNode.java @@ -14,7 +14,9 @@ import org.eclipse.milo.opcua.sdk.client.OpcUaClient; import org.eclipse.milo.opcua.sdk.client.api.nodes.ObjectTypeNode; +import org.eclipse.milo.opcua.sdk.core.nodes.ObjectTypeNodeProperties; import org.eclipse.milo.opcua.stack.core.AttributeId; +import org.eclipse.milo.opcua.stack.core.types.builtin.ByteString; import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue; import org.eclipse.milo.opcua.stack.core.types.builtin.NodeId; import org.eclipse.milo.opcua.stack.core.types.builtin.StatusCode; @@ -48,4 +50,46 @@ public CompletableFuture writeIsAbstract(DataValue value) { return writeAttribute(AttributeId.IsAbstract, value); } + /** + * Get the value of the {@link ObjectTypeNodeProperties#NodeVersion} Property, if it exists. + * + * @return the value of the NodeVersion Property, if it exists. + * @see ObjectTypeNodeProperties + */ + public CompletableFuture getNodeVersion() { + return getProperty(ObjectTypeNodeProperties.NodeVersion); + } + + /** + * Get the value of the {@link ObjectTypeNodeProperties#Icon} Property, if it exists. + * + * @return the value of the Icon Property, if it exists. + * @see ObjectTypeNodeProperties + */ + public CompletableFuture getIcon() { + return getProperty(ObjectTypeNodeProperties.Icon); + } + + /** + * Set the value of the {@link ObjectTypeNodeProperties#NodeVersion} Property, if it exists. + * + * @param nodeVersion the value to set. + * @return a {@link CompletableFuture} that completes with the {@link StatusCode} of the write operation. + * @see ObjectTypeNodeProperties + */ + public CompletableFuture setNodeVersion(String nodeVersion) { + return setProperty(ObjectTypeNodeProperties.NodeVersion, nodeVersion); + } + + /** + * Set the value of the {@link ObjectTypeNodeProperties#Icon} Property, if it exists. + * + * @param icon the value to set. + * @return a {@link CompletableFuture} that completes with the {@link StatusCode} of the write operation. + * @see ObjectTypeNodeProperties + */ + public CompletableFuture setIcon(ByteString icon) { + return setProperty(ObjectTypeNodeProperties.Icon, icon); + } + } diff --git a/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaReferenceTypeNode.java b/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaReferenceTypeNode.java index bbc1ff64c..b4e40f41e 100644 --- a/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaReferenceTypeNode.java +++ b/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaReferenceTypeNode.java @@ -14,6 +14,7 @@ import org.eclipse.milo.opcua.sdk.client.OpcUaClient; import org.eclipse.milo.opcua.sdk.client.api.nodes.ReferenceTypeNode; +import org.eclipse.milo.opcua.sdk.core.nodes.ReferenceTypeNodeProperties; import org.eclipse.milo.opcua.stack.core.AttributeId; import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue; import org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText; @@ -89,4 +90,25 @@ public CompletableFuture writeInverseName(DataValue value) { return writeAttribute(AttributeId.InverseName, value); } + /** + * Get the value of the {@link ReferenceTypeNodeProperties#NodeVersion} Property, if it exists. + * + * @return the value of the NodeVersion Property, if it exists. + * @see ReferenceTypeNodeProperties + */ + public CompletableFuture getNodeVersion() { + return getProperty(ReferenceTypeNodeProperties.NodeVersion); + } + + /** + * Set the value of the {@link ReferenceTypeNodeProperties#NodeVersion} Property, if it exists. + * + * @param nodeVersion the value to set. + * @return a {@link CompletableFuture} that completes with the {@link StatusCode} of the write operation. + * @see ReferenceTypeNodeProperties + */ + public CompletableFuture setNodeVersion(String nodeVersion) { + return setProperty(ReferenceTypeNodeProperties.NodeVersion, nodeVersion); + } + } diff --git a/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaVariableNode.java b/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaVariableNode.java index 80e6608e4..b28278f83 100644 --- a/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaVariableNode.java +++ b/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaVariableNode.java @@ -17,10 +17,13 @@ import org.eclipse.milo.opcua.sdk.client.OpcUaClient; import org.eclipse.milo.opcua.sdk.client.api.nodes.VariableNode; import org.eclipse.milo.opcua.sdk.client.api.nodes.VariableTypeNode; +import org.eclipse.milo.opcua.sdk.core.nodes.VariableNodeProperties; import org.eclipse.milo.opcua.stack.core.AttributeId; import org.eclipse.milo.opcua.stack.core.Identifiers; import org.eclipse.milo.opcua.stack.core.StatusCodes; +import org.eclipse.milo.opcua.stack.core.types.builtin.ByteString; import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue; +import org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText; import org.eclipse.milo.opcua.stack.core.types.builtin.NodeId; import org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName; import org.eclipse.milo.opcua.stack.core.types.builtin.StatusCode; @@ -33,7 +36,9 @@ import org.eclipse.milo.opcua.stack.core.types.enumerated.NodeClass; import org.eclipse.milo.opcua.stack.core.types.structured.BrowseDescription; import org.eclipse.milo.opcua.stack.core.types.structured.BrowseResult; +import org.eclipse.milo.opcua.stack.core.types.structured.EUInformation; import org.eclipse.milo.opcua.stack.core.types.structured.ReferenceDescription; +import org.eclipse.milo.opcua.stack.core.types.structured.TimeZoneDataType; import org.eclipse.milo.opcua.stack.core.util.FutureUtils; import static org.eclipse.milo.opcua.sdk.core.util.StreamUtil.opt2stream; @@ -284,5 +289,194 @@ public CompletableFuture writeHistorizing(DataValue value) { return writeAttribute(AttributeId.Historizing, value); } + /** + * Get the value of the {@link VariableNodeProperties#NodeVersion} Property, if it exists. + * + * @return the value of the NodeVersion Property, if it exists. + * @see VariableNodeProperties + */ + public CompletableFuture getNodeVersion() { + return getProperty(VariableNodeProperties.NodeVersion); + } + + /** + * Get the value of the {@link VariableNodeProperties#LocalTime} Property, if it exists. + * + * @return the value of the LocalTime Property, if it exists. + * @see VariableNodeProperties + */ + public CompletableFuture getLocalTime() { + return getProperty(VariableNodeProperties.LocalTime); + } + + /** + * Get the value of the {@link VariableNodeProperties#DataTypeVersion} Property, if it exists. + * + * @return the value of the DataTypeVersion Property, if it exists. + * @see VariableNodeProperties + */ + public CompletableFuture getDataTypeVersion() { + return getProperty(VariableNodeProperties.DataTypeVersion); + } + + /** + * Get the value of the {@link VariableNodeProperties#DictionaryFragment} Property, if it exists. + * + * @return the value of the DictionaryFragment Property, if it exists. + * @see VariableNodeProperties + */ + public CompletableFuture getDictionaryFragment() { + return getProperty(VariableNodeProperties.DictionaryFragment); + } + + /** + * Get the value of the AllowNulls Property, if it exists. + * + * @return the value of the AllowNulls Property, if it exists. + * @see VariableNodeProperties#AllowNulls + */ + public CompletableFuture getAllowNulls() { + return getProperty(VariableNodeProperties.AllowNulls); + } + + /** + * Get the value of the {@link VariableNodeProperties#ValueAsText} Property, if it exists. + * + * @return the value of the ValueAsText Property, if it exists. + * @see VariableNodeProperties + */ + public CompletableFuture getValueAsText() { + return getProperty(VariableNodeProperties.ValueAsText); + } + + /** + * Get the value of the {@link VariableNodeProperties#MaxStringLength} Property, if it exists. + * + * @return the value of the MaxStringLength Property, if it exists. + * @see VariableNodeProperties + */ + public CompletableFuture getMaxStringLength() { + return getProperty(VariableNodeProperties.MaxStringLength); + } + + /** + * Get the value of the {@link VariableNodeProperties#MaxArrayLength} Property, if it exists. + * + * @return the value of the MaxArrayLength Property, if it exists. + * @see VariableNodeProperties + */ + public CompletableFuture getMaxArrayLength() { + return getProperty(VariableNodeProperties.MaxArrayLength); + } + + /** + * Get the value of the {@link VariableNodeProperties#EngineeringUnits} Property, if it exists. + * + * @return the value of the EngineeringUnits Property, if it exists. + * @see VariableNodeProperties + */ + public CompletableFuture getEngineeringUnits() { + return getProperty(VariableNodeProperties.EngineeringUnits); + } + + /** + * Set the value of the {@link VariableNodeProperties#NodeVersion} Property, if it exists. + * + * @param nodeVersion the value to set. + * @return a {@link CompletableFuture} that completes with the {@link StatusCode} of the write operation. + * @see VariableNodeProperties + */ + public CompletableFuture setNodeVersion(String nodeVersion) { + return setProperty(VariableNodeProperties.NodeVersion, nodeVersion); + } + + /** + * Set the value of the {@link VariableNodeProperties#LocalTime} Property, if it exists. + * + * @param localTime the value to set. + * @return a {@link CompletableFuture} that completes with the {@link StatusCode} of the write operation. + * @see VariableNodeProperties + */ + public CompletableFuture setLocalTime(TimeZoneDataType localTime) { + return setProperty(VariableNodeProperties.LocalTime, localTime); + } + + /** + * Set the value of the {@link VariableNodeProperties#DataTypeVersion} Property, if it exists. + * + * @param dataTypeVersion the value to set. + * @return a {@link CompletableFuture} that completes with the {@link StatusCode} of the write operation. + * @see VariableNodeProperties + */ + public CompletableFuture setDataTypeVersion(String dataTypeVersion) { + return setProperty(VariableNodeProperties.DataTypeVersion, dataTypeVersion); + } + + /** + * Set the value of the {@link VariableNodeProperties#DictionaryFragment} Property, if it exists. + * + * @param dictionaryFragment the value to set. + * @return a {@link CompletableFuture} that completes with the {@link StatusCode} of the write operation. + * @see VariableNodeProperties + */ + public CompletableFuture setDictionaryFragment(ByteString dictionaryFragment) { + return setProperty(VariableNodeProperties.DictionaryFragment, dictionaryFragment); + } + + /** + * Set the value of the {@link VariableNodeProperties#AllowNulls} Property, if it exists. + * + * @param allowNulls the value to set. + * @return a {@link CompletableFuture} that completes with the {@link StatusCode} of the write operation. + * @see VariableNodeProperties + */ + public CompletableFuture setAllowNulls(Boolean allowNulls) { + return setProperty(VariableNodeProperties.AllowNulls, allowNulls); + } + + /** + * Set the value of the {@link VariableNodeProperties#ValueAsText} Property, if it exists. + * + * @param valueAsText the value to set. + * @return a {@link CompletableFuture} that completes with the {@link StatusCode} of the write operation. + * @see VariableNodeProperties + */ + public CompletableFuture setValueAsText(LocalizedText valueAsText) { + return setProperty(VariableNodeProperties.ValueAsText, valueAsText); + } + + /** + * Set the value of the {@link VariableNodeProperties#MaxStringLength} Property, if it exists. + * + * @param maxStringLength the value to set. + * @return a {@link CompletableFuture} that completes with the {@link StatusCode} of the write operation. + * @see VariableNodeProperties + */ + public CompletableFuture setMaxStringLength(UInteger maxStringLength) { + return setProperty(VariableNodeProperties.MaxStringLength, maxStringLength); + } + + /** + * Set the value of the {@link VariableNodeProperties#MaxArrayLength} Property, if it exists. + * + * @param maxArrayLength the value to set. + * @return a {@link CompletableFuture} that completes with the {@link StatusCode} of the write operation. + * @see VariableNodeProperties + */ + public CompletableFuture setMaxArrayLength(UInteger maxArrayLength) { + return setProperty(VariableNodeProperties.MaxArrayLength, maxArrayLength); + } + + /** + * Set the value of the {@link VariableNodeProperties#EngineeringUnits} Property, if it exists. + * + * @param engineeringUnits the value to set. + * @return a {@link CompletableFuture} that completes with the {@link StatusCode} of the write operation. + * @see VariableNodeProperties + */ + public CompletableFuture setEngineeringUnits(EUInformation engineeringUnits) { + return setProperty(VariableNodeProperties.EngineeringUnits, engineeringUnits); + } + } diff --git a/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaVariableTypeNode.java b/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaVariableTypeNode.java index fa2f48ebd..283c787bc 100644 --- a/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaVariableTypeNode.java +++ b/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaVariableTypeNode.java @@ -14,6 +14,7 @@ import org.eclipse.milo.opcua.sdk.client.OpcUaClient; import org.eclipse.milo.opcua.sdk.client.api.nodes.VariableTypeNode; +import org.eclipse.milo.opcua.sdk.core.nodes.VariableTypeNodeProperties; import org.eclipse.milo.opcua.stack.core.AttributeId; import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue; import org.eclipse.milo.opcua.stack.core.types.builtin.NodeId; @@ -129,4 +130,25 @@ public CompletableFuture writeIsAbstract(DataValue value) { return writeAttribute(AttributeId.IsAbstract, value); } + /** + * Get the value of the {@link VariableTypeNodeProperties#NodeVersion} Property, if it exists. + * + * @return the value of the NodeVersion Property, if it exists. + * @see VariableTypeNodeProperties + */ + public CompletableFuture getNodeVersion() { + return getProperty(VariableTypeNodeProperties.NodeVersion); + } + + /** + * Set the value of the {@link VariableTypeNodeProperties#NodeVersion} Property, if it exists. + * + * @param nodeVersion the value to set. + * @return a {@link CompletableFuture} that completes with the {@link StatusCode} of the write operation. + * @see VariableTypeNodeProperties + */ + public CompletableFuture setNodeVersion(String nodeVersion) { + return setProperty(VariableTypeNodeProperties.NodeVersion, nodeVersion); + } + } diff --git a/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaViewNode.java b/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaViewNode.java index 4ba4230da..60ed06c82 100644 --- a/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaViewNode.java +++ b/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/nodes/UaViewNode.java @@ -14,12 +14,14 @@ import org.eclipse.milo.opcua.sdk.client.OpcUaClient; import org.eclipse.milo.opcua.sdk.client.api.nodes.ViewNode; +import org.eclipse.milo.opcua.sdk.core.nodes.ViewNodeProperties; import org.eclipse.milo.opcua.stack.core.AttributeId; import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue; import org.eclipse.milo.opcua.stack.core.types.builtin.NodeId; import org.eclipse.milo.opcua.stack.core.types.builtin.StatusCode; import org.eclipse.milo.opcua.stack.core.types.builtin.Variant; import org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UByte; +import org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger; import static org.eclipse.milo.opcua.stack.core.types.builtin.DataValue.valueOnly; @@ -69,4 +71,46 @@ public CompletableFuture writeEventNotifier(DataValue value) { return writeAttribute(AttributeId.EventNotifier, value); } + /** + * Get the value of the {@link ViewNodeProperties#NodeVersion} Property, if it exists. + * + * @return the value of the NodeVersion Property, if it exists. + * @see ViewNodeProperties + */ + public CompletableFuture getNodeVersion() { + return getProperty(ViewNodeProperties.NodeVersion); + } + + /** + * Get the value of the {@link ViewNodeProperties#ViewVersion} Property, if it exists. + * + * @return the value of the ViewVersion Property, if it exists. + * @see ViewNodeProperties + */ + public CompletableFuture getViewVersion() { + return getProperty(ViewNodeProperties.ViewVersion); + } + + /** + * Set the value of the {@link ViewNodeProperties#NodeVersion} Property, if it exists. + * + * @param nodeVersion the value to set. + * @return a {@link CompletableFuture} that completes with the {@link StatusCode} of the write operation. + * @see ViewNodeProperties + */ + public CompletableFuture setNodeVersion(String nodeVersion) { + return setProperty(ViewNodeProperties.NodeVersion, nodeVersion); + } + + /** + * Set the value of the {@link ViewNodeProperties#ViewVersion} Property, if it exists. + * + * @param viewVersion the value to set. + * @return a {@link CompletableFuture} that completes with the {@link StatusCode} of the write operation. + * @see ViewNodeProperties + */ + public CompletableFuture setViewVersion(UInteger viewVersion) { + return setProperty(ViewNodeProperties.ViewVersion, viewVersion); + } + } diff --git a/opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/DataTypeNodeProperties.java b/opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/DataTypeNodeProperties.java new file mode 100644 index 000000000..f807a6124 --- /dev/null +++ b/opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/DataTypeNodeProperties.java @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2019 the Eclipse Milo Authors + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + */ + +package org.eclipse.milo.opcua.sdk.core.nodes; + +import org.eclipse.milo.opcua.sdk.core.QualifiedProperty; +import org.eclipse.milo.opcua.sdk.core.ValueRanks; +import org.eclipse.milo.opcua.stack.core.Identifiers; +import org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText; +import org.eclipse.milo.opcua.stack.core.types.structured.EnumValueType; +import org.eclipse.milo.opcua.stack.core.util.Namespaces; + +public final class DataTypeNodeProperties { + + private DataTypeNodeProperties() {} + + /** + * The NodeVersion Property is used to indicate the version of a Node. + *

+ * The NodeVersion Property is updated each time a Reference is added or + * removed from the Node the Property belongs to. + */ + public static final QualifiedProperty NodeVersion = new QualifiedProperty<>( + Namespaces.OPC_UA, + "NodeVersion", + Identifiers.String.expanded(), + ValueRanks.Scalar, + String.class + ); + + /** + * The EnumStrings Property only applies for Enumeration DataTypes. It + * shall not be applied for other DataTypes. + *

+ * If the EnumValues Property is provided, the EnumStrings Property shall + * not be provided. + *

+ * Each entry of the array of LocalizedText in this Property represents + * the human-readable representation of an enumerated value. The Integer + * representation of the enumeration value points to a position of the + * array. + */ + public static final QualifiedProperty EnumStrings = new QualifiedProperty<>( + Namespaces.OPC_UA, + "EnumStrings", + Identifiers.LocalizedText.expanded(), + ValueRanks.OneDimension, + LocalizedText[].class + ); + + /** + * The EnumValues Property only applies for Enumeration DataTypes. It + * shall not be applied for other DataTypes. + *

+ * If the EnumStrings Property is provided, the EnumValues Property shall + * not be provided. + *

+ * Using the EnumValues Property it is possible to represent Enumerations + * with integers that are not zero-based or have gaps (e.g. 1, 2, 4, 8, + * 16). Each entry of the array of EnumValueType in this Property + * represents one enumeration value with its integer notation, human- + * readable representation, and help information. + */ + public static final QualifiedProperty EnumValues = new QualifiedProperty<>( + Namespaces.OPC_UA, + "EnumValues", + Identifiers.EnumValueType.expanded(), + ValueRanks.OneDimension, + EnumValueType[].class + ); + + /** + * The OptionSetValues Property only applies for OptionSet DataTypes and + * UInteger DataTypes. + *

+ * An OptionSet DataType is used to represent a bit mask and the + * OptionSetValues Property contains the human-readable representation for + * each bit of the bit mask. The OptionSetValues Property provides an + * array of LocalizedText containing the human-readable representation for + * each bit. + */ + public static final QualifiedProperty OptionSetValues = new QualifiedProperty<>( + Namespaces.OPC_UA, + "OptionSetValues", + Identifiers.LocalizedText.expanded(), + ValueRanks.OneDimension, + LocalizedText[].class + ); + +} diff --git a/opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/MethodNodeProperties.java b/opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/MethodNodeProperties.java new file mode 100644 index 000000000..9327b3d38 --- /dev/null +++ b/opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/MethodNodeProperties.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2019 the Eclipse Milo Authors + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + */ + +package org.eclipse.milo.opcua.sdk.core.nodes; + +import org.eclipse.milo.opcua.sdk.core.QualifiedProperty; +import org.eclipse.milo.opcua.sdk.core.ValueRanks; +import org.eclipse.milo.opcua.stack.core.Identifiers; +import org.eclipse.milo.opcua.stack.core.types.structured.Argument; +import org.eclipse.milo.opcua.stack.core.util.Namespaces; + +public final class MethodNodeProperties { + + private MethodNodeProperties() {} + + /** + * The NodeVersion Property is used to indicate the version of a Node. It + * does not apply to Properties. + *

+ * The NodeVersion Property is updated each time a Reference is added or + * removed from the Node the Property belongs to. + *

+ * Although the relationship of a Variable to its DataType is not modelled + * using References, changes to the DataType Attribute of a Variable lead + * to an update of the NodeVersion Property. + *

+ * The usage of this Property is optional. + */ + public static final QualifiedProperty NodeVersion = new QualifiedProperty<>( + Namespaces.OPC_UA, + "NodeVersion", + Identifiers.String.expanded(), + ValueRanks.Scalar, + String.class + ); + + /** + * The InputArguments Property is used to specify the arguments that shall + * be used by a client when calling the Method. + */ + public static final QualifiedProperty InputArguments = new QualifiedProperty<>( + Namespaces.OPC_UA, + "InputArguments", + Identifiers.Argument.expanded(), + ValueRanks.OneDimension, + Argument[].class + ); + + /** + * The OutputArguments Property specifies the result returned from the + * Method call. + */ + public static final QualifiedProperty OutputArguments = new QualifiedProperty<>( + Namespaces.OPC_UA, + "OutputArguments", + Identifiers.Argument.expanded(), + ValueRanks.OneDimension, + Argument[].class + ); + +} diff --git a/opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/ObjectNodeProperties.java b/opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/ObjectNodeProperties.java new file mode 100644 index 000000000..4af6e469b --- /dev/null +++ b/opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/ObjectNodeProperties.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2019 the Eclipse Milo Authors + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + */ + +package org.eclipse.milo.opcua.sdk.core.nodes; + +import org.eclipse.milo.opcua.sdk.core.QualifiedProperty; +import org.eclipse.milo.opcua.sdk.core.ValueRanks; +import org.eclipse.milo.opcua.stack.core.Identifiers; +import org.eclipse.milo.opcua.stack.core.types.builtin.ByteString; +import org.eclipse.milo.opcua.stack.core.types.enumerated.NamingRuleType; +import org.eclipse.milo.opcua.stack.core.util.Namespaces; + +public final class ObjectNodeProperties { + + private ObjectNodeProperties() {} + + /** + * The NodeVersion Property is used to indicate the version of a Node. + *

+ * The NodeVersion Property is updated each time a Reference is added or + * removed from the Node the Property belongs to. + */ + public static final QualifiedProperty NodeVersion = new QualifiedProperty<>( + Namespaces.OPC_UA, + "NodeVersion", + Identifiers.String.expanded(), + ValueRanks.Scalar, + String.class + ); + + /** + * The Icon Property is provides an image that can be used by Clients when + * displaying the Node. + *

+ * It is expected that the Icon Property contains a relatively small image. + */ + public static final QualifiedProperty Icon = new QualifiedProperty<>( + Namespaces.OPC_UA, + "Icon", + Identifiers.Image.expanded(), + ValueRanks.Scalar, + ByteString.class + ); + + /** + * The NamingRule Property defines the NamingRule of a ModellingRule. + *

+ * This Property shall only be used for Objects of type ModellingRuleType. + */ + public static final QualifiedProperty NamingRule = new QualifiedProperty<>( + Namespaces.OPC_UA, + "NamingRule", + Identifiers.NamingRuleType.expanded(), + ValueRanks.Scalar, + NamingRuleType.class + ); + +} diff --git a/opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/ObjectTypeNodeProperties.java b/opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/ObjectTypeNodeProperties.java new file mode 100644 index 000000000..2a7fba48c --- /dev/null +++ b/opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/ObjectTypeNodeProperties.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2019 the Eclipse Milo Authors + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + */ + +package org.eclipse.milo.opcua.sdk.core.nodes; + +import org.eclipse.milo.opcua.sdk.core.QualifiedProperty; +import org.eclipse.milo.opcua.sdk.core.ValueRanks; +import org.eclipse.milo.opcua.stack.core.Identifiers; +import org.eclipse.milo.opcua.stack.core.types.builtin.ByteString; +import org.eclipse.milo.opcua.stack.core.util.Namespaces; + +public final class ObjectTypeNodeProperties { + + private ObjectTypeNodeProperties() {} + + /** + * The NodeVersion Property is used to indicate the version of a Node. + *

+ * The NodeVersion Property is updated each time a Reference is added or + * removed from the Node the Property belongs to. + */ + public static final QualifiedProperty NodeVersion = new QualifiedProperty<>( + Namespaces.OPC_UA, + "NodeVersion", + Identifiers.String, + ValueRanks.Scalar, + String.class + ); + + /** + * The Icon Property is provides an image that can be used by Clients when + * displaying the Node. + *

+ * It is expected that the Icon Property contains a relatively small image. + */ + public static final QualifiedProperty Icon = new QualifiedProperty<>( + Namespaces.OPC_UA, + "Icon", + Identifiers.Image, + ValueRanks.Scalar, + ByteString.class + ); + +} diff --git a/opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/ReferenceTypeNodeProperties.java b/opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/ReferenceTypeNodeProperties.java new file mode 100644 index 000000000..249410990 --- /dev/null +++ b/opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/ReferenceTypeNodeProperties.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2019 the Eclipse Milo Authors + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + */ + +package org.eclipse.milo.opcua.sdk.core.nodes; + +import org.eclipse.milo.opcua.sdk.core.QualifiedProperty; +import org.eclipse.milo.opcua.sdk.core.ValueRanks; +import org.eclipse.milo.opcua.stack.core.Identifiers; +import org.eclipse.milo.opcua.stack.core.util.Namespaces; + +public class ReferenceTypeNodeProperties { + + /** + * The NodeVersion Property is used to indicate the version of a Node. + *

+ * The NodeVersion Property is updated each time a Reference is added or + * removed from the Node the Property belongs to. + */ + public static final QualifiedProperty NodeVersion = new QualifiedProperty<>( + Namespaces.OPC_UA, + "NodeVersion", + Identifiers.String.expanded(), + ValueRanks.Scalar, + String.class + ); + +} diff --git a/opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/VariableNodeProperties.java b/opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/VariableNodeProperties.java new file mode 100644 index 000000000..86136a50a --- /dev/null +++ b/opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/VariableNodeProperties.java @@ -0,0 +1,196 @@ +/* + * Copyright (c) 2019 the Eclipse Milo Authors + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + */ + +package org.eclipse.milo.opcua.sdk.core.nodes; + +import org.eclipse.milo.opcua.sdk.core.QualifiedProperty; +import org.eclipse.milo.opcua.sdk.core.ValueRanks; +import org.eclipse.milo.opcua.stack.core.Identifiers; +import org.eclipse.milo.opcua.stack.core.types.builtin.ByteString; +import org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText; +import org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger; +import org.eclipse.milo.opcua.stack.core.types.structured.EUInformation; +import org.eclipse.milo.opcua.stack.core.types.structured.TimeZoneDataType; +import org.eclipse.milo.opcua.stack.core.util.Namespaces; + +public final class VariableNodeProperties { + + private VariableNodeProperties() {} + + /** + * The NodeVersion Property is used to indicate the version of a Node. It + * does not apply to Properties. + *

+ * The NodeVersion Property is updated each time a Reference is added or + * removed from the Node the Property belongs to. + *

+ * Although the relationship of a Variable to its DataType is not modelled + * using References, changes to the DataType Attribute of a Variable lead + * to an update of the NodeVersion Property. + *

+ * The usage of this Property is optional. + */ + public static final QualifiedProperty NodeVersion = new QualifiedProperty<>( + Namespaces.OPC_UA, + "NodeVersion", + Identifiers.String.expanded(), + ValueRanks.Scalar, + String.class + ); + + /** + * The LocalTime Property is only used for DataVariables. It does not + * apply to Properties. + *

+ * This Property is a structure containing the Offset and the + * DaylightSavingInOffset flag. The Offset specifies the time difference + * (in minutes) between the SourceTimestamp (UTC) associated with the + * value and the time at the location in which the value was obtained. + * If DaylightSavingInOffset is TRUE, then Standard/Daylight savings time + * (DST) at the originating location is in effect and Offset includes the + * DST correction. If FALSE then the Offset does not include DST + * correction and DST may or may not have been in effect. + *

+ * The usage of this Property is optional. + */ + public static final QualifiedProperty LocalTime = new QualifiedProperty<>( + Namespaces.OPC_UA, + "LocalTime", + Identifiers.TimeZoneDataType.expanded(), + ValueRanks.Scalar, + TimeZoneDataType.class + ); + + /** + * Only used for Variables of the VariableType DataTypeDictionaryType and + * DataTypeDescriptionType as described in OPC UA Part 5, section 5.18. + *

+ * The usage of this Property is optional. + */ + public static final QualifiedProperty DataTypeVersion = new QualifiedProperty<>( + Namespaces.OPC_UA, + "DataTypeVersion", + Identifiers.String.expanded(), + ValueRanks.Scalar, + String.class + ); + + /** + * Only used for Variables of the VariableType DataTypeDescriptionType as + * described in OPC UA Part 5, section 5.18. + *

+ * The usage of this Property is optional. + */ + public static final QualifiedProperty DictionaryFragment = new QualifiedProperty<>( + Namespaces.OPC_UA, + "DictionaryFragment", + Identifiers.ByteString.expanded(), + ValueRanks.Scalar, + ByteString.class + ); + + /** + * The AllowNulls Property is only used for DataVariables. It does not + * apply to Properties. + *

+ * This Property specifies if a null value is allowed for the Value + * Attribute of the DataVariable. If it is set to true, the Server may + * return null values and accept writing of null values. If it is set to + * false, the Server shall never return a null value and shall reject any + * request writing a null value. + *

+ * If this Property is not provided, it is Server-specific if null values are + * allowed or not. + *

+ * The usage of this Property is optional. + */ + public static final QualifiedProperty AllowNulls = new QualifiedProperty<>( + Namespaces.OPC_UA, + "AllowNulls", + Identifiers.Boolean.expanded(), + ValueRanks.Scalar, + Boolean.class + ); + + /** + * Only used for DataVariables having an Enumeration DataType. + *

+ * This optional Property provides the localized text representation of + * the enumeration value. It can be used by Clients only interested in + * displaying the text to subscribe to the Property instead of the value + * attribute. + *

+ * The usage of this Property is optional. + */ + public static final QualifiedProperty ValueAsText = new QualifiedProperty<>( + Namespaces.OPC_UA, + "ValueAsText", + Identifiers.LocalizedText.expanded(), + ValueRanks.Scalar, + LocalizedText.class + ); + + /** + * Only used for DataVariables having a String DataType. + *

+ * This optional Property indicates the maximum number of characters + * supported by the DataVariable. + *

+ * The usage of this Property is optional. + */ + public static final QualifiedProperty MaxStringLength = new QualifiedProperty<>( + Namespaces.OPC_UA, + "MaxStringLength", + Identifiers.UInt32.expanded(), + ValueRanks.Scalar, + UInteger.class + ); + + /** + * Only used for DataVariables having its ValueRank Attribute not set to + * scalar. + *

+ * This optional Property indicates the maximum length of an array + * supported by the DataVariable. In a multidimensional array it indicates + * the overall length. + *

+ * NOTE: In order to expose the length of an array of bytes do not use the + * DataType ByteString but an array of the DataType Byte. In that case the + * MaxArrayLength applies. + *

+ * The usage of this Property is optional. + */ + public static final QualifiedProperty MaxArrayLength = new QualifiedProperty<>( + Namespaces.OPC_UA, + "MaxArrayLength", + Identifiers.UInt32.expanded(), + ValueRanks.Scalar, + UInteger.class + ); + + /** + * Only used for DataVariables having a Number DataType. + *

+ * This optional Property indicates the engineering units for the value of + * the DataVariable (e.g. hertz or seconds). Details about the Property + * and what engineering units should be used are defined in Part 8. The + * DataType EUInformation is also defined in Part 8. + *

+ * The usage of this Property is optional. + */ + public static final QualifiedProperty EngineeringUnits = new QualifiedProperty<>( + Namespaces.OPC_UA, + "EngineeringUnits", + Identifiers.EUInformation.expanded(), + ValueRanks.Scalar, + EUInformation.class + ); + +} diff --git a/opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/VariableTypeNodeProperties.java b/opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/VariableTypeNodeProperties.java new file mode 100644 index 000000000..94ab9a8e2 --- /dev/null +++ b/opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/VariableTypeNodeProperties.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2019 the Eclipse Milo Authors + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + */ + +package org.eclipse.milo.opcua.sdk.core.nodes; + +import org.eclipse.milo.opcua.sdk.core.QualifiedProperty; +import org.eclipse.milo.opcua.sdk.core.ValueRanks; +import org.eclipse.milo.opcua.stack.core.Identifiers; +import org.eclipse.milo.opcua.stack.core.util.Namespaces; + +public final class VariableTypeNodeProperties { + + private VariableTypeNodeProperties() {} + + /** + * The NodeVersion Property is used to indicate the version of a Node. It + * does not apply to Properties. + *

+ * The NodeVersion Property is updated each time a Reference is added or + * removed from the Node the Property belongs to. + *

+ * Although the relationship of a Variable to its DataType is not modelled + * using References, changes to the DataType Attribute of a Variable lead + * to an update of the NodeVersion Property. + *

+ * The usage of this Property is optional. + */ + public static final QualifiedProperty NodeVersion = new QualifiedProperty<>( + Namespaces.OPC_UA, + "NodeVersion", + Identifiers.String.expanded(), + ValueRanks.Scalar, + String.class + ); + +} diff --git a/opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/ViewNodeProperties.java b/opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/ViewNodeProperties.java new file mode 100644 index 000000000..48e32752b --- /dev/null +++ b/opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/nodes/ViewNodeProperties.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2019 the Eclipse Milo Authors + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + */ + +package org.eclipse.milo.opcua.sdk.core.nodes; + +import org.eclipse.milo.opcua.sdk.core.QualifiedProperty; +import org.eclipse.milo.opcua.sdk.core.ValueRanks; +import org.eclipse.milo.opcua.stack.core.Identifiers; +import org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger; +import org.eclipse.milo.opcua.stack.core.util.Namespaces; + +public final class ViewNodeProperties { + + private ViewNodeProperties() {} + + /** + * The NodeVersion Property is used to indicate the version of a Node. + *

+ * The NodeVersion Property is updated each time a Reference is added or + * removed from the Node the Property belongs to. + */ + public static final QualifiedProperty NodeVersion = new QualifiedProperty<>( + Namespaces.OPC_UA, + "NodeVersion", + Identifiers.String.expanded(), + ValueRanks.Scalar, + String.class + ); + + /** + * The version number for the View. When Nodes are added to or removed + * from a View, the value of the ViewVersion Property is updated. + *

+ * Clients may detect changes to the composition of a View using this + * Property. + *

+ * The value of the ViewVersion shall always be greater than 0. + */ + public static final QualifiedProperty ViewVersion = new QualifiedProperty<>( + Namespaces.OPC_UA, + "ViewVersion", + Identifiers.UInt32.expanded(), + ValueRanks.Scalar, + UInteger.class + ); + +} diff --git a/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaDataTypeNode.java b/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaDataTypeNode.java index 063fa6c94..dc9c3f65d 100644 --- a/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaDataTypeNode.java +++ b/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaDataTypeNode.java @@ -12,18 +12,15 @@ import javax.annotation.Nullable; -import org.eclipse.milo.opcua.sdk.core.QualifiedProperty; -import org.eclipse.milo.opcua.sdk.core.ValueRanks; +import org.eclipse.milo.opcua.sdk.core.nodes.DataTypeNodeProperties; import org.eclipse.milo.opcua.sdk.server.api.nodes.DataTypeNode; import org.eclipse.milo.opcua.stack.core.AttributeId; -import org.eclipse.milo.opcua.stack.core.Identifiers; import org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText; import org.eclipse.milo.opcua.stack.core.types.builtin.NodeId; import org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName; import org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger; import org.eclipse.milo.opcua.stack.core.types.enumerated.NodeClass; import org.eclipse.milo.opcua.stack.core.types.structured.EnumValueType; -import org.eclipse.milo.opcua.stack.core.util.Namespaces; public class UaDataTypeNode extends UaNode implements DataTypeNode { @@ -83,55 +80,96 @@ public synchronized void setAttribute(AttributeId attributeId, Object value) { fireAttributeChanged(attributeId, value); } + /** + * Get the value of the NodeVersion Property, if it exists. + * + * @return the value of the NodeVersion Property, if it exists. + * @see DataTypeNodeProperties#NodeVersion + */ @Nullable public String getNodeVersion() { - return getProperty(NodeVersion).orElse(null); + return getProperty(DataTypeNodeProperties.NodeVersion).orElse(null); } + /** + * Get the value of the EnumStrings Property, if it exists. + * + * @return the value of the EnumStrings Property, if it exists. + * @see DataTypeNodeProperties#EnumStrings + */ @Nullable public LocalizedText[] getEnumStrings() { - return getProperty(EnumStrings).orElse(null); + return getProperty(DataTypeNodeProperties.EnumStrings).orElse(null); } + /** + * Get the value of the EnumValues Property, if it exists. + * + * @return the value of the EnumValues Property, if it exists. + * @see DataTypeNodeProperties#EnumValues + */ @Nullable public EnumValueType[] getEnumValues() { - return getProperty(EnumValues).orElse(null); + return getProperty(DataTypeNodeProperties.EnumValues).orElse(null); } + /** + * Get the value of the OptionSetValues Property, if it exists. + * + * @return the value of the OptionSetValues Property, if it exists. + * @see DataTypeNodeProperties#OptionSetValues + */ + @Nullable + public LocalizedText[] getOptionSetValues() { + return getProperty(DataTypeNodeProperties.OptionSetValues).orElse(null); + } + + /** + * Set the value of the NodeVersion Property. + *

+ * A PropertyNode will be created if it does not already exist. + * + * @param nodeVersion the value to set. + * @see DataTypeNodeProperties#NodeVersion + */ public void setNodeVersion(String nodeVersion) { - setProperty(NodeVersion, nodeVersion); + setProperty(DataTypeNodeProperties.NodeVersion, nodeVersion); } + /** + * Set the value of the EnumStrings Property. + *

+ * A PropertyNode will be created if it does not already exist. + * + * @param enumStrings the value to set. + * @see DataTypeNodeProperties#EnumStrings + */ public void setEnumStrings(LocalizedText[] enumStrings) { - setProperty(EnumStrings, enumStrings); + setProperty(DataTypeNodeProperties.EnumStrings, enumStrings); } + /** + * Set the value of the EnumValues Property. + *

+ * A PropertyNode will be created if it does not already exist. + * + * @param enumValues the value to set. + * @see DataTypeNodeProperties#EnumValues + */ public void setEnumValues(EnumValueType[] enumValues) { - setProperty(EnumValues, enumValues); + setProperty(DataTypeNodeProperties.EnumValues, enumValues); } - public static final QualifiedProperty NodeVersion = new QualifiedProperty<>( - Namespaces.OPC_UA, - "NodeVersion", - Identifiers.String, - ValueRanks.Scalar, - String.class - ); - - public static final QualifiedProperty EnumStrings = new QualifiedProperty<>( - Namespaces.OPC_UA, - "EnumStrings", - Identifiers.LocalizedText, - ValueRanks.OneDimension, - LocalizedText[].class - ); - - public static final QualifiedProperty EnumValues = new QualifiedProperty<>( - Namespaces.OPC_UA, - "EnumValues", - Identifiers.EnumValueType, - ValueRanks.OneDimension, - EnumValueType[].class - ); + /** + * Set the value of the OptionSetValues Property. + *

+ * A PropertyNode will be created if it does not already exist. + * + * @param optionSetValues the value to set. + * @see DataTypeNodeProperties#OptionSetValues + */ + public void setOptionSetValues(LocalizedText[] optionSetValues) { + setProperty(DataTypeNodeProperties.OptionSetValues, optionSetValues); + } } diff --git a/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaMethodNode.java b/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaMethodNode.java index 294c8869f..9659ade4e 100644 --- a/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaMethodNode.java +++ b/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaMethodNode.java @@ -17,21 +17,18 @@ import javax.annotation.Nullable; import com.google.common.base.Preconditions; -import org.eclipse.milo.opcua.sdk.core.QualifiedProperty; -import org.eclipse.milo.opcua.sdk.core.ValueRanks; +import org.eclipse.milo.opcua.sdk.core.nodes.MethodNodeProperties; import org.eclipse.milo.opcua.sdk.server.api.methods.MethodInvocationHandler; import org.eclipse.milo.opcua.sdk.server.api.nodes.MethodNode; import org.eclipse.milo.opcua.sdk.server.api.nodes.Node; import org.eclipse.milo.opcua.sdk.server.api.nodes.ObjectNode; import org.eclipse.milo.opcua.stack.core.AttributeId; -import org.eclipse.milo.opcua.stack.core.Identifiers; import org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText; import org.eclipse.milo.opcua.stack.core.types.builtin.NodeId; import org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName; import org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger; import org.eclipse.milo.opcua.stack.core.types.enumerated.NodeClass; import org.eclipse.milo.opcua.stack.core.types.structured.Argument; -import org.eclipse.milo.opcua.stack.core.util.Namespaces; import static org.eclipse.milo.opcua.sdk.core.Reference.ALWAYS_GENERATES_EVENT_PREDICATE; import static org.eclipse.milo.opcua.sdk.core.Reference.HAS_MODELLING_RULE_PREDICATE; @@ -111,7 +108,7 @@ public synchronized void setAttribute(AttributeId attributeId, Object value) { case UserExecutable: userExecutable = (Boolean) value; break; - + default: super.setAttribute(attributeId, value); return; // prevent firing an attribute change @@ -154,58 +151,75 @@ public void setInvocationHandler(MethodInvocationHandler handler) { this.handler = handler; } + /** + * Get the value of the NodeVersion Property, if it exists. + * + * @return the value of the NodeVersion Property, if it exists. + * @see MethodNodeProperties#NodeVersion + */ @Nullable public String getNodeVersion() { - return getProperty(NodeVersion).orElse(null); + return getProperty(MethodNodeProperties.NodeVersion).orElse(null); } + /** + * Get the value of the InputArguments Property, if it exists. + * + * @return the value of the InputArguments Property, if it exists. + * @see MethodNodeProperties#InputArguments + */ @Nullable public Argument[] getInputArguments() { - return getProperty(InputArguments).orElse(null); + return getProperty(MethodNodeProperties.InputArguments).orElse(null); } + /** + * Get the value of the OutputArguments Property, if it exists. + * + * @return the value of the OutputArguments Property, if it exists. + * @see MethodNodeProperties#OutputArguments + */ @Nullable public Argument[] getOutputArguments() { - return getProperty(OutputArguments).orElse(null); + return getProperty(MethodNodeProperties.OutputArguments).orElse(null); } + /** + * Set the value of the NodeVersion Property. + *

+ * A PropertyNode will be created if it does not already exist. + * + * @param nodeVersion the value to set. + * @see MethodNodeProperties#NodeVersion + */ public void setNodeVersion(String nodeVersion) { - setProperty(NodeVersion, nodeVersion); + setProperty(MethodNodeProperties.NodeVersion, nodeVersion); } + /** + * Set the value of the InputArguments Property. + *

+ * A PropertyNode will be created if it does not already exist. + * + * @param inputArguments the value to set. + * @see MethodNodeProperties#InputArguments + */ public void setInputArguments(Argument[] inputArguments) { - setProperty(InputArguments, inputArguments); + setProperty(MethodNodeProperties.InputArguments, inputArguments); } + /** + * Set the value of the OutputArguments Property. + *

+ * A PropertyNode will be created if it does not already exist. + * + * @param outputArguments the value to set. + * @see MethodNodeProperties#OutputArguments + */ public void setOutputArguments(Argument[] outputArguments) { - setProperty(OutputArguments, outputArguments); + setProperty(MethodNodeProperties.OutputArguments, outputArguments); } - - public static final QualifiedProperty InputArguments = new QualifiedProperty<>( - Namespaces.OPC_UA, - "InputArguments", - Identifiers.Argument, - ValueRanks.OneDimension, - Argument[].class - ); - - public static final QualifiedProperty OutputArguments = new QualifiedProperty<>( - Namespaces.OPC_UA, - "OutputArguments", - Identifiers.Argument, - ValueRanks.OneDimension, - Argument[].class - ); - - public static final QualifiedProperty NodeVersion = new QualifiedProperty<>( - Namespaces.OPC_UA, - "NodeVersion", - Identifiers.String, - ValueRanks.Scalar, - String.class - ); - /** * @return a new {@link UaMethodNodeBuilder}. */ diff --git a/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaObjectNode.java b/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaObjectNode.java index 68ce04e45..e1a37f60f 100644 --- a/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaObjectNode.java +++ b/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaObjectNode.java @@ -19,9 +19,8 @@ import com.google.common.base.Preconditions; import com.google.common.collect.Lists; -import org.eclipse.milo.opcua.sdk.core.QualifiedProperty; import org.eclipse.milo.opcua.sdk.core.Reference; -import org.eclipse.milo.opcua.sdk.core.ValueRanks; +import org.eclipse.milo.opcua.sdk.core.nodes.ObjectNodeProperties; import org.eclipse.milo.opcua.sdk.server.api.AddressSpaceManager; import org.eclipse.milo.opcua.sdk.server.api.nodes.Node; import org.eclipse.milo.opcua.sdk.server.api.nodes.ObjectNode; @@ -37,7 +36,6 @@ import org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger; import org.eclipse.milo.opcua.stack.core.types.enumerated.NamingRuleType; import org.eclipse.milo.opcua.stack.core.types.enumerated.NodeClass; -import org.eclipse.milo.opcua.stack.core.util.Namespaces; import static org.eclipse.milo.opcua.sdk.core.Reference.HAS_COMPONENT_PREDICATE; import static org.eclipse.milo.opcua.sdk.core.Reference.HAS_DESCRIPTION_PREDICATE; @@ -302,57 +300,75 @@ public void removeComponent(UaNode node) { )); } + /** + * Get the value of the NodeVersion Property, if it exists. + * + * @return the value of the NodeVersion Property, if it exists. + * @see ObjectNodeProperties#NodeVersion + */ @Nullable public String getNodeVersion() { - return getProperty(NodeVersion).orElse(null); + return getProperty(ObjectNodeProperties.NodeVersion).orElse(null); } + /** + * Get the value of the Icon Property, if it exists. + * + * @return the value of the Icon Property, if it exists. + * @see ObjectNodeProperties#Icon + */ @Nullable public ByteString getIcon() { - return getProperty(Icon).orElse(null); + return getProperty(ObjectNodeProperties.Icon).orElse(null); } + /** + * Get the value of the NamingRule Property, if it exists. + * + * @return the value of the NamingRule Property, if it exists. + * @see ObjectNodeProperties#NamingRule + */ @Nullable public NamingRuleType getNamingRule() { - return getProperty(NamingRule).orElse(null); + return getProperty(ObjectNodeProperties.NamingRule).orElse(null); } + /** + * Set the value of the NodeVersion Property. + *

+ * A PropertyNode will be created if it does not already exist. + * + * @param nodeVersion the value to set. + * @see ObjectNodeProperties#NodeVersion + */ public void setNodeVersion(String nodeVersion) { - setProperty(NodeVersion, nodeVersion); + setProperty(ObjectNodeProperties.NodeVersion, nodeVersion); } + /** + * Set the value of the Icon Property. + *

+ * A PropertyNode will be created if it does not already exist. + * + * @param icon the value to set. + * @see ObjectNodeProperties#Icon + */ public void setIcon(ByteString icon) { - setProperty(Icon, icon); + setProperty(ObjectNodeProperties.Icon, icon); } + /** + * Set the value of the NamingRule Property. + *

+ * A PropertyNode will be created if it does not already exist. + * + * @param namingRule the value to set. + * @see ObjectNodeProperties#NamingRule + */ public void setNamingRule(NamingRuleType namingRule) { - setProperty(NamingRule, namingRule); + setProperty(ObjectNodeProperties.NamingRule, namingRule); } - public static final QualifiedProperty NodeVersion = new QualifiedProperty<>( - Namespaces.OPC_UA, - "NodeVersion", - Identifiers.String, - ValueRanks.Scalar, - String.class - ); - - public static final QualifiedProperty Icon = new QualifiedProperty<>( - Namespaces.OPC_UA, - "Icon", - Identifiers.Image, - ValueRanks.Scalar, - ByteString.class - ); - - public static final QualifiedProperty NamingRule = new QualifiedProperty<>( - Namespaces.OPC_UA, - "NamingRule", - Identifiers.NamingRuleType, - ValueRanks.Scalar, - NamingRuleType.class - ); - public static UaObjectNodeBuilder builder(UaNodeContext context) { return new UaObjectNodeBuilder(context); } diff --git a/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaObjectTypeNode.java b/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaObjectTypeNode.java index 70f32a5ce..24f724d51 100644 --- a/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaObjectTypeNode.java +++ b/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaObjectTypeNode.java @@ -18,9 +18,8 @@ import com.google.common.base.Preconditions; import com.google.common.collect.Lists; -import org.eclipse.milo.opcua.sdk.core.QualifiedProperty; import org.eclipse.milo.opcua.sdk.core.Reference; -import org.eclipse.milo.opcua.sdk.core.ValueRanks; +import org.eclipse.milo.opcua.sdk.core.nodes.ObjectTypeNodeProperties; import org.eclipse.milo.opcua.sdk.server.api.nodes.ObjectTypeNode; import org.eclipse.milo.opcua.stack.core.AttributeId; import org.eclipse.milo.opcua.stack.core.Identifiers; @@ -30,7 +29,6 @@ import org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName; import org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger; import org.eclipse.milo.opcua.stack.core.types.enumerated.NodeClass; -import org.eclipse.milo.opcua.stack.core.util.Namespaces; import static org.eclipse.milo.opcua.sdk.core.Reference.HAS_COMPONENT_PREDICATE; import static org.eclipse.milo.opcua.sdk.core.util.StreamUtil.opt2stream; @@ -157,31 +155,51 @@ public void addSubtype(UaObjectTypeNode node) { )); } + /** + * Get the value of the NodeVersion Property, if it exists. + * + * @return the value of the NodeVersion Property, if it exists. + * @see ObjectTypeNodeProperties#NodeVersion + */ @Nullable public String getNodeVersion() { - return getProperty(NodeVersion).orElse(null); + return getProperty(ObjectTypeNodeProperties.NodeVersion).orElse(null); } + /** + * Get the value of the Icon Property, if it exists. + * + * @return the value of the Icon Property, if it exists. + * @see ObjectTypeNodeProperties#Icon + */ @Nullable public ByteString getIcon() { - return getProperty(Icon).orElse(null); + return getProperty(ObjectTypeNodeProperties.Icon).orElse(null); } - public static final QualifiedProperty NodeVersion = new QualifiedProperty<>( - Namespaces.OPC_UA, - "NodeVersion", - Identifiers.String, - ValueRanks.Scalar, - String.class - ); - - public static final QualifiedProperty Icon = new QualifiedProperty<>( - Namespaces.OPC_UA, - "Icon", - Identifiers.Image, - ValueRanks.Scalar, - ByteString.class - ); + /** + * Set the value of the NodeVersion Property. + *

+ * A PropertyNode will be created if it does not already exist. + * + * @param nodeVersion the value to set. + * @see ObjectTypeNodeProperties#NodeVersion + */ + public void setNodeVersion(String nodeVersion) { + setProperty(ObjectTypeNodeProperties.NodeVersion, nodeVersion); + } + + /** + * Set the value of the Icon Property. + *

+ * A PropertyNode will be created if it does not already exist. + * + * @param icon the value to set. + * @see ObjectTypeNodeProperties#NodeVersion + */ + public void setIcon(ByteString icon) { + setProperty(ObjectTypeNodeProperties.Icon, icon); + } public static UaObjectTypeNodeBuilder builder(UaNodeContext context) { return new UaObjectTypeNodeBuilder(context); diff --git a/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaReferenceTypeNode.java b/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaReferenceTypeNode.java index 784797d36..80485ac53 100644 --- a/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaReferenceTypeNode.java +++ b/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaReferenceTypeNode.java @@ -12,17 +12,14 @@ import javax.annotation.Nullable; -import org.eclipse.milo.opcua.sdk.core.QualifiedProperty; -import org.eclipse.milo.opcua.sdk.core.ValueRanks; +import org.eclipse.milo.opcua.sdk.core.nodes.ReferenceTypeNodeProperties; import org.eclipse.milo.opcua.sdk.server.api.nodes.ReferenceTypeNode; import org.eclipse.milo.opcua.stack.core.AttributeId; -import org.eclipse.milo.opcua.stack.core.Identifiers; import org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText; import org.eclipse.milo.opcua.stack.core.types.builtin.NodeId; import org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName; import org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger; import org.eclipse.milo.opcua.stack.core.types.enumerated.NodeClass; -import org.eclipse.milo.opcua.stack.core.util.Namespaces; public class UaReferenceTypeNode extends UaNode implements ReferenceTypeNode { @@ -127,21 +124,27 @@ public synchronized void setAttribute(AttributeId attributeId, Object value) { fireAttributeChanged(attributeId, value); } + /** + * Get the value of the NodeVersion Property, if it exists. + * + * @return the value of the NodeVersion Property, if it exists. + * @see ReferenceTypeNodeProperties#NodeVersion + */ @Nullable public String getNodeVersion() { - return getProperty(NodeVersion).orElse(null); + return getProperty(ReferenceTypeNodeProperties.NodeVersion).orElse(null); } + /** + * Set the value of the NodeVersion Property. + *

+ * A PropertyNode will be created if it does not already exist. + * + * @param nodeVersion the value to set. + * @see ReferenceTypeNodeProperties#NodeVersion + */ public void setNodeVersion(String nodeVersion) { - setProperty(NodeVersion, nodeVersion); + setProperty(ReferenceTypeNodeProperties.NodeVersion, nodeVersion); } - public static final QualifiedProperty NodeVersion = new QualifiedProperty<>( - Namespaces.OPC_UA, - "NodeVersion", - Identifiers.String, - ValueRanks.Scalar, - String.class - ); - } diff --git a/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaVariableNode.java b/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaVariableNode.java index 697a802e8..52f769f8b 100644 --- a/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaVariableNode.java +++ b/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaVariableNode.java @@ -20,9 +20,9 @@ import com.google.common.base.Preconditions; import com.google.common.collect.Lists; import org.eclipse.milo.opcua.sdk.core.AccessLevel; -import org.eclipse.milo.opcua.sdk.core.QualifiedProperty; import org.eclipse.milo.opcua.sdk.core.Reference; import org.eclipse.milo.opcua.sdk.core.ValueRanks; +import org.eclipse.milo.opcua.sdk.core.nodes.VariableNodeProperties; import org.eclipse.milo.opcua.sdk.server.api.NodeManager; import org.eclipse.milo.opcua.sdk.server.api.nodes.Node; import org.eclipse.milo.opcua.sdk.server.api.nodes.ObjectNode; @@ -45,7 +45,6 @@ import org.eclipse.milo.opcua.stack.core.types.enumerated.NodeClass; import org.eclipse.milo.opcua.stack.core.types.structured.EUInformation; import org.eclipse.milo.opcua.stack.core.types.structured.TimeZoneDataType; -import org.eclipse.milo.opcua.stack.core.util.Namespaces; import static org.eclipse.milo.opcua.sdk.core.Reference.HAS_COMPONENT_PREDICATE; import static org.eclipse.milo.opcua.sdk.core.Reference.HAS_MODELLING_RULE_PREDICATE; @@ -360,149 +359,189 @@ public void removeComponent(UaNode node) { )); } + /** + * Get the value of the NodeVersion Property, if it exists. + * + * @return the value of the NodeVersion Property, if it exists. + * @see VariableNodeProperties#NodeVersion + */ @Nullable public String getNodeVersion() { - return getProperty(NodeVersion).orElse(null); + return getProperty(VariableNodeProperties.NodeVersion).orElse(null); } + /** + * Get the value of the LocalTime Property, if it exists. + * + * @return the value of the LocalTime Property, if it exists. + * @see VariableNodeProperties#LocalTime + */ @Nullable public TimeZoneDataType getLocalTime() { - return getProperty(LocalTime).orElse(null); + return getProperty(VariableNodeProperties.LocalTime).orElse(null); } + /** + * Get the value of the DataTypeVersion Property, if it exists. + * + * @return the value of the DataTypeVersion Property, if it exists. + * @see VariableNodeProperties#DataTypeVersion + */ @Nullable public String getDataTypeVersion() { - return getProperty(DataTypeVersion).orElse(null); + return getProperty(VariableNodeProperties.DataTypeVersion).orElse(null); } + /** + * Get the value of the DictionaryFragment Property, if it exists. + * + * @return the value of the DictionaryFragment Property, if it exists. + * @see VariableNodeProperties#DictionaryFragment + */ @Nullable public ByteString getDictionaryFragment() { - return getProperty(DictionaryFragment).orElse(null); + return getProperty(VariableNodeProperties.DictionaryFragment).orElse(null); } + /** + * Get the value of the AllowNulls Property, if it exists. + * + * @return the value of the AllowNulls Property, if it exists. + * @see VariableNodeProperties#AllowNulls + */ @Nullable public Boolean getAllowNulls() { - return getProperty(AllowNulls).orElse(null); + return getProperty(VariableNodeProperties.AllowNulls).orElse(null); } + /** + * Get the value of the MaxStringLength Property, if it exists. + * + * @return the value of the MaxStringLength Property, if it exists. + * @see VariableNodeProperties#MaxStringLength + */ @Nullable public UInteger getMaxStringLength() { - return getProperty(MaxStringLength).orElse(null); + return getProperty(VariableNodeProperties.MaxStringLength).orElse(null); } + /** + * Get the value of the MaxArrayLength Property, if it exists. + * + * @return the value of the MaxArrayLength Property, if it exists. + * @see VariableNodeProperties#MaxArrayLength + */ @Nullable public UInteger getMaxArrayLength() { - return getProperty(MaxArrayLength).orElse(null); + return getProperty(VariableNodeProperties.MaxArrayLength).orElse(null); } + /** + * Get the value of the EngineeringUnits Property, if it exists. + * + * @return the value of the EngineeringUnits Property, if it exists. + * @see VariableNodeProperties#EngineeringUnits + */ @Nullable public EUInformation getEngineeringUnits() { - return getProperty(EngineeringUnits).orElse(null); + return getProperty(VariableNodeProperties.EngineeringUnits).orElse(null); } + /** + * Set the value of the NodeVersion Property. + *

+ * A PropertyNode will be created if it does not already exist. + * + * @param nodeVersion the value to set. + * @see VariableNodeProperties#NodeVersion + */ public void setNodeVersion(String nodeVersion) { - setProperty(NodeVersion, nodeVersion); + setProperty(VariableNodeProperties.NodeVersion, nodeVersion); } + /** + * Set the value of the LocalTime Property. + *

+ * A PropertyNode will be created if it does not already exist. + * + * @param localTime the value to set. + * @see VariableNodeProperties#LocalTime + */ public void setLocalTime(TimeZoneDataType localTime) { - setProperty(LocalTime, localTime); + setProperty(VariableNodeProperties.LocalTime, localTime); } + /** + * Set the value of the DataTypeVersion Property. + *

+ * A PropertyNode will be created if it does not already exist. + * + * @param dataTypeVersion the value to set. + * @see VariableNodeProperties#DataTypeVersion + */ public void setDataTypeVersion(String dataTypeVersion) { - setProperty(DataTypeVersion, dataTypeVersion); + setProperty(VariableNodeProperties.DataTypeVersion, dataTypeVersion); } + /** + * Set the value of the DictionaryFragment Property. + *

+ * A PropertyNode will be created if it does not already exist. + * + * @param dictionaryFragment the value to set. + * @see VariableNodeProperties#DictionaryFragment + */ public void setDictionaryFragment(ByteString dictionaryFragment) { - setProperty(DictionaryFragment, dictionaryFragment); + setProperty(VariableNodeProperties.DictionaryFragment, dictionaryFragment); } + /** + * Set the value of the AllowNulls Property. + *

+ * A PropertyNode will be created if it does not already exist. + * + * @param allowNulls the value to set. + * @see VariableNodeProperties#AllowNulls + */ public void setAllowNulls(Boolean allowNulls) { - setProperty(AllowNulls, allowNulls); + setProperty(VariableNodeProperties.AllowNulls, allowNulls); } + /** + * Set the value of the MaxStringLength Property. + *

+ * A PropertyNode will be created if it does not already exist. + * + * @param maxStringLength the value to set. + * @see VariableNodeProperties#MaxStringLength + */ public void setMaxStringLength(UInteger maxStringLength) { - setProperty(MaxStringLength, maxStringLength); + setProperty(VariableNodeProperties.MaxStringLength, maxStringLength); } + /** + * Set the value of the MaxArrayLength Property. + *

+ * A PropertyNode will be created if it does not already exist. + * + * @param maxArrayLength the value to set. + * @see VariableNodeProperties#MaxArrayLength + */ public void setMaxArrayLength(UInteger maxArrayLength) { - setProperty(MaxArrayLength, maxArrayLength); + setProperty(VariableNodeProperties.MaxArrayLength, maxArrayLength); } + /** + * Set the value of the EngineeringUnits Property. + *

+ * A PropertyNode will be created if it does not already exist. + * + * @param engineeringUnits the value to set. + * @see VariableNodeProperties#EngineeringUnits + */ public void setEngineeringUnits(EUInformation engineeringUnits) { - setProperty(EngineeringUnits, engineeringUnits); - } - - public static final QualifiedProperty NodeVersion = new QualifiedProperty<>( - Namespaces.OPC_UA, - "NodeVersion", - Identifiers.String, - ValueRanks.Scalar, - String.class - ); - - public static final QualifiedProperty LocalTime = new QualifiedProperty<>( - Namespaces.OPC_UA, - "LocalTime", - Identifiers.TimeZoneDataType, - ValueRanks.Scalar, - TimeZoneDataType.class - ); - - public static final QualifiedProperty DataTypeVersion = new QualifiedProperty<>( - Namespaces.OPC_UA, - "DataTypeVersion", - Identifiers.String, - ValueRanks.Scalar, - String.class - ); - - public static final QualifiedProperty DictionaryFragment = new QualifiedProperty<>( - Namespaces.OPC_UA, - "DictionaryFragment", - Identifiers.ByteString, - ValueRanks.Scalar, - ByteString.class - ); - - public static final QualifiedProperty AllowNulls = new QualifiedProperty<>( - Namespaces.OPC_UA, - "AllowNulls", - Identifiers.Boolean, - ValueRanks.Scalar, - Boolean.class - ); - - public static final QualifiedProperty ValueAsText = new QualifiedProperty<>( - Namespaces.OPC_UA, - "ValueAsText", - Identifiers.LocalizedText, - ValueRanks.Scalar, - LocalizedText.class - ); - - public static final QualifiedProperty MaxStringLength = new QualifiedProperty<>( - Namespaces.OPC_UA, - "MaxStringLength", - Identifiers.UInt32, - ValueRanks.Scalar, - UInteger.class - ); - - public static final QualifiedProperty MaxArrayLength = new QualifiedProperty<>( - Namespaces.OPC_UA, - "MaxArrayLength", - Identifiers.UInt32, - ValueRanks.Scalar, - UInteger.class - ); - - public static final QualifiedProperty EngineeringUnits = new QualifiedProperty<>( - Namespaces.OPC_UA, - "EngineeringUnits", - Identifiers.EUInformation, - ValueRanks.Scalar, - EUInformation.class - ); + setProperty(VariableNodeProperties.EngineeringUnits, engineeringUnits); + } public static UaVariableNodeBuilder builder(UaNodeContext context) { return new UaVariableNodeBuilder(context); diff --git a/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaVariableTypeNode.java b/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaVariableTypeNode.java index 712a2c9b7..12fe6e9c5 100644 --- a/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaVariableTypeNode.java +++ b/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaVariableTypeNode.java @@ -12,18 +12,16 @@ import javax.annotation.Nullable; -import org.eclipse.milo.opcua.sdk.core.QualifiedProperty; -import org.eclipse.milo.opcua.sdk.core.ValueRanks; +import org.eclipse.milo.opcua.sdk.core.nodes.VariableNodeProperties; +import org.eclipse.milo.opcua.sdk.core.nodes.VariableTypeNodeProperties; import org.eclipse.milo.opcua.sdk.server.api.nodes.VariableTypeNode; import org.eclipse.milo.opcua.stack.core.AttributeId; -import org.eclipse.milo.opcua.stack.core.Identifiers; import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue; import org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText; import org.eclipse.milo.opcua.stack.core.types.builtin.NodeId; import org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName; import org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger; import org.eclipse.milo.opcua.stack.core.types.enumerated.NodeClass; -import org.eclipse.milo.opcua.stack.core.util.Namespaces; public class UaVariableTypeNode extends UaNode implements VariableTypeNode { @@ -171,21 +169,27 @@ public synchronized void setAttribute(AttributeId attributeId, Object value) { fireAttributeChanged(attributeId, value); } + /** + * Get the value of the NodeVersion Property, if it exists. + * + * @return the value of the NodeVersion Property, if it exists. + * @see VariableTypeNodeProperties#NodeVersion + */ @Nullable public String getNodeVersion() { - return getProperty(NodeVersion).orElse(null); + return getProperty(VariableTypeNodeProperties.NodeVersion).orElse(null); } + /** + * Set the value of the NodeVersion Property. + *

+ * A PropertyNode will be created if it does not already exist. + * + * @param nodeVersion the value to set. + * @see VariableNodeProperties#NodeVersion + */ public void setNodeVersion(String nodeVersion) { - setProperty(NodeVersion, nodeVersion); + setProperty(VariableTypeNodeProperties.NodeVersion, nodeVersion); } - public static final QualifiedProperty NodeVersion = new QualifiedProperty<>( - Namespaces.OPC_UA, - "NodeVersion", - Identifiers.String, - ValueRanks.Scalar, - String.class - ); - } diff --git a/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaViewNode.java b/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaViewNode.java index 3567d7bd8..d016ff99f 100644 --- a/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaViewNode.java +++ b/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/UaViewNode.java @@ -12,18 +12,15 @@ import javax.annotation.Nullable; -import org.eclipse.milo.opcua.sdk.core.QualifiedProperty; -import org.eclipse.milo.opcua.sdk.core.ValueRanks; +import org.eclipse.milo.opcua.sdk.core.nodes.ViewNodeProperties; import org.eclipse.milo.opcua.sdk.server.api.nodes.ViewNode; import org.eclipse.milo.opcua.stack.core.AttributeId; -import org.eclipse.milo.opcua.stack.core.Identifiers; import org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText; import org.eclipse.milo.opcua.stack.core.types.builtin.NodeId; import org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName; import org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UByte; import org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger; import org.eclipse.milo.opcua.stack.core.types.enumerated.NodeClass; -import org.eclipse.milo.opcua.stack.core.util.Namespaces; public class UaViewNode extends UaNode implements ViewNode { @@ -105,38 +102,50 @@ public synchronized void setAttribute(AttributeId attributeId, Object value) { fireAttributeChanged(attributeId, value); } + /** + * Get the value of the NodeVersion Property, if it exists. + * + * @return the value of the NodeVersion Property, if it exists. + * @see ViewNodeProperties#NodeVersion + */ @Nullable public String getNodeVersion() { - return getProperty(NodeVersion).orElse(null); + return getProperty(ViewNodeProperties.NodeVersion).orElse(null); } + /** + * Get the value of the ViewVersion Property, if it exists. + * + * @return the value of the ViewVersion Property, if it exists. + * @see ViewNodeProperties#ViewVersion + */ @Nullable public UInteger getViewVersion() { - return getProperty(ViewVersion).orElse(null); + return getProperty(ViewNodeProperties.ViewVersion).orElse(null); } + /** + * Set the value of the NodeVersion Property. + *

+ * A PropertyNode will be created if it does not already exist. + * + * @param nodeVersion the value to set. + * @see ViewNodeProperties#NodeVersion + */ public void setNodeVersion(String nodeVersion) { - setProperty(NodeVersion, nodeVersion); + setProperty(ViewNodeProperties.NodeVersion, nodeVersion); } + /** + * Set the value of the ViewVersion Property. + *

+ * A PropertyNode will be created if it does not already exist. + * + * @param viewVersion the value to set. + * @see ViewNodeProperties#NodeVersion + */ public void setViewVersion(UInteger viewVersion) { - setProperty(ViewVersion, viewVersion); + setProperty(ViewNodeProperties.ViewVersion, viewVersion); } - public static final QualifiedProperty NodeVersion = new QualifiedProperty<>( - Namespaces.OPC_UA, - "NodeVersion", - Identifiers.String, - ValueRanks.Scalar, - String.class - ); - - public static final QualifiedProperty ViewVersion = new QualifiedProperty<>( - Namespaces.OPC_UA, - "ViewVersion", - Identifiers.UInt32, - ValueRanks.Scalar, - UInteger.class - ); - }