Generating Java™ wrappers
The EGL Java™ wrapper is a set of classes used to invoke an EGL main or called program from non-EGL Java™ code; for example, from an action class in a Struts- or from a non-J2EE Java™ program. You can generate Java™ wrapper classes when you generate the related program.
A Java™ wrapper consists of a set of classes. Those classes act as an interface between a servlet or a non-EGL generated Java™ program, on the one hand, and a generated program or EJB session bean, on the other.
You generate the Java™ wrapper
classes if you use a build descriptor that has these characteristics:
- The enableJavaWrapperGen build descriptor option is set to yes or only.
- The linkage build descriptor option references a linkage options part that includes a callLink element to guide the call from wrapper to program.
- One of two statements apply:
- The call from wrapper to program is by way of an EJB session bean
(in which case the type property of the callLink element
is set to ejbCall).
In this case, the invoked program must be an EGL called program.
- The call from wrapper to program is remote (in which case the callLink element, type property
is set to remoteCall); also, the callLink element, javaWrapper property
is set to yes.In this case, the invoked program might be an EGL called or main program. In relation to an EGL main program, the following rules apply:
- The callLink element, remoteComType element is set either to DIRECT or DISTINCT. In either case, the native Java™ code and the EGL-generated program run in the same Java™ Virtual Machine. The call is remote because EGL middleware is involved, as necessary to handle data conversion between the Java™ wrapper and the EGL-generated program.
- The main program can in turn complete a transfer to program, but not a transfer to transaction.
- The call from wrapper to program is by way of an EJB session bean
(in which case the type property of the callLink element
is set to ejbCall).
For further details on using the classes, see Java™ wrapper classes. For details on the class names, see Output of Java™ wrapper generation.
To use a Java™ wrapper perform
the following steps:
- Generate Java™ wrapper classes, which are specific to a generated program
- Incorporate those wrapper classes into the non-generated Java™ code
- From the non-generated Java™ code,
invoke the wrapper-class methods to make the actual call and to convert
data between these two formats:
- The data-type formats used by Java™
- The primitive-type formats required when passing data to and from the EGL-generated program