® AD204 Lotus Domino, WebSphere Portal, and Lotus Workplace Integration Part 4: Developing Portlets for Domino in Java Joel Demay, Lotus Worldwide Technical Sales Oliver Trabert, Senior Consultant, WP Experts
®
AD204 Lotus Domino, WebSphere Portal, and Lotus Workplace Integration Part 4:
Developing Portlets for Domino in Java
Joel Demay, Lotus Worldwide Technical Sales Oliver Trabert, Senior Consultant, WP Experts
Presenters bio’s
Joel Demay, Lotus Worldwide Technical Sales
Presenters bio’s cont.
Oliver Trabert, Senior Consultant, WP Experts GmbHWorked exclusively with WebSphere Portal (WP) for more than 2 years doing numerous on-site customer implementations
Experienced WP architect, solution designer and performance expert
Specialized in ‘portalization’ of Domino applications
Co-author of multiple IBM Redbooks on WP• Portalizing Domino Applications for WebSphere Portal• Portal Application Design and Development Guidelines• A Portal Composite Pattern Using WebSphere Portal V5
Contact: [email protected]
Preface
Intermediate level lecture with code examples and best practices.
Entry skillsDomino savvy developers with medium Java skills
You should have basic Portal knowledge
Exit skills:Good overview of Domino Portlet development
Learned concepts to architect scalable Domino Portal applications
Ask the audience
Please tell us your experienceWho has implemented a Portal today?
Who is planning implementation this year, next year?
Portal Administration (e.g Portlet deployment)
WebSphere Studio Application Developer (WSAD) / Eclipse
Servlet’s, EJB’s, custom JSP taglib’s
Domino Java API
Portlet development
This will help us to keep the session at the right level.
Thank You!
Agenda
Brief Portal/Workplace definitionOverview of Domino access methodsPortlet development introductionMy first Domino PortletPortlet design principlesAuthenticationResource managementPortal applications
Portlet frameworks
Architecture
If we still have time: Domino Rich-Text in Portlets
Q&A
Brief Portal/Workplace definition
WebSphere PortalStandard infrastructure platform for building enterprise class applications
Delivers integrated content and applications
Enables the integration of existing applications and processes
Unified collaborative workplace.
Brief Portal/Workplace definition
Lotus WorkplaceConsists of flexible, portal-ready collaboration products
Products provide features similar to those found in the core IBM/Lotus Software portfolio
Earlier informally referred to as the next generation of Lotus products, or ‘NextGen’
built on industry standards and core IBM/Lotus technologies
Portal and Lotus Workplace together
Lotus Workplace leverages WebSphere Portal as its presentation layerPortlet development works in the same way
Overview of Domino access methods
‘Native’ Java methods only, not Domino JSP tag libraryJSP tags were covered in AD203 already
Collaborative Components APIXMLDomino Java API (Backend classes)
Local (JNI)
Remote (DIIOP)Custom
Collaborative Components API
DefinitionJava API and JSP tags to implement Lotus advanced collaboration in Portlets
Allows to incorporate some features of Domino, QuickPlace, Sametime, and Discovery Server
Methods provided complement - not replace - the APIs of the individual companion products
Sometimes referred to as "collaborative services" or "cs"
Collaborative Components API cont.
AccessInfrastructure objects
• Information on the environment (e.g. installed products)• Manage authentication
Service objects• Provide some functionality to access to the Lotus products• DominoService, QPService, PeopleService,
DiscoveryServerService, SametimeService JSP tags
• Provide people awareness and menus• People tags, Menu tags
Collaborative Components API cont.
Example: DominoServiceDirectory-related methods Document-related methods View-related methods (getViewInfo() and getDatabaseViews())
BenefitsProvide standardized access to Lotus productsEasy-to-use high level APIs Consistent security model across all Lotus productsPeople and menu tags are especially useful
ConsLimited functionality compared to native product API’s
Collaborative Components API cont.
NoticeAlways call the cleanup() method when finished with the Service object.
The Lotus Notes productivity portlets that ship with Portal are NOT based on the Collaborative Components API.
ReferencePortal InfoCenterhttp://publib.boulder.ibm.com/pvc/wp/500/ent/en/InfoCenter/collab/ksd_cs_api_intro.htmlComprehensive overview and code examples
API Java dochttp://www-106.ibm.com/developerworks/websphere/zones/portal/portlet/5.0api/CollabServices/
Redbook: Collaborative serviceshttp://www.redbooks.ibm.com/redpapers/pdfs/redp0319.pdf
XML
DefinitionDomino provides support for Extensible Markup Language, or XML
XML enables you to tag data in order to delimit it
Compared with HTML, HTML describes the appearance of data
XML describes the structure of data
XML representation of Domino data is known as DXL
DXL describes Domino-specific data and design elements
DXL provides a basis for importing or exporting XML representations of Domino data
XML cont.
AccessUses Domino HTTP?ReadViewEntries URL command
• http://localhost/names.nsf/people?ReadViewEntries
XML Processor
Portlet
Domino HTTPDomino View
Optional parameters• CollapseView, Count, Expand, ExpandView, KeyType, PreFormat,
ResortAscending, ResortDescending, RestrictToCategory, Start, StartKey, UntilKey
NoticeParameters have evolved with succeeding Domino versions
HTTP
XML cont.
BenefitsFastest method to read view dataUsed e.g. by the Lotus Notes productivity portlets
ConsNeed HTTP enabledLimited functionality, e.g. no search, write access
ReferenceDomino 6.5 Designer helphttp://www-12.lotus.com/ldd/doc/domino_notes/6.5/help65_designer.nsf/2e73cbb2141acefa85256b8700688cea/3147390f7d5857fb85256d9b0042fe98?OpenDocument
Related sessions
Domino Java API
Provides Java access to the Domino backend classes
AccessSupports local and remote accessWith virtually identical object modelsJava interfaces are contained in the lotus.domino packageMain difference is in the thread management
Domino Java API
LocalThin layer of Java code into the Domino "back-end" code, which is implemented in C++. Java Native Interface (JNI)Need Notes/Domino DLL’s locally installedcode is loaded "in process" in the Java Virtual Machine (JVM)
Domino Java API
Portlet
Domino C APIJNI
BenefitsFast and versatile
ConsCPU load, can degrade overall Portal performance JNI = introduced potential risks / can crash JVM = Portal serverMemory management, resource exhaustionThread init/term issueThe tread that creates a Domino session also needs to destroy it!
Domino Java API
RemoteUse IIOP (CORBA's protocol)Local Java object instances are just instances of proxy objectsAll Domino objects reside on the remote Domino machine
NoticeThe JVM garbage collection can’t notify Domino backend that objects went away
Always call recycle() on the Session objectthis implicitly recycles all the Session’s child objects
Domino 5 DIIOP does not scale well
Domino 5: ncso.jar vs. ncsow.jar.
DIIOP task
Portlet
Domino C API
CORBA via IIOP
Proxy objectsRemote Domino Java API
real Objects
Domino Java API
BenefitsAs versatile as local accessDistributed architecture
ConsSlower than local accessHigher network load
References:Advisor article from Bob Balabanhttp://advisor.com/Articles.nsf/aid/BALAB03Redbook: Domino and WebSphere TogetherRedbook: Portalizing Domino Applications for WebSphere Portal
Custom
Hybrid solution combining remote access with JNI local access
AccessUsing local Java application (JNI)
Implements a socket server to communicate with the Portlet
Socket Server
Portlet
Domino Java API
Domino C APIJNI
RMI via IIOP
BenefitsAllows for service oriented architecturesGet the native access performanceWithout the drawbacks
ConsSpecific functional implementationNot easy to extend
Blended methods
Using more than one access method
Uses a combination of XML over HTTP and DIIOP
Good example is Lotus Notes productivity portletsFor specific requirements the best solution
But makes configuration and debugging more difficult
Summary of Access Methods
There is all the access you need availableNo one method fits all needsOverview matrix
Assumption
In the following examples we will focus on remote Java API access (DIIOP)Use people awareness from the collaborative services
Why?Easy to understand for Lotus Script developers
Very flexible
Has less requirements for the runtime environment than any blended approach
Portlet development introduction
Development environmentWebSphere Studio (WSAD)Portal toolkitWebSphere Portal 5
Portlet development introduction cont.
ConfigurationDomino/WAS Single-Sign-On (SSO)WSAD
References:WSAD setupRedbook: A Guide for Portlet Application DevelopmentAppendix A: Portlet development platform sample installationhttp://www.redbooks.ibm.com/redpieces/pdfs/sg246076.pdfSingle Sign On
NoticeFollow exactly the step by step installation instructionsUnless you fully understand the products
Using the Portal toolkit
Portlet creation demo
Base structure of a Portlet
Java SourceJSP’sPortlet XML
My first Domino Portlet
A naïve approachPut scriptlet on the view.jsp
// Creating diiop session for Dominodiiopsession =
NotesFactory.createSession("<servername>","<username>","<password>");
Iterate through view;
Diiopsession.recycle();
Add People Awareness
<%@taglib uri="/WEB-INF/tld/people.tld" prefix="p"%>
<p:person><%=doc.getItemValueString("LastName")%></p:person>
Problems with this approach
Portlet designCluttered code (see e.g. WP 4.2 Notesview Portlet JSP’s)
Difficult to read and maintain
64K limit for JSP pages
Authenticationno dynamic user / Single-Sign-On
Resource managementCreate and destroy the Domino resources with each call
Resource are ‘expensive’, especially the Domino session
Portlet caching
Portlet design
Model View Controller design
Portlet design
What does this mean for our Portlet?Identify the Modell, View and Controller parts of the Portlet
Separate out the different code elements
Code flow
How does the code run?
Important objects
How do the different pieces communicate together?
Data beans
portletsession, portletrequest, portletresponse
Portlet actions
How does user interaction work?Example 1: Portlet edit mode
Example 2: Execute search
Portlet actions: Edit mode
Portlet actions
1. Initially, the doView method is executed.2. A JSP is called to render an initial screen. A message is
obtained from the request object.3. The Portlet View mode screen is shown in the browser window.4. The user clicks Edit to go into Edit mode.5. The Edit mode screen is displayed (the doEdit method is
executed).6. The user selects the desired action button (red or blue).7. The actionPerformed method is executed to process the action.
A resulting8. message is stored in the request object.9. The doView method is executed to complete the cycle and a
message is10.obtained from the request object.
Portlet actions: Execute Search
Authentication
Single-Sign-On (SSO)
LTPA token
Light-Weight Third Party Authentication (LTPA). LTPA uses shared secret keysOnce a user is authenticated all server in the same DNS domain trust this authenticationLTPA utilizes a token, which is stored as a cookie
WAS and Domino can be configured to use LTPA
LTPA pitfalls
NoticeYour browser will always show that WAS did issue an LTPA cookie.This maps the client’s user ID to a valid LTPA credential, but is used by WAS internally only. This can be verified by looking at the domain of the cookie. It shows the fully qualified DNS name of the WAS server. This limits its validity to this machine only.
Tivoli Access Manager and Siteminder
Session creation options
Using LTPAcreateSession(hostString, PortletRequest)
createSession(hostString, tokenString)
From EJB’screateSession(hostString, null)
Using user credentialscreateSession(hostString, Credentials)
AlternativelyUse Collaborative Components API
Acquire session via Collaborative Components API
CSEnvironment environ = CSEnvironment.getEnvironment(request);
CSCredentials cred = environ.getCredentials(request);
DominoService dominoService = (DominoService)CSFactory.getService(cred, CSFactory.DOMINO_SERVICE, Server, "http");
Session s=dominoService.getSessionObject();
Credential Vault
Vault segmentVault slotCredential Object
Types of Credential Objects
PassiveUserPasswordPassive, SimplePassive, JaasSubjectPassive
ActiveHttpBasicAuth
HttpFormBasedAuth
JavaMail
LtpaToken
SiteMinderToken
WebSealToken
None LTPA authentication cases
Different name/password for Portal/DominoCreate a Vault slot
Use UserPasswordPassive
Example
Resource management
Step1: Manage Domino session in the Portlet controllerStep2: Implement an object poolIn addition use Portlet cachingBest practices
Manage Domino session in the Portlet controller
Store Domino session in the Portletsession
Let’s see how this is done.
Problem:Session time-out
• Problematic in R5• Associated objects, e.g. views and sessions
Implicit Portal sessions for unauthenticated users / Performance
References:
Implement an object pool
More scalable, resourcefulEnables load balancingThread safeHelps with session time-outEase of use
Pools
1. Portlet calls an interface method on the virtual object.
2. The virtual object's implementation reserves a matching physical object from a named pool.
3. The method call is delegated to the physical object.
4. When the method call is completed, the physical object is returned to the appropriate pool for use by other virtual objects.
Domino session pool
TasksManage sessions
Periodically garbage collect sessions
ImplementationUse Jakarta common pools implementations
Pools
Outlook:Extend the pool to manage databases and view objects
NoticeThe Domino JSP tag library has an build in session manager (new in Domino 6.5)
There are commercially available pool managers, e.g. fromLooseleaf Software (not Portal specific)
Some Domino performance considerations
Use your Lotus Script experience
Use the least # of method calls possible
Always use views to query data = indexedUse viewentries, do not access the document
Use caching
Portlet cachedoView gets called every time the Portal page is rendered
Portlet.xml
lastmodified
Portal applications
Portlet applications
RequirementsMultiple Portlet applications
Applications with page flows
Portlet cooperation (not covered here)
Raises the need forPortlet Framework
Architecture
Portlet Framework
Problems with the standard approachImplementing complex process control is outside the scope of thePortlet API.
End up creating lots of code, just for user interaction
Repetitive and makes the code much harder to read
SolutionConsider your application to be a collection of Portlet actions and states
Envision a well-defined approach to state transitions
Introduction to the state pattern
Architecture
Moving from single Portlet to Portal applicationsFurther abstraction of Model View and Controller
Implement session EJB’s
You really need to know what you are doing here!
Summary
Domino Portlet developmentIs very powerful
Is 100% Java development
Domino access is not a problem
Needs Java experience
Needs proper architecture
Can be complex (EJB)
Can be time consuming
So when would we choose it?
You need to decide if your application is tactical or strategic
Tactical
Strategic
Need to decide carefully what functionalities you really need in the Portlet. (integration depth)
Need to know implementation alternatives (e.g. Portlet Builders from Bowstreet or CONET, Domino JSP tag library)
Domino Rich-Text in Portlets
®
REMINDER
Please fill out the session evaluation form.
Thank you!
®
Your Turn
Questions ?