Rapid Application Development
and
Java...
A place where many, many ideas have been tried and discarded.
A current problem is it's success: so many libraries,
so many technologies, so many choices
WEB Project DNA
● IDE (Eclipse, NetBeans, Jbuilder, IntelliJ, ...) ● Build Tool (Maven, Ant, …)
● Unit testing (Arquillian, EasyMock, JUnit, ...)
● App server (Tomcat, JBoss, WebLogic, WebSphere, Netty, ...) ● UI framework (JSF, GWT, Spring MVC, Struts, Tapestry, …) ● CSS files, JavaScript files, Images, HTML files, SQL
● View JavaBeans, Business JavaBeans, WebService endpoints ● ORM, DAO (JPA, Hibernate, JDBC), WebService clients
Java takes too long:
●
develop / compile / deploy / test cycle is long
●
IDE / project integration mysteries
●
download / config jars into IDE / app server
●
XML configurations are tedious (older spring /
hibernate)
●
Technologies change every darn time
So what did we do about it?
Rapid Application Development !
AppFuse 3.x
● open-source Java EE web app framework ● designed for quick, easy development start up
● Provides project skeleton and additional code features ● Maven 2 build automation
● Hibernate, iBATIS or JPA as persistence frameworks
● compatible with JSF, Spring MVC, Struts 2 or Tapestry frameworks ● Uses Netty web server
● http://appfuse.org
Some of the Code Features:
● User Management – login, signup, remember ● E-Mail
Grails
● Re-use technologies like Hibernate and Spring under a single interface ● Templates using GSP (Groovy Server Pages)
● Dynamic tag libraries for creating web page components ● Customizable Ajax support
● sample applications that demonstrate the framework ● includes a web server and automatic reload of resources ● http://grails.org/
Features
● No XML configuration
● All required libraries present
● Automatically prepares the Java web environment for deployment ● provides dynamic methods (mixins) based on class type
● allows developers to perform operations without implements or extends ● Has an app generator, owned by Spring Source, works like Spring Roo
JSPX(-bay)
● asp.net like imitator, yet different ● Does not mix java into jspx pages ● Plain html use – page tags
● convention over configuration ● stateful ui interface
● Data persistence exists, JPA not mentioned
OpenXava
● You write the code for data structure and business logic
● You do not have to write HTML, JavaScript, CSS, SQL, etc. ● Java EE user interface and the database logic are
automatically provided
● Extend any part of the app later, if needed
● List mode (search) has paging, ordering, filtering, adding /
removing / moving columns, PDF reports, export to Excel, etc.
● Detail mode (view) with tabs, frames, dialogs, editors for
Play 2.x
● Definite Scala web platform possibility● Scala and Java, non Java EE
● heavily inspired by and similar to Ruby on Rails and Django, uses module concept ● Uses convention over configuration
● designed to be run using JBoss Netty web server ● Can package to war and run on EE app servers.
● Stateless: Play 2 is fully RESTful - there is no Java EE session per connection ● a persistence layer based on JPA
● Built in hot-reloading ● an embedded database
● full embedded testing framework ● http://www.playframework.com/
WaveMaker 6.x
● Automatic generation of Hibernate mapping, queries from database
schema import
● Automatic creation of Enterprise Data Widgets based on schema import
● Edit form implements create, update, delete functions automatically
● Visual, drag & drop assembly of web applications
● Developer sees live application data within the studio (LiveLayout)
● one-touch deployment to Tomcat, Websphere, Weblogic, Jboss
● Browser-based WaveMaker studio can be bundled
● Deploys a standard Java .war file
● effectively an open source alternative to Force.com
Others not covered
● Jrapid, not free, cloud based, DRY
http://www.jrapid.org/
● Stripes, not specifically RAD
http://www.stripesframework.org
● Vaadin, not specifically RAD
https://vaadin.com
● Wicket, not RAD, plain html, components
Common Features
● Project skeletons and some feature code
● Convention over configuration and Annotations ● Maven – get / configure / deploy jars
● Maven – standard project config, operations ● light-weight frameworks, scripting langs
● DRY (don't repeat yourself) pattern
Another Approach Please?
●
I don't really want to give up my
environment for another
●
The technology changed again and I don't
want to jump to yet another environment to
catch up
Application Generation Tools
● Not as easy as pushing a button
● Does not generate a production application
● DOES generate a deployable running application
● A good start, delete what you don't want ● Grails
● Maven archetypes ● Spring Roo
Maven Archetypes
● Many choices, will likely find one for your desired
environment and version.
● Built a demo with
jboss-javaee6-webapp-archetype 7.1.3 Final
● Command line: mvn archetype:generate
● Eclipse new → maven project
● Produces a maven project skeleton
Maven Archetypes
Pros
● Part of Maven, instant Maven project
● Light, quick, easy to run
● No other external software to install
● Freedom to build app your way
● Many, many archetypes to work with
Cons
● Produces a skeleton only
Spring Roo
●
Is a separate (commandline) generator
●Has to be installed (unzipped)
●
Install oracle driver into internal osgi
●Reversing a database worked first try!
●Had to build database tables first
Roo commands
● project --topLevelPackage org.cchmc.bmi.psysoc.pvp ● jpa setup --provider HIBERNATE --database ORACLE
● dependency remove --groupId com.oracle --artifactId ojdbc14 --version 10.2.0.2 ● dependency add --groupId com.oracle --artifactId ojdbc6 --version 11.2.0
● database properties set --key database.driverClassName --value oracle.jdbc.OracleDriver ● database properties set --key database.url --value jdbc:oracle:thin:@localhost:1521:XE ● database properties set --key database.username --value myid
● database properties set --key database.password --value mypass
### all tables at once
● database reverse engineer --schema PSYSOCPVP --package ~.models
● web jsf setup --implementation ORACLE_MOJARRA --library PRIMEFACES --theme BLUESKY
### build them all
Roo
Generated:
● a PrimeFaces JSF UI
● Non EE AspectJ Spring beans and models
● heavy use annotation and injection
● Models use JPA
● Some internationalization provided
Roo
Pros
● Little investment
● More capabilities than shown
● Database schema reversal works
● Spring, JPA, JSF, PrimeFaces
Cons
● Non EE
● AspectJ bean generation
● Roo Specific Annotations
Seam 2
● Marry JSF 1.2 w/ JPA and make it work
● My first app generation encounter ● Installed Seam external to IDE
● Defined schema in reveng.xml
● Built an EE 5 CRUD app
● MPM admin tool started this way
Seam 3
●
Java EE 6 and CDI
●
Seam 2 had to become Seam 3
●Seam 3 introduced JBoss forge
●
Seam 3 has stopped (see Apache
DeltaSpike, others)
Jboss Forge 1.4x
●
Is a separate (commandline) generator
●Has to be installed (unzipped, Eclipse)
●Reversing a database - miserable failure
●Did it their way, inside out
Forge Commands
● New-project;
● scaffold setup --scaffoldType faces;
● beans setup;
● entity --named Customer --package ~.domain; ● field string --named firstName;
● field string --named lastName;
● field temporal --type DATE --named birthDate; ● …
● @/* Generate the UI for all */;
● scaffold from-entity ~.domain.* --scaffoldType faces –overwrite;
● @/* create rest WebService CRUD endpoints */; ● rest setup;
● rest endpoint-from-entity ~.domain.*;
Forge
Generated:
●JSF UI
●
Domain beans, EE criteria query view beans
●
heavy use annotation and injection
●
views use JPA
Forge
Pros
● More function, for free
● J2EE 6 Annotated, JBoss compatible, what we use ● JSF, JPA, criteria queries already built if desired ● Large table paging is built in.
Cons
● Multiple injected entity managers ● Extended conversations
● More pages, clicks to navigate
● Want DB reverse engineering to work ● View beans are too dense
Conclusions
●
Generally good starts or short cuts
●Use what works, delete what doesn't
●