代码改变世界

J2EE Investigation (2)

2011-02-25 15:16  Aga.J  阅读(328)  评论(0编辑  收藏  举报

  The most common thing you may encounter is that in your client application you need to write intricate code to handle transaction and state management , multithreading, resource pooling, and other complex low-level details. We always do this , don’t we? Smart coder may try to organize his code structure to be more neat and more reusable. That’s the purpose of the J2EE architecture . As we talk about J2EE above, we know that J2EE is component-based and platform-independent. These nice feature help us to focus ourselves in our business problem to satisfy our client.

   How to J2EE do this? The J2EE organizes something into reusable components. Most importantly, J2EE server provide underlying services in the form of a container for every component type. Please remember the word “container”. It’s a important concept in J2EE.

   What is containers? Containers are the interface between a component and the low-level platform specific functionality that supports the component. Every component must be assembled into a J2EE application and deployed into its CONTAINER before it can be executed. It means that we have a manage layer, called container. It help us to do something for the component.

For example, J2EE security model lets us configure a Web component or Enterprise bean so that system resources are accessed only by authorized users. The j2EE transaction model lets us specify relationships among methods that make up a single transaction so that all methods in one transaction are treated as a single unit. The J2EE remote connectivity model manages low-level communications between clients and enterprise beans. It’s easy to find the value of the feature described above. That is application components within the same J2EE application can behave differently based on where they are deployed. Oh! So convenient it is. For companies whose business process change all the time , they can easily adjust their J2EE application to meet their business goal. You can look at the follow picture to try to have an impression on the container.

                                                 

   Next topic is the packaging for J2EE application. J2EE components are packaged separately and bundled into a J2EE application for deployment. So one J2EE application may be composed of several component modules. Each modules has its own deployment descriptor. We can just alter something in the xml-based descriptor without modifying the source code. (One thing we need to know is that J2EE server read the deployment descriptor at run time.)

   Finally, let’s talk about techniques that relates to J2EE.

   1 Enterprise JavaBeans Technology

     An enterprise bean is a body of code with fields and methods to implement modules of business logic. There are three kinds of enterprise beans: session beans, entity beans, and message-driven beans. Enterprise beans often interact with database. With enterprise beans and EJB container, you do not need to write any SQL code or use the JDBC API directly to perform database access operation.(beside having a session bean access the database.).

   2 JDBC API

     The JDBC API lets you invoke SQL commands from java programming language methods. You can use JDBC API from a servlet or JSP page to access the database directly without going through an enterprise bean.

     The JDBC API has two parts: an application-level interface used by the application components to access a database, and a service provider interface to attach a JDBC driver to the J2EE platform.

   3 Java Servlet Technology

     Java Servlet Technology let you put snippets of servlet code directly into a text-based document(JSP page). JSP page contains two types of text: static template data, which can be expressed in any text-based format such as HTML, WML, XML, and JSP elements, which determine how the page constructs dynamic content.

   4 Java Message Service

     The JMS is a messaging standard that allows J2EE application components to create, send, receive and read messages. It enables distributed communication that is loosely coupled, reliable , and asynchronous.

   5 Java Naming and Directory Interface

     JNDI provides naming and directory functionality. It provides applications with methods for performing standard directory operation, such as associating attributes with objects and searching for objects using their attributes,

   6  Java Transaction API 1.0

The Java Transaction API (“JTA”) provides a standard interface for demarcating transactions. The J2EE architecture provides a default auto commit to handle transaction commits and rollbacks. An auto commit means that any other applications viewing data will see the updated data after each database read or write operation. However, if your application performs two separate database access operations that depend on each other, you will want to use the JTA API to

demarcate where the entire transaction, including both operations, begins, rolls back, and commits.

   7 JavaMail™ API 1.2

J2EE applications can use the JavaMail™ API to send e-mail notifications. TheJavaMail API has two parts: an application-level interface used by the application components to send mail, and a service provider interface. The J2EE platform includes JavaMail with a service provider that allows application components to send Internet mail.

   8 JavaBeans Activation Framework 1.0

The JavaBeans Activation Framework (“JAF”) is included because JavaMail uses it. It provides standard services to determine the type of an arbitrary piece of data, encapsulate access to it, discover the operations available on it, and create the appropriate JavaBeans component to perform those operations.

   9 Java API for XML Processing 1.1

XML is a language for representing text-based data so the data can be read and handled by any program or tool. Programs and tools can generate XML documents that other programs and tools can read and handle. The Java API for XML Processing (“JAXP”) supports processing of XML documents using DOM, SAX, and XSLT. JAXP enables applications to parse and transform XML documents independent of a particular XML processing implementation. For example, a J2EE application can use XML to produce reports, and different companies that receive the reports can handle the data in a way that best suits their needs. One company might put the XML data through a program to translate the XML to HTML so it can post the reports to the Web, another company might put the XML data through a tool to create a marketing presentation, and yet another company might read the XML data into its J2EE application for processing.

  10 J2EE Connector Architecture 1.0

The J2EE Connector architecture is used by J2EE tools vendors and system integrators to create resource adapters that support access to enterprise information systems that can be plugged into any J2EE product. A resource adapter is a software component that allows J2EE application components to access and interact with the underlying resource manager. Because a resource adapter is specific to its resource manager, there is typically a different resource adapter for each type of database or enterprise information system.

  11 Java Authentication and Authorization Service 1.0

The Java Authentication and Authorization Service (“JAAS”) provides a way for a J2EE application to authenticate and authorize a specific user or group of users to run it. JAAS is a Java programing language version of the standard Pluggable Authentication Module (PAM) framework that extends the Java 2 Platform security architecture to support user-based authorization.

 (ps

reference: J2EE Tutorial

author: aga j

statement:last article that is called "J2EE Investigation" is removed from the home page of cnblog by the administrator, it's a little bit of hit to me. But I will keep on training my writing skill and keep on writing something like these,which may not help you guys learn much but it's the basic knowledge about J2EE.)