Show TOC Start of Content Area

Procedure documentation Defining a Remote Interface  Locate the document in its SAP Library structure

Use

Writes the remote interface that defines the method signatures of the remote object. You then implement those methods signatures as described in Implementing the Remote Interface.

Procedure

...

       1.      Extend a remote interface. You usually extend the java.rmi.Remote interface directly.

       2.      Specify the methods signatures that the remote object will have. You are not obliged to declare java.rmi.RemoteException in the throw clauses of the methods; you can declare exceptions that are specific to your application.

Example

The account interface is a remote interface that defines three methods. It extends java.rmi.Remote directly. The draw method declares an OverdrawException in its throw clause, which is an application-specific exception.

Syntax

public interface Account extends java.rmi.Remote {

    // Define method signatures

    public void deposit(int amount);

    public void draw (int amount) throws OverdrawException;

    public int getBalance() throws java.rmi.RemoteException;

}

The definition of the OverdrawException class is as follows:

Syntax

package exapmles.rmi_p4;

 

public class OverdrawException extends Exception {

 

  public OverdrawException(int overdraw) {

    super("Overdraw:" + overdraw);

  }

}

 

 

 

 

End of Content Area