AppFuse Architecture Directory Structure, Build/Test/Deploy Processes
Project Structure Directory structure –Simpler is better –Map to artifacts –Customizations/personalization's –IDE issues –Separate source from artifacts - cleanable
Top-level Directory Structure bin – automation scripts lib – 3 rd party libraries (i.e. Struts and Hibernate) metadata – SQL scripts, server configurations and XDoclet fragments src – Java source files test – JUnit, Cactus, StrutsTestCase tests tools – Strutsgen: a tool for generating JSPs from ActionForms web – JSPs, properties files, images, scripts, stylesheets
Open Source Dependencies Ant-contrib – use “propertycopy” task in build process Checkstyle – used to verify that coding standards are followed Dbunit – cleans/loads data into database before tests are run Display Tag – used to display list screens (including sorting/paging) Hibernate – persistence engine Cactus – for unit testing server-side java code Log4j – logging framework, includes ing errors Struts – web application framework, we use JSPs and Servlets Java2HTML – creates HTML pages of.java files … continued
Open Source Dependencies, cont. JUnitDoclet – generates skeleton test cases for a class’s methods PMD – inspects code for unused variables, parameters, etc. StrutsMenu – navigation system StrutsTestCase – extension of Cactus to test Struts’ Actions WebTest – used to test JSPs XDoclet – code and deployment descriptor generator
Java Directory Structure src & test common ejb web org.appfuse…
Ant Build File XML format In project root directory Default name: build.xml Declarative - define steps, not scripty details Defines a single project A project contains targets Targets contain tasks
AppFuse Tasks Main tasks in appfuse project –clean –ejbdoclet and webdoclet –compile-module (where module is common, web or ejb) –package-module –deploy –test-module
build/deploy process
Test process
XDoclet’s Role Generates Hibernate mapping files (.hbm.xml) - Generates Struts’ ActionForms from POJOs - Generates Validator’s validation.xml from ActionForms - Generates web.xml and struts- config.xml -
XDoclet Examples Hibernate: User.java table=“app_user" Generating ActionForms: User.java include-all="true" extends=“BaseForm"
XDoclet Examples, cont. Generating entries in struts-config: UserAction.java path="/saveUser" name=“userForm“ scope="request" validate="true" parameter="action" input=“editUser"
User Interface Constructed with Tiles – web/layouts/baseLayout.jsp controls the entire layout of the site. Uses Struts JSP tags for editing/saving forms. Uses JSTL for conditionals, includes and messages.
User Interface, cont. XHTML 1.0 and CSS 2.0 –Allows validation –Cleaner HTML (all attributes lowercase, etc) –DOCTYPE switching
More Resources AppFuse Project Homepage – – Java Development with Ant – Enhance J2EE component reuse with XDoclet – Step-by-Step tutorial on using XDoclet to write your own custom templates – Ant, JUnit, XDoclet Presentations –