Automating Google Workspace (GWS) & more with Apps Script
From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)
1. Presenter: Paul Withers
Company: Intec Systems Ltd
Presenter: John Cooper
Company: JCB
ICON UK 2014 From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries
2. 2
Paul Withers
•XPages Developer since 2009
•IBM Champion
•Author of XPages Extension Library
•Developer XPages OpenLog Logger
•Co-Developer of OpenNTF Domino API
3. 3
John Cooper
Began developing XPages from 8.5.0
Developed many XPage applications using java beans and custom components so decide to create OSGI Plugin to be able to deploy once
New to blogging, contributed 1 project to Open NTF so far.
4. 4
Agenda
•Why
•Development and Debugging Environment
•XPages Starter Kit
•Structure and Deployment
5. 5
XPages Developer Roadmap
•11 types of developer – Stephan Wissel
•Three types of developer – Niklas Heidloff
•Five tiers of developers – Greg Reeder
Extension Library development should be the goal of XPages developers
6. 6
Why?
•Build Once, Use Anywhere (virtually!)
•Easier to deploy new versions
•Deploy for junior developers
•Deploy third-party libraries
•Apache POI etc
•JDBC Drivers
•More easily avoid Java security exceptions
•Required for DOTS
8. 8
JDBC Driver Plugin Wizard
•Enhancement to RDBMS part of Ext Lib
•Requires latest version of ExtLib
•Allows a plugin to be created from one dialog for a JDBC driver
•See 3:15 on video http://www.openntf.org/main.nsf/blog.xsp?permaLink=NHEF-9N7CKD
9. 9
Agenda
•Why
•Development and Debugging Environment
•XPages Starter Kit
•Structure and Deployment
10. 10
Development and Debugging Environment
•Eclipse
•XPages SDK
•Debug Plugin
•IBM Java Runtime
•Local Domino Server recommended
11. 11
Eclipse for RCP and RAP Developers
•Latest release is Luna
•Debug plugin does not support this?
•Can have multiple versions installed
12. 12
OpenNTF XPages SDK Project
•Two downloads needed
•Installation video from Niklas Heidloff
13. 13
XPages SDK
•Gives XPages JREs and Target Platforms
•From 4:40 in video
•Point Preferences to Domino and Notes installs
•Ensure “Automatically create JRE” ticked
•Tick relevant entry in Java > Installed JREs
•Create and select entry under Plug-in Development > Target Platform
14. 14
Debug Plugin
•Allows you to point Domino server direct to projects in relevant workspace
•From 7:44 in video
•Point Preferences to Domino install
•Configure Domino server for Java debugging, as for Java development
•Run > Debug Configurations
•Create Debug Configuration
15. 15
OSGi Configuration
•Create new OSGi Framework configuration – tells Domino to use Eclipse workspace
•Set as Domino OSGi Framework
•Set auto-start to false
•Click Debug – creates pde.launch.ini
•Issue “res task http” command
•Obviously will cause problems on networked server!
16. 16
New Plugins
•For new plugins
•Go to OSGi Framework configuration
•Select the new plugin
•Click Debug to update config
•Issue “res task http” command
•If plugin is changed
•Issue “res task http” command
17. 17
Java Runtime
•Not necessary for most development
•Needed to debug Extension Library
•See blog post by Paul Withers
•Point eclipse.ini to Domino javaw.exe
•Ensures it uses IBM version of Java
•Add before Xms
•No spaces
18. 18
Agenda
•Why
•Development and Debugging Environment
•XSP Starter Kit
•Structure and Deployment
20. 20
XSP Starter Kit
•Sample Plugin
•Includes examples for all main classes
•Components
•Beans
•SSJS – not straightforward
•Listeners
•and more
21. 21
Agenda
•Why
•Development and Debugging Environment
•XPages Starter Kit
•Structure and Deployment
22. 22
Structure
•Plugin project
•This is all that’s needed for OSGi framework configuration
•Feature project loads one or more plugin
•Update Site project points to one or more feature
•Creates plugins and features jars
•Export as General > File System
24. 24
Deployment to Server / DDE
•Run from Eclipse using Domino Debug Plugin
•Install to remote server as other Ext Libs
•See Chapter 2 of XPages Extension Library pp28+
•Install to DDE as other Ext Libs
25. 25
Deploy to DDE
•Every change you make to the component re-install the update – Quite laborious for development
•Add directly to DDE plugins
•Best to create separate directory See blog post by John Cooper
26. 26
Create new Directory
•Navigate to framework directory inside the Notes Data Directory
•Create a new plugin directory
27. 27
Create a Link file
•Inside your newly created text file add the following:
path=C:/Program Files (x86)/IBM/Notes/framework/jmc-plugins
28. 28
Update Platform.XML file
•Change the transient attribute on the config tag to false
•Replace all the instances of policy="MANAGED-ONLY" to policy="USER-EXCLUDE"
29. 29
Export Plugin
•Export plugin as a “Deployable Plugin and Fragment”
•Put in newly created directory
•Restart designer
30. 30
Is It Working?
•Check Help > Support > View Log and View Trace for errors / print statements
32. 32
Deployment to Developers / XPiNC
•Add to Widget Catalog from Update Site database
•See XPages Extension Library pp40+
•Best practice is using Desktop Policy, ensures updates automatically deployed
33. 33
Plugin Structure
•See Extensibility API Developers Guide
•Activator is optional
•Allows generic code to be run
•Extend org.eclipse.core.runtime.Plugin
34. 34
Extensions
•Extensions load other Java classes
•Extend com.ibm.commons.Extension
•Use “tell http osgi pt -v com.ibm. commons.Extension” to see types and classes currently loaded
39. 39
Rest Service using DAS
•DAS – Domino Access Services
•Create a plugin project
•Add extension point to plugin.xml
<plugin> <extension point="com.ibm.domino.das.service"> <serviceResources class="org.iconuk.servicesdemo.service.NabDetailsService" name="NabDetails" path="nabdetails" version="9.0.1"> </serviceResources> </extension> </plugin>
40. 40
Plugin.xml
class="org.iconuk.servicesdemo.service.NabDetailsService“
Points to main service class
name="NabDetails"
Name of service is used in server document to know which service to load
path="nabdetails"
Path is the used to for the URL to access the service. Eg. http://hostname/api/nabdetails
41. 41
Service Class
•Required for extension point
•Extends com.ibm.domino.das.service.RestService
•getClasses method used to access Classes for each service URL
42. 42
Resource class
•One class per url
api/nabdetails/me -> class CurrentUserDetailsResource
api/nabdetails/paul -> class UserPaulDetailsResource
•Used to identify which path uses the class
@Path(CURRENTUSER_PATH)
•Used to identify which http method uses class method
@GET
43. 43
Enable on server
•Load plugin on to server in same way as any other plugin
•Open Server Document Internet Protocols -> Domino Web Engine
•Add service name to Enabled DAS Services
44. 44
Components
•Take a custom control and make it global
•NotesIn9 64 by Tim Tripcony
•#codefortim
•Or code within Eclipse
•Extensibility API 9.0.1
45. 45
Components
•Component class DOMINO
•.xsp-config to add properties DDE
•Renderer class, if required DOMINO
•Use getRendererType() to find an existing renderer
•faces-config.xml to add renderer DOMINO
•Load xsp-config and faces-config.xml in Library class
46. 46
Including Third Party Jars
•Create a separate plugin
•New > Plug-in from Existing JAR Archives
•For additional jars
•Import the jar
•Add to Build Path
•Ensure included in Binary Build on build.properties
•Also blog post by John Dalsgaard
47. 47
Including Third Party Jars
•Add as Required Plug-in to plugin.xml
•Click on Properties and tick “Reexport this dependency”
•Add to feature
•Ensure “Unpack the plug-in archive after the installation” is ticked
Otherwise DDE will not see the jars
48. 48
Demo Plugin
•Add component for Separator
•Allow properties for:
•separatorType (New Line / Space)
•count (integer, defaulting to 1)
•Deploy org.apache.commons.lang3
•Add utility method to convert any object to string detailing properties
49. 49
Links to Demos
•https://github.com/paulswithers/pluginDemo
•Demo database is in notes folder
•https://bitbucket.org/johnmcooper/icon-uk- 2014-services-demo
50. 50
Thank You
•Paul Withers
•pwithers@intec.co.uk
•http://www.intec.co.uk/blog
•http://twitter.com/paulswithers
•John Cooper
•john@johnmcooper.co.uk
•http://developmentblog.johnmcooper.co.uk
•http://twitter.com/j_m_cooper