Middleware Architecture with Patterns and Frameworks
Total Page:16
File Type:pdf, Size:1020Kb
Middleware Architecture with Patterns and Frameworks Sacha Krakowiak Distributed under a Creative Commons license http://creativecommons.org/licenses/by-nc-nd/3.0/ February 27, 2009 Contents Preface ix References........................................ x 1 An Introduction to Middleware 1-1 1.1 Motivation for Middleware . 1-1 1.2 CategoriesofMiddleware . 1-6 1.3 A Simple Instance of Middleware: Remote Procedure Call . ......... 1-7 1.3.1 Motivations and Requirements . 1-8 1.3.2 Implementation Principles . 1-9 1.3.3 Developing Applications with RPC . 1-11 1.3.4 SummaryandConclusions. .1-13 1.4 Issues and Challenges in Middleware Design . 1-14 1.4.1 DesignIssues ...............................1-14 1.4.2 Architectural Guidelines . 1-15 1.4.3 Challenges ................................1-17 1.5 HistoricalNote .................................. 1-18 References........................................1-19 2 Middleware Principles and Basic Patterns 2-1 2.1 ServicesandInterfaces . 2-1 2.1.1 Basic Interaction Mechanisms . 2-2 2.1.2 Interfaces ................................. 2-3 2.1.3 Contracts and Interface Conformance . 2-5 2.2 ArchitecturalPatterns . 2-9 2.2.1 Multilevel Architectures . 2-9 2.2.2 DistributedObjects . .. .. .. .. .. .. .. .2-12 2.3 Patterns for Distributed Object Middleware . 2-15 2.3.1 Proxy ...................................2-15 2.3.2 Factory ..................................2-16 2.3.3 Adapter..................................2-18 2.3.4 Interceptor ................................2-19 2.3.5 Comparing and Combining Patterns . 2-20 2.4 Achieving Adaptability and Separation of Concerns . ..........2-21 2.4.1 Meta-ObjectProtocols. 2-21 2.4.2 Aspect-Oriented Programming . 2-23 ii CONTENTS 2.4.3 PragmaticApproaches. .2-25 2.4.4 ComparingApproaches . .2-26 2.5 HistoricalNote .................................. 2-26 References........................................2-27 3 Naming and Binding 3-1 3.1 Names.......................................3-1 3.1.1 NamingContexts. ............................ 3-4 3.1.2 NameResolution.............................. 3-8 3.2 Patterns for Distributed Name Services . 3-11 3.2.1 Problems and Techniques of Distributed Naming . 3-11 3.2.2 Naming Services in a Slowly Changing World . 3-12 3.2.3 Dynamic Service Discovery Services . 3-16 3.3 Binding ......................................3-20 3.3.1 ExamplesandBasicTechniques. 3-21 3.3.2 AModelforDistributedBinding . 3-23 3.3.3 The export-bind Pattern........................3-25 3.3.4 Putting it All Together: A Model for Service Provision . 3-27 3.4 Case Study: Jonathan: a Kernel for Distributed Binding . ..........3-28 3.4.1 DesignPrinciples.............................3-29 3.4.2 NamingandBindinginJonathan. 3-29 3.4.3 Examples .................................3-32 3.5 HistoricalNote .................................. 3-35 References........................................3-36 4 Communication 4-1 4.1 IntroducingCommunicationSystems . 4-1 4.1.1 Single Message, Reliable Channel . 4-2 4.1.2 Multiple Receivers and Messages, Unreliable Channel ........ 4-4 4.2 ApplicationRequirements . 4-7 4.2.1 QualityofService ............................ 4-7 4.2.2 Availability ................................ 4-8 4.2.3 Security .................................. 4-9 4.3 Communication Systems Architecture . 4-9 4.3.1 ProtocolsandLayering . .4-10 4.3.2 TheProtocolsoftheInternet . 4-11 4.4 Middleware and Application-level Protocols . .........4-13 4.4.1 OverlayNetworks ............................4-13 4.4.2 GossipProtocols .............................4-15 4.5 BuildingaCommunicationSystem . 4-16 4.5.1 The x-kernel, an Object-based Framework for Protocols . 4-17 4.5.2 Component-based Frameworks for Protocols . 4-18 4.6 Case Study: the Jonathan Communication Framework . 4-23 4.6.1 Principles of the Communication Framework . 4-24 4.6.2 TheTCP-IPProtocol . .4-27 4.6.3 Other Communication Protocols . 4-34 CONTENTS iii 4.6.4 Conclusion ................................4-41 4.7 HistoricalNote .................................. 4-41 References........................................4-42 5 Distributed Objects 5-1 5.1 DistributingObjects . .. .. .. .. .. .. .. .. 5-1 5.1.1 Overview ................................. 5-1 5.1.2 Remote Object Call: a First Outline . 5-3 5.1.3 TheUser’sView ............................. 5-4 5.2 RemoteObjectCall: aCloserView. 5-5 5.2.1 ObjectReferences ............................ 5-6 5.2.2 TheObjectInvocationPath. 5-8 5.2.3 ObjectAdapters ............................. 5-9 5.2.4 ParameterPassing .. .. .. .. .. .. .. .. .5-10 5.3 InsideanObjectRequestBroker . 5-11 5.3.1 The Mechanics of Object Invocation . 5-11 5.3.2 BindinginanORB............................5-13 5.3.3 IntroductiontotheCaseStudies . 5-14 5.4 AnImplementationofJavaRMI . 5-15 5.4.1 IntroducingJavaRMI . .5-15 5.4.2 Developing an RMI Application . 5-17 5.4.3 TheInnerWorkingofJeremie. 5-19 5.5 AnImplementationofCORBA . 5-21 5.5.1 IntroducingCORBA. .5-22 5.5.2 Developing a CORBA Application . 5-23 5.5.3 TheInnerWorkingofDavid . .5-26 5.6 ComplementsandExtensions . 5-28 5.7 HistoricalNote .................................. 5-28 References........................................5-28 6 Coordination and Events 6-1 6.1 IntroducingCoordination . 6-1 6.1.1 Motivation and Requirements . 6-1 6.1.2 Terminology ............................... 6-2 6.2 PatternsforCoordination . 6-3 6.2.1 Observer ................................. 6-3 6.2.2 Publish-Subscribe ............................ 6-5 6.2.3 SharedDataspace ............................ 6-6 6.2.4 Extra-Functional Properties . 6-7 6.2.5 Comparing the Coordination Patterns . 6-8 6.3 Event-based Communication . 6-8 6.3.1 Event Mediator Architecture . 6-9 6.3.2 EventFiltering ..............................6-10 6.3.3 Notification Diffusion . 6-10 6.3.4 Examples .................................6-11 6.4 MessageQueuing.................................6-12 iv CONTENTS 6.4.1 MessageQueuingPrinciples . 6-12 6.4.2 Message Queuing Implementation . 6-12 6.4.3 Examples .................................6-13 6.5 CoordinationthroughSharedObjects . 6-13 6.6 ActiveObjectsandAgents . 6-13 6.7 WebServicesCoordination . 6-13 6.8 Case Study: Joram, a Message-Oriented Middleware . 6-13 6.9 HistoricalNote .................................. 6-13 References........................................6-14 7 Composition 7-1 7.1 FromObjectstoComponents . 7-1 7.2 RequirementsforComponents. 7-4 7.2.1 Requirements for a Component Model . 7-4 7.2.2 Requirements for a Component Infrastructure . 7-6 7.3 Architectural Description . 7-7 7.3.1 Compositional Entities . 7-8 7.3.2 Architecture Description Languages . 7-9 7.3.3 Examples of Connection Patterns . 7-12 7.3.4 Software Engineering Considerations . 7-15 7.4 ElementsofaComponentModel . 7-15 7.4.1 NamingandVisibility . .7-16 7.4.2 ComponentTypingandConformance . 7-16 7.4.3 BindingandConfiguration . .7-17 7.4.4 ComponentLifecycle. .7-18 7.4.5 ComponentControl . .7-20 7.5 Patterns and Techniques for Component Frameworks . 7-22 7.5.1 Functions of a Component Framework . 7-22 7.5.2 Inversion of Control and Dependency Injection . 7-23 7.5.3 Factories .................................7-26 7.5.4 Interceptors................................7-27 7.5.5 Reflective Component Frameworks . 7-28 7.6 Fractal: a Model and Framework for Components . 7-30 7.6.1 TheFractalModel ............................7-31 7.6.2 Fractal Implementation Frameworks . 7-35 7.6.3 FractalADL ...............................7-37 7.7 OSGi: ADynamicServicePlatform . 7-41 7.7.1 TheOSGiComponentModel . .7-41 7.7.2 Dynamic Service Management in OSGi . 7-43 7.7.3 OSGi Standard Services, Implementations and Extensions . 7-44 7.8 HistoricalNote .................................. 7-45 References........................................7-46 8 Persistence 8-1 CONTENTS v 9 Transactions 9-1 9.1 Motivations and Main Concepts . 9-1 9.2 ConcurrencyControl.............................. 9-4 9.2.1 Serializability ............................... 9-4 9.2.2 Locking .................................. 9-7 9.2.3 AdditionalIssues .............................9-10 9.3 Recovery......................................9-12 9.3.1 Buffer Management . 9-13 9.3.2 Logging ..................................9-14 9.4 DistributedTransactions. 9-15 9.4.1 AtomicCommitment. .9-16 9.4.2 Two-phaseCommit . .. .. .. .. .. .. .. .9-17 9.4.3 Non-Blocking Commitment Protocols . 9-18 9.4.4 OptimizingTwo-phaseCommit . 9-20 9.5 Advanced Transaction Models . 9-21 9.5.1 NestedTransactions . .9-22 9.5.2 Sagas ...................................9-23 9.6 TransactionalMiddleware . 9-24 9.6.1 Transaction Management in JEE . 9-25 9.6.2 Web Services Transactions . 9-26 9.6.3 Advances in Transactional Middleware . 9-29 9.7 GoTM, a Framework for Transaction Services . 9-29 9.7.1 ArchitectureofGoTM . .9-30 9.7.2 Implementation of GoTM . 9-32 9.7.3 UsingGoTM ...............................9-34 9.8 HistoricalNote .................................. 9-35 References........................................9-36 10 Systems Management 10-1 10.1 Main Concepts and Terminology . 10-1 10.1.1 IntroducingManagement . 10-1 10.1.2 Designing and Implementing Management Functions . 10-3 10.1.3 Basic Functions of Systems Management . 10-6 10.1.4 The Challenges of Management . 10-11 10.2 AutonomicComputing. 10-12 10.2.1 Systems Management as a Control Process . 10-13 10.2.2 Architectural Aspects of Autonomic Computing . 10-14 10.2.3 Principles and Patterns of Self-Management . 10-16 10.2.4 Frameworks for Actuators . 10-18 10.2.5 Conclusion ................................10-19 10.3 ObservationandMonitoring. 10-20 10.3.1 Requirements for Observation and Monitoring . 10-20 10.3.2 Patterns for Observation and Monitoring . 10-20 10.3.3 Frameworks for Observation and Monitoring . 10-22 10.4 ConfigurationandDeployment . ..