Entering content frame

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. See the requirements for defining a remote interface in Characteristics of a Remote Object.

       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.

This graphic is explained in the accompanying text

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:

This graphic is explained in the accompanying text

package exapmles.rmi_p4;

 

public class OverdrawException extends Exception {

 

  public OverdrawException(int overdraw) {

    super("Overdraw:" + overdraw);

  }

}

 

 

 

 

Leaving content frame