XML.com: XML From the Inside Out
oreilly.comSafari Bookshelf.Conferences.

advertisement

Building XML Portals with Cocoon
Pages: 1, 2, 3

Along with the components that can be used to protect the pipeline, Cocoon also offers several browser-based tools that will let you maintain a user database and configure new users or roles without having to edit the underlying XML by hand. Because the different functions (such as "add user" etc.) are mapped to specific pipelines inside the authentication framework, it is easy to configure the tools so that say an existing data-source can be used instead of the sample XML file which is provided in the distribution.

Tool for user
management

Using the sample authentication setup provided in the distribution, it is easy to build prototype solutions that can be reconfigured from a test database to the production database by just changing the handler configuration. As mentioned, the authentication components can be used on their own to provide access control to any type of application built with Cocoon.

Portal

Because of the vast amount of information available on the Web, portals have become a common tool which provides a personalized view on that information. A portal normally consists of the user authentication and the personalized content view. The content view is generated from several different sources, such as news or weather feeds. This is of course dependent on the type of portal being built.

When we evaluated available portal solutions for our customers, it quickly became clear that the "out-of-the-box" solutions were not flexible enough to meet the varied requirements of our customers. Because of the increased need for "multi-channel" solutions (i.e. publishing to different formats such as HTML, WML or PDF) and the requirement that the portal be able to connect up to varied data sources, we decided that adding portal components to Cocoon would provide an ideal solution.

Mission

The most important goal of the Cocoon portal was to maintain Cocoon concepts, in particular the flexibility of using pipelines to access the various data sources and the use of XML inside the platform. The solution should provide typical portal functionality, such as the ability to configure the layout of the portal or for the user to be able to decide which data-feeds she would like to see. The portal configuration (available portlets etc.) and the portal view should be described using XML. The layout of the portal should be done using stylesheets, so the portal can be generated for the needed output formats, like HTML, WML or even PDF. Using stylesheets to layout the portal would also allow for flexible generation based on information such as the type of browser used or whether the user prefers a "tabbed" portal or not.

Solution

In order to authenticate a portal user, the portal uses the Cocoon authentication components described above. This allows existing user databases to be used as a storage for portal users. The portal framework contains additional Cocoon components for the portal generation and configuration. Accessing different data sources, known as portlets in most of the portal world (Cocoon calls them "coplets"), can be done via pipelines, URIs, or even Java classes which implement the coplet interface.

Using XML as the format for the portal (that includes profiles and coplet configuration) means that the portal can be extended as needed. The portal demo which is included in Cocoon has typical portal features like minimizing or maximizing a coplet, changing colors, or rearranging the layout.

An example portal

The portal view a user receives is described in XML. When the user logs into the portal, various steps are performed to build the user-specific portal. The build process begins with two base profiles, the definition of the coplets, and the definition of the portal layout. The following XML snippet shows the definition of a coplet called "sundnnews". Notice how the definition of the resource uri maps to a pipeline inside the Cocoon sitemap. This example shows how a normal Cocoon pipeline can be used as the source for a coplet.

<coplets-profile>
    <coplets>
        <coplet id="sundnnews">
             <resource uri="
                 cocoon:raw:/sunspotdemosunlet-onlinesundn.xml"/>
             <configuration>
                 <mandatory>false</mandatory>
                 <sizable>true</sizable>
                 <active>true</active>
             </configuration>
             <title>s&n News</title>
             <status>
                 <customize>false</customize>
                 <visible>true</visible>
                 <size>max</size>
             </status>
        </coplet>
        ...
    </coplets>
</coplets-profile>

The base layout profile describes the layout of the portal, such as which style (column or tabbed) is to be used and whether a footer or header is available.

Pages: 1, 2, 3

Next Pagearrow