This Cloud Tutorial Series is intended to guide the reader through the development of a piece of software that draws on the latest technologies of the Java EE standard. We will program the application over several stages, starting with the Web layer and moving up to the persistence layer.
In the process, we will get to know more about the technologies used. This section will take a closer look at the software architecture, which mainly uses CDI, JSF, EJB and JPA. This target architecture will serve as a common thread running throughout the book.
Our architecture implements the MVC pattern. We’ll use JSF Facelets for the view, while CDI beans will function as “controllers”. For the model, we’ll use ordinary Java classes that implement standard entities. These standard entities implement the corresponding object-relational mapping using JPA annotations.
As an extension to the pure MVC pattern, we’ll use additional stateless service classes that manage the persistence of the entities and provide the actual business logic. This relieves the controller classes of having to perform these functions and separates the Web layer cleanly from the business layer, making it easy to add additional clients at a later date.
The implementation of the services is carried out by EJB session beans. The CDI beans gain access to these session beans via dependency injection and are addressed in Facelets using the EL. The CDI beans also use dependency injection to gain access to other CDI beans, and manage entities as part of their state.
Fig. I-6 Sequence diagram of the target architecture
The sequence diagram in Fig. 1-6 illustrates the routes of access between the various components. One of things we can do with the EL is to bind input components from forms to attributes of the beans (controller.model.attribute
).
We can also use EL to access the methods of CDI beans. These could include e.g. methods for controlling the actions of the application (controller.doSomeThing
).
Such a method can delegate functionalities for the execution of business logic to a session bean (e.g. a functionality for saving an entity (ejb.businessLogic
)).
Discussion
Use the message board below to give the authors your feedback or to discuss this page’s topic with other readers (in English please!). Please don’t expect the authors to answer directly, but they might update the content of this site according to your feedback.