Expresso Developer's Guide

David Lloyd, Michael Rimov, Larry Hamel, et. al.

October 2004


Table of Contents

1. Introduction
Welcome
Jcorporate's JGroup Services
We need your Support
2. Expresso Overview
Introduction
Using Expresso
Services
Expresso's Struts Integration
Benefits of Struts Integration
History of Integration
Struts Users Getting Started with Expresso
Expresso/Struts Webapp Example
Taking Advantage of Struts
Views
Flow of Control
Struts Tag Libraries
Other Open Source Project Integration
Conclusion
Contributors
3. Why Use An Architectural Framework?
Summary
Component Based Applications - Changing the Software Process
Industry Focus on Shared Standards
Why is there a Need for Frameworks?
What is a Framework?
What Advantages do Frameworks Offer?
Conclusion
Contributors
4. What is MVC?
MVC Overview
MVC in Java Server Pages
The case for separating presentation and logic
Conclusion
Contributors
5. Why Use Expresso?
An Example of a Java Application Services Framework
Expresso Embraces Model/View/Controller Paradigm
Conclusion
Contributors
6. Developing an Expresso Application
Introduction
Planning the Application
Create the Packages
Create a Schema Object
Create any required DB Objects
Create any required Controller Objects
Create any required Job Objects
Conclusion
Contributors
7. Application Configuration and Initialization
Introduction
Steps to setup an Expresso Application
expresso-config.xml
struts-config.xml
Other application-specific xxx-config.xml files
Logging Configuration
Schema List Table
Schema Object
Initialization
DefaultInit
Configuration Manager
Setup Values
LogManager
JobHandler
CacheManager
DB Connection Pool Initialization
Struts Initialization
Standalone Application Initialization
DBTool and DBcreate
DBCreate
Introduction
Initializing the Database
Initial Setup
An Example of How-To Use DBCreate
DBTool
Introduction
Running DBTool
Initial Setup with DBTool
Initial Setup Values
Arguments to DBTool
Conclusion
Contributors
8. Caching
Introduction
Automatic Caching
Database Object Caching
Custom Caching
Clustered or Distributed Environments
Conclusion
Contributors
9. Database Objects
Introduction
Database Objects Advantages
Scaling Your Applications
Feature Overview
Expresso Database Objects
Object/Relational Mapping
Automatic Generation
DBMaint
Security
Hiding Changes
Virtual Fields, Referential Integrity, Valid Values, Next Number
MultiDBObject
Schema Objects
AutoDBObject
Server-Side Objects
Database Connections
Using JNDI to retrieve your connections
Compatibility with Other Applications
Database Objects
Why Use Database Objects?
An Introduction To The Expresso DataObject API
Creating Database Objects
Using Database Objects
Database Objects in Multiple Databases
Why Multiple Databases?
Independent Multiple Databases
DBOtherMap
Using DataObjects in conjunction with Serialization
Getting an instance of a DataTransferObject
Rebuild a DBObject with a DataTransferObject
Conclusion
Contributors
10. Specific DataObject types.
MultiDBObjects
JoinedDataObject [Since Expresso 5.1]
Introduction
Creating a Joined DataObject
Instantiating and Using a Joined DataObject
Accessing JoinedDataObjects in DBMaint
Performing 'negative' security overrides
Using JoinedDigesterBean for polymorphism
MediaDBObject [Since Expresso 5.1]
Creating a MediaDBObject
Programmatically using the Media DBObject
Saving Time - Using DBMaint
AutoDBObject
Row Secured DBObjects
SynchronizedDataObjects
SynchronizedDataObject example
SecurityDBObjects
Conclusion
Contributors
11. Using Controller Objects
Introduction
MVC Architecture
Controllers Overview
Why Use Controllers?
Pitfalls to Avoid in Using Controllers
UI-Independant
Form-Handling
Controllers and EJBs
Controller Basics
Inputs
Outputs
Transitions
Blocks
Types of Controller
Controller Objects Included with Expresso
Controller Activity Explained
States
Internal States
External States
Transitioning
Extending Controllers
Background information
Extending the User Interface
Extending the default controller behaviors.
Workflow
Conclusion
Contributors
12. Validating user input
Setting up the Validator plugin
Standard Built In Validations
Manually validating a form
Automatically validating a form
Using client-side Javascript validation
Writing your own pluggable validators
Conclusion
Contributors
13. The Request Registry
Introduction
Initializing the Request Registry
Using the Request Registry
Getting the Settings
Temporarily Increasing Security Permissions
Destroying the RequestRegistry
Multi-Threaded Programming and the Request Registry
Command-Line Programs and the Request Registry
14. Database Maintenance
Using DBMaint
Using DBMaint
DBMaint and Defineable Objects
A Step-By-Step Example
Directory Structure
Example Step-by-Step
Conclusion
Contributors
15. Database Connection Pooling
Introduction
Why Is a Database Connection Pool Used?
EJB Server Connection Pools
Expresso Implementation
Database and Application Server Independent
DB Pooling Management
Queued Connections
Database Connections
Conclusion
Contributors
16. Developing The View in the MVC
Introduction
Order of execution to a request.
How to get at your data.
Understanding JavaBean properties naming conventions
Rendering ControllerResponse With JSP
Which tag library is better: Struts or JSTL?
A Common Controller
Processing With Struts Tags
Processing with Struts Extended Tags
Processing with JSTL
Processing with JSTL Extended Tags
Rendering the ControllerResponse with XSLT
Rendering ControllerResponse With Velocity
Configuring Velocity in Expresso
Velocity Global Macros for Expresso Integration
Using Velocity within Expresso
How to shorten URLs in links
Universal Dispatch
Conclusion
Contributors
17. Expresso Taglib Descriptions
Introduction
Tag Library Descriptor
Expresso Extended Struts Tags
Expresso Bean Tag Library (WEB-INF/tld/expresso-bean.tld)
Expresso HTML Tags (WEB-INF/tld/expresso-html.tld)
Expresso Logic Tags (WEB-INF/tld/expresso-logic.tld)
How to Use Struts Tags in Expresso
Expresso Tag Library (WEB-INF/tld/expresso.tld)
Example JSP code
Expresso Tags Described
Expresso Library Tag Details
ActionTag - Renders an Expresso action, and associated hidden fields
AttributeTag - Displays an attribute from an Input or Output object
Back - Displays a "Back" button or image to go back to a page
Block - Acts as a container for child InputTag, OutputTag,TransitionTag and Block tags
config - Defines a scripting variable based on the specified values
ContentTag - Displays an Expresso Output element's Contents field.
Context - Inserts the web-app context
DBDescription - Displays the description text for the current DB context
DBMaint - Includes a row with calls to DBMaint for a dbobject
ElementCollection - Retrieves a collection of a controller elements that can later be iterated through using the ElementIterator tag
ElementIterator - iterates through each controller element inside a parent ElementCollection tag
ErrorMessages - Displays an Expresso Error Collection from the Message Bundle
ErrorTag - Displays an Expresso Error Collection
IfElementExists - Checks if a particular controller element exists.
IfErrorExists - Checks if the controller generated errors and stored it in the page context.
IfLoggedIn - Checks if a session is established and a valid user is logged in.
IfMemberOfGroup - Checks if the user logged in has access to the specified group
InputTag - Displays an Expresso Input Object
LabelTag - Prints the label of a controller element
Login - Tries to make the user log in
output - Defines a scripting variable based on the specified values
OutputTag - Displays an Expresso Output Element
RestrictAccess - Allows quick and dirty restriction of access to jsp pages
session - Defines a scripting variable based on the specified values
setup - Defines a scripting variable based on the specified values
TableHead - Displays a pipe-delimited string as a table header
TransitionTag - Displays an Expresso Transition Button
TransitionParamsTag - Displays the parameters with an Expresso Transition
UserName - Displays the logged in user-name
Conclusion
Contributors
18. Expresso Utilities
Utilities
Conclusion
Contributors
19. Expresso Security
Introduction
Security Architecture Overview
User Authentication and Authorization
Authentication
Authorization
Servlet Engine Container Authentication
Filtering
LDAP Integration
SSL and Web Applications
A Super Quick Introduction To SSL
Configuring Expresso to use SSL
Coding Expresso to utilize SSL
Application Security
Administrative Security
Database Security
Encryption
Cross Site Scripting Countermeasures
SQL Injection Countermeasures
RowSecuredDBObject
Cookie Encryption
Tips for Securing a Production Expresso Environment
Conclusion
Contributors
20. Expresso Event System
Introduction
Event Conditions: Success or Unsuccessful
Message Content
Event Configuration
Triggering an event from code
EMail Integration
Event notifications
User Notifications
Login Verification
Attachments
Conclusion
Contributors
21. Internationalization
Locales
Character Sets
Internationalization and DB Objects
Internationalization in Controllers
Internationalization in JSP's
ISO Valid Values
Conclusion
Contributors
22. Asynchronous Request Processing Framework
Introduction
How it works
The Big Picture
A Real World Example
The Details
Implementing Your Own Async Process
Conclusion
Contributors
23. Expresso and XML
Introduction
XML Configuration Files
XML Data Import/Export
XML Output from Controllers
XSL Stylesheets
Conclusion
Contributors
24. Expresso Component Application Deployment
Introduction
Before You Start
Installation Procedure
Register the Application's Schema
Run DBCreate to create the Application's Database Tables
Conclusion
Contributors
25. Unit Testing
Introduction
Client-side Tests
Client Side Testing
How to run this test case
Writing your test case guidelines
Schema Testing
Server Side Testing
A Quick Sample
Running The Test Case
Conclusion
Contributors
26. Healthcheck Monitoring and Application Performance
Introduction
Healthcheck Monitors Web Components
Healthcheck Error Reporting
Healthcheck Tests Performed
Optimizing Performance
Performance Hogs
Cache Tuning
Database Optimization
Indexing
Conclusion
Contributors
27. Jobs Expresso
Introduction
Job Queue
Job Handler
Job Order
Creating a job
Submitting A Job
Job Parameters
Defining the Job Parameters
Adding parameters to a job
Accessing the parameters within the Job itself
Job Handling and Management
Starting the Job Handler
Job Scheduling Features
Cron Jobs
Theory and Implementation
Some Cron parameter examples
Conclusion
Contributors
28. Reporting System
Introduction
The Reporting Interfaces
Running a Report
Prepare the Report
Accessing the Report Controller
Conclusion
Contributors
29. Expresso Workflow
Introduction
Theory
Controller & State Forms
Workflow
Controller Definition
State default flow
Controller Security & Chaining flow
Screen Build
State Run
Practice
Defining the workflow in the Controller
Defining the workflow at screen build time
Defining workflow at runtime
Workflow sample code
Conclusion
Contributors
30. User Registration and Login
Introduction
Express Registration
Email Validation
Registration Domains
Registration Object Map And Detailed/Extended Registration
Default domain and registration object map
Extended domain and registration object map
Customization of registration
Conclusion
Contributors
31. Logging
Introduction
Apache Log4j Integration
Expresso Extensions
Package Organization
Configuration Mechanism
Appender Types
Available Appenders
Categories
How to use Expresso Logging
How to Add logging to your own Expresso-based application
Production Capable High Speed Logging
Appenders
Categories
Conclusion
Contributors
A. Contributing To Expresso Framework
Coding Conventions and Guidelines
Editing The Expresso Developers Guide
DocBook, XML, and XSLT
Transforming XML to HTML
Generating A Unified Difference Patch
Working With Other Databases
Quick Start
Final Work
Conclusion
Contributors
B. The Expresso Component Architecture [Future Direction]
Introduction
Goals
Architectural Overview
What makes a component then?
Architectural Tradeoffs
Component Containers and Services
Example
Component Lifecycle and Interfaces.
ExpressoComponent Interface
ExpressoComponent Lifecycle
Startup Configuration
Example expresso-services.xml
Component Creation
Define the component's interface.
Implement ExpressoComponent interface
Write the component's metadata
Implement Lifecycle interface if you want to receive configuration and lifecycle events.
System initialization
Required System Parameters
Logging: The odd guy out
Enter the System Factory
System Destruction
To Do Items
Future Expansion possibilities
Conclusion
Conclusion
Contributors
Glossary
Index

List of Tables

2.1. Apache
2.2. Other Projects Integrated
3.1.
7.1. Pre-Defined Class Handlers
7.2. Setup Values
7.3. Initializing the Database
7.4. Arguments to DBTool
11.1. Controller Objects Included with Expresso
16.1. Expresso Global Macros
17.1. Extended Tag Libraries
17.2. Expresso HTML Tags
17.3. Expresso Logic Tags
17.4. Expresso Tags Described
17.5. Attribute Tag
17.6. Back Attributes
17.7. Block Attributes
17.8. config Attributes
17.9. Context Attributes
17.10. DBMaint Attributes
17.11. ElementCollection Attributes
17.12. ErrorMessages Attributes
17.13. ErrorTag Attributes
17.14. IfElementExists Attributes
17.15. IfLoggedIn Attributes
17.16. IfMemberOfGroup Attributes
17.17. InputTag Attributes
17.18. LabelTag Attributes
17.19. Login Attributes
17.20. output Attributes
17.21. OutputTag Attributes
17.22. RestrictAccess Attributes
17.23. session Attributes
17.24. setup Attributes
17.25. TableHead Attributes
17.26. TransitionTag Attributes
17.27. TransitionParamsTag Attributes
19.1. Administrative Security
26.1. Healthcheck Functions
27.1. Job Queue Entry Parameters
27.2. Job Scheduling Parameters
31.1. Available Appenders
31.2. Categories
A.1. JDBC Attributes
A.2. DBCreate Failure Issues

List of Examples

16.1. Login's promptSendPassword state using jsp
16.2. Login's promptSendPassword state using Velocity