![]() |
![]() |
|
|
Creating Custom Data Types
The data integration component of WebLogic Integration uses a metadata language called Message Format Language (MFL), based on XML, to describe binary data structure. Format Builder creates and maintains this metadata as a data file, or an MFL document in the repository. MFL uses the following metadata information 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 on how to use User Defined Type are contained in the following topics:
User Defined Types Sample Files
The following table provides a listing and description of the sample files installed for use with User Defined Types. All directory names are relative to the WebLogic Integration installation directory.
Table B-1 User Defined Types Sample Files
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
Note: The class name entered must include any package name present in the definition of the module. Additionally, the named class must be found in the Format Builder CLASSPATH. The WebLogic Integration installation of Format Builder creates a <wli home>/ext directory specifically for containing User Defined Types. The <wli home> directory is where WebLogic Integration is installed.
Figure B-2 Add/Remove User Defined Types Dialog Box
If the requested class cannot be loaded or does not conform to the requirements for a User Defined Type, an error message displays. Click OK to return to the Add/Remove User Defined Types dialog box. Refer to the User Defined Type Coding Requirements for required and optional interface methods, and available utility methods used for User Defined Types.
Now that you have defined the new data type, the new Display Name appears in Format Builder along with the built-in data types. All User Defined Types displayed in the Data Type drop-down list box are prefixed with User Defined:, as in DisplayName text field.
Note: Because Format Builder cannot know the exact type of data represented by a User Defined Type, all generated XML Schema documents describing the XML generated by the data translation run-time component of WebLogic Integration for a particular transformation will use type of xsd::string to represent User Defined Type fields. This also affects Format Tester. When generating data for an MFL document containing User Defined Types, String data is generated for the corresponding fields. You must adjust the generated data so it will parse 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 static method of the com.bea.wlxt.WLXT class.
Installation of a User Defined Type into the data translation engine is not persistent. At termination of the current JVM process, 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:
public static void addNewDataType(String name, Bintype binType)
public static void removeDataType (String name)
The following example illustrates using theses 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
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 runtime, the Data Integration Plug-In loads User Defined Type classes from the repository as required. In addition, the Data Integration Plug-In will export the MFL and class files required to support the active template allowing a template to be imported on another BPM instance intact.
At runtime, the Data Integration Plug-In will retrieve both MFL documents and required User Defined Type classes from the repository. Class documents may be placed in the repository using one of the following methods:
Publishing User Defined Types to the Repository from Format Builder
Perform the following steps to publish a User Defined Type to the repository.
Figure B-3 WebLogic Integration Repository Login Window
Note: The WebLogic Integration Repository Login window allows up to three unsuccessful login attempts, after which, a login failure message is displayed. If you experience three login failures, choose Repository
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 an icon of a ball preceding the type name of each installed User Defined Type.
Figure B-4 Add/Remove User Defined Types Dialog Box
The color of the icon associated with each User Defined Type indicates its status:
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. This is accomplished by passing the class file name on the Import command line. For example, to import all the class files in the current directory:
java com.bea.wlxt.repository.Import *.class
It must be noted that any Java class file can be imported to the repository. This is not the case for Format Builder User Defined Type class files. 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. Using the repository import utility allows these utility classes to be placed in the repository where they can be loaded 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 its derived classes. The Bintype class provides the basic framework the data integration component of WebLogic Integration uses to interface with a data type and also provides utility routines useful in 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 and their required and optional interface methods are used 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
The following interface routines are optional when using the data translation user defined data types utility.
Utility Interface Routines
The following utility interface routines are available when using the data translation user defined data types utility.
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 User Defined Type read and write methods. It encapsulates all the defined attributes for the field being read or written. MFLField supplies various methods that allows these attributes to be queried, and their respective values returned. Attributes that the User Defined Type does not support will never be present. For example, if the User Defined Type returned false to the isValueOK() method, it would never be passed to an MFLField object which returned true for the MFLField.hasValue() method.
Class com.bea.wlxt.mfl.MFLField supports the following MFLField methods.
![]() |
![]() |
![]() |
|
Copyright © 2001 BEA Systems, Inc. All rights reserved.
|