Attaining Critical Mass with Java EE6 Brian E. Lavender March 19, 2012 Computer Scientist CNSS 4011 and 4012 ==Intro== Critical Mass is the name of large bike gathering that notably started in San Francisco where on the 4th friday bicyclists come out in mass and take over the streets. The term comes from Ted White's movie titled "The Scorcher" where he details his experience objserving cyclists in 1992 in China. He observed cyclists in China who would arrive at an intersection. The cyclists would accumulate at the intersection unitl enough gathered with a critical mass to ride through. ==Kick Start Demo== Demo of taking a database and rolling up a web application using a reverse engineering tools in Netbeans. Quick way to see some possibilities. ==Ingredients== Java 6 or Java 7 JDK. OpenJDK is fine. Application server: JBoss 7 or Glassfish 3.x Maven and perhaps ant in some places. IDE: Netbeans or Eclipse. Or, use a text editor of your choice, depending upon your religion. ==Interesting Books== Beginning JSF™ 2 APIs and JBoss® Seam By: Kent Ka Iok Tong This book uses CDI, but was written while CDI specification was still in development, so you have to make minor changes to the examples, but the author covers some good cases. Java EE 6 Development with NetBeans 7 David R. Heffelfinger This book has a lot of great examples and easy to follow. There are a few skipped steps, but overall, I think it provides good insight. Eclipse Web Tools Platform: Developing Java™ Web Applications by Naci Dai, Lawrence Mandel, and Arthur Ryman This book covers J2EE, but provides good insight on how a project is assembled. Has a good case study and covers the Facade design pattern. Examples cover ==Interesting websites== Getting Started Developing Applications Guide https://docs.jboss.org/author/display/AS71/Getting+Started+Developing+Applications+Guide The website has great examples for doing development using JBoss 7.1 and CDI. JBoss Application Server Download JBoss AS samples https://www.jboss.org/jbossas/downloads/ What is a Bean? https://docs.jboss.org/weld/reference/1.1.0.Final/en-US/html_single The above document gives a good explanation of what a bean is and how this puzzle fits together. ==Getting the stuff== Java EE 6 download This includes Glassfish. It also includes the Java EE 6 tutorial http://www.oracle.com/technetwork/java/javaee/downloads/java-ee-sdk-6u3-downloads-439814.html Getting Eclipse http://eclipse.org/ Netbeans Download http://netbeans.org/downloads/ Maven Get Maven 3 https://maven.apache.org/download.html ==Go== The Maven archetype $ mvn archetype:generate -DarchetypeArtifactId=jboss-javaee6-webapp \ -DarchetypeGroupId=org.jboss.weld.archetypes -DarchetypeVersion=1.0.1.CR1 -DarchetypeRepository=central HSQLdb and Derby OpenOffice uses the hsql embedded data base We will use a pom file to start a database. Can use the same jar file to connect to it in OpenOffice, except that it runs in network server mode. Derby runs along a similar line. It is also known as Java database. Mysql module for JBoss AS Add the module that creates a connection pool to Mysql database Things to check before you get started $ mvn -version Should output version 3.x $ java -version Should report openjdk or Sun jdk, version 6 or higher Simple web project JBoss Quickstarts! No fricken XML configuration needed! Hello World! https://docs.jboss.org/author/display/AS71/Getting+Started+Developing+Applications+Guide https://www.jboss.org/jbossas/downloads/ JBoss Quickstart with EntityManager. Connect it to the database! Using the example project from JBoss Tools! New->Other->Examples->JBoss Tools->Project Examples Java EE Web Project Shop example This example is code from the beginning JSF book. It shows the concept of a phase listener and blocking access to a certain view until the user logs in! Some EJB stuff. https://www.jboss.org/ejb3/docs.html The EJB3 tutorial shows some interesting stuff, but it's hard to see how to pull the pieces apart.