|
|
Converting Sun JavaSoft RMI to BEA WebLogic Enterprise RMI Classes
It is easier to use BEA WebLogic Enterprise RMI if you have already written classes in the Sun Microsystems JavaSoft reference implementation of RMI. This section explains how to convert Sun JavaSoft RMI classes to WebLogic RMI using the WebLogic RMI Hello World application as an example.
Suppose you have an RMI Hello World example written similar to those found in the Sun JavaSoft documentation distribution. To convert these files for use with BEA WebLogic Enterprise, you must do the following:
Step 1: Modify the Java source code files
To convert the RMI Hello World example from Sun JavaSoft RMI to BEA WebLogic Enterprise RMI, you must first modify the Java source code files to adjust for the following major differences:
You need to modify the following Java source code files:
Note that the file Hello.java, which contains the remote interface, is exactly the same in both the Sun JavaSoft Hello World RMI example and in BEA WebLogic Enterprise RMI. Therefore, you do not need to make any changes to this Java source file-you can use it as is. You will need to recompile it, though, along with the other Java files.
HelloImpl.java-A Remote Object Implementation
To modify this file, compete the following steps:
For details, see Step 3: Write the source code for a remote object that implements the remote interface in Developing RMI Applications in BEA WebLogic Enterprise.
HelloClient.java-A Client That Invokes Methods on the Remote Object
The RMI client can be either an applet or a Java client similar to that shown in our BEA WebLogic Enterprise RMI Hello World example. To convert either type of client from Sun JavaSoft RMI to BEA WebLogic Enterprise RMI, you must modify the client file similar to the following to account for some basic differences:
For details, see the explanation of the code for the BEA WebLogic Enterprise Hello World RMI client in Step 4: Write the source code for a client that invokes methods on the remote object in Developing RMI Applications in BEA WebLogic Enterprise.
Step 2: Compile the Java source files
Compile the Java source files including the remote object implementation source file (HelloImpl.java), the remote interface that it extends (Hello.java), the RMI client (HelloClient.java or an applet file), along with any other associated Java files needed for the application.
For example, the following command compiles the Java source files in examples/hello and puts the resulting class files under a directory called classes.
javac -d classes examples/hello/*.java
For more information on using the javac compiler to generate BEA WebLogic Enterprise RMI classes, see Step 5: Compile the source code files to create the executable RMI classes in Developing RMI Applications in BEA WebLogic Enterprise.
Step 3: Run the WebLogic RMI compiler on the implementation class
To create a proxy stub file for the client and skeleton file for the server, run the weblogic.rmic compiler on the fully-qualified package names of compiled class files that contain remote object implementations.
For the BEA WebLogic Enterprise RMI Hello World Example, you would run the weblogic.rmic compiler on the class file HelloImpl as follows:
java weblogic.rmic -d . examples.hello.HelloImpl
For more information about stubs and skeletons and about using the WebLogic RMI compiler to generate them, see Step 6: Run the WebLogic RMI compiler on the implementation class to generate stubs and skeletons in Developing RMI Applications in BEA WebLogic Enterprise.
Step 4: Build and package the application for BEA WebLogic Enterprise
Once you have the BEA WebLogic Enterprise RMI class files, all that is left to do is create a bootstrapping mechanism for your application and package the application into a JAR file. For information on how to do this, see the section Building Your RMI Application in the BEA WebLogic Enterprise Environment.
|
Copyright © 2000 BEA Systems, Inc. All rights reserved.
|