Reality Interface Classes

com.northgateis.reality.rsc
Class RSC

java.lang.Object
 |
 +--com.northgateis.reality.rsc.RSC

public class RSC
extends java.lang.Object
implements java.util.Observer

Constructs a class that accesses a subroutine on the server.

This class is often extended to provided a subroutine specific class although this is not essential.

The class can also be used independently. The following example shows how to call a subroutine called "subname" which takes two parameters. Both parameters are used for input, and one parameter returns a result.

 RSCConnection con = new RSCConnection("host","dbase","user","account");
 con.connect();
 RSC sub = new RSC(con, "subname");
 sub.getParam(1).setValue("p1");
 sub.getParam(2).setValue("p2");
 sub.execute();
 byte result[] = sub.getParam(1).getValue();
 con.disconnect();
 


Constructor Summary
RSC(RSCConnection c, java.lang.String name)
          Create a class to refer to a specific subroutine.
RSC(java.lang.String name, RSCConnection c)
          Deprecated. replaced by RSC(RSCConnection, String) which is more efficient as it doesn't always prepare a subroutine first.
 
Method Summary
 voidexecute()
          Send all parameters, execute the subroutine, receive all result parameters and load them into the parameter structure
 voidexecute(byte[][] params)
          Execute subroutine with parameters passed as byte array.
 voidexecute(java.lang.String[] params)
          Execute subroutine with parameters passed as String array.
 voidgetDescription()
          Get the parameter descriptions string for this subroutine from the RSC server.
 RSCDescriptorgetDescriptor()
          Returns the the parameter descriptor.
 RSCParamgetParam(int index)
          Get a pointer to a parameter descriptor by index.
 RSCParamgetParam(java.lang.String name)
          Get a pointer to a parameter descriptor by name.
 voidupdate(java.util.Observable s, java.lang.Object arg)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RSC

public RSC(java.lang.String name,
           RSCConnection c)
 throws RSCException
Deprecated. replaced by RSC(RSCConnection, String) which is more efficient as it doesn't always prepare a subroutine first.

Create a class to refer to a specific subroutine. Get the subroutines parameter descriptor so that parameters may be refered to by name.
Parameters:
name - the subroutine name
c - an RSCConnection
Throws:
RSCException - something went wrong


RSC

public RSC(RSCConnection c,
 java.lang.String name)
Create a class to refer to a specific subroutine.
Parameters:
c - an RSCConnection
name - the subroutine name
Method Detail

getDescription

public void getDescription()
 throws RSCException
Get the parameter descriptions string for this subroutine from the RSC server. The descriptions are loaded into this structure, so that parameters may be referenced by name.
Throws:
RSCException - if an RSC error occurs

getParam

public RSCParamgetParam(java.lang.String name)
 throws RSCException
Get a pointer to a parameter descriptor by name. getDescription() must have been called before using this method.
Parameters:
name - name of parameter to get
Returns:
the descriptor for the parameter
Throws:
RSCException - invalid parameter name, or parameter descriptions not loaded.

getParam

public RSCParamgetParam(int index)
 throws RSCException
Get a pointer to a parameter descriptor by index.
Parameters:
index - index of parameter to get
Returns:
the descriptor for the parameter
Throws:
RSCException - invalid parameter index.

getDescriptor

public RSCDescriptorgetDescriptor()
Returns the the parameter descriptor. This allows a the subroutines parameters to be listed by using the Enumeration facilities of RSCDescriptor
Returns:
the RSCDescriptor for the subroutine

execute

public void execute()
 throws RSCException
Send all parameters, execute the subroutine, receive all result parameters and load them into the parameter structure
Throws:
RSCException - an RSC error occurred

execute

public void execute(byte[][] params)
 throws RSCException
Execute subroutine with parameters passed as byte array. Results are passed back in same byte array.
Parameters:
params - two dimensional byte array containing all input and output parameters. Parameters are passed to the subroutine in the order params[0], params[1], ...
Throws:
RSCException - an RSC error occurred

execute

public void execute(java.lang.String[] params)
 throws RSCException
Execute subroutine with parameters passed as String array. Results are passed back in same String array.
Parameters:
params - String array containing all input and output parameters. Parameters are passed to the subroutine in the order params[0], params[1], ...
Throws:
RSCException - an RSC error occurred

update

public void update(java.util.Observable s,
 java.lang.Object arg)
Specified by:
update in interface java.util.Observer

Reality Interface Classes

Copyright (c) 2000 NEC Software Services (UK) Limited