/TicketManorJava

Move maintenance here since LT discontinued Course 936.

Primary LanguageJavaMIT LicenseMIT

TicketManor

[This repo takes over the mantle of TicketManor from the previous LearningTree site, since Learning Tree discontinued their Course 936, Enterprise Java, for which this website was the sample application foundation. It was used as a showcase in the course offered by Learning Tree, the world leader in instructor-led tecnical training. Learning Tree still offers some courses in Java as well as many other enterprise applications.]

This is a demo application of building enterprise applications using Java EE. There are a variety of APIs used, e.g., Java EE (JPA, EJB), Spring Framework, modern SPA Web (Angular, Ember.JS), and so on. Each major framework has its own subdirectory.

Legal Note: We do not intend this to be a passing-off of TicketMaster.com, which is a trademark in most countries. It is just a demonstration of how certain parts of an enterprise app could be implemented. WE ARE NOT ACTUALLY SELLING ANY TICKETS.

This site is not affiliated in any way with TicketMaster™ nor any other commercial ticket selling organization.

Building

This project now depends on Java SE 12+ and Java EE 8+.

The Java projects generally use Eclipse to write/compile/test code and Maven to build/package.

The top-level Maven pom runs each of the other projects. For some reason the top-level build doesn’t always succeed, so you might want to build just the EE project, as below.

Build

license BSD2 green maven Standard Builds pink

Deployment

The server projects are configured to deploy with the EE Server WildFly 14+

You MUST change the file ${WILDFLYHOME}/standalone/configuration/standalone.xml AND standalone-full.xml to have a datasource named TicketManorDataSource. For initial testing I just added:

<datasource jndi-name="java:jboss/datasources/TicketManorDataSource" pool-name="TicketManorPool"
	enabled="true" use-java-context="true">
	<connection-url>jdbc:h2:mem:ticketmanor;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
	<driver>h2</driver>
	<security>
		<user-name>sa</user-name>
		<password>sa</password>
	</security>
</datasource>

You should change this to a real database like PostgreSQL before deployment.

cd ticketmanor-ee
mvn wildfly:deploy # Assuming you have WildFly running

N.B. Never give the production app unfettered access to the database; limit it by doing something like the following, which creates a new account in the database accounting mechanism, separate from the database account that owns the database tables, and gives it only insert and update privileges. Commands are from PostgreSQL (where 'role' means 'user') but will be similar on other DB products.

postgres=# \c ticketmanor
You are now connected to database "ticketmanorjava"...

ticketmanor=# create role myAppAcct login password 'someEnchantedPasswordHere45678';
CREATE ROLE

ticketmanor=# revoke all on database ticketmanorjava from myAppAcct;
REVOKE

ticketmanor=# grant select, insert, update on all tables in schema public to myAppAcct;
GRANT
ticketmanor=#

The "schema public" only applies to the current database, so it’s important to connect to the correct database before issuing this command!

You might need a few other perms if JPA/Hibernate is running in "create" or "update" mode, but these modes should not really be used in production!

Note that when you want to delete a role that has been granted permissions, you must first use drop owned by myappacct cascade;.

Naming Conventions

In the Java code, classnames with:

  • Bean means either a JSF managed JavaBean or a Spring-managed JavaBean;

  • Resource means a RESTful web service endpoint;

  • Ejb (or *EJB) of course represents an Enterprise JavaBean.

ToDos

Basics

Use http://www.stateofflow.com/journal/66/creating-java-projects-programmatically to create Eclipse projects for different courses.

Beyond The Basics

The following is IN ADDITION to getting the basic functionality working across all the designated APIs that we need to demonstrate in the courses. It’s more a placeholder for IDEAS than an actual list of steps to do.

  • "Sync Instance" feature to update the database from a master copy on the Internet.

Cross-Platformality

Maybe use j2objc to make iOS versions of at least the Model classes.