15.01.2015 Views

4th International Conference on Principles and Practices ... - MADOC

4th International Conference on Principles and Practices ... - MADOC

4th International Conference on Principles and Practices ... - MADOC

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

model:<br />

1. Servlet [6] adapter comp<strong>on</strong>ent.<br />

2. Sessi<strong>on</strong> router service.<br />

3. Synchr<strong>on</strong>izing filter service.<br />

4. HTTP filter service.<br />

5. Widget adapter service.<br />

6. Widget c<strong>on</strong>tainer widget.<br />

7. Flow c<strong>on</strong>tainer widget that will allow to run nested<br />

processes.<br />

8. Applicati<strong>on</strong> root flow widget which in many cases is<br />

the login flow.<br />

Figure 2: Framework assembly for hosting pages<br />

• Only <strong>on</strong>e request will be processed at <strong>on</strong>ce (due to synchr<strong>on</strong>izing<br />

filter). This means that widget developers<br />

should never worry about c<strong>on</strong>currency.<br />

• The widget may render a resp<strong>on</strong>se, however it has no<br />

way of directly referencing other widgets by URLs.<br />

Therefore it must send all events from HTML to itself.<br />

• Up<strong>on</strong> receiving an event the widget might replace itself<br />

with another widget (opti<strong>on</strong>ally passing it data as<br />

a c<strong>on</strong>structor parameter) using the c<strong>on</strong>text provided<br />

by the page c<strong>on</strong>tainer widget. Generally all modificati<strong>on</strong>s<br />

of the widget hierarchy (e.g. adding/removing<br />

children) can <strong>on</strong>ly be d<strong>on</strong>e during event part of the<br />

request-resp<strong>on</strong>se cycle.<br />

• The hierarchy of widgets under the applicati<strong>on</strong> root<br />

widget (e.g. GUI elements like forms or tabs) may be<br />

arranged using usual Composite widget implementati<strong>on</strong>s<br />

as no special routing is needed anymore.<br />

In the real setup page c<strong>on</strong>tainer widget may be emulated<br />

using flow c<strong>on</strong>tainer widget that allows replacing the current<br />

flow with a new <strong>on</strong>e.<br />

Such an executi<strong>on</strong> model is very similar to that of Wicket<br />

[20], JSF [8] or Tapestry [5] although these frameworks separate<br />

the pages from the rest of comp<strong>on</strong>ents (by declaring a<br />

special subclass) <strong>and</strong> add special support for markup comp<strong>on</strong>ents<br />

that compose the actual presentati<strong>on</strong> of the page.<br />

4.3 Stateful N<strong>on</strong>-Reentrant C<strong>on</strong>trollers with<br />

Flows<br />

To add nested processes we basically need <strong>on</strong>ly to replace<br />

the page c<strong>on</strong>tainer with a flow c<strong>on</strong>tainer in the previous<br />

The executi<strong>on</strong> model here is very similar to the <strong>on</strong>e outlined<br />

in Subsecti<strong>on</strong> 4.2. The <strong>on</strong>ly difference is that the applicati<strong>on</strong><br />

root flow may start a new subflow instead of replacing<br />

itself with another widget.<br />

This model is similar to that of Spring WebFlow [18], although<br />

Spring WebFlow uses Push-Down Finite State Automat<strong>on</strong><br />

to simulate the same navigati<strong>on</strong> pattern <strong>and</strong> c<strong>on</strong>sequently<br />

it has <strong>on</strong>ly <strong>on</strong>e top-level call stack. In our model<br />

call stacks can appear at any level of widget compositi<strong>on</strong> hierarchy,<br />

which makes our model c<strong>on</strong>siderably more flexible.<br />

4.4 Combining the Models<br />

It is also relatively easy to combine these models, modifying<br />

the model shown <strong>on</strong> figure 2 by putting a URL path<br />

router service before the sessi<strong>on</strong> router, map the sessi<strong>on</strong><br />

router to a particular URL path <strong>and</strong> put a flow c<strong>on</strong>tainer in<br />

the end.<br />

The combined model is useful, since reentrant stateless<br />

services allow to download files from database <strong>and</strong> send<br />

other semi-static data comfortably to the user. They can<br />

also be used to serve parts of the applicati<strong>on</strong> that has the<br />

highest dem<strong>and</strong> <strong>and</strong> thus load.<br />

5. FRAMEWORK ASPECTS<br />

Next we examine some typical web framework aspects <strong>and</strong><br />

how they are realized in Aranea.<br />

5.1 C<strong>on</strong>figurati<strong>on</strong><br />

The first aspect that we want to examine is c<strong>on</strong>figurati<strong>on</strong>.<br />

We have repeated throughout the paper that the comp<strong>on</strong>ents<br />

should form a dynamic hierarchy, however it is comfortable<br />

to use a static c<strong>on</strong>figurati<strong>on</strong> to wire the parts of the<br />

hierarchy that form the framework core.<br />

To do that <strong>on</strong>e can use just plain Java combining a hierarchy<br />

of objects using setter methods <strong>and</strong> c<strong>on</strong>structors. But<br />

in reality it is more comfortable to use some c<strong>on</strong>figurati<strong>on</strong><br />

mechanism, like an IoC c<strong>on</strong>tainer. We use in our c<strong>on</strong>figurati<strong>on</strong><br />

examples Spring [17] IoC c<strong>on</strong>tainer <strong>and</strong> wire the<br />

comp<strong>on</strong>ents together as beans. Note that even such static<br />

c<strong>on</strong>figurati<strong>on</strong> c<strong>on</strong>tains elements of dynamicity, since some<br />

comp<strong>on</strong>ents (á la root user sessi<strong>on</strong> service) are wired not as<br />

instances, but via a factory that returns a new service for<br />

each sessi<strong>on</strong>.<br />

6<br />

168

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!