Overview  Generating Java stubs

Chapter 12: Creating CORBA Java Clients

Procedure for creating CORBA-compatible Java clients

A Java client establishes a session with the application server, instantiates stub (or proxy) instances for EAServer components, and executes component methods by calling like-named methods on the stub instance.

  1. Generate stub classes.

    These classes act as a proxy object for a component instance that is executing on the server; there is one stub for each IDL interface that the component implements. “Generating Java stubs” describes how to generate stubs with EAServer Manager.

  2. Implement code to instantiate proxy objects.

    Your program must obtain proxy objects for the EAServer component and narrow them to the stub interface that you intend to use. EAServer supports three techniques for proxy instantiation, using different interfaces for resolving component names to server objects. “Instantiating proxy instances” describes each technique in detail.

  3. Implement code that invokes the component methods.

    You execute the component’s methods by calling like-named methods on the stub class and passing the necessary input data. Each stub method has a return value and parameter list that is mapped from the corresponding EAServer Manager method definition. “Executing component methods” describes return type and parameter type mappings in detail.

  4. If desired, you can serialize the component instance reference as an IOR string, then deserialize the reference later.

    See “Serializing component instance references” for details.

  5. Clean up client-side resources.

    When proxy objects are no longer required, set the references to null to expedite cleanup by the Java garbage collection mechanism. See “Cleaning up client resources” for details.

Each of these steps requires appropriate exception handling. “Handling exceptions” summarizes CORBA exceptions.

Copyright © 2005. Sybase Inc. All rights reserved. Generating Java stubs