Java various system architecture diagrams and their introduction __java

Source: Internet
Author: User
Tags aop error handling exception handling

various system architecture diagrams and their introduction

Reprint please retain the source, the life of a drunken summary.

The following text and architectural diagrams are used in my system design and architecture.

Original source: http://space.itpub.net/6517/viewspace-609654

1.Spring Frame composition

Spring is an open source framework that is created to address the complexity of enterprise application development. One of the main advantages of the framework is its tiered architecture, which allows you to choose which components to use, while providing an integrated framework for Java EE application development. The spring framework features can be used in any Java EE server, and most of the functionality also applies to an environment that is not managed . The central point of spring is to support reusable business and data access objects that are not bound to a specific Java EE service. Such objects can be reused in different Java EE environments (Web or EJB), stand-alone applications, and test environments.

Each module (or component) that makes up the spring framework can exist either independently or jointly with one or more other modules. The functionality of each module is as follows: Core container: The core container provides the basic functionality of the spring framework. The main component of the core container is Beanfactory, which is the implementation of the factory pattern. Beanfactory uses control reversal (IOC) mode to separate the application's configuration and dependency specification from the actual application code . Spring Context: The spring context is a configuration file that provides contextual information to the spring framework. The spring context includes enterprise services such as Jndi, EJB, e-mail, internationalization, checksums, and scheduling capabilities. Spring AOP: Through configuration management features, the Spring AOP module integrates aspect-oriented programming capabilities directly into the spring framework. Therefore, it is easy to make any object managed by the spring Framework support AOP. The spring AOP module provides transaction management services for objects in a spring-based application. By using spring AOP, you can integrate declarative transaction management into your application without relying on EJB components. The Spring dao:jdbc DAO Abstraction Layer provides a meaningful exception hierarchy that can be used to manage exception handling and error messages thrown by different database vendors. The exception hierarchy simplifies error handling and greatly reduces the number of exception codes that need to be written (for example, opening and closing connections). The Spring DAO's JDBC-oriented exception conforms to the common DAO exception hierarchy. The Spring orm:spring Framework inserts several ORM frameworks, providing an ORM object-relational tool that includes JDO, Hibernate, and Ibatis SQL maps. All of these conform to spring's common transaction and DAO exception hierarchy.

2.ibatis Frame composition

Ibatis is a Java -based persistence layer framework. The persistence layer framework provided by Ibatis includes SQL maps and Data Access Objects (DAO), along with a Jpetstore instance developed using this framework.


Ogx%e@mx0

IBATIS: The biggest advantage is that it can effectively control the number of SQL sent, improve the execution efficiency of the data layer. It requires programmers to write their own SQL statements, unlike Hibernate, which is completely object-oriented, automated, Ibatis is semi-automatic, through the mapping of tables and objects and hand-written SQL statements, can achieve higher query efficiency than hibernate.

Ibatis just encapsulates the data access layer, and we do a partial mapping of the object relationship. But the price is that you have to write an XML configuration file and write a lot of SQL relative to hibernate. Hibernate generates entity classes and basic configuration files directly from the database schema through tools, and most of the cases do not require us to write SQL, which greatly improves development efficiency. But these also have a lot of limitations, especially to the environment of higher requirements (database design, object design, team collaboration, etc.). A personal sense of ibatis to a project is that it is small, flexible, extensible, encapsulates the data access layer (transaction, cache, exception, log), and provides DAO framework support.

With Ibatis we can separate the code from the SQL, as long as the SQL can solve the problem, Ibatis can help us easier to solve, but also make our project on a framework of small dependencies (because the Ibatis is non-intrusive). This will greatly reduce the risk of the project, reduce the time to solve complex problems, and make the maintenance of the project easier.

Ibatis changes to the application, debugging, expansion and maintenance will become easy and natural. When modified, we primarily modify the entity objects that represent the model, the SQL in the XML configuration file, and/or the resultmap of the configuration file (which is often not needed). At the same time, SQL and code separation, we do not have to stringbuffer the code of the append to find the need to modify the SQL. SQL in the configuration file facilitates our debugging and SQL review as well as future SQL reuse.

3.structs1 Frame composition

Struts is an open source project in the Apache Foundation's Jakarta Project, which employs the MVC pattern to help Java developers develop Web applications using EE. Like other Java architectures, struts is also object-oriented, with the ability to "separate the display logic and the business logic" of the MVC pattern to its fullest. The core of the structs framework is a resilient control layer based on standard technologies such as Java servlets,javabeans,resourcebundles and XML, as well as some class libraries of Jakarta Commons. Struts consists of a set of mutually collaborative classes (components), Serlvet, and JSP tag lib. The Web application based on struts architecture conforms to the design standard of JSP Model2, which can be said to be a kind of change of traditional MVC design pattern.

Struts has its own controller (Controller), while consolidating other technologies to implement the model and view layers. At the model level, struts can be easily combined with data access technologies such as JDBC/EJB, and other third-party libraries such as hibernate/ibatis, or Object Relational Bridge. In the view layer, struts can work with JSPs, including Jstl and JSF, as well as velocity templates, XSLT, and other presentation layer technologies.

Struts supports every professional Web application and helps create an extended development environment for your application.

client Browser (Customer browser)

Each HTTP request from the client browser creates an event. The Web container responds with an HTTP response.

controller (Controller)

The controller receives the request from the browser and decides where to send the request. In the case of struts, the controller is a command design pattern implemented in a servlet. Struts-config.xml file Configuration controller.

 Business logic

The business logic updates the state of the model and helps control the flow of the application. In the case of struts, this is done by the action class as the "thin" wrapper for the actual business logic.

The state of the model (model)

The model represents the state of the application. The business object updates the state of the application. Actionform. The bean represents the state of the model at the session level or at the request level, not at the persistence level. JSP files are read from Actionform using JSP tags. The information for the bean.

view (view)

A view is a JSP file. There is no process logic, no business logic, no model information-only tags. Marking is one of the factors that make struts different from other frameworks, such as velocity

4.structs2 Frame composition

Struts 2, in contrast to struts 1.X, separates the user business logic (Action) from the Servlet API, which uses interceptors or interceptor stacks (interceptor chains). Interceptors are one of the core elements of struts 2.

Struts 2 built multiple interceptors and interceptor stacks (interceptor chains formed by multiple interceptors) to intercept user Web requests, providing richer functionality such as data type conversions, internationalization, file uploads, and more.

5.Hibernate Frame composition

Hibernate is an open source Object Relational mapping framework that has a very lightweight object encapsulation for JDBC, making it possible for Java programmers to manipulate the database with arbitrary object programming thinking. Hibernate can be applied in any use of JDBC, either in Java client programs or in servlet/jsp Web applications, and, most of all, hibernate can replace CMP in an EJB-ee architecture, Complete the task of data persistence.

There are 5 core interfaces of Hibernate, namely session, Sessionfactory, Transaction, query and configuration. These 5 core interfaces will be used in any development. Through these interfaces, not only can the persisted object be accessed, but also the transaction can be controlled. The following five core interfaces are described separately.

· Session Interface: The session interface is responsible for performing crud operations on the persisted object (the CRUD task is to communicate with the database, including many common SQL statements.) )。 However, it should be noted that the session object is not thread safe. At the same time, Hibernate's session is different from the HttpSession in JSP application. Here when using the term session, in fact, refers to the hibernate in the sessions, and later will be the Httpsesion object called the user.

· Sessionfactory interface: Sessionfactory interface is responsible for initialization of hibernate. It acts as a proxy for the data storage source and is responsible for creating the Session object. The factory model is used here. Note that sessionfactory is not lightweight, because typically a project requires only one sessionfactory, and you can specify a sessionfactory for each database when you need to manipulate multiple databases.

· Configuration interface: The configuration interface is responsible for configuring and starting Hibernate, creating Sessionfactory objects. During hibernate startup, instances of the configuration class first locate the mapping document location, read the configuration, and then create the Sessionfactory object.

· Transaction interface: The transaction interface is responsible for transaction-related operations. It is optional, and developers can also design their own underlying transaction processing code.

· Query and the criteria interface: query and the criteria interface are responsible for performing various database queries. It can be expressed using either the HQL language or the SQL statement.

6.J2EE Frame composition

Java EE is a completely different from the traditional application development of the technical framework, including many components, mainly simplifies and standardize the application system development and deployment, and thus improve portability, security and reuse value.

Java EE Core is a set of technical specifications and guidelines, including all kinds of components, service architecture and technical level, have common standards and specifications, so that all kinds of different platforms following the Java EE architecture, there is good compatibility, to solve the past enterprise back-end use of information products are incompatible with each other, The dilemma that leads to the difficulty of interoperability within or outside the enterprise.

7.Oracle Frame composition

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.