1 / 11

Paul Scherrer Institute

Simon Gregor Ebner. Paul Scherrer Institute. JCA Extensions. PSI,. 22. August 2014. Contents. Introduction Why JCA-E Architecture Examples Outlook. PSI,. 22. August 2014. Motivation. While using JCA, there are many things that can be done wrong …

talmai
Download Presentation

Paul Scherrer Institute

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Simon Gregor Ebner Paul Scherrer Institute JCA Extensions PSI, PSI, 22. August 2014

  2. Contents • Introduction • Why JCA-E • Architecture • Examples • Outlook PSI, PSI, 22. August 2014

  3. 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, … (flushIO/pendIO) • Need to know how to use JCA/CAJ libraries in a single/multithreaded environments • Lots of duplicated code (unless developer creates utility classes) PSI,

  4. 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,

  5. JCA-E Architecture Application Application JCA Extensions JCA JCA CAJ CAJ Channel Access Channel Access PSI,

  6. JCA-E Architecture / Components Application Annotations Factory Classes Ca Bean Manager Ca Bean Channel Bean Factory Channel Bean Channel Factory jca.properties Context Factory JCA PSI,

  7. Use Case / Example 1 – Channel Bean • // Retrieve channel bean factory • ChannelBeanFactory factory = ChannelBeanFactory.getFactory(); • // Create channel bean • ChannelBean<String> bean = factory.createChannelBean(String.class, “MYCHANNEL:XYZ”, true); • // Get value • String value = bean.getValue(); • // Set value • bean.setValue(“hello”); • // Wait for a specific value • bean.waitForValue(“world”, 10000); • // Register a function to the monitor • bean.addMonitorListener(this, this.getClass().getMethod(“doIt”)); • // Register an object as PropertyChangeListener • bean.addPropertyChangeListener(listener); • // Destroy bean / close channel • bean.destroy(); PSI,

  8. Use Case / Example 2 – Annotations • // Specify CaBean • public class TestBean{ • @CaChannel(name=“.ACQT”, type=String.class, monitor=true) • private ChannelBean<String> type • @CaChannel(name={“.ONE”, “.TWO”, “.THREE”}, type=Double.class, monitor=true) • private List<ChannelBean<Double>> values; • // Getter and Setters … etc. • } • // Use Ca Bean • CaBeanManager manager = new CaBeanManager(); • TestBean tbean = new TestBean(); • manager.manage(tbean, “PREFIX”); • // Work with Ca Bean • tbean.getType().getValue(); PSI,

  9. Use Case / Example 3 http://people.web.psi.ch/ebner/wordpress PSI,

  10. Outlook • JCA-E need to be reviewed by JCA experts / community • Further improvements like: • Optimizations … • Include alarm states in Channel Bean class • Documentation • … PSI,

  11. Questions • … Questions … • … Suggestions … • … Remarks … • … Feedback … • … Ideas … • simon.ebner@psi.ch PSI,

More Related