Immediate download Java EE 8 Design Patterns and Best Practices 1st Edition Rhuan Rocha ebooks 2024
Immediate download Java EE 8 Design Patterns and Best Practices 1st Edition Rhuan Rocha ebooks 2024
com
https://ebookmeta.com/product/java-ee-8-design-patterns-and-
best-practices-1st-edition-rhuan-rocha/
OR CLICK HERE
DOWLOAD NOW
https://ebookmeta.com/product/react-18-design-patterns-and-best-
practices-fourth-edition-early-access-anonymous/
ebookmeta.com
https://ebookmeta.com/product/java-design-patterns-a-tour-of-23-gang-
of-four-design-patterns-in-java-1st-edition-vaskaran-sarcar/
ebookmeta.com
https://ebookmeta.com/product/the-genes-eye-view-of-evolution-1st-
edition-j-arvid-agren/
ebookmeta.com
The History of Britain and Ireland: Prehistory to Today
2nd Edition Kenneth L. Campbell
https://ebookmeta.com/product/the-history-of-britain-and-ireland-
prehistory-to-today-2nd-edition-kenneth-l-campbell/
ebookmeta.com
https://ebookmeta.com/product/wild-wastes-4-1st-edition-randi-darren-
william-d-arand/
ebookmeta.com
https://ebookmeta.com/product/dizzy-me-1st-edition-f-wuyts-t-
stadsbader/
ebookmeta.com
https://ebookmeta.com/product/beyond-the-veil-1st-edition-jeannie-
wycherley/
ebookmeta.com
https://ebookmeta.com/product/existential-group-counselling-and-
psychotherapy-1st-edition-karen-weixel-dixon/
ebookmeta.com
Hybrid Metal-Organic Framework and Covalent Organic
Framework Polymers (ISSN) 1st Edition Bo Wang
https://ebookmeta.com/product/hybrid-metal-organic-framework-and-
covalent-organic-framework-polymers-issn-1st-edition-bo-wang/
ebookmeta.com
Java EE 8 Design Patterns and
Best Practices
Rhuan Rocha
João Purificação
BIRMINGHAM - MUMBAI
Java EE 8 Design Patterns and Best
Practices
Copyright © 2018 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form
or by any means, without the prior written permission of the publisher, except in the case of brief quotations
embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented.
However, the information contained in this book is sold without warranty, either express or implied. Neither the
authors, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to
have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products
mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy
of this information.
ISBN 978-1-78883-062-1
www.packtpub.com
To my Aunt, Vanessa Rocha, for teaching me to have a calm look and observe the facts more
clearly. To my mother, Ivonete Rocha, for her sacrifices and power.
- Rhuan Rocha
To my two daughters, Carolina and Beatriz, who give me the energy to walk even further; to my
father, João Lobato, for his great wisdom and intelligence; and to my mother, Dinah, for her love
and affection.
- João Purificação
mapt.io
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as
well as industry leading tools to help you plan your personal development and advance
your career. For more information, please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical eBooks and Videos
from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
PacktPub.com
Did you know that Packt offers eBook versions of every book published, with PDF and
ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a
print book customer, you are entitled to a discount on the eBook copy. Get in touch with us
at service@packtpub.com for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a
range of free newsletters, and receive exclusive discounts and offers on Packt books and
eBooks.
Contributors
Layers 45
Tiers 47
The classic Business Delegate pattern scenario 48
The benefits of the Business Delegate pattern 51
Business Delegate – obsolete or not 52
Explaining the Session Façade pattern 53
Benefits of Session Façade 54
Implementing the Session Façade pattern in JEE 55
The classic Session Façade pattern scenario 55
Implementing the Session Façade pattern 58
Explaining the business-object pattern 70
Applications with complex business rules 71
Motivation for using the business-object pattern 73
Benefits of business-object pattern usage 73
Implementing the business-object pattern 75
Summary 78
Chapter 4: Integration Patterns 80
Explaining the concept of the integration tier 80
Explaining the concept of the data-access object pattern 81
Implementing the data-access object pattern 82
Implementing the entity with JPA 83
Implementing DAO 85
Explaining the concept of the domain-store pattern 88
Implementing the domain-store pattern 90
Implementing the PersistenceManagerFactory class 91
Implementing the PersistenceManager class 92
Implementing the EmployeeStoreManager class 95
Implementing the StageManager interface 96
Implementing the TransactionFactory class 98
Implementing the Transaction class 99
Implementing the EmployeeBusiness class 100
Explaining the concept of the service-activator pattern 101
Java Message Service (JMS) 102
EJB asynchronous methods 104
Asynchronous events – producers and observers 104
Implementing the service-activator pattern 106
Implementing sending and receiving messages with JMS 106
Implementing the EJB asynchronous methods 107
Implementing asynchronous events – producers and observers 108
Summary 109
Chapter 5: Aspect-Oriented Programming and Design Patterns 110
Aspect-oriented programming 111
Compile-time versus run-time AOP 111
AOP in JEE scenario – the interceptor 112
[ ii ]
Table of Contents
[ iii ]
Table of Contents
[ iv ]
Table of Contents
Logs 204
Admin processes 204
The API Gateway 205
The service-registry pattern 206
Config server 207
The circuit-breaker pattern 208
The circuit-breaker mechanism 209
Summary 210
Chapter 9: Security Patterns 211
Explaining the concept of security patterns 211
Explaining the concept of the single-sign-on pattern 212
Implementing the single-sign-on pattern 214
Implementing the AuthenticationResource class 215
Implementing the App1 and App2 classes 221
Explaining the authentication mechanism 225
Explaining basic authentication 226
Explaining form authentication 226
Explaining digest authentication 227
Explaining client authentication 227
Explaining mutual authentication 227
When to use the deployment descriptor, annotation, or programmatic
configuration 230
Implementing the authentication mechanism 230
Implementing the web.xml file 231
Implementing the HelloWorld class 232
Implementing the HelloWordServlet class 234
Explaining the authentication interceptor 235
Implementing the authentication interceptor 235
Implementing the CDI interceptor 236
Implementing the JAX-RS resource 242
Summary 243
Chapter 10: Deployment Patterns 244
Explaining the concept of deployment patterns 244
Explaining the concept of canary deployment 247
Defining the canary servers 248
Deploying the application to canary servers 249
Testing the application and verifying whether it satisfies our criteria 249
Deploying the application to remaining servers 250
Explaining the concept of blue/green deployment 250
Defining the group of servers to receive the first deployment 250
Deploying the application to a group of servers 251
Deploying the application to the remaining server 252
Explaining the concept of A/B testing 253
Defining a group of end users 254
[v]
Table of Contents
[ vi ]
Table of Contents
[ vii ]
Preface
Over time, the world of enterprise has invested more and more in technologies and
applications that optimize processes and help businesses increase their profits and improve
services or products. The enterprise environment has challenges that need to be faced to
implement good solutions, such as the high availability of services, the capacity to change
when needed, the capacity to scale services, and the capacity to process a large amount of
data. With this, new applications have been created to optimize processes and increase
profits. The Java language and Java EE are great tools for creating an application for the
enterprise environment, because, Java language is multiplatform, open source, widely
tested, and has a strong community and a strong ecosystem. Furthermore, the Java
language has Java EE, which is, an umbrella of specifications that permit us developer
enterprise application without depending on vendors. The development of enterprise
application has some well-known problems that occur over and over. These problems
involve the integration of services, the high availability of applications, and resilience.
This book will explain the concepts of Java EE 8, what its tiers are, and how to develop
enterprise applications using Java EE 8 best practices. Furthermore, this book will
demonstrate how we can use design patterns and enterprise patterns with Java EE 8, and
how we can optimize our solutions using aspect-oriented programming, reactive
programming, and microservices with Java EE 8. Throughout this book, we learn about
integration patterns, reactive patterns, security patterns, deployment patterns, and
operational patterns. At the end of this book, we will have an overview of MicroProfile and
how it can help us develop applications using microservices architecture.
Nantes, i. 101;
ceded to the Bretons, 102;
Angevin claims on, 116, 117;
attacked by Normans, 117;
counts and bishops, 121, 122;
seized by Conan, 146;
won by Fulk, 148;
Geoffrey Martel’s dealings with, 212;
union with Rennes, 449;
again independent, ib.;
seized by Conan IV. and claimed by Henry II., 450;
surrendered to Henry, 451;
significance of its acquisition, 452, 453;
Henry and Geoffrey at, ii. 58.
See Alan, Drogo, Geoffrey, Guerech, Hoel, Judicaël
Nest, daughter of Rees Ap-Tewdor, ii. 100, 453
Neubourg, i. 282, 470
Neufmarché, council at, i. 502
Newcastle-upon-Tyne, i. 37
Newark, i. 304
Niall of the Nine Hostages, ii. 84
Nicolas Breakspear or of Langley, i. 475, 476, 481.
See Adrian
Nigel, bishop of Ely and treasurer, i. 302;
defends Devizes, 304;
chancellor, 418;
treasurer again, ib.
Nomenoë, king of Britanny, i. 101
Nonancourt, treaty at, ii. 213
Nonant, see Hugh
Norfolk, see Hugh Bigod
Normandy, duchy of, i. 111;
confusion under Robert Curthose, 11;
campaigns of Henry I. in, 11–13;
relations with England, 13, 23, 24;
with France, 24;
invaded by Henry of France, 210, 213;
claimed by Matilda, 276;
invaded by Geoffrey, 281, 306–308;
offered to Theobald of Blois, 282, 337;
Stephen in, 286;
granted to his son, ib.;
conquered by Geoffrey, 338–342;
ceded to Henry Fitz-Empress, 369, 377;
attacked by Louis VII. and Eustace, 385, 386, 394;
inquest on ducal demesnes, ii. 128;
rebels in (1173), 138, 139;
attacked by Louis etc., 143;
loyal barons in (1173), 146;
Henry’s administration in, 192–194;
laid under interdict, 315, 380;
submits to Philip, 424, 425;
dukes of, their claims upon Maine, i. 124, 203, 216.
See Geoffrey, Henry, Hrolf, John, Richard, Robert, William
Normans destroy Fleury, i. 112;
attack Nantes, 117;
fusion of Normans and English, 24, 48, 49; ii. 489, 490
“Normans” and “English,” different meanings of, i. 23, 24
Northallerton, i. 289