Enterprise Java Development@TOPIC@

Chapter 22. Project 2 Technical Details

22.1. Data Tier and Business Logic Support
22.2. Module Layout
22.2.1. eLeague Modules
22.2.2. eClub Module(s)
22.3. EJB Tier
22.3.1. EJB Base Tier
22.3.2. EJB Business
22.3.3. eClub EJB Tier
22.3.4. Remote Interfaces
22.3.5. eClub/eLeague Integration
22.4. Transactions
22.5. Web UI
22.5.1. eLeague Web UI
22.5.2. eClub WEB UI Tier

Tip

It may be helpful to browse the grading criteria at the end of this assignment before reading through the specifications. This will give you a better idea of what has to be completed to achieve a passing grade. A perfect score for the assignment will require that the entire specification be implemented. A passing score will require the demonstration of understanding of specific concepts covered. You can conceivably do well in the grading if you tackle each of the technical areas at least once. Example: Don't focus so much on completing the steps of the end-to-end that you ignore the transaction and Web UI aspects of the assignment. Of course, the opposite is true. Don't ignore the end-to-end scenario and demonstrate functionality in a vacuum. The end-to-end scenario should provide plenty of chances to demonstrate required technical parts of this assignment.

Continue to provide all functionality from Project 1; especially the unit tests as you revise your earlier implementations For example, you should continue to have the ability to run the unit and end-to-end tests implemented in project 1. Make sure you design your project 2 testing such that it does not depend on database residue from project 1 tests.

Create a Maven module layout that will support the additional architecture layers of the assignment. It is intended that eLeague be implemented with a multi-module approach (to mimic a complex application) and eClub be implemented with very few (possibly one) modules (to mimic a simplistic application).

To implement the full project 2 assignment, you will eventually need your existing implementation module(s) and new modules to implement a remote client, EJB, WEB, EAR, and test concepts.


League Implementation Module(s)

These are your existing implementation module(s) from project 1. They are intended to remain mostly unchanged when working on project 2. They represent your core data and business logic and business decisions in getting this far. We want to keep project 2 focused on the technical aspects of deploying this capabilty to the server-side and leave the detailed business decisions behind.

LeagueClient Module

This new module is going to make available to external clients of eLeague. This will contain data transfer objects (DTOs) and JAX-RS client code to make implementing the client calls easier.

LeagueEJB Module

This new module will host the EJB components and define a META-INF/persistence.xml that is appropriate for use on the server-side. Most of the implementation of these components will be based on the project 1 implementation.

LeagueWAR Module

This new module will host the JAX-RS interface for eLeague and any Web UI that is developed.

LeagueEAR Module

This new module will package the EJB(s), WAR(s), and necessary JAR(s) in a single deployment to the server. It will define identity information for the EJB and WAR that will impact base JNDI and URI name paths generated to access the hosted components. It will also be a location where we exclude unecessary dependency JARs to trim the EAR of unecessary artifacts.

League Remote Test Module

This new module will deploy the EAR to the server and execute integration tests that use remote interfaces to verify eLeague functionality.

Create an EJB tier for both applications to host your server-side, transactional, and persistence logic. Security will be added in the next project.

The EJB tiers must host your persistence unit and supply a set of EJB components that will provide access to your server-side logic.

Remote interface to the two applications will be demonstrated using two technologies: Java Remote Method Invocation (RMI) and HTTP/REST-like (using JAX-RS). Any data transferred using either will be part of the Data Transfer Objects (DTOs). DTOs used with RMI will need to be Java Serializable. DTOs used with JAX-RS will need to be marshaled as XML or JSON.

DTOs and and any classes written to support the remote interface will be placed in a JAR module that can be easily used by clients. Since eClub does not have any clients and we want to limit its complexity -- only eLeague will require a separate client module to host these classes.

The primary focus for implementing remote interfaces will be HTTP/REST-like interfaces using JAX-RS (server and client APIs). The EJBs already provide an injectable component to complete the desired functionality. It is intended that you add a set of one or more classes that expose access to this functionality using JAX-RS.

A candidate set of resource collection URIs is shown below. Add a {resourceId} to address a specific resource from the collection. Add an additional property name or query parameter to address a specific property of the resource. Use the appropriate verb (GET, POST, PUT, DELETE), query parameters, and payloads to make the intended requests. Make use of appropriate status codes (e.g, 200, 201, 400, 404, and 500) to communicate the results.

There is no requirement that you specifically make use of the specific URIs listed or break root level resources into separate JAX-RS classes. It is your choice. It is suggested that all URIs be exposed under the "/api" root URI for the targeted application context. The details here are provided as concrete suggestions. In the end, the primary requirement for remote interfaces is:

Create or identify classes that will express information passed between client and server within the remote interfaces.

XML marshaling should be implemented with JAXB. JSON marshalling can be implemented with JSONB, but it is recommended to use jackson2 since JSONB is not supported in Wildfly until we reach JavaEE 8 compliance. Client-side JSONB and server-side jackson will work 95% of the time -- but there are some differences.

<!-- JSON wiring for RESTEasy JAX-RS provider (javaee7)-->
<dependency>
  <groupId>org.jboss.resteasy</groupId>
  <artifactId>resteasy-jackson2-provider</artifactId>
</dependency>

Add transaction properties to the EJBs.

Add separate server-side Web UI(s) to demonstrate integration between the Web UI and EJB Tiers. To meet this requirement -- you only have to implement *ONE* of the following in either eLeague or eClub.