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
The VJS Developer's Guide describes how to import a CORBA component into VJS: 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 you can edit the names and icons directly in VJS. The following sections describe 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.Objec
t 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.
An IDL file can specify three different kinds of method 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 behave 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 (for example, myParam = new Object()
). The actual value for the parameter is passed in and out through the object's value
member (that is, 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 retrieve the value that the operation passed back to you from the value
member of the object.
NOTE: The JSB method wrapper created for a CORBA object interface map the CORBA operation's parameter data types to corresponding Java data types when they exist, but the JSB wrapper does not indicate whether a parameter is anIN
,OUT
, orIN/OUT
parameter. 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. §
<SCRIPT>
or <APPLET>
tag attributes (for example, PURPOSE
, CLASS
, and sometimes SRC
, WIDTH
, HEIGHT
)
ObjectURL
, which specifies the URL to the actual instance of the CORBA object)
ObjectURL
property is especially important because it establishes the connection between the actual CORBA object and the component that represents it in VJS. For more information see Connecting to a CORBA Object.
NOTE: Because CORBA objects do not implement events, you cannot use the VJS events and you cannot use bound properties. §
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. As a result, 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: See the Netscape ISB for Java Programmer's Guide for the latest information about IDL-to-Java data type mappings.In general, keep these notes in mind:
ObjectURL
property is unique to JavaScript components that result from importing a CORBA object IDL into VJS. ObjectURL
specifies the URL to the actual instance of the CORBA object. When you first import a CORBA object into VJS, you should give ObjectURL
an initial value.
You can change the value of ObjectURL
at design-time through the Inspector, and you can change the value of ObjectURL
programmatically at run time, through the setObjectURL
method. When you change ObjectURL
, the JavaScript component is bound to the newly-specified CORBA object on the fly. Object binding is actually managed by the platform's name service; in order for binding to occur, the CORBA objects you specify in the ObjectURL
property must be listed in the name service.
For more information about using CORBA with Enterprise Server 3.0, see Writing Web Applications with WAI. For more information about building Java applications that can use the Netscape Internet Service Broker API to create CORBA applications, see the Netscape ISB for Java Programmer's Guide.
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: 11/20/97 13:56:37