cool stuff
/src_docs/architecture/event/index.html, v127

Event Model

The Barracuda Event Model is designed to make it easier to build and administer complex web applications by using events in conjuction with a Model 2 dispatching paradigm. With simple applications, it is often sufficient to implement screens as simple Servlets; as application complexity grows, however, events become a valuable mechanism for managing your web application.

From the simplest perspective, the Event Model simply intercepts HTTP Requests, converts them to actual event objects, and then dispatches them to all interested listeners in the system. There are two kinds of events in the system: Control Events and View Events.

Control Events indicate you want to do something--perhaps get a certain screen or update a form. View events, on the other hand, are actually responsible for ensuring that the correct screen gets sent back to the client. In the Model 2 paradigm, you generally handle control events and then redirect to the appropriate view. This is very easy in the Barracuda Event Model because one event (spawned by the HTTP Request) can actually generate many additional events.

This one-to-many relationship makes it possible to intercept events before they actually get handled to make sure that the action is permissable. For instance, if I define an event called TransferFunds.event, I probably want to be sure that you have logged into the system before actually allowing the event handlers to process the event. With the Barracuda event model, this process is very easy: I can install security or logging mechanisms over various portions of the event hierarchy without ever touching the actual event handler code for given events. This keeps the system loosely coupled and highly cohesive (where event handlers each do one thing and do it well).

Of course this flexibility requires some additional effort on the part of the developer: you must carefully define the event hierarchy up front and specify which screens are capable of handling events. The process is straightforward, however, and well documented. For enterprise caliber system, the reward is well worth it.

For details on how to use the Event Model, refer to the Event Model - 30,000 Ft Overview and the Event Model Tutorial.


Last Modified: 2006-01-04 15:56:22 -0500 (Wed, 04 Jan 2006)