RIFE Users Guide

Geert Bevin

Mikael Hallendal

Richard Hult

IMPORTANT NOTICE: This users guide has been written for earlier version of RIFE. While everything is correct, it's often not the current easiest or most flexible way. Please refer to the wiki's cookbook for more information about all the features that have been added since this guide has been written.

This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at http://www.opencontent.org/openpub/).


Table of Contents

1. Introduction
1. Purpose
2. History of RIFE
3. Java web applications
2. Getting started
1. Installing RIFE
2. A simple RIFE application
3. Creating a more advanced RIFE application
1. Laying out the structure
2. Linking elements
2.1. Defining exits
2.2. Creating the links
3. Passing data between elements
3.1. Defining inputs and outputs
3.2. Creating the data link
4. Templates
5. Reading data from a form
6. Specifying the starting point
7. Wrapping it up
4. Templates
1. The block tag
2. The value tag
3. Overriding the default value
4. The include tag
5. A friends database
1. Introduction
2. Defining and connecting the elements
2.1. Properties
2.2. The site definition
2.3. Global exits
2.4. Displaying the friends
6. Adding configuration to the friends application
1. Some explanation on RIFE participants
1.1. Various types of participants
1.2. Execution of participants
2. Configuration in the friends application
3. More on configuration
3.1. Accessing parameters from within the configuration file
3.2. Configuration selectors
3.3. Configuration file inclusion
7. Adding database support
1. The datasource participant
1.1. Datasource parameters
1.1.1. Username and password
1.1.2. Database driver
1.1.3. URL
1.1.4. Connection pool
2. Selecting a data source
3. The Friend bean
4. Managing the data
4.1. Using the right data source
5. Displaying the friends
5.1. Displaying one friend at a time
5.2. Writing a row processor
6. Adding friends
6.1. Declaring the new element
6.2. Submission beans
6.3. The add template
6.4. Adding a friend to the database
7. Finishing up the example
7.1. Installing and removing the database table
7.2. Creating the table
7.3. Cleaning up
8. We're done!
8. Adding authentication
1. Authentication
2. Memory users
3. Changing the site structure
3.1. Using a subsite
3.2. The authentication element
3.3. The login form
4. Putting it all together
4.1. Inheritance
4.2. Child triggers
4.3. Adding an auth id variable
4.4. Inheriting the auth element
5. Finishing touches
5.1. Logging out
5.2. Conclusion
9. Cookbook
1. Dynamic submission parameters
2. Cookies
3. Departure
4. Grouping elements
5. Filling out templates using beans
10. Cookbook - database
1. Datasource independence
1.1. Using multiple database drivers
2. Handling database exceptions
3. Row processors revisited
11. Cookbook - authentication
1. Authentication and database users
1.1. Mixing memory and database backends
1.2. Automatically purging sessions
2. Password encryption
12. Cookbook - non-web apps
1. Non-web app applicability
1.1. Writing a non-web application
2. Rounding up

List of Figures

3.1. The numberguess site

List of Examples

2.1. The participants file for Hello World
2.2. Site file for Hello World
2.3. The Java element of Hello World
3.1. Directory structure for the numberguess example
3.2. Defining exits for an element
3.3. Defining flowlinks
3.4. Defining inputs and outputs
3.5. Adding data links to the guess element
3.6. The template for the guess page
3.7. Adding a submission to the guess element
3.8. The guess template with a form
3.9. Java code for the Guess element
3.10. The final number guess site file
4.1. guess.html
4.2. Snippet from Guess.java that uses setBlock()
4.3. Template that can be used as a standard page, page.html
4.4. Including another page with the I-tag, home.html
5.1. Directory structure of the friends application
5.2. Participant file for Friends database
5.3. The DISPLAY element
5.4. The MENU element
5.5. PrintTemplate.java: Using properties from Java
5.6. PrintTemplateInjection.java: Injecting properties from Java
5.7. First cut on the site definition
5.8. Template for listing friends
5.9. The Java code used to add friends
6.1. Participant file for Friends database
6.2. A configuration file
6.3. Display template modified to use configuration data for title
6.4. Using the values from within the configuration file
6.5. Filename convention when using selectors
7.1. Adding a data source participant
7.2. Data source definition
7.3. Selecting a data source through the configuration system
7.4. Friend bean class
7.5. Using the selected data source
7.6. Retrieving the friends list
7.7. Our row processor
7.8. Updating the site file
7.9. Element for adding a friend
7.10. Template for adding a friend
7.11. Adding a friend to the database
7.12. Method to install the Friends table
7.13. Method to remove the Friends table
8.1. A memory users configuration file
8.2. Memory users configuration file
8.3. The main site definition file
8.4. The admin site definition file
8.5. The authentication element
8.6. The authentication template
8.7. Adding authid to sites/friends.xml
9.1. Element using dynamic submission parameters
9.2. Template used for demonstrating dynamic submission parameters
9.3. Java implementation of element using dynamic submission parameters
9.4. Defining an element with a cookie
9.5. NewsList.java: Using cookies from Java
9.6. Site using a departure
9.7. Showing the group tag being used
10.1. Datasource dependent implementation
10.2. Datasource independent implementation
10.3. An abstract row processor
11.1. Authentication element for database users
11.2. Installing the tables for database users
11.3. Encrypted memory users
12.1. Participant file defining TestParticipant
12.2. Implementation of a Participant
12.3. Starting a participant from the main method