Aranea - PowerPoint PPT Presentation

1 / 30
About This Presentation
Title:

Aranea

Description:

... framework compatible with JSP tags, Wicket markup, JSF components, Facelets, ... Integration with Wicket, JSF, Struts, Spring MVC & WebFlow, Echo2, GWT ... – PowerPoint PPT presentation

Number of Views:51
Avg rating:3.0/5.0
Slides: 31
Provided by: csI88
Category:
Tags: aranea | wicket | widget

less

Transcript and Presenter's Notes

Title: Aranea


1
Aranea Java Web Framework Construction and
Integration Kit
Jevgeni Kabanov University of Tartu, Webmedia,
Ltd., Estonia
Oleg Mürk Chalmers University of
Technology, Sweden
2
Outline
  • Introduction
  • Hello World! In Aranea
  • Framework construction
  • Framework integration
  • Further work

3
Motivation
  • At the moment web applications are barely
    reusable!
  • Existing code cannot be reused for similar
    requirements without inserting if-then-else-s
    everywhere
  • Legacy migration is very hard!
  • Integrating applications built on different
    platforms is hard and often visible to user
  • Object-Oriented Design to the rescue!

4
Web is
  • Procedural (Client calls server)
  • Synchronized (One window one request)
  • Decomposable into pages
  • Client is mostly stateless (Current state with
    result, cookies)
  • In general web is based around a concept of a
    page, which is combining data, behavior and
    presentation

5
GUI applications are
  • Often stateful
  • Mostly synchronized (one window one thread)
  • Decomposable into components
  • Comfortable to represent using OO concepts
  • Model-View-Controller pattern suggest to keep
    data, presentation and behavior separately

6
Enter MVC Web Frameworks
  • Request-based Struts, Spring MVC
  • Page-based JSF, Wicket, Tapestry
  • Continuation/flow-based RIFE, Spring WebFlow
  • AJAX-based Echo2, GWT
  • OO-based Wicket, Aranea

7
A Sea of Frameworks
  • Do we really need all those approaches?
  • They play out well for different requirements
  • Can we combine them?
  • Well try to do just that ?
  • Well also hint how to make the existing
    frameworks work together

8
Introducing Aranea
  • An Open-Source project available at
    http//www.araneaframework.org
  • A component object model styled after a variant
    of Hierarchical MVC pattern
  • Reusable components, which can be assembled into
    an MVC framework
  • Note that we are only examining the Controller
    part of MVC!

9
Hello World!
NameWidget name.jsp Reads the name from requests
and passes it to HelloWidget
HelloWidget hello.jsp Renders the Hello
name! greeting, where name is given by the
caller.
Note that we need two widgets only for
demonstration purposes
10
NameWidget
public class NameWidget extends BaseUIWidget
//Called on hello event public void
handleEventHello() String name //reads
name from request parameters (String)
getInputData().getGlobalData().get("name")
getFlowCtx().replace(new HelloWidget(name),
null)
name.jsp
ltuisystemForm method"GET"gt Insert your name
ltinput typetext name"name"/gtltbr/gtltbr/gt
ltuieventButton labelId"Say hello"
eventId"hello"/gt lt/uisystemFormgt
11
HelloWidget
public class HelloWidget extends BaseUIWidget
private String name //Widget state is in its
fields public HelloWidget(String name)
this.name name //We could pass any Java object
here public String getName()
return this.name
hello.jsp
? Hello ltcout value"widget.name"/gt!
12
Hello World! reexamined
NameWidget name.jsp handleEventHello()
getFlowCtx().replace(new HelloWidget(name))
HelloWidget hello.jsp
Note that we can pass any Java object to the
widget constructor, enabling e.g. polymorphism
13
Framework construction
  • Components are assembled in a chain
  • Only 3 component kinds (components, services
    widgets)
  • Some components may contain more than one child
  • Servlet only dispatches the HTTP call to adaptor

14
Component
interface Component void init(Environment
env) void destroy()
15
Service
  • Services correspond to the procedural
    unsynchronized HTTP model
  • Unlike servlets no binding or configuration
    specified

interface Service extends Component void
action( Path path, //Routing
destination for Composite case InputData
input, //Request abstraction OutputData
output) //Response abstraction
16
SynchronizingFilterService
  • Synchronizes the underlying calls
  • In reality childService is handled by the base
    class (BaseFilterService)

public class SynchronizingFilterService extends
BaseService protected Service childService
public void setChildService(Service childService)
this.childService childService
synchronized void action( Path path,
InputData input, OutputData output)
childService.action(path, input, output)
17
Environment
  • Environment allows parents to let children access
    their features

interface Environment Object getEntry(Object
key)
Usage example
L10nContext locCtx (L10nContext)
getEnvironment().getEntry(L10nContext.class) Stri
ng message locCtx.localize("message.key")
18
LocalizationFilterService
  • Provides localization features

public class LocalizationFilterService extends
BaseFilterService implements L10nContext
public void init(Environment env)
childService.init( new StandardEnvironment(e
nv, L10nContext.class, this) public
String localize(String key) //Look up a
ResourceBundle and return the message
19
SessionRouterService
  • Routes the action() to a service associated with
    the HTTP session
  • Creates new services using a service factory
    (assigned via setter)

public class SessionRouterService extends
BaseService void action(Path p, InputData
input, OutputData output) HttpSession sess
//Lookup logic if (sess.get(SERVICE_KEY)
null) createService(sess) //Build
service using factory ((Service)
sess.get(SERVICE_KEY)).action(p, input, output)

20
Half of a framework
  • Service adaptor creates Input- OutputData
  • Session router saves service chain under itself
    in session
  • Synchronizing filter protects session state from
    concurrent modification
  • HTTP filter sets headers

21
Widget
  • Widget corresponds to a stateful synchronized GUI
    component
  • Most applications are built from widgets

interface Widget extends Service //Calls must
be made in the same order void
update(InputData data) //Sent to all widgets
void event(Path path, InputData input) //Routed
to one widget void process() //Preparing to
render void render(OutputData output) //May
be called several times
22
Flows
  • Flows are pages which preserve nested state and
    can return values

23
Flows examined
  • Flow container is a widget that contains a stack
    of widgets representing flows
  • Being a usual widget flow container can be used
    at an arbitrary place in framework or application

public interface FlowContext void
start(Widget flow, Handler handler) void
replace(Widget flow) void finish(Object
result) void cancel()
24
And the final touch
  • Widget adapter calls update(), event(),
    process() and render() for each action() call
  • Widget container creates Path for event routing
  • Flow container provides FlowContext and a widget
    stack

25
Other configurations
  • We can assemble a system to bind stateless
    services to URLs like Struts actions
  • We can also assemble a system that will bind
    stateful widgets to URLs like Wicket pages
  • In fact it is easy to simulate all of the
    mentioned approaches

26
Integration
  • Our goal is to use Aranea component model to
    structure our application
  • And then use it as glue to integrate with all
    other web frameworks
  • In fact Aranea was specially designed with
    integration in mind
  • But before 1.0 release we had to put our energy
    elsewhere

27
Integration Picture
28
Summary
  • A HMVC component model
  • A modular web framework supporting all common GUI
    approaches
  • A platform for web framework development and
    research
  • An Object-Oriented web framework with support for
    first-class flows
  • A web framework integration platform

29
Further work
  • Remote integration a service protocol with
    Environment over Web Services
  • Weaver templating framework compatible with JSP
    tags, Wicket markup, JSF components, Facelets,
  • Blocking continuation support
  • Integration with Wicket, JSF, Struts, Spring MVC
    WebFlow, Echo2, GWT
  • Aranea for rich client (Eclipse RCP)

30
Thank you! Questions?
Write a Comment
User Comments (0)
About PowerShow.com