use of org.eclipse.milo.opcua.stack.core.AttributeId in project milo by eclipse.
the class AddressSpace method createObjectNodeFromBaseAttributes.
private CompletableFuture<UaObjectNode> createObjectNodeFromBaseAttributes(NodeId nodeId, List<DataValue> baseAttributeValues) {
Set<AttributeId> remainingAttributes = Sets.difference(AttributeId.OBJECT_ATTRIBUTES, AttributeId.BASE_ATTRIBUTES);
CompletableFuture<ReadResponse> attributesFuture = readAttributes(nodeId, remainingAttributes);
CompletableFuture<NodeId> typeDefinitionFuture = readTypeDefinition(nodeId);
return CompletableFuture.allOf(attributesFuture, typeDefinitionFuture).thenCompose(ignored -> {
ReadResponse response = attributesFuture.join();
NodeId typeDefinitionId = typeDefinitionFuture.join();
List<DataValue> attributeValues = new ArrayList<>(baseAttributeValues);
Collections.addAll(attributeValues, response.getResults());
try {
UaObjectNode node = newObjectNode(nodeId, typeDefinitionId, attributeValues);
nodeCache.put(node.getNodeId(), node);
return completedFuture(node);
} catch (UaException e) {
return failedFuture(e);
}
});
}
use of org.eclipse.milo.opcua.stack.core.AttributeId in project milo by eclipse.
the class AddressSpace method createViewNodeFromBaseAttributes.
private CompletableFuture<UaViewNode> createViewNodeFromBaseAttributes(NodeId nodeId, List<DataValue> baseAttributeValues) {
Set<AttributeId> remainingAttributes = Sets.difference(AttributeId.VIEW_ATTRIBUTES, AttributeId.BASE_ATTRIBUTES);
CompletableFuture<ReadResponse> attributesFuture = readAttributes(nodeId, remainingAttributes);
return attributesFuture.thenCompose(response -> {
List<DataValue> attributeValues = new ArrayList<>(baseAttributeValues);
Collections.addAll(attributeValues, response.getResults());
try {
UaViewNode node = newViewNode(nodeId, attributeValues);
nodeCache.put(node.getNodeId(), node);
return completedFuture(node);
} catch (UaException e) {
return failedFuture(e);
}
});
}
use of org.eclipse.milo.opcua.stack.core.AttributeId in project milo by eclipse.
the class AddressSpace method createDataTypeNodeFromBaseAttributes.
private CompletableFuture<UaDataTypeNode> createDataTypeNodeFromBaseAttributes(NodeId nodeId, List<DataValue> baseAttributeValues) {
Set<AttributeId> remainingAttributes = Sets.difference(AttributeId.DATA_TYPE_ATTRIBUTES, AttributeId.BASE_ATTRIBUTES);
CompletableFuture<ReadResponse> attributesFuture = readAttributes(nodeId, remainingAttributes);
return attributesFuture.thenCompose(response -> {
List<DataValue> attributeValues = new ArrayList<>(baseAttributeValues);
Collections.addAll(attributeValues, response.getResults());
try {
UaDataTypeNode node = newDataTypeNode(nodeId, attributeValues);
nodeCache.put(node.getNodeId(), node);
return completedFuture(node);
} catch (UaException e) {
return failedFuture(e);
}
});
}
use of org.eclipse.milo.opcua.stack.core.AttributeId in project milo by eclipse.
the class AddressSpace method createMethodNodeFromBaseAttributes.
private CompletableFuture<UaMethodNode> createMethodNodeFromBaseAttributes(NodeId nodeId, List<DataValue> baseAttributeValues) {
Set<AttributeId> remainingAttributes = Sets.difference(AttributeId.METHOD_ATTRIBUTES, AttributeId.BASE_ATTRIBUTES);
CompletableFuture<ReadResponse> attributesFuture = readAttributes(nodeId, remainingAttributes);
return attributesFuture.thenCompose(response -> {
List<DataValue> attributeValues = new ArrayList<>(baseAttributeValues);
Collections.addAll(attributeValues, response.getResults());
try {
UaMethodNode node = newMethodNode(nodeId, attributeValues);
nodeCache.put(node.getNodeId(), node);
return completedFuture(node);
} catch (UaException e) {
return failedFuture(e);
}
});
}
use of org.eclipse.milo.opcua.stack.core.AttributeId in project milo by eclipse.
the class AddressSpace method createVariableTypeNodeFromBaseAttributes.
private CompletableFuture<UaVariableTypeNode> createVariableTypeNodeFromBaseAttributes(NodeId nodeId, List<DataValue> baseAttributeValues) {
Set<AttributeId> remainingAttributes = Sets.difference(AttributeId.VARIABLE_TYPE_ATTRIBUTES, AttributeId.BASE_ATTRIBUTES);
CompletableFuture<ReadResponse> attributesFuture = readAttributes(nodeId, remainingAttributes);
return attributesFuture.thenCompose(response -> {
List<DataValue> attributeValues = new ArrayList<>(baseAttributeValues);
Collections.addAll(attributeValues, response.getResults());
try {
UaVariableTypeNode node = newVariableTypeNode(nodeId, attributeValues);
nodeCache.put(node.getNodeId(), node);
return completedFuture(node);
} catch (UaException e) {
return failedFuture(e);
}
});
}
Aggregations