The Java EE application program interface (API) consists of a suite of technology components and services that are used to build enterprise applications. It includes components that may be used to build presentation and business logic, APIs for managing business transactions, security and infrastructure tools to support the application operating environment, and tools for both internal and external integration. The following is a list of major technologies provided by Java EE. Refer to [J2EE15] pp 5-13 for more details (see also [J2EETutor] for additional information). Enterprise Applications and Transactions
Security Services
Integration and Interoperability
Management
Figure 1-1 depicts the suite of Java EE technologies in a logical architecture diagram. Client applications can send service requests to the Web Container or EJB Container for accessing business transactions or services. The Web Container provides technologies for building Web-based applications and defining processing logic in the Web tier. The EJB Container provides technologies for building reliable business applications to manage reliable and scalable transactions. The security services are shared among the containers. The integration and interoperability technologies are used for both back-end system integration (such as legacy system and ERP system integration) and cross-platform interoperability (such as Java EE .NET interoperability). Figure 1-1. Java EE 5.0 architectureJava EE technologies support a variety of clients, for exampleJava EE: applet, Java ME client (or mobile devices), and application clients (browsers and rich clients). These clients can access different service components provided by the Java EE via HTTP protocol or secure HTTPS protocol using Secure Socket Layer (SSL) or Transport Layer Security (TLS). The Java EE consists of the Web Container (usually implemented as a Web server) and the Enterprise Java Bean (EJB) Container (usually implemented as an application server). A .NET client can also send service requests to the Web Container or the EJB Container via a variety of interoperability options such as Web services (which interoperate with JAX-RPC) and a bridge (which interoperates with RMI-IIOP). Building Interoperable ComponentsServlets, JSPs, EJBs and JSFs are programming language elements that can be used to build reusable components for interoperating with .NET or other platforms. Servlets and JSPs are usually categorized as Web components, as they are managed in a Web Container. For example, they can create Web services that can exchange business data synchronously or asynchronously with .NET applications. EJBs are categorized as EJB components, as they are managed in an EJB Container. For example, they can interoperate with a .NET application using an RMI-IIOP bridge. The underlying Java EE services are responsible to provide underlying system services and infrastructure functions for the Web tier (or Web Container) or business tier (or EJB Container) components while interoperating with a .NET application. For example, RMI/IIOP communication service is required when an RMI-IIOP bridge integration strategy is used. The following provides a brief description of these programming language elements and the underlying Java EE services: ServletsServlets are server-side Java programs that process business logic and handle HTTP requests and replies. A typical servlet is a Java class that extends HttpServlet. When the client submits a service request, a servlet receives an HTTP request (HttpServletRequest) and an HTTP response (HttpServletResponse) in the parameters using the doGet method. Data results or messages can be rendered as an HTML page by printing HTML tags of texts and data, for example, out.println("<html><body><p>Hello World, Java EE .NET Interoperability</p></body></html>"). Servlets will be deployed to a "context" (a virtual name for the servlets deployed) on the local host, for example, myContextRoot, and can be invoked via the URL http://localhost:8080/myContextRoot/myServlet where myServlet is the name of the servlet. The file web.xml stores information about the servlet configuration, where the actual Java class will be referenced to a physical Java class name (in this example, myServletClass) and the URL pattern (for example, /myContextRoot). The web.xml file is a deployment file, stored in the ./WEB-INF directory of the Web server or application server. JSPJSP is a Java scripting language that will be compiled dynamically into a servlet (and re-compiled again for any changes intelligently), and cached for better performance during execution. A typical JSP may consist of the following elements:
JSFJSF is a draft specification (http://java.sun.com/javaee/javaserverfaces) for new standardized user interface components that manage page state, application events, input validation, and page navigation and that support internationalization and accessibility. It augments JSP technology by providing an interface to the custom tag library within a JSP page. It is also a good tool supporting a Model-View-Controller architecture such as Struts. EJBEJBs are reusable components that encapsulate business logic. They make use of the container services that manage the life cycle of the business objects, operate the naming service, and provide transaction handling (for example, connecting to multiple data sources), security mechanisms (for example, identifying the principals and the users), and persistence mechanisms. There are three types of EJBs:
Java EE 5.0 introduces EJB 3.0, which uses annotation (@Stateless, @EJB) to simplify the development complexity and effort in building EJBs. Refer to [J2EE15Intro] for examples and details. Supporting Services for InteroperabilityJava EE containers provide common services that are shared by Java EE components. These system services provide functions for database connectivity, transaction management, naming service, communication and connectivity, and messaging.
Among these Java EE services, the communication and connectivity services are crucial to supporting Java EE .NET interoperability using the bridge technology (such as RMI/IIOP bridge). The Messaging service is often used for synchronous and asynchronous Web services integration strategy. For example, SAAJ requires JavaMail to handle document attachments. Deploying Java EE ApplicationsJava EE applications are usually packaged and deployed in one or multiple units in EAR file format. An EAR file (depicted in the META-INF/application.xml file) consists of EJB components in JAR files (META-INF/ejb-jar.xml), Web modules in WAR files (WEB-INF/web.xml), and Java modules in JAR files (META-INF/application-client.xml). Many application server implementations allow developers to deploy Java EE applications by any of the following mechanisms:
Figure 1-2 shows the structure of Java EE deployment elements (that is, deployment descriptors and the contents such as EAR and WAR files). A Java EE application can be packaged and deployed in an EAR file, which in turn can consist of multiple JAR files (Java classes) and WAR files (for Web applications). A Java EE .NET interoperable application written in Java, whether it uses synchronous communication, asynchronous messaging, or bridge integration strategies, is also deployed using the same deployment mechanism (say, EAR or WAR file) here. Figure 1-2. Java EE application deployment structureManagement of access rights for security control is very important for application deployment. The security role is defined in the application.xml file, which is a declarative security feature of the Java EE architecture. An application deployment tool will copy all EAR files to the Java EE application server, generate any necessary implementation classes and help documentation, and deploy the application EAR files to the deployment directory of the Java EE application server. After that, architects and developers need to configure the application server-specific information, such as creating data sources and connection factories and administer JMS queue names. |