engage 2014 openntf domino api slides
DESCRIPTION
Presentation by Paul Withers and Martin Jinoch at Engage 2014 about OpenNTF Domino APITRANSCRIPT
OpenNTF Domino API: The Community API
Paul Withers – Intec Systems Ltd
Martin Jinoch
20-3-2014 @EngageUG #engageug 1
Paul Withers
• IBM Champion
• Author of XPages Extension Library
• OpenNTF Director
• Co-Developer of OpenNTF Domino API
20-3-2014 @EngageUG #engageug 2
Martin Jinoch
• Notes developer since version 3.0
• Java/XPages
• Source control
• Test driven development
20-3-2014 @EngageUG #engageug 3
Agenda
• Why Did We Bother?
• Deployment and Configuration
• What’s Available?
• How Do I Convert My Code?
20-3-2014 @EngageUG #engageug 4
Why Bother?
20-3-2014 @EngageUG #engageug 5
* See http://www.shoeboxblog.com/wp-content/uploads/2010/02/life-before-google-500x496.jpg
Why Java?
• One install per server
• Run contexts • XPages
• Java / JAR Design Elements
• Agents (slightly different deployment model)
• Applets / Servlets
• Plugins (Client/Designer/OSGi)
• DOTS Tasks
• SSJS just runs Java methods • So most classes and methods are available in SSJS as well!
20-3-2014 @EngageUG #engageug 6
Why Develop It?
• Bridge gap between LotusScript and Java developers
• Remove risk of infinite loops in DocumentCollections
• No need to recycle
• Take advantage of List and Sets (Collections)
• More intuitively named parameters
• No need to catch NotesExceptions
• Pass more Java objects to methods
• Lots of helper methods
• In context Javadocs
20-3-2014 @EngageUG #engageug 7
After?
Paul Withers: I have a checkIsUnique() method that you pass a View, a Key, and the current Document. Would that be a useful addition to DominoUtils?
Nathan T. Freeman: sure that looks useful
Nathan T. Freeman: BUT...
Nathan T. Freeman: you're forgetting something
Nathan T. Freeman: you own the API :)
Nathan T. Freeman: View.checkUnique(Object key, Document doc)
20-3-2014 @EngageUG #engageug 8
Why Use It?
• Upgrading to 9.0.1 (can be forked for 9.0)
• Open source can be used
• Don’t want to work out where you need to recycle now
• Didn’t realise DateTimes and Vectors were so toxic
• You prefer beer and chocolate and User Groups!
20-3-2014 @EngageUG #engageug 9
Agenda
• Why Did We Bother?
• Deployment and Configuration
• What’s Available?
• How Do I Convert My Code?
20-3-2014 @EngageUG #engageug 10
Deployment
• Download from OpenNTF or download as part of OpenNTF Essentials from http://essentials.openntf.org
• Upload Update Site to server
• Issue console command “restart task http”
• Sufficient for OSGi-dependent contexts since M4
20-3-2014 @EngageUG #engageug 11
Deployment to Client / Designer
• Install Update Site or OpenNTF Essentials via Widget Catalog or via File > Application > Install
• Designed for Server and Client 9.0.1
20-3-2014 @EngageUG #engageug 12
Enable Library for Each NSF
• No draggable components, so we can’t enable it for you
• Enable on Page Generation tab of Xsp Properties
20-3-2014 @EngageUG #engageug 13
Configure Xsp Properties
• org.openntf.domino.xsp= • godmode: session & database auto-converted to
org.openntf.domino
• marcel: always convert MIME
• raid: run in debug mode
• khan: turn on all fixes, e.g. appendItemValue()
“I am…better.”
“At what?”
“Everything.”
• e.g. org.openntf.domino.xsp=godmode,mime,khan 20-3-2014 @EngageUG #engageug 14
Configure Xsp Properties for OpenLog
• Same as in XPages OpenLog Logger • xsp.openlog.filepath • xsp.openlog.displayError • xsp.openlog.genericErrorMessage • xsp.openlog.email • xsp.openlog.debugLevel • xsp.openlog.suppressEventTrace
20-3-2014 @EngageUG #engageug 15
Agenda
• Why Did We Bother?
• Deployment and Configuration
• What’s Available?
• How Do I Convert My Code?
20-3-2014 @EngageUG #engageug 16
Packages
• org.openntf.domino: core code
• org.openntf.domino.designer: future DDE-specific code
• org.openntf.domino.plugin: core packaged in a plugin • If you want to modify and test, build this
• org.openntf.domino.xsp: OSGi-specific code
• org.openntf.domino.xsp.feature: feature project
• org.openntf.domino.xsp.update: update site project • Delete features & plugins folders, open site.xml, click Build All
and export as General > File System
20-3-2014 @EngageUG #engageug 17
Core API Packages
• org.openntf.domino • Core Domino API interfaces
• Import classes from this package
• org.openntf.domino.ext • Extension interfaces
• Look here for methods we’ve added
• org.openntf.domino.impl • Implementations of interfaces
• Look here for the actual code
20-3-2014 @EngageUG #engageug 18
Key Additions
• XPages OpenLog Logger
• Transactional Processing
• Database Event Listeners
• Graph Database
• Jobs and Tasks
• Email Helper
• Sync Helper
• Document Scanner
• Index Database
20-3-2014 @EngageUG #engageug 19
Work in Progress
• Classes for ALL Design Elements
• Data Schemas
• Name / Value Picker DataProviders
• Read / write XPages, Custom Controls, JARs
• Recycle performance optimisation
• Index Database optimisation
• Collection sorting and progress serialisation
• AtFormulaParser – quicker 20-3-2014 @EngageUG #engageug 20
Demo
20-3-2014 @EngageUG #engageug 21
Agenda
• Why Did We Bother?
• Deployment and Configuration
• What’s Available?
• How Do I Convert My Code?
20-3-2014 @EngageUG #engageug 22
How do I convert my code?
1. Do nothing and use old code with a new one together (not recommended!)
2. Replace all implicit objects via godmode
3. Search and replace imports (lotus.domino -> org.openntf.domino)
4. Remove unnecessary code (try catch blocks, “throws NotesException”, recycle() calls, …)
5. Enjoy the power of helper methods
20-3-2014 @EngageUG #engageug 23
How do I convert my code
• Use old code with new one together
Converting from new API objects to original and back via Factory.fromLotus() and Factory.toLotus() methods
• org.openntf.domino.xsp=godmode
iddqd anyone?
• Change import lotus.domino -> org.openntf.domino
Search and replace in DDE can do this for you for a whole project
20-3-2014 @EngageUG #engageug 24
Demo
20-3-2014 @EngageUG #engageug 25
Links
• Project on OpenNTF - http://www.openntf.org/internal/home.nsf/project.xsp?action=openDocument&name=OpenNTF%20Domino%20API
• OpenNTF Essentials - http://essentials.openntf.org/
• Source code on GitHub - https://github.com/OpenNTF/
• Wiki articles - https://github.com/OpenNTF/org.openntf.domino/wiki/_pages
• OpenNTF Webinar (last year) - http://www.youtube.com/watch?v=g-u2IEEPAfM
20-3-2014 @EngageUG #engageug 26
Questions!
• Paul Withers • Intec Systems Ltd
• http://www.intec.co.uk/blog
• twitter.com/paulswithers
• Martin Jinoch • http://jinoch.cz
• twitter.com/mjinoch
20-3-2014 @EngageUG #engageug 27