uklug 2012 - xpages extensibility api - going deep!

80
XPages Extensibility API – going deep UKLUG, September 2012, Cardiff René Winkelmeyer midpoints GmbH

Upload: rene-winkelmeyer

Post on 22-Nov-2014

1.747 views

Category:

Technology


1 download

DESCRIPTION

These slides have been shown at UKLUG 2012 in Cardiff and are an introduction to programming with the XPages Extensiblity API.

TRANSCRIPT

Page 1: UKLUG 2012 - XPages Extensibility API - going deep!

XPages Extensibility API – going deep

UKLUG, September 2012, Cardiff

René Winkelmeyer midpoints GmbH

Page 2: UKLUG 2012 - XPages Extensibility API - going deep!

2

René Winkelmeyer Senior Consultant

midpoints GmbH http://www.midpoints.de IBM Advanced Business Partner IBM Design Partner for Domino Next IBM Mobile Design Partner Apple Enterprise Developer & MDM Program Samsung MDM Partner Services

•  Notes / Domino Consulting •  E-Mail Management •  App Development (IBM Connections, RCP,

XPages, mobile, iOS, Android)

We mobilize Notes •  Lotus Traveler planning & deployment •  mobile app development •  Apple iOS Device Management with

midpoints iOS.profiler •  Secure Domino-based mobile content with

midpoints doc.Store

OpenNTF Contributor and OpenNTF Director

About me

Page 3: UKLUG 2012 - XPages Extensibility API - going deep!

3

René Winkelmeyer Senior Consultant

•  Skype

muenzpraeger •  Twitter

muenzpraeger •  LinkedIn

muenzpraeger •  Facebook

muenzpraeger •  Slideshare

muenzpraeger •  G+

www.winkelmeyer.com/+

•  Web http://blog.winkelmeyer.com http://www.midpoints.de

•  Mail [email protected] [email protected]

Page 4: UKLUG 2012 - XPages Extensibility API - going deep!

4

I don‘t do XPages! I go deeper.

Page 5: UKLUG 2012 - XPages Extensibility API - going deep!

5

Agenda

What will we talk about? -  Differences XPages, Extension Library and Extensibility API

-  Starting with Plug-In-Development -  Code examples

-  Deployment

Page 6: UKLUG 2012 - XPages Extensibility API - going deep!

6

Agenda

What will we talk about? -  Differences XPages, Extension Library and Extensibility API

-  Starting with Plug-In-Development -  Code examples

-  Deployment

Page 7: UKLUG 2012 - XPages Extensibility API - going deep!

7

XPages

§  XPages is a great technology and expands our possibilities – from the point of administrators, developers and users.

§  Starting with XPages could be really simple. For the very first steps is just drag‘n‘drop, computing stuff and so on.

§  To be honest: Domino web development never was so easy (after you‘ve learned the basics) - even if it takes „slightly“ more time.

Page 8: UKLUG 2012 - XPages Extensibility API - going deep!

8

XPages

§  The most powerful component is the editable area.

Page 9: UKLUG 2012 - XPages Extensibility API - going deep!

9

XPages / XPages Extension Library

§  There are some things which aren‘t so easy... §  You are missing controls in the pallette §  OneUI ist too complex §  You want some custom rendering §  ...

§  Here the XPages Extension Library comes to your help.

Page 10: UKLUG 2012 - XPages Extensibility API - going deep!

10

XPages Extension Library

Page 11: UKLUG 2012 - XPages Extensibility API - going deep!

11

XPages Extension Library

§  IBM has introduced the XPages Extensibility API with Notes/Domino 8.5.2.

§  This API is a set of Java classes and methods which allow to integrate specialised functionality directly into XPages. §  This means XPages in the browser and XPages in the Notes client.

§  IBM has used this API to provide the well-known XPages Extension Library – (first) on OpenNTF and than as part of the core product!

Page 12: UKLUG 2012 - XPages Extensibility API - going deep!

12

XPages Extension Library

Page 13: UKLUG 2012 - XPages Extensibility API - going deep!

13

XPages Extension Library

§  You‘ll finde it on OpenNTF http://extlib.openntf.org

Page 14: UKLUG 2012 - XPages Extensibility API - going deep!

14

XPages Extension Library

§  It‘s part of Notes/Domino 8.5.3 as „Upgrade Pack 1“ – full product support through IBM! §  Part number: CI5GIEN

§  Watch out: If you want to use the Upgrade Pack 1 you‘ll have to uninstall previous versions of the OpenNTF Extension Library. §  IBM installs the UP1 in the program directory. The OpenNTF

components are installed in the data directory. §  Currently only available as Installer – not as Updatesite.

Page 15: UKLUG 2012 - XPages Extensibility API - going deep!

15

XPages Extensibility API

Page 16: UKLUG 2012 - XPages Extensibility API - going deep!

16

XPages Extensibility API

§  It only makes sense to develop your own extensions if you need the same functionality across multiple applications.

§  An extension (aka OSGi Plug-In) needs only to deployed once per server or client – not per application.

http://www.osgi.org <= start here

Page 17: UKLUG 2012 - XPages Extensibility API - going deep!

17

XPages Extensibility API

§  So called „artefacts“ can be added to the existing API during runtime.

§  JSF is an „open standard“ which APIs are publically available.

§  The XPages APIs are public since Domino 8.5.2.

§  Artefacts can be: §  UI Controls §  Converters §  Validators §  Data Sources §  Simple Actions §  Language Bindings §  ...

Page 18: UKLUG 2012 - XPages Extensibility API - going deep!

18

XPages Architektur

Page 19: UKLUG 2012 - XPages Extensibility API - going deep!

19

XPages API Concepts

§  XPages Library §  OSGi bundle, contains Java code, configuration files

§  Controls §  Components which are available in the Designer pallette

§  Renderer §  Renderer are responsible for displaying the output (HTML, CSS, ...)

§  Complex Types §  Those are i. e. used to create encapsulated functions or store data.

Page 20: UKLUG 2012 - XPages Extensibility API - going deep!

20

Agenda

What will we talk about? -  Differences XPages, Extension Library and Extensibility API

-  Starting with Plug-In-Development -  Code examples

-  Deployment

Page 21: UKLUG 2012 - XPages Extensibility API - going deep!

21

Powered By Eclipse

Page 22: UKLUG 2012 - XPages Extensibility API - going deep!

22

Eclipse Plug-In-Architektur

Page 23: UKLUG 2012 - XPages Extensibility API - going deep!

23

IBM Clients/Server based on Eclipse

Page 24: UKLUG 2012 - XPages Extensibility API - going deep!

24

Development setup

§  We are using Eclipse 4.2 (32bit) – definetly not recommended by IBM.

Page 25: UKLUG 2012 - XPages Extensibility API - going deep!

25

Development setup

§  For keeping it simple: use the OpenNTF project „XPages SDK for Eclipse RCP. §  Nathan T. Freeman:

http://www.openntf.org/internal/home.nsf/project.xsp?action=openDocument&name=XPages%20SDK%20for%20Eclipse%20RCP

Page 26: UKLUG 2012 - XPages Extensibility API - going deep!

26

Development setup

§  First create a new workspace

Page 27: UKLUG 2012 - XPages Extensibility API - going deep!

27

Development setup

§  Install new software in Eclipse

Page 28: UKLUG 2012 - XPages Extensibility API - going deep!

28

Development setup

§  Select the XPages SDK

Page 29: UKLUG 2012 - XPages Extensibility API - going deep!

29

Development setup

§  XPages SDK installation (I)

De-select this check boxDe-select this check box

Page 30: UKLUG 2012 - XPages Extensibility API - going deep!

30

Development setup

§  XPages SDK installation (II)

Page 31: UKLUG 2012 - XPages Extensibility API - going deep!

31

Development setup

§  XPages SDK installation (III)

Page 32: UKLUG 2012 - XPages Extensibility API - going deep!

32

Development setup

§  XPages SDK installation (IV) §  Unsigned means, that the plug-ins aren‘t digitially signed. That‘s ok.

Page 33: UKLUG 2012 - XPages Extensibility API - going deep!

33

Development setup

§  XPages SDK installation (V)

Page 34: UKLUG 2012 - XPages Extensibility API - going deep!

34

Development setup

§  Configuration of the XPages SDK (I)

Page 35: UKLUG 2012 - XPages Extensibility API - going deep!

35

Development setup

§  Configuration of the XPages SDK (II)

Page 36: UKLUG 2012 - XPages Extensibility API - going deep!

36

Development setup

§  Configuration of the XPages SDK (III)

Page 37: UKLUG 2012 - XPages Extensibility API - going deep!

37

Development setup

§  Configuration of the XPages SDK (IV)

Page 38: UKLUG 2012 - XPages Extensibility API - going deep!

38

Development setup

§  Configuration of the XPages SDK (V)

Page 39: UKLUG 2012 - XPages Extensibility API - going deep!

39

Development setup

§  Configuration of the XPages SDK (VI)

Page 40: UKLUG 2012 - XPages Extensibility API - going deep!

40

Development setup

§  Configuration of the XPages SDK (VII)

Page 41: UKLUG 2012 - XPages Extensibility API - going deep!

41

Development setup

§  You shouldn‘t develop without debugging. So we‘re installing a debugger.

§  We are using the OpenNTF Domino Debug Plug-In. §  http://www.openntf.org/internal/home.nsf/release.xsp?

documentId=CBF874E9C4607B4C8625799D00287B8C&action=openDocument

Page 42: UKLUG 2012 - XPages Extensibility API - going deep!

42

Development setup

§  Installation of the Debug-Plug-In (I)

Page 43: UKLUG 2012 - XPages Extensibility API - going deep!

43

Development setup

§  Installation of the Debug-Plug-In (II)

Page 44: UKLUG 2012 - XPages Extensibility API - going deep!

44

Development setup

§  Installation of the Debug-Plug-In (III)

Page 45: UKLUG 2012 - XPages Extensibility API - going deep!

45

Development setup

§  Installation of the Debug-Plug-In (IV)

Page 46: UKLUG 2012 - XPages Extensibility API - going deep!

46

Development setup

§  Installation of the Debug-Plug-In (V)

Page 47: UKLUG 2012 - XPages Extensibility API - going deep!

47

Development setup

§  Installation of the Debug-Plug-In (VI)

Page 48: UKLUG 2012 - XPages Extensibility API - going deep!

48

Development setup

§  Installation of the Debug-Plug-In §  Currently only local Domino server installations are supported.

Page 49: UKLUG 2012 - XPages Extensibility API - going deep!

49

Development setup

§  Creating the debug environment (I)

Page 50: UKLUG 2012 - XPages Extensibility API - going deep!

50

Development setup

§  Creating the debug environment (II)

Page 51: UKLUG 2012 - XPages Extensibility API - going deep!

51

Development setup

§  Creating the debug environment (II)

Page 52: UKLUG 2012 - XPages Extensibility API - going deep!

52

Development setup

§  Creating the debug environment (III)

Page 53: UKLUG 2012 - XPages Extensibility API - going deep!

53

Development setup

§  Add the following notes.ini parameters to the locally installed Domino server (they are needed for the remote debugging) §  JAVADEBUGOPTIONS=transport=dt_socket,server=y,suspend=n,addr

ess=8000 §  JAVAENABLEDEBUG=1

Page 54: UKLUG 2012 - XPages Extensibility API - going deep!

54

Agenda

What will we talk about? -  Differences XPages, Extension Library and Extensibility API

-  Starting with Plug-In-Development -  Code examples

-  Deployment

Page 55: UKLUG 2012 - XPages Extensibility API - going deep!

55

Code examples

§  A simple UIComponent created with the XPages Extensibility API

Rendered with plug-inRendered with plug-in

Set the request scopeSet the request scope

Page 56: UKLUG 2012 - XPages Extensibility API - going deep!

56

General library structure

§  Java files §  Controls

§  javax.faces.component.UIComponent §  Base for all UI components

§  Renderers §  javax.faces.render.Renderer §  Writes the output to the browser

§  Configuration files §  faces-config.xml

§  Runtime JSF configuration, defines i. e. the renderer §  .xsp-config

§  Defines the controls, is used to display within Designer and for compiling the XPages

§  plugin.xml §  Adding the extensions

Page 57: UKLUG 2012 - XPages Extensibility API - going deep!

57

Project structure

Page 58: UKLUG 2012 - XPages Extensibility API - going deep!

58

for identificationfor identification

MessagesDialog (UIComponent for Designer)

Page 59: UKLUG 2012 - XPages Extensibility API - going deep!

59

MessagesDialog (UIComponent for Designer)

Page 60: UKLUG 2012 - XPages Extensibility API - going deep!

60

MessagesRenderer (XPages output)

Page 61: UKLUG 2012 - XPages Extensibility API - going deep!

61

MessagesRenderer (XPages output)

helper methodhelper method

Page 62: UKLUG 2012 - XPages Extensibility API - going deep!

62

MessagesRenderer (XPages output)

Page 63: UKLUG 2012 - XPages Extensibility API - going deep!

63

MessagesRenderer (XPages output)

Page 64: UKLUG 2012 - XPages Extensibility API - going deep!

64

Library

Case-sensitiveCase-sensitive

Designer(UIComponent)Designer(UIComponent)

XPages(Renderer)XPages(Renderer)

Page 65: UKLUG 2012 - XPages Extensibility API - going deep!

65

manifest.mf

optional for JS addinoptional for JS addin

Page 66: UKLUG 2012 - XPages Extensibility API - going deep!

66

plugin.xml

plug-ins library classplug-ins library class

Page 67: UKLUG 2012 - XPages Extensibility API - going deep!

67

Configuration files

§  Simple till here...or?

§  Now we have to create the configuration files. Remember the standards!

Page 68: UKLUG 2012 - XPages Extensibility API - going deep!

68

messages-faces-config.xml (XPage-Rendering)

Page 69: UKLUG 2012 - XPages Extensibility API - going deep!

69

messages.xsp-config

Page 70: UKLUG 2012 - XPages Extensibility API - going deep!

70

messages.xsp-config

Page 71: UKLUG 2012 - XPages Extensibility API - going deep!

71

messages.xsp-config

Page 72: UKLUG 2012 - XPages Extensibility API - going deep!

72

messages.xsp-config

Page 73: UKLUG 2012 - XPages Extensibility API - going deep!

73

plugin.xml für your own @Commands

Page 74: UKLUG 2012 - XPages Extensibility API - going deep!

74

Global Java definiton for your own @Commands

Page 75: UKLUG 2012 - XPages Extensibility API - going deep!

75

Detail class for your own @Commands

Page 76: UKLUG 2012 - XPages Extensibility API - going deep!

76

D - E - B - U - G - G - I - N - G

§  Setup a remote application for debugging.

Page 77: UKLUG 2012 - XPages Extensibility API - going deep!

77

D - E - B - U - G - G - I - N - G

Page 78: UKLUG 2012 - XPages Extensibility API - going deep!

78

Agenda

What will we talk about? -  Differences XPages, Extension Library and Extensibility API

-  Starting with Plug-In-Development -  Code examples

-  Deployment

Page 79: UKLUG 2012 - XPages Extensibility API - going deep!

79

Deployment Domino-Server

§  Create a new database/application based on the Updatesite template. I highly recommend to use a dedicated database for server-only plug-ins in a production environment.

§  Import the plug-ins into the database.

§  Replicate the database with all according servers. §  Plug-Ins couldn‘t be replicated as they „normally“ reside on the file

system.

§  Set the notes.ini parameter OSGI_HTTP_DYNAMIC_BUNDLES=<database.nsf> on the Domino servers.

§  Finished. Restart the http and that‘s all.

Page 80: UKLUG 2012 - XPages Extensibility API - going deep!

80

Thank you very much! And thank you for excellent evals! :-D