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
-
Sample
extendsRSC
to provide a subroutine specific class. -
A program creating an instance of
Sample
must supply a reference to anRSCConnection
object. -
Sample
callsRSC
, passing the reference to theRSCConnection
object 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
).Sample
reads them into a string array calledresult
.
Main
-
Main
sets 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 anRSCConnection
object. Theconnect()
method is called to establish the connection. -
Main creates
sam
, a reference to aSample
object, and passes in thereality
reference. -
Main then calls
sam.execute()
to execute RW.SAMPLE, passing the two parametersparam1
andparam2
. -
The contents of the
result
array returned bysam
are displayed. -
Main
callsreality.disconnect()
to disconnect from the Reality database.