Oracle WebLogic Tuxedo Connector Programmer's Guide

      

Oracle WebLogic Tuxedo Connector JATMI VIEWs

The following sections provide information about how to use Oracle WebLogic Tuxedo Connector VIEW buffers:

The TypedView and TypedView32 buffer types are missing from the WLS Javadocs, see TypedView and TypedView32 instead.

 


Overview of Oracle WebLogic Tuxedo Connector VIEW Buffers

For more information on Oracle Tuxedo VIEW buffers, see Using a VIEW Typed Buffer.

Oracle WebLogic Tuxedo Connector allows you to create a Java VIEW buffer type analogous to an Oracle Tuxedo VIEW buffer type derived from an independent C structure. This allows Oracle WebLogic Server applications and Oracle Tuxedo applications to pass information using a common structure. Oracle WebLogic Tuxedo Connector VIEW buffers do not support FML VIEWs or FML VIEWs/Java conversions.

 


How to Create a VIEW Description File

fbname and null fields are not relevant for independent Java and C structures and are ignored by the Java and C VIEW compiler. You must include a value (for example, a dash) as a placeholder in these fields.

Your Oracle WebLogic Server application and your Oracle Tuxedo application must share the same information structure as defined by the VIEW description. The following format is used for each structure in the VIEW description file:

$ /* VIEW structure */

VIEW viewname
type cname fbname count flag size null

where

 

Example VIEW Description File

The following provides an example VIEW description which uses VIEW buffers to send information to and receive information from an Oracle Tuxedo application. The file name for this VIEW is infoenc. Listing 8-1 Example VIEW Description

VIEW infoenc

#type cname fbname count flag size null
float amount AMOUNT 2 - - 0.0
short status STATUS 2 - - 0
int term TERM 2 - - 0
char mychar MYCHAR 2 - - -
string name NAME 1 - 16 -
carray carray1 CARRAY1 1 - 10 -
dec_t decimal DECIMAL 1 - 9 - #size ignored by viewj/viewj32
END

 


How to Use the viewj Compiler

To compile a VIEW typed buffer, run the viewj command, specifying the package name and the name of the VIEW description file as arguments. The output file is written to the current directory.

To use the viewj compiler, enter the following command:

java weblogic.wtc.jatmi.viewj [options] [package] viewfile

To use the viewj32 compiler, enter the following command:

java weblogic.wtc.jatmi.viewj32 [options] [package] viewfile

The arguments for this command are defined as follows:

Argument Description
options

  • -associated_fields:

    Use to set AssociatedFieldHandling to true. This allows set and get accessor methods to use the values of the associated length and count fields if they are specified in the VIEW description file. If not specified, the default value for AssociatedFieldHandling is false.

  • -bean_names:

    Use to create set and get accessor names that follow JavaBeans naming conventions. The first character of the field name is changed to upper case before the set or get prefix is added. The signature of indexed set accessors for array fields changes from the default signature of void setAfield(T value, int index) to void setAfield(int index, T value).

  • -compat_names:

    Use to create set and get accessor names that are formed by taking the field name from the VIEW description file and adding a set or get prefix. Provides compatibility with releases prior to WebLogic Server 8.1 SP2. Default value is -compat_names if -bean_names or -compat_names is not specified.

  • -modify_strings:

    Use to generate different Java code for encoding strings sent to Oracle Tuxedo and decoding strings received from Oracle Tuxedo. Encoding code adds a null character to the end of each string. Decoding code truncates each string at the first null character received.

  • -xcommon:

    Use to generate output class as extending TypedXCommon instead of TypedView.

  • -xtype:

    Use to generate output class as extending TypedXCType instead of TypedView.

-compat_names and -bean_names are mutually exclusive options.

package The package name to be included in the .java source file. Example: examples.wtc.atmi.simpview viewfile Name of the VIEW description file. Example: Infoenc

For example:

 


How to Pass Information to and from a VIEW Buffer

The output of the viewj and viewj32 command is a .java source file that contains set and get accessor methods for each field in the VIEW description file. Use these set and get accessor methods in your Java applications to pass information to and from a VIEW buffer.

The AssociatedFieldHandling flag is used to specify if the set and get methods use the values of the associated length and count fields if they are specified in the VIEW description file.

Use one of the following to set or get the state of the AssociatedFieldHandling flag:

 


How to Use VIEW Buffers in JATMI Applications

The TypedView and TypedView32 buffer types are missing from the WLS Javadocs, see TypedView and TypedView32 instead.

Use the following steps when incorporating VIEW buffers in your JATMI applications:

  1. Create a VIEW description file for your application as described in How to Create a VIEW Description File .

  2. Compile the VIEW description file as described in How to Use the viewj Compiler .

  3. Use the set and get accessor methods to pass information to and receive information from a VIEW buffer as described in How to Pass Information to and from a VIEW Buffer.

    See the examples/wtc/atmi/simpview/ViewClient.java file in your Oracle WebLogic Server distribution for an example of how a client uses accessors to pass information to and from a VIEW buffer.

  4. Import the output of the VIEW compiler into your source code.

  5. If necessary, compile the VIEW description file for your Oracle Tuxedo application and include the output in your C source file as described in Using a VIEW Typed Buffer.

  6. Configure a WTCServer MBean with a Resources Mbean that specifies the VIEW buffer type (VIEW or VIEW32) and the fully qualified class name of the compiled Java VIEW description file. The class of the compiled Java VIEW description file should be in your CLASSPATH.

  7. Build and launch your Oracle Tuxedo application.

  8. Build and launch your Oracle WebLogic Server Application.

 

How to Get VIEW32 Data In and Out of FML32 Buffers

A helper class is available to add and get VIEW32 data in and out of an FML32 buffer. The class name is wtc.jatmi.FViewFld. This class assists programmers in developing JATMI-based applications that use VIEW32 field type for FML32 buffers.

No change to configuration is required. You still configure the VIEW32 class path using the ViewTbl32Classes attribute in the WTCResources section of the WLS configuration file.

The following access methods are available in this helper class.

The following code listing is an example FML Description(MyFieldTable) related to the example in Listing 8-2.

*base 20000 
#name    number  type   flags   comments

FLD0 10 string - -
FLD1 20 long - -
FLD2 30 float - -
myview 50 view32 - defined in View description file

 


Using the XmlViewCnv Class for XML to and From View/View(32) Translation

Use the XmlViewCnv class to perform XML to View /View(32) or View/View(32) to XML translation. The following code listing is an example that uses the XmlViewCnv class for conversion to and from XML buffer formats.


import examples.wtc.atmi.simpview.infoenc; // View class import
weblogic.wtc.gwt.XmlViewCnv;
import weblogic.wtc.jatmi.TypedBuffer;

public class xml2view
{
   public static void main(String[] args) {

String xmlDoc =
"<VIEW32><infoenc><amount>1000.0</amount><infoenc></VIEW32>";

infoenc convertMe = new infoenc();
convertMe = (infoenc) XmlViewCnv.XMLToView(
         xmlDoc,

convertMe.getClass(),
convertMe.getSubtype());

convertMe = (infoenc) echo.Echo(convertMe);

result = XmlViewCnv.ViewToXML(
(TypedBuffer) convertMe,
convertMe.getClass(),
true);

System.out.println(result);
   }
}