The Remote Interface


The remote interface is the starting point for creating an RMI application. It is written as a standard Java interface. The following rules must be followed whether J2SE or WebLogic is being used for development:

  • The remote interface must extend the Remote class.

  • All parameters must be Serializable.

  • All return values must be Serializable.

In addition to these common requirements, J2SE and WebLogic have individual requirements or enhancements that must be followed. To maximize portability, follow the J2SE requirements. The WebLogic implementation is compatible with J2SE and only the import statement would need to be changed.

Java 2 Standard Edition Remote Interface

For a J2SE implementation, the remote interface must extend the java.rmi.Remote interface to ensure that this new interface can be cast to a Remote interface. All methods defined by the remote interface must be declared to throw java.rmi.RemoteException . The IHitCounter in the sample RMI application shown later in this chapter is a remote interface.

WebLogic Remote Interface

The WebLogic remote interface provides ease-of-use extensions for remote interfaces and code generation. For a WebLogic implementation, the remote interface must extend weblogic.rmi.Remote . Each method in the interface does not need to declare a java.rmi.RemoteException in its throws block. This allows more freedom for your application to throw specific exceptions. The exceptions can extend Exception or RuntimeException depending upon the needs of the application.



BEA WebLogic Platform 7
BEA WebLogic Platform 7
ISBN: 0789727129
EAN: 2147483647
Year: 2003
Pages: 360

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net