Let me introduce you: DOTS


Published on

Entwicklercamp 2013

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Let me introduce you: DOTS

  1. 1. Let me introduce you: DOTS Frank van der Linden
  2. 2. Frank van der Linden & e-office @flinden68 http://www.domino-weblog.nl nl.linkedin.com/in/flinden68 fli@e-office.com
  3. 3. Roadmap• Introduction• What is DOTS• Setup your environment• My first DOTS tasklet• Debug my first DOTS tasklet• Deploy your tasklet• Tips and tricks
  4. 4. Introduction
  5. 5. Introduction of OSGi• Open Services Gateway initiative – Started in 1999 – Still improved – module system and service platform• OSGi bundles – Can be installed remotely. – No reboot required – Lifecycle
  6. 6. Introduction of OSGi• OSGi and IBM Notes/Domino – Since 8.5.2 9+ – Extension points – Extension Library – DOTS (Domino OSGi Tasklet Service) – OpenSocial Container 8.5.3 8.5.2
  7. 7. Introduction to DOTS• Domino OSGi Tasklet Service – Easy development – Outside in Eclipse IDE – Tasklets can run: scheduled, manual• Next generation agents for Domino• OpenNTF project by IBM since April, 2011 (replaced JAVADDIN project)• Included in IBM Domino 9 Social Edition
  8. 8. Introduction to DOTS
  9. 9. Introduction to DOTS• DOTS Tasklets outperforms over Java Agents! AMGR Prepare JVM Load Agent Java Agent: launches a Initializes Java and JNI Bytecode Run! Thread interfaces DOTS tasklet: Everything is ready to run Run!> tell amgr run "testXPagescrash.nsf" LongJobAgent09.11.2012 19:38:39 JVM: Java Virtual Machine initialized.09.11.2012 19:38:39 AMgr: Start executing agent LongJobAgent in testXPagescrash.nsf09.11.2012 19:38:39 Agent Manager: Agent printing: 18134909.11.2012 19:41:02 Agent Manager: Agent printing: 222709.11.2012 19:41:02 Agent Manager: Agent printing: Finished in 143 secs... -09.11.2012 19:41:02 AMgr: Agent LongJobAgent in testXPagescrash.nsf completed execution > load dots > Listening for transport dt_socket at address: 8001 09.11.2012 19:42:40 Domino OSGi Tasklet Container started ( profile DOTS ) > 181349 > 2227 09.11.2012 19:43:22 [DOTS] (annotated) Finished in 41 secs...
  10. 10. Introduction to DOTS• DOTS versus Agents – AMGR is old and complicated – Range • Agents are database depended • DOTS run server wide – DOTS are more flexible • Precise timing
  11. 11. Setup your environment
  12. 12. Setup your environment• DOTS should be installed into IBM Domino server – For IBM Domino 9 Social Edition Public Beta, you don’t need to do anything. – For versions 8.5.2 and 8.5.3, • Download DOTS package from OpenNTF • You will also need some Eclipse plugins from Eclipse 3.6.2+
  13. 13. Setup your environment• Create some folders inside your Domino folder – [Domino Program Files]osgi-dotsrcpeclipseplugins – [Domino Program Files]osgi-dotssharedeclipseplugins• Copy files from Eclipse install directory These plugins will be copied from Eclipse installation [Eclipse]plugins
  14. 14. Setup your environment• The DOTS package contains the executables – The jar files in the newly created directories – The executables in the Domino program directory Copy to [Domino]osgi-dotssharedeclipseplugins Copy to [Domino]osgi-dots
  15. 15. Setup your environment• The DOTS package contains the executables – The jar files in the newly created directories – The executables in the Domino program directory Copy to [Domino]osgi-dotssharedeclipseplugins Copy to [Domino]osgi-dots
  16. 16. Setup your environment• Download Eclipse – http://www.eclipse.org/downloads – Eclipse >3.6.2(Eclipse IDE for Java EE Developers)• Download projects from OpenNTF – Domino Debug Plug-in from XPages SDK for Eclipse RCP: http://tiny.cc/XPagesSDK
  17. 17. Setup the Domino Debug Plugin• Accept all next steps• Restart Eclipse
  18. 18. Setup the Domino Debug Plugin• Check Preferences,if Domino Debug Plugin is installed
  19. 19. Setup the target platform [Domino Program Files]osgi-dotsrcpeclipse [Domino Program Files]osgi-dotsrcpeclipse
  20. 20. Setup the Notes Java Api reference
  21. 21. My first DOTS tasklet
  22. 22. My First DOTS tasklet• Create a new Plug-in Project – File  New  Plug-in Project
  23. 23. My First DOTS tasklet• Prepare the DOTS extensions
  24. 24. My First DOTS tasklet• Import DOTS extensions – Deselect «Show only extension points from the required plug-ins» – Find & pick «com.ibm.dots.task» extension from the list – Correct the warning in the Manifest.mf tab, then Save & Close Manifest view.
  25. 25. My First DOTS tasklet• Import Domino package
  26. 26. My First DOTS tasklet• Create the Java class
  27. 27. My First DOTS tasklet• Add some code
  28. 28. My First DOTS tasklet• Modify the plugin.xml name of the class tasklet id
  29. 29. My First DOTS tasklet• Now we can run our tasklet• DOTS will run on the Domino server• There are two ways to run from Eclipse IDE – Run – Run and debug
  30. 30. My First DOTS tasklet• Create a “run configuration”
  31. 31. My First DOTS tasklet• PDE Configuration file should be created, the first time• PDE file is created in the dots workspace
  32. 32. My First DOTS tasklet• Now, lets run the tasklet
  33. 33. Debug a DOTS tasklet• Stop DOTS task – Tell dots quit• Adding debug parameters to notes.ini – DOTS_DEBUGADDRESS=8001 – DOTS_DEBUGSUSPEND=y• Reload DOTS task – Load dots – Dots task will start only when debugger connects
  34. 34. Debug my first DOTS tasklet• Server needs to know what to debug
  35. 35. Debug my first DOTS tasklet• Adding breakpoint to debug the code
  36. 36. Debug my first DOTS tasklet• Some tips – Schedule tasks – OSGi allows you to refresh bundles without restart, here is how: • Find out the «bundle-id» for the plug-in • Refresh the bundle
  37. 37. Debug my first DOTS tasklet • More tips...Annotations – Annotations is supported in DOTS. – Powerfull way of specify for each method, what to do@RunOnStartpublic void runOnStart( IProgressMonitor monitor ){ logMessage("Annotated onStart method");}@Run( id="manual")public void runManual( String[] args, IProgressMonitor monitor ){ logMessage("Annotated run method with id=manual");}@RunOnStart@RunEvery( every=60, unit=RunUnit.second )@HungPossibleAfter( timeInMinutes=1 )public void runEvery60seconds( IProgressMonitor monitor ){ logMessage( "Called from annotated method every 60 seconds");}
  38. 38. Deploy your tasklet
  39. 39. Deploy your tasklet• DOTS plugins can be deployed as OSGi bundle – As jar file in OSGi plugins folder – As update site• Disable debug parameters – Delete PDE runtime configuration (pde.launch.ini) – Disable suspend feature in debugging (DOTS_DEBUGSUSPEND)
  40. 40. Deploy your tasklet• Create a jar file from the plugin • Right Click  Export  Deployable plug-ins and fragments...
  41. 41. Deploy your tasklet• Select the plugin and destination• Place exported JAR file into plugins folder, then restart DOTS task [Domino Program Files]osgi-dotssharedeclipseplugins
  42. 42. Deploy your Tasklet• Another deploy method, DOTS profiles – It can stored inside a Notes database – Can run in is own profile container – With his own security settings – Can started seperatly “tell profilename run abc”
  43. 43. Deploy your Tasklet• Creating Profile Repository as NSF – Create an empty nsf, set ACL – Configure DOTS to use profiles database • tell dots quit • set config OSGI_CONFIGURATION_DB=dotsprofiles.nsf • load dots • tell dots profileCreate dots – DOTS profile is created – You can import an updatesite in the profile
  44. 44. Deploy your Tasklet• Create a Feature project in Eclipse
  45. 45. Deploy your Tasklet• Create the update site project in Eclipse
  46. 46. Deploy your Tasklet• Build the update site project
  47. 47. Deploy your Tasklet• Create an Update Site Database
  48. 48. Deploy your Tasklet• Open OSGi profile db – Add update site database into Sites section• Restart DOTS task
  49. 49. Tips and tricks
  50. 50. Multiple profiles• You may create more than one profiles. – For testing – Tasklets that you use occasionally – Tasklets with different security needs – Heavily loaded Tasklets
  51. 51. Life-cycle for a scheduled Tasklet• When a tasklet runs on schedule, DOTS class loader will create an instance from your tasklet class. This instance will not be disposed until DOTS process stops.
  52. 52. Multiple purpose Tasklet• Same Tasklet, different Java instances• In multiple scheduled runs – persistent objects, stays in memory• In multiple manual runs – unloaded from memory afterwards
  53. 53. Tips and tricks• Logging – Try not to use System.out.println. (No output to log.nsf) – Instead, use logMessage(...) and Vector<?> views = db.getViews(); logException(...) monitor.beginTask( "List the views", views.size() ); Init with # of steps• Progress Monitoring for ( Object view : views ){ if ( monitor.isCanceled() ){ break;  – IProgressMonitor monitor Break if canceled. } logMessage("t" + argument passed on tasklet ((View)view).getName() ); try { Thread.sleep( 1000 methods. ); { } catch (InterruptedException e) – Very useful for tasklets running e.printStackTrace(); } monitor.worked( 1 ); long time. completed  One step }
  54. 54. Questions
  55. 55. Contact details @flinden68 http://www.domino-weblog.nl nl.linkedin.com/in/flinden68 fli@e-office.com