use of org.eclipse.milo.opcua.stack.core.types.structured.AddReferencesRequest in project milo by eclipse.
the class DefaultNodeManagementServiceSet method onAddReferences.
@Override
public void onAddReferences(ServiceRequest service) {
OpcUaServer server = service.attr(ServiceAttributes.SERVER_KEY).get();
Session session = service.attr(ServiceAttributes.SESSION_KEY).get();
AddReferencesRequest request = (AddReferencesRequest) service.getRequest();
List<AddReferencesItem> referencesToAdd = l(request.getReferencesToAdd());
if (referencesToAdd.isEmpty()) {
service.setServiceFault(StatusCodes.Bad_NothingToDo);
return;
}
if (referencesToAdd.size() > server.getConfig().getLimits().getMaxNodesPerNodeManagement().longValue()) {
service.setServiceFault(StatusCodes.Bad_TooManyOperations);
return;
}
AddReferencesContext context = new AddReferencesContext(server, session, new DiagnosticsContext<>());
server.getAddressSpaceManager().addReferences(context, referencesToAdd);
context.getFuture().thenAccept(results -> {
ResponseHeader header = service.createResponseHeader();
AddReferencesResponse response = new AddReferencesResponse(header, a(results, StatusCode.class), new DiagnosticInfo[0]);
service.setResponse(response);
});
}
Aggregations