users@javaserverfaces-spec-public.java.net

[jsr344-experts mirror] [jsr344-experts] [730-TaskFlows] PROPOSAL

From: Edward Burns <edward.burns_at_oracle.com>
Date: Tue, 6 Mar 2012 19:27:07 -0800

Hello Experts,

This proposal has gone through seven revisions, starting on 2011-09-27,
and now it's time to share it with the EG and start discussion in
earnest on 730-TaskFlows. Please look for paragraphs that start with
the string "ACTION:" for instructions on what I want you to do with that
section.

Let's try to have the first round of discussion on this done by next
Wednesday.

FWIW, this document is available at in svn at

  svn checkout https://svn.java.net/svn/javaserverfaces-spec-public~svn/trunk/www/proposals/JAVASERVERFACES_SPEC_PUBLIC-730

  the document is proposal.txt

and at <http://javaserverfaces-spec-public.java.net/proposals/JAVASERVERFACES_SPEC_PUBLIC-730/proposal.txt>.

Version 20120306

SECTION: Introduction and basic Q&A

ACTION: read this for background on what this is all about.

The view (or page) is the most common unit of abstraction in the current
progamming model for JSF applications. The absence of any formal way to
group related views together leads to web applications that suffer from
the same maintainability and understandability problems as a large
program written as a single programming language function with goto
statements being used to control flow. Specifically, if the smallest
unit you have is the view, then applications quickly become a difficult
to maintain collection of views and the connections between them. This
feature intends to provide support for encapsulating related views
together such that applications can be created as composites of modules
of functionality, with each module consiting of well defined entry and
exit conditions. This feature is heavily influenced by the design of ADF
Task Flows in Oracle's Fusion Middleware. Spring Web Flow also
influenced the design.

What is a task flow?

  A collection of JSF views (and related artifacts) with explicitly
  defined entry and exit points that have been assigned some application
  specific meaning by the developer. Usually the objects in a task flow
  are designed to allow the user to accomplish a task that requires
  input over a number of different views. The canonical example of a
  flow is an "order checkout" process where the user enters in address,
  payment, shipping information, etc., and then submits the entire
  result at the end, placing an order.

How do you get into and out of a task flow?

  The manner in which we define a flow must have some way to declare
  which nodes serve as entry and exit points of the task flow

What changes do we need to make to the navigation system?

  We need to build on the existing navigation system, including
  everything that we've done in the past and in this version of the spec
  as well. I imagine taking the existing navigation data structure
  (including the provision for implicit navigation) and making it a
  stack of such structures.

How do you define a flow as an object?

  Here are the three most obvious approaches.

  1. additional syntax in the faces-config.
  2. metadata in the Facelet pages that comprise the flow.
  3. java code

  Discoverability is a big concern. It's the same concern we have with
  annotations vs. xml.

  Question: should we even bother considering cases 2 and 3?

SECTION: Artifacts

ACTION: Read this and comment on if you think I've decomposed the
artifacts correctly. I have made every effort to have this list of
artifacts be exhaustive and inclusive, again, with the close input from
the principals of the three most popular task-flow-like systems, ADF
Task Flows, Spring Web Flow, and MyFaces CODI/Orchestra. I strongly
hope that the EG doesn't feel the need to add anything to these
artifacts, but I also know that I'm a very fallible and ignorant human,
so I'll list them here and hope they don't grow too much.

This section defines the artifacts and terminology of task flows. These
artifacts have been arrived at with the input of Keith Donald from
VMware, David Schneider from Oracle, and Gerhard Petracek from Apache.
I have taken the union of input from my interviews with these three
individuals and synthesized this list of artifacts. This list was
present in the EDR of the spec we released in November 2011.

Task Flow

  This is the fundamental artifact for the feature. A Task Flow enables
  navigation, encapsulation, reuse, and managed bean lifecycles within a
  JSF application.Instead of representing an application as a collection
  of Faces Views, related Views can be grouped into a collection of
  reusuable Task Flows. Each Task Flow contains a portion of the
  application's flow of control graph. The nodes in the Task Flow are
  called activities. The edges between the nodes are called control flow
  cases. A special case of a Task Flow is a "Bounded Task Flow". This
  variant has all the properties of a Task Flow but adds the ability to
  declare a start node and zero or more exit nodes.

Flow Node

  A Task Flow is composed of a number of Flow Nodes, of which several
  types are defined.

  View

    This is just a JSF page

  Method Call

    An arbitrary method call, specified via EL. This includes the use of
    paremeters.

  Navigation Rule Set

    This is an instance a group <navigation-rule>s that have been in JSF
    since the beginning.

  Task Flow Call

    Declares that this Task Flow is calling another Task Flow.

  Control Flow Rule

    A Control Flow Rule declares how one Flow Node relates to another
    Flow Node. Note that this concept may not be necessary when using a
    FDL that supports programmatic logic, such as Java.

  Input Parameter

    An Input Parameter only makes sense on a Bounded Task Flow, and
    declares a value necessary to the operation of the Bounded Task Flow

  Output Parameter

    An Output Parameter is a declared name=value pair that will exist
    when a flow is exited.

  Flow Scope

    The Flow Scope is a CDI custom scope that is associated with a
    specific task flow and only exists while the user's session is
    navigating within that flow.

  View Activity

    ACTION: David Schneider, can you please answer these two specific
    questions?

    Is there ever a case where you want to collect the attributes from a
    single View Activity instance, and associate them with a collection of
    views, rather than just a single view?

    In other words is there always a 1:1 mapping between View Activity and
    view? I'm wondering if the view activity can be specified within the
    <f:metadata> section for a page.

Router Activity

  The conditional navigation in JSF 2 lets you accomplish a similar thing.

Method-Call Activity

  Invokes application logic via an EL expression. May generate a fixed
  outcome or use a method return value.

Scopes

  PageFlowScope

  ViewScope

  FaceletScope (maybe call it ViewFragmentScope?)

Need a way to have managed bean definitions be scoped within a task flow.

SECTION: Requirements

ACTION: As with the Artifacts section, read this and comment on if you
think I've captured all the requirements. Again, I sincerely hope I
didn't miss anything but I am very well aware of my own ignorance in
these matters. You all are the experts.

730-TaskFlows_FlowDeclarationLanguageSPI

It must be possible to do all the authoring for all of the artifacts
related to this feature using pure Java or XML, or even an unknown
FDL. There is precedent for this in SpringWebFlow, where flows can be
declared in XML, in Groovy, or in Java (this last is in SWF3, which was
tabled before completion).

730-TaskFlows_FlowDeclarationLanguageInFacelets

It must be possible to author flows by including metadata in Facelet
pages. This enables the developer to have a choice between centralizing
their flow data in one place, or having it spread out across many views
in the app.

730-TaskFlows_Visualization

It must be possible for a tool to produce a high fidelity visualization
of the flow in an application, regardless of how the flow is authored.

730-TaskFlows_Modularity

It must be possible to group views together into modules with well
defined entry and exit points.

730-TaskFlows_JarOrExplodedPackaging

It must be possible to package a task flow as a jar file, or as an
exploded directory. In both cases, the system must be able to
automatically discover all information necessary to use the task flow
lazily, once per application initialization, without any additional
configuration being provided to the application. In other words, "drop
in and go". This will make it possible to offer task flows as re-usable
components in a software repository, such as a maven repository.

730-TaskFlows_DesignTimeFlowValidation

Whatever way the flow is declared, it must be possible to validate the
correctness and validity of a flow at design time and at run
time. Consider the analogy of a puzzle piece. On its own, a puzzle piece
may be a valid puzzle piece, but it is only valid for inclusion in one
specific puzzle.

730-TaskFlows_FlowOfFlows

It must be possible to compose a flow as a flow of self contained inner
flows.

730-TaskFlows_CohesiveWithJSF

While other flow technologies strive to be agnostic to a particular view
technology, JSF Task Flows will specifically be designed for JSF. It is
not a requirement to be view technology agnostic.

730-TaskFlows_PortletSupport

Task Flows must be 100% usable inside of portlets.

730-TaskFlow_Scope

There must be an easy-to-use scope concept that is bound to the task
flow. The metadata for a task flow must include what managed beans are
involved in the task flow, including managed beans that are declared
only with annotations. Any managed beans defined in a scope must be
visible only to views in that scope. This is so two different flows can
both define a bean named 'foo' and get their own definition at runtime
without colliding with another flow.

730-TaskFlow_Access_CSRF

The task flow access feature must play well with our CSRF protection
feature.

730-TaskFlow_PrettyURLs

It must be possible to make it so when a task flow is traversed, the
URLs in the browser make sense for Search Engine Optimization and
aesthetic purposes.

730-TaskFlow_MultipleWindowResilience

The task flow feature must function properly even when there are
multiple browser windows open on the views of a task flow, each at
different stages of the task flow.

730-TaskFlow_InitializerFinalizer

The task flow must have a way to define via EL a method (with
parameters) to be executed when the flow is entered and exited.

SECTION: Non-requirements

730-TaskFlow_Templates

ADF has a task flow template feature. This is out of scope for this
release.

730-TaskFlow_RegionsFragments

ADF has a region/fragment concept. This is out of scope for this release.


-- 
| edward.burns_at_oracle.com | office: +1 407 458 0017
| homepage:               | http://ridingthecrest.com/