1
2
3
4
5 package org.epics.pvmanager.sample;
6
7 import gov.aps.jca.Context;
8 import gov.aps.jca.Monitor;
9 import java.util.concurrent.Executor;
10 import org.epics.pvmanager.CompositeDataSource;
11 import static org.epics.pvmanager.ExpressionLanguage.*;
12 import org.epics.pvmanager.PVManager;
13 import org.epics.pvmanager.PVReader;
14 import org.epics.pvmanager.jca.JCADataSource;
15 import org.epics.pvmanager.jca.JCADataSourceBuilder;
16 import org.epics.pvmanager.sim.SimulationDataSource;
17 import static org.epics.pvmanager.util.Executors.*;
18 import static org.epics.util.time.TimeDuration.*;
19
20
21
22
23
24
25 public class ConfigurationExamples {
26
27 public void e1_pvManagerInCSS() {
28
29
30
31
32
33
34
35
36 PVReader<?> pvReader = PVManager.read(channel("test")).notifyOn(swtThread()).maxRate(ofMillis(100));
37 }
38
39 public void e2_pvManagerInSwing() {
40
41
42
43
44
45
46
47
48 PVReader<?> pvReader = PVManager.read(channel("test")).notifyOn(swingEDT()).maxRate(ofMillis(100));
49
50
51 PVManager.setDefaultNotificationExecutor(swingEDT());
52 }
53
54 public void e3_configuringJcaAsDefaultDataSource() {
55
56
57 PVManager.setDefaultDataSource(new JCADataSource());
58
59
60
61 Context jcaContext = null;
62 PVManager.setDefaultDataSource(new JCADataSourceBuilder()
63 .monitorMask(Monitor.VALUE | Monitor.ALARM)
64 .jcaContext(jcaContext)
65 .build());
66
67
68 }
69
70 public void e4_configuringMultipleDataSources() {
71
72 CompositeDataSource composite = new CompositeDataSource();
73 composite.putDataSource("ca", new JCADataSource());
74 composite.putDataSource("sim", new SimulationDataSource());
75
76
77 composite.setDefaultDataSource("ca");
78
79
80 PVManager.setDefaultDataSource(composite);
81
82
83 }
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106 public static Executor swtThread() {
107
108
109 return null;
110 }
111 }