Paul Scherrer Institute Simon Gregor Ebner JCA Extensions
Paul Scherrer Institute Simon Gregor Ebner JCA Extensions PSI, 19 19 Mai 2021
Contents • • • Introduction Why JCA-E Architecture Examples Outlook PSI, 19 Mai 2021 Seite 2
Motivation • • • While using JCA, there are many things that can be done wrong … Need to know details about the Channel Access protocol Need to open/close channels, set/get values, monitor, … (flush. IO/pend. IO) Need to know how to use JCA/CAJ libraries in a single/multithreaded environments Lots of duplicated code (unless developer creates utility classes) PSI, 19. 05. 2021 Seite 3
JCA-E Benefits Simplification • Additional layer of abstraction • Developer can think in pure Object Oriented Java • All you have to know is monitored/non monitored • Ease of use • Use of annotations to facilitate development • Provides easy way to hook functions to channel monitors • Facilitates GUI programming while providing events • No need of type conversions due to the use of Java Generics • Optimization • Eliminates duplicated code in Java applications • One can transparently benefit from improvements in the JCA-E library • PSI, 19. 05. 2021 Seite 4
JCA-E Architecture Application JCA Extensions PSI, 19. 05. 2021 JCA CAJ Channel Access Seite 5
JCA-E Architecture / Components Application jca. prope rties Factory Classes Annotations Ca Bean Manager Ca Bean Channel Bean Factory Channel Bean Channel Factory Context Factory JCA PSI, 19. 05. 2021 Seite 6
Use Case / Example 1 – Channel Bean // Retrieve channel bean factory Channel. Bean. Factory factory = Channel. Bean. Factory. get. Factory(); // Create channel bean Channel. Bean<String> bean = factory. create. Channel. Bean(String. class, “MYCHANNEL: XYZ”, true); // Get value String value = bean. get. Value(); // Set value bean. set. Value(“hello”); // Wait for a specific value bean. wait. For. Value(“world”, 10000); // Register a function to the monitor bean. add. Monitor. Listener(this, this. get. Class(). get. Method(“do. It”)); // Register an object as Property. Change. Listener bean. add. Property. Change. Listener(listener); // Destroy bean / close channel bean. destroy(); PSI, 19. 05. 2021 Seite 7
Use Case / Example 2 – Annotations // Specify Ca. Bean public class Test. Bean{ @Ca. Channel(name=“. ACQT”, type=String. class, monitor=true) private Channel. Bean<String> type @Ca. Channel(name={“. ONE”, “. TWO”, “. THREE”}, type=Double. class, monitor=true) private List<Channel. Bean<Double>> values; // Getter and Setters … etc. } // Use Ca Bean Ca. Bean. Manager manager = new Ca. Bean. Manager(); Test. Bean tbean = new Test. Bean(); manager. manage(tbean, “PREFIX”); // Work with Ca Bean tbean. get. Type(). get. Value(); PSI, 19. 05. 2021 Seite 8
Use Case / Example 3 http: //people. web. psi. ch/ebner/wor PSI, 19. 05. 2021 Seite 9
Outlook JCA-E need to be reviewed by JCA experts / community • Further improvements like: • Optimizations … • Include alarm states in Channel Bean class • Documentation • … • PSI, 19. 05. 2021 Seite 10
Questions … … Suggestions … … Remarks … … Feedback … … Ideas … simon. ebner@psi. ch PSI, 19. 05. 2021 Seite 11
- Slides: 11