Date post: | 20-Dec-2015 |
Category: |
Documents |
View: | 215 times |
Download: | 0 times |
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 Processhttp://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
• 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
http://portals.apache.org/
Portlets in uPortal
Jakarta Pluto
• Status– Apache Incubator
– Apache Portals
• Contents– Portlet API (JSR 168)– Portlet Container– Portal Driver– Test Suite Portlet
http://portals.apache.org/pluto/
Portlets in uPortal
Portlets
Pluto Component Relationships
Portlet API
Portlet Container
Portal
javax.portlet
org.apache.pluto.core.impl
org.apache.plutoorg.apache.pluto.omorg.apache.pluto.services
org.apache.pluto.portalImpl Pluto Portal Driver
Portlet Portlet
Portlet Portlet
org.jasig.portal.container uPortal
Implements
Implements
Live in
Use
Portlets in uPortal
Pluto Object Model
• Servlet org.apache.pluto.om.servlet
– Web application, servlet definition
• Portlet org.apache.pluto.om.portlet
– Portlet application definition, portlet definition
• Entity org.apache.pluto.om.entity
– Portlet application entity, portlet entity
• Window org.apache.pluto.om.window
– Portlet 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
Pluto
Portlet Application
Portlet Adapter
uPortal
Portlet Portlet
WebProxy
Channel
PortletAdapter Channel
CustomChannel
PortletAdapterChannel
Portlet Application
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 toolorg.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
• Portlet Preferences– Zero or more name-value
pairs can be specified– Overrides Preferences
specified in portlet.xml
testsuite.war
portlet.xml
testsuite.TestPortlet1
<portlet-name>TestPortlet1
</portlet-name>
Portlets in uPortal
Publishing Portlets: Channel Type
Portlets in uPortal
Publishing Portlets: Portlet Definition and Prefs
Enter zero or more portlet preference name-value pairs.
Enter Portlet Definition GUID
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
• IChannel• IMultithreadedChannel
• IPrivilegedChannel• IMultithreadedPrivileged
• ICacheable• IMultithreadedCacheable
org.jasig.portal…
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
• 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)
org.jasig.portal…
Portlets in uPortal
Portlet Base Class
• GenericPortlet– Dispatches request according to the Portlet Mode– Override doView(), doEdit(), or doHelp()
javax.portlet…
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&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
• Fontsportlet-font, portlet-font-dim
• Messagesportlet-msg-status, portlet-msg-info, portlet-msg-error, etc.
• Sectionsportlet-section-header, portlet-section-body, portlet-section-alternate, etc.
• Tablesportlet-table-header, portlet-table-body, portlet-table-selected, etc.
• Formsportlet-form-label, portlet-form-input-field, portlet-form-button, etc.
• Menusportlet-menu, portlet-menu-item, portlet-menu-caption, etc.
Portlets in uPortal
OASIS WSRP CSS Style Example
Favorite color
Other color:
Blue Green Red Pink
Submit
.portlet-form-label
.portlet-form-field-label
.portlet-form-button
.portlet-form-input-field
.portlet-form-field
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 methodsInputStream 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 filerequest.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 containingchannel 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 byRutgers 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)
• 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
http://portlet-opensrc.sourceforge.net/
Portlets in uPortal
uPortal 3.0
Portlets in uPortal
uPortal 3.0
Framework
uPortal 2.3
Pluto
uPortal Portlet Roadmap
• uPortal 2.3– Support Portlets
(JSR 168) via Portlet adapter
• uPortal 3.0– Portlets become
native portal component
– Support Channels via Channel adapter
Portlet Portlet
Pluto
Portlet Portlet
Adapter
Chan Chan
Portlet
Framework
PortletChan Chan
Adapter
Chan Chan
Portlets in uPortal
New in uPortal 2.3
JSR 168 Portlet support Implementation of Pluto Portlet ContainerLayout fragment managerPulled layout fragmentsEnhanced content subscriberPerson attributes groups store (PAGS)Multi-valued person attributes supportJust-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 DeploymentPortlet Deployment– Information from portlet.xml file
• Portlet Application DefinitionPortlet Definition– Deployment + Preferences
• Portlet Application EntityPortlet 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
Database
DAO’s
Registries
DAO Implementations e.g. Spring JDBC
Caching
uPortal Framework
Domain objects
Domain objectsTransfer objects
DomainObject
Factories
Portlets in uPortal
uPortal 3.0 Rendering Architecture
Con
text
X
Con
text
A
…
Context Resolver
Def
ault
Con
text
Parameterprocessing
Ren
derin
g pi
pelin
e
Layoutgenerator
Transformer
…
Transformer
Filter
Serializer
Selects a context toprocess the incomingrequestParses request URL and
initiates actions on:•Portlets•Rendering pipeline elementsGenerates initial user layout•Aggregated layouts•Simple layouts
Chain of transformers andfilters compiles presentationmarkup.
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
Speaker: Ken WeinerPresentation Title: Portlets in uPortalDate: 6/22/2004Time: 10:15 AM – 11:15 AMRoom: Westminster Ballroom II
Speaker Evaluation Info:
The End
Questions ?