g+
g+ Communities
Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014 
<== Date ==> <== Thread ==>

Subject: PV Mapping Using Java Annotations
From: Mitch McCuiston <mmccuiston@aps.anl.gov>
To: tech-talk@aps.anl.gov
Date: Mon, 10 Jan 2011 18:12:53 -0600
I've been thinking about implementing an annotation based mapping of Java objects to PVs. I thought I would ask the community if something like this already exists before I take it on. If it doesn't exist, would anyone find value in this. The idea is loosely based on how Hibernate maps Java objects to a relational database, although the read/write semantics are a little different. Here is an example.

######################################################
public class EpicsMotor{

    //This will peform a synchronous GET of PV "DLLM" upon invocation
    @PV(name="DLLM", accessType=PVAccessType.READ)
    public double getLowerLimit(){
    ...

    //This will establish a PV monitor for "DRBV" that will call the method
    //below upon any change in "DRBV"
    @PV(name="DRBV", accessType=PVAccessType.MONITOR)
    public void setDialPosition(double position){
    ...

    //Any call to this method will result in a synchronous PUT
    //to the PV named "S".
    @PV(name="S", accessType=PVAccessType.WRITE)
    public void setSpeed(double position){
    ...

//This will create a monitor for PV named "RBV" that will call this method //upon any change in "RBV". In addition, any invocations of this method will
    //be intercepted and a synchronous PUT to PV "RBV" will occur.
    @PV(name="RBV", accessType=PVAccessType.MONITOR_WRITE)
    public void setPosition(double position){
    ...

}
#######################################################

This would allow someone to instrument an instance of the class above at runtime and "connect" it to a set of PVs (given a prefix i.e. "xxx:motor1."). I feel that this would have the following advantages over writing raw JCA/CAJ.

1. This could increase read performance because the POJO essentially becomes a PV cache. 2. This cuts down dramatically on the amount of channel managment code that needs writing. 3. The little bit of channel management code that is written is centralized and can be better tested. 4. This provides a nice way of abstracting a collection of PVs for easier application development.


Thanks in advance for your help!

Mitch McCuiston
mmccuiston@aps.anl.gov

Replies:
Re: PV Mapping Using Java Annotations J. Lewis Muir
RE: PV Mapping Using Java Annotations Carcassi, Gabriele

Navigate by Date:
Prev: RE: JAI CM-140GE Szalata, Zenon M.
Next: RE: Writing mbbo/mbbi text labels using asynPortDriver/areaDetector Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014 
Navigate by Thread:
Prev: RE: 24-bit DAC matthew.pearson
Next: Re: PV Mapping Using Java Annotations J. Lewis Muir
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICSv4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·