Today, more and more programming staff want to develop distributed transaction applications for their enterprises with the speed, safety and reliability of the server. If you have worked in this area, you will be very clear that in today's e-commerce and information technology rapid development, and full of demand, enterprise applications must be more funds, faster and more than ever. Less resources to design, build and operate.
In order to reduce costs, quickly realize the design and development of enterprise applications, J2EE platform technology provides a component-based implementation approach to enterprise applications. The J2EE platform provides you with a multi-level distribution is the ability to apply design patterns, reuse components, unified security mode, flexible transaction control. Not only can you sell new customer solutions, but also to the market, and platform independence, J2EE component-based solutions will make your product not bound to any manufacturer's products and APIs.
This article describes the J2EE 1.3 platform and simultaneously as an overview of the J2EE tutorial. The J2EE tutorial uses an example-based approach to describe the characteristics and functions of the J2EE SDK version 1.3. Whether you are a newcomer or an experienced enterprise application developer, you will find an example of a text in the J2EE tutorial. When you create your own company's solution, it is valuable, and you can know the library.
If you have just started to exposure to J2EE application development, this introduction is a good starting point. Here you will learn J2EE architecture, start familiar with important terms and concepts, find how to start J2EE application programming, integration, and deployment.
Distributed multi-level application
The J2EE platform uses a multi-level distributed application mode. This means that the application logic is divided into components based on the function, which makes up the different application components of the J2EE app installed on different servers, which is determined based on which level of the application component belongs to the multi-level J2EE environment. Figure 1 shows the two multi-level J2EE applications divided into different levels described in the table below. The J2EE application portion shown in Figure 1 represents the J2EE application component.
• Customer layer components running on the client machine
• WEB layer components running on the J2EE server
• Business layer components running on the J2EE server
• Enterprise information system layer software running on the EIS server
As shown in Figure 1, the J2EE application can consist of three or four hierarchies, J2EE multi-level applications are generally considered to be three-layer applications because they are distributed in three different locations: client machine, J2EE server, and databases or The traditional system server of the backend. The three-layer architecture application is an extension of the standard client / server application architecture, that is, adding a multi-thread application server between client applications and background storage.
Figure 1: Multi-layer application
J2EE Application Components
J2EE applications are composed of components. The J2EE component is a self-encapsulated function software unit that will be integrated into J2EE applications through the associated class, file, and communication with other components. The J2EE specification defines the following J2EE components:
• Application Client and Applets are client components
• Java Servlet and Java Server Pages Technical Components are web components
• Enterprise JavaBeans (EJB) Components are business components
J2EE components are written in Java programming languages and are also compiled as any Java programming language program. The use of the J2EE platform is that the J2EE component is integrated into J2EE applications, which is well formatted and verified by J2EE specification compatibility, and is running on J2EE servers when deploying and formal running And is running under the management of the J2EE server.
Client component
A J2EE application allows web-based or not web-based. For web-based J2EE applications, an application client software will run on the client machine, and for web-based J2EE applications, the browser downloads the web page and a small program (Applet) to the client machine. Application client
The application client software running on the client machine provides a way for users to process like J2EE systems or applications. It usually consists of a graphical user interface developed with Swing or AWT API, but you can also use the command line interface.
Application client software directly access the business bean running on the business layer. Of course, if the J2EE application client allows, an application client can also establish an HTTP connection, communicating with a servlet running on the web layer.
Web browser
The user-end web browser downloads static or dynamic web pages such as HTML / WML / XML from the Web layer. The dynamic page is generated by the servlet or JSP page running on the Web layer.
Applet
A web page downloaded from the web layer can contain embedded Applets. A applet is a small client application written in a Java programming language, executed by a Java virtual machine installed on a web browser. However, Applets are successfully running on a web browser, and the client system also requires Java Plug-in and security policy files.
The JSP page is recommended to create an API based on web-based client program because no plugins and security policy files are required on the client. Moreover, JSP pages support clear, multi-module application design, as it provides a way to separate application programming and web page design. This means that the work to be done by participating in the Web page design, does not need to understand the syntax of the Java programming language.
Operating an applet based on a network-based system, such as handheld devices, cars, etc., can perform the WML page generated by the JSP page or servlet running on the J2EE server. The WML page is transmitted through the Wireless Application Protocol (WAP). The network configuration requires a gateway, converting the WAP into HTTP, and then back. The gateway converts the WAP request from the handheld device into the HTTP request of the J2EE server, and then converts the HTTP server response and WML pages into a WAP server response and the WML page is displayed on the handheld device.
JavaBeans component architecture
The client layer is also used by a Javabeans component architecture that manages the data stream between the application client or Applet and the components running on the J2EE server. JavaBeans components are not components in the J2EE specification.
JavaBeans components written for J2EE platforms, including instance variables, and read and setup methods for accessing instance variables. The JavaBeans component used in this way is generally designed and implemented, but it is necessary to follow the naming and design specifications in the Javabeans component architecture.
J2EE server communication
Figure 2 shows the different components of the formation of the client layer. The communication between the client and the business layer running on the J2EE server can be dutied directly, or when the browser is running, it is done by the JSP page or servlet running on the Web layer.
Figure 2: Server Communication
Thin client
J2EE App uses thin clients. A thin client is a light load interface connected to the application, which does not process the query database, performs load business logic, or domain traditional system connection. This weight is transferred to the web or enterprise beans running on the J2EE server, so that the security, fast, service, and reliability of the J2EE server-side technology can be used.
Web component
J2EE's Web component can be a JSP page or a servlet. Servlet is a class of Java programming languages that can dynamically process requests and generate responses. The JSP page is a text-based file that contains static content and the Java programming language code for the small segment to generate dynamic content. When the JSP page is called, the background servlet executes this short code and returns the result. Static HTML pages and applets are bundled with web components when appging is integrated. However, it is not previously handled by the J2EE specification. The server-side application class can also be bundled with the web component, like HTML, and is not as a web component.
As shown in Figure 3, like the client layer, the web layer has a Javabeans object management user input and sends the input to the enterprise bean processing running in the business layer.
Figure 3: Web layer and J2EE application
Business component
Business code, logic for solving problems in specific business sectors, such as banking, retail or finance, etc., is handled by business layers, from enterprise beans. Figure 4 shows how a business beans receive data of the client program, handling it (if needed), and send it to the enterprise information system layer for storage. Enterprise beans also receive stored data, handle it (if needed), sent back to the client program.
Enterprise Beans has three categories: session beans, entity beans (entity beans) and messaging beans. A session bean represents a temporary session with the customer. This session bean disappeared when the client ended. Instead, the entity bean represents data that is permanently stored in the table of the database. If the customer ends the operation or server shutdown, the background operation guarantees the data store of entity Beans.
A message-driven bean combines the function of the Session Bean and Java Message Service (JMS) message listener, allowing business components to receive JMS messages in asynchronously. Here is an entity Beans and Session Beans. Want to know more about the message driver Beans, participate in the Java Message Service tutorial.
Figure 4: Business and Enterprise Information System (EIS)
Enterprise information system layer
Enterprise information system layer handling enterprise information system software, including enterprise architecture systems such as enterprise resource planning (ERP), large machine transaction processing, database system, and traditional information systems. J2EE Applications require access to enterprise information systems, such as establishing database connections, and more.
J2EE architecture
Typically, thin client multi-level applications are difficult to write because it includes a lot of codes that are very difficult to understand to handle transaction and state management, multi-thread, resource pool management, and other complex low-level detail issues. Component-based, development of J2EE applications that are unrelated to the platform is easy because business logic is organized into reusable components, and the J2EE server provides background support for each type of components in the form of a container. Since you don't have to develop these services yourself, you can focus on solving your business problems.
Container and service
The components are installed in the container during deployment, which is the interface between the component and the underlying function of the specific platform supports components. Before web, enterprise beans, or application client components can be executed, it must be assembled into J2EE applications and is deployed into it.
The assembly process includes setting each component in the J2EE application and the J2EE application itself in the container. The set of containers personalized the J2EE server for background support for each component, including information security, transaction management, Java naming, and directory interface queries, and remote connections, and more. Here is some of the focus: • J2EE security mode allows you to configure web components or enterprise beans to enable system resources to access user access.
• J2EE Trading Mode allows you to specify the relationship between the method, which makes up a transaction, so that all methods in this transaction will be treated as a unit.
• JNDI query service provides a unified interface for multiple naming and directory services in the enterprise, so that the application component can access naming and directory service.
• J2EE Remote Connection Mode, the underlying communication between the management client and the enterprise beans. After the enterprise bean is created, the client calls its method, just like it is on the same virtual machine.
In fact, the J2EE architecture provides configurable services, meaning that the application components in the same J2EE application can be different depending on their deployment, performance is different. A enterprise bean can pass different security settings, which is a hierarchical database data access in a production system, and in another production system, another database access is obtained.
The container also manages non-configurable services, such as the lifecycle of the enterprise bean and servlets, database connection resource pools, data persisters, and access J2EE platforms described in the J2EE API. Although the data persistence mechanism is an unconfigurable service, the J2EE architecture allows you to overwrite the original container management in your enterprise bean implementation when more controlling the persistent mechanism of contrary to the default container management. Continuous mechanism. For example, you can use the sustainability mechanism for Bean to implement your own search method, or create a personalized database cache.
Container type
Among the deployment procedures, the J2EE application component is installed in the J2EE container in the following types. The J2EE components and containers involved herein are reflected in Figure 5.
Enterprise JavaBeans (EJB) container, manages all enterprise beans for J2EE applications. Enterprise beans and their containers are running on the J2EE server.
Web containers manage all JSP pages and servlet components for J2EE applications. The web components and their containers are running on the J2EE server.
Apply client containers to manage all application client components for J2EE applications. Applying client components and their containers run on the client machine.
Applet containers, is a combination of web browsers and Java plugins, running on the client machine.
Figure 5: J2EE server and container
package
The J2EE component is individually packaged, bundled in J2EE applications for deployment. Each component, its related files such as GIF and HTML files, or server-side application classes, and deployment descriptions, are integrated into a module and added to J2EE applications. J2EE applications are composed of one or more enterprise beans, web, or application client component modules. The final enterprise solution can be used in two or more J2EE applications by using a J2EE app or according to design needs.
A J2EE app and each module it has its own deployment description. The deployment description is an XML text file with a .xml suffix, deployment settings for the component. Deployment description of an enterprise bean, for example, declares transaction properties, and security certification of enterprise beans. Since the information described in the deployment can be declared so that it can be modified without modifying the source code of the BEAN. At runtime, the J2EE server reads the deployment description and manipulates the components in turn.
J2EE Application and related modules are sent in an Enterprise Archive (EAR). The EAR file is a standard JAR file, ending with .ear suffix. In the GUI version of J2EE SDK Applement Tools, you create an EAR file, add JAR and WAR to EAR. If you use the command line package tool, create a JAR and WAR file first, then create an EAR file. J2EE SDK Tools: • Each EJB JAR file contains its deployment description, related files and enterprise beans .class files
• Each application client JAR contains its deployment description, related files, and application client .class files
• Each WAR file contains its deployment description, related files and servlets .class files, and JSP pages. JSP files
Use modules and EAR files to make multiple different J2EE applications using some of the same components. No additional programming is required, just assembled different J2EE modules into the J2EE EAR file.
Development role
The reusable module makes it possible to divide the application development and deployment procedures into a distinct role. Such different people or companies can implement different parts throughout the process.
The first two characters include purchasing and installing J2EE products and tools. When the software is purchased and installed, the J2EE component can be developed by the application component provider, which is assembled by the application assembler and deployed by the application deployment. In a large mechanism, each role is done by different individuals or groups. This labor force is feasible because each previous role outputs a portable file, which can be used as an input of subsequent roles. For example, in the application component development phase, a business bean software developer submits the EJB JAR file. In the application assembly role, another developer combines these EJB JAR files with J2EE applications and stores in an EAR file. In the application deployment role, the system administrator uses the EAR file to install the J2EE server in the customer site.
Different characters are not always performed by different people. If you work for a small company, or you can build a test application, you may have to perform every stage.
J2EE product supplier
J2EE Products suppliers are companies designed and fabricated to other features defined by J2EE platforms, API, and J2EE specifications that can be sold. Product suppliers are generally operating system, database systems, application servers, or web server vendors, and they implement J2EE platforms based on J2EE specifications.
Tool supplier
Tools suppliers are individuals or companies that provide development, assembly and packaging tools such as component developers, assembers, deployers, etc. See the J2EE SDK 1.3 compatible tool provided by tool information.
Application component supplier
Application component vendor is a company or individual, they produce web components, enterprise beans, applets, or application clients, which can be used for J2EE applications.
Enterprise bean production
Software developers do the following to provide EJB JAR files that contain enterprise beans:
• Write and compile source code
• Custom deployment description
• Bundle .class files and deployment descriptions to an EJB JAR file
Web component production
Web Developer (JSP Page) or Software Developer (Servlet) completes the following work to provide a WAR file containing web components.
• Write and compile the servlet source code
• Write JSP and HTML files
• Customized deployment description for Web Components
• Bundle .class, .jsp, .html and deployment description file to the WAR file
J2EE application client production
Software developers have done the following work to provide JAR files that contain J2EE application clients.
• Write and compile source code
• Tailor deployment description for the client
• Bundle .class files and deployment description files to JAR files
Application assembly
Application Assemblers is some companies or individuals, they get the JAR file of the application component from the component vendor, and assemble the EAR files for J2EE applications. Assembliers and deployers can directly edit the deployment description or use tools, and increase the XML tag correctly based on the choice of interaction. Software developers do the following to provide an EAR file that contains J2EE applications. • Assemble the WEB component (WAR) file developed in EJB JAR and the previous phase, generate a new J2EE application (EAR) file.
• Custom deployment description for J2EE application
• Check if the content of the EAR file is well formatted and complies with the J2EE specification
Application deployment and administrator
Deployers and administrators are companies or individuals, they configure and deploy J2EE applications, manage the Calculation and network architecture of J2EE run, and monitor the running environment. Responsibility includes setting transaction control, security properties, and settings with databases.
During the configuration process, deployers follow the guidelines provided by the application component vendor to solve external dependencies, set the security frame, and set the transaction properties. During installation, deployers transfer the application component to the server and generate the dedicated class and interface.
Deployers / System Administrators complete the following work, installed and configure J2EE applications.
• Increase the J2EE application (EAR) file made in the previous phase to the J2EE server
• Configure J2EE applications for runtime, namely the deployment description of the J2EE application
• Check if the content of the EAR file is well formatted and complies with the J2EE specification
• Deploy (installation) J2EE application's EAR file to J2EE server
Reference implementation software
J2EE SDK is an implementation of J2EE platforms and normative non-commercial uses provided by Sun, suitable for demonstration, original formation and teaching environment. It includes a J2EE application server, web server, relational database, J2EE API, etc., is a complete development deployment tool. You can download J2EE SDK online.
• The product developer uses J2EE SDK to determine those implementations that must be implemented under a set of given applications, and run J2EE compatibility test packets to detect if their product test packs are fully compliant with J2EE specifications.
• Application Components Developers running their J2EE apps on J2EE SDK to verify that these applications apply to all J2EE products and tools.
Web server
The web server provides one or more Web containers. For example, a web container generally depends on the web server to provide HTTP message management. J2EE implementation is not to support a particular web server, which means that different J2EE products have been changed by the support of the web server.
Database access
Relationship database provides a lasting storage for application data. J2EE implementation is not to support a particular type of database, which means that different J2EE products have changed for databases. See the release description in the J2EE SDK download file, which provides a reference to the currently supported database list.
J2EE API
Java 2 Platform Standard Edition (J2SE) SDK is required when running J2EE SDK, which provides a core API, core development tool, and Java virtual machine for writing J2EE components. J2EE SDK provides the following API for J2EE applications.
Enterprise JavaBeans Technology 2.0
A enterprise bean is a block containing a domain and method for implementing a module for business logic. You can think that enterprise beans are a build module that can be used alone or with other businesses Beans to perform business logic on the J2EE server.
Three types of enterprise beans, and messaging beans, which are described in the business component. With entity beans, you don't need to write any SQL code or use the JDBC API to perform database access operations directly. The EJB container is handled for you. Of course, if you have any reason for any reason, you will need to use the JDBC API. Similarly, if you choose Session Beans to access the database, you must use the JDBC API. JDBC 2.0 API
JDBC API is that you can call the SQL command from the Java programming language. You are overlying the provision of container management persistent mechanisms, or selection Session Beans to access the database, you must use the JDBC API in the Enterprise Bean. With the persistent mechanism of the container management, the database access operation is handled by the container, and the JDBC code or SQL command is not included in your business bean implementation. You can also use the JDBC API to access the database directly from the Servlet or JSP page without passing the enterprise bean.
The JDBC API is from two parts: an application driver interface for application components to access the database; one is a service providing interface that belongs to the J2EE platform.
Java servlet technology 2.3
Java servlet technology defines the HTTP-specific servlet class. A servlet class extends the server's ability, and the server is stored, and the application is accessed in request - response programming mode. Although servlets can respond to any form of requests, it is usually used to extend the application of WEB server storage.
JavaServer Pages (JSP) Technology 1.2
The JSP page technology is that you can combine the Java programming language code and static content in the text based on the text-based file. A JSP page is a text-based file that contains two types of text: static template data, which can be expressed as any text-based format, such as HTML, WML, and XML; JSP elements, determine how this page constructs dynamic content.
Java Messaging Service 1.0
JMS API is a message standard that allows J2EE application components to create, send, accept, and read messages. It is loosely coupled, reliable, asynchronously distributed communication. For more information on JMS, see the Java Message Service Tutorial.
Java Transaction API (JTA) 1.0
The JTA API provides a standard segmentation interface for segmentation transactions. The J2EE architecture provides a default automatic confirmation to handle the confirmation and rollback of the transaction. An automatic confirmation means that any other query data is applied, after the read and write operation of each database, will see the latest data. However, if your application performs two independent interdependent database access, you will want to use the JTA API to divide, so that the entire transaction contains start, rollback, and confirmation.
JavaMail technology 1.2
Many Internet applications need to send emails to confirm, so the J2EE platform contains the JavaMail API used in conjunction with the JavaMail service provider, so that the application component can use it to send mail. The JavaMail API contains two parts: one is an application layer interface, and the application component uses it to send an email; a service provider interface.
JavaBean Activation Framework 1.0
The JavaBeans activation frame is included because JavaMail is to use it. It provides standard services to determine the type of dedicated data, to compress it, discover the operations it can use, and create the corresponding JavaBean components to perform those operations.
Java API for XML (JAXP) 1.1
XML is a language that represents and describes text-based data so that data can be read and processed using the XML API program or tool. Programs and tools can generate an XML file, and other programs and tools can read and process. For example, a J2EE application uses XML production reports, and different companies receive this report, which can be handled by the most in line with what they need. A company may convert XML data to an HTML format via the program so that it can put the report on the web, another company may use XML data to generate a market speech through the tool, and another company may read XML data to J2EE application Treatment is performed.
J2EE Connector API 1.0
Connector API is used by J2EE tool vendors and system integrators to create a resource adapter, enabling enterprise information systems to embed some J2EE products. A resource adapter is a software component that allows J2EE application components to access and interact with the background resource manager. Because the resource adapter is a dedicated to his resource manager, each type of database or information system has its different resource adapters.
Java Authorization & Certified Service (JAAS) 1.0
Java Authorization and Authentication Service (JAAS) provide a way to enable J2EE applications to authorize and authenticate a user or a user group using it. JaaS is a Java programming language version of the Standard Embedded Authentication Module (PAM) frame, allowing the Java 2 platform security architecture to support user-based authorization.
tool
J2EE Reference Implementation provides an application deployment tool and a set of scripts for assembly, verification, and deploying J2EE applications and manages your development and production environment. See the J2EE tutorial to fully understand these tools.
Application deployment tool
J2EE Reference Implementation provides an application deployment tool for assembly, verification, and deployment J2EE applications. It is made from two versions: command lines and GUI.
The GUI tool contains Wizards for:
• Packaging, configuring and deploying J2EE applications
• Pack, configure enterprise beans
• Pack, configure web components
• Pack, configure application client
• Package, configure resource midsturs
Additionally, configuration information can be set for each component and module type in the table -ified inspection box.
script
Table 1 lists the scripts included in the J2EE reference implementation, and you can perform these operations in the command line.
Script Description J2EE Start and Start J2EE Server Cloudscape Start and Stop the Default Database Cloudij Run Interactive SQL Tool, this is an unsupported tool J2EEADMIN to add JDBC drivers, JMS targets, and connecting factories, KEYTOOL. Open and private The key that generates the certificate RealTool enters the certificate file in the X509's own signature. To the J2EE application, add, delete the J2EE user packager package J2EE application component to EAR, EJB JAR, Application Client JAR and WAR files. Verifier verifies that EAR, EJB JAR, application client JAR and WAR files are well formatted, and whether to follow J2EE Specifications RunClient Run J2EE Applications Cleanup Clear all deployments from J2EE servers
in conclusion
The J2EE platform provides you with all the content you need to design, build, test, deploy distributed multi-level applications. The J2EE tutorial has a deep introduction to platform characteristics, API and tools. If you need J2EE application design, J2EE BluePrints Digest provides high-level description to develop multi-level, thin customer applications on J2EE platforms.
Application programming mode consists of technical subjects and principles, guidance J2EE application developers determine the most reasonable implementation selection, the most efficient use of JSP and Servlets, selecting a good design when implementing business logic, effectively maping J2EE security models to enterprise calculations Environment and architecture.