Table of Contents Previous Next PDF


This topic includes the following sections:
Using FML with Oracle Tuxedo Java Server
Overview of FML
FML is a set of java language functions for defining and manipulating storage structures called fielded buffers. Each fielded buffer contains attribute-value pairs in fields. For each field:
There are two types of FML:
For more information about using FML, see Programming a Tuxedo ATMI Application Using FML.
The Oracle WebLogic Tuxedo Connector FML API
The FML application program interface (API) is documented in the package included in the Javadocs for "WebLogic Server Classes".
FML Field Table Administration
Field tables are generated in a manner similar to Oracle Tuxedo field tables. The field tables are text files that provide the field name definitions, field types, and identification numbers that are common between the two systems. To interoperate with an Oracle Tuxedo system using FML, the following steps are required:
For example: Your Oracle Tuxedo distribution contains a bank application example called bankapp. It contains a file called bankflds that has the following structure:
# name number type flags comments
ACCOUNT_ID 110 long - -
ACCT_TYPE 112 char - -
ADDRESS 109 string - -
Use the correct instance of the command to convert the bankflds field table into FML32 java source. The following example uses mkfldclass.
java bankflds
The resulting file is called and has the following structure:
import java.lang.*;
import java.util.*;
public final class bankflds
/** number: 110 type: long */
public final static int ACCOUNT_ID = 33554542;
/** number: 112 type: char */
public final static int ACCT_TYPE = 67108976;
/** number: 109 type: string */
public final static int ADDRESS = 167772269;
/** number: 117 type: float */
The result is a bankflds.class file. When loaded, the Oracle Tuxedo Java server uses the class file to add, retrieve and delete field entries from an FML field.
For example:
Using the DynRdHdr Property for mkfldclass32 Class
You may need to use the DynRdHdr utility if:
Use the following steps to use the DynRdHdr property when compiling your FML tables:
java -DDynRdHdr=Path_to_Your_FML_Table userTable
The arguments for this command are defined as follows:
Compile the userTable file using the following command:
For example:
Once you have created the userTable.class file, you can modify the FML table and deploy the changes without having to manually create an updated userTable.class. When the Java server is started, Java server will load the updated FML table.
If the Path_to_Your_FML_Table attribute changes, you will need to use the preceding procedure to update your and userTable.class files.
Gaining TypedFML32 Performance Improvements
Two new constructors for TypedFML32 are available to improve performance. The following topic provides explanation as to when to use these constructors.
The constructors are defined in the Javadocs for "WebLogic Server Classes".
To gain TypedFML32 performance improvements, you can choose to give size hints to TypedFML32 constructors. There are two parameters that are available to those constructor:
For instance, a field table used by the buffer contains 20 field IDs, and each field can occur 20 times. In this case, the first parameter should be 400 for the maximum number of fields. The second parameter should be 20 for the total number of field IDs.
TypeFML32 mybuffer = new TypeFML32(400, 20);
If you have an extremely small buffer, use those constructor without hints. An example of an extremely small buffer is a buffer with less than 16 total occurrences. If the buffer is extremely large, for example contains more than 250000 total field occurrences, then the application should consider splitting it into several buffers smaller than 250000 total field occurrences.
Using VIEW with Oracle Tuxedo Java Server
Overview of VIEW Buffers
Oracle Tuxedo Java server allows you to use a Java VIEW buffer type analogous to an Oracle Tuxedo VIEW buffer type derived from an independent C structure. This allows Oracle Tuxedo Java server classes and Oracle Tuxedo applications to pass information using a common structure.
For more information on Oracle Tuxedo VIEW buffers, see "Using a VIEW Typed Buffer" in Programming a Tuxedo ATMI Application Using C.
How to Create a VIEW Description File
Your Oracle Tuxedo Java server class 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
You can have only one VIEW description per file.
The VIEW description file is the same file used for both the viewj compiler and the Oracle Tuxedo viewc compiler.
Data type of the field. Can be set to short, long, float, double, char, string, carray, or dec_t (packed decimal).
For STRING and CARRAY buffer types, specifies the maximum length of the value. This field is ignored for all other buffer types.
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 '\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 an Oracle Tuxedo application. The file name for this VIEW is infoenc.
Listing 5‑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
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) How to Use the viewj CompilerHow to Use the viewj Compileras a placeholder in these fields.
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 [options] [package] viewfile
To use the viewj32 compiler, enter the following command:
java [options] [package] viewfile
The arguments for this command are defined as follows:
Table 5‑3 Arguments for the Commands for viewj Compiler
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.
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).
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.
Use to generate output class as extending TypedXCommon instead of TypedView.
Use to generate output class as extending TypedXCType instead of TypedView.
-compat_names and -bean_names are mutually exclusive options.
Example: Infoenc
For example:
A VIEW buffer is compiled as follows:
java -compat_names examples.javaserver.atmi.simpview infoenc
A VIEW32 buffer is compiled as follows:
java -compat_names -modify_strings
examples.javaserver.atmi.simpview infoenc
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.set methods set the count for an array field and set the length for a string or carray field.
Use one of the following to set or get the state of the AssociatedFieldHandling flag:
Use the -associated_fields option for the viewj and viewj32 compiler to set the AssociatedFieldHandling flag to true.
Invoke the void setAssociatedFieldHandling (boolean state) method in your Java application to set the state of the AssociatedFieldHandling flag.
Invoke the boolean getAssociatedFieldHandling() method in your Java application to return the current state of AssociatedFieldHandling.
How to Use VIEW Buffers in JATMI Applications
Use the following steps when incorporating VIEW buffers in your JATMI applications:
Create a VIEW description file for your application as described above.
Compile the VIEW description file as described above.
Import the output class of the VIEW compiler into your source code.
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" in Programming a Tuxedo ATMI Application Using C.
Configure the fully qualified class name of the compiled Java VIEW description file in <Resources> section in Tuxedo Java server configuration. The class of the compiled Java VIEW description file should also be included in <ClassPath> of your configuration file.
For example: (for VIEW32)
<ViewFile32Classes> examples.javaserver.atmi.simpview</ViewFile32Classes>
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 using the ViewFile32Classes attribute in the <Resources> section of the Tuxedo Java server configuration file.
The following access methods are available in this helper class.
Listing 5‑2 Example: How to Add and Retrieve an Embedded TypedView32 Buffer in a TypedFML32 Buffer
String toConvert = new String("hello world");
TypedFML32 MyData = new TypedFML32(new MyFieldTable());
Long d1 = new Long(1234);
Float d2 = new Float(12.32);
MyView data = new myView();
FviewFld vfld;
vfld = new FviewFld("myView", data);
try {
myData.Fchg(MyFieldTable.FLD0, 0, toConvert);
myData.Fchg(MyFieldTable.FLD1, 0, 1234);
myData.Fchg(MyFieldTable.FLD2, 0, d2);
myData.Fchg(MyFieldTable.myview, 0, vfld);
} catch (Ferror fe) {
log("An error occurred putting data into the FML32 buffer. The error is " + fe);
try {
myRtn = myTux.tpcall("FMLVIEW", myData, 0);
} catch(TPReplyException tre) {
TypedFML32 myDataBack = (TypedFML32)myRtn.getReplyBuffer();
Integer myNewLong;
Float myNewFloat;
myView View;
String myNewString;
try {
myNewString = (String)myDataBack.Fget(MyFieldTable.FLD0, 0);
myNewLong = (Integer)myDataBack.Fget(MyFieldTable.FLD1, 0);
myNewFloat = (Float)myDataBack.Fget(MyFieldTable.FLD2, 0);
vfld = (FviewFld)myDataBack.Fget(MyFieldTable.myview, 0);
view = (myView)vfld.getViewData();
} catch (Ferror fe) {
The following code listing is an example FML Description (MyFieldTable) related to the example in Listing 5‑2.
Listing 5‑3 Example FML Description
*base 20000
#name number type flags comments
FLD0 10 string - -
FLD1 20 long - -
FLD2 30 float - -
myview 50 view32 - defined in View description file

Copyright © 1994, 2017, Oracle and/or its affiliates. All rights reserved.