• 1. J2EE与中间件技术——Java EE概述
  • 2. Java EE 5
  • 3. Overviewhttp://java.sun.com/javaee Java Platform, Enterprise Edition (Java EE) builds on the solid foundation of Java Platform, Standard Edition (Java SE) and is the industry standard for implementing enterprise-class service-oriented architecture (SOA) and next-generation web applications. Web Developer Resources for Java EE Whether creating a rich user experience with Ajax and JavaServer Faces or a collaborative, community-focused application such as a wiki or blogging server, do it more quickly and with less effort using the Java EE platform.
  • 4. OverviewDevelopers today increasingly recognize the need for distributed, transactional, and portable applications that leverage the speed, security, and reliability of server-side technology. The aim of the JavaTM Platform, Enterprise Edition (Java EE) platform is to provide developers a powerful set of APIs while reducing development time, reducing application complexity, and improving application performance.
  • 5. OverviewThe Java EE 5 platform introduces a simplified programming model.
  • 6. Distributed Multitiered ApplicationsThe Java EE platform uses a distributed multitiered application model for enterprise applications. Application logic is divided into components according to function, and the various application components that make up a Java EE application are installed on different machines depending on the tier in the multitiered Java EE environment to which the application component belongs.
  • 7. Multitiered Applications
  • 8. Java EE Components: Client-tierClient-tier components run on the client machine web client/thin client: dynamic web pages containing various types of markup language (HTML, XML, and so on) Applets application client: typically has a graphical user interface (GUI) created from the Swing or the Abstract Window Toolkit (AWT) API The JavaBeansTM Component Architecture
  • 9. Java EE Server Communications
  • 10. Java EE Components: Web-tierWeb-tier components run on the Java EE server Java Servlet, JavaServer Faces, and JavaServer PagesTM (JSPTM)
  • 11. Java EE Components: Business-tierBusiness-tier components run on the Java EE server Enterprise JavaBeansTM (EJBTM)
  • 12. Enterprise information system-tierEnterprise information system (EIS)-tier software runs on the EIS server enterprise infrastructure systems such as enterprise resource planning (ERP), mainframe transaction processing, database systems, and other legacy information systems
  • 13. Java EE ComponentsJava EE components are written in the Java programming language and are compiled in the same way as any program in the language. The difference between Java EE components and “standard” Java classes is that Java EE components are assembled into a Java EE application, are verified to be well formed and in compliance with the Java EE specification, and are deployed to production, where they are run and managed by the Java EE server.
  • 14. Java EE Serverthe Java EE server provides underlying services in the form of a container for every component type. Containers are the interface between a component and the low-level platform-specific functionality that supports the component.
  • 15. Server and Containers
  • 16. Container TypesJava EE server: The runtime portion of a Java EE product. A Java EE server provides EJB and web containers. Enterprise JavaBeans (EJB) container: Manages the execution of enterprise beans for Java EE applications. Enterprise beans and their container run on the Java EE server. Web container: Manages the execution of JSP page and servlet components for Java EE applications. Web components and their container run on the Java EE server. Application client container: Manages the execution of application client components. Application clients and their container run on the client. Applet container: Manages the execution of applets. Consists of a web browser and Java Plug-in running on the client together.
  • 17. Container ServicesThe Java EE security model lets you configure a web component or enterprise bean so that system resources are accessed only by authorized users. The Java EE transaction model lets you specify relationships among methods that make up a single transaction so that all methods in one transaction are treated as a single unit. JNDI lookup services provide a unified interface to multiple naming and directory services in the enterprise so that application components can access these services. The Java EE remote connectivity model manages low-level communications between clients and enterprise beans. After an enterprise bean is created, a client invokes methods on it as if it were in the same virtual machine.
  • 18. Java EE Application Assembly and DeploymentA Java EE application is packaged into one or more standard units for deployment to any Java EE platform-compliant system. Each unit contains: A functional component or components (such as an enterprise bean, JSP page, servlet, or applet) An optional deployment descriptor that describes its content
  • 19. Packaging Applications
  • 20. Development RolesThe Java EE product provider designs and makes available for purchase the Java EE platform APIs, and other features defined in the Java EE specification. typically application server vendors who implement the Java EE platform according to the Java EE 5 Platform specification. The tool provider creates development, assembly, and packaging tools used by component providers, assemblers, and deployers. Application Component Provider creates web components, enterprise beans, applets, or application clients for use in Java EE applications. Application Assembler receives application modules from component providers and assembles them into a Java EE application EAR file. Application Deployer and Administrator configures and deploys the Java EE application, administers the computing and networking infrastructure where Java EE applications run, and oversees the runtime environment.
  • 21. Java EE 5 APIs
  • 22. Enterprise JavaBeans TechnologyThere are two kinds of enterprise beans: session beans and message-driven beans. A session bean represents a transient conversation with a client. When the client finishes executing, the session bean and its data are gone. A message-driven bean combines features of a session bean and a message listener, allowing a business component to receive messages asynchronously. Commonly, these are JavaMessage Service (JMS) messages. In Java EE 5, entity beans have been replaced by Java persistence API entities.
  • 23. Java servlet technology lets you define HTTP-specific servlet classes. A servlet class extends the capabilities of servers that host applications that are accessed by way of a 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.Java Servlet Technology
  • 24. JavaServer PagesTM (JSP) technology lets you put snippets of servlet code directly into a text-based document. A JSP page is a text-based document that contains two types of text: static data (which can be expressed in any text-based format such as HTML, WML, and XML) and JSP elements, which determine how the page constructs dynamic content.JavaServer Pages Technology
  • 25. The JavaServer Pages Standard Tag Library (JSTL) encapsulates core functionality common to many JSP applications. Instead of mixing tags from numerous vendors in your JSP applications, you employ a single, standard set of tags. This standardization allows you to deploy your applications on any JSP container that supports JSTL and makes it more likely that the implementation of the tags is optimized. JSTL has iterator and conditional tags for handling flow control, tags for manipulating XML documents, internationalization tags, tags for accessing databases using SQL, and commonly used functions.JavaServer Pages StandardTag Library
  • 26. JavaServer FacesJavaServer Faces technology is a user interface framework for building web applications. The main components of JavaServer Faces technology are as follows: A GUI component framework. A flexible model for rendering components in different kinds of HTML or different markup languages and technologies. A Renderer object generates the markup to render the component and converts the data stored in a model object to types that can be represented in a view. A standard RenderKit for generating HTML/4.01 markup.
  • 27. Java Message Service APIThe JavaMessage Service (JMS) API is a messaging standard that allows Java EE application components to create, send, receive, and read messages. It enables distributed communication that is loosely coupled, reliable, and asynchronous.
  • 28. JavaTransaction APIThe Java Transaction API (JTA) provides a standard interface for demarcating transactions. The Java EE architecture provides a default auto commit to handle transaction commits and rollbacks. An auto commit means that any other applications that are 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.
  • 29. JavaMail APIJava EE applications use the JavaMailTM API to send email notifications. The JavaMail API has two parts: an application-level interface used by the application components to send mail, and a service provider interface. The Java EE platform includes JavaMail with a service provider that allows application components to send Internet mail.
  • 30. JavaBeans Activation FrameworkThe JavaBeans Activation Framework (JAF) is included because JavaMail uses it. (JavaMail利用JAF处理MIME编码的邮件附件) JAF 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.
  • 31. Java Database Connectivity APIThe JavaDatabase Connectivity (JDBC) API lets you invoke SQL commands from Java programming language methods. You use the JDBC API in an enterprise bean when you have a session bean access the database. You can also use the JDBC API from a servlet or a 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 Java EE platform.
  • 32. Java Persistence APIThe Java Persistence API is a Java standards-based solution for persistence. Persistence uses an object-relational mapping approach to bridge the gap between an object oriented model and a relational database. Java Persistence consists of three areas: The Java Persistence API The query language Object/relational mapping metadata
  • 33. Java Naming and Directory InterfaceThe JavaNaming and Directory InterfaceTM (JNDI) provides naming and directory functionality, enabling applications to access multiple naming and directory services, including existing naming and directory services such as LDAP, NDS,DNS, and NIS. It provides applications with methods for performing standard directory operations, such as associating attributes with objects and searching for objects using their attributes. Using JNDI, a Java EE application can store and retrieve any type of named Java object, allowing Java EE applications to coexist with many legacy applications and systems.
  • 34. Java Authentication and Authorization ServiceThe Java Authentication and Authorization Service (JAAS) provides a way for a Java EE application to authenticate and authorize a specific user or group of users to run it.
  • 35. Web Services SupportWeb services are web-based enterprise applications that use open, XML-based standards and transport protocols to exchange data with calling clients. The Java EE platform provides the XML APIs and tools you need to quickly design, develop, test, and deploy web services and clients that fully interoperate with other web services and clients running on Java-based or non-Java-based platforms.
  • 36. XMLJava API for XML Processing(JAXP) Java API for XMLWeb Services (JAX-WS) Java Architecture for XML Binding (JAXB) SOAP with Attachments API for Java(SAAJ) Java API for XML Registries
  • 37. J2EE Connector ArchitectureThe J2EE Connector architecture is used by tools vendors and system integrators to create resource adapters that support access to enterprise information systems that can be plugged in to any Java EE product.
  • 38. Simplified Systems IntegrationThe Java EE platform is a platform-independent, full systems integration solution that creates an open marketplace in which every vendor can sell to every customer. The Java EE 5 APIs enable systems and applications integration through the following: Unified application model across tiers with enterprise beans Simplified request-and-response mechanism with JSP pages and servlets Reliable security model with JAAS XML-based data interchange integration with JAXP, SAAJ, and JAX-WS Simplified interoperability with the J2EE Connector architecture Easy database connectivity with the JDBC API Enterprise application integration with message-driven beans and JMS, JTA, and JNDI
  • 39. 轻型框架Hibernate: ORM工具 Struts:基于MVC设计模式的Web框架 Spring:轻量级的JAVA EE应用程序框架
  • 40. 开发工具Eclipse:可扩展的免费开放源代码IDE Jbuilder NetBeans:开放源码的Java集成开发环境
  • 41. Web服务器和应用服务器Web服务器:Tomcat, Resin EJB容器: JBoss 应用服务器:IBM Websphere, BEA Weblogic, Oracle 9iAS,
  • 42. Java EE应用
  • 43. 应用服务器稳定可靠的性能: 企业的电子商务系统面向全球,提供7天*24小时不间断的服务,系统在大负荷量下和长时间运转下的稳定性至关重要 当系统处理能力不够时,可以通过简单的增加硬件来解决:
  • 44. 应用服务器动态调整不同主机间的负载可以最大的利用系统资源,同时提高单机的稳定性: 负载均衡:将用户发来的请求,恰当地分配给各个应用服务器,无需对应用进行任何修改---可扩展性
  • 45. 应用服务器当系统中的某台机器出现故障时,它的工作可由其它机器来承担,不会影响系统整体的运行,即无单点故障: 高可靠性:错误容忍和错误恢复