bea.com | products | dev2dev | support | askBEA

Download Docs | Site Map | Glossary
Search

WebLogic Tuxedo Connector Programmer's Guide

WebLogic Tuxedo Connector JATMI VIEWs

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

- Overview of WebLogic Tuxedo Connector VIEW Buffers

- How to Create a VIEW Description File

- How to Use the viewj Compiler

- How to Use VIEW Buffers in JATMI Applications

Overview of WebLogic Tuxedo Connector VIEW Buffers

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

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

How to Create a VIEW Description File

Note: 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 WebLogic Server application and your 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

- The file name is the same as the VIEW name.

- You can have only one VIEW description per file.

- The VIEW description file is the same file used for both the WebLogic Tuxedo Connector viewj compiler and the Tuxedo viewc compiler.

- viewname is the name of the information structure.

- You can include a comment line by prefixing it with the # or $ character.

- The following table describes the fields that must be specified in the VIEW description file for each structure.

  Table 7-1 VIEW Description File Fields

  Field | Description
  --- | ---
  type | Data type of the field. Can be set to short, long, float, double, char, string, or carray.
  cname | Name of the field as it appears in the information structure.
  fbname | Ignored.
  count | Number of times field occurs.
  flag | Specifies any of the following optional flag settings: N—zero-way mapping C—generate additional field for associated count member (ACM) L—hold number of bytes transferred for STRING and CARRAY
  size | For STRING and CARRAY buffer types, specifies the maximum length of the value. This field is ignored for all other buffer types.
  null | User-specified NULL value, or minus sign (-) to indicate the default value for a field. NULL values are used in VIEW typed buffers to indicate empty C structure members. The default NULL value for all numeric types is 0 (0.0 for dec_t). For character types, the default NULL value is \Q\0'. For STRING and CARRAY types, the default NULL value is " ". Constants used, by convention, as escape characters can also be used to specify a NULL value. The VIEW compiler recognizes the following escape constants: \ddd (where d is an octal digit), \0, \n, \t, \v, \r, \f, \\, \', and \". You may enclose STRING, CARRAY, and char NULL values in double or single quotes. The VIEW compiler does not accept unescaped quotes within a user-specified NULL value. You can also specify the keyword NONE in the NULL field of a VIEW member description, which means that there is no NULL value for the member. The maximum size of default values for string and character array members is 2660 characters.

Example VIEW Description File

The following provides an example VIEW description which uses VIEW buffers to send information to and receive information from a Tuxedo application. The file name for this VIEW is infoenc.

Listing 7-1 Example VIEW Description

>     VIEW infoenc
>     #type    cname    fbname  count flag size null
>     float    amount   AMOUNT  2     -    -    0.0
>     short    status   STATUS  2     -    -    0
>     init     term     TERM    2     -    -    0
>     char     mychar   MYCHAR  2     -    -    -
>     string   name     NAME    1     -    16   -
>     carray   carray1  CARRAY1 	1     -    10   -
>     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 [package] viewfile

To use the viewj32 compiler, enter the following command:

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

The arguments for this command are defined as follows:

Argument | Description
--- | ---
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:

- A VIEW buffer is compiled as follows:

>     java weblogic.wtc.jatmi.viewj examples.wtc.atmi.simpview infoenc

- A VIEW32 buffer is compiled as follows:

>     java weblogic.wtc.jatmi.viewj32 examples.wtc.atmi.simpview infoenc

The output of the viewj command is a .java source file that contains set and get accessor methods for each field in the VIEW description file.

How to Use VIEW Buffers in JATMI Applications

Note: For an example on how to develop JATMI applications that use VIEW buffers, see the examples/wtc/atmi/simpview package in your WebLogic Server distribution.

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 recieve information from a VIEW buffer.

   See the examples/wtc/atmi/simpview/ViewClient.java file in your 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 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.

7. Build and launch your Tuxedo application.

8. Build and launch your WebLogic Server Application.