dannotes 2013: openntf domino api
DESCRIPTION
OpenNTF Domino API presentation at DanNotes November 2013TRANSCRIPT
![Page 1: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/1.jpg)
September 2013
Paul Withers
Intec Systems Ltd
OpenNTF Domino API: Making Domino Work The Way You Want
![Page 2: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/2.jpg)
Paul Withers
• XPages Developer since 2009
• IBM Champion
• Author of XPages Extension Library
• Co-Developer of OpenNTF Domino API
• Notes cheat sheets
![Page 3: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/3.jpg)
Agenda
• Background
• Why Bother?
• Installation and Architecture
• Using the API
• Investigating the API
![Page 4: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/4.jpg)
Why Java?
• Current Run Contexts
• Agents
• XPages
• Java / JAR Design Element
• Applets
• Servlets
• Java Addins
• Client Plugin
• Designer Plugin
• OSGi Plugin
• DOTS Task
• Accessible Objects*
• Databases
• Directories
• Documents
• Design Elements
• ACLs
• Admin Requests
• Names
• HTTP Requests / Responses
• Sessions
• File Attachments
*Accessible objects can vary by context
![Page 5: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/5.jpg)
Java in Domino
![Page 6: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/6.jpg)
Not Just for Java
• SSJS
• #{javascript:…} means parse this string
using SSJS rules
• Pass commands to VariableResolver
• Look for corresponding variable name
• Map to a Java object/method
• Add variable and mapping to registry
• In org.openntf.domino.xsp plugin (most)
![Page 7: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/7.jpg)
Why Bother?
* See http://www.shoeboxblog.com/wp-content/uploads/2010/02/life-before-google-500x496.jpg
![Page 8: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/8.jpg)
Why Develop It?
• Out-dated objects (Vectors)
• Out-dated iteration rules
• Unhelpful content assist
• Argument names arg0, arg1
• No Javadoc
• Recycling – here be dragons!
• Exceptional exception handling
![Page 9: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/9.jpg)
Why Use It?
Inline
Documentation
Garbage Collection
Auto-logging
Auto-boxing
Iterables
Helpers
![Page 10: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/10.jpg)
How Do You Use It?
GitHub source
OpenNTF download
Upload Update Site to Server
Drop JAR in
Designer JVM (outside OSGi)
Install Update Site in DDE
Drop JAR in Domino JVM
(outside OSGi)
![Page 11: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/11.jpg)
Installation on Server
• Upload org.openntf.domino.xsp into Update Site Db
• “Restart task http” on console
• Sufficient for OSGi-dependent contexts since M4
![Page 12: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/12.jpg)
Installation on Server
• For non-OSGi contexts, e.g. Agents:
• Save org.openntf.domino JAR to
<domino>\jvm\lib\ext
![Page 13: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/13.jpg)
Installation on Client / Designer
• Install Update Site via Widget Catalog or via File > Application > Install
• For agents save org.openntf.domino JAR to <notes>\jvm \lib\ext
![Page 14: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/14.jpg)
OpenNTF Essentials
• Also part of OpenNTF Essentials
• Only XPages / OSGi part
• Does not include jar file
• Download from http://essentials.openntf.org
• Copy Update Site database to server
• Update notes.ini
• Restart server
• Install in client (see OpenNTF webinar)
![Page 15: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/15.jpg)
Enable Library for NSF
• Remember to add it to Xsp Properties
![Page 16: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/16.jpg)
Configure Xsp Properties
• org.openntf.domino.xsp=….
• godmode: override session and database objects
• marcel: always convert MIME
• raid: run in debug mode
• khan: turns on all “fixes”, e.g. appendItemValue
"I am... better."
"At what?"
"Everything."
• e.g. org.openntf.domino.xsp=godmode,khan
![Page 17: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/17.jpg)
Configure Xsp Properties
• OpenLog
• xsp.openlog.filepath
• xsp.openlog.displayError
• xsp.openlog.genericErrorMessage
• xsp.openlog.email
• xsp.openlog.debugLevel
![Page 18: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/18.jpg)
See Demo App
• All available in the demo application
https://github.com/paulswithers/org.openntf.domino-Demo-Database
![Page 19: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/19.jpg)
Using Demo Database
• Download and sign
• Go to Administration page
• Create Sample DataSet
• Familiar? Sort of…
• Based on Extension Library code
• Uses org.openntf.domino
• Use Import Comparator to compare
![Page 20: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/20.jpg)
Sample Pages
![Page 21: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/21.jpg)
Java Comparator
![Page 22: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/22.jpg)
Creating Pages
![Page 23: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/23.jpg)
Java Methods
• New#{compositeData.title}Bean & Old#{compositeData.title}Bean
• Register in faces-config.xml
• Add public void methods
• For comparator, set javaMethodName to method name
• Create text files
• Copy & paste bean code
![Page 24: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/24.jpg)
Reviewing the Source
• Install / open Eclipse
• Using Git
• Clone repository from GitHub
• Import projects
![Page 25: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/25.jpg)
Packages
• org.openntf.domino: core code
• org.openntf.domino.designer: future Designer-specific
functionality
• org.openntf.domino.plugin: core packaged in plugin
• If you want to modify and test, build this
• org.openntf.domino.xsp: XPages-specific code
• org.openntf.domino.xsp.feature: feature project
• org.openntf.domino.xsp.update: update project
• Build All and export
![Page 26: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/26.jpg)
Core API Packages
• src: main code
• test: test scripts
• tinkerpop: graph db code
• data: sample error log
• doc: JavaDoc
• resources: various resource files
![Page 27: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/27.jpg)
src Package
• org.openntf.domino
• Core interfaces
• Import these classes
• org.openntf.domino.ext
• Extension interfaces
(new methods)
• org.openntf.domino.impl
• Implementations of
interfaces - actual code
![Page 28: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/28.jpg)
Enabling SSJS
• Core cannot have XPages dependencies
• Must be in org.openntf.domino.xsp
• org.openntf.domino.xsp.script
• WrapperOpenDomino.register()
• Adds objects for each class
• getMethodMap() creates map for each
method
• OpenFunction.call() calls that method
![Page 29: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/29.jpg)
How It’s Normally Done
![Page 30: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/30.jpg)
How We Do It?
• WRAPPED_CLASSES adds each class required for SSJS
• Iterated to create one OpenFunction object for each class
• Generic Code to add all public non-static methods to Map
• generateMethodMap()
• Limitations on ellipses / generic parameters
• There are ways round this!
![Page 31: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/31.jpg)
Benefits?
• If we add a new public non-static method, it’s automatically added
• If we add a new class, we just need to add new element in WRAPPED_CLASSES Map
![Page 32: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/32.jpg)
Recent Additions (M3, M4)
• Database Event Listeners
• Graph Database
• Jobs and Tasks
• Email Helper
• XPages OpenLog Logger
• New 9.0.1 methods added
![Page 33: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/33.jpg)
Work in Progress
• Classes for ALL Design Elements
• Read / write XPages, Custom Controls, JARs
• Data Schemas
• Big Data Models
• MapPicker / ListPicker as dataProviders
• NamePicker dataProviders
• Support
![Page 34: DanNotes 2013: OpenNTF Domino API](https://reader034.vdocuments.mx/reader034/viewer/2022042700/554e1e8db4c90571798b4b7e/html5/thumbnails/34.jpg)
Thank You
• Paul Withers
• http://www.intec.co.uk/blog
• @paulswithers
• https://github.com/OpenNTF/ org.openntf.domino
• https://github.com/paulswithers/org.openntf.domino-Demo-Database