Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Lotusphere 2011 Jmp103 - Jumpstart Your "Jedi Plug-in Development Skills" with the Masters
1. JMP103 Jumpstart Your "Jedi Plug-in Development Skills" with the Masters Ryan Baxter | Staff Software Engineer | IBM Mikkel Flindt Heisterberg | Developer | IntraVision
41. Eclipse Architecture Workbench JFace SWT Core Extension Point Framework Service Framework Rich Client Platform Plug-in Plug-in Extension Pt. Plug-in Extension Point Extension Point Extension Point A software component in Eclipse Extension Point declares contract to extend plug-in functionality Extension code extends this functionality RCP allows you to build GUI apps on multiple OS SWT provides uniform UI API across multiple OS that calls OS UI API for native look and feel JFace provides components to make it easier to write a GUI e.g. wizards, preference pages, actions, dialogs Workbench is desktop UI and customizable Service Framework supports registration and lifecycle management of plug-ins
42. IBM Lotus Clients – Built on Eclipse Sametime Expeditor Apps and Plug-ins (ISV + Customer) Notes Symphony Industry knowledge and experience ecosystem of partners open and extensible collaborative services Integrated applications Portal Browser Desktop Mobile Multiplatform support Scalability Security
173. Attempts to access the UI (i.e. set the text of a label) outside the UI thread will fail with an exception
174.
175. 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); }
176. Using UIJob in code final List lstJedis = new List(parent, SWT.NONE); ... public void psssst( final String[] jedis) { // since we're called in a background process // use that UIJob we learned about to update the UI new UIJob("Load Jedis") { public IStatus runInUIThread(IProgressMonitor monitor) { // update UI for (String jedi : jedis) { lstJedis.add(jedi); } // return status return Status.OK_STATUS; } }.schedule(); }
177. Don't Go To The Dark Side! public void createPartControl(Composite parent) { final Label txt = new Label(parent, SWT.NONE); new UIJob("Indicate job starting") { public IStatus runInUIThread(IProgressMonitor monitor) { // update label txt.setText("Turning star cruiser (" + new Date() + ")..."); // do long running task try { Thread.sleep(5000); } catch (Exception e) {} // update label txt.setText("Done turning star cruiser (" + new Date() + ")..."); // schedule this.schedule(5000); // return return Status.OK_STATUS; } }.schedule(5000); }
178.
179.
180. You perform some background operation (e.g. load data from a web service or similar)
183. A nice example of how a Jedi does it! public void widgetSelected(SelectionEvent event) { // update label to tell user we're starting off list.add("Starting to run code (" + new Date() + ")...", 0); // create job for background operation and schedule it new Job("Long running job") { protected IStatus run(IProgressMonitor monitor) { // do operation that possibly takes a while downloadEntireGalacticLibrary(); // call back into UI to tell user we're done new UIJob("Update UI") { public IStatus runInUIThread(IProgressMonitor monitor) { list.add("Done running code (" + new Date() + ")...", 0); return Status.OK_STATUS; } }.schedule(); // return return Status.OK_STATUS; } }.schedule(); }
200. DO use the Job API and the supplied NotesSessionJob new NotesSessionJob("Access Notes data") { public IStatus runInNotesThread(Session session, IProgressMonitor monitor) throws NotesException { // print username System.out.println(session.getDatabase(null, “names.nsf”).getTitle()); // return return Status.OK_STATUS; } }.schedule();
Open Sources Project One of the best IDEs Integration for almost any kind of language you can images Extensible SCM plugins, SQL DB plugins, UML plugins, Web Dev plugins Expeditor and therefore Notes, Sametime, and Syphomy are build ontop of it Other companies also build applications ontop of Eclipse, other IDEs like Aptana, and MyEclipse Resources are endless with Eclipse
Give a quick overview of the workbench, this will be useful for later on so they can see how it related to the Notes workbench and when we talk about things like “views” they know what they are All of the pieces of the workbench correlate to Notes as well
Point out that some of the most recognizable parts of the Notes workbench are just Eclipse concepts. We achieve this via plugins
Why should they care about plugins? Its all about extensibility and integration Plugin development is a great way to integrate into Lotus products. Once you have the knowledge you know how to integrate into 4 Lotus products Java Java Java Java is a 1 st class language, its mature and has a ton of libraries You can do a ton of things with plugins like work with web services, integrate with web applications, integrate with Database applications
The Expeditor toolkit provides tools for developers to get started building plugins for Lotus products Makes your life easy, easy configuration and easy launching to test your plugins Free not charge to download it
You can use any number of eclipse configurations with the expeditor toolkit
Download from IBM Unzip In Eclipse go to Help -> Software Updates This is where you install features into eclipse, we will talk more about features later
Select Local Site Go to where you unziped the download Click OK
Select the top level expeditor toolkit feature Click Install
Accept the license agreement and install the features After the install finished restart eclipse
Walk them through setting up the expeditor toolkit Create a new workspace in eclipse Configure the toolkit Create a new run configuration Launch Notes
From Pierre: automatic manifest management, migration of secondary dependencies, other migration capabilities (mostly on other CS project types), common UI category (requested via UI team).
Java – goes in the src folder Manifest.mf – basic properties, and dependencies Plugin.xml – extention points Build.properties – for when you build your plugin Resources – other resources your plugin uses
Plugins live in the Notes install directory Most are compiled as jars
Walk through creating a new plugin project Explain the different pieces just covered in the slides
Extension points provide you with integration points Plugins define extension points for other plugins to use Eclipse, and Expeditor both define extension points The reason for extension points is to allow the platform to me performant, eclipse only loads the code when it has to Eclipse provides an editor for you to leverage and define extension points, also provides wizards Extension points are documented
Demo adding a view and a sidebar
Show this page but just jump right to a demo This is probably a good 5 minutes of demo Probably just show the attachment viewer Preference page or selection Show the Debug configuration screen Set a breakpoint line 73, Viewer.java (selectionChanged) Launch Notes and open an email with an attachment Explain the variables panel, show the selection object Then show what the osgi console is all about Setting logging levels