At run time, VJS applications can use CORBA-based components to request services from an object request broker (ORB), or to process service requests received from an ORB. The ORB is responsible for marshalling and processing requests for service, which frees applications from locating those services and translating between disparate operating systems and data structures. For a more complete introduction to CORBA, see CORBA: Catching the Next Wave.
Installing a CORBA Component
To import a CORBA component into VJS:
1. Choose Install CORBA Object from the VJS menu.
2. Specify the IDL file to import in the dialog box. Note that the import process takes a short time.
NOTE: The following restrictions and workarounds apply to IDL files:VJS retrieves the specified interface information, converts it to a JSB file that is stored in the palette archive, and displays a corresponding "CORBA" icon on the palette.VJS creates one JSB file for each interface definition in the IDL file. Default names and icons are generated automatically, but can be edited by the user in VJS. The following sections describes the Component Methods, Component Properties, and Component Attributes associated with imported components.
Component Methods
An imported component has one JavaScript method declaration for each interface operation defined in the IDL file for the original CORBA object. These declarations map the data types of parameters and return type of the original object to corresponding Java data types, or to the java.lang.Object type when an exact match is not available. For more information, see Mapping Data Types.
Because the JS component is a stub for the server object, it must be connected to the server object before it is useful. Once connected, the component will have a member called "corbaObject" which is the ORB's local Java representation of the object. The JS methods formulate calls through the Dynamic Invocation Interface (DII) on this object, and return the results.
An imported component's methods are essentially wrappers for the actual operations associated with the CORBA object.
Working with Parameters
IDL files can specify three different kinds of parameters for its operations: IN, OUT, and IN/OUT. These parameters can be of any recognized IDL data type, and may involve mapping data types. CORBA uses IN and IN/OUT parameters to receive information from the calling application. You must pass an initial value to IN and IN/OUT parameters. CORBA uses OUT and IN/OUT parameters to pass values back to the calling application. These parameter values may be in addition to an operation's return value. You do not need to set an initial value for OUT parameters.
IN parameters exactly like standard Java and JavaScript parameters. OUT and IN/OUT parameters work a little differently. For these cases, you must create a JS object (e.g. myParam = new Object()). The actual value for the parameter is passed in and out through the object's value member (e.g., myParam.value. If it is an IN/OUT parameter, you need to set the value member to the value you want to pass to the object. In either OUT and IN/OUT cases, after the call is complete, you can get the value that the operation passed back to you from the value member of the object.
NOTE: The JSB method wrappers created for a CORBA object interface maps the CORBA operation's parameter data types to corresponding Java data types where they exist, but the JSB wrapper does not indicate whether a parameter is an IN, OUT, or IN/OUT type. You should examine the IDL file to determine the kinds of parameter, whether you must supply a value to them when you call the operations, and whether you should examine parameters for values on return from the call.
NOTE: Because CORBA objects do not implement events, you cannot use the VJS events and you cannot use bound properties as you can for JavaScript components and Java objects.
Component Events
There are no events on CORBA components.
Mapping Data Types
CORBA data types specified in an IDL file are automatically mapped to corresponding Java data types as much as possible when you import the IDL file into VJS as a component. Because CORBA objects can be implemented in C++ or Java, CORBA recognizes a wider variety of data types than Java, so some data type translation occurs. The following table summarizes IDL-to-Java mappings used by VJS. It also notes any additional translation that must occur between Java and JavaScript when you work with certain Java data types, such as java.lang.Char.
NOTE: This table is preliminary, and subject to change. See the "Netscape ISB for Java Programmer's Guide" for the latest information about IDL-to-Java data type mappings.In general, note that:
Accessing a CORBA Object at Run Time
After you import a CORBA object into VJS, use the resulting JavaScript component to build applications just as you use the built-in components already on the VJS palette. At run time, the application automatically accesses the CORBA object using the CORBA support built into Communicator.
Last Updated: 09/03/97 11:33:50