Use a simple WebFrame to solve EAI and division of labor cooperation issues

zhaozj2021-02-16  43

Use a simple WebFrame to solve EAI and division of labor cooperation issues

In the work of the previous time, we have developed a website for the final customer. The website's data is from different systems. This is an item with EAI nature, including: SQL Server Database, Tuxedo Jolt Service, Tuxedo CORBA service running, Socket. Naturally, consider using EJB to access these background systems, using servlets to access EJB, using JSP to display results.

In the design phase, our most painful problem is that we only have two primary experience JSP / servlet staff, and the J2EE's understanding is not deep, and there are two J2EE developers with considerable experience. If you develop EJB according to the traditional way, then publish an interface to the Web developer, then complete the page by the web developer, and the efficiency is very low and there is no way to maintain it. We also briefly examine some existing technologies, including WebService, Cocoon, MVC, TAG technologies, etc., which requires an increase in considerable training time, so we decided to be a webframe, this WebFrame currently used version, solved The following two important issues:

2 Departing the development of Web and EJB (completed EAI interface) developers

2 can be integrated with other systems (EAI)

In fact, the current WebFrame, implemented features have a lot of similarities with WebService.

Complete workflow interacting with EAI system

This sequence diagram simply describes how to interact with an EAI background system with WebFrame.

The XML Message, Servlet, and JSP View in the figure constitute a simple MVC model.

Servlet converts the submitted data into XML data, WebFrame is responsible for checking the legality of these data, while determining which EJB should be submitted to the XML data. After the EJB receives XML data, connects to the background EAI system, and then constructs the result to the XML data, returns to WebFrame.

In general, XML data should describe the following information:

2 Operation users, WebFrame do logging and determine if the user is operating

2 The number of this operation, WebFrame is used to determine the corresponding EJB JNDI NAME

2 Data operation, WebFrame does not process this data, and is processed by EJB

2 Returned data, WebFrame does not process this data, displayed by JSP View to User

It can be seen that the key is that the data is XML format, so in realization, the method of operating the operation in WebFrame and EJB is String type, which means all EJBs responsible for EAI. Interface and Remote Interface are consistent.

The most critical transaction processing class and method in WebFrame:

Package com.sztelecom.Webframe.core;

/ **

* Core transaction management, responsible for foreground and EJB session management

* @Author chen wenjing

* @version 1.0, Mar-27-2002

* @since JDK 1.3.1

* /

Public Class TransactionManager

{

/ **

* Acceptance application, distribute to different EAI EJBs according to XML description

* See WebUser.referapply ()

* @Param _sxml XML Description * @Return XML operation result

* /

Public String Referapply (String_SXML)

{

}

}

EJB Home Interface:

Package com.sztelecom.Webframe.ejb.core;

/ **

* All EAI EJB HOME interface

*

* @Author chen wenjing

* @version 1.0, Mar-27-2002

* @since JDK 1.3.1

* /

Public Interface Agene Extends EJBHOME

{

Agent Create () THROWS CREATEXCEPTION, EJBEXCEPTION, RemoteException

}

EJB Remote Interface:

Package com.sztelecom.Webframe.ejb.core;

/ **

* All EAI EJB Remote interface

*

* @Author chen wenjing

* @version 1.0, Mar-27-2002

* @since JDK 1.3.1

* /

Public Interface Agent Extends EJBOBJECT

{

/ **

* Operation application method.

* @Param _sxml XML Description

* @return XML operation result.

* /

Public String Referapply (String _sxml) throws EJBEXCEPTION, RemoteException;

/ **

* View the method available for EJB.

* @Return True

* /

Public boolean isavailable () throws ejbexception, remoteexception;

}

EAI interface developer's responsibilities

In the case of using WebFrame development, EAI interface developers only need to complete EAI calls, and give an XML request data and return data format, and more complete cases, it can give a simple call routine. Unlike traditional J2EE EJB development, you need to let calm people to care about Exception, AppServer addresses, complex parameters.

WEB developer's responsibilities

In the case of using WebFrame development, the web developer only needs to know the format of XML data and the number of the operation, it can be done. Web developers don't need to know any knowledge related to EJB, just master HTML, JSP, and servlets.

Key class description in WebFrame

The core handling class includes:

TransactionManager Completes transaction management, this Singleton is responsible for connecting to Eai EJB.

The Pluginit interface is used to define additional initialization content, and the class name that implements this interface will be described in the configuration file called WebFrame.xml.

The DBConnection class wraps the database connection, the address of the database connection or the JNDI name is described in WebFrame.xml.

HOME and REMOTE INTERFACE in Eai EJB

Class of log records, WebFrame Package log system, which is provided by Apache, and logkit provides more custom space than log4j, so the system log is log 4J record, and accesses the EAI EJB application log, by Logkit is recorded.

WebFrame initializes servlet, all configuration information, recorded in the webframe.xml file.

Related to users include:

The WebUser class is a physical class, record the various status and data of the logged in user. The LoginRole interface is a user role interface, while the specific corresponding user role class is described in WebFrame.xml.

The Validator interface is a user authenticator interface to check the user legality, and the corresponding user authenticator class is described in WebFrame.xml.

LoginManager class management user's entire survival period.

WEBFrame provides a list of features

ü Completely complies with the J2EE specification, which can be built in any web server that meets J2EE standards.

ü Management basic database connection

ü Perfect log system, including system logs and Eai logs

ü Manage user types, and user types can be customized

ü Responsible for EAI EJB access distribution, control access to concurrent load

ü You can customize additional initialization plugins

ü Manage user types available EAI EJB

ü Use XML to complete the configuration and EAI EJB access data

ü Manage user survival

ü unified user login entrance

ü Unified XML business data entrance and export

WebFrame Prospect

The current configuration file WebFrame.xml also needs to be modified, and will provide console to modify the configuration file. The situation currently modifying the configuration file needs to be restarted.

The ultimate goal of WebFrame is to become a Web-EAI system base platform that adapts to most of the cases, minimizing training costs, so that developers of different roles can focus on their development work in their respective proprietary areas.

转载请注明原文地址:https://www.9cbs.com/read-27031.html

New Post(0)