本文整理汇总了Java中org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText.english方法的典型用法代码示例。如果您正苦于以下问题:Java LocalizedText.english方法的具体用法?Java LocalizedText.english怎么用?Java LocalizedText.english使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText
的用法示例。
在下文中一共展示了LocalizedText.english方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCallMeNode
import org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText; //导入方法依赖的package包/类
public static UaMethodNode createCallMeNode(final UShort index, final ServerNodeMap nodeMap) {
final UaMethodNode method = new UaMethodNode(
nodeMap,
new NodeId(index, "call-me-al"),
new QualifiedName(index, "Al"),
LocalizedText.english("Al"),
LocalizedText.english("Call me Al"),
UInteger.MIN, UInteger.MIN, true, true);
try {
final AnnotationBasedInvocationHandler handler = AnnotationBasedInvocationHandler
.fromAnnotatedObject(nodeMap, new CallMe());
method.setInputArguments(handler.getInputArguments());
method.setOutputArguments(handler.getOutputArguments());
method.setInvocationHandler(handler);
} catch (final Exception e) {
e.printStackTrace();
}
return method;
}
示例2: addVendorInfoPlainJava
import org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText; //导入方法依赖的package包/类
private void addVendorInfoPlainJava(UaObjectNode vendorServerInfo) {
UaVariableNode availableProcessors = new UaVariableNode(
nodeMap,
new NodeId(1, "VendorServerInfo/AvailableProcessors"),
new QualifiedName(1, "AvailableProcessors"),
LocalizedText.english("AvailableProcessors")) {
@Override
public DataValue getValue() {
return new DataValue(new Variant(Runtime.getRuntime().availableProcessors()));
}
};
availableProcessors.setDataType(Identifiers.Int32);
vendorServerInfo.addComponent(availableProcessors);
}
示例3: CamelServerItem
import org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText; //导入方法依赖的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);
}
示例4: getLocalizedTexts
import org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText; //导入方法依赖的package包/类
@DataProvider
public Object[][] getLocalizedTexts() {
return new Object[][]{
{new LocalizedText(null, null)},
{new LocalizedText("locale", null)},
{new LocalizedText(null, "text")},
{LocalizedText.english("hello, world!")},
};
}
示例5: getVariants
import org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText; //导入方法依赖的package包/类
@DataProvider
public Object[][] getVariants() {
return new Object[][]{
{new Variant(true)},
{new Variant((byte) 1)},
{new Variant(ubyte(1))},
{new Variant((short) 1)},
{new Variant(ushort(1))},
{new Variant(1)},
{new Variant(uint(1))},
{new Variant(1L)},
{new Variant(ulong(1L))},
{new Variant(3.14f)},
{new Variant(6.12d)},
{new Variant("hello, world")},
{new Variant(DateTime.now())},
{new Variant(UUID.randomUUID())},
{new Variant(ByteString.of(new byte[]{1, 2, 3, 4}))},
{new Variant(new XmlElement("<tag>hello</tag>"))},
{new Variant(new NodeId(0, 42))},
{new Variant(new ExpandedNodeId(1, 42, "uri", 1))},
{new Variant(StatusCode.GOOD)},
{new Variant(new QualifiedName(0, "QualifiedName"))},
{new Variant(LocalizedText.english("LocalizedText"))},
{new Variant(ExtensionObject.encode(new ReadValueId(NodeId.NULL_VALUE, uint(1), null, new QualifiedName(0, "DataEncoding"))))},
};
}
示例6: TestNamespace
import org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText; //导入方法依赖的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();
}
示例7: addScalarNodes
import org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText; //导入方法依赖的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);
}
}
示例8: addAdminReadableNodes
import org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText; //导入方法依赖的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);
}
示例9: addAdminWritableNodes
import org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText; //导入方法依赖的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);
}
示例10: addDataAccessNodes
import org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText; //导入方法依赖的package包/类
private void addDataAccessNodes(UaFolderNode rootNode) {
// DataAccess folder
UaFolderNode dataAccessFolder = new UaFolderNode(
server.getNodeMap(),
new NodeId(namespaceIndex, "HelloWorld/DataAccess"),
new QualifiedName(namespaceIndex, "DataAccess"),
LocalizedText.english("DataAccess")
);
server.getNodeMap().addNode(dataAccessFolder);
rootNode.addOrganizes(dataAccessFolder);
// AnalogItemType node
AnalogItemNode node = nodeFactory.createVariable(
new NodeId(namespaceIndex, "HelloWorld/DataAccess/AnalogValue"),
new QualifiedName(namespaceIndex, "AnalogValue"),
LocalizedText.english("AnalogValue"),
Identifiers.AnalogItemType,
AnalogItemNode.class
);
node.setDataType(Identifiers.Double);
node.setValue(new DataValue(new Variant(3.14d)));
node.setEURange(new Range(0.0, 100.0));
server.getNodeMap().addNode(node);
dataAccessFolder.addOrganizes(node);
}
示例11: registerItems
import org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText; //导入方法依赖的package包/类
private void registerItems() {
// create a folder
final UaFolderNode folder = new UaFolderNode(
this.nodeMap,
new NodeId(this.index, 1),
new QualifiedName(this.index, "FooBarFolder"),
LocalizedText.english("Foo Bar Folder"));
// add our folder to the objects folder
this.nodeMap.getNode(Identifiers.ObjectsFolder).ifPresent(node -> {
((FolderNode) node).addComponent(folder);
});
// add single variable
{
final UaVariableNode variable = new UaVariableNode(
this.nodeMap,
new NodeId(this.index, "look-at-me-i-am-right-here-hey-watch-out-woooohoo-here-i-am"),
new QualifiedName(this.index, "FooBar"),
LocalizedText.english("Foo Bar")) {
@Override
public DataValue getValue() {
return new DataValue(new Variant(Math.sin(System.currentTimeMillis() / 1000)));
}
};
variable.setDataType(Identifiers.Double);
folder.addOrganizes(variable);
}
// add method call
{
final UaMethodNode method = createCallMeNode(
this.index,
this.nodeMap);
folder.addComponent(method);
}
}
示例12: toWritableDataTypeObject
import org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText; //导入方法依赖的package包/类
public static Object toWritableDataTypeObject(NodeId node, String value) throws Exception {
if (node == null || node.isNull()) {
throw new Exception("not parsable value: " + String.valueOf(value));
}
if (node.getIdentifier() == null && !(node.getIdentifier() instanceof UInteger)) {
throw new Exception("indentifier missing for value: " + String.valueOf(value));
}
switch (((UInteger) node.getIdentifier()).intValue()) {
case 1:
if ("0".equals(value)) {
return Boolean.FALSE;
}
if ("1".equals(value)) {
return Boolean.TRUE;
}
return Boolean.valueOf(value);
case 2:
return Byte.valueOf(value);
case 3:
return Unsigned.ubyte(value);
case 4:
return Short.valueOf(value);
case 5:
return Unsigned.ushort(value);
case 6:
return Integer.valueOf(value);
case 7:
return Unsigned.uint(value);
case 8:
return Long.valueOf(value);
case 9:
return Unsigned.ulong(value);
case 10:
return Float.valueOf(value);
case 11:
return Double.valueOf(value);
case 12:
return value;
case 13:
return new DateTime(java.util.Date.from(ZonedDateTime.from(DateTimeFormatter.ISO_DATE_TIME.parse(value)).toInstant()));
case 14:
return UUID.fromString(value);
case 15:
return ByteString.of(value.getBytes());
case 16:
return XmlElement.of(value);
case 17:
return NodeId.parse(value);
case 18:
return ExpandedNodeId.parse(value);
case 19:
if (value != null && value.equalsIgnoreCase("good")) {
return StatusCode.GOOD;
}
return StatusCode.BAD;
case 20:
return QualifiedName.parse(value);
case 21:
return LocalizedText.english(value);
case 22:
case 23:
case 24:
case 25:
return value;
case 26:
case 27:
return Integer.valueOf(value);
case 28:
return UInteger.valueOf(value);
case 29:
case 30:
default:
return value;
}
}
示例13: getRootNode
import org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText; //导入方法依赖的package包/类
public ReferenceDescription getRootNode(String displayName) {
return new ReferenceDescription(Identifiers.RootFolder, Boolean.TRUE, Identifiers.RootFolder.expanded(), QualifiedName.parse("Root"),
LocalizedText.english(displayName), NodeClass.Unspecified, ExpandedNodeId.NULL_VALUE);
}
示例14: addVendorInfoJmx
import org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText; //导入方法依赖的package包/类
private void addVendorInfoJmx(UaObjectNode vendorServerInfo) {
OperatingSystemMXBean osBean = ManagementFactory.getOperatingSystemMXBean();
MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean();
UaVariableNode usedMemory = new UaVariableNode(
nodeMap,
new NodeId(1, "VendorServerInfo/UsedMemory"),
new QualifiedName(1, "UsedMemory"),
LocalizedText.english("UsedMemory")) {
@Override
public DataValue getValue() {
return new DataValue(new Variant(memoryBean.getHeapMemoryUsage().getUsed() / 1000));
}
};
usedMemory.setDataType(Identifiers.Int64);
UaVariableNode maxMemory = new UaVariableNode(
nodeMap,
new NodeId(1, "VendorServerInfo/MaxMemory"),
new QualifiedName(1, "MaxMemory"),
LocalizedText.english("MaxMemory")) {
@Override
public DataValue getValue() {
return new DataValue(new Variant(memoryBean.getHeapMemoryUsage().getMax()));
}
};
maxMemory.setDataType(Identifiers.Int64);
UaVariableNode osName = new UaVariableNode(
nodeMap,
new NodeId(1, "VendorServerInfo/OsName"),
new QualifiedName(1, "OsName"),
LocalizedText.english("OsName")) {
@Override
public DataValue getValue() {
return new DataValue(new Variant(osBean.getName()));
}
};
osName.setDataType(Identifiers.String);
UaVariableNode osArch = new UaVariableNode(
nodeMap,
new NodeId(1, "VendorServerInfo/OsArch"),
new QualifiedName(1, "OsArch"),
LocalizedText.english("OsArch")) {
@Override
public DataValue getValue() {
return new DataValue(new Variant(osBean.getArch()));
}
};
osArch.setDataType(Identifiers.String);
UaVariableNode osVersion = new UaVariableNode(
nodeMap,
new NodeId(1, "VendorServerInfo/OsVersion"),
new QualifiedName(1, "OsVersion"),
LocalizedText.english("OsVersion")) {
@Override
public DataValue getValue() {
return new DataValue(new Variant(osBean.getVersion()));
}
};
osVersion.setDataType(Identifiers.String);
vendorServerInfo.addComponent(usedMemory);
vendorServerInfo.addComponent(maxMemory);
vendorServerInfo.addComponent(osName);
vendorServerInfo.addComponent(osArch);
vendorServerInfo.addComponent(osVersion);
}
示例15: addVendorInfoSunJmx
import org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText; //导入方法依赖的package包/类
private void addVendorInfoSunJmx(UaObjectNode vendorServerInfo) {
try {
com.sun.management.OperatingSystemMXBean osBean =
(com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
UaVariableNode processCpuLoad = new UaVariableNode(
nodeMap,
new NodeId(1, "VendorServerInfo/ProcessCpuLoad"),
new QualifiedName(1, "ProcessCpuLoad"),
LocalizedText.english("ProcessCpuLoad")) {
@Override
public DataValue getValue() {
return new DataValue(new Variant(osBean.getProcessCpuLoad() * 100d));
}
};
processCpuLoad.setDataType(Identifiers.Double);
UaVariableNode systemCpuLoad = new UaVariableNode(
nodeMap,
new NodeId(1, "VendorServerInfo/SystemCpuLoad"),
new QualifiedName(1, "SystemCpuLoad"),
LocalizedText.english("SystemCpuLoad")) {
@Override
public DataValue getValue() {
return new DataValue(new Variant(osBean.getSystemCpuLoad() * 100d));
}
};
systemCpuLoad.setDataType(Identifiers.Double);
vendorServerInfo.addComponent(processCpuLoad);
vendorServerInfo.addComponent(systemCpuLoad);
if (osBean instanceof UnixOperatingSystemMXBean) {
UnixOperatingSystemMXBean unixBean = (UnixOperatingSystemMXBean) osBean;
UaVariableNode openFileDescriptors = new UaVariableNode(
nodeMap,
new NodeId(1, "VendorServerInfo/OpenFileDescriptors"),
new QualifiedName(1, "OpenFileDescriptors"),
LocalizedText.english("OpenFileDescriptors")) {
@Override
public DataValue getValue() {
return new DataValue(new Variant(unixBean.getOpenFileDescriptorCount()));
}
};
openFileDescriptors.setDataType(Identifiers.Int64);
UaVariableNode maxFileDescriptors = new UaVariableNode(
nodeMap,
new NodeId(1, "VendorServerInfo/MaxFileDescriptors"),
new QualifiedName(1, "MaxFileDescriptors"),
LocalizedText.english("MaxFileDescriptors")) {
@Override
public DataValue getValue() {
return new DataValue(new Variant(unixBean.getMaxFileDescriptorCount()));
}
};
maxFileDescriptors.setDataType(Identifiers.Int64);
vendorServerInfo.addComponent(openFileDescriptors);
vendorServerInfo.addComponent(maxFileDescriptors);
}
} catch (Throwable e) {
// ignore
}
}