Reprinted from: http://www.java-cn.com/technology/technology_detail.jsp? Id = 781
Total one, the Server component structure EJB is a component structure of a Server party that develops Java-based enterprise-based distributed object applications. Using EJB can develop easy-to-upgrade, reliable, secure applications, without independently develop complex distributed object frameworks; EJB can quickly develop service-based applications, quickly establish Java-based service-based components. EJB is designed to realize the portable and reusability of enterprise middleware services. If you are very strange to business, these concepts are useful to you, EJB is a very complex topic, which should be fully explained. In this chapter we discuss the main concept of EJB. First of all, let's discuss development enterprise software for dry? Why is it like the pre-packaged distributed object system of EJB to simplify your life? In the discussion, you will have a macro understanding of the components structure of the server. The server component structure requires us to understand what developers usually need when developers build and configure the components in the server environment? At the same time, we will solve the problems that have emerged around the development of the server will see the need to establish a set of EJB standard architecture. Software components ?? A software component is a code that is used to implement a range of definition interfaces. Components are not a complete application ?? They cannot be run independently. More appropriate, they are considered to be a small problem divided by many large problems. The idea of software components is very useful. Companies can buy a module that can be used to solve a problem, compile it with other components to solve large problems. Component structure ?? In order to make the component development process easier, you need to establish a specification for establishing, management, and maintaining components. Developing components development tools When establishing components, developers should be allowed to concentrate on developing core logic behind components, so that developers do not need to consider too many standard details, so that the application is quickly developed. For example, Ide: Symantec Visual Cafe, IBM's Visualage for Java, Inprise's JBuilder 2, which helps you quickly create and debug components. Managing configured component containers ?? Component container provides a runtime environment for your component. It also provides a universal service for most components. Configuring and maintaining the component tool ?? After purchasing components from the component provider, you also need a set of tools to help configure and maintain these components. Java: Perfect implementation component structure For a component that solves business issues, whether it is a component developer or a component of the component, you must comply with the syntax and semantics of the calling component method. Developers publishing the specifications for calling components, customer code must follow them. In order to prevent developers from providing a new version of component, or change the component specification, the client must rewrite or compile their code, so object-oriented design proposes a new design method: through the implementation from the component Separate the interface. The component interface component logic becomes more efficient in order to separate the interface / implementation, the developer must write customer code for the component interface (this is called an interface-based programming), and the server logic can be changed by this separation. Do not change the customer code. The component structure in Java is now let us know what is the component structure and see those component structures in the Java world. First, you should understand what JavaBeans, JavaBeans Components are small application blocks, you can use JavaBean to set into large components to compile full applications. However, you can't configure a Javabean because a JavaBean is not a full application. JavaBean can help you build a larger configurable software. Because there is no need to configure, JavaBean does not need runtime environments, nor does it require a container to instantiate, destroy, and provide other services. The application itself is composed of many JavaBeans.
Compared, the EJB standard defines a component structure to configure components, known as enterprise-class Beans. Enterprise-level Beans is a relatively large, rough application component. They can be destroyed and can also be used to combine more components into larger application systems. Configurable components are configured in the container that the container provides the runtime service for the component. For example, instantiate. Enterprise Beans and two other Java components are very similar: Applets and servlets. Applets can be configured in a web page, and the browser's AppletViewer provides a container that is running. Servlets can be configured in Web Server, the WebServer Servlet Engine is a container that provides runtime. Enterprise Beans can be configured in the application server, and the application server provides a running container. The truly difference between the three is a small domain that can extend each component type. Applets is a lightweight java program that can be downloaded and running. For example, it can download it from the web server to your browser. Servlets is a network component that can be used to extend the Web Server feature. It is a request / answer, from many clients to request a request, and give them a question. This makes it widely used to perform web tasks. Applets and servlets are suitable for client-side operations. The enterprise-level bean does not extend the client operation, it is a server component, performs a server operation; for example, performing complex operations, performing a large number of commercial transmission. A complete component structure required for the server follows the following way: Developers write reusable components to provide business-writer component containers: to provide runtime environment and service providers to provide development, configuration, and maintenance tools. These methods ensure reusability. Multi-layer structural server configuration is software used to support users simultaneously, safe, reliable, and efficient operations. Services are generally divided into multiple layers. Different functions are achieved for each layer, each layer has one or more components. Note: The layer is an abstract concept, which does not physical it. There is a layered example below: a representative layer: These container components handle user interfaces and user interactions. For example, a representative layer is a separate application that can be written in VB. A web configuration-based representative layer can use Java Servlets, Java Server Pages, or Java Applets. Business Logic Layer: It is a collection of container components used to solve business problems. These components are often used to process high-performance work, and they are used to write, for example: Java, C. Data layers: The business logic layer is used to hold the persistence of the status. The center of the data layer is one or more databases. The advantage of the layering is to try to isolate the layers. Two-layer structure is usually, most configurations are two-layer structure. A merger of the business logic layer and the other two layers: may be merged with the representative layer. It may be combined with the data layer. In terms of layers and business logic layers, such as the layer of the representative layer and the business logic layer as the client, the data layer is used as the server, and the situation of the Thin server is formed. In the two-layer structure, the client application is connected to the data layer through the Database Bridge API. For example: ODBC, JDBC. Such two layers have the following features: The consumer is very high. The database driver must be installed and configured on each customer layer. The database driver exchange is high. Transfer a database driver, you need to reinstall the client driver at each client. The database type transition cost is high. High cost logic transplantation. The database connection is high. Network performance is low. Parting the business logic layer is partially incorporated into the data layer to form the client Thin, and the server FAT is in the case. The N layer structure will represent the layer, the business logic layer, and the data layer are each layer. Features: Low configuration cost. The database exchange cost is low. Low business logic transplantation. You can configure the security part with the firewall. Resources can be reused.