bea.com | products | dev2dev | support | askBEA |
![]() |
![]() |
|
![]() |
e-docs > WebLogic Platform > WebLogic Integration > DI Topics > Translating Data > Creating Custom Data Types |
Translating Data
|
Creating Custom Data Types
WebLogic Integration uses a metadata language called Message Format Language (MFL), based on XML, to describe the structure of binary data when data is being integrated. The Format Builder creates and maintains metadata as a data file, or an MFL document in the repository.
In MFL, the following metadata is used to describe a binary field:
Of this information, the data type is the most critical. The selected data type dictates which metadata attributes are valid and how they are interpreted.
The data integration component of WebLogic Integration includes a User Defined Type feature that allows you to create custom data types specific to your unique data type requirements. The User Defined Type feature allows these custom data types to be plugged in to the data translation run-time engine. Once a user defined data type is plugged-in, it is indistinguishable from a built-in data type in both features and function.
Instructions for using user-defined types are provided in the following sections:
Samples of User-Defined Types
The following table provides describes the sample files installed with user-defined types. All directory names are relative to the WebLogic Integration samples directory (SAMPLES_HOME\integration) where SAMPLES_HOME is the samples directory in your WebLogic Platform installation..
Registering User-Defined Types
Perform the following steps to register a new User Defined Type:
Figure B-1 Add/Remove User-Defined Types Dialog Box
Figure B-2 Add/Remove User-Defined Types Dialog Box
If a requested class cannot be loaded or does not conform to the requirements for a user-defined type, an error message is displayed. Click OK to return to the Add/Remove User Defined Types dialog box.
For lists of the required and optional interface methods, and utility methods available for use with user-defined types, see the user-defined type coding requirements.
After you define the new data type, the new Display Name is shown in the Type drop-down list on the detail window for a field. All user-defined types displayed in the Type drop-down list are prefixed with User Defined:, as shown in the DisplayName text field.
Because the Format Builder cannot know the exact type of data represented by a user-defined type, the xsd::string type is used to represent the user-defined type in the XML Schema generated to describe the content model of the XML output.
Use of this data type also affects the Format Tester. When data is being generated for an MFL document containing user-defined types, String data is generated for the corresponding fields. You must adjust the generated data so it can be parsed according to the user-defined type.
Creating User-Defined Types
The interface to the data translation engine is an API called by a Java program. Creating a new user-defined type for the process engine is accomplished via a static method of the com.bea.wlxt.WLXT class.
Installation of a user-defined type in the data translation engine is not persistent. When the current JVM process terminates, the user-defined type configuration information is discarded. As a result, clients using the stand-alone engine must install all user-defined types at the start of each program.
The following public functions are defined for user-defined types:
name specifies the name of the data type to be removed.
The following example shows how to use these APIs to install and remove the CapString user-defined type:
import com.bea.wlxt.WLXT;
import com.bea.wlxt.binType.BinType;
// create data type object and install it
Bintype udt = new CapString();
WLXT.addNewDataType("UpperCaseString", udt);
.
.
.
//remove the udt installed above
WLXT.removeDataType("UpperCaseString");
Configuring User-Defined Types for the Data Integration Plug-In
The user-defined types used by the data integration plug-in for business process management (BPM) are stored in the WebLogic Integration repository as CLASS documents. At run time, the data integration plug-in loads user-defined type classes from the repository as required. In addition, the data integration plug-in exports the MFL and class files required to support the active template, allowing a template to be imported, intact, on another BPM instance.
At run time, the data integration plug-in retrieves both MFL documents and required user-defined type classes from the repository. Class documents may be placed in the repository by using one of the following methods:
Publishing User-Defined Types to the Repository from the Format Builder
To publish a user-defined type to the repository, complete the following procedure:
Figure B-3 WebLogic Integration Repository Login Dialog Box
With a repository connection established, the Add/Remove User Defined Types dialog box displays the status of each registered user-defined type and allows for its publication to the repository. The user-defined type repository status is reflected by a ball-shaped icon before the name of each installed user-defined type.
Figure B-4 Add/Remove User-Defined Types Dialog Box
The status of each user-defined type is indicated by the color of the icon.
Publishing User-Defined Types to the Repository Using the Repository Import Utility
The repository import utility may be used to import Java class files, including data translation user-defined types. To use the import utility for this purpose, pass the name of the class file on the Import command line. For example, to import all the class files in the current directory:
java com.bea.wlxt.repository.Import *.class
Please note that any Java class file can be imported to the repository. This is not the case for user-defined type class files created in the Format Builder. This capability can be useful if, for example, a user-defined type relies on additional class files that do not extend the com.bea.wlxt.bintype.Bintype class. By using the repository import utility, you can put these utility classes in the repository, where they can be accessed by the repository class loader.
User-Defined Type Coding Requirements
User-defined types are required to extend the com.bea.wlxt.bintype.Bintype abstract class or one of the classes derived from it. The Bintype class provides the basic framework used by the data integration component of WebLogic Integration to interface with a data type. This class also provides utility routines that are useful for processing binary data types. In addition, two subclasses of Bintype, BintypeDate and BintypeString, offer additional utility routines for date and string types, respectively.
The following classes, along with the required and optional interface methods they provide, are available for user-defined types.
Class com.bea.wlxt.bintype.Bintype
Class com.bea.wlxt.bintype.Bintype consists of the following required, optional, and utility methods.
Required Interface Routines
The following interface methods are required when using the WebLogic Integration user defined data types utility.
Optional Interface Routines
When you use the data translation user-defined data types utility, the following interface routines are optional:
Utility Interface Routines
When you use the data translation user-defined data types utility, the following utility interface routines are available:
Class com.bea.wlxt.bintype.BintypeString
Class com.bea.wlxt.bintype.BintypeString consists of the following required, optional, and utility routines.
Required Interface Routines
Same as class com.bea.wlxt.bintype.Bintype.
Optional Interface Routines
Same as class com.bea.wlxt.bintype.Bintype.
Utility Interface Routines
Same as class com.bea.wlxt.bintype.Bintype, plus the following utility interface routines.
Class com.bea.wlxt.bintype.BintypeDate
Class com.bea.wlxt.bintype.BintypeDate consists of the following required, optional, and utility routines.
Required Interface Routines
Same as class com.bea.wlxt.bintype.Bintype.
Optional Interface Routines
Same as class com.bea.wlxt.bintype.Bintype.
Utility Interface Routines
Same as class com.bea.wlxt.bintype.Bintype, plus the following utility interface routines.
Class com.bea.wlxt.mfl.MFLField
The MFLField class is passed into all read and write methods for user-defined types. It encapsulates all the attributes defined for the field being read or written. MFLField supplies various methods that allow these attributes to be queried, and their respective values returned. Attributes that are not supported by a user-defined type are never included. For example, if a user-defined type returns false to the isValueOK() method, it is never passed to an MFLField object that returns true for the MFLField.hasValue() method.
Class com.bea.wlxt.mfl.MFLField supports the following MFLField methods:
![]() |
![]() |
![]() |
![]() |
||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |