RIFE
Architecture
- Elements
- The basic unit of a RIFE site is the element. An element represents one web page or component.
An element is associated with a template and a Java class; if desired, the Java class can be used as a controller,
with a data class serving as the model. Metadata can be defined in the data class, or in a separate class.
Metadata includes validation constraints, and an ability to group the model's fields.
The element can then define multiple forms in its template, associating each form with a group.
- Flow Control
- There are two methods for controlling flow in RIFE.
- Between elements
-
- Exit links define endpoints where control may be passed to another element.
- Input links define endpoints from which data may be received.
- Flow links connect endpoints to elements.
- Data links define the data which flows between endpoints.
These links are normally defined in an XML configuration file, although they can all be set in Java.
- Within elements
- Continuations enable a block of Java code to
pause while waiting for a page response, and if necessary, go back to a previous pause. This enables programatic flow control
in a fully imperative style. During pauses, the thread is not actually paused. Rather, a copy of the local state is created
(a continuation), and this continuation is activated when the page is posted back to the server.
If the program moves back to a previous state, the current continuation is abandoned, and a previous continuation is activated.
- Templates
- Whereas other templates contain the logic to build themselves, RIFE templates are more passive.
They only contain marked fields/blocks and data binding declarations. The controller is responsible for filling
the fields, and moving or hiding blocks.
State
RIFE provides configurable state storage
to handle server-side data with data links. Continuations are also an excellent solution to maintaining server-side state.
Configurable state storage generates a new ID for each request, which brings some of the same benefits as continuations;
submitting a browser-cached copy of a previous page will use the old state data.
Source Files
- web/RIFE.html
- The application template.
- web/participants.xml
- Tells RIFE where to find the site's configuration.
- web/rife.xml
- The site configuration; only one element, which handles its own flow control.
- src/app/Rife.java
- The business and UI logic.
- src/app/Name.java
- The model class.
- src/app/NameMetaData.java
- The metadata class, mapping model fields to template forms. Validation would go in here.
Deployment
Deployment is the same as for any other Java web application with custom servlets, and can be performed with standard JEE tools.
Tools
There is no specific tool support for RIFE. However, as it is a Java web application, any standard Java tools can be used.
This application was developed with NetBeans.