Introducing Portlet - PowerPoint PPT Presentation

1 / 100
About This Presentation
Title:

Introducing Portlet

Description:

Panes are collections of portlets specified directly with either a Menu-pane ... can put easily expose your business objects to the designer. Common Portlets ... – PowerPoint PPT presentation

Number of Views:113
Avg rating:3.0/5.0
Slides: 101
Provided by: ntarlC
Category:

less

Transcript and Presenter's Notes

Title: Introducing Portlet


1
Introducing Portlet
  • ---s p

2
Content
  • 1?Portal and Portal Server
  • 2?Jetspeed Structure
  • 3?Portlet
  • 4?Portlet in Jetspeed
  • 5?Conclusion

3
1?Portal and Portal Server
4
What Are Portals ?
  • Portals provide a secure, single point of
    interaction with diverse information, business
    processes, and people, personalized to a user's
    needs and responsibilities." There is a good
    analogy between what portals add to web
    applications and what window managers (like
    Microsoft windows) add to operating systems (like
    DOS). Both provide a consistent and uniform way
    to interact with applications.

5
What Are Portlets?
  • Portlets, are "visible active components users
    see within their portal pages... In the simplest
    terms, a portlet is a java servlet that operates
    inside a portal."

6
An Example
  • See next figure for an example portal page with
    two visible components on it. Each visible
    component is called a portlet. In this example,
    one portlet allows the user to go to a URL the
    other portlet provides some reminder text to the
    user.

7

8
Portal Server
  • A portal server provides common services such as
    application connectivity, integration,
    administration, and presentation that would be
    required across all portal environments.
    Functionally, a portal server serves the portlets
    to the user.

9
The Portal Servers
  • 1?IBMs WebSphere Portal Server
  • 2?Apaches Jetspeed
  • 3?Metadots Portal Server
  • 4?Sun Java System Portal Server
  • 5?MSs SharePoint Portal Server
  • And so on.

10
WebSphere Portal Server
  • WedSphere portal basic structure provides some
    service that can easily interact with others
    ,flow ,enterprise application ,the content from
    the syndicated content provider ,database and
    information which is structured or non-structured.

11
Jetspeed
  • Jetspeed is an open source implementation of an
    enterprise information portal, using java and
    XML. Jetspeed acts as the central hub where
    information from multiple sources are made
    available in an easy to use manner.

12
Metadot Portal Server
  • Metadot is a popular open source portal software
    (GPL) recognized for its revolutionary
    ease-of-use. It provides content management like
    file, page and link management, collaboration
    features like discussion forums and polls and
    personalization like my yahoo

13
Sun Portal Server
  • It provides all the user, policy and identity
    management to enforce the security, single sign
    on and access capabilities to end user
    communities

14
MS SharePoint
  • SharePoint allows information workers to create
    powerful personalized interfaces by simply
    dragging and dropping pre-defined Web Part
    Components.
  • It is implemented by .net technology

15
2?Jetspeed architecture
16
  • Jetspeed, written in java language, Jetspeed
    offers a portal API for developing portlets,
    small java applications that are building blocks
    of a portal. Jetspeed makes connections to
    external data and content feeds to retrieve and
    display the data via a portal. You can implement
    the portal and access it from a web browser or a
    wireless device (such as a WAP phone or palm
    device). Jetspeed supports built-in services for
    user interface customization, caching,
    persistence, and user authentication, eliminating
    the need implement these services.

17
Jetspeed Architecture Model
  • This figure in next page illustrates the Jetspeed
    architecture model. Jetspeed is built on top of
    Turbine, a servlet-based framework. Turbine
    handles user authentication and page layout as
    well as scheduling. Jetspeed can run on a number
    of servlet engines and databases.

18

19
High-level Jetspeed Features
  • Support for wireless markup language (WML)
  • A web application development infrastructure
  • Portability across all platforms that support JDK
    1.2 and Servlet 2.2
  • User, group, role, and permission administration
    via security portlets
  • Role-based security access to portlets

20

21
Page Layout
  • This next figure illustrates the anatomy of a
    page containing portlets. Within a page, portlet
    content gets rendered by a PortletControl and a
    PortletController.

22
(No Transcript)
23
  • PortletControl the function of the
    PortletControl within the Portlet page handles
    rendering the title and body of the Portlet.

24
  • PortletController the function of the
    PortletController is to handle multiple
    PortletControls (each controlling a Portlet) to
    provide an entire page of information from all
    the Portlets.

25
How Portlets Display Content
  • To display content, portlets use the element
    construction set (ECS) API. This comes bundled
    with Jetspeed, which generates markup elements
    from java objects. You can use a servlet template
    or JSP technology to generate content as an
    output, which is then captured by an ECS element
    that displays the content. ECS supports WML as
    well as HTML and XML.

26
What Is ECS?
  • The Element Construction Set is a java API for
    generating elements for various markup languages
    it directly supports HTML 4.0 and XML, but can
    easily be extended to create tags for any markup
    language. It allows you to use java objects to
    generate markup code

27
A Simple ecs Example
  • Html html new Html()
  • .addElement(new Head()
  • .addElement(new Title("Demo")))
  • .addElement(new Body()
  • .addElement(new H1("Demo Header")))
  • out.println(html.toString())
  • output(out)

28
Generate the Code Below
  • lthtmlgt
  • ltheadgtlttitlegtDemolt/titlegtlt/headgt
  • ltbodygt
  • lth1gtDemoHeaderlt/h1gt
  • lt/bodygt
  • lt/htmlgt

29
  • ECS places mark-up information into compiled
    code . Therefore, we generally recommend using a
    page template mechanism of your choice, rather
    than using ECS directly.

30
Portlet Caching
  • Jetspeed provides developers with an advanced
    caching mechanism. Portlets that need to be
    cached are placed within the cache with relevant
    handle information like the classname and some
    portlet configuration information like the URL,
    etc. If there is a need to remove the portlet
    from the cache, it can be done by providing an
    expire() method, which determines when the
    portlet needs to expire itself.

31
What Are the Standard Portlets?
  • HTML portlet
  • JSP portlet
  • RSS portlet
  • Webpage portlet

32
Wireless Support From portlets
  • Jetspeed supports WAP devices, and the WAP
    browser renders WML content., One can uses RSS to
    syndicate content from the web site. The other
    can works with a local RSS-formatted XML file.

33

34
3?Portlet
35

36
  • Depicts a portal's basic architecture. The
    portal web application processes the client
    request, retrieves the portlets on the user's
    current page, and then calls the portlet
    container to retrieve each portlet's content. The
    portlet container provides the runtime
    environment for the portlets and calls the
    portlets via the Portlet API. The portlet
    container is called from the portal via the
    Portlet invoker API The container retrieves
    information about the portal using the Portlet
    provider SPI (service provider interface).

37
Page
  • Depicts the basic portal page components. The
    portal page itself represents a complete markup
    document and aggregates several portlet windows.
    In addition to the portlets, the page may also
    consist of navigation areas and banners. A
    portlet window consists of a title bar with the
    portlet's title, decorations, and the content
    produced by the portlet..

38
Portlet Container
  • A portlet container runs portlets and provides
    them with the required runtime environment. A
    portlet container contains portlets and manages
    their life cycles. It also provides persistent
    storage mechanisms for the portlet preferences. A
    portlet container receives requests from the
    portal to execute requests on the portlets hosted
    by it. A portlet container is not responsible for
    aggregating the content produced by the portlets
    the portal itself handles aggregation.

39
Portlet life cycle
  • Init initialize the portlet and put the portlet
    into service
  • Handle requests process different kinds of
    action- and render-requests
  • Destroy put portlet out of service

40
Portlet interface
  • init(PortletConfig config)
  • processAction(ActionRequest request,
    ActionResponse response)
  • render(RenderRequest request, RenderResponse
    response)
  • destroy()

41
Portlet modes
  • Required modes
  • Optional custom modes
  • Portal vendor-specific modes

42
Window states
  • Normal
  • Maximized
  • Minimized

43
Persistent store
  • The portlet can store persistent data for a
    specific user by using the PortletPreferences
    object. Preferences can be read and written in
    the action phase, and read in the render phase.

44
Sessions
  • JSR (java specification request
  • ) 168's session concept is based on the
    HttpSession defined for web applications. As
    portlet applications are web applications, they
    use the same session as servlets.

45
Including servlets/JSP pages
  • In JSR 168, the include mechanism for servlets
    and JSP pages is the same for the Servlet API.
    Via the portlet context, a request dispatcher is
    retrieved for a given path The include() method
    is then called on this request-dispatcher object

46
  • PortletRequestDispatcher rd getPortletContext().
    getRequestDispatcher(editJSP)  
    Rd.include(portletRequest, portletResponse)
  • But in jetspeed ,there are another method to
    include the servlets/jsp page.

47
Advanced Portlet API Items
  • User information
  • Portal context
  • Localization
  • Caching

48
Extensibility
  • If a portlet application uses additional
    portlet modes or window states than the ones
    defined by the Portlet specification, the portlet
    application can declare them in the deployment
    descriptor.

49
4?Portlet in Jetspeed
50
What Is a Portlet?
A portlet is a web component managed by a
container, that generates dynamic content.
Portlets are platform independent Java classes
compiled to an architecture neutral bytecode that
can be loaded dynamically into and run by a web
server. While servlets usually interact directly
with web clients, portlets interact with web
clients indirectly through portals, via a request
response paradigm implemented by the portlet
container (HTTP). Portlets are specialized
servlets that plug into and run in portals.
Portlets are designed to be aggregatable in the
larger context of a portal page. They rely on the
portal infrastructure to function.
51
Portal Architecture
52
Aggregating Content
Portlets are invoked in the course of handling a
single request, aggregating their respective
produced content in one page by appending each
individual portlets output to the page. Portlets
generate markup fragments that can be aggregated
in the scope of a portal, containing links,
actions and content suitable for aggregation
within a portal.
53
(No Transcript)
54
Portlet Modes
  • View Mode standard user interaction
  • Customize (Edit) Mode editing the portlet
    data, customizing the portlet content.
  • Maximize View the portlet in full screen with
    no other portlets in view.
  • Minimize Only show the Title Bar.
  • Closed Close the portlet remove it from the
    page.
  • When in View Mode, you can see that the title bar
    contains buttons allowing you to switch modes

55
View Mode
56
  • Customize
  • Close
  • Minimize
  • Maximize

57
Portlet Customize Mode
Here is an example of an RSS Portlets
customization.
58
PSML
  • PSML is an acronym for Portal Structure Markup
    Language. It was created to allow content
    structure and abstraction within Jetspeed. PSML
    is XML, and is defined by an XML schema at
    http//xml.apache.org/jetspeed/2000/psml
  • The layout of a portal page is defined in PSML.
    With PSML, you can define
  • Which portlets will appear in your portal page,
    and at which position in the portal window.
  • The look and feel (Skins) of the portal windows
  • The layout (controller) strategies (2 column, 3
    column, tabbed-panes, menu-panes, single column)
    for collection of portlets
  • The control, a decoration to apply to
    collections of portlets (title bars, borders,
    buttons in the title bar, tabs, menus)

59
The Customizer
The layout (PSML) can be edited with the Jetspeed
Customizer (easier than editing XML). To
customize the current pane, press the pencil icon
in the title bar
Or you can also customize for a specific media
type
  • Customizing allows you to
  • Add and Remove portlets
  • Move a portlet to a different position
  • Choose the Skin to apply to this pane
  • Choose the Layout to apply to this pane
  • Change the name of the pane
  • Add/Remove/Move Panes (only for Menu and Tab
    panes, which contain other panes).

60
(No Transcript)
61
Adding a Portlet
62
Moving and Removing Portlets
  • Remove the portlet
  • Move the portlet UP
  • Move the portlet DOWN
  • Move the portlet RIGHT
  • Move the portlet LEFT

63
Changing the Skin
64
Layouts
  • Menu-Pane
  • Single Column
  • Single Row
  • Tabbed-Pane
  • 3 Column (25/50/25)
  • 3 Column (33/33/33)
  • 2 Column (25/75)
  • 2 Column (50/50)
  • 2 Column (75/25)

65
Changing The Layout
From 2 column to 3 column (33/33/33)
66
Panes
Panes are collections of portlets specified
directly with either a Menu-pane layout or a
Tab-pane layout. Panes allow you to overlay
collections of portlets on top of the same screen
area. You can then select the visible collection
by selecting a tab or menu option.
67
Adding/Removing/Moving Panes
68
Registries
  • Registries are used to define the portal
    components
  • Portlets
  • Controllers (Layouts)
  • Controls (Decorators)
  • Skins
  • Media Types
  • Registries can be defined in multiple files with
    the extension .xreg and placed in the webapps
    WEB-INF/conf directory. This allows for easily
    integrating new registries into the portal.

69
(No Transcript)
70
Portlet Registry Entry Types
71
Referencing Registry Entries in PSML
-- Referencing a portlet ltentry
parentStockQuote/gt -- Referencing a
controller ltcontroller name"TabController"/gt -
- Referencing a skin ltskin name"orange-red"/gt
72
Complete Portal Page Layout
  • Looking deeper into how Jetspeed works, we can
    see how the web application framework, Turbine,
    is used in the portal container implementation of
    Jetspeed. Turbine is a Model-View-Controller
    (MVC-2) type servlet framework. It introduces the
    concept of modules
  • Layouts controls the layout of the entire web
    page.
  • Navigations Top, Bottom, Right, Left areas of
    the web page
  • Screens (templates) the center area of the web
    page, where the PSML is placed.

73
  • All of these modules are defined as templates.
    Jetspeed supports two templating engines
  • Apache Velocity
  • JSP (Java Server Pages)

74
Velocity
  • Velocity is a java-based template engine, a
    simple and powerful development tool that allows
    you to easily create and render documents that
    format and present your data.
  • We make servlet development with velocity very
    easy if you use our provided class
    VelocityServlet as a base class for your servlet,
    and offer a utility class to help with
    application development.

75
The Velocity Fundamental Pattern
  • Initialize velocity. This applies to both usage
    patterns for velocity, the singleton as well as
    the 'separate runtime instance', and you only do
    this once.
  • Create a context object (more on what that is
    later).
  • Add your data objects to the context.
  • Choose a template.
  • 'Merge' the template and your data to produce the
    output.

76
Editing Templates
When configuring a website, you will need to edit
the default layouts, navigations and screen
template modules. For the default site, all of
these templates are defined in Velocity. You can
find all templates under the /WEB-INF/templates
directory in the web application.
77
Profile Requests
  • When a request is received by the portal, the
    Profiler will map the request to template and
    PSML resources based on request parameters and
    user information. When no user information is
    available, the profiler will know to provide
    anonymous PSML content. The profile uses a
    fallback algorithm to find templates and PSML.
    This fallback algorithm first searches for the
    most specific resource, and then falls back to
    least specific resources. Here are the criteria
    listed from most to least specific
  • Country Code
  • Language
  • Media Type
  • User Type

78
Media Types
  • Media Types are defined in the Media Type
    registry. Currently Jetspeed has 3 entries in the
    registry
  • HTML
  • WML
  • VXML

79
(No Transcript)
80
(No Transcript)
81
(No Transcript)
82
Velocity and JSP
In order to incorporate dynamic content into your
web pages and portlets, it is strongly
recommended to use a templating engine such as
Velocity or JSP. Here we demonstrate Jetspeeds
Tools and how they can be used with the Velocity
Templating Engine. Velocity allows you to access
these tools by specifying a dollar sign to
denote the tool. Similarly, you can put easily
expose your business objects to the designer.
83
Common Portlets
84
(No Transcript)
85
Demo Portlets
86
Admin Portlets
87
Security Model
  • Jetspeed provides secure access to the portal.
    The basic security model has
  • Users users in the portal system.
  • Permissions portal permissions to portal
    resources (view, customize, minimize, maximize)
  • Groups Users can be associated to groups
    through roles.
  • Roles Users can have several roles. Roles
    control access to portal resources (such as
    portlets, PSML).

88
Example of a security role in a portlet
registry ltportlet-entry type"ref"
parent"CustomizerVelocity" name"UserForm" gt
ltsecurity role"admin"/gt .
89
Databases
Jetspeed stores its security information in a
relational database. The PSML can also be
configured to be stored in a database. The
default system comes installed with a
HypersonicSQL database pre-populated with the
demo system data. Jetspeed can be easily
configured to work with most leading database
systems by changing the settings in the
TurbineResources.properties database.default.driv
erorg.hsql.jdbcDriver database.default.urljdbcH
ypersonicSQLwebappRoot/WEB-INF/db/jetspeed dat
abase.default.usernamesa database.default.passwor
d database.adaptorDBHypersonicSQL database.adapt
or.DBHypersonicSQLorg.hsql.jdbcDriver
90
A Little Example
91
HelloWorld Portlets
  • 1?Implement and compile the portlet
  • 2?Create the portlet registry fragment
  • 3?Put the compiled portlet in the appropriate
    location
  • 4?Register the portlet with the Jetspeed portlet
    registry

92
Create a Simple Hello World portlet
  • package com.bluesunrise.portal.portlets
  • Import org.apache.jetspeed.portal.
  • portlets.AbstractPortlet
  • importorg.apache.turbine.util.RunData
  • import org.apache.ecs.ConcreteElement
  • import org.apache.ecs.StringElement
  • public class HelloWorldPortlet extends
    AbstractPortlet
  • public ConcreteElement getContent (RunData
    runData)
  • return (new StringElement ("Hello
    Worldtest!"))

93
Location
  • Once the java code is compiled, the class has to
    be placed in the classpath. For this example the
    classpath is lttomcat_homegt/ltjetspeed_directorygt/we
    b-INF/classes/com/bluesunrise/
  • Portal/portlets/.

94
Hello World! Portlet registry fragment
  • lt?xml version"1.0" encoding"UTF-8"?gt ltregistrygt
  • ltportlet-entry name"HelloWorld" hidden"false"
    type"instance" application"false"gt
  • ltmeta-infogt
  • lttitlegtHelloWorldlt/titlegt ltdescriptiongtHello
    Worldlt/descriptiongt lt/meta-infogt
    ltclassnamegtcom.bluesunrise.portal.portlets.HelloWo
    rldPortletlt/classnamegt ltmedia-type ref"html"/gt
  • lt/portlet-entrygt
  • lt/registrygt

95
(No Transcript)
96
(No Transcript)
97
  • Jetspeed is easy to use, I think I will be
    accepted commonly.

98
5?My Idea
99
When Do portlets Make the Most Sense?
  • If your goal is to bring together your web
    applications and information into one convenient
    place, portlets are the obvious choice. If your
    development goals are somewhat different,
    consider portlet and portal server features that
    you might want to take advantage of.

100
Thank you !!!
Write a Comment
User Comments (0)
About PowerShow.com