Extending the RSC Class
This section of the help includes the code for a class Sample which extends
the RSC class
to access the Remote Basic subroutine
RW.SAMPLE.
It also includes the code for a class Main which creates an instance of
Sample to run RW.SAMPLE, passing in the parameters required by RW.SAMPLE and
receiving these parameters which are simply returned by the subroutine.
Sample
SampleextendsRSCto provide a subroutine specific class.- A program creating an instance of
Samplemust supply a reference to anRSCConnectionobject. SamplecallsRSC, passing the reference to theRSCConnectionobject and the name of the Remote Basic subroutine to be accessed, RW.SAMPLE.Sample's localexecute()method overridesRSC'sexecute()method and calls RW.SAMPLE, passing the parameters as a string array.- RW.SAMPLE returns these two parameters (see example code for
rwdemo).Samplereads them into a string array calledresult.
Main
Mainsets up string variables with the host name, port number, user-id and Reality account name that configure the connection to the required Reality database. These are used to createreality, a reference to anRSCConnectionobject. Theconnect()method is called to establish the connection.- Main creates
sam, a reference to aSampleobject, and passes in therealityreference. - Main then calls
sam.execute()to execute RW.SAMPLE, passing the two parametersparam1andparam2. - The contents of the
resultarray returned bysamare displayed. Maincallsreality.disconnect()to disconnect from the Reality database.