Book Image

Developing Middleware in Java EE 8

Book Image

Developing Middleware in Java EE 8

Overview of this book

Middleware is the infrastructure in software based applications that enables businesses to solve problems, operate more efficiently, and make money. As the use of middleware extends beyond a single application, the importance of having it written by experts increases substantially. This book will help you become an expert in developing middleware for a variety of applications. The book starts off by exploring the latest Java EE 8 APIs with newer features and managing dependencies with CDI 2.0. You will learn to implement object-to-relational mapping using JPA 2.1 and validate data using bean validation. You will also work with different types of EJB to develop business logic, and with design RESTful APIs by utilizing different HTTP methods and activating JAX-RS features in enterprise applications. You will learn to secure your middleware with Java Security 1.0 and implement various authentication techniques, such as OAuth authentication. In the concluding chapters, you will use various test technologies, such as JUnit and Mockito, to test applications, and Docker to deploy your enterprise applications. By the end of the book, you will be proficient in developing robust, effective, and distributed middleware for your business.
Table of Contents (18 chapters)
Title Page
Copyright and Credits
Dedication
Packt Upsell
Contributors
Preface
Index

What is Java EE?


Java EE is a very popular platform for building enterprise solutions in the Java programming language. For many years, it has reached the top of the list of the most important enterprise application development platforms, with success in nearly all aspects of enterprise application development.

Java EE provides application developers with the following:

  • Application Server: A fully-featured middleware with all of the functionalities required to build enterprise applications
  • Java EE APIs: A set of APIs covering the common functionalities required by application developers to implement their enterprise solutions

Our role, as application developers and architects, is to design our solution as a set of components. Those components will use the Java EE APIs.

Enterprise applications

For me, enterprise applications was always a buzzy term. If we substituted enterprise with the word business, it would become business applications, which is, in fact, misleading and a far cry from the true meaning of the term.

The term enterprise applications refer to the type of applications that are used by a group of users. These types of applications include nearly everything around us—social networks, business applications, productivity applications, gaming, chatting, and so on. If we conduct a simple analysis of the commonalities between all of them, we will find that some of their common characteristics include:

  • The applications are used by a group of users, with different levels of authority over the provided functionalities
  • The applications require special scaling and resource management techniques to be applied in order to be able to handle heavy loads when the application gets more active users or more data
  • The application should run on a robust environment, robust enough to provide near 100% system availability
  • The applications manage an operational database, with hundreds or thousands of operations performed each second, while keeping our data consistent and responsive

Java EE is you a platform that fulfills all of the aforementioned requirements, and more, with declarative and easy-to-use methodologies. Rather than investing time and effort into those non-functional requirements, you'll build your applications above a middleware software, providing you with a ready-to-use implementation for all required services, leaving you free to focus on your business logic.

Java EE architecture

The Java EE platform follows the four-tier architecture, the tiers being as follows:

  • EIS tier: This is the enterprise information system (EIS) tier, where we store and retrieve all of our business data. Usually, it's a relational database system that's accessed using the Java Persistence API through our business tier, as will be discussed in detail in this book.
  • Business tier: The business tier is responsible for managing business components that expose functionalities to other modules or separate systems. Enterprise JavaBeans, messaging, and other services are maintained in this tier, which will be discussed in detail in this book.
  • Web tier: The web tier is where your web components/pages live. Although the Java's EE web profile is out of the scope of this book, we've used the web tier in many examples as well as in this chapter; therefore, basic knowledge about Servlets and JSP is essential.
  • Client tier: Either a thin client (web browser) or a thick one (another Java application) that consumes the services we provide in our enterprise middleware solution.

Note that, in this book, we'll be focusing more on the EIS and business tier parts of an enterprise middleware solution, the web part being out of the scope of this book.