1 package de.dlr.bt.stc.source.opcua;
2
3 import javax.annotation.Nullable;
4
5 import org.apache.commons.configuration2.HierarchicalConfiguration;
6 import org.eclipse.milo.opcua.stack.core.security.SecurityPolicy;
7
8 import de.dlr.bt.stc.config.CfgFactory;
9 import de.dlr.bt.stc.init.Register;
10 import de.dlr.bt.stc.source.AEndpointSourceCfg;
11
12 public class SourceOPCUACfg extends AEndpointSourceCfg {
13
14 protected SourceOPCUACfg(HierarchicalConfiguration<?> config) {
15 super(config);
16 }
17
18 private static SourceOPCUACfg createInstance(HierarchicalConfiguration<?> config) {
19 return new SourceOPCUACfg(config);
20 }
21
22 @Register
23 public static void register() {
24 CfgFactory.getInstance().registerCreator("opcua", SourceOPCUACfg::createInstance);
25 }
26
27
28
29
30 @Nullable
31 public Double getSamplingInterval() {
32 return config.getDouble("sampling_interval", null);
33 }
34
35
36
37
38 @Nullable
39 public Double getPublishingInterval() {
40 return config.getDouble("publishing_interval", null);
41 }
42
43
44
45
46
47 @Nullable
48 public Integer getQueueSize() {
49 return config.getInteger("queue_size", null);
50 }
51
52 @Nullable
53 public Integer getPollingInterval() {
54 return config.getInteger("polling_interval", null);
55 }
56
57 @Nullable
58 public String getSubstitutionValue() {
59 return config.getString("substitution_value", null);
60 }
61
62 @Nullable
63 public String getNodeId() {
64 return config.getString("nodeid", null);
65 }
66
67 @Nullable
68 public String getNodePath() {
69 return config.getString("node_path", null);
70 }
71
72 public CaptureMode getCaptureMode() {
73 var cm = config.getString("capture_mode", "subscription");
74 return CaptureMode.valueOf(cm.toUpperCase());
75 }
76
77 public SecurityPolicy getSecurityPolicy() {
78 var sp = config.getString("security_policy", "None");
79 return SecurityPolicy.valueOf(sp);
80 }
81
82 @Nullable
83 public String getKeystorePath() {
84 return config.getString("keystore_path", System.getProperty("java.io.tmpdir") + "/stckst.pk12");
85 }
86
87 @Nullable
88 public String getKeystorePassword() {
89 return config.getString("keystore_password", "kpw");
90 }
91
92 public boolean isCreateKeystore() {
93 return config.getBoolean("keystore_create", true);
94 }
95
96 public enum CaptureMode {
97 SUBSCRIPTION, POLLING
98 }
99 }