Rendering Contexts and Components What is a uPortal3 context ? –Defines all aspects of a...
-
Upload
quentin-armstrong -
Category
Documents
-
view
214 -
download
1
Transcript of Rendering Contexts and Components What is a uPortal3 context ? –Defines all aspects of a...
Rendering Contexts and Components
• What is a uPortal3 context ?– Defines all aspects of a traditional portal instance
• Design, navigation, profiles• Parameter syntax• Portlet selections, session scopes
– Multiple, concurrent contexts can be used
• Example contexts– static frame showing a single portlet– simple navigation with human-readable URLs– uPortal2 clone
Rendering Contexts and Components
cont
ext
B
cont
ext
X
…
context resolver
cont
ext
Aparameterprocessing
rend
erin
g pi
pelin
e
layoutsource
transformer
…
transformer
filter
serializer
selects a context to be usedin processing the incoming requestparses request URL syntax
initiates actions on:•portlets•rendering pipeline elementsgenerates initial user layoutmarkup.
Aggregated, simple layoutsa chain of transformers andfilters compiles presentationmarkup.
URL command syntax canbe customized by providingalternate processing andURL generation components
Context resolvers
• Servlet Path context resolver– switch contexts by going to a specific servlet path– http://hostname/uPortal/context/.../render.uP– default, ServletPathContextResolver implementation
• Alternatively contexts can be resolved using– user information
• authentication state• user affiliation (groups), attributes (permissions)
– user agent information (browser)– internal states, session (ex.:down for maintenance)
Context responsibilities
uPortal Framework
User Interaction Presentation
Channel Channel Channel
Context responsibilities
uPortal3 Context
User Interaction Presentation
Portlet Portlet Portlet
IPortletWindowManager / JSR168 container (Pluto)
Contexts
• IContext– service(HttpRequest, HttpResponse)
• CompoundContext implements IContext– separates parameter processing and rendering– IRequestParameterController
• processParameters(HttpRequest, HttpResponse)
– IPortalRenderer• render(HttpRequest, HttpResponse)
Rendering: drilling down
• TreeRenderer implements IPortalRenderer– Responsible for rendering cycle initiation/events– Assumes a rooted structure of components
• IRenderingComponentManager– Defines the topology of rendering components– Responsible for finding optimal cache entry points
• PipelineComponentManager – defines linear pipeline rendering structures
Rendering: SAX pipelines
• uPortal2-like pipeline in which components pass SAX events to each other
• ISaxConsumer and ISaxRenderer• Components
– abstract Filters and Buffers– Serializers– XSL transformers
• SAX Cache entry points– know how to replay cache– returned by cache managers
• implementing IPipelineCacheManager
Rendering: String pipelines
• Pipeline that operates by transforming Strings• quick, non-restricted
• IStringRenderer and IStringFilter• Components
– RegexStringFilter• PortletRenderingInitiationFilter
– StringResponseWriter
• String cache filters, managers, entry points
Rendering: Hybrid pipelines
• Pipelines that can be configured with multiple types of components– org.jasig.portal.rendering.hybrid– component manager implementation
• connector structure
– cache manager implementation• multiple cache types• prioritized
• Should be primary choice for configuring context rendering
• uP2 context example
Rendering: XML layout sources
• Starting point for the SAX pipelines– XmlFileLayoutSource
• implements IPortalRenderer, ISaxRenderer
• org.jasig.portal.layout.uportal2 package– LegacyLayoutSource
• wraps IUserLayoutManager
– SimpleUserLayoutManager • lightly modified uPortal2 version• with simplified DAO Impl
Rendering: XSLT TransformationFilter
• A flexible XSLT SAX rendering component– Configured with ITransformerPreferences– Insert arbitrary element attributes & params
• Transformer preferences– contain IStylesheetDescription
• location, mime type, etc.• IParamDescription and IElementAttributeDescription
– default values, persistance scope, target elements
– responsible for keeping track of current values of stylesheet params, attributes
– RuntimeTransformerPreferences (in memory)– TransformerPreferencesImpl (persistent)
• ITransformerHelper – stylesheet handling
Contexts
• IContext– service(HttpRequest, HttpResponse)
• CompoundContext implements IContext– separates parameter processing and rendering– IRequestParameterController
• processParameters(HttpRequest, HttpResponse)
– IPortalRenderer• render(HttpRequest, HttpResponse)
CompoundContext parameter processing
• Before the rendering starts, need to make sense of the request parameters …
• RequestParameterProcessorListController– based on a prioritized list of parameter processors– each parameter processor talks to some component– ordered list of IRequestParameterProcessors
• boolean processParameters(req, res)• allows multiple rounds of processing for variable evaluation
– set of IUrlConstructorProviders
• Example: uPortal2 transformation legacy syntax
Context patterns: parameter-aware component
• Goal– isolation and targeted injection of components
• Parameter-aware context component– directly involved in the rendering– assisting other rendering components– assisting other parameter processors
• Pattern:– Implement URL constructor (i.e. how to write)– Implement ParameterProcessor (i.e. how to parse)– Connect processor, component itself and other pieces
using dependency injection– Test URL constructor and processor against
eachother
Context patterns: parameter-aware component
• Example 1: Legacy (uP2) Layout param syntax– see PDF
• Example 2: Persistence manager– job: fire off persistence events– request param command to initiate persistence– no rendering, just param processing– injected into secondary parts of the downstream
components (i.e. preferences impl for the XSLT Filter)
– Commands interface (optional)– IRequestParameterProcessor impl.– URL constructor impl.
The fate of the URL constructors
• Controller configuration is passed to Pluto’s PortletURLFactoryImpl
• PortletURL delivered to the portlets– implements IPortletUrl
• adds ability to obtain uPortal-specific URL constructors• getUrlConstructor(name)
– IPortletUrlConstructor • implements portlet URL syntax• also configurable