Paul Scherrer Institute

Post on 29-Jan-2016

45 views 0 download

Tags:

description

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 … - PowerPoint PPT Presentation

transcript

22. April 2023PSI, 22. April 2023PSI,

Paul Scherrer Institute

JCA Extensions

Simon Gregor Ebner

22. April 2023PSI,

• Introduction• Why JCA-E• Architecture• Examples• Outlook

Contents

22. April 2023PSI, Seite 2

• 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)

Motivation

22.04.23PSI, Seite 3

• 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

JCA-E Benefits

22.04.23PSI, Seite 4

JCA-E Architecture

22.04.23PSI, Seite 5

CAJCAJ

JCAJCA

Channel AccessChannel Access

JCA ExtensionsJCA Extensions

ApplicationApplication

CAJCAJ

JCAJCA

Channel AccessChannel Access

ApplicationApplication

JCA-E Architecture / Components

22.04.23PSI, Seite 6

Factory ClassesFactory Classes

ApplicationApplication

Context FactoryContext Factory

Channel FactoryChannel Factory

Channel Bean FactoryChannel Bean Factory

Ca Bean ManagerCa Bean Manager

Channel BeanChannel Bean

AnnotationsAnnotations

Ca BeanCa Bean

JCAJCA

jca.properties

jca.properties

// 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();

Use Case / Example 1 – Channel Bean

22.04.23PSI, Seite 7

// 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();

Use Case / Example 2 – Annotations

22.04.23PSI, Seite 8

Use Case / Example 3

22.04.23PSI, Seite 9

http://people.web.psi.ch/ebner/wordpress

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

• Documentation• …

Outlook

22.04.23PSI, Seite 10

… Questions …… Suggestions …

… Remarks …… Feedback …

… Ideas …

simon.ebner@psi.ch

Questions

22.04.23PSI, Seite 11