Distributed Multitiered Applications The JavaBeans Component Architecture Enterprise Information System Tier UDDI and ebXML Standard Formats Java EE Application Assembly and Deployment Application Component Provider Application Deployer and Administrator Enterprise JavaBeans Technology JavaServer Pages Standard Tag Library JavaBeans Activation Framework Java API for XML Web Services (JAX-WS) Java Architecture for XML Binding (JAXB) SOAP with Attachments API for Java Java Database Connectivity API Java Naming and Directory Interface Sun Java System Application Server 9.1 2. Using the Tutorial Examples 3. Getting Started with Web Applications 5. JavaServer Pages Technology 7. JavaServer Pages Standard Tag Library 10. JavaServer Faces Technology 11. Using JavaServer Faces Technology in JSP Pages 12. Developing with JavaServer Faces Technology 13. Creating Custom UI Components 14. Configuring JavaServer Faces Applications 15. Internationalizing and Localizing Web Applications 16. Building Web Services with JAX-WS 17. Binding between XML Schema and Java Classes 19. SOAP with Attachments API for Java 21. Getting Started with Enterprise Beans 23. A Message-Driven Bean Example 24. Introduction to the Java Persistence API 25. Persistence in the Web Tier 26. Persistence in the EJB Tier 27. The Java Persistence Query Language 28. Introduction to Security in the Java EE Platform 29. Securing Java EE Applications 31. The Java Message Service API 32. Java EE Examples Using the JMS API 36. The Coffee Break Application | Java EE 5 APIsFigure 1-7 illustrates the availability of the Java EE 5 platform APIs in eachJava EE container type. The following sections give a brief summary of thetechnologies required by the Java EE platform, and the APIs used in JavaEE applications. Figure 1-7 Java EE Platform APIs ![]() Enterprise JavaBeans TechnologyAn Enterprise JavaBeans (EJB) component, orenterprise bean, is a body of code havingfields and methods to implement modules of business logic. You can think ofan enterprise bean as a building block that can be used alone orwith other enterprise beans to execute business logic on the Java EE server. There are two kinds of enterprise beans: session beans and message-driven beans. Asession bean represents a transient conversation with a client. When the client finishes executing,the session bean and its data are gone. Amessage-driven bean combines featuresof a session bean and a message listener, allowing a business component toreceive messages asynchronously. Commonly, these are Java Message Service (JMS) messages. In Java EE 5, entity beans have been replaced by Java persistence APIentities. An entity represents persistent data stored in one row of a databasetable. If the client terminates, or if the server shuts down, the persistencemanager ensures that the entity data is saved. Java Servlet TechnologyJava servlet technology lets you define HTTP-specific servlet classes. A servlet class extendsthe capabilities of servers that host applications that are accessed by way ofa request-response programming model. Although servlets can respond to any type of request,they are commonly used to extend the applications hosted by web servers. JavaServer Pages TechnologyJavaServer Pages (JSP) technology lets you put snippets of servlet code directly intoa text-based document. A JSP page is a text-based document that contains twotypes of text: static data (which can be expressed in any text-basedformat such as HTML, WML, and XML) and JSP elements, which determine howthe page constructs dynamic content. JavaServer Pages Standard Tag LibraryThe JavaServer Pages Standard Tag Library (JSTL) encapsulates core functionality common to many JSPapplications. Instead of mixing tags from numerous vendors in your JSP applications, youemploy a single, standard set of tags. This standardization allows you to deployyour applications on any JSP container that supports JSTL and makes it morelikely that the implementation of the tags is optimized. JSTL has iterator and conditional tags for handling flow control, tags for manipulatingXML documents, internationalization tags, tags for accessing databases using SQL, and commonly usedfunctions. JavaServer FacesJavaServer Faces technology is a user interface framework for building web applications. The maincomponents of JavaServer Faces technology are as follows:
The following features support the GUI components:
All this functionality is available using standard Java APIs and XML-based configuration files. Java Message Service APIThe Java Message Service (JMS) API is a messaging standard that allows JavaEE application components to create, send, receive, and read messages. It enables distributedcommunication that is loosely coupled, reliable, and asynchronous. Java Transaction APIThe Java Transaction API (JTA) provides a standard interface for demarcating transactions. TheJava EE architecture provides a default auto commit to handle transaction commits and rollbacks.Anauto commit means that any other applications that are viewing data will seethe updated data after each database read or write operation. However, if yourapplication performs two separate database access operations that depend on each other, youwill want to use the JTA API to demarcate where the entire transaction,including both operations, begins, rolls back, and commits. JavaMail APIJava EE applications use the JavaMail API to send email notifications. The JavaMail APIhas two parts: an application-level interface used by the application components to sendmail, and a service provider interface. The Java EE platform includes JavaMail witha service provider that allows application components to send Internet mail. JavaBeans Activation FrameworkThe JavaBeans Activation Framework (JAF) is included because JavaMail uses it. JAF providesstandard services to determine the type of an arbitrary piece of data, encapsulate accessto it, discover the operations available on it, and create the appropriate JavaBeanscomponent to perform those operations. Java API for XML ProcessingThe Java API for XML Processing (JAXP), part of the Java SE platform,supports the processing of XML documents using Document Object Model (DOM), Simple APIfor XML (SAX), and Extensible Stylesheet Language Transformations (XSLT). JAXP enables applications to parseand transform XML documents independent of a particular XML processing implementation. JAXP also provides namespace support, which lets you work with schemas that mightotherwise have naming conflicts. Designed to be flexible, JAXP lets you use anyXML-compliant parser or XSL processor from within your application and supports the W3Cschema. You can find information on the W3C schema at this URL:http://www.w3.org/XML/Schema. Java API for XML Web Services (JAX-WS)The JAX-WS specification provides support for web services that use the JAXB APIfor binding XML data to Java objects. The JAX-WS specification defines client APIs foraccessing web services as well as techniques for implementing web service endpoints. TheWeb Services for J2EE specification describes the deployment of JAX-WS-based services and clients.The EJB and servlet specifications also describe aspects of such deployment. It mustbe possible to deploy JAX-WS-based applications using any of these deployment models. The JAX-WS specification describes the support for message handlers that can process messagerequests and responses. In general, these message handlers execute in the same containerand with the same privileges and execution context as the JAX-WS client orendpoint component with which they are associated. These message handlers have access tothe same JNDIjava:comp/env namespace as their associated component. Custom serializers and deserializers,if supported, are treated in the same way as message handlers. Java Architecture for XML Binding (JAXB)The Java Architecture for XML Binding (JAXB) provides a convenient way to bindan XML schema to a representation in Java language programs. JAXB can beused independently or in combination with JAX-WS, where it provides a standard databinding for web service messages. All Java EE application client containers, web containers, andEJB containers support the JAXB API. SOAP with Attachments API for JavaThe SOAP with Attachments API for Java (SAAJ) is a low-level API onwhich JAX-WS and JAXR depend. SAAJ enables the production and consumption of messagesthat conform to the SOAP 1.1 specification and SOAP with Attachments note. Most developersdo not use the SAAJ API, instead using the higher-level JAX-WS API. Java API for XML RegistriesThe Java API for XML Registries (JAXR) lets you access business and general-purpose registriesover the web. JAXR supports the ebXML Registry and Repository standards and theemerging UDDI specifications. By using JAXR, developers can learn a single API andgain access to both of these important registry technologies. Additionally, businesses can submit material to be shared and search for material thatothers have submitted. Standards groups have developed schemas for particular kinds of XMLdocuments; two businesses might, for example, agree to use the schema for theirindustry’s standard purchase order form. Because the schema is stored in a standardbusiness registry, both parties can use JAXR to access it. J2EE Connector ArchitectureThe J2EE Connector architecture is used by tools vendors and system integrators to createresource adapters that support access to enterprise information systems that can be pluggedin to any Java EE product. Aresource adapter is a software componentthat allows Java EE application components to access and interact with the underlyingresource manager of the EIS. Because a resource adapter is specific to itsresource manager, typically there is a different resource adapter for each type ofdatabase or enterprise information system. The J2EE Connector architecture also provides a performance-oriented, secure, scalable, and message-based transactionalintegration of Java EE-based web services with existing EISs that can be eithersynchronous or asynchronous. Existing applications and EISs integrated through the J2EE Connector architecture intothe Java EE platform can be exposed as XML-based web services byusing JAX-WS and Java EE component models. Thus JAX-WS and the J2EE Connectorarchitecture are complementary technologies for enterprise application integration (EAI) and end-to-end business integration. Java Database Connectivity APIThe Java Database Connectivity (JDBC) API lets you invoke SQL commands from Javaprogramming language methods. You use the JDBC API in an enterprise bean whenyou have a session bean access the database. You can also use theJDBC API from a servlet or a JSP page to access the databasedirectly without going through an enterprise bean. The JDBC API has two parts: an application-level interface used by the applicationcomponents to access a database, and a service provider interface to attach aJDBC driver to the Java EE platform. Java Persistence APIThe Java Persistence API is a Java standards-based solution for persistence. Persistence usesan object-relational mapping approach to bridge the gap between an object oriented modeland a relational database. Java Persistence consists of three areas:
Java Naming and Directory InterfaceThe Java Naming and Directory Interface (JNDI) provides naming and directory functionality, enabling applicationsto access multiple naming and directory services, including existing naming and directory servicessuch as LDAP, NDS, DNS, and NIS. It provides applications with methods forperforming standard directory operations, such as associating attributes with objects and searching forobjects using their attributes. Using JNDI, a Java EE application can store andretrieve any type of named Java object, allowing Java EE applications to coexistwith many legacy applications and systems. Java EE naming services provide application clients, enterprise beans, and web components withaccess to a JNDI naming environment. Anaming environment allows a component tobe customized without the need to access or change the component’s source code.A container implements the component’s environment and provides it to the component asa JNDInaming context. A Java EE component can locate its environment naming context using JNDI interfaces.A component can create ajavax.naming.InitialContext object and looks up the environmentnaming context inInitialContext under the namejava:comp/env. A component’s naming environment isstored directly in the environment naming context or in any of its director indirect subcontexts. A Java EE component can access named system-provided and user-defined objects. The namesof system-provided objects, such as JTAUserTransaction objects, are stored in the environment namingcontext,java:comp/env. The Java EE platform allows a component to name user-defined objects,such as enterprise beans, environment entries, JDBCDataSource objects, and message connections. An objectshould be named within a subcontext of the naming environment according to thetype of the object. For example, enterprise beans are named within the subcontextjava:comp/env/ejb, and JDBCDataSource references in the subcontextjava:comp/env/jdbc. Java Authentication and Authorization ServiceThe Java Authentication and Authorization Service (JAAS) provides a way for a Java EEapplication to authenticate and authorize a specific user or group of users torun it. JAAS is a Java programming language version of the standard Pluggable Authentication Module(PAM) framework, which extends the Java Platform security architecture to support user-based authorization. Simplified Systems IntegrationThe Java EE platform is a platform-independent, full systems integration solution that createsan open marketplace in which every vendor can sell to every customer. Sucha marketplace encourages vendors to compete, not by trying to lock customers intotheir technologies but instead by trying to outdo each other in providing productsand services that benefit customers, such as better performance, better tools, or bettercustomer support. The Java EE 5 APIs enable systems and applications integration through the following:
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.Legal Notices |