当前位置: 首页>>代码示例>>Java>>正文


Java AccessLevel类代码示例

本文整理汇总了Java中org.eclipse.milo.opcua.sdk.core.AccessLevel的典型用法代码示例。如果您正苦于以下问题:Java AccessLevel类的具体用法?Java AccessLevel怎么用?Java AccessLevel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AccessLevel类属于org.eclipse.milo.opcua.sdk.core包,在下文中一共展示了AccessLevel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readDataAttributes

import org.eclipse.milo.opcua.sdk.core.AccessLevel; //导入依赖的package包/类
private CompletableFuture<List<DataValue>> readDataAttributes(Session session, Namespace namespace, NodeId itemId) {
    Function<AttributeId, ReadValueId> f = id ->
        new ReadValueId(itemId, id.uid(), null, QualifiedName.NULL_VALUE);

    CompletableFuture<List<DataValue>> future = new CompletableFuture<>();

    ReadContext readContext = new ReadContext(
        server, session, future, new DiagnosticsContext<>());

    List<ReadValueId> attributes = newArrayList(
        f.apply(AttributeId.AccessLevel),
        f.apply(AttributeId.UserAccessLevel),
        f.apply(AttributeId.MinimumSamplingInterval));

    namespace.read(readContext, 0.0, TimestampsToReturn.Neither, attributes);

    return future;
}
 
开发者ID:eclipse,项目名称:milo,代码行数:19,代码来源:SubscriptionManager.java

示例2: testWriteConversion

import org.eclipse.milo.opcua.sdk.core.AccessLevel; //导入依赖的package包/类
private void testWriteConversion(
    DataValue value,
    NodeId dataType,
    Consumer<UaVariableNode> nodeCustomizer) throws UaException {

    final UaVariableNode varNode = createMockNode("test", node -> {
        UByte accessLevel = ubyte(AccessLevel.getMask(AccessLevel.READ_WRITE));
        node.setAccessLevel(accessLevel);
        node.setUserAccessLevel(accessLevel);
        if (nodeCustomizer != null) {
            nodeCustomizer.accept(node);
        }
    });

    if (dataType != null) {
        varNode.setDataType(dataType);
    }

    AttributeWriter.writeAttribute(new AttributeContext(null, null), varNode, AttributeId.Value, value, null);
}
 
开发者ID:eclipse,项目名称:milo,代码行数:21,代码来源:AttributeWriterTest.java

示例3: CamelServerItem

import org.eclipse.milo.opcua.sdk.core.AccessLevel; //导入依赖的package包/类
public CamelServerItem(final String itemId, final ServerNodeMap nodeManager, final UShort namespaceIndex,
		final UaObjectNode baseNode) {

	this.baseNode = baseNode;

	final NodeId nodeId = new NodeId(namespaceIndex, "items-" + itemId);
	final QualifiedName qname = new QualifiedName(namespaceIndex, itemId);
	final LocalizedText displayName = LocalizedText.english(itemId);

	// create variable node

	this.item = new UaVariableNode(nodeManager, nodeId, qname, displayName) {

		@Override
		public DataValue getValue() {
			return getDataValue();
		}

		@Override
		public synchronized void setValue(final DataValue value) {
			setDataValue(value);
		}

	};

	// item.setDataType();
	this.item.setAccessLevel(ubyte(AccessLevel.getMask(AccessLevel.READ_WRITE)));
	this.item.setUserAccessLevel(ubyte(AccessLevel.getMask(AccessLevel.READ_WRITE)));

	baseNode.addComponent(this.item);
}
 
开发者ID:ctron,项目名称:de.dentrassi.camel.milo,代码行数:32,代码来源:CamelServerItem.java

示例4: addStaticScalarNodes

import org.eclipse.milo.opcua.sdk.core.AccessLevel; //导入依赖的package包/类
private void addStaticScalarNodes() {
    UaObjectNode folder = addFoldersToRoot(testFolder, "/Static/AllProfiles/Scalar");

    for (Object[] os : STATIC_SCALAR_NODES) {
        String name = (String) os[0];
        NodeId typeId = (NodeId) os[1];
        Variant variant = (Variant) os[2];

        UaVariableNode node = new UaVariableNode.UaVariableNodeBuilder(nodeManager)
            .setNodeId(new NodeId(namespaceIndex, "/Static/AllProfiles/Scalar/" + name))
            .setAccessLevel(ubyte(AccessLevel.getMask(AccessLevel.READ_WRITE)))
            .setUserAccessLevel(ubyte(AccessLevel.getMask(AccessLevel.READ_WRITE)))
            .setBrowseName(new QualifiedName(namespaceIndex, name))
            .setDisplayName(LocalizedText.english(name))
            .setDataType(typeId)
            .setTypeDefinition(Identifiers.BaseDataVariableType)
            .build();

        node.setValue(new DataValue(variant));

        folder.addReference(new Reference(
            folder.getNodeId(),
            Identifiers.Organizes,
            node.getNodeId().expanded(),
            node.getNodeClass(),
            true
        ));

        logger.debug("Added reference: {} -> {}", folder.getNodeId(), node.getNodeId());

        nodeManager.put(node.getNodeId(), node);
    }
}
 
开发者ID:eclipse,项目名称:milo,代码行数:34,代码来源:TestNamespace.java

示例5: readEventAttributes

import org.eclipse.milo.opcua.sdk.core.AccessLevel; //导入依赖的package包/类
private CompletableFuture<EventAttributes> readEventAttributes(Namespace namespace, NodeId nodeId) {
    Function<AttributeId, ReadValueId> f = id ->
        new ReadValueId(nodeId, id.uid(), null, QualifiedName.NULL_VALUE);

    CompletableFuture<List<DataValue>> future = new CompletableFuture<>();

    ReadContext readContext = new ReadContext(
        server, null, future, new DiagnosticsContext<>());

    List<ReadValueId> readValueIds = newArrayList(
        f.apply(AttributeId.AccessLevel),
        f.apply(AttributeId.UserAccessLevel),
        f.apply(AttributeId.EventNotifier));

    namespace.read(readContext, 0.0, TimestampsToReturn.Neither, readValueIds);

    return future.thenApply(values -> {
        UByte accessLevel = Optional.ofNullable((UByte) values.get(0).getValue().getValue()).orElse(ubyte(1));
        UByte userAccessLevel = Optional.ofNullable((UByte) values.get(1).getValue().getValue()).orElse(ubyte(1));
        Optional<UByte> eventNotifier = Optional.ofNullable((UByte) values.get(2).getValue().getValue());

        return new EventAttributes(
            AccessLevel.fromMask(accessLevel),
            AccessLevel.fromMask(userAccessLevel),
            eventNotifier);
    });
}
 
开发者ID:eclipse,项目名称:milo,代码行数:28,代码来源:SubscriptionManager.java

示例6: getAccessLevels

import org.eclipse.milo.opcua.sdk.core.AccessLevel; //导入依赖的package包/类
public static Set<AccessLevel> getAccessLevels(
    ServerNode node,
    AttributeContext context) throws UaException {

    UByte accessLevel = extract(
        node.getAttribute(
            context,
            AttributeId.AccessLevel)
    );

    return AccessLevel.fromMask(accessLevel);
}
 
开发者ID:eclipse,项目名称:milo,代码行数:13,代码来源:AttributeUtil.java

示例7: getUserAccessLevels

import org.eclipse.milo.opcua.sdk.core.AccessLevel; //导入依赖的package包/类
public static Set<AccessLevel> getUserAccessLevels(
    ServerNode node,
    AttributeContext context) throws UaException {

    UByte userAccessLevel = extract(
        node.getAttribute(
            context,
            AttributeId.UserAccessLevel)
    );

    return AccessLevel.fromMask(userAccessLevel);
}
 
开发者ID:eclipse,项目名称:milo,代码行数:13,代码来源:AttributeUtil.java

示例8: getUserAccessLevel

import org.eclipse.milo.opcua.sdk.core.AccessLevel; //导入依赖的package包/类
@Override
public UByte getUserAccessLevel(AttributeContext context, VariableNode node) throws UaException {
    Optional<Object> identity = context.getSession().map(Session::getIdentityObject);

    Set<AccessLevel> accessLevels = identity.map(accessLevelsFn).orElse(INTERNAL_ACCESS);

    return ubyte(AccessLevel.getMask(accessLevels));
}
 
开发者ID:eclipse,项目名称:milo,代码行数:9,代码来源:RestrictedAccessDelegate.java

示例9: addScalarNodes

import org.eclipse.milo.opcua.sdk.core.AccessLevel; //导入依赖的package包/类
private void addScalarNodes(UaFolderNode rootNode) {
    UaFolderNode scalarTypesFolder = new UaFolderNode(
        server.getNodeMap(),
        new NodeId(namespaceIndex, "HelloWorld/ScalarTypes"),
        new QualifiedName(namespaceIndex, "ScalarTypes"),
        LocalizedText.english("ScalarTypes")
    );

    server.getNodeMap().addNode(scalarTypesFolder);
    rootNode.addOrganizes(scalarTypesFolder);

    for (Object[] os : STATIC_SCALAR_NODES) {
        String name = (String) os[0];
        NodeId typeId = (NodeId) os[1];
        Variant variant = (Variant) os[2];

        UaVariableNode node = new UaVariableNode.UaVariableNodeBuilder(server.getNodeMap())
            .setNodeId(new NodeId(namespaceIndex, "HelloWorld/ScalarTypes/" + name))
            .setAccessLevel(ubyte(AccessLevel.getMask(AccessLevel.READ_WRITE)))
            .setUserAccessLevel(ubyte(AccessLevel.getMask(AccessLevel.READ_WRITE)))
            .setBrowseName(new QualifiedName(namespaceIndex, name))
            .setDisplayName(LocalizedText.english(name))
            .setDataType(typeId)
            .setTypeDefinition(Identifiers.BaseDataVariableType)
            .build();

        node.setValue(new DataValue(variant));

        node.setAttributeDelegate(new ValueLoggingDelegate());

        server.getNodeMap().addNode(node);
        scalarTypesFolder.addOrganizes(node);
    }
}
 
开发者ID:eclipse,项目名称:milo,代码行数:35,代码来源:ExampleNamespace.java

示例10: addAdminReadableNodes

import org.eclipse.milo.opcua.sdk.core.AccessLevel; //导入依赖的package包/类
private void addAdminReadableNodes(UaFolderNode rootNode) {
    UaFolderNode adminFolder = new UaFolderNode(
        server.getNodeMap(),
        new NodeId(namespaceIndex, "HelloWorld/OnlyAdminCanRead"),
        new QualifiedName(namespaceIndex, "OnlyAdminCanRead"),
        LocalizedText.english("OnlyAdminCanRead")
    );

    server.getNodeMap().addNode(adminFolder);
    rootNode.addOrganizes(adminFolder);

    String name = "String";
    UaVariableNode node = new UaVariableNode.UaVariableNodeBuilder(server.getNodeMap())
        .setNodeId(new NodeId(namespaceIndex, "HelloWorld/OnlyAdminCanRead/" + name))
        .setAccessLevel(ubyte(AccessLevel.getMask(AccessLevel.READ_WRITE)))
        .setBrowseName(new QualifiedName(namespaceIndex, name))
        .setDisplayName(LocalizedText.english(name))
        .setDataType(Identifiers.String)
        .setTypeDefinition(Identifiers.BaseDataVariableType)
        .build();

    node.setValue(new DataValue(new Variant("shh... don't tell the lusers")));

    node.setAttributeDelegate(new RestrictedAccessDelegate(identity -> {
        if ("admin".equals(identity)) {
            return AccessLevel.READ_WRITE;
        } else {
            return AccessLevel.NONE;
        }
    }));

    server.getNodeMap().addNode(node);
    adminFolder.addOrganizes(node);
}
 
开发者ID:eclipse,项目名称:milo,代码行数:35,代码来源:ExampleNamespace.java

示例11: addAdminWritableNodes

import org.eclipse.milo.opcua.sdk.core.AccessLevel; //导入依赖的package包/类
private void addAdminWritableNodes(UaFolderNode rootNode) {
    UaFolderNode adminFolder = new UaFolderNode(
        server.getNodeMap(),
        new NodeId(namespaceIndex, "HelloWorld/OnlyAdminCanWrite"),
        new QualifiedName(namespaceIndex, "OnlyAdminCanWrite"),
        LocalizedText.english("OnlyAdminCanWrite")
    );

    server.getNodeMap().addNode(adminFolder);
    rootNode.addOrganizes(adminFolder);

    String name = "String";
    UaVariableNode node = new UaVariableNode.UaVariableNodeBuilder(server.getNodeMap())
        .setNodeId(new NodeId(namespaceIndex, "HelloWorld/OnlyAdminCanWrite/" + name))
        .setAccessLevel(ubyte(AccessLevel.getMask(AccessLevel.READ_WRITE)))
        .setBrowseName(new QualifiedName(namespaceIndex, name))
        .setDisplayName(LocalizedText.english(name))
        .setDataType(Identifiers.String)
        .setTypeDefinition(Identifiers.BaseDataVariableType)
        .build();

    node.setValue(new DataValue(new Variant("admin was here")));

    node.setAttributeDelegate(new RestrictedAccessDelegate(identity -> {
        if ("admin".equals(identity)) {
            return AccessLevel.READ_WRITE;
        } else {
            return AccessLevel.READ_ONLY;
        }
    }));

    server.getNodeMap().addNode(node);
    adminFolder.addOrganizes(node);
}
 
开发者ID:eclipse,项目名称:milo,代码行数:35,代码来源:ExampleNamespace.java

示例12: EventAttributes

import org.eclipse.milo.opcua.sdk.core.AccessLevel; //导入依赖的package包/类
public EventAttributes(EnumSet<AccessLevel> v1, EnumSet<AccessLevel> v2, Optional<UByte> v3) {
    super(v1, v2, v3);
}
 
开发者ID:eclipse,项目名称:milo,代码行数:4,代码来源:SubscriptionManager.java

示例13: setAccessLevel

import org.eclipse.milo.opcua.sdk.core.AccessLevel; //导入依赖的package包/类
@Override
public synchronized void setAccessLevel(UByte accessLevel) {
    this.accessLevel = accessLevel;

    fireAttributeChanged(AttributeId.AccessLevel, accessLevel);
}
 
开发者ID:eclipse,项目名称:milo,代码行数:7,代码来源:UaVariableNode.java

示例14: writeMaskForAttribute

import org.eclipse.milo.opcua.sdk.core.AccessLevel; //导入依赖的package包/类
private static WriteMask writeMaskForAttribute(AttributeId attributeId) {
    switch (attributeId) {
        case AccessLevel:
            return WriteMask.AccessLevel;
        case ArrayDimensions:
            return WriteMask.ArrayDimensions;
        case BrowseName:
            return WriteMask.BrowseName;
        case ContainsNoLoops:
            return WriteMask.ContainsNoLoops;
        case DataType:
            return WriteMask.DataType;
        case Description:
            return WriteMask.Description;
        case DisplayName:
            return WriteMask.DisplayName;
        case EventNotifier:
            return WriteMask.EventNotifier;
        case Executable:
            return WriteMask.Executable;
        case Historizing:
            return WriteMask.Historizing;
        case InverseName:
            return WriteMask.InverseName;
        case IsAbstract:
            return WriteMask.IsAbstract;
        case MinimumSamplingInterval:
            return WriteMask.MinimumSamplingInterval;
        case NodeClass:
            return WriteMask.NodeClass;
        case NodeId:
            return WriteMask.NodeId;
        case Symmetric:
            return WriteMask.Symmetric;
        case UserAccessLevel:
            return WriteMask.UserAccessLevel;
        case UserExecutable:
            return WriteMask.UserExecutable;
        case UserWriteMask:
            return WriteMask.UserWriteMask;
        case Value:
            return WriteMask.ValueForVariableType;
        case ValueRank:
            return WriteMask.ValueRank;
        case WriteMask:
            return WriteMask.WriteMask;

        default:
            throw new IllegalArgumentException("unknown AttributeId: " + attributeId);
    }
}
 
开发者ID:eclipse,项目名称:milo,代码行数:52,代码来源:AttributeWriter.java

示例15: RestrictedAccessDelegate

import org.eclipse.milo.opcua.sdk.core.AccessLevel; //导入依赖的package包/类
public RestrictedAccessDelegate(Function<Object, Set<AccessLevel>> accessLevelsFn) {
    this(null, accessLevelsFn);
}
 
开发者ID:eclipse,项目名称:milo,代码行数:4,代码来源:RestrictedAccessDelegate.java


注:本文中的org.eclipse.milo.opcua.sdk.core.AccessLevel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。