• Stars
    star
    342
  • Rank 123,697 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 5 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The project demonstrates how you can develop applications with Jakarta EE using widely adopted architectural best practices like Domain-Driven Design (DDD).

Eclipse Cargo Tracker - Applied Domain-Driven Design Blueprints for Jakarta EE

The project demonstrates how you can develop applications with Jakarta EE using widely adopted architectural best practices like Domain-Driven Design (DDD). The project is directly based on the well known original Java DDD sample application developed by DDD pioneer Eric Evans' company Domain Language and the Swedish software consulting company Citerus. The cargo example actually comes from Eric Evans' seminal book on DDD. The original application is written in Spring, Hibernate and Jetty whereas the application is built on Jakarta EE.

The application is an end-to-end system for keeping track of shipping cargo. It has several interfaces described in the following sections.

For further details on the project, please visit: https://eclipse-ee4j.github.io/cargotracker/.

A slide deck introducing the fundamentals of the project is available on the official Eclipse Foundation Jakarta EE SlideShare account. A recording of the slide deck is available on the official Jakarta EE YouTube account.

Eclipse Cargo Tracker cover

Getting Started

The project website has detailed information on how to get started.

The simplest steps are the following (no IDE required):

  • Get the project source code.
  • Ensure you are running Java SE 11 or Java SE 17.
  • Make sure JAVA_HOME is set.
  • As long as you have Maven set up properly, navigate to the project source root and type: mvn clean package cargo:run
  • Go to http://localhost:8080/cargo-tracker

To set up in Visual Studio Code, follow these steps:

  • Set up Java SE 11, or Java SE 17, Visual Studio Code and Payara 6. You will also need to set up the Extension Pack for Java and Payara Tools in Visual Studio Code.
  • Make sure JAVA_HOME is set.
  • Open the directory that contains the code in Visual Studio Code. Visual Studio Code will do the rest for you, it will automatically configure a Maven project. Proceed with clean/building the application.
  • After the project is built (which will take a while the very first time as Maven downloads dependencies), simply run the generated cargo-tracker.war file under the target directory using Payara Tools.

Exploring the Application

After the application runs, it will be available at: http://localhost:8080/cargo-tracker/. Under the hood, the application uses a number of Jakarta EE features including Faces, CDI, Enterprise Beans, Persistence, REST, Batch, JSON Binding, Bean Validation and Messaging.

There are several web interfaces, REST interfaces and a file system scanning interface. It's probably best to start exploring the interfaces in the rough order below.

The tracking interface let's you track the status of cargo and is intended for the general public. Try entering a tracking ID like ABC123 (the application is pre-populated with some sample data).

The administrative interface is intended for the shipping company that manages cargo. The landing page of the interface is a dashboard providing an overall view of registered cargo. You can book cargo using the booking interface. Once cargo is booked, you can route it. When you initiate a routing request, the system will determine routes that might work for the cargo. Once you select a route, the cargo will be ready to process handling events at the port. You can also change the destination for cargo if needed or track cargo.

The Handling Event Logging interface is intended for port personnel registering what happened to cargo. The interface is primarily intended for mobile devices, but you can use it via a desktop browser. The interface is accessible at this URL: http://localhost:8080/cargo-tracker/event-logger/index.xhtml. For convenience, you could use a mobile emulator instead of an actual mobile device. Generally speaking cargo goes through these events:

  • It's received at the origin location.
  • It's loaded and unloaded onto voyages on it's itinerary.
  • It's claimed at it's destination location.
  • It may go through customs at arbitrary points.

While filling out the event registration form, it's best to have the itinerary handy. You can access the itinerary for registered cargo via the admin interface. The cargo handling is done via Messaging for scalability. While using the event logger, note that only the load and unload events require as associated voyage.

You should also explore the file system based bulk event registration interface. It reads files under /tmp/uploads. The files are just CSV files. A sample CSV file is available under src/test/sample/handling_events.csv. The sample is already set up to match the remaining itinerary events for cargo ABC123. Just make sure to update the times in the first column of the sample CSV file to match the itinerary as well.

Sucessfully processed entries are archived under /tmp/archive. Any failed records are archived under /tmp/failed.

Don't worry about making mistakes. The application is intended to be fairly error tolerant. If you do come across issues, you should report them.

You can simply remove ./cargo-tracker-data from the file system to restart fresh. This directory will typically be under $your-payara-installation/glassfish/domains/domain1/config.

You can also use the soapUI scripts included in the source code to explore the REST interfaces as well as the numerous unit tests covering the code base generally. Some of the tests use Arquillian.

Exploring the Code

As mentioned earlier, the real point of the application is demonstrating how to create well architected, effective Jakarta EE applications. To that end, once you have gotten some familiarity with the application functionality the next thing to do is to dig right into the code.

DDD is a key aspect of the architecture, so it's important to get at least a working understanding of DDD. As the name implies, Domain-Driven Design is an approach to software design and development that focuses on the core domain and domain logic.

For the most part, it's fine if you are new to Jakarta EE. As long as you have a basic understanding of server-side applications, the code should be good enough to get started. For learning Jakarta EE further, we have recommended a few links in the resources section of the project site. Of course, the ideal user of the project is someone who has a basic working understanding of both Jakarta EE and DDD. Though it's not our goal to become a kitchen sink example for demonstrating the vast amount of APIs and features in Jakarta EE, we do use a very representative set. You'll find that you'll learn a fair amount by simply digging into the code to see how things are implemented.

Cloud Demo

Cargo Tracker is deployed to Kubernetes on the cloud using GitHub Actions workflows. You can find the demo deployment on the Scaleforce cloud (https://cargo-tracker.j.scaleforce.net). This project is very thankful to our sponsors Jelastic and Scaleforce for hosting the demo! The deployment and all data is refreshed nightly. On the cloud Cargo Tracker uses PostgreSQL as the database. The GitHub Container Registry is used to publish Docker images.

Jakarta EE 8

A Jakarta EE 8, Java SE 8, Payara 5 version of Cargo Tracker is available under the 'jakartaee8' branch.

Java EE 7

A Java EE 7, Java SE 8, Payara 4.1 version of Cargo Tracker is available under the 'javaee7' branch.

Contributing

This project complies with the Google Style Guides for Java, JavaScript, and HTML/CSS. You can use the google-java-format tool to help you comply with the Google Java Style Guide. You can use the tool with most major IDEs such as Eclipse, Visual Studio Code, and IntelliJ.

In general for all files we use a column/line width of 80 whenever possible and we use 2 spaces for indentation. All files must end with a new line. Please adjust the formatting settings of your IDE accordingly. You are encouraged but not required to use HTML Tidy and CSS Tidy to help format your code.

For further guidance on contributing including the project roadmap, please look here.

Known Issues

  • When using Visual Studio Code, please make sure that the JAVA_HOME environment variable is correctly set up. If it is not configured properly, you will be unable to select a domain when adding a Payara Server instance in Visual Studio Code.
  • Currently, we are utilizing the most recent Payara version, which is 6.2023.8. It is important to note that this particular version is functioning correctly when paired with JDK 11. However, it is experiencing compatibility issues with JDK 17. Therefore, we recommend continuing to use JDK 11 in conjunction with Payara 6.2023.8 for optimal performance and stability for now. This issue will be resolved in a subsequent Payara release.
  • Presently, Jakarta EE 10 and Payara 6 encounters operational challenges within Eclipse IDE. Consequently, we have adopted Visual Studio Code as an alternative. We wholeheartedly welcome contributions aimed at rectifying the compatibility disparity within Eclipse IDE. Your input towards resolving this issue would be greatly appreciated.
  • You may get a log message stating that Payara SSL certificates have expired. This won't get in the way of functionality, but it will stop log messages from being printed to the IDE console. You can solve this issue by manually removing the expired certificates from the Payara domain, as explained here.
  • If you restart the application a few times, you will run into a bug causing a spurious deployment failure. While the problem can be annoying, it's harmless. Just re-run the application (make sure to completely un-deploy the application and shut down Payara first).
  • Sometimes when the server is not shut down correctly or there is a locking/permissions issue, the H2 database that the application uses get's corrupted, resulting in strange database errors. If this occurs, you will need to stop the application and clean the database. You can do this by simply removing the cargo-tracker-data directory from the file system and restarting the application. This directory will typically be under $your-payara-installation/glassfish/domains/domain1/config.

More Repositories

1

jersey

Eclipse Jersey Project - Read our Wiki:
Java
689
star
2

glassfish

Eclipse GlassFish
Java
377
star
3

ee4j

Eclipse EE4J Top-level Project and community related issues
276
star
4

jaxb-ri

Jaxb RI
Java
202
star
5

yasson

Eclipse Yasson project
Java
201
star
6

eclipselink

Eclipselink project
Java
196
star
7

mojarra

Mojarra, a Jakarta Faces implementation
Java
160
star
8

grizzly

Grizzly
Java
147
star
9

jakartaee-examples

Jakarta EE Examples
Java
124
star
10

tyrus

Tyrus
Java
112
star
11

jakartaee-tutorial

Jakarta EE Tutorial
Ruby
96
star
12

glassfish-hk2

Dynamic dependency injection framework
Java
84
star
13

metro-jax-ws

metro-jax-ws
Java
71
star
14

soteria

Soteria, a Jakarta Security implementation
Java
57
star
15

angus-mail

Angus Mail
Java
53
star
16

krazo

Java
50
star
17

openmq

OpenMQ
Java
50
star
18

starter

Eclipse Starter for Jakarta EE
HTML
50
star
19

glassfish-samples

Java
32
star
20

jakartaee-firstcup-examples

Java
31
star
21

orb

Eclipse ORB is a CORBA orb for use in Jakarta EE and GlassFish and other projects that still need an ORB.
Java
23
star
22

glassfish-concurro

Eclipse Concurrō project
Java
14
star
23

jaxb-istack-commons

Java
13
star
24

metro-saaj

Java
13
star
25

jakartaee-firstcup

First Cup of Jakarta EE Tutorial
CSS
13
star
26

exousia

Exousia, a Jakarta Authorization implementation
Java
11
star
27

parsson

Parsson Project
Java
10
star
28

expressly

Expressly, a Jakarta Expression Language implementation
Java
9
star
29

odi

Open DI
Java
8
star
30

jaxb-fi

Java
8
star
31

jakartaee-tck-tools

Java
7
star
32

wasp

WaSP, a Jakarta Pages implementation
Java
7
star
33

jaxb-stax-ex

Java
7
star
34

grizzly-ahc

Java
7
star
35

jaxb-dtd-parser

Java
7
star
36

metro-wsit

metro-wsit
Java
6
star
37

glassfish-fighterfish

FighterFish project
Java
6
star
38

ee4j-website

Website for the Eclipse EE4J Top Level Project
PHP
6
star
39

eclipselink-workbench

eclipselink-workbench
Java
6
star
40

epicyro

Epicyro, a Jakarta Authentication implementation
Java
6
star
41

angus-activation

Angus Activation
Java
5
star
42

glassfish-shoal

Shoal
Java
5
star
43

glassfish.docker

Official supported GlassFish docker
Dockerfile
5
star
44

jakartaee-release

This repository will be used to help manage the various Jakarta EE releases. No deliverable code will be housed in this repository -- only Issues, PRs, Tools, etc in support of delivering a release
Shell
5
star
45

orb-gmbal-pfl

Java
4
star
46

eclipselink-examples

eclipselink-examples
Java
4
star
47

glassfish-maven-embedded-plugin

Glassfish maven embedded plugin
Java
4
star
48

glassfish-jsftemplating

JSFTemplating project
Java
4
star
49

glassfish-security-plugin

Java
4
star
50

glassfish-repackaged

GlassFish repackaged 3rd party
3
star
51

glassfish-hk2-extra

HK2 extra
Java
3
star
52

glassfish-woodstock

GlassFish Woodstock UI components
Java
3
star
53

jersey.github.io

Jersey project
3
star
54

metro-mimepull

Metro mimepull
Java
3
star
55

glassfish-build-maven-plugin

GlassFish Build Maven Plugin
Java
3
star
56

glassfish-logging-annotation-processor

Java
2
star
57

glassfish-cdi-porting-tck

Java
2
star
58

glassfish-copyright-plugin

Java
2
star
59

glassfish-spec-version-maven-plugin

API Specification Version Maven Plugin
Java
2
star
60

jax-rpc-ri

JAX RPC Implementation (Eclipse Metro Project)
Java
2
star
61

eclipselink-oracleddlparser

eclipselink-oracleddlparser
Java
2
star
62

orb-gmbal-commons

Java
2
star
63

genericmessagingra

Java
2
star
64

grizzly-memcached

Grizzly-memcached
Java
2
star
65

glassfish-doc-plugin

Java
2
star
66

mojarra-jsf-extensions

Java
1
star
67

grizzly-thrift

Grizzly-thrift
Java
1
star
68

jersey-web

The source repository for
HTML
1
star
69

management-api

Jakarta Management
Java
1
star
70

glassfish-ha-api

glassfish-ha-api
Java
1
star
71

metro-xmlstreambuffer

Metro xmlstreambuffer
Java
1
star
72

metro-package-rename-task

Metro package rename
Java
1
star
73

jax-rpc-api

Jakartaee-stable project
Java
1
star
74

jakartaee-renames

1
star
75

glassfish-docs

HTML
1
star
76

gransasso

Eclipse Gransasso Repository
1
star
77

krazo-extensions

Java
1
star
78

debugging-support-for-other-languages-tck

Java
1
star
79

cditck-porting

Standard ML
1
star
80

ditck-porting

Shell
1
star
81

bvtck-porting

Glassfish Bean Validation 2.0 porting kit
Standard ML
1
star