JAVA高级技术

  • 格式:pdf
  • 大小:578.64 KB
  • 文档页数:40

《Java高级技术》课程Java EE概述(1)李戈北京大学信息科学技术学院软件研究所2008年5月17日What is Java EEJava technologyis both a programming language and a platform.The Java programming language is a high-levelobject-oriented language that has a particular syntaxand style.Java platform is a particular environment in whichJava programming language applications run.There are three platforms of the Java programming language:Java Platform, Standard Edition (Java SE)Java Platform, Enterprise Edition (Java EE)Java Platform, Micro Edition (Java ME)What is Java EEJava Platform, Standard EditionJava SE’s API provides the core functionality of theJava programming language.●It defines everything from the basic types and objects tohigh-level classes that are used for networking, security,database access, graphical user interface (GUI)development, and XML parsing.In addition to the core API, the Java SE platformconsists of a virtual machine, development tools,deployment technologies, and other class libraries and toolkits commonly used in Java applications.What is Java EE Java SE 6 Platform at a GlanceWhat is Java EEJavaMEThe JavaME platform provides an API and a small-footprint virtual machine for running Java programming languageapplications on small devices.The API is a subset of the Java SE API, along with special class libraries useful for small device application development.Java EEThe Java EE platform is built on top of the Java SE platform.Java EE provides an API and runtime environment fordeveloping and running large-scale, multi-tiered, scalable,reliable,and secure network applications.What is Java EE Java EEprovides a comprehensive and cohesiveimplementation for enterprise system needs. Elements in Enterprise systemWhat is Enterprise System NeedsInformation PresentationWeb Content PresentationApplications Content PresentationBusiness LogicWeb Connectivity LogicEnterprise Application LogicData ManagementEnterprise Data AccessIntra & Inter ApplicationsIntra-Enterprise Applications●Legacy●Auxiliary●EmbeddedExternal Inter-Enterprise ApplicationsCommunicationsDistributed Enterprise Communications领域工程领域工程方法领域应用应用应用应用领域工程DA1B1C1A2B2领域模型/构架领域可复用构件输入输出领域分析员最终用户领域专家应用系统开发需求分析员、软件设计者...Enterprise System SolutionJavaEE Enterprise System Solution ModelJava EE Application Model The Java EE platform uses a distributed multi-tiered application model for enterprise applications.JavaEE Component-ContainerArchitectureAn enterprise componentis an encapsulation of acertain body of codeutilized in an enterpriseapplication.An enterprise containerrepresents anenvironment in which acomponent operates.The container itself mayoffer a set of services thatcomponents may tap in astandard fashion.JavaEE Components & ContainersJ2EE Components & Containers “Five & Four”defined within the J2EE specification.Five major classes of components :●EJB Component / JSP Web Component / ServletComponent/ Applet / Java ApplicationFour container types :●Enterprise JavaBeans (EJB) container / Webcontainer / Application client container / AppletcontainerClient TierJava EE ClientsWeb Clients (Web Pages + Web Browser) /Applets + JavaBeans Components●Web Pages: various types of markup language (HTML, XML, and so on),which are generated by web components running in the web tier Application Clients + JavaBeans ComponentsServer Tier (1)Web TierJava EE web components ( Servlets& JSP pages)JavaBeans componentServer Tier (1)Web TierJava EE web components●Servlets are Java programming language classes thatdynamically process requests and construct responses.●JSP pages are text-based documents that execute asservlets but allow a more natural approach to creatingstatic content.●JavaServer Faces technology builds on servlets and JSPtechnology and provides a user interface componentframework for web applications.JavaBeans component●manage the user input and send that input to enterprisebeans running in the business tier for processing.Server Tier (2)Business TierBusiness Components (Enterprise Java Bean)Server Tier (2)Business TierBusiness Components (Enterprise Java Bean)●receives data from client programs, processes it(if necessary), and sends it to the enterpriseinformation system tier for storage.●retrieves data from storage, processes it (ifnecessary), and sends it back to the clientprogram.EIS Tier Enterprise Information System Tier Database SystemsEnterprise Resource Planning (ERP)some Legacy Information SystemsJava EE ContainersContainersBusiness logic is organized into reusable componentsJava EE server provides underlying services in the form of acontainer for components.Containers are the interface between a component and the low-level platform-specific functionality that supports the component.Java EE 5 Services Services for JavaEEJava EE 5 ServicesJava Transaction API (JTA)The Java Transaction API provides a standard interface for demarcating transactions.●provides a default auto commit to handle transactioncommits and rollbacks.●An auto commit means that any other applications thatare viewing data will see the updated data after eachdatabase read or write operation.For example, your application performs two separatedatabase access operations that depend on each other,you will want to use the JTA API to demarcate wherethe entire transaction, including both operations,begins, rolls back, and commits.Java EE 5 ServicesJavaNaming and Directory InterfaceTM (JNDI) provides naming and directory functionality, enablingapplications to access multiple naming and directoryservices, including existing naming and directoryservices such as LDAP, NDS, DNS, and NIS.It provides applications with methods for performingstandard directory operations, such as searching forobjects using their attributes.Using JNDI, a Java EE application can store and retrieve any type of named Java object, allowing Java EEapplications to coexist with many legacy applicationsand systems.Java EE 5 ServicesJava API for XML Processing (JAXP)A part of the Java SE platformsupports the processing of XML documentsusing Document Object Model (DOM), Simple API for XML (SAX), and Extensible StylesheetLanguage Transformations (XSLT).●enables applications to parse and transformXML documents.●enables using any XML-compliant parser orXSL processor from within your application.Java EE 5 ServicesJava API for XML Web Services (JAX-WS) provides support for web services that use theJAXB API(Java Architecture for XML Binding)●binding an XMLschema to XML●binding XML data to Java objects.defines client APIs for accessing web services.support for message handlers that can processmessage requests and responses.About Web ServicesJava EE 5 ServicesRemote Method Invocation (RMI)allows an object running in one Java virtual machine to invoke methods on an object running in another Javavirtual machine.RMI provides●the mechanism by which the server and the clientcommunicate and pass information back and forth.●support for remote communication between programsRMI uses object serialization to marshal and unmarshalparameters and does not truncate typesJava EE 5 ServicesCommon Object Request Broker Architecture (CORBA)CORBA implementation in the Java platform provides standards-based interoperability and connectivity.Java IDL enables distributed Web-enabled Javaapplications to transparently invoke operations onremote network services using the industry standardOMG IDL(Object Management Group InterfaceDefinition Language) and IIOP(Internet Inter-ORBProtocol).Java EE 5 ServicesJava Message Service (JMS)JMS defines the standard for reliable Enterprise Messaging.allows application components based on JavaEEto create, send, receive, and read messages.allowing loosely coupled, reliable,asynchronous interactions among JavaEEcomponents and legacy systems capable ofmessaging.Packaging Applications A Java EE application is delivered in an Enterprise Archive (EAR) file, a standard Java Archive(JAR) file with an .ear extension.Java EE Modules in EARThe four types of Java EE modules are as follows:EJB modules, which contain class files for enterprise beans and an EJB deployment descriptor. Packaged as JAR files with a .jarextension.Web modules, which contain servlet class files, JSP files,supporting class files, GIF and HTML files, and a web applicationdeployment descriptor. Packaged as JAR files with a .warextension.Application client modules, which contain class files and anapplication client deployment descriptor. Packaged as JAR fileswith a .jar extension.Resource adapter modules, which contain all Java interfaces,classes, native libraries, and other documentation, along with theresource adapter deployment descriptor. Packaged as JAR fileswith an .rar(resource adapter archive) extension.Development RolesJava EE Product ProviderTool ProviderApplication Component ProviderEnterprise Bean DeveloperWeb ComponentDeveloperApplication ClientDeveloperApplication AssemblerApplication Deployer and AdministratorJava EE & Software Reuse软件构件技术构件、构架获取构件、构架获取构件标准化与描述构件标准化与描述构件分类、存储与检索构件分类、存储与检索构件组装构件组装CASE技术软件过程非技术因素领域工程软件再工程软件构架开放系统技术软件复用软件复用出发点:在软件系统的开发中,不再采用一切“从零开始”的模式,而是以已有的工作为基础,充分利用过去应用系统开发中积累的知识和经验。