Docstoc

View Presentation Princeton University Welcome

Document Sample
View Presentation Princeton University Welcome Powered By Docstoc
					Portlets in uPortal

Ken Weiner kweiner@unicon.net 310.414.6760 x216

Portlets in uPortal

Overview

• • • • • •

Portlet Specification Jakarta Pluto Portlets in uPortal 2.3 Portlets vs. Channels Portlet Development uPortal Portlet Roadmap

Portlets in uPortal

Portlet Specification

Portlets in uPortal

JSR 168: Portlet Specification • Java Community Process
http://www.jcp.org/en/jsr/detail?id=168

• • • •

Led by Sun and IBM 1.0 Final Release Oct 27, 2003 Interoperability between Portlets/Portals Set of APIs addressing areas of aggregation, personalization, presentation and security.

Portlets in uPortal

Future of Portlet Specification • Portlet filters • Inter-portlet event-style communication • Portlets produce and influence markup outside of the portlet fragment

Portlets in uPortal

Jakarta Pluto

Portlets in uPortal

Apache Portals Project
http://portals.apache.org/

• Pluto
– Portlet Container – Reference implementation of JSR 168

• WSRP4J
– Reference implementation of Oasis WSRP Spec – Producer/consumer interfaces – Consumer Portlet proxy

• Jetspeed-2
– Enterprise portal – JSR-168 compliant

Portlets in uPortal

Jakarta Pluto
http://portals.apache.org/pluto/ • Status
– Apache Incubator

– Apache Portals

• Contents
– – – – Portlet API (JSR 168) Portlet Container Portal Driver Test Suite Portlet

Portlets in uPortal

Pluto Component Relationships
Portal
org.jasig.portal.container org.apache.pluto.portalImpl Implements

uPortal Pluto Portal Driver

Portlet Container
org.apache.pluto org.apache.pluto.om org.apache.pluto.services org.apache.pluto.core.impl Live in

Portlets
Portlet Portlet

Portlet Use

Portlet

Implements

Portlet API
javax.portlet

Portlets in uPortal

Pluto Object Model • Servlet
org.apache.pluto.om.servlet

– Web application, servlet definition

• Portlet
• Entity • Window
– Portlet window

org.apache.pluto.om.portlet

– Portlet application definition, portlet definition
org.apache.pluto.om.entity

– Portlet application entity, portlet entity
org.apache.pluto.om.window

• Common

org.apache.pluto.om.common

– Names, descriptions, preferences, etc.

Portlets in uPortal

Pluto Services • Information provider service
– Static information provider
• Portlet definition registry

– Dynamic information provider
• Portlet Modes, Portlet Window States, etc.

• Factory manager service
– Obtains an implementation through a factory

• Log service
– Defines a logging facility

Portlets in uPortal

Portlets in uPortal 2.3

Portlets in uPortal

Portlet Adapter
uPortal

Custom Channel

Portlet Adapter Channel

Web Proxy Channel

Portlet Adapter Channel

Pluto
Portlet Application Portlet Application

Portlet

Portlet

Portlet

Portlet

Portlets in uPortal

Portlet Adapter
• Java class name
– org.jasig.portal.channels.portlet.CPortletAdapter

• IMultithreadedCharacterChannel
– Produces character output rather than XML

• IMultithreadedPrivileged
– Has access to HttpServletRequest and HttpServletResponse

• IMultithreadedCacheable
– Utilizes uPortal content caching

Portlets in uPortal

Portlet File Structure
• All resources are packaged into a web application archive (WAR) • web.xml
– Specifies web application resources

• portlet.xml
– Specifies portlet resources

Portlets in uPortal

Deploying Portlets • Deployer tool
org.jasig.portal.container.deploy.Deployer – Required for Pluto container – Rewrites web.xml
• Inserts servlet definitions which wrap portlets

• Ant target
– Deploy one Portlet or all Portlets (in lib/portlets directory)
ant deployPortletApp -DportletApp=C:/TEMP/myPortlet.war ant deployPortletApp –DportletApp=all

Portlets in uPortal

Publishing Portlets: Getting Portlet GUID • Identify Portlet Definition
– Need to know the Portlet Definition GUID

testsuite.TestPortlet1

• Portlet Preferences
– Zero or more name-value pairs can be specified – Overrides Preferences specified in portlet.xml

testsuite.war
portlet.xml
<portlet-name> TestPortlet1 </portlet-name>

Portlets in uPortal

Publishing Portlets: Channel Type

Portlets in uPortal

Publishing Portlets: Portlet Definition and Prefs Enter Portlet Definition GUID

Enter zero or more portlet preference name-value pairs.

Portlets in uPortal

Sample Portlets in uPortal: Test Suite
Test Suite Portlet
– Distributed with Pluto – Tests
• • • • • • • • • • Render Request Render Response Portlet Session Portlet Context Portlet URL Portlet modes Portlet window states Resource loading Portlet actions Preferences persistence

Portlets in uPortal

Sample Portlets in uPortal: RSS Portlet
RSS Portlet
– Available at POST – Written by Plumtree Software – Displays RSS content – User can choose content with drop-down – User can edit the list of RSS source URLs – Supports RSS 1.0 and 2.0

Portlets in uPortal

Sample Portlets in uPortal: Google Portlet
Google Portlet
– Available at POST – Written by Plumtree Software – Allows search with Google Web APIs – Communicates with Google Web Service using SOAP – Requires license key configuration

Portlets in uPortal

User Information • Available as of uPortal 2.3.2 • Map user info in Portlet Application’s portlet.xml
<user-attribute> <description>User Given Name</description> <name>user.name.given</name> </user-attribute>

• Configure uPortal’s PersonDirs.xml
<attribute> <name>FIRST_NAME</name> <alias>user.name.given</alias> </attribute>

• Add code to Portlet
Map userInfo = (Map)request.getAttribute(PortletRequest.USER_INFO); String givenName = (String)userInfo.get("user.name.given"); String lastName = (String)userInfo.get("user.name.last");

Portlets in uPortal

P3P User Information Attributes • Platform for Privacy Preferences 1.0 • W3C
– http://www.w3c.org/TR/P3P

• Same attribute names used in WSRP • Examples:
– – – – user.gender user.name.given user.home-info.postal.city user.business-info.postal.name

Portlets in uPortal

Portlet Modes
• Portal must support…
– view
• Display current state of Portlet • Mandatory for Portlet

– edit
• Allows user to customize Portlet • Optional for Portlet

– help
• Provide help information about Portlet • Optional for Portlet

• Declaration in portlet.xml
<supports> <mime-type>text/html</mime-type> <portlet-mode>help</portlet-mode> </supports>

Portlets in uPortal

Custom Portlet Modes • Custom Portlet Mode examples
– – – – about config edit_defaults preview

• Not implemented yet • Declaration in portlet.xml
<portlet-app> <custom-portlet-mode> <name>config</name> <description>Admin functions</description> </custom-portlet-mode> </portlet-app>

Portlets in uPortal

Portlet Window States

• Portal must support…
– normal
• Portlet may be sharing page with other Portlets • Portlet should restrict size of rendered output

– maximized
• Only Portlet being rendered on the portal page • Portlet may generate richer content

– minimized
• Portlet should render minimal out put or no output at all

Portlets in uPortal

Custom Portlet Window States • Custom Portlet Mode examples
– detach – half-page

• Not implemented yet • Declaration in portlet.xml
<portlet-app> <custom-window-state> <name>half-page</name> <description>1/2 a page</description> </custom-window-state> </portlet-app>

Portlets in uPortal

Portlet Caching • uPortal caches all Portlet content the same way • A Portlet screen is cached until the Portlet needs to change state…
– User clicks on a link or button within Portlet – User clicks on a button within the Portlet control bar, i.e. Edit, Help, About, etc. – Portlet is focused or unfocused, i.e. the Portlet alternates between being and not being the root of the layout – PortletEvent is sent to the Portlet

• Optional expiration caching mechanism not implemented. See PLT.18 of Portlet Spec.

Portlets in uPortal

Servlet Container Requirements • Servlet Specification 2.3 or higher

• Cross context capability
– In Tomcat… <Context path="/uPortal“ docBase="uPortal“ crossContext="true"> </Context>

• Avoid Tomcat 5.0.19
– Tomcat Bug 27309 – NPE in ApplicationHttpRequest.java

Portlets in uPortal

Portlets vs. Channels

Portlets in uPortal

Channel Interfaces org.jasig.portal… • IChannel • IMultithreadedChannel • IPrivilegedChannel • IMultithreadedPrivileged • ICacheable • IMultithreadedCacheable

Portlets in uPortal

IChannel Interface
package org.jasig.portal; public interface IChannel { public void setStaticData (ChannelStaticData sd); public void setRuntimeData(ChannelRuntimeData rd);

public void receiveEvent(PortalEvent ev);
public ChannelRuntimeProperties getRuntimeProperties();

public void renderXML (DocumentHandler out);
}

Portlets in uPortal

Portlet Interface
package javax.portlet;

public interface Portlet {
public void init(PortletConfig config); public void render (RenderRequest request, RenderResponse response); public void processAction (ActionRequest request, ActionResponse response); public void destroy(); }

Portlets in uPortal

Channel Base Classes org.jasig.portal… • BaseChannel
– Start by overriding renderXML()

• BaseMultithreadedChannel
– Maintains an internal state table which can be unlocked with the unique ID. The state contains the channel static data, runtime data, and a HashMap (analogous to an HttpServletSession object)

Portlets in uPortal

Portlet Base Class javax.portlet… • GenericPortlet
– Dispatches request according to the Portlet Mode – Override doView(), doEdit(), or doHelp()

Portlets in uPortal

Channel Base Action URLs
• Get base action URL from ChannelRuntimeData • Pass as XSLT parameter to transformation
xslt.setStylesheetParameter( “baseActionURL”, runtimeData.getBaseActionURL());

• Append request parameter name/value pairs
<a href=“{$baseActionURL}?n1=p1&amp;n2=p2”> Go to page 1 </a>

Portlets in uPortal

Portlet URLs • Redner URLs
– RenderResponse.createRenderURL()

• Action URLs
– RenderResponse.createActionURL()

• Example
PortletURL url = response.createActionURL(); url.setParameter(“n1”, “v1”); url.setParameter(“n2”, “v2”); url.setWindowState(WindowState.MAXIMIZED); writer.print(“<form method=\”post\” action=\”” + url.toString() + “\”>”);

Portlets in uPortal

uPortal CSS Classes

Portlets in uPortal

OASIS WSRP CSS Classes
• Fonts
portlet-font, portlet-font-dim

• Messages
portlet-msg-status, portlet-msg-info, portlet-msg-error, etc.

• Sections
portlet-section-header, portlet-section-body, portlet-section-alternate, etc.

• Tables
portlet-table-header, portlet-table-body, portlet-table-selected, etc.

• Forms
portlet-form-label, portlet-form-input-field, portlet-form-button, etc.

• Menus
portlet-menu, portlet-menu-item, portlet-menu-caption, etc.

Portlets in uPortal

OASIS WSRP CSS Style Example

.portlet-form-label Favorite color

.portlet-form-field

.portlet-form-field-label

Blue

Green

Red

Pink

.portlet-form-input-field

Other color:

Submit

.portlet-form-button

Portlets in uPortal

Channel File Uploading
• Form must contain enctype attribute:
enctype="multipart/form-data"

• Input element:
<input type="file" name="uploadfile"/>

• Channel access to file:
MultipartDataSource fileSource = ((MultipartDataSource[]) runtimeData.getObjectParameterValues ("uploadfile"))[0];

• MultipartDataSource methods
InputStream getInputStream()
returns the actual file stream to save to disk/rdbms

String getContentType()
returns the mime type of the file

String getName()
returns the uploaded file’s name

Portlets in uPortal

Portlet File Uploading • Form must contain enctype attribute: enctype="multipart/form-data"

• Input element:
<input type="file" name="uploadfile"/>

• Portlet access to file
request.getParameter("uploadfile");

Portlets in uPortal

Channel File Downloading
• Acquire resource URL in channel and pass to stylesheet:
runtimeData.getBaseWorkerURL (UPFileSpec.FILE_DOWNLOAD_WORKER, true)

• Use of resource URL in stylesheet:
<!-- resource URL parameter --> <xsl:param name="resourceURL">default</xsl:param> <!–- use resource URL to form link to file --> <a href="{$resourceURL}?filename=NAME_OF_FILE"> Filename </a>

Portlets in uPortal

Channel File Downloading • Channel must implement org.jasig.portal.IMimeResponse Portal’s download worker will call the following IMimeResponse methods in the following sequence:
1) Call the channel’s setRuntimeData() method. Channel can retrieve any parameters appended to the resource URL (ie: filename=NAME_OF_FILE) 2) Call the getHeaders() from IMimeResponse 3) Call the getContentType() from IMimeResponse 4) Call the getInputStream() from IMimeResponse

•

Portlets in uPortal

Portlet File Downloading • No general solution yet • Might be able to use separate servlet • Portlet and Servlet can communicate via an application-scoped session attribute

Portlets in uPortal

Channel ARchives (CAR) • Packaging and deployment of channel code and resources • WEB-INF/cars directory  .car files • Car resource worker
– org.jasig.portal.car.CarResourceWorker

CAR file is a zip containing channel sources, stylesheets, and resources such as images

Portlets in uPortal

Portlet WAR
• All resources are packaged into a web application archive (WAR) • web.xml
– Specifies web application resources

• portlet.xml
– Specifies portlet resources

Portlets in uPortal

Portlet Development

Portlets in uPortal

Pluto Eclipse Plugin
• Facilitates writing and deployment of JSR 168 Portlets in Pluto • Wizards • Context menu actions • 1.0.0 alpha 2 release October 25, 2003 • http://sourceforge.net/ projects/plutoeclipse

Portlets in uPortal

Spring PortletMVC
• Framework for Portlet Development
– Analogous to Spring Web MVC

• Flexible with respect to view technology
– JSP – JSTL – XML/XSLT etc.

• Introduced to Spring Framework by Rutgers University
– Bill Thompson – Dmitriy Kopylenko (“Dima”)

• Currently in Spring CVS “sandbox” • Release planned for September 2004 Spring 1.1

Portlets in uPortal

Portlet Open Source Trading Site (POST)
http://portlet-opensrc.sourceforge.net/ • A Portlet “Clearinghouse” • Founded Sept 2003 by Plumtree, Documentum, BEA, and Sun • Sections for JSR 168 and WSRP portlets • Not very popular yet
– 5 Portlets available – 7 people on mailing list

Portlets in uPortal

uPortal 3.0

Portlets in uPortal

uPortal Portlet Roadmap
• uPortal 2.3
– Support Portlets (JSR 168) via Portlet adapter
uPortal 2.3
Framework Chan Chan

uPortal 3.0
Framework Pluto
Portlet Portlet

• uPortal 3.0
– Portlets become native portal component – Support Channels via Channel adapter

Chan

Chan

Adapter Portlet
Pluto

Portlet
Adapter

Portlet Portlet Chan Chan

Portlets in uPortal

New in uPortal 2.3
JSR 168 Portlet support Implementation of Pluto Portlet Container Layout fragment manager Pulled layout fragments Enhanced content subscriber Person attributes groups store (PAGS) Multi-valued person attributes support Just-in-time XSLT localization

Portlets in uPortal

uPortal 2.4 • Complete WSRP implementation
– Apache Portals WSRP4J

• New RSS Channel
– Easily supports multiple RSS versions

Portlets in uPortal

uPortal 3.0 Overview • Terminology and paradigm change: Channels replaced by Portlets • Componentization of framework • Modular rendering pipeline • Clean separation of business logic and persistence layer • Full support for uPortal 2.x Channels • Upgrade tools

Portlets in uPortal

uPortal Domain Objects • Portlet Application Deployment Portlet Deployment
– Information from portlet.xml file

• Portlet Application Definition Portlet Definition
– Deployment + Preferences

• Portlet Application Entity Portlet Entity
– Definition + Preferences

• Portlet Window
– Instances of Portlet Entity painted on screen – Carries Portlet Window State

Portlets in uPortal

uPortal 3.0 Data Access • Data Access Objects (DAO) • Transfer Objects • Spring JDBC

Portlets in uPortal

uPortal 3.0 Registries • Communicate with DAO layer • Utilize caching services • Utilize domain object factories

Portlets in uPortal

uPortal 3.0 Domain Object Architecture
uPortal Framework Domain objects Registries Transfer objects DAO’s DAO Implementations e.g. Spring JDBC Domain Object Factories Domain objects

Caching

Database

Portlets in uPortal

uPortal 3.0 Rendering Architecture
Context Resolver Parameter processing Default Context

…

Rendering pipeline

Layout generator
Transformer

Selects a context to process the incoming request request URL and Parses initiates actions on: •Portlets •Renderinginitial user layout Generates pipeline elements
•Aggregated layouts •Simple layouts

Context X

Context A

…

Filter Transformer

Chain of transformers and filters compiles presentation markup.

Serializer

Portlets in uPortal

Useful URL’s
• JSR 168 – http://www.jcp.org/en/jsr/detail?id=168 • Apache Portals – http://portals.apache.org/ • Jakarta Pluto – http://portals.apache.org/pluto/ • Portlets in uPortal – http://www.uportal.org/implementors/portlets/ workingWithPortlets.html • Portlet Open Source Trading Site (POST) – http://portlet-opensrc.sourceforge.net/

Portlets in uPortal

The End

Questions ?

Speaker Evaluation Info:
Speaker: Ken Weiner Presentation Title: Portlets in uPortal Date: 6/22/2004 Time: 10:15 AM – 11:15 AM Room: Westminster Ballroom II


				
DOCUMENT INFO