SLAC ESD Software Engineering
Group
|
||||||||||
|
|
|
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.
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.
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
set file/attr=(RFM:STMLF,RAT:CR) aida.jar
public class DpSlcHistI_impl extends DpSlcHistIPOAjavac your Dp<dpname>I_impl.java file.
{
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;
}
MCCDEV> javac -g DpSlcModelI_impl.java
define/user java$classpath [------],javalib:[foreign]ob.jar
javah -jni "edu.stanford.slac.aida.dp.dpSlcModel.DpSlcModelI_impl"
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!