plug yourself in and your app will never be the same (1 hr edition)
TRANSCRIPT
Belux Lotus User Group 2011
Antwerp, Belgium
Plug yourself in and your applications will never be the same!(An introduction to plugin development for Lotus Notes, Domino and Sametime)
About me
Developer: Notes / Domino / Sametime / Java / DB2 / WebSphere / web / plug-ins
Design Partner for Domino NEXT and Lotus Connections 3.0
Active blogger: lekkimworld.com
Speaker at Lotusphere
Articles for THE VIEW
E-mail: [email protected]
.com/lekkim
What I do!
Well plugins of course... But plugins are a many-headed beast!It's not just stuff for the Notes sidebar
It's about extending the UI in Notes, Sametime
and Symphony
It's about delivering a UI capable of doing
stuff you cannot do in traditional Notes
It's about developing custom components for
the XPages Extensibility Library
It's about DOTS (previously JAVADDIN) and OSGi
on the Lotus Domino Server
What's possible with plugins
RedWiki for plugin development
Lotus Notes and Domino Application Development wiki / IBM Redbook Publicationshttp://www-10.lotus.com/ldd/ddwiki.nsf/dx/Table_of_Contents_Developing_Customized_Components_for_Lotus_Notes_Sametime_and_Symphony
...or use the bit.ly link >> http://bit.ly/pluginredwiki
What I'm going to build (if time permits)
Sidebar panel containingA list box
Three buttons at the bottomOne button reads from a web service
One button reads contacts from names.nsf
One button creates a new emailReads recipient from list
Create document
Set subject
Add data from web service call to body
Create a feature for the plugin
Create an update site with the feature
Create a widget for the feature from the update site
Agenda
About Eclipse and Lotus Expeditor Toolkit
Installing Lotus Expeditor Toolkit
Plugin Development Basics
Building UI's with SWT and JFace
Jobs, Jobs, Jobs
Time to build some stuff...
Resources / Q&A
Eclipse architecture
Workbench
JFace
SWT
Core ExtensionPoint Framework
Service FrameworkRich Client Platform
Plug-inPlug-inExtension Pt.
Plug-in
ExtensionPointExtensionPointExtensionPoint
A software component in EclipseExtension Point declares
contract
to extend plug-in functionalityExtension code extends this
functionalityRCP allows you to build GUI apps on multiple OSSWT
provides
uniform UI API across multiple OS that calls
OS UI API for native look and feelJFace provides components to make
it easier to write a GUI e.g. wizards, preference pages, actions,
dialogs Workbench is desktop UI and customizableService Framework
supports registration and lifecycle management of
plug-ins
IBM Lotus Clients built on Eclipse
Notes
Sametime
Expeditor
SymphonyIndustry knowledge
and experienceecosystem of partners open and
extensible
Apps and Plug-ins (ISV + Customer)
collaborative servicesIntegratedapplications
Portal
BrowserDesktopMobileMultiplatform supportScalabilitySecurity
Eclipse workbench
Notes workbench
s
Lotus Expeditor (XPD) Toolkit
An integrated set of tools to develop, test, and deploy applications built on top of ExpeditorSupports Expeditor, Sametime, Notes and Symphony
FREE! No charge to use the Expeditor toolkit
Supported on Windows and Linux operating systems
Benefits Of Using The ToolkitEasily configure your development environment to develop for the platforms aboveTakes ~ 1 minute to configure your environmentSet your target environment
Point to the target locations on your machine
Provides a new launcher to launch products built on top of ExpeditorCreate a new launch configuration to launch the application from Eclipse
Provides numerous samples to get your started developing for Expeditor based products
Installing XPD Toolkit (1)
Download the XPD Toolkithttp://bit.ly/fKMF5o
Unzip
In EclipseHelp Software Updates...
Installing XPD Toolkit (2)
Click New Local Site...
Browse to unziped update
site
Select OK
Installing XPD Toolkit (3)
Select The XPD Toolkit
Click Install...
Installing XPD Toolkit (4)
Agree to the license
agreement
Install all features
Restart
Installing XPD Toolkit (5)
Start IDE
Select Test EnvironmentNotes, Sametime, Symphony, XPD
Specify Target LocationPoint to target runtime
/framework/rcp/eclipse
Click OK
Run Run Configuration
Double Click Client Services
Give The Configuration A Name
Select Run
What are plugins?
Plugins are the building blocks of Eclipse based applicationsAt their core a plugin is some code plus some declarations (extension points)
By themselves plugins may not do anything, but when you start combining plugins you can build very powerful applications
Examples: Eclipse, Notes, Sametime, Symphony
Application
Plugin
Anatomy of a plugin
Java code (optional)
Manifest.mf Basic properties of a plugin
Specifies dependencies this plugin has
Plugin.xmlExtension points the plugin uses / defines
Build.propertiesManages the build configuration of the plugin
Resources (optional)Jars the plugin may need
Files used for translation
Images
etc....
Extension Points
Extension points make plugins pluggablePlugins define extension points for other plugins to useExamples: sidebar, toolbar buttons, right click menus...
Extension points allow the platform to be more performant
Eclipse has a nice editor for adding and defining extension points
How do I know what extension points are available?Eclipse.org and the Expeditor wiki are your friends
Plugin
Using Extension Point
Extension Point Definition
Key Extension Points
org.eclipse.ui.viewsRegisters a view part with the platform
View parts can be used inside perspectives or in the sidebar
com.ibm.rcp.ui.shelfViewAn Expeditor extension point
Used to add a view part to the sidebar
org.eclipse.ui.actionSetsUsed to add top level toolbars and menus
org.eclipse.ui.menusUsed to add context menus
org.eclipse.ui.preferencePagesUsed to add preference pages to the preferences
The arcane art of building UI's
UI's are built using code
UI's are built using Java code adding widgets (controls) to containes (composites)
custom drawn using Java
code to listen for paint
events
In either case it isn't
WYSIWYG :-(
Standard Widget Toolkit (SWT)
Platform native look and feel
Protection from OS Level Changes
Very responsive
Resulting UI looks like native platform applications
Meet WindowBuilder!
http://eclipse.org/windowbuilder/
Threading lightly
A thread is an abstraction in computers to allow programs to perform multiple operations simultaneouslyAvoid tying up the program with background operations
Two ways to call other codeSynchronously == blockingBlocks current code until call is done and then returns to continue processing
Like you're used to from LotusScript
Asynchronously == non-blockingThe calling code continues to run you now have two pieces of code running
To tell the caller we're done we use callbacks or listeners
Harder to grasp
Used in AJAX you request data in the background and once the data has been fetched you are told
Jobs, jobs, jobs - lets vote for jobs!
Eclipse Job Frameworkjava.lang.Thread is way too low-level and error prone
Allows for easy background processing
Very simple to use
Allows scheduling of jobs (run this code in 2 minutes)
Allows weaving of jobs
Allows for listening to job status etc.
Standard UI for manipulating jobs
Two types of JobJob for background processing
UIJob for user interface updates
Both are abstract classes and normally used as anonymous inner classes
There can be only one
Any Eclipse application only has ONE thread that may update the user interface
It's surprise, surprise called the UI thread
This means thatTying up the UI thread will render the entire client unresponsive
Attempts to access the UI (i.e. set the text of a label) outside the UI thread will fail with an exception
You need a way to do stuff in the UI thread
To do stuff in the UI thread you use an UIJob from the Job API
Using Job in code
public void fireOnTheEmpire(int initDelay, final String jediName) { // create recurring job to poll web service new Job("Poll the Force!") { protected IStatus run(IProgressMonitor monitor) { // invoke endpoint using input String srvc = http://moon5.tatooine.com/JediFinder; WSFacade facade = new WSFacade(srvc); String result = facade.fire(jediName); // do something with the result ...
// reschedule this job (in 5 mintues) this.schedule(5 * 60 * 1000); // return return Status.OK_STATUS; } }.schedule(initialDelay * 60 * 1000);}
final
Weaving Jobs
Most operations usually include a UI and a background component so you need to weave jobs
A typical operation from the user consists of 3 steps:
Usually you start of with a UI call (button click i.e. button selection)
You perform some background operation (e.g. load data from a web service or similar)
You need to call back into the UI and update or inform
We call this to weave job
We do it by nesting Job instances
Let us build something!
DOTS (used to be JAVADDIN)
XPages Extensibility Library
A new project has been created which contains a simple sample for how to to develop a 'native' XPages control via the Java extensibility API. This control can be deployed globally as an OSGi bundle/plugin to Lotus Domino and Lotus Notes/Domino Designer and then used in all NSFs without having to put the code in all NSFs redundantely. The new control shows up in the palette in Designer as other out of the box controls.
Summary and resources
RedWiki about plugin development >> http://bit.ly/pluginredwiki
HIGHLY recommended article on the Job API >> http://www.eclipse.org/articles/Article-Concurrency/jobs-api.html
Eclipse articles >> http://www.eclipse.org/articles
Eclipse WindowBuilder >> http://www.eclipse.org/windowbuilder
Q&A
But!
How do I?
Doesn't that mean?
Give it to me! :-)
IV_Logo.png
OnTime_Logo.png
IV_Logo.png
OnTime_Logo.png
2011 IBM Corporation