|
WebLogic Server 6.1 Code Examples, BEA Systems, Inc. |
See:
Description
Interface Summary | |
Account | The methods in this interface are the public face of AccountBean. |
AccountHome | This interface is the home interface for the EJBean AccountBean. |
Class Summary | |
AccountBean | Date AccountBean is an EntityBean. |
AccountTypes | This is a dummy interface that is used to ensue idl generation for concrete valuetypes that are used by EJB. |
Exception Summary | |
ProcessingErrorException | This class is used with the WebLogic EJBean container-managed example package. |
This example demonstrates connectivity between a c++ client or a Tuxedo client and an entity bean. This specific package contains the necessary files to build the EJB used in these examples. You must first build the EJB before you can execute any of the clients. Note that this example demonstrates passing more complex valuetypes than both the stateless session bean RMI-IIOP examples and the RMI Visibroker example. These examples also use Inprise Visibroker 4.1 for C++. These examples use an entity EJB called AccountBean and presumes some knowledge of EJB deployment. For examples pertaining stricly to EJBs, please see our EJB examples page. Included there is an entity bean similar to Account Bean.
To get the most out of this example, first read through the source code files to see what is happening. Start with the XML deployment files to find the general structure of the EJB, i.e. which classes are used for the different objects and interfaces, then examine the other files to see how the applications work. There are three different clients that can be executed to call the EJB. Examine the XML build file carefully for each one. Take special note to see how the idl files are created for the C++ and Tuxedo clients.
Note that this example demonstrates the use of derived datatypes that are not usually visible to the Java programmer. When accessing an EJB finder, for example, the Java programmer sees a Collection or Enumeration--but the programmer doesn't have to pay attention to the underlying implementation since the JDK runtime will network classload it. However the C++ programmer must know the type that comes across the wire so that he can register a valuetype factory for it (in order that the ORB can unmarshall it). Examples of this in this case are EJBObjectEnum, Vector and ArrayList. Simply running ejbc on the defined EJB interfaces will *not* generate these definitions because they do not appear in the interface. For this reason ejbc will also accept Java classes that are not remote interfaces--specifically for the purpose of generating IDL for these interfaces.
Keeping this in mind, the following are key points covered in this example.
1. Generating IDL for interfaces not exposed in the EJB definitions-- for example EJBObjectEnum. Under IIOP you have to know the valuetype coming across the wire in order to be able to unmarshall it. This is most relevant to entity finders which return strange valuetypes--and although they inherit from some general superclass, such as Enumeration, you still have to generate code for the actual type: such as EJBObjectEnum. The rmic compiler allows you to do this.
2. Implementing java valuetypes in C++. The example uses the valuetypes for EJBObjectEnum, Vector and ArrayList. By default the generated C++ only includes data, not functions, so we have extended the definition of these (in the built _i files) to look more like there java counterparts.
3. Using custom valuetypes. Java types that are serializable but that define writeObject() are mapped to custom valuetypes in IDL, this means that the user has to write C++ code to hand unmarshall the valuetype. This is demonstrated in the definition of ArrayList (ArrayList_i.cpp).
4. Marshalling complex datatypes. The example also shows how to construct a complex valuetype in C++ in order to pass it in to WebLogic server.
The following section describes how to build and run the example:
$ mkdir build build\META-INF build\images
$ copy *.xml build\META-INF
$ copy *.gif build\images
Additional information on using the build scripts is found in Building Enterprise JavaBean examples
C++ Client (requires visibroker 4.1)
Tuxedo Client (requires Tuxedo 8.0)
Read more about WebLogic RMI over IIOP in the Developer Guide, Using WebLogic RMI over IIOP.
Read more about WebLogic EJB in the Developer Guide, BEA WebLogic Server Enterprise JavaBeans.
Read more about WebLogic RMI in the Developer Guide, Using WebLogic RMI.
|
Documentation is available at http://e-docs.bea.com/wls/docs61 |