Rule-based large host message format conversion
The most widely used industry in large mainframes is banking, and the vast majority of the world's banking back-end systems are running on mainframe computers, because large hosts have unparalleled advantages over I/O capabilities, Non-numeric computing capabilities, stability, and security for other types of computer systems. In recent years, with the strong demand of enterprise in data centralization, application integration, IT infrastructure migration and mass data processing, combined with the rapid development of virtualization technology and the relatively low overall cost of mainframe, it has made its manufacturing, insurance, aviation, transportation, government and Large-scale retail enterprises and other industries have been a lot of successful applications. However, for a professional Java EE application developers, host-related content is unfamiliar and not intuitive, for example, for like "tx01#010 20319#01223@michale@19@china beijing#2009.07.04#" Such a transaction message would give some developers only familiar with the application of the upper layer of the problem, of course, the example is relatively simple, and the actual application of those long and the lack of readability of the host packet, for a developer who want to understand the meaning of a nightmare. Also, large hosts are basically applied to more complex systems, inside the message format varies widely, although there are generally some rules to describe these formats, but the large number of message format and low-level fault tolerance will still make the developer daunting (I have seen a small project in the message format of the description of the document, Printed out with a full thickness of this). Therefore, based on the experience of some practical projects, this paper proposes a design framework of a large host message simulation tool based on Eclipse and gives some realization ideas. This tool is mainly used to assist developers in the design and verification of message format rules, to help developers quickly understand the contents of the message, it is proved that such a tool in the implementation of the project can greatly improve the content of the host message development efficiency, reduce the difficulty of development.
Before we begin to introduce this packet simulation tool, let's briefly describe the architecture of rule-based large host message format conversion. In general, this application of the message format conversion to achieve two requirements, one is to convert the content of a Java object into a host message, and the second is to transfer the contents of a host message to a Java object. It also requires that the conversion rules be described in some way, and out of the box, such as using XML to describe these rules and save them to a file. This shows that the message format conversion contains two parts of the key content, a conversion engine, responsible for conversion and reverse conversion, some existing files or the existence of rules in the database, as shown in the following figure.
Figure 1. Rule-based Message format conversion function
For example, there is an existing Java Bean named Customer that contains the ID and name two attributes. Listing 1. Customer's definitionpublic class Customer {
private String id;
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
Defining the transformation rules for XML format for this Java Bean relies on the rule modeling primitives supported by this transformation engine, and on the other hand, on the business requirements of the specific application. The conversion engine used in different applications may come from different products, but the commonality makes the architecture design of the later message Converter simulator have enough versatility, in order to better illustrate this commonality, we use IBM Websphere multi-channel Bank Transform Toolkit (WMBTT) is an example of Formatter in this product. WMBTT is one of IBM's products for banks to provide multi-channel solutions for the electronic platform, which is widely used in internet banking, teller system, mobile banking and so on in different countries of the world. Formatter is the core component of WMBTT and is used as an engine for format conversions. Define a Formatter XML conversion rule for the above Java Bean, as follows: Listing 2. Conversion rules defined for Customer<fmtDef id="customerFmt">
<record>
<constant value="TX01"/>
<fString dataName="id"/>
<delim delimChar="#"/>
<fString dataName="name"/>
<delim delimChar="#"/>
</record>
</fmtDef>
Then for an ID "001", name "Shaoyu" Customer object, the final conversion result is "tx01001#shaoyu#", which "TX01" is the transaction code, indicating this message to the big machine will start which transaction services. Also, there is not a one by one correspondence between Java beans and XML rules, and a Java bean may apply to multiple conversion rules, and the same transformation rule may be used for different Java beans, a relationship that derives from the diversity of business requirements.
Looking at the XML transformation rule in Listing 2, you can see that it describes the structure of the converter. Each of these converters is built by the transformation engine according to the XML rule description, and follows the composite design pattern, which is the commonality of the transformation engine: a converter that generates a composite pattern in XML or other format descriptions, which completes the final conversion and conversion work. The following figure is the structure of the Formatter composite pattern in WMBTT.
Figure 2. The composite design pattern of Formatter in WMBTT
From the above figure, you can see that the Formatter in WMBTT follows the composite design pattern, which is so versatile that many of the converter designs in the project application take such a structure. Based on this, we propose a design of a message simulator. This design approach is sufficiently versatile, and the tools that are implemented based on this design can help project engineers improve the efficiency of defining XML rules for the transformation engine.