书签 分享 收藏 举报 版权申诉 / 41
上传文档赚钱

类型最新305设计模式课件.ppt

  • 上传人(卖家):晟晟文业
  • 文档编号:4967467
  • 上传时间:2023-01-29
  • 格式:PPT
  • 页数:41
  • 大小:1.26MB
  • 【下载声明】
    1. 本站全部试题类文档,若标题没写含答案,则无答案;标题注明含答案的文档,主观题也可能无答案。请谨慎下单,一旦售出,不予退换。
    2. 本站全部PPT文档均不含视频和音频,PPT中出现的音频或视频标识(或文字)仅表示流程,实际无音频或视频文件。请谨慎下单,一旦售出,不予退换。
    3. 本页资料《最新305设计模式课件.ppt》由用户(晟晟文业)主动上传,其收益全归该用户。163文库仅提供信息存储空间,仅对该用户上传内容的表现方式做保护处理,对上传内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知163文库(点击联系客服),我们立即给予删除!
    4. 请根据预览情况,自愿下载本文。本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
    5. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007及以上版本和PDF阅读器,压缩文件请下载最新的WinRAR软件解压。
    配套讲稿:

    如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。

    特殊限制:

    部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。

    关 键  词:
    最新 305 设计 模式 课件
    资源描述:

    1、1/29/20232lDesigning Enterprise Applications with the J2EE Platform,Second EditionlArchitecting and Designing J2EE Applications,SL-425lCore J2EE Patterns1/29/20239lMultitier Application ScenariolStand-Alone Client ScenariolWeb-Centric Application ScenariolBusiness-to-Business Scenario1/29/202310lMul

    2、titier Application ScenariolStand-Alone Client ScenariolWeb-Centric Application ScenariolBusiness-to-Business Scenario1/29/202311lClient components Applet Application client Java Web Start-enabled rich client Wireless clientlWeb components Servlet JsplEJB components Session bean Entity bean Message-

    3、driven bean1/29/202312 J2EE平台提供一系列服务,并允许以统一的方式访问这些服务l平台服务(Platform Service)简化编程的工作,允许在部署时间对组件和应用程序进行定制 应用程序或组件可以使用被部署环境中的资源l服务技术(Service Technologies)允许应用程序以统一的方式访问各种服务 标准的API,供组件开发人员使用服务 标准的SPI,供J2EE产品提供商实现服务1/29/202313lNaming services 可以在不改变组件源码的情况下定制组件 使用一个名字访问数据库连接,其他的组件等资源lDeployment Services 在

    4、打包和部署定制应用程序/组件 部署描述符 J2EE.ear=client.jar+web.war+ejb.jar+connector.rarlTransaction Services Flat:不允许嵌套事务 Distributed:支持分布式事务lSecurity Services 认证(Authentication)授权(Authorization)1/29/202314lJava Naming and Directory Interface(JNDI)lJDBC API JDBC 2.0 Core API JDBC 2.0 Extension API,连接池和分布式事务支持lJava T

    5、ransaction API and Service(JTA,JTS)JTA JTSlJava Connector Architecture(JTA)连接J2EE平台和EISlJava API for XML Processing Technology DOM:Document Object Model SAX:Event-based Model XSLT1/29/202315lInternet ProtocolsTCP/IPHTTP 1.0SSL 3.0lRemote Method Invocation ProtocolslObject Management Group ProtocolsJ

    6、avaIDLRMI-IIOPlMessage TechnologiesJava Message Service APIJavaMail APIJavaBeans Activation Framework APIlData FormatsHTML 3.2Image filesJAR fileClass fileXML1/29/2023161/29/202317为创建为创建 EJB 服务器端服务器端组件,组件,Enterprise Bean 开发人员提供了开发人员提供了两个定义两个定义 bean 商业商业方法的公共接口方法的公共接口Remote接口和接口和Home接口(或者接口(或者Local接口

    7、接口和和LocalHome接口)接口),以及真正的,以及真正的 bean 实现类实现类Bean Class。客户机使用客户机使用 bean 的的公共接口来创建、操作公共接口来创建、操作 bean,以及从服务器,以及从服务器除去除去 bean。bean实现类在运行时实现类在运行时被实例化。被实例化。1/29/202318Bean实现类实现类:Entity Bean的实现类的实现类实现实现javax.ejb.EntityBean接口。接口。Session Bean的实现的实现类实现类实现javax.ejb.SessionBean接口。接口。Message-driven Bean的实现类实现的实现类

    8、实现javax.ejb.MessageDrivenBean接口。接口。Bean实现类要实现实现类要实现Remote/Local接口中接口中定义的商业方法,以及定义的商业方法,以及Home/LocalHome接接口中定义的创建、破坏口中定义的创建、破坏、查找方法。、查找方法。1/29/202319EJB2.0中中Session Bean和和Entity Bean可可以有两种客户端视图以有两种客户端视图Local Client View和和Remote Client View:Remote Client View适用于分布式环境,对适用于分布式环境,对Remot/Home接口方接口方法的调用都是远

    9、程调用法的调用都是远程调用,因此对性能有一定的,因此对性能有一定的影响影响(特别是在细粒度特别是在细粒度的情况下的情况下)。Local Client View避避免了远程方法调用的开免了远程方法调用的开销,但是客户端和服务销,但是客户端和服务器必须存在于同一器必须存在于同一JVM中,同时失去了中,同时失去了分布式环境带来的好处分布式环境带来的好处。Remote Client ViewLocal Client View1/29/202320Home/LocalHome接接口:口:FactoryHome接口继承接口继承javax.ejb.EJBHome接口。接口。LocalHome接口继承接口继承

    10、javax.ejb.EJBLocalHome接口。接口。Home接口中都要定义接口中都要定义bean的创建、破坏、的创建、破坏、查找方法。查找方法。1/29/202321Remote/Local接口:接口:Delegate供客户端调用商业方法供客户端调用商业方法的接口。的接口。Remote接口继承接口继承javax.ejb.EJBObject接口。接口。Local接口继承接口继承javax.ejb.EJBLocalObject接口。接口。两个接口中都要定义两个接口中都要定义bean的商业方法。的商业方法。1/29/2023221/29/202323ejb-jar.xml Hello examp

    11、les.HelloHome examples.Hello examples.HelloLocalHome examples.HelloLocal examples.HelloBean Stateless Container 1/29/202324lRemote/Home接口及实现类的class文件,实体Bean还包括primary key classl代码中依赖的其他class文件,如参数、返回值以及自定义异常等类型l部署描述符(META-INF/ejb-jar.xml)1/29/2023251/29/202326在部署在部署EJB时,容器会为每个时,容器会为每个EJB:l根据根据Home接口

    12、和接口和Remote接口产生接口产生Home Object和和Remote Objectl生成生成stub和和skeletonl根据部署描述符设置安全环境根据部署描述符设置安全环境l根据部署描述符设置事务环境根据部署描述符设置事务环境l在在JNDI名称空间中注册名称空间中注册EJB包括包括Home接口、资源引用等接口、资源引用等l为为CMP的实体的实体Bean创建数据库表创建数据库表1/29/202327客户端在访问客户端在访问EJB时:时:l通过通过JNDI查找到查找到Home Object的引用的引用l通过通过Home Interface上的上的create方法创建一个方法创建一个Remo

    13、te ObjectlHome Object会创建并返回一个会创建并返回一个Remote Objectl调用调用Remote Interface上的商业方法上的商业方法lRemote Object截取调用进行处理,然后委托截取调用进行处理,然后委托Bean Class完成商业方法完成商业方法lRemote Object截取截取Bean Class的返回进行处理,然后将结果返回给客户端的返回进行处理,然后将结果返回给客户端1/29/202328Bean Class在执行商业方法时可以访问容器:在执行商业方法时可以访问容器:l可以通过可以通过EJBContext对象(它是对容器的直接引用)请求关于环

    14、境的信息对象(它是对容器的直接引用)请求关于环境的信息:如:如Client的身份、事务的状态以及自身的引用。的身份、事务的状态以及自身的引用。l可以通过可以通过JNDI访问资源,如访问资源,如JDBC连接、其它的连接、其它的EJB等。等。1/29/202329容器在管理容器在管理EJB生命周期过程中,通过回调方法通知生命周期过程中,通过回调方法通知EJB状态的变化:状态的变化:lBean Class实现并响应这些回调方法,进行相应的处理实现并响应这些回调方法,进行相应的处理l不同类型的不同类型的EJB回调方法各不相同,如回调方法各不相同,如Session Bean包括:包括:ejbCreate

    15、;ejbRemove;ejbPassivate;ejbActivate。1/29/202330lEntity Bean Container-Managed Persistent Entity Bean Bean-Managed Persistent Entity BeanlSession Bean Stateful Session Bean Stateless Session BeanlMessage-Driven Beans1/29/202331lSession FacadelBusiness DelegatelValue ObjectlComposite EntitylValue Obje

    16、ct AssemblerlValue List HandlerlData Access ObjectlService Locator1/29/202332lContext:In a multi-tiered application,business logic is encapsulated in serverside components.Business components expose interfaces and complexity to clients.lProblem:Application clients need to use business components to

    17、fulfill their responsibilities.The BusinessObjects expose their interfaces and clients access the business objects directly.This introduces a tight coupling between business components and clients.In some scenarios,several business components may be used in succession.This exposes clients to depende

    18、ncies between BusinessObjects,and can introduce network chattiness.BusinessObjects are not protected from misuse or abuse by clients.lForcesClients need a simpler interface.The number of BusinessObjects exposed over the network must be reduced.The client should not have to manage interactions betwee

    19、n business components.A unified service layer must be provided for coarsegrained access by all clients,based on use cases.BusinessObjects and clients should be decoupled.lSolutionA Session bean as a Faade encapsulates complex interactions between the business objects in a workflow.The Session Faade

    20、will be responsible for:llocating,creating,and modifying the business objectslProviding a uniform coarse-grained access layer to all clientslHandling relationships between business objects1/29/2023331/29/2023341/29/202335lContext:The system exposes the entire business service API to its clients,ofte

    21、n across a network.lProblem:Presentation tier components are interacting directly with business services,exposing the underlying implementation details of the service API.Additionally,the presentation tier components that use the service API make too many calls over the network.If the implementation

    22、 of the business services change,all the exposed implementation code in the presentation tier will also need to change.lForces Presentation tier clients need access to business services.Service APIs may change as business requirements evolve.There is a need to minimize coupling between presentation

    23、tier clients and the business service API,hiding underlying implementation details of the service,such as lookup and access.The system would benefit from a caching mechanism for service information.There is a need to minimize the network traffic between client and business services.lSolution Use a business delegate to reduce coupling between presentation tier clients and business services.The business delegate hides the underlying implementation details of the business service,such as lookup and access details of EJBs.1/29/2023361/29/2023371/29/2023381/29/2023391/29/20234041 结束语结束语

    展开阅读全文
    提示  163文库所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。
    关于本文
    本文标题:最新305设计模式课件.ppt
    链接地址:https://www.163wenku.com/p-4967467.html

    Copyright@ 2017-2037 Www.163WenKu.Com  网站版权所有  |  资源地图   
    IPC备案号:蜀ICP备2021032737号  | 川公网安备 51099002000191号


    侵权投诉QQ:3464097650  资料上传QQ:3464097650
       


    【声明】本站为“文档C2C交易模式”,即用户上传的文档直接卖给(下载)用户,本站只是网络空间服务平台,本站所有原创文档下载所得归上传人所有,如您发现上传作品侵犯了您的版权,请立刻联系我们并提供证据,我们将在3个工作日内予以改正。

    163文库