38
The web framework dream team Johan Eltes [email protected] e www.callistaenterprise.se

The Web Framework Dream Team

Embed Size (px)

DESCRIPTION

Presentation on modularization of web applications at Callista Developers Conference 2008

Citation preview

Page 1: The Web Framework Dream Team

The web framework dream team

Johan [email protected]

www.callistaenterprise.se

Page 2: The Web Framework Dream Team

The web framework dream team, Slide 2Copyright 2008, Callista Enterprise AB

Agenda

• Customer Case Background

• Requirements

• The reference architecture

• The frameworks and their contributions

• Lessons learned

Page 3: The Web Framework Dream Team

Strategic drivers behind reference architecture

The web framework dream team, Slide 3Copyright 2008, Callista Enterprise AB

National IT strategi for healthcare

Regional strategi

Regional projects

IT a

rchit

ectu

re

Porta

l fram

ewor

k

Page 4: The Web Framework Dream Team

IT Architecture for VGRegion HealthcareC

ore He

althca

re interop infrastructure

Legacy EPR 1 Legacy EPR 2

Internal logInternal log…

Internal Workflow

Internal Workflow

Gradual adoption of legacy healthcare systemsUnified

Information View (portal)

EPRMy

Tasks

SOAPlatformAlarming and

loggingPortal

frameworkPeople

Directory

Internal roles database

LabProcess

Internal roles database

AdaptersAdapters

Workflow Engine

YP

Legacy Lab System

Internal log

Internal Workflow

Internal roles database

Adapters

Taxonomy services

New business process support

(composite apps), utilizing service enabled back-

ends

Native Services

Page 5: The Web Framework Dream Team

Layered View

Back-end enterprise resources

Canonical (Enterprise) Services

Composite Applications

Business Model

Workflow

Presentation

Composite Services

Local development. Put together a development

framework!

SO

A

Pla

tfor

m

COTS and semi-COTS

Page 6: The Web Framework Dream Team

Requirement: “Use-Case-as-service”

The web framework dream team, Slide 6Copyright 2008, Callista Enterprise AB

Usecase Usecase

Process Service

Process Service

Data Service

Data Service

Business ValueBusiness Value

Page 7: The Web Framework Dream Team

Requirement: Portability

The web framework dream team, Slide 7Copyright 2008, Callista Enterprise AB

Container portability (Java EE)Portability across Web app and Portlet

Web-appPortlet

Page 8: The Web Framework Dream Team

Requirement: Web designer friendly templating technology

The web framework dream team, Slide 8Copyright 2008, Callista Enterprise AB

NetWeaver

Design in DreamWeaver

Development in XML editor

Page 9: The Web Framework Dream Team

Requirement: Support Verva web design requirements

• Graceful degradation– Always functional

– Usability proportional to browser capabilities

• Example– JavaScript disabled

The web framework dream team, Slide 9Copyright 2007, Callista Enterprise AB

Page 10: The Web Framework Dream Team

Requirements: Agile Development environment

The web framework dream team, Slide 10Copyright 2008, Callista Enterprise AB

• No IDE / Developer set-up lock-in

– Portable builds

– IDE settings / projects generated from build files (“build file is master”)

• Reasonable hardware requirements

– Run well in VMWare on mid-range laptop

• Broad, practical availability of tooling

– Consultant-friendly

• Fast code-test-debug cycle

– Do not require deploy in WebSphere Portal for developer testing

– “Remove” inherent web programming issues / cost drivers

Page 11: The Web Framework Dream Team

Major Challenge: Re-use at Use-Case-level

The web framework dream team, Slide 11Copyright 2008, Callista Enterprise AB

Usecase Usecase

Process Service

Process Service

Data Service

Data Service

Business ValueBusiness Value

Page 12: The Web Framework Dream Team

How will Use-cases become components?

The web framework dream team, Slide 12Copyright 2008, Callista Enterprise AB

Sample Composite Application

List Address Entries

User

Create Address Categories

Edit Address Entry«include»

«include»«include»

Demo

Page 13: The Web Framework Dream Team

Use-cases as Components

The web framework dream team, Slide 13Copyright 2008, Callista Enterprise AB

Semantically equivalent to calling modal dialog in Swing!

Composite Application

«webcomp»:Edit Address Entry

«webcomp»:NewCategory

«webcomp»:AddressList

1: editAddressEntry(long) :entryId of new Entry

1.1: addNewCategory() :CategoryId

1.2: addNewCategory() :CategoryId

Page 14: The Web Framework Dream Team

The web framework dream team, Slide 14Copyright 2008, Callista Enterprise AB

Web realization versus Rich Client

• Think ”Modal sub dialogs”

• Each dialog is tied to back-end logic

Use-case logic

Back-end services

Page 15: The Web Framework Dream Team

Re-use in another composite application

The web framework dream team, Slide 15Copyright 2008, Callista Enterprise AB

Another composite application

«webcomp»:Edit Address Entry

«webcomp»:NewCategory

1: addNewCategory() :CategoryId

Page 16: The Web Framework Dream Team

Adding portability…

The web framework dream team, Slide 16Copyright 2008, Callista Enterprise AB

«webcomp»

:Edit Address Entry

• WEB-INF artifacts are not portable - nor composable

– We can’t depend on JSPs

– A use-case web component will have to be a jar files that works on WEB-

INF/lib whether portlet or webapp (formulera om)

PortletWebApp

Page 17: The Web Framework Dream Team

“Remove” inherent web programming issues

The web framework dream team, Slide 17Copyright 2008, Callista Enterprise AB

public class Game extends Element {private static Random randomNumbers = new Random();public void processElement() {

Template template = getHtmlTemplate("game");int answer = 0, guesses = 0, guess = -1;

answer = randomNumbers.nextInt(101);while (guess != answer) {

print(template);pause();template.clear();guess = getParameterInt("guess", -1);if (guess < 0 || guess > 100) {

template.setBlock("warning", "invalid");continue;

}guesses++;if (answer < guess) template.setBlock("msg", "lower");else if (answer > guess) template.setBlock("msg", "higher");

}ContinuationContext.getActiveContext().removeContextTree();template = getHtmlTemplate("success");template.setValue("answer", answer);template.setValue("guesses", guesses);print(template);

}}

0. Get a random number between 0 and 1001. Show the guess-form2. Repeat until successful guess:2.1. The user enters a value and submits the form2.2. Validate the guess. I error (not between 0 and 100), continue at 2.2.3. Unless successful guess, show whether the guess was under or above the answer.2.4. Display guess-form.3.0 Show congratulations screen with number of guesses.

Page 18: The Web Framework Dream Team

Reduce semantic gap: Flow of events

The web framework dream team, Slide 18Copyright 2008, Callista Enterprise AB

• Continuations – Code flow mirrors use-case flow

• Supporting technologies– Code in Java

• The RIFE framework

– Code in XML

• Spring WebFlow

Page 19: The Web Framework Dream Team

The resulting reference architecture

The web framework dream team, Slide 19Copyright 2008, Callista Enterprise AB

Page 20: The Web Framework Dream Team

Systemnivå: Komponenthierarki

Web Framework Dream Team, Slide 20Copyright 2008, Callista Enterprise AB

:Entitetskomponent

Resursskikt

Verksamhetsskikt

Komponenttjänst

Anslutningsskikt

:Entitetskomponent 1

Resursskikt

Verksamhetsskikt

Komponenttjänst

Anslutningsskikt

Integrationstjänst Webgränssnitt

:Entitetskomponent

Resursskikt

Verksamhetsskikt

Komponenttjänst

Anslutningsskikt

:Processkomponent 1

Resursskikt

Verksamhetsskikt

Komponenttjänst

Anslutningsskikt

Integrationstjänst Webgränssnitt

Page 21: The Web Framework Dream Team

Logisk nivå (system-nivå): Beroenden vid återanvändning av web-dialog

Web Framework Dream Team, Slide 21Copyright 2008, Callista Enterprise AB

:Entitetskomponent

Resursskikt

Verksamhetsskikt

Komponenttjänst

Anslutningsskikt

:Entitetskomponent 1

Resursskikt

Verksamhetsskikt

Komponenttjänst

Anslutningsskikt

Integrationstjänst Webgränssnitt

:Entitetskomponent

Resursskikt

Verksamhetsskikt

Komponenttjänst

Anslutningsskikt

:Processkomponent 1

Resursskikt

Verksamhetsskikt

Komponenttjänst

Anslutningsskikt

Integrationstjänst Webgränssnitt

Page 22: The Web Framework Dream Team

Design-nivå: Beroenden vid återanvändning av web-komposit

The web framework dream team, Slide 22Copyright 2008, Callista Enterprise AB

Hierakiskt beroende i systemmodellen

Page 23: The Web Framework Dream Team

Logisk nivå (system-nivå): Beroenden vid återanvändning av komponenttjänst

Web Framework Dream Team, Slide 23Copyright 2008, Callista Enterprise AB

:Entitetskomponent

Resursskikt

Verksamhetsskikt

Komponenttjänst

Anslutningsskikt

:Entitetskomponent 2

Resursskikt

Verksamhetsskikt

Komponenttjänst

Anslutningsskikt

Integrationstjänst Webgränssnitt

:Entitetskomponent

Resursskikt

Verksamhetsskikt

Komponenttjänst

Anslutningsskikt

:Processkomponent 2

Resursskikt

Verksamhetsskikt

Komponenttjänst

Anslutningsskikt

Integrationstjänst Webgränssnitt

Page 24: The Web Framework Dream Team

Design-nivå: Beroenden vid återanvändning av service-komposit

The web framework dream team, Slide 24Copyright 2008, Callista Enterprise AB

Hierakiskt beroende i systemmodellen

Page 25: The Web Framework Dream Team

Dynamic view (runtime perspective)

The web framework dream team, Slide 25Copyright 2008, Callista Enterprise AB

<webcomp>

Address List<webcomp>

Add Category

<webcomp>

Address Entry

Business Component 1Business Component 2

Composite Application

Page 26: The Web Framework Dream Team

Selected frameworks

The web framework dream team, Slide 26Copyright 2008, Callista Enterprise AB

• Core requirements– Complete workflow in composable archives (jar files)

– Empty web-inf (breaking the monolith web app)

– Continuations (remove semantic gap)

• Spring WebFlow – Use-case logic– Clean separation of workflow logic

– Powerful, expressive, simple, continuation-based

• Facelets - Presentation– None-intrusive to html

– Supports jar packaging!

– Made for JSF (unlike JSP)

• JSF – Request processing– Standard and does support jar-packaging

– “Hidden” by Spring WebFlow

Page 27: The Web Framework Dream Team

Anatomy of a web use-case component(web composite)

The web framework dream team, Slide 27Copyright 2008, Callista Enterprise AB

«webcomp»

:Category

Presentation

Use-case logic

Back-end integration

Input / output parameters Context for use-case component instance state

Page 28: The Web Framework Dream Team

Anatomy of a web use-case component(web composite)

The web framework dream team, Slide 28Copyright 2008, Callista Enterprise AB

«webcomp»

:Category

Presentation

Use-case logic

Back-end integration

Input / output parameters Context for use-case component instance state

Spring WebFlow: category-flow.xml

Page 29: The Web Framework Dream Team

WebFlow – Sample – AddressEntryComposite

Open ESB, Slide 29Copyright 2007, Callista Enterprise AB

«action»

getNewOrExistingAddressEntity

start

«view»editAddressEntry

«action»save

«subflow»enterNewCategory

«action»assignNewCategory

exit

«flow»

«flow»

«flow»

ok

«flow»

cancel

«flow»

«flow»

cancel

add category

Page 30: The Web Framework Dream Team

Anatomy of a web use-case component(web composite)

The web framework dream team, Slide 30Copyright 2008, Callista Enterprise AB

«webcomp»

:Category

Presentation

Use-case logic

Back-end integration

Input / output parameters Context for use-case component instance state

Facelets: Category.xhtml

Page 31: The Web Framework Dream Team

Facelets– Sample – Category Composite

The web framework dream team, Slide 31Copyright 2008, Callista Enterprise AB

• None-intrusive to html

• Supports jar packaging (loading of views from class-path)

• Made for JSF (unlike JSP)

<h:commandLink action=“viewAddressEntryAction” ..>

Page 32: The Web Framework Dream Team

Anatomy of a web use-case component(web composite)

The web framework dream team, Slide 32Copyright 2008, Callista Enterprise AB

«webcomp»

:Category

Presentation

Use-case logic

Back-end integration

Input / output parameters Context for use-case component instance state

Java: CategoryFlowSupport.javaFaçade per use-case component.

Additional model beans when required

Page 33: The Web Framework Dream Team

Use-case façade

The web framework dream team, Slide 33Copyright 2008, Callista Enterprise AB

Page 34: The Web Framework Dream Team

But what about JSF?

The web framework dream team, Slide 34Copyright 2008, Callista Enterprise AB

• Just for bootstrapping Spring Webflow

• Generic faces-config in web-app

• No footprint in web composites<?xml version="1.0"?><!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN" "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">

<faces-config><application>

<navigation-handler>org.springframework.webflow.executor.jsf.FlowNavigationHandler

</navigation-handler><variable-resolver>

org.springframework.webflow.executor.jsf.DelegatingFlowVariableResolver</variable-resolver><view-handler>com.sun.facelets.FaceletViewHandler</view-handler>

</application>

<lifecycle><phase-listener>

org.springframework.webflow.executor.jsf.FlowPhaseListener</phase-listener>

</lifecycle></faces-config>JSF

Page 35: The Web Framework Dream Team

Environments

Web Framework Dream Team, Slide 35Copyright 2008, Callista Enterprise AB

• Development– Apache Tomcat with Apache Pluto

– Eclipse 3.3 (Europa) with WTP

• Deployment– WebSphere Application Server 6.1

– WebSphere Portal Server 6.0

• Build system• Maven 2 – manages the component architecture

• Generates Eclipse dependencies and project files

Page 36: The Web Framework Dream Team

Lessons learned

The web framework dream team, Slide 36Copyright 2008, Callista Enterprise AB

• Webflow

– Revolution for html centric web applications

– The foundation for use-case componentization

– WebFlow validation framework tied into SpringMVC• On the agenda for next version…

• Facelets

– Momentum depends on Seam

– Servlet required for loading web resources (images etc) from jar files (web composites)

– Intuitive

• Portability

– Native JSF implementations are not fully portable. We ended up bundling MyFaces rather than deploying to WebSphere JSF implementation (Sun RI)

Page 37: The Web Framework Dream Team

SummaryRe-usable Use-case Components Delivered!

The web framework dream team, Slide 37Copyright 2008, Callista Enterprise AB

Usecase Usecase

Process Service

Process Service

Data Service

Data Service

Business Value Business Value

…by the dream team: Spring WebFlow, Facelets, JSF, a reference architecture and some glue

Page 38: The Web Framework Dream Team

Time (?) for Questions!

The web framework dream team, Slide 38Copyright 2008, Callista Enterprise AB