External Interfaces > Reality Java Interface > Extending the RSC Class > Example Subroutine-specific RSC Class

Comment on this topic

Documentation Comments

Use this form to comment on this topic. You can also provide any general observations about the Online Documentation, or request that additional information be added in a future release.

Reality V15.0 ()

Example Subroutine-specific RSC Class (JReal) (rsc_example.htm)

To

Reality

Version

Topic

Submitted by

Company

Location

Email address

Comment

 

 

Example Subroutine-specific RSC Class

/* @(#) Sample.java ver 1.0 00/08/21 14:43:49
 * ???.java, initial version May 2000
 *
 * Copyright (c) 2000 Northgate Information Solutions Plc.
 * All Rights Reserved.
import com.northgateis.reality.rsc.*;
/**
 * Sample class demonstrating how the RSC class can be extended
 * to provide a subroutine specific class.
 *
 * @author Kevin Wright
 */
public class Sample extends RSC
{
    public Sample(RSCConnection s) throws RSCException
    {
       super(s, "RW.SAMPLE");
    }
    // Override RSC's execute() method
    public String[] execute( String param1, String param2 )
       throws RSCException
    {
       
       RSCParam p1, p2;
       // Get references to the parameters
       p1 = getParam(1);
       p2 = getParam(2);
       // Set the parameters
       p1.setValue(param1);
       p2.setValue(param2);
       // Attempt to run the Remote Basic program
       super.execute();
       // Put the returned parameters into the result array
       String[] result = new String[2];
       result[0] = p1.getString();
       result[1] = p2.getString();
       return result;
    }
}

The Main class shows how a program can create an instance of Sample to call the RW.SAMPLE subroutine.

RealityV15.0Comment on this topic