本文整理汇总了Java中org.eclipse.milo.opcua.sdk.server.OpcUaServer类的典型用法代码示例。如果您正苦于以下问题:Java OpcUaServer类的具体用法?Java OpcUaServer怎么用?Java OpcUaServer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OpcUaServer类属于org.eclipse.milo.opcua.sdk.server包,在下文中一共展示了OpcUaServer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onUnregisterNodes
import org.eclipse.milo.opcua.sdk.server.OpcUaServer; //导入依赖的package包/类
@Override
public void onUnregisterNodes(
ServiceRequest<UnregisterNodesRequest, UnregisterNodesResponse> service) throws UaException {
OpcUaServer server = service.attr(ServiceAttributes.SERVER_KEY).get();
UnregisterNodesRequest request = service.getRequest();
List<NodeId> nodeIds = l(request.getNodesToUnregister());
if (nodeIds.isEmpty()) {
throw new UaException(StatusCodes.Bad_NothingToDo);
}
if (nodeIds.size() > server.getConfig().getLimits().getMaxNodesPerRegisterNodes().intValue()) {
throw new UaException(StatusCodes.Bad_TooManyOperations);
}
service.setResponse(new UnregisterNodesResponse(service.createResponseHeader(StatusCode.GOOD)));
}
示例2: onTranslateBrowsePaths
import org.eclipse.milo.opcua.sdk.server.OpcUaServer; //导入依赖的package包/类
@Override
public void onTranslateBrowsePaths(
ServiceRequest<TranslateBrowsePathsToNodeIdsRequest, TranslateBrowsePathsToNodeIdsResponse> service) {
translateBrowsePathsCounter.record(service);
OpcUaServer server = service.attr(ServiceAttributes.SERVER_KEY).get();
Session session = service.attr(ServiceAttributes.SESSION_KEY).get();
NamespaceManager namespaceManager = server.getNamespaceManager();
BrowsePathsHelper browsePathsHelper = new BrowsePathsHelper(
() -> Optional.ofNullable(session),
server,
namespaceManager
);
browsePathsHelper.onTranslateBrowsePaths(service);
}
示例3: onRegisterNodes
import org.eclipse.milo.opcua.sdk.server.OpcUaServer; //导入依赖的package包/类
@Override
public void onRegisterNodes(
ServiceRequest<RegisterNodesRequest, RegisterNodesResponse> service) throws UaException {
OpcUaServer server = service.attr(ServiceAttributes.SERVER_KEY).get();
RegisterNodesRequest request = service.getRequest();
List<NodeId> nodeIds = l(request.getNodesToRegister());
if (nodeIds.isEmpty()) {
throw new UaException(StatusCodes.Bad_NothingToDo);
}
if (nodeIds.size() > server.getConfig().getLimits().getMaxNodesPerRegisterNodes().intValue()) {
throw new UaException(StatusCodes.Bad_TooManyOperations);
}
service.setResponse(new RegisterNodesResponse(
service.createResponseHeader(StatusCode.GOOD),
a(nodeIds, NodeId.class)
));
}
示例4: doStart
import org.eclipse.milo.opcua.sdk.server.OpcUaServer; //导入依赖的package包/类
@Override
protected void doStart() throws Exception {
this.server = new OpcUaServer(buildServerConfig());
this.namespace = this.server.getNamespaceManager().registerAndAdd(this.namespaceUri,
index -> new CamelNamespace(index, this.namespaceUri, this.server));
super.doStart();
this.server.startup();
}
示例5: onTranslateBrowsePaths
import org.eclipse.milo.opcua.sdk.server.OpcUaServer; //导入依赖的package包/类
public void onTranslateBrowsePaths(
ServiceRequest<TranslateBrowsePathsToNodeIdsRequest, TranslateBrowsePathsToNodeIdsResponse> service) {
OpcUaServer server = service.attr(ServiceAttributes.SERVER_KEY).get();
List<BrowsePath> browsePaths = l(service.getRequest().getBrowsePaths());
if (browsePaths.size() >
server.getConfig().getLimits().getMaxNodesPerTranslateBrowsePathsToNodeIds().intValue()) {
service.setServiceFault(StatusCodes.Bad_TooManyOperations);
} else {
List<CompletableFuture<BrowsePathResult>> futures = newArrayListWithCapacity(browsePaths.size());
for (BrowsePath browsePath : browsePaths) {
futures.add(translate(browsePath));
}
sequence(futures).thenAcceptAsync(results -> {
ResponseHeader header = service.createResponseHeader();
TranslateBrowsePathsToNodeIdsResponse response = new TranslateBrowsePathsToNodeIdsResponse(
header, a(results, BrowsePathResult.class), new DiagnosticInfo[0]);
service.setResponse(response);
}, server.getExecutorService());
}
}
示例6: CustomNamespace
import org.eclipse.milo.opcua.sdk.server.OpcUaServer; //导入依赖的package包/类
public CustomNamespace(final UShort index, final OpcUaServer server) {
this.index = index;
this.nodeMap = server.getNodeMap();
this.subscriptionModel = new SubscriptionModel(server, this);
registerItems();
}
示例7: TestNamespace
import org.eclipse.milo.opcua.sdk.server.OpcUaServer; //导入依赖的package包/类
public TestNamespace(OpcUaServer server, UShort namespaceIndex) {
this.server = server;
this.namespaceIndex = namespaceIndex;
nodeManager = server.getNodeMap();
NodeId testFolderNodeId = new NodeId(namespaceIndex, "Test");
testFolder = new UaFolderNode(
nodeManager,
testFolderNodeId,
new QualifiedName(namespaceIndex, "Test"),
LocalizedText.english("Test")
);
nodeManager.put(testFolderNodeId, testFolder);
try {
server.getUaNamespace().addReference(
Identifiers.ObjectsFolder,
Identifiers.Organizes,
true,
testFolderNodeId.expanded(),
NodeClass.Object
);
} catch (UaException e) {
logger.error("Error adding reference to Connections folder.", e);
}
subscriptionModel = new SubscriptionModel(server, this);
addStaticScalarNodes();
}
示例8: browse
import org.eclipse.milo.opcua.sdk.server.OpcUaServer; //导入依赖的package包/类
default void browse(BrowseContext context,
ViewDescription view,
UInteger maxReferencesPerNode,
List<BrowseDescription> nodesToBrowse) {
OpcUaServer server = context.getServer();
List<CompletableFuture<BrowseResult>> futures = nodesToBrowse.stream()
.map(browseDescription ->
BrowseHelper.browse(context, server, view, maxReferencesPerNode, browseDescription))
.collect(toList());
FutureUtils.sequence(futures).thenAccept(context::complete);
}
示例9: BrowseContext
import org.eclipse.milo.opcua.sdk.server.OpcUaServer; //导入依赖的package包/类
public BrowseContext(OpcUaServer server,
@Nullable Session session,
CompletableFuture<List<BrowseResult>> future,
DiagnosticsContext<BrowseDescription> diagnosticsContext) {
super(server, session, future, diagnosticsContext);
}
示例10: OperationContext
import org.eclipse.milo.opcua.sdk.server.OpcUaServer; //导入依赖的package包/类
public OperationContext(OpcUaServer server,
@Nullable Session session,
CompletableFuture<List<U>> future,
DiagnosticsContext<T> diagnosticsContext) {
this.server = server;
this.session = session;
this.future = future;
this.diagnostics = diagnosticsContext;
}
示例11: ReadContext
import org.eclipse.milo.opcua.sdk.server.OpcUaServer; //导入依赖的package包/类
public ReadContext(OpcUaServer server,
@Nullable Session session,
CompletableFuture<List<DataValue>> future,
DiagnosticsContext<ReadValueId> diagnosticsContext) {
super(server, session, future, diagnosticsContext);
}
示例12: WriteContext
import org.eclipse.milo.opcua.sdk.server.OpcUaServer; //导入依赖的package包/类
public WriteContext(OpcUaServer server,
@Nullable Session session,
CompletableFuture<List<StatusCode>> future,
DiagnosticsContext<WriteValue> diagnosticsContext) {
super(server, session, future, diagnosticsContext);
}
示例13: HistoryReadContext
import org.eclipse.milo.opcua.sdk.server.OpcUaServer; //导入依赖的package包/类
public HistoryReadContext(OpcUaServer server,
@Nullable Session session,
CompletableFuture<List<HistoryReadResult>> future,
DiagnosticsContext<HistoryReadValueId> diagnosticsContext) {
super(server, session, future, diagnosticsContext);
}
示例14: HistoryUpdateContext
import org.eclipse.milo.opcua.sdk.server.OpcUaServer; //导入依赖的package包/类
public HistoryUpdateContext(OpcUaServer server,
@Nullable Session session,
CompletableFuture<List<HistoryUpdateResult>> future,
DiagnosticsContext<HistoryUpdateDetails> diagnosticsContext) {
super(server, session, future, diagnosticsContext);
}
示例15: CallContext
import org.eclipse.milo.opcua.sdk.server.OpcUaServer; //导入依赖的package包/类
public CallContext(OpcUaServer server,
@Nullable Session session,
CompletableFuture<List<CallMethodResult>> future,
DiagnosticsContext<CallMethodRequest> diagnosticsContext) {
super(server, session, future, diagnosticsContext);
}