CCT Architecture
Download
Report
Transcript CCT Architecture
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 – 3rd 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
e-mailing 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) - <ejbdoclet>
Generates Struts’ ActionForms from
POJOs - <ejbdoclet>
Generates Validator’s validation.xml
from ActionForms - <webdoclet>
Generates web.xml and strutsconfig.xml - <webdoclet>
XDoclet Examples
Hibernate: User.java
– @hibernate.class table=“app_user"
Generating ActionForms: User.java
– @struts.form include-all="true"
extends=“BaseForm"
XDoclet Examples,
cont.
Generating entries in struts-config:
UserAction.java
– @struts.action 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
– http://raibledesigns.com/appfuse
– http://raibledesigns.com/appfuse/tutorials
Java Development with Ant
– http://www.ehatchersolutions.com/JavaDevWithAnt
Enhance J2EE component reuse with XDoclet
– http://www.arc-mind.com/papers/ws-j2x-ltr.pdf
Step-by-Step tutorial on using XDoclet to write your own custom
templates
– http://www.arc-mind.com/papers/xdoclet2.pdf
Ant, JUnit, XDoclet Presentations
– http://ehatchersolutions.com/downloads/presentations