From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)
-
Upload
paul-withers -
Category
Technology
-
view
541 -
download
7
description
Transcript of From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)
![Page 1: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/1.jpg)
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
![Page 2: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/2.jpg)
2
Paul Withers
• XPages Developer since 2009
• IBM Champion
• Author of XPages Extension Library
• Developer XPages OpenLog Logger
• Co-Developer of OpenNTF Domino API
![Page 3: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/3.jpg)
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.
![Page 4: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/4.jpg)
4
Agenda
• Why
• Development and Debugging Environment
• XPages Starter Kit
• Structure and Deployment
![Page 5: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/5.jpg)
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
![Page 6: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/6.jpg)
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
![Page 7: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/7.jpg)
7
Examples
• XPages Extension Library
• IBM SBT
• XPages OpenLog Logger
• OpenNTF Domino API
• Bootstrap4Xpages
• XPage Debug Toolbar
• XPages Scaffolding
• XPages Toolkit
![Page 8: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/8.jpg)
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
![Page 9: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/9.jpg)
9
Agenda
• Why
• Development and Debugging Environment
• XPages Starter Kit
• Structure and Deployment
![Page 10: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/10.jpg)
10
Development and Debugging Environment
• Eclipse
• XPages SDK
• Debug Plugin
• IBM Java Runtime
• Local Domino Server recommended
![Page 11: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/11.jpg)
11
Eclipse for RCP and RAP Developers
• Latest release is Luna
• Debug plugin does not support this?
• Can have multiple versions installed
![Page 12: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/12.jpg)
12
OpenNTF XPages SDK Project
• Two downloads needed
• Installation video from Niklas Heidloff
![Page 13: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/13.jpg)
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
![Page 14: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/14.jpg)
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
![Page 15: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/15.jpg)
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!
![Page 16: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/16.jpg)
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
![Page 17: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/17.jpg)
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
![Page 18: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/18.jpg)
18
Agenda
• Why
• Development and Debugging Environment
• XSP Starter Kit
• Structure and Deployment
![Page 19: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/19.jpg)
19
XSP Starter Kit
![Page 20: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/20.jpg)
20
XSP Starter Kit
• Sample Plugin
• Includes examples for all main classes
• Components
• Beans
• SSJS – not straightforward
• Listeners
• and more
![Page 21: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/21.jpg)
21
Agenda
• Why
• Development and Debugging Environment
• XPages Starter Kit
• Structure and Deployment
![Page 22: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/22.jpg)
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
![Page 23: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/23.jpg)
23
Update Site Project
![Page 24: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/24.jpg)
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
![Page 25: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/25.jpg)
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
![Page 26: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/26.jpg)
26
Create new Directory
• Navigate to framework directory inside the Notes Data Directory
• Create a new plugin directory
![Page 27: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/27.jpg)
27
Create a Link file
• Inside your newly created text file add the following:
path=C\:/Program Files (x86)/IBM/Notes/framework/jmc-plugins
![Page 28: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/28.jpg)
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"
![Page 29: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/29.jpg)
29
Export Plugin
• Export plugin as a “Deployable Plugin and Fragment”
• Put in newly created directory
• Restart designer
![Page 30: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/30.jpg)
30
Is It Working?
• Check Help > Support > View Log and View Trace for errors / print statements
![Page 31: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/31.jpg)
31
Is It Working?
![Page 32: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/32.jpg)
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
![Page 33: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/33.jpg)
33
Plugin Structure
• See Extensibility API Developers Guide
• Activator is optional
• Allows generic code to be run
• Extend org.eclipse.core.runtime.Plugin
![Page 34: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/34.jpg)
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
![Page 35: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/35.jpg)
35
Library
• Selected in Xsp Properties
• Type=com.ibm.xsp.Library
• Extend AbstractXspLibrary
• Defines
• Dependencies
• Faces-Config files
• Xsp-Config files
![Page 36: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/36.jpg)
36
Contributor
• Adds factories
• Holds server-level maps
• Load implicit objects (variables)
• Type=com.ibm.xsp.library.Contributor
• Extend XspContributor
![Page 37: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/37.jpg)
37
ResourceProvider
• Adds browser resources
• JavaScript
• CSS
• Images
• Type=com.ibm.xsp.GlobalResourceProvider
• Extend BundleResourceProvider
![Page 38: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/38.jpg)
38
Basic Plugin from XSP Starter Kit
![Page 39: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/39.jpg)
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>
![Page 40: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/40.jpg)
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
![Page 41: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/41.jpg)
41
Service Class
• Required for extension point
• Extends com.ibm.domino.das.service.RestService
• getClasses method used to access Classes for each service URL
![Page 42: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/42.jpg)
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
![Page 43: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/43.jpg)
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
![Page 44: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/44.jpg)
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
![Page 45: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/45.jpg)
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
![Page 46: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/46.jpg)
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
![Page 47: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/47.jpg)
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
![Page 48: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/48.jpg)
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
![Page 49: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/49.jpg)
49
Links to Demos
• https://github.com/paulswithers/pluginDemo
• Demo database is in notes folder
• https://bitbucket.org/johnmcooper/icon-uk-2014-services-demo
![Page 50: From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Libraries (ICON UK 2014)](https://reader034.fdocuments.us/reader034/viewer/2022042509/55639debd8b42a01658b4c85/html5/thumbnails/50.jpg)
50
Thank You
• Paul Withers
• http://www.intec.co.uk/blog
• http://twitter.com/paulswithers
• John Cooper
• http://developmentblog.johnmcooper.co.uk
• http://twitter.com/j_m_cooper