Chapter 12 Creating CORBA-Java Components
Jaguar provides two component types for Java components. These component types are functionally equivalent, except that they use different mappings between IDL datatypes and the Java datatypes that are required in your implementation class. The choices are:
Use IDL types for new development Java/JDBC type mappings are supported to provide backward compatibility with Jaguar 1.1. For new development, use the Java/CORBA types. Components using Java/JDBC type mappings cannot raise user-defined IDL exceptions; all exceptions must be thrown as the generic jaguar.util.JException class.
The sections below describe the mappings in detail.
The following table lists the datatypes displayed in Jaguar Manager, the equivalent CORBA IDL types, and the Java datatypes used in Java/IDL component methods.
Binary, Fixed-Point, and Date/Time types The BCD and MJD IDL modules define types to represent common database column types such as binary data, fixed-point numeric data, dates, times. The BCD::Binary CORBA type maps to a Java byte array. The other BCD and MJD types map to data representations that are optimized for network transport.
To convert between the IDL-mapped datatypes and from core java.* classes, use these classes from the com.sybase.CORBA.jdbc11 package:
Class |
Description |
---|---|
SQL |
Contains methods to convert from BCD.* and MJD.* types to java.* types |
IDL |
Contains methods to convert from java.* types to BCD.* and MJD.* types |
Chapter 1, "Java Classes and Interfaces" in the Jaguar CTS API Reference provides reference pages for these classes.
Result set types The TabularResults IDL module defines types used to represent tabular data. Result sets are typically used only as return types, though you can pass them as parameters.
"Return result sets" describes how to create and return result sets.
User-defined IDL types A user-defined type is any type that is:
If a method definition includes user-defined types, the Java component method will use the equivalent Java datatype as specified by the CORBA Java language mappings specification. See "Overview" for more information on this document.
CORBA Any and TypeCode support Jaguar's Java ORB supports the CORBA Any and TypeCode datatypes. Refer to the OMG CORBA 2.3 specification and IDL to Java Language Mapping Specification (formal/99-07-53) for information on using these types.
Holder classes for IDL types All IDL-mapped Java types have an accompanying holder class that is used for passing parameters by reference. Each holder class has the following structure:
public class <Type>Holder {
// Current value
public <type> value;
// Default constructor
public <Type>Holder() {}
// Constructor that sets initial value
public <Type>Holder(<type> v) {
this.value = v;
}
}
This structure is defined by the CORBA Java-language bindings specification.
Java/JDBC type mappings are supported to provide backward compatibility with Jaguar 1.1. For new development, use the Java/CORBA types. Components using Java/JDBC type mappings cannot raise user-defined IDL exceptions; all exceptions must be thrown as the generic jaguar.util.JException class.
The table below shows the datatypes displayed in the Jaguar Manager, the datatypes used by Java components, and the argument modes (in, inout, out for parameter passing modes and return to indicate the type is used for method return values).
inout and out parameters for these datatypes are passed in holder classes from the com.sybase.jaguar.util and com.sybase.CORBA.jdbc11 packages. For more information on these packages, see the reference pages in the Jaguar CTS API Reference.
User-defined IDL types in a method declaration are mapped to the same Java classes as for a Java/IDL component. See "User-defined IDL types" for more information.
Methods in a Java/JDBC component do not return result
sets explicitly. If the IDL method definition indicates a result
set or result sets are returned, the Java method must be declared
to return void
, and the
implementation must use the Jaguar JServerResultSet and JServerResultSetMetaData interfaces
to send result sets back to the client.
Copyright © 2000 Sybase, Inc. All rights reserved. |