Nuxeo EP 5
Open Source Enterprise Content Management

A Seam Case Study

Thierry Delprat, CTO
tdelprat@nuxeo.com


Agenda
· What is Nuxeo 5?
­ Architecture overview

· Nuxeo 5 EP
­ Challenges and requirements of the Web UI front-end

· Nuxeo 5 and Seam
­ How we use Seam to build Nuxeo 5 EP

2


Nuxeo 5 ­ Solution Overview
· An Open Source ECM solution
­ EDM, WF/BPM, Collaboration, WCM ...

· A platform for building custom ECM solutions
­ Generic services with an « extension and customization » model ­ A framework for building ECM applications

· The Java 5 version of CPS 3.4
­ Keep the proven concepts of Zope/CPS (2000 -> 2006) ­ Leverage the Java 5 infrastructure

· A multi-platform and multi-target ECM solution
­ Thin client: Java EE Web application ­ Nuxeo 5 EP ­ Rich client: Eclipse RCP application ­ Nuxeo 5 RCP ­ Client/Server: RCP client with JEE server
3


Nuxeo 5 ­ Architecture Overview
· Core Layer: Embeddable document repository
­ Storage-oriented services + plugin model ­ Repository API: POJO and ejb3

· Service Layer: a extensible set of ECM services
­ Generic and con gurable services + extension model ­ Services API: POJO and ejb3

· Client Layer: UI management
­ Links services together to achieve business speci c needs ­ Uses Services Layer and Core Layer API ­ Clients can be
· Web application · RCP Application · Flex client
4


Nuxeo 5 ­ « 10 000 feet view »
Audit Service Web Application EJB Relation Service WF and BPM Service EJB Nuxeo Core
Query Management LifeCycle Management Security Management

APIs

APIs

RCP Application POJO Flex Application

Versions management Schemas Management

Transformation Service Directory Service Indexation Service POJO

Nuxeo Core (Content Repository)
Storage adapter

JCR/Jackrabbit

NXRuntime JBoss (JMX) or Eclipse RCP (OSGi)

5


Nuxeo 5 EP - Web UI
The web client on top of Nuxeo 5 EP services
What are the requirements Why we choose JSF and JBoss Seam

6


Requirements > Generation engine
· Powerful templating system
­ Want to keep a templating engine with a composition system

· MVC model, Widget and Layout system
­ Clear separation of concerns (Presentation / Validation / Model) ­ Reusable and customizable widgets (like in CPS) ­ Complete layout system like with CPSSkins

· Not tied to HTML
­ Keep the possibility to generate non HTML data (ie : XForm)

7


Requirements > Why JSF & Facelets?
· Great standard even if complex
­ Java EE Standard ­ Very pluggable and extensible (EL Binding, Layout and Theme manager)

· Growing libraries of Widgets
­ from Ajax/HTML to DataModel

· IDE support is growing · Facelets are close to Zope's PageTemplates (ZPT)
­ Templating and slot model ­ Pure presentation technology ­ Clean for designers

8


Requirements > Web Framework
· JSF and Facelets compliant · Cache aware state management
­ Each page rendering needs to fetch a lot of documents
But most documents are the same between two requests keep state of the user context

­ Data needs to be fresh and invalidated

· Remote access to application's controlers
­ Access via Ajax ­ Access via Browser helper ­ Access via O ce Plugin

9


Requirements > Web Framework
· Seamless EJB3 integration
­ Easy access to EJB3 Nuxeo EP Services ­ JSF binding

· Loosely coupled UI and application components
­ Nuxeo 5 must provide hot-pluggable Web components
· Shared context · Dependencies injections · Events system

· Multiscreen and wizards management
­ ECM provides a lot of use cases ­ Manual page ow management is boring

10


Nuxeo 5 Web Framework > Why Seam ?
· Seam provides a lot of the needed features "out of the box"
­ Native EJB3 integration ­ Bijection ­ Seam context management ­ Seam remoting and Ajax4JSF integration ­ Page ows via JBPM integration

· Good t with other selected infrastructure components
­ JBoss AS, jBPM and JSF

· Great project! :-)
­ Good references of Seam's lead developers ­ The right vision for a web framework

· New, modern and evolving framework
11


Nuxeo 5 and Seam
How we use Seam in Nuxeo 5 EP

12


Nuxeo 5 & Seam > Context Management

Usage
· Partial content location tree => Seam context
­ Read placeful con guration
· UI Theme & Perspective con guration · User Noti cation

Server Domain Workspace

Users Documents Theme

­ Retrieve data to display

Current Document
Children

· Current working context => Seam context
­ Current document and children ­ Clipboard (cut/copy/paste) ­ Working set of documents
· Easy mass document management
Clipboard
Shared Context

MySelection

13


Nuxeo 5 & Seam > Context Management

Content
· Seam context stores Document and lists of documents
­ DocumentModel is an artifact for a document and associated con guration
· Lazy data fetching from the core · Lazy placeful con guration fetching

­ Services may contribute new facet of contextual data
· Security descriptors, Relations informations, Subscription con guration, ...

· Context variable are usually pulled via factory
­ Use of the Seam @Factory annotation ­ Use of @DataModel annotation to feed DataLists from context

· Each component can access easily the contextual documents
­ Ask for injection via @In

14


Nuxeo 5 & Seam > Context Management

Injection & Outjection
· Services get the current document by injection (AL base class)
public abstract class InputController{ @In(required = true) protected ECServer ecServer; @In(required = true) protected ECDomain ecDomain; @In(required = true) protected ECContentRoot ecContentRoot; @In(required = false) protected DocumentModel currentItem;

· Navigation controlers outject the currentDocument
Navigation tree Breadcrumb AAcitons cttons AAcitons c iions
Current Document

Factory Factory Factory

current children security info relations info

15


Nuxeo 5 & Seam > Context Management

Events and Invalidation
· Context Invalidation
­ Dependent context variables
update currentDocument => update currentDocumentChilds

­ Invalidation needs to
· nullify the variable to get @Factory called the next time (lazy refresh) · call explicitly the factory

­ Dependencies are spread across components that don't know each others (distributed invalidation needed)

· Seam messaging system is used to propagate context changes
Events.instance().raiseEvent(EventNames.DOCUMENT_SELECTION_CHANGED);

Component A
@Observer( { EventNames.DOCUMENT_SELECTION_CHANGED, Component B EventNames.CONTENT_ROOT_CHILD_SELECTION_CHANGED, EventNames.DOCUMENT_CHANGED }) @Factory("documentResource") public void getDocumentResource() { documentResource = relationManager.getQNameResource(documentNamespace, currentItem); }

16


Nuxeo 5 & Seam > Context Management

Caching
· "Stalled copies" problem
­ Long running contexts act as a cache (session/conversation)
· invalidation needs to be propagated when changes occur (document edit, security update, new child ...)

­ There may be a lots of users using the same document
· e cient to share the state of a document across user's contexts (Domain, Workspace, Folders, etc.)

· Nuxeo 5 Cache and Context management
­ The documents are actually stored in JBoss cache
· Cache is invalidated by core events

­ The context holds GhostDocumentModels or lists of Ghosts
· acts as transparent stubs to the real DocumentModel in the shared cache

17


Nuxeo 5 & Seam > Context Management

Conversation
· Nuxeo 5 uses nested conversations
­ Wizards ­ Temporary state management

· The Seam Workspace Management is useful for Nuxeo 5
­ like opening several File Explorers is parallel

· Nuxeo 5 will use long running conversations
­ Parallel sessions that holds the navigation context ­ Use Seam Workspace Management to switch between contexts

18


Nuxeo 5 & Seam

JSF Limitations
· JSF is a powerful UI model, but...
­ urls are not meaningful ­ open in new tab/window is broken by JS form submission ! ­ EL does not permit to send parameters

· Nuxeo 5 needs meaningful urls
­ Accessibility and WCM ­ Bookmark a Document ­ Send a link to a document via Mail

· Seam provides a helper for these problems
­ Integrate GET requests with JSF and Context ­ Bind requests parameters ­ Used by Nuxeo 5 to generate 'PermLink' for the documents ­ EL enhancements in latest Seam
19


Nuxeo 5 & Seam

jBPM Integration > Page ow
· In ECM creation wizard are useful
­ Fill out all the properties of the complex document ­ Let user de ne di erent options during the creation process
· Choose templates during the creation process · Assign roles to users

­ Optional "step by step" interactive help

· Nuxeo 5 uses Page ow for wizard
­ Complex screens series can be easily modelized ­ Make the application « agile » to t customer needs ­ Temporary state is easily handled by the Seam context

20


Nuxeo 5 & Seam

Integrated Remoting
· Some Nuxeo 5 Seam Components are accessed remotely
­ ActionListener ­ Speci c Seam Components

· By some PlugIns like LiveEdit
­ Use SOAP to integrate Nuxeo5 with MS O ce and OpenO ce

· By the browser helpers (Firefox and IE)
­ Use Seam remoting to upload les by Drag&Drop

· The theme Editor
­ Uses Seam remoting to edit the theme from AJAX WYSIWYG editor

· Will be used for internal Drag&Drop and AJAX features
­ When Nuxeo 5 is aligned with latest Seam release (1.1)

21


Nuxeo 5 & Seam

Integrated Remoting > Examples

Drag & Drop ScreenCast

Drag & Drop les from the Desktop to the Browser
Great User Experience for le upload! Firefox / Internet Explorer Win32 / MacOS / Linux

Nuxeo Theme Editor
Modify page layout from the browser using AJAX Add page fragments visually Basically: a WYSYWG UI editor for JSF web apps

22


Nuxeo 5 & Seam

Additional Views and Actions
NXRelations NXAudit NXWork ow Contributed Views

23


Nuxeo 5 & Seam

Loosely coupled components
· The Nuxeo 5 UI is build from several components
­ Base components (DocumentManager, SecurityManager ...) ­ Additional optional components
· NXAuditClient · NXRelationClient · NXWork owClient · etc.

· Each additional component uses NXRuntime extension points
­ to contribute Views
· Facelets that provide a new view on Documents: AuditView, RelationView, TaskView, etc.

­ to contribute Action
· Buttons or Links to achieve additional processing: Add a relation, Add a comment, Create a new folder, etc.
24


Nuxeo 5 & Seam

Loosely coupled components
· Components share some state via the context
­ At least the currentDocument ­ Most ActionListers use @In to get some contextual documents

· Components may notify each other
­ Usage of the @Observer to become an event listener

· New components may be easily added
­ Only cares about the shared data and events
· not "who" the other components are

­ New views can be added transparently

25


Nuxeo 5 & Seam

Factory for EJB3
· Each action listener needs to access one or more services of Nuxeo's platform · Services are accessed via a Delegate Layer
­ Wraps remote or local calls

· Delegates use the Seam component manager pattern
­ use @Unwrap to access services via a transparent Factory

· Base components are created at application start-up
­ use @Startup to load services automatically

· Base class of Action Listener provide compulsory services
­ contains @In to get all basic services

26


Nuxeo 5 & Seam

Components interactions
@In / @Out / @Factory Facelet FFacelet acelet Action Listener (Seam Component) @Unwrap Delegate (Seam Component) Platform service

NXAction

Seam Events

Seam Context Conversation / Session

Jboss Cache update / invalidate

NXCore events

@In / @Out / @Factory Facelet FFacelet acelet Action Listener (Seam Component)

@Unwrap Delegate (Seam Component)

Platform service

27


Nuxeo 5 & Seam > Conclusion
· Seam
­ Provides a nice infrastructure for Nuxeo 5 web application ­ Helped us building Nuxeo 5 in a few months

· Provides a great pluggable component model for the web layer
­ Easily de ne new ECM Actions

· A lot of good perspectives
­ Align on Seam 1.1 in the next days ­ Leverage Seam and Ajax4JSF integration ­ Leverage Workspace Management ­ Leverage integration between
· NXWork ow (JBPM based) · Seam Business Process Context

28


ank you!

www.nuxeo.com - contact@nuxeo.com - www.nuxeo.org


Download & Enjoy!
http://www.nuxeo.org/download

www.nuxeo.com - contact@nuxeo.com - www.nuxeo.org