相关与课件it十八掌manning in action it18掌aspectj_第1页
相关与课件it十八掌manning in action it18掌aspectj_第2页
相关与课件it十八掌manning in action it18掌aspectj_第3页
相关与课件it十八掌manning in action it18掌aspectj_第4页
相关与课件it十八掌manning in action it18掌aspectj_第5页
已阅读5页,还剩561页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、 - Free Books & magazinesEnterprise AOP with Spring ApplicationsIN ACTIONRamnivas LaddadFOREWORD BY ROD JOHNSONM A N N I N G Praise for the First EditionThere are aly several books about AspectJone of its major advantages.Myfavorite is AspectJ in Action.Rod Johnson, Creator of the Spring Framewo

2、rkin J2EE Development without EJBOne of the clearest expositions of AOP and its benefits that I have seen. It is obvious that a lot of care and attention has gone into the preparation of the material.Adrian Colyer, AspectJ Project Lead, in The Computer JournalI would highly recommend AspectJ in Acti

3、on to anyone who is interested in AOP.I liked the practical angle, and you could tell that Ramnivas has really used AOP/ AspectJ on his projects.Dion Almaer at TheServerSreal solutions to tough problems.Chris Bartling, Identix, Inc.Laddad brings to the professional commua valuable book, to support A

4、OPtutoring and adoption.a well-constructed, well-balanced book that delivers what it promises.Computing Reviews atI starteding at 11 PM and couldnt stop. Its a must-for anyone interestedin the future of program.Arno Schmidmeier, AspectSoftThis book is to aspect-oriented program patterns.what the Gan

5、g of Four book is to designComputing Reviews at.a wonderful job of introducing the new AOP trend.no other book succeeded to present the challenges of AOP so well.JavaRDownload at WoWeBook.ComMore Praise for the First EditionThe author succeeds brilliantly in gradually building your understanding of

6、AOP,then AspectJs own sems, and then the coding possibilities these offer. Thewriting is clear and accessible, the content expertly graduated.aer at Amazon.co.uk.one of the few technical books that has blown my hair back. I walked away feeling as though I had actually grown as a developer.Alex Winst

7、on at AlexWBy far the best program-related book I havein a long time.aer at Amazon.co.uk.a very clear and complete treatment of aspects. Like the other books in the “In Action” series from Manning, it is filled with very good diagrams.This book willdefinitely help.on The Daily Channel.I would recomm

8、end going with AspectJ in Action.you will get the most bang for your buck from Ramnivass work.The subject-oriented approach in this book lendsitself well to future reuse.on .exactly what I needed.fantastic use of diagrams, figures, and annotated code. They solidly add to understanding the content. I

9、 found the book to really be excellent from all viewpoints for getting into the subject matter from many angles and diving down very deep into it.Max Spille at TheServerSThis book provides a very good resource both for people starting to learn AOP and AspectJ and for experienced AOP programmers who

10、wish to deepen their knowledge in this new area.Valentin Crettaz, JavaRanchThe only resource that presents AOP concepts and real-world examples in anapproachable,able way.Jean Baltus, Metafron-InfosysDownload at WoWeBook.ComAspectJ in ActionSecond EditionENTERPRISE AOP WITH SPRING APPLICATIONSRAMNIV

11、AS LADDADMANNING Greenwich (74° w. long.)Download at WoWeBook.ComFor online information and ordering of this and other Manning books, please visit. The publisher offers discounts on this book when ordered in qu For more information, please contactSpecial Sales Department Manning Publications Co

12、.Sound View Court 3Bfax: (609) 877-8256ty.Greenwich, CT 06830: orders©2010 by Manning Publications Co.No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written pe

13、rmission of the publisher.Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or al

14、l caps.Recognizing the importance of preserving what has been written, it is Mannings policy to havethe books we publish printed on acid-paper, and we exert our best efforts to that end.Recognizing also our responsibility to conserve the resources of our planet, Manning books areprinted on paper tha

15、t is at least 15% recycled and processed without the use of elemental chlorine.Development Editor:Copyeditor: Typesetter: Cover designer:Cynthia Kane Tiffany Taylor Gordan Salinovic Marija TudorManning Publications Co. Sound View Court 3B Greenwich, CT 06830ISBN 978-1-933988-05-4Printed in the Unite

16、d States of America1 2 3 4 5 6 7 8 9 10 MAL 14 13 12 11 10 09Download at WoWeBook.ComTo AshishIn our hearts you will always remainDownload at WoWeBook.ComDownload at WoWeBook.Combrief contentsPART 1UNDERSTANDING AOP AND ASPECTJ1123456789Discovering AOP3Introducing AspectJ27 Understanding the join po

17、int m51Modifying behavior with dynamic crosscutting87 Modifying structure with static crosscutting116 Aspects: putting it all together136Diving into the AspectJ syntax168AspectJ weaving ms199Integration with Spring217PART 2APPLICATIONS OF ASPECTJ WITH SPRING2491011121314Monitoring techniques251Polic

18、y enforcement: keeyour design intact288 Learning design patterns319Implementing concurrency control344Managing tranions373viiDownload at WoWeBook.ComviiiBRIEF CONTENTS151617appendix A appendix B appendix CSecuring applications404 Improving domain logic431 Taking the next step459Setting up the exampl

19、e469 Using Ant with AspectJ486Using Maven with AspectJ491Download at WoWeBook.Comcontentsforewordxixprefacexxiiipreface to the first editionxxvacknowledgments about this book about the titlexxvii xxixivabout the cover illustrationva real-world perspective of AOPviiPART 1UNDERSTANDING AOP AND ASPECTJ

20、11Discovering AOP31.1Life without AOP4Code scattering7Code tangling51.21.3Modularizing with AOP7Anatomy of an AOP language9The AOP language specification9The AOP languageimplementation101.4Fundamental concepts in AOP11ixDownload at WoWeBook.ComxCONTENTS1.5AOP by analogy13Cascading Style Sheets (CSS)

21、 Event-oriented programImplementations of AOP13151516Database systems141.6AspectJ15Spring AOPOther implementations of AOP171.7Alternatives to AOP17Frameworks17Code generation18Design patterns19Dynamic languages221.8Costs and benefits of AOP23Costs of AOP23Benefits of AOP241.9Summary252Introducing As

22、pectJ272.1Writing your first AspectJ program28Setting up the example28Adding an aspect292.2AspectJ crosscutting construct31Common crosscutting constructs31Dynamic crosscuttingconstruct: advice32Static crosscutting constructs342.32.4AspectJ alternative syntax37 Weaving mechanisms39Source weaving39Bin

23、ary weaving39Load-timeweaving412.5AspectJ weaving: under the hood42The compiled aspect43The woven class432.62.7Spring AspectJ integration44AspectJ logistics overview46IDE integration46AspectJ documentation tool482.8Summary493Understanding the join point m513.1Understanding the join point m52Join poi

24、nts53Pointcuts543.2Categorizing exposed join points55Method join points56Constructor join points57Fieldaccess join points58Exception-handler joinpoints59Class-initialization join points59Objectinitialization join points60Object pre-initialization joinpoints60Advice execution join points61Download at

25、 WoWeBook.ComxiCONTENTS3.3Join point demonstration example61The aspect61The result623.4Understanding pointcut basics64Named and anonymous pointcuts64Pointcut operators653.5Signature syntax65Type signature patterns66Method and constructor signaturepatterns69Field signature patterns733.6Implementing p

26、ointcuts75Kinded pointcuts75Non-kinded pointcuts773.7Summary854Modifying behavior with dynamic crosscutting874.1Advice overview88Advice classification88Advice syntax884.2Comparing advice to methods90Similarities between advice and methods90Differences betweenadvice and methodsAdvice in depth914.392B

27、efovice92After advice929999Around advice944.4Collecting join point contextCollecting objects at the join pointImplementing simplecaching1024.5Accessing join point context via reflection105The reflection API106Improving caching using reflectionAPIs109Comparing the reflection API to pointcuts1134.6Sum

28、mary1155Modifying structure with static crosscutting1165.1Introducing membersScattering and tangling117117Untangling withaspects118Mixing with mixins121Memberintroduction rules123124Idiom: Providing a default interfaceimplementation5.5Modifying the type hierarchy128Introducing members to mu

29、ltiple types129Supplying annotations130Declaring weave-time errors and warnings132Download at WoWeBook.ComxiiCONTENTS5.6Softening checked exceptions1335.7Summary1346Aspects: putting it all together1366.1Working with aspects137Similarities between aspects and classes aspects and classes139137Differen

30、ces between6.2Aspesociation140Default singleton association141Per-objesociation143148Per-control-flow association145Per-type associationImplicit limiting of join points with aspesociations150Accessing aspect instances151Comparing per-objectassociation and member introduction152Improving thecaching a

31、spect1536.3Aspect precedence159Ordering of advice161Explicit aspect precedence162Ordering advice in a single aspect1646.46.5Privileged aspects166Summary1677Diving into the AspectJ syntax1687.1Syntax overviewNatural map169170Java compatibility171Early errordetectionMap1717.2aspects172sociationSpecify

32、ing aspe173Accessing the aspectinstanceMapMapMap173Declaring aspect precedence1737.3pointcuts174abstract pointcuts174Mapconcrete pointcuts1791757.4dynamic crosscutting constructsThe befovice180The after advice184The aroundadviceMapMap parents1877.5static crosscuttingweave-time declarations 190189189

33、Mapdeclare7.6Features not implemented in AspectJ194Associating annotations194Introducing data and methods194Softening exceptions195Privileged aspects196Download at WoWeBook.ComxiiiCONTENTS7.7Comparing syntax styles1967.8Summary1978AspectJ weaving ms1998.18.2Classifying weaving mBuild-time weavings20

34、0201Build-time source code weaving201Build-time binaryweaving2028.3Load-time weaving206Load-time weaving overview206Configuring the load-timeweaver20Load-time weaver in actionChoosing syntax and weaving213215Summary2169Integration with Spring2179.1Spring AOP fundamentals218Setting up the a

35、pplication219Utilizing the AspectJsyntax221Spring IDE2229.2Spring AOP under the hood222A quick introduction to dynamic proxies223Proxy-basedAOP with Spring224Spring AOP internals225Proxy-based AOP in DI framework226Limitations of SpringAOP2279.3AspectJ support in depth229Static crosscutting236Dynami

36、c crosscutting2302359.4Schema-style AOP supportMap adviceTapaspects236Mappointcuts237Map238Mapstatic crosscutting239240Spring-driven9.5into the full power of AspectJConfiguring aspects using Spring DI240LTW2419.6Choosing an appropriate AOP system245Comparing AspectJ to Spring AOP245Comparing Spring

37、AOPsyntaxSummary246Its decision time2469.7247Download at WoWeBook.ComxivCONTENTSPART 2APPLICATIONS OF ASPECTJ WITH SPRING24910Monitoring techniques25110.1Tracing in action252Tracing the aspect-oriented way253Tracing the conventionalway25510.210.3Conventional vs. AOP tracing Selecting join points of

38、interestSelection based on static structure257258259Selection based ondynamic context26310.4Tracing264Indenting trace calls264Sharing tracing aspect functionality266Tracing intra-method activities267Logging the methodparameters268Choosing a type-specific logger27010.5A detour: deployment options for

39、 monitoring aspects271Utilizing load-time weaving271Utilizing Spring AOP fortracing27310.610.7Exception monitoring275Improving conventional logging277Modularizing NDC with conventional logging Modularizing MDC with conventional logging27727910.810.910.10Performance monitoring281Runtime control of mo

40、nitoring aspects284Summary28611Policy enforcement: keeyour design intact288289AOP-based policy enforcement overview Policy origins and destinations294Enforcement using AOP294Compile-time enforcement295Runtime enforcement29611.411.5Comparison with code-analysis tools297Implementing flexib

41、le access control298Restricting exposure298Limitingcollaboration299Enforcing the factory pattern30111.611.7Enforcement idiom: return-value restriction303Enforcing JPA-integration policies304Download at WoWeBook.ComxvCONTENTS11.8Implementing EJB policies308Develoa core EJB enforcement aspect309Defini

42、ng EJBpointcuts310Dealing with XML-based EJBs312Implementing a “no EJBs” policy31211.9Detecting Swing concurrency control policy violations313Understanding the problem314Detecting the violation31511.10Summary31812Learning design patterns31912.1The worker object pattern320The current solution320An ov

43、erview of the worker objectpattern321The worker object pattern template321Getting the return value324A summary of the worker objectpattern32612.2The wormhole pattern327The current solution327An overview of the wormhole pattern327The wormhole pattern template328A summary of the wormholepattern33012.3

44、The participant pattern330Current solutions331An overview of the participantpattern333The participant pattern template333Consequences of the participant pattern336A summary of theparticipant pattern33612.4Annotation-driven participant pattern336Current solution337The annotation-driven participantpat

45、tern template337Annotation type abstraction338Variation: bridged participation pattern341Role of ADPP inlibrary aspects34212.5Summary34313Implementing concurrency control34413.1Modularizing Swings single-thrule345A test problem346Solution: the conventional way348Solution: the AspectJ way351Improving

46、 the solution36113.213.3Improving the responsiveness of UI applications362Modularizing the-write lock pattern365Implementation: the conventional way365Implementation: theAspectJ waySummary36737113.4Download at WoWeBook.ComxviCONTENTS14Managing tranions37314.1Tranion management implementations374Conv

47、entional implementation374AOPimplementation37514.2Tranion-management players376376Tranion management in architectureTranionmanagement: one concept, too many implementations377Tranion-management abstraction37714.3Aspect implementation choices378Proxy-based AOP378Byte-code weaving37914.4Tranion-manage

48、ment aspect (almost) from scratch379Implementing the aspect380Testing the aspect382Roadtest for the aspectSprings tran384ion management39014.5XML-driven tranion management391Annotation-driventranion management393AspectJ weaver-based tranionmanagement39414.6Implementing fault tolerance for tranional

49、operations395Base aspect395Using the annotation-driven participantpattern397Configuring the aspect398Testing the fault- 401tolerance aspect399Improving the solution14.7Summary40215Securing applications40415.1Securing applications with conventional techniques405The-yourself approach405The framework-b

50、asedapproach40615.215.3Modularizing security using AOP406A quick overview of Spring Security407Authentication407Authorization40815.4Implementing a security solution from scratch409Implementing authentication aspects410Implementingauthorization aspects41315.515.6Implementing field-level authorization

51、421Spring Security prebuilt solutions425Web security security428425Service level security425Domain-objectDownload at WoWeBook.ComxviiCONTENTS15.7Additional ideas in implementing security428Auditing access429Filtering field content42915.8Summary42916Improving domain logic43116.1Empowering objects432Enabling rich behavior433Injecting dependencies with Springand AspectJ434Possibilities enabled by domain-object DI44216.2Implementing business logic447Improving inventory management447Checking for the o

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论