Building XML Portals with Cocoon M atthew Langham S&N AG [email protected].

38
Building XML Portals with Cocoon Matthew Langham S&N AG [email protected]

Transcript of Building XML Portals with Cocoon M atthew Langham S&N AG [email protected].

Page 1: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Building XML Portalswith Cocoon

Matthew Langham S&N AG

[email protected]

Page 2: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Matthew Langham

• Technical Director Open Source Group– S&N AG, Paderborn Germany

• Co-Author: – Cocoon: Building XML Applications

• S&N donated Portal and authentication components to Cocoon– Main development by Carsten Ziegeler

• Committer and Release Manager

Page 3: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Agenda

• Starting with Apache Cocoon

• Adding Authentication

• Opening the Portal

• Building a Portal

• Examples and Outlook

Page 4: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Cocoon

• Apache Open Source project– http://xml.apache.org/cocoon

• Originally Started by Stefano Mazzocchi– Original goal: Redesign Apache.org

• XML Publishing Platform– Makes extensive use of XML and XSL

• Aim: To Separate Concerns (SoC)– Site Administrator, Content Deployer,

Layout Deployer

Page 5: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Cocoon

• Document generation on the server– Logical names used

„http://myserver/cocoon/helloworld“

• Runs in different environments – Servlet-Engine– Command Line

Page 6: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Cocoon

• Used for various Web application scenarios

– From Web sites to complete XML Portals– XML processing systems

• Extensible Architecture– Based on Apache Avalon– Integrates other open source projects

• Xalan, Xerces, FOP, Batik

– Add new components written in Java

Page 7: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Cocoon Architecture

• Sitemap– Centralized Configuration File in XML

• Sub-sitemaps possible

– Contains set of ready-to-use components• Use them to build functions• Write and „drop-in“ your own

– Contains collection of Pipelines (Functions)

Page 8: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Cocoon Architecture

• Pipelines– Pipeline processes a request

• Request matched to pipeline with a Matcher

– Contains chain of Java components• Generator• Transformer• Serializer

<map:match pattern=“welcome”> <map:generate src=“welcome.xml”/> <map:transform src=“stylesheets/welcome-page2html.xsl”/> <map:serialize type=“html”/></map:match>

Page 9: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Request<map:sitemap> <map:components> <map:generators/> <map:transformers/> <map:serializers/> <map:readers/> <map:selectors/> <map:matchers/> <map:actions/> </map:components> <...> <map:pipelines> <map:pipeline/> <map:pipeline/> <...> </map:pipelines></map:sitemap>

<map:sitemap> <map:components> <map:generators/> <map:transformers/> <map:serializers/> <map:readers/> <map:selectors/> <map:matchers/> <map:actions/> </map:components> <...> <map:pipelines> <map:pipeline/> <map:pipeline/> <...> </map:pipelines></map:sitemap>

GT

TS

Sitemap

Request

XSL

HTML

XML DB

Page 10: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

HTMLHTMLPDFPDF

Cocoon Architecture

XSLStylesheets

XSLStylesheets

XML Pipeline ConfigurationXML Pipeline Configuration

XSL Layout generationXSL Layout generation

XMLProcessing

XMLProcessing

DatabaseDatabase News Provider

PersonalNews

XML

SQL

LoginWeather

Stocks

Page 11: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Building XML Applications

• Cocoon is great .. for …– Publishing, Data source integration, multi-

channel

• But we wanted to do more!– Build XML Applications with additional

functionality

• While evaluating existing portal solutions– We decided that what was really needed

was an integrated Cocoon XML portal

Page 12: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

sunShine – built on Cocoon

• Commercial product developed by S&N– Based on Cocoon– Additional components and project

specific additions

• sunRise (auth) and sunSpot (portal)– Cocoon components– Completed in mid 2001– Used in various projects (production!)– Donated to Cocoon in Feb. 2002

Page 13: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Authentication (org.apache.cocoon.webapps.authentication)

• Mission– Authentication of Users– Protect Documents– Flexible Integration of User Databases– Support for Web Applications– Completely Designed using Cocoon-

Concepts!

Page 14: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Authentication (org.apache.cocoon.webapps.authentication)

• Solution– New Cocoon components for

• Common Session Handling• Actions for Authentication

– Everything configurable in Sitemap• Flexibility through pipelines• Mapping: Function Pipeline Call• Documents grouped by Handlers

Page 15: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Authentication (org.apache.cocoon.webapps.authentication)

Authentication Framework

Request Document A

DocumentProtected ?

YES

Get handler

UserAuthenticated?

YES: Respond with A

NO: Respond with A

Redirect Document

NO

Respond with Redirect-to Document

Document Protection - Flow

Page 16: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Authentication (org.apache.cocoon.webapps.authentication)

• Configuration– Mapping: Function Pipeline Call– Flexible Integration of data-sources– Simple Development of Management

Tools

Page 17: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Authentication (org.apache.cocoon.webapps.authentication)

Page 18: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Authentication (org.apache.cocoon.webapps.authentication)

Page 19: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Portal (org.apache.cocoon.webapps.portal)

• Mission– Flexible integration of User Databases– Profiles and Configuration completely defined in XML– Integration of “data-feeds” (portlets)– Portal user functionality– Multi-Channel – Completely designed using Cocoon-Concepts!

Page 20: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Portal (org.apache.cocoon.webapps.portal)

• Solution– Use “sunRise” for User Management– New Cocoon components for

• Portal generation• Portal configuration

– Everything configurable in Sitemap• Mapping Function Pipeline Call

– Coplets can be• A URI• A Cocoon Pipeline• A Java Class

Page 21: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Portal (org.apache.cocoon.webapps.portal)

• Portal Profile in XML per User– Selected Information Blocks (coplets)– Ordering and Configuration of coplets– Selected Layout (Colors etc)

• Profile Hierarchy for flexible maintenance– Changes reflected on next login– Profile Caching

• Profiles can be stored in files, databases ...

Page 22: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Portal

• Everything is configurable– Available coplets and their features– Layout information– User rights

• Example features of a coplet– Minimizing / Maximizing– Hiding– Configuration

Page 23: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

PortalPortal Generator

Get UserProfile

Add contentof each coplet

XSLT Transformer

Layout Portal

HTML Serializer

Generate Response

Page 24: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Portal

• Flexible Presentation– Stylesheets for multi-channel– Coplets can be channel-dependent

• Flexible Integration of– Authentication– Data-sources– Management Tools

Page 25: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Portal

Page 26: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Portal

Page 27: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Portal

Page 28: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Building A Portal

• Download the Cocoon distribution– Build from CVS

• Use the included example Portal as a base

• Choose some feeds– Standard format such as RSS helps

• News, Weblogs, …

– Other formats via Pipeline

• Define the coplet pipeline– Just a regular Cocoon pipeline

Page 29: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Coplet Pipelines

<map:match pattern="sunbanksunlet-onlinesundn.xml"> <map:generate src="http://www.s-und-n.de/aktuelles/news.xml"/> <map:transform src="sunbank/styles/sunLet_sundnNews.xsl"/> <map:serialize type="xml"/></map:match>

<map:match pattern="sunbanksunlet-account.xml"> <map:generate src="sunbank/resources/auth/sunlet-account.xml"/> <map:transform src="sunbank/styles/sunlet-account.xsl"/> <map:serialize type="xml"/></map:match>

<map:match pattern="sunbanksunlet-online-*.xml"> <map:generate src="http://p.moreover.com/cgi-local/page?index_{1}+xml"/> <map:transform src="sunbank/styles/sunLet_MoreoverDotCom.xsl"/> <map:serialize type="xml"/></map:match>

Page 30: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Building A Portal

• Configure the coplets– Edit coplet definition file or use provided

tools

• Add new coplet to profile– Edit profile definition file or use provided

tools

• Define your Portal Layout– Just change the stylesheet– Use a Selector to have a “night” portal

Page 31: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

A News Portal

Page 32: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Outlook

• Merging other Cocoon portal ideas

• Flexible architecture– Different pluggable Portal Managers

• Flexible Presentation– Not limited to tables

• JSR 168 support– Evaluation if and when available

Page 33: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

From a bank…

Page 34: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

…to the moon

• Andrew J Lewis, NASA:

Cocoon 2.x is being used as the core of a new portal that is being built at NASA Kennedy Space Center.

Thanks you all for making my job SOOO much easier!!!

Page 35: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

…and other fans

• Bert Van Kets, The Vision Web Belgium NV

Although I'm working in a Microsoft adept environment, where people install every Microsoft Server Product available, it took only 1 little 20 minutedemonstration of the S&N Cocoon Portal to convince everybody the companyneeds this.

... the portal was up and running and ready to be filled with content in 1 day, including presentation adjustments. The underlying technology of XML, XSLT and the implemented Java components make the portal very easy to manageand adjust.

Page 36: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Closing the Portal

• XML Portal available in Cocoon today!– Tried and trusted

• Used by NASA, BASF-IT Services and others

– It‘s open source• You don‘t like it? – help us make it better!

• Example portal included– Show your customers!– Change the stylesheet for more Wows!

• Documentation is available

Page 37: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.

Matthew Langham, S&N AG

Cleaning Up

• The Company– http://www.s-und-n.de

• Email me– [email protected]

• Cocoon Authentication and Portal– http://xml.apache.org/cocoon– CVS checkout and build– Contains documentation– Contains tools

          

                     

Page 38: Building XML Portals with Cocoon M atthew Langham S&N AG mlangham@s-und-n.de.