Author(s): Rhuan Rocha
Publisher: Packt
Year: 2020
Language: English
Tags: java design patterns web
Cover
Title Page
Copyright and Credits
Dedication
Packt Upsell
Contributors
Table of Contents
Preface
Chapters 1: Introduction to Design Patterns
Explaining design patterns
Explaining the Gang of Four design patterns
The catalog of Gang of Four design patterns
Understanding the advantages of design patterns
Understanding the basic design patterns of the Java world
Explaining Singleton
Explaining Abstract Factory
Explaining Facade
Explaining Iterator
Explaining Proxy
Explaining enterprise patterns
Defining the difference between design patterns and enterprise patterns
Summary
Chapters 2: Presentation Patterns
Explaining the presentation tier
Explaining intercepting filter pattern
Implementing the intercepting filter pattern using Java EE 8
Implementing LogAccessFilter
Implementing LogBrowserFilter
Deciding filter mapping
Explaining the FrontController pattern
Implementing FrontController
Implementing the commands
The application controller pattern
Implementing DownloadFrontController
Implementing DownloadApplicationController
Implementing commands
The difference between the application controller and front controller patterns
Summary
Chapters 3: Business Patterns
Understanding the business tier
Explaining the Business Delegate pattern
Client tier, presentation tier, and business tier
Layers
Tiers
The classic Business Delegate pattern scenario
The benefits of the Business Delegate pattern
Business Delegate – obsolete or not
Explaining the Session Façade pattern
Benefits of Session Façade
Implementing the Session Façade pattern in JEE
The classic Session Façade pattern scenario
Implementing the Session Façade pattern
Explaining the business-object pattern
Applications with complex business rules
Motivation for using the business-object pattern
Benefits of business-object pattern usage
Implementing the business-object pattern
Summary
Chapters 4: Integration Patterns
Explaining the concept of the integration tier
Explaining the concept of the data-access object pattern
Implementing the data-access object pattern
Implementing the entity with JPA
Implementing DAO
Explaining the concept of the domain-store pattern
Implementing the domain-store pattern
Implementing the PersistenceManagerFactory class
Implementing the PersistenceManager class
Implementing the EmployeeStoreManager class
Implementing the StageManager interface
Implementing the TransactionFactory class
Implementing the Transaction class
Implementing the EmployeeBusiness class
Explaining the concept of the service-activator pattern
Java Message Service (JMS)
EJB asynchronous methods
Asynchronous events – producers and observers
Implementing the service-activator pattern
Implementing sending and receiving messages with JMS
Implementing the EJB asynchronous methods
Implementing asynchronous events – producers and observers
Summary
Chapters 5: Aspect-Oriented Programming and Design Patterns
Aspect-oriented programming
Compile-time versus run-time AOP
AOP in JEE scenario – the interceptor
A brief word about CDI and beans
The bean
Managed beans in CDI
Loose coupling
Interceptors in the JEE platform
EJB interceptor implementation
Intercepting method invocation
Interceptor class and multiple method interceptors
Intercepting life cycle callback events
CDI interceptor implementation
Decorator
The decorator pattern
The decorator in a JEE scenario
Decorator implementation
Summary
Chapters 6: Reactive Patterns
Explaining the concept of an event in CDI
Implementing an event in CDI
Implementing the FileUploadResource class
Bean sent on the event
Qualifier to select the JpgHandler observer to react to an event
Qualifier to select the PdfHandler observer to react to an event
Qualifier to select the ZipHandler observer to react to an event
The FIleUploadResource class
Implementing observers
Explaining the concept of an asynchronous EJB method
Difference between an asynchronous EJB method and an event in CDI
Implementing an asynchronous EJB method
Implementing EJBs
Implementing the FileUploadResource class
Calling an asynchronous EJB method to save a PDF
Calling an asynchronous EJB method to save a JPG
Calling an asynchronous EJB method to save a ZIP
Explaining the concept of an asynchronous REST service
Implementing an asynchronous REST service
Implementing the EJBs
Implementing the FileUploadResource class
Implementing the client API
Summary
Chapters 7: Microservice Patterns
Explaining microservices patterns
Inside a monolithic application
Difficulty in implementing new features and fixing bugs
Long application startup time
Inefficient continuous deployment
Low reliability
Difficulty using new frameworks and technologies
The scale cube
What microservices actually are
Microservices are not a silver bullet
Explaining how microservices architecture works
The application is decomposed into smaller components
Multitask teams
Product focus
Simpler and smarter processing
Decentralized governance of libraries and APIs
Single responsibility principle
Fault tolerance
Evolutionary systems
Decentralized data
Explaining when to use microservices architecture
How to decompose an application into microservices
Identifying microservices
Taking care of the process of extracting application modules that are candidates for microservices
Establishing a hexagonal model for the application
Advantages and drawbacks of a microservices-based application
Microservices architecture patterns
Aggregator pattern
Proxy pattern
Chained pattern
Branch pattern
Asynchronous pattern
Implementing microservices
Summary
Chapters 8: Cloud-Native Application Patterns
Explaining the concept of cloud-native applications
Explaining the goals of the cloud-native application
Explaining the cloud design patterns
Composite application (microservices)
Abstraction
Twelve-factor
Codebase
Dependencies
Config
Backing services
Build, release, run
Processes
Port-binding
Concurrency
Disposability
Dev/prod parity
Logs
Admin processes
The API Gateway
The service-registry pattern
Config server
The circuit-breaker pattern
The circuit-breaker mechanism
Summary
Chapters 9: Security Patterns
Explaining the concept of security patterns
Explaining the concept of the single-sign-on pattern
Implementing the single-sign-on pattern
Implementing the AuthenticationResource class
Implementing the App1 and App2 classes
Explaining the authentication mechanism
Explaining basic authentication
Explaining form authentication
Explaining digest authentication
Explaining client authentication
Explaining mutual authentication
When to use the deployment descriptor, annotation, or programmatic configuration
Implementing the authentication mechanism
Implementing the web.xml file
Implementing the HelloWorld class
Implementing the HelloWordServlet class
Explaining the authentication interceptor
Implementing the authentication interceptor
Implementing the CDI interceptor
Implementing the JAX-RS resource
Summary
Chapters 10: Deployment Patterns
Explaining the concept of deployment patterns
Explaining the concept of canary deployment
Defining the canary servers
Deploying the application to canary servers
Testing the application and verifying whether it satisfies our criteria
Deploying the application to remaining servers
Explaining the concept of blue/green deployment
Defining the group of servers to receive the first deployment
Deploying the application to a group of servers
Deploying the application to the remaining server
Explaining the concept of A/B testing
Defining a group of end users
Defining the servers to receive a new version
Deploying the new version
Evaluating the impact of a new version
Explaining the concept of continuous deployment
Summary
Chapters 11: Operational Patterns
Explaining the concept of operational patterns
Explaining the concept of performance and scalability patterns
The cache-aside pattern
When to use the cache-aside pattern
The lifetime of cached data
Evicting data
Priming the cache
Consistency
Local (in-memory) caching
The CQRS pattern
When to use the CQRS pattern
The event sourcing pattern
Understanding the event of event sourcing
Promoting performance
Promoting decoupling
Promoting scalability
Promoting auditing
Explaining the index table pattern
The materialized view pattern
Rebuilding the materialized view
When to use the materialized view pattern
Explaining the sharding pattern
When to use the sharding pattern
Explaining the concept of management and monitoring patterns
The ambassador pattern
When to use the ambassador pattern
Explaining the health endpoint monitoring pattern
When to use the health endpoint monitoring pattern
Explaining the external configuration store pattern
When to use the external configuration store pattern
Summary
Chapters 12: MicroProfile
Explaining the Eclipse MicroProfile project approach
Eclipse MicroProfile Config 1.3
Eclipse MicroProfile Fault Tolerance 1.1
Eclipse MicroProfile Health Check 1.0
Eclipse MicroProfile JWT authentication 1.1
Eclipse MicroProfile Metrics 1.1
Eclipse MicroProfile OpenAPI 1.0
Eclipse MicroProfile OpenTracing 1.1
Eclipse MicroProfile REST Client 1.1
CDI 2.0
Common annotations 1.3
JAX-RS 2.1
JSON-B 1.0
JSON-P 1.1
Why should we use the MicroProfile project?
Community
Future work
Summary
Other Books You May Enjoy
Index