Programmer's Guide



Chapter 31   Using CORBA Objects

This chapter describes SilverStream's support for CORBA. It covers the following topics:

This chapter assumes that you are familiar with CORBA. If you are new to CORBA or just want to explore a specific CORBA topic, you can find more information at the OMG Web site at www.omg.org.

About CORBA   Top of page

The Common Object Request Broker Architecture (CORBA) is an object-oriented distributed computing infrastructure specified by the Open Management Group (OMG).

CORBA allows you to build applications so that objects can call methods on other objects, regardless of where each object is located. The objects might be located in different processes or on different machines; the remote machines can be of different types and the objects can be implemented in different languages. The caller does not need to know where the other object is actually located.

There is a set of services that is common to all distributed computing environments. OMG has defined IDL interfaces for many of these services so that objects have a common way to access them. For example there are CORBA-defined Naming, Event Management, Persistence, Lifecycle, Concurrency, Security and Transaction services. CORBA allows your application to make use of these services and to be a remote object-oriented service.

SilverStream CORBA support   Top of page

The SilverStream Application Server includes the JBroker ORB. JBroker is an enterprise-class Java-based CORBA ORB. You can use the JBroker ORB from the SilverStream Server, SilverJRunner, or any browser. You can use it to develop, deploy, and manage Java-based CORBA applications. It includes the following features:

    For more information on JBroker, see the JBroker documentation available from the online help system.

Writing CORBA applications in SilverStream   Top of page

To build a SilverStream CORBA application, you create the following objects:

Creating a CORBA IDL file   Top of page

The IDL file defines the interfaces that your CORBA application uses. You use SilverStream's Business Object Designer to create and compile the CORBA IDL.

SilverStream provides a CORBA IDL wizard to create a framework for writing your CORBA IDL definition. You can launch the CORBA IDL wizard by choosing New CORBA IDL from the SilverStream Business Object Designer. Here is an example of a CORBA IDL file.

  module Customers 
{
   struct CustomerRecord
    {
     long customerId;
     string firstName;
     string lastName;
    };

   interface Cust
    {
     CustomerRecord getCustomer()
     boolean gotoFirst();
     boolean gotoNext();
    };
};

One you have defined the IDL, you simply save it to invoke SilverStream's IDL compiler.

What happens when you save the IDL file

When you save the IDL file, SilverStream launches the idl2java compiler in a DOS window. The idl2java compiler generates the stubs and skeletons and any additional helper objects that are necessary. It specifically:

To access the CORBA objects from a SilverStream form, page, or business object, you must include a reference to the IDL JAR file. To access the CORBA objects from an external file, you need to download the JAR from the server and add it to the path.

Guidelines for writing CORBA IDL in SilverStream

Use the following guidelines when writing IDL files in SilverStream:

Writing a CORBA implementation class   Top of page

The CORBA implementation class resides on the server. It includes an implementation for each of the methods defined by the CORBA IDL. You use SilverStream's Business Object Designer to create the implementation class.

Here are the steps:

  1. Create (or use) a package that is different from the IDL package.

  2. Create a Java class that extends the class created by the IDL compiler. In the previous example, your implementation class would extend Customers._CustImplBase class.

    NOTE   If you are using the Business Object wizard, do not create stubs for abstract methods on the base class.

  3. The class must implements the interface defined in the IDL. In the previous example, the class should implement the Customers.Cust interface.

    NOTE   If you are using the Business Object wizard do not create stubs for interface methods.

    NOTE   When you finish the wizard, SilverStream generates an error message stating that the methods on the implementation class must be declared abstract. You can ignore this message. It is generated because you have not yet written implementations for the methods defined by the interface (that is the next step).

  4. The class must import the package that includes the IDL, for example:

      import Customers.*; 
  5. The class must have access to the JAR that contains the CORBA IDL, stubs, and skeletons. You can use the File>JAR files... menu option.

  6. Write the method implementations.

Writing the SilverStream triggered business object   Top of page

You need to create a SilverStream triggered business object whose job is to:

Here are the guidelines for writing this object:

Writing CORBA clients    Top of page

This is the object that calls the methods exposed on the CORBA server-side object. The client-side class gets the reference to the server object using the JNDI naming service. Once it has the reference, the client object can make method calls as though the server-side class were local.

Here are the guidelines for your CORBA clients:






Copyright © 2000, SilverStream Software, Inc. All rights reserved.