Use J2EE architecture enterprise application
This article is selected from: Open System World - CCIDOM 2003 February 25
Enterprise applications refer to solutions and applications that are created and deployed for business organizations, large companies. These large enterprise-class applications are complex, involved in many external resources, intensive data, large amount of data, and more security considerations. Contemporary enterprise applications can no longer be a separate system. In the enterprise, multiple enterprise applications that are generally deployed, interacting with each other, while these applications may be connected to other businesses, which constitutes a structure complex, across intranet and Internet distributed enterprise application cluster. Among them, the technique of connecting various applications within the enterprise is called EAI (Enterprise Application Integration, Enterprise Application Integration), and the technology of various applications between enterprises is called B2BI (Business-To-Business Integration, inter-business integration), using Eai , B2BI technology and the early N-layer architecture are the biggest feature of today's enterprise applications. In addition, as an enterprise-class application, it must not only have a powerful function, but also meet the changes in future business needs, easy to upgrade and maintain.
Enterprise application architecture
Below we use a diagram to simply resolve the architecture of an enterprise application, see Figure 1.
Figure 1 System architecture for enterprise applications
The main body of this architecture is the MVC architecture. MVC is an abbreviation of Model / View / Control. Model / View / Control is a typical structure for software design. In this design structure, an application is divided into three parts: Model, View, and Controller, each part is responsible for different functions. Model refers to the processing module for business data / information, including access, processing, synthesis, etc. of business data; View refers to a user interface, which is a data indicating that the user is responsible for the process control between View and Model. That is to complete the operation of the two directions: 1. Map the operation of the user interface (view) to the specific model to complete the specific business logic; 2. React to the user interface in a timely business data over Model (View )on. The MVC architecture makes the application's structure clearer, and the code stability is enhanced by controlling the code according to the level divided into business logic / data, user interface, and application flow control. We know, for the three features of Model, View, Controller, the implementation of View is generally completed by interface designers and interface programmers. Model is completed by business logic, and Controller is generally controlled by the overall control. The programmer is completed. The code of the Controller section is relatively stable, which generally implements a universal architecture; MODEL will change with the change of business processes; the changes changed by the user demand. The division of this module function is conducive to the isolation of modules during code modification, and does not need to mix code with different functions to cause confusion. For project development, it is conducive to the division of labor in accordance with the team members in the project team, which is conducive to three partial parallel development, speeding up project progress.
Enterprise resource connection
For the Model section, it is the processing part of the business logic, and it is generally always processed, processing, synthesis, etc. For enterprise-class applications, Shangyu Yu Xin Street throws a pleasant, 恢 鞘 菘猓 硪 硪 蚴 蚴 蚴 渌 队 导 队 队 τ 场 场 场 场 场 蚴 蚴 蚴? 蚴 场 场 场 场 场? 场 场? 场 场 场 场 场 数据 场 数据 数据It should be a field that everyone is familiar with. By using the database driver, we use SQL to query and manipulate the database. For other enterprise applications, generally these applications provide an API. Through these APIs, other applications can access the data accessed, even some of these amateur applications in these enterprise applications.
Characteristic Enterprise Applications of Enterprise Platforms requires an excellent enterprise-class application architecture, and excellent enterprise-class application architecture usually comes from excellent solutions. The application design begins with the rationality, flexibility, and robustness of its architecture, which can meet the complex demand for enterprise applications, and there is room for future systems to adjust and upgrade. The architecture affects the life cycle of the entire application. It is actually able to extend the life cycle of the entire application, and enhance the adaptability of users in a variety of commercial society, reducing the overhead and difficulty of system maintenance, thus bringing maximum to users. Interests. An ideal enterprise-level application system should have the following characteristics: ◆ Validity of deployment, development and maintenance; ◆ Quality and reliability of the system operation; ◆ Ability to fail to recover; ◆ Can handle massive data; Hundreds of users; ◆ High security; ◆ High availability of data; ◆ Can quickly develop and deploy new applications; ◆ Simplify component reuse; ◆ Intuitive programming model; ◆ Support industry standard and general programming Interface; ◆ Applicable to small, medium, large-scale application systems; ◆ System cost increases with the growth of system scale; ◆ Continuous technical upgrade to meet the emerging demand.
Use J2EE architecture enterprise application
In order to meet the needs of architecture enterprise applications, Java's founder Sun is based on the various needs, leading and created J2EE (Java 2 Platform Enterprise Edition) based on early J2SE (Java 2 Platform Standard Edition). . So what is J2EE? In general, J2EE is a factual industrial standard using Java technology to develop enterprise-level applications (Sun has not included Java and its related technologies in the system of standardized organizations in their own interests. Java technology is constantly adapted and promoted the product in the enterprise application. Currently, the Java platform has three versions: J2ME (Java 2 Platform Micro Edition) for small devices and smart cards, J2SE for desktop systems and J2EE for enterprise-level applications. Sun launches J2EE's purpose is to overcome the shortcomings of traditional client / server mode, catering to the trend of the Browser / Server architecture, providing a platform for the application of Java technology development server-side applications to provide a platform independent, portable, multi-user, secure, and based on Standard enterprise platforms simplify the development, management and deployment of enterprise applications. J2EE is a standard, not an off-the-shelf product. Each platform developer has developed different J2EE application servers in accordance with the J2EE specification, and the J2EE application server is a deployment platform for J2EE enterprise applications. Since they all follow J2EE specifications, enterprise applications developed using J2EE technology can be deployed on various J2EE application servers. In order to promote and standardize the architecture using J2EE architecture enterprise applications, Sun also gives a suggested J2EE application design model: J2EE Blueprints. J2EE Blueprints provides architecture, design patterns, and related code for implementing J2EE enterprise applications. By applying the architecture described by J2EE BluePrints, it is possible to partially simplify the complex work of architecture enterprise-class applications. J2EE Blueprints is the basic principles of developers design and optimize J2EE components, and give guidance strategies for functional division of functions around development work to help application development and designers rationally allocate technical resources. Let's refer to J2EE BluePrints, combine the latest version of J2EE specification (J2EE 1.4), which is integrally elaborated how to use J2EE architecture enterprise applications.
Figure 2 Architecture using the J2EE architecture enterprise application
Figure 2 shows an architecture using the J2EE architecture enterprise application. J2EE will make a complete enterprise-level application to include a different container (Container), each container contains several components (these components are required to be deployed in the corresponding container), while various components can use various J2EEs. Service / API. J2EE containers include: ◆ Web container server-side containers, including two components JSP and Servlet, JSP, and Servlets are features of the web server, accept web requests, return dynamic web pages. Components in the web container can use components in the EJB container to complete complex business logic. ◆ EJB container server-side container, included components for EJB (Enterprise Javabeans), is one of the core of J2EE, mainly for commercial logic of server-side. The EJB specification defines a framework for developing and deploying distributed business logic to simplify the development of enterprise applications, making it easier to have scalability, portability, distributed transaction, multi-users, and security. ◆ Applet container client container containing components for Applets. Applet is a lightweight client embedded in the browser. In general, it is only used when using the web page that cannot fully expresses data or application interfaces. Applet is a means of replacing a web page, we can only use J2SE development applets, Applets cannot use j2ee's various service and APIs, which is for security considerations. ◆ Application Client container client container, included components for Application Client. Application Client is a more weight-level client relative to Applet, which can use the J2EE's service and APIs. Through these four containers, J2EE can flexibly implement the architecture of the enterprise application described earlier. In the View section, J2EE provides three means: JSP (or servlet), Applet, and Appvert, Applet, and Applets Client in the web container enabled browser-oriented data performance, and desktop applications. Servlets in the web container are the main means of implementing the business process control of the Controller; the EJB is primarily realized for the business logic of the Model section. As for various enterprise resources and enterprise applications, it is based on the various services and APIs of J2EE. In various services and APIs in J2EE, JDBC and JCA are used for enterprise resources (various enterprise information systems and databases, etc.), JAX-RPC, JAXR, and SAAJ are basic support for Web Services and Web Services. J2EE's various components, we will make more detailed description of the various components, services and APIs of J2EE, and see how flexible use and combinations depending on the respective needs and goals when developing different types of enterprise applications. Components and services. · ServletServlet is CGI technology on the Java platform. Servlet runs in the server side, dynamically generates a web page. Java servlets have higher efficiency and easier to use compared to traditional CGIs and many other similar CGI technologies. For servlets, repetitive requests do not cause multiple reprints of the same program, which is relying on threads to support concurrent access. · JSPJSP (Java Server Page) is a technique for achieving normal static HTML and dynamic page output mixed encoding. From this point of view, it is very similar to Microsoft ASP, PHP and other technologies. With the separation of content and appearance, the task made by the web page can be easily divided into page designers and programmers, and is convenient to synthesize through JSP.
At runtime, JSP will be first converted to servlet, and compile operation with servlet, so its efficiency and function are not different from servlet, which has high efficiency. · EJBEJB defines a set of reusable components: Enterprise Beans. Developers can use these components to establish distributed applications like wood. When assembling the assembly, all Enterprise Beans need to be configured to the EJB server (General WebLogic, WebSphere, etc. J2EE application servers are ejb servers). The EJB server manages the EJB container as a bridge of the container and the low-level platform and provides the capacity of the container to access the system service. All EJB instances run in the EJB container. The EJB container provides system-level services to control the life cycle of EJB. EJB containers have used their developers, such as security, remote connection, lifecycle management and transaction management, and simplify business logic development. Three Enterprise Beans: ◆ Session Beans ◆ Entity Beans ◆ Message-Driven Beans · JDBCJDBC (Java Database Connectivity, Java Database Connection) API is a standard SQL (Structured Query Language, Structured Query Language) Database Access Interface, It enables database developers to write database applications with standard Java APIs. The JDBC API is primarily used to connect the database and directly call the SQL command to perform various SQL statements. Using the JDBC API can perform a general SQL statement, dynamic SQL statement, and stored procedures with IN and OUT parameters. JAVA's JDBC is quite ODBC (Open Database Connectivity in the Microsoft platform. · JMSJMS (Java Message Service, Java Messaging) is a set of Java application interfaces that provide services for creation, sending, receiving, and reading messages. The JMS API defines a set of public application interfaces and corresponding syntax that enables Java applications to communicate with various message middleware, including IBM MQ-Series, Microsoft MSMQ, and pure Java SonicMQ. By using the JMS API, developers do not need to master the use of different message products, or use a unified JMS API to manipulate various message middleware. By using JMS, the portability of the message application can be maximized. JMS supports both point-to-peer messaging, and also supports publish / subscribed messaging. · JNDI Since J2EE application components are generally distributed on different machines, there is a mechanism to facilitate the component customer user to find and reference components and resources. In the J2EE system, all objects are locked using JNDI (Java Naming and Directory Interface), including EJB, database driver, JDBC data source, and message connections. JNDI API provides an application with a unified interface to complete the standard directory operation, such as the object properties to find and locate the object. Since JNDI is independent of the directory protocol, the app can also access a variety of specific directory services such as LDAP, NDS, and DNS, etc. · JTAJTA (Java Transaction API) provides a standard interface for handling transactions in J2EE, which supports the start of transactions, rollback, and submission. At the same time, on the general J2EE platform, a JTS (Java Transaction Service) is always available as a standard transaction service, and developers can use JTA to use JTS.
· JCAJCA (J2EE Connector Architecture) is part of the J2EE architecture that provides developers with a system architecture that connects a variety of enterprise information systems (EIS, including ERP, SCM, CRM, etc.). For EIS developers, they Just develop a JCA-based EIS connection adapter, developers can connect and use it in any J2EE application server. The implementation of JCA-based connecting adapters requires service components such as transaction management, safety management, and connection management in J2EE. · JMXJMX (Java Management Extensions) is JMAPI. JMX is committed to solving the problem of distributed system management. JMX is an assembly that applies programming interfaces, scalable objects, and methods that can develop seamlessly integrated-oriented, network, and service management applications across a variety of heterogeneous operating system platforms, system architecture, and network transport protocols. JMX is a complete network management application development environment. It also provides a full-specific list of manufacturers to collect, generates a resource list table, graphical user interface; access SNMP network API; host remote process call; database Access method, etc. · Jaasjaas (Java Authentication and Authorization Service) implements a framework for the Java version of the standard Pluggable Authentication Module (PAM). JaaS can be used to identify user identity, so that you can reliably and safely determine who is executing Java code. At the same time, JAAs can also implement user-based access control by authorizing users. · JACCJACC (Java Authorization Service Provider Contract for Conta) defines a connection between J2EE Application Server and a specific license server to insert various authorization authentication servers into the J2EE product. · JAX-RPC can be re-packaged by using JAX-RPC (Java API for XML-Based RPC), and it can be repaired and published in the form of Web Services. JAX-RPC provides an API that encodes and decodes RPC parameters (IN / OUT) enables developers to easily use SOAP messages to complete RPC calls. Similarly, for commercial applications using EJB (Enterprise JavaBeans), you can also use JAX-RPC to package into a web service, and this WSDL interface of this web servoce is consistent with the original EJB method. JAX-RPC packs the deployment and implementation of the Web service. For developers of Web services, SOAP / WSDL has become transparent, which facilitates accelerating the development cycle of Web services. · JAXRJAXR (Java API for XML Registries) provides an API that interacts with a variety of type registration services. JAXR Run Client Access Web ServCices compatible with Jaxr specification, where Web Services is registered. In general, the registration service is always running in the form of Web Services. JAXR supports three registration service types: Jaxr Pluggable Provider, Registry-Specific Jaxr Provider, Jaxr Bridge Provider (support UDDI Registry, and EBXML REGISTRY / Repository, etc.). · Saajsaaj (SOAP WITH ATCHEMNTS API for Java) is an enhancement of JAX-RPC, providing support for low-level SOAP messaging. Enterprise application example
Below we implement the application of various components and services by assuming the J2EE implementation of an enterprise application. Suppose the application object is a sales system of the manufacturer / retailer of the computer product. This sales system can publish product information through its own website, and can also transfer the product catalog to the computer product trading market. The sales system can accept orders online (from your own web site or from computer product trading market), and then transfer to the internal enterprise management system for relevant subsequent processing. Referring to Figure 3, this enterprise application can be architectural in this way. The core of the company's application is the two business logic of product catalog management and product order management, and is implemented using EJB and is deployed in the EJB container. Since the product catalog and order information require persistence, use the JDBC to connect the database and use JTA to complete the data inventory. Figure 3 J2EE Application example
Then use the JSP / Servlet to implement the application's Web performance: Online Product Catalog Browse and Ordered online. In order to send the product catalog to a specific trading market, use JMS to achieve asynchronous-based product catalog transmission. In order to make more other external trading markets can integrate product catalogs and ordering services, it is necessary to use the implementation of Web Services technology packaging business logic. Since product order management needs to be handled by company internal employees, you need to integrate user systems and access control services within the company to facilitate employees, using JACC integration internal access control services, use JNDI integration inside users directory, and use Jaas Access control. Since the product ordering transaction triggers the relevant operations of the subsequent enterprise ERP system (including warehousing, finance, production, etc.), JCA connection is required to connect to the company ERP. Finally, in order to incorporate this application into the system management system of the enterprise, use the Application Client to architecture a management client (deployed on one machine with other enterprise application management applications) and manage this enterprise application through JMX.