SLAC ESD Software Engineering Group
Stanford Linear Accelerator Center
AIDA


Under Construction

Create a New Data Provider

SLAC Detailed
SLAC Computing
Software Home
Software Detailed
AIDA Home

Describes how to create new data server programs in an Aida network. That is, how to enable Aida to acquire data from a new place.


SLC Data Providers

Remember that the stubs and skeletons of all AIDA servers, including those on VMS, are defined in the AIDA.JAR file, which is built on Unix and kept in /afs/slac/g/cd/soft/ref/package/aida/lib/aida.jar. You may also want to get a new except.jar, if any new exceptions have been defined.

  1. If the aidaObject.idl interface definition has changed, ftp a new aida.jar from Unix (in bin mode):
    TERSK08.SLAC.STANFORD.EDU>cd /afs/slac/g/cd/soft/ref/package/aida/lib
    <CWD command successful.
    TERSK08.SLAC.STANFORD.EDU>bin
    Type: Image, Structure: File, Mode: Stream
    TERSK08.SLAC.STANFORD.EDU>get aida.jar
      To local file: aida.jar
  2. Set the file attributes for a VMS jar file:
    set file/attr=(RFM:STMLF,RAT:CR) aida.jar
public class DpSlcHistI_impl extends DpSlcHistIPOA
{
private org.omg.PortableServer.POA poa_;
private _PersistentDaObject da_;

/*
** Native methods to obtain SLC History data
*/
public native void DbInit() throws ServerInitialisationException;
public native float[] GetHistSamples(String pvname, String starttime,
String endtime) throws UnableToGetDataException;


static DpSlcHistI_impl nat; // Reference to invoke native methods

static { System.loadLibrary("aidashr"); }

static Err err; // To log Slc errors
...
}
public
DpSlcHistI_impl(_PersistentDaObject da, org.omg.PortableServer.POA poa)
{
poa_ = poa;
da_ = da;
err = Err.getInstance(); // Get the Err singleton.
}

// IDL:dp.aida.slac.stanford.edu/dpSlcHist/DpSlcHistI/init:1.0
//
public void
init()
throws edu.stanford.slac.except.ServerInitialisationException
{
// System.out.println ("Entered init");
nat = this; // Save class reference for future native calls
try {
nat.DbInit();
}
catch (Exception ex) {
throw (ServerInitialisationException) err.log (ex,
" while trying to initialize for SLC Hist database access.");
}
}

//
// IDL:dp.aida.slac.stanford.edu/dpSlcHist/DpSlcHistI/get:1.0
//
public org.omg.CORBA.Any
get(String target,
String[] args)
throws edu.stanford.slac.except.UnableToGetDataException
{
org.omg.CORBA.Any _r = _orb().create_any();
...
histArray = nat.GetHistSamples(queryToSlcHistName(target),
startTime, endTime);

histData f = new histData(values, times, repCnt);
histDataHelper.insert(_r, f);

return _r;
}

javac your Dp<dpname>I_impl.java file.
MCCDEV> javac -g DpSlcModelI_impl.java

Then javah the .class file output from the javac command. This step will produce an include file (.h) of the form:
EDU_STANFORD_SLAC_AIDA_DP_DPSLCMODEL_DP.H;1 The include file contains prototypes you'll
use in the .C file that defines your native function. You need to override java$classpath to put your working directory in it.
define/user java$classpath [------],javalib:[foreign]ob.jar
javah -jni "edu.stanford.slac.aida.dp.dpSlcModel.DpSlcModelI_impl"

Write the first level interface routine. Our convention is to put these in a file named DP<dpname>_JNI.C, eg DPSLCMODEL_JNI.C.
Take the signatures from the generated .h file (adding the argument names).
Compile it:
MCCDEV> GLB_OPT:= aidashr_xfr_alpha
libr/crea aidashr_devlib.olb
MCCDEV> define slctxt [], ref_c_inc
MCCDEV> cinc *.c



[SLAC ESD Software Engineering Group][ SLAC Home Page]

Author: your name, dd-Mmm-year
Modified by: dd-Mmm-yy, user name, short comment. dd-Mmm-yy, username, short comment. Note, all modifications are listed on same line!