AD110 - Unleash the power of XPages
Philippe Riand | XPages Architect
Maire Kehoe | Lead XPages Developer
Financial Disclaimer
The information on the new product is intended to outline our general
product direction and it should not be relied on in making a purchasing
decision. The information on the new product is for informational purposes
only and may not be incorporated into any contract. The information on
the new product is not a commitment, promise, or legal obligation to
deliver any material, code or functionality. The development, release, and
timing of any features or functionality described for our products remains
at our sole discretion
Agenda
●   Introduction

●   XPages architecture

●   Advanced XPages application development

●   Extending the XPages Runtime

     ▬   Controls and other object tags
     ▬   Other Runtime Extensions
     ▬   Packaging a library for the server and client

●   Examples

●   Conclusion

                3
Objectives
●   Show how XPages can be extended to match your needs and increase
    the developer productivity
      ▬ Create new controls and other XPages artifacts
      ▬ Deploy them on your IBM Lotus® Domino® servers
        or IBM Lotus Notes® clients

●   Expose the technical architecture behind XPages
     ▬ Describe the technology being used
     ▬ Give an overview of how XPages is integrated in both the Domino
       server and the Notes client




             4
XPages architecture

XPages Technology
●   XPages is a Java™ runtime built on top of JavaServer™ Faces 1.1 (JSF)
     ▬ JSF has been extended in many ways to make it richer and easier to
       use (ajax behaviors, script languages, extended control set...)
     ▬ JSF APIs and concepts fully apply to XPages.

●   XPages runs within a servlet engine
     ▬ A custom servlet engine is used to run NSF based Web applications
       The NSF is seen as a deployed J2EE® Web Module
     ▬ The Servlet API is available to the running XPages

●   The Dojo Toolkit is used as the runtime JavaScript™ library
     ▬ Used as a core JavaScript library as well as a UI widget framework
     ▬ Tightly integrated within the XPages Runtime


             5
XPages architecture

How can the XPages Runtime be Extended?
●   By creating Custom Controls design elements
     ▬  Easy to develop, just uses XPages and script language
     ▬  Embedded inside an NSF
     ▬  Powerful, but don't have access to the full JSF API

●   By extending the runtime with your existing Java code
     ▬ Adding Java libraries to the runtime (jar files)
     ▬ By calling Java from XPages (JavaScript bridge, EL, managed
       beans...)

●   By providing native JSF/XPages libraries
     ▬ Requires knowledge of Java, JSF and XPages native API
     ▬ Gives the full access to the runtime


             6
XPages architecture

      XPages Development Model

                                                                                          Use the XPages
                                                                                            native API
                                                                      Use managed beans
                                                                        and advanced
                                                                          extensions
                                                Integration of Java
                                                 libraries/classes

                         JavaScript libraries                                              Java developers
                            and custom
                              controls
   Drag & drop
application building
  using XPages                                             Advanced users with
                                                            development skills                We'll focus on this during
                                                                                                     this session
                       Power users




                             7
XPages architecture

OSGi™ bundles
 ●      Native XPages libraries are packaged as OSGi bundles
          ▬ On Notes client 8.5.1
          ▬ On a future 8.5.x Domino server maintenance stream, on top of an
            IBM Lotus Expeditor subset
 ●      Bundles are versioned .jars that list other bundles they depend on.
 ●      Simplifies debugging absent dependencies and handling multiple
        versions of classes.
 ●      OSGi bundles also support services.
        Installed bundles contribute to a service, to provide objects
        implementing the service interface, whenever the service objects are
        requested.


           http://www.osgi.org/Main/HomePage
           https://www.ibm.com/developerworks/lotus/products/expeditor/
The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for
informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or
functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion



                                 8
XPages architecture
XPages Architecture - 8.5/8.5.1
                                                                                   NSF Applications

 NSF Applications

                                                                                                      XPages Extensions
                                                                                                        OSGi bundles

                    XPages Extensions
                    provided as jar files                        Profile                XPages
                                                                 +Web Container         Runtime
     XPages
     Runtime
                                                                          OSGi Runtime

             Domino HTTP Task                                             Notes Client Process


            Domino Server                                                  Notes Client
     ●   You can extend XPages within an NSF Application, or as separate XPages Extensions.
     ●   The Domino runtime is deployed as a set of jar files into well defined directories
         Extensions are provided as jar files copied to <domino>/xsp/nsf/lib
         (warn: this directory is cleaned-up by the installer when upgrading the server)
     ●   The Client runtime is deployed as a set of OSGi bundles (plugins)
         Extensions are also deployed as OSGi bundles

                                                                                                                      9
XPages architecture
XPages Architecture – 8.5.x
                             NSF Applications                                                                                       NSF Applications




                                                           XPages Extensions                                                                                      XPages Extensions
                                                             OSGi bundles                                                                                           OSGi bundles


  XPD Profile                        XPages                                                           XPD Profile                            XPages
                                     Runtime                                                          +Web Container                         Runtime


             OSGi Runtime                                                                                            OSGi Runtime

             Domino HTTP Task                                                                                        Notes Client Process


              Domino Server                                                                                            Notes Client
    ●      Both the Domino server and the Notes client are deployed as OSGi bundles
           The same extension mechanism is used in both platforms; extensions are provided as OSGi bundles.



    The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for
    informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or
    functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion


                                                                                                                                                                                                        10
Advanced XPages application development

Integrating Java Code Inside XPages
●   Java classes can be either
     ▬ Embedded in an application, using J2EE packaging capability
         ▬ WEB-INF/classes & WEB-INF/lib


     ▬ Shared by all the applications
         ▬ The jar files should be copied into <domino>/xsp/nsf/lib


         ▬ Deployed as plug-ins in Notes client or future Domino 8.5.x




●   Developing the java code inside IBM Lotus Domino Designer

●   Calling Java libraries from an XPage
     ▬  Call Java from JavaScript


     http://www-10.lotus.com/ldd/ddwiki.nsf/dx/09242008095047AMWEBJ9A.htm


              11
Advanced XPages application development

   Working with Managed Beans
    ●   What is a managed bean and why should I use it?
         ▬ It is a Java bean where the lifecycle of the bean is managed by the
           JSF runtime
              ▬ Declared in an XML file (faces-config.xml)

              ▬ Created the first time it is used


              ▬ Automatically stored into a scope

                 application, session, view (new in 8.5.2) or request
         ▬ It can encapsulate data access or business logic
         ▬ Lots of documentation is available on the net

    ●   Binding UI controls to a managed bean
         ▬ Using the EL language
         ▬ Using Managed Beans through JavaScript

http://www.mindoo.com/web/blog.nsf/dx/16.07.2009095816KLEBCY.htm?opendocument&comments
                  12
Extending the XPages Runtime

XPages Native API concepts
 ●      XPages Library
         ▬ OSGi bundle (plug-ins) that contains Java code, configuration files
           and resources
 ●      Controls
         ▬ Reusable components that appear in the Designer palette
 ●      Renderers
         ▬ A renderer defines how a control is rendered at runtime
         ▬ Outputs HTML and client JavaScript to the browser
 ●      Complex types
         ▬ Other XPages objects used by controls to store parameters and
           encapsulate behaviors
         ▬ Some examples
         ▬ Data sources, simple actions, validators, converters...
The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for
informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or
functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion



                                 13
Extending the XPages Runtime
Example #1
New Native Controls in the Palette
●   Tooltip: basic control that generates a Dojo tag
     ▬ Requires 2 Java classes: one for the control, and one for its
       associated renderer
     ▬ The control definition is located in a xsp-config file
     ▬ Read only control: processing the JSF rendering phase only



●   Data bound slider
     ▬ Binding a control to data
     ▬ Processing all the JSF phases




              14
Extending the XPages Runtime
Example #2
Packaging a Custom Control into a plug-in
 ●      A custom control is defined similarly to Native control
         ▬  A configuration file (.xsp-config) is defining the control properties
         ▬  A Java file is used to create the control object at runtime
         ▬  A custom control can be packaged like a native control
 ●      Example: simple Ok-Cancel toolbar
         ▬  Copy the Java file, generated by Designer, to the plug-in
         ▬  The xsp-config file should also be added to the plug-ins
         ▬  Path to resources should be adapted
         ▬  Extension point to publish images, style sheets, other resources.
 ●      Allows reuse of multiple XPage design elements from different sources,
        without using templates.


The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for
informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or
functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion



                                 15
Extending the XPages Runtime
Example #3
Simple Actions
 ●      Simple actions are objects, added to events, that can execute code on
        either the server or client side
         ▬  Each simple action can have it own set of properties
         ▬  Server Side
              ▬ Execute some Java code on the server


              ▬ Example: Modify Selected Documents Field,

                 e.g. if you want to select multiple documents and change status
                 field to "completed".
         ▬  Client Side
              ▬ Generates a piece of client side JavaScript when the page is

                 rendered
              ▬ Example: Select Documents with Column Value

                 e.g. Action to check the check box for each row where the
                 column value is “new”.
The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for
informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or
functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion


                                 16
Extending the XPages Runtime
Example #4
Json Data Source
 ●      A DataSource provides data access to the page through a set of objects
         ▬ DataSource, complex type tag used in the XPage
         ▬ DataContainer, used to persist data between requests until saved
         ▬ DataModel, used by repeating controls to find individual items

 ●      An example DataSource with underlying data like
         { {name: 'Fred', position: 'QE', phone: '5551234' },
         {name: 'Joe', position: 'Dev', phone: '5551235' } }




The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for
informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or
functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion



                                 17
Extending the XPages Runtime
Example #5
Providing a ContentType Renderer
 ●      A content type renderer is used to format a text
         ▬ Available as a property to computed fields and view columns




           ▬      It gets the text to display from the runtime and can generate any
                  markup
           ▬      Contributed using an extension point

 ●      Examples
         ▬ Lotus Sametime® awareness rendering
         ▬ Lotus Connections VCard

The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for
informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or
functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion



                                 18
Extending the XPages Runtime
Example #6
Implementing Custom Request Processing
 ●      Hooking into the page request
         ▬ XPages controls can shortcut a request with a “pathinfo” and render
           any kind of result
             ▬ http://server/db.nsf/page.xsp/pathinfo?...


         ▬ The request is executed in the context of the page
             ▬ Any page/user/application data is available




 ●      Example: REST services
         ▬ Formatting Domino data into a JSON stream
            ▬ Consumed by a Dojo dynamic grid

         ▬ RPC calls between the client and the server



The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for
informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or
functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion



                                 19
Extending the XPages Runtime
XPages Library Content
 ●      Java files
         ▬ A library definition file
         ▬ Java files implementing XPages controls, renderers, complex types

 ●      Configuration files
         ▬ faces-config.xml
           Runtime JSF configuration file, defining for example the renderers
         ▬ .xsp-config
           XPages configuration file defining the controls and complex type.
           Used by Designer editors to fill the palette and the property panels.
           Used to generate the compiled XPages.

 ●      Runtime resources
         ▬ CSS, JavaScript...

The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for
informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or
functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion



                                 20
Extending the XPages Runtime

Building and Deploying a Library
 ●      Building Java plug-ins from Domino Designer
         ▬  using the Eclipse™ PDE, included in Designer

 ●      Installing into Designer and the developer's Notes Client
          ▬ Optional design time plugin, to get a better user experience in
            Designer

 ●      Installing the library on the server
          ▬ Libraries do not replicate between servers.

 ●      Publishing the bundle on a server for other Notes Client users
         ▬ Libraries can be pulled from a server to the Notes Client

The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for
informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or
functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion



                                 21
Extending the XPages Runtime

Using a Library in an Application
 ●      Pre-installed IBM libraries
         ▬ Are automatically available

 ●      Explicit libraries
         ▬ A link should be added at the Application level
         ▬ The plug-ins can be downloaded and deployed to the client

 ●      Global libraries
         ▬ When installed, available at runtime to every application
         ▬ Explicitly linked by applications that need them to function



The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for
informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or
functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion



                                 22
Extending the XPages Runtime

Enhancing the Design Time Experience
 ●      Providing render time markup
         ▬ XPages markup can be provided to replace the default square tags

 ●      Registering property editors
         ▬ A property editor is used by the “All Properties” panel when the user
           edits a property
         ▬ Designer comes with a large set of predefined editors, but custom
           ones can be provided




The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for
informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or
functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion



                                 23
What We Skipped....
 ●      A lot... we'll provide documentation and samples over time
         ▬  Custom validators/converters
         ▬  Extending language bindings
         ▬  RequestParameters extension to configure themes & other
            properties
         ▬  Active Content Filtering engines for processing markup
         ▬  ...




The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for
informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or
functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion



                                 24
Q&A - Anticipated!
 ●      Can I deploy custom XPages libraries on N/D 8.5, 8.5.1?
         ▬  This is not supported/documented by IBM.
 ●      Can I use OSGi on Domino for purposes other than XPages?
         ▬  This is a future goal but it hasn't been qualified yet to support those
            use cases.
 ●      Will you update to JSF 2.0?
         ▬  Not in plan for now. Might be if we have strong business cases. It is
            not justified as XPages already implements most of the JSF 2.0 new
            features.
 ●      Can I contribute to the OSGi framework from a NSF?
         ▬  This is not supported in the next release of Notes/Domino, but we're
            thinking about it!


The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for
informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or
functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion



                                 25
Q&A – Your Turn!




       26
Related Sessions
Session ID        Description
AD106             XPages Just Keep Getting Better
AD107             Enhance Your Existing Applications with XPages
AD108             XPages in the IBM Lotus Notes Client - A Deep Dive!
AD109             XPages Performance and Scalability
AD111             Harnessing the Power of Server-Side JavaScript and Other
                  Advanced XPage Techniques
BP207             Make Your XPage Apps "Pop!" with CSS and Themes
SHOW112           How to Build an XPages Application from Start to Finish



             27
Legal Disclaimer
© IBM Corporation 2009. All Rights Reserved.
The information contained in this publication is provided for informational purposes only. While efforts were made to verify the completeness and accuracy of the information contained in this publication, it is provided AS IS
without warranty of any kind, express or implied. In addition, this information is based on IBM’s current product plans and strategy, which are subject to change by IBM without notice. IBM shall not be responsible for any
damages arising out of the use of, or otherwise related to, this publication or any other materials. Nothing contained in this publication is intended to, nor shall have the effect of, creating any warranties or representations
from IBM or its suppliers or licensors, or altering the terms and conditions of the applicable license agreement governing the use of IBM software.
References in this presentation to IBM products, programs, or services do not imply that they will be available in all countries in which IBM operates. Product release dates and/or capabilities referenced in this presentation
may change at any time at IBM’s sole discretion based on market opportunities or other factors, and are not intended to be a commitment to future product or feature availability in any way. Nothing contained in these
materials is intended to, nor shall have the effect of, stating or implying that any activities undertaken by you will result in any specific sales, revenue growth or other results.


IBM, the IBM logo, Lotus, Lotus Notes, Notes, Domino, Sametime and Lotusphere are trademarks of International Business Machines Corporation in the United States, other countries, or both.

Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.
JavaScript is a trademark of Sun Microsystems, Inc. in the United States, other countries, or both.

OSGi is a trademark of the OSGi Alliance in the United States, other countries, or both.

Eclipse is a trademark of Eclipse Foundation, Inc.




                                         28

Ad110 - Unleash the Power of Xpages

  • 1.
    AD110 - Unleashthe power of XPages Philippe Riand | XPages Architect Maire Kehoe | Lead XPages Developer
  • 2.
    Financial Disclaimer The informationon the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion
  • 3.
    Agenda ● Introduction ● XPages architecture ● Advanced XPages application development ● Extending the XPages Runtime ▬ Controls and other object tags ▬ Other Runtime Extensions ▬ Packaging a library for the server and client ● Examples ● Conclusion 3
  • 4.
    Objectives ● Show how XPages can be extended to match your needs and increase the developer productivity ▬ Create new controls and other XPages artifacts ▬ Deploy them on your IBM Lotus® Domino® servers or IBM Lotus Notes® clients ● Expose the technical architecture behind XPages ▬ Describe the technology being used ▬ Give an overview of how XPages is integrated in both the Domino server and the Notes client 4
  • 5.
    XPages architecture XPages Technology ● XPages is a Java™ runtime built on top of JavaServer™ Faces 1.1 (JSF) ▬ JSF has been extended in many ways to make it richer and easier to use (ajax behaviors, script languages, extended control set...) ▬ JSF APIs and concepts fully apply to XPages. ● XPages runs within a servlet engine ▬ A custom servlet engine is used to run NSF based Web applications The NSF is seen as a deployed J2EE® Web Module ▬ The Servlet API is available to the running XPages ● The Dojo Toolkit is used as the runtime JavaScript™ library ▬ Used as a core JavaScript library as well as a UI widget framework ▬ Tightly integrated within the XPages Runtime 5
  • 6.
    XPages architecture How canthe XPages Runtime be Extended? ● By creating Custom Controls design elements ▬ Easy to develop, just uses XPages and script language ▬ Embedded inside an NSF ▬ Powerful, but don't have access to the full JSF API ● By extending the runtime with your existing Java code ▬ Adding Java libraries to the runtime (jar files) ▬ By calling Java from XPages (JavaScript bridge, EL, managed beans...) ● By providing native JSF/XPages libraries ▬ Requires knowledge of Java, JSF and XPages native API ▬ Gives the full access to the runtime 6
  • 7.
    XPages architecture XPages Development Model Use the XPages native API Use managed beans and advanced extensions Integration of Java libraries/classes JavaScript libraries Java developers and custom controls Drag & drop application building using XPages Advanced users with development skills We'll focus on this during this session Power users 7
  • 8.
    XPages architecture OSGi™ bundles ● Native XPages libraries are packaged as OSGi bundles ▬ On Notes client 8.5.1 ▬ On a future 8.5.x Domino server maintenance stream, on top of an IBM Lotus Expeditor subset ● Bundles are versioned .jars that list other bundles they depend on. ● Simplifies debugging absent dependencies and handling multiple versions of classes. ● OSGi bundles also support services. Installed bundles contribute to a service, to provide objects implementing the service interface, whenever the service objects are requested. http://www.osgi.org/Main/HomePage https://www.ibm.com/developerworks/lotus/products/expeditor/ The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion 8
  • 9.
    XPages architecture XPages Architecture- 8.5/8.5.1 NSF Applications NSF Applications XPages Extensions OSGi bundles XPages Extensions provided as jar files Profile XPages +Web Container Runtime XPages Runtime OSGi Runtime Domino HTTP Task Notes Client Process Domino Server Notes Client ● You can extend XPages within an NSF Application, or as separate XPages Extensions. ● The Domino runtime is deployed as a set of jar files into well defined directories Extensions are provided as jar files copied to <domino>/xsp/nsf/lib (warn: this directory is cleaned-up by the installer when upgrading the server) ● The Client runtime is deployed as a set of OSGi bundles (plugins) Extensions are also deployed as OSGi bundles 9
  • 10.
    XPages architecture XPages Architecture– 8.5.x NSF Applications NSF Applications XPages Extensions XPages Extensions OSGi bundles OSGi bundles XPD Profile XPages XPD Profile XPages Runtime +Web Container Runtime OSGi Runtime OSGi Runtime Domino HTTP Task Notes Client Process Domino Server Notes Client ● Both the Domino server and the Notes client are deployed as OSGi bundles The same extension mechanism is used in both platforms; extensions are provided as OSGi bundles. The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion 10
  • 11.
    Advanced XPages applicationdevelopment Integrating Java Code Inside XPages ● Java classes can be either ▬ Embedded in an application, using J2EE packaging capability ▬ WEB-INF/classes & WEB-INF/lib ▬ Shared by all the applications ▬ The jar files should be copied into <domino>/xsp/nsf/lib ▬ Deployed as plug-ins in Notes client or future Domino 8.5.x ● Developing the java code inside IBM Lotus Domino Designer ● Calling Java libraries from an XPage ▬ Call Java from JavaScript http://www-10.lotus.com/ldd/ddwiki.nsf/dx/09242008095047AMWEBJ9A.htm 11
  • 12.
    Advanced XPages applicationdevelopment Working with Managed Beans ● What is a managed bean and why should I use it? ▬ It is a Java bean where the lifecycle of the bean is managed by the JSF runtime ▬ Declared in an XML file (faces-config.xml) ▬ Created the first time it is used ▬ Automatically stored into a scope application, session, view (new in 8.5.2) or request ▬ It can encapsulate data access or business logic ▬ Lots of documentation is available on the net ● Binding UI controls to a managed bean ▬ Using the EL language ▬ Using Managed Beans through JavaScript http://www.mindoo.com/web/blog.nsf/dx/16.07.2009095816KLEBCY.htm?opendocument&comments 12
  • 13.
    Extending the XPagesRuntime XPages Native API concepts ● XPages Library ▬ OSGi bundle (plug-ins) that contains Java code, configuration files and resources ● Controls ▬ Reusable components that appear in the Designer palette ● Renderers ▬ A renderer defines how a control is rendered at runtime ▬ Outputs HTML and client JavaScript to the browser ● Complex types ▬ Other XPages objects used by controls to store parameters and encapsulate behaviors ▬ Some examples ▬ Data sources, simple actions, validators, converters... The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion 13
  • 14.
    Extending the XPagesRuntime Example #1 New Native Controls in the Palette ● Tooltip: basic control that generates a Dojo tag ▬ Requires 2 Java classes: one for the control, and one for its associated renderer ▬ The control definition is located in a xsp-config file ▬ Read only control: processing the JSF rendering phase only ● Data bound slider ▬ Binding a control to data ▬ Processing all the JSF phases 14
  • 15.
    Extending the XPagesRuntime Example #2 Packaging a Custom Control into a plug-in ● A custom control is defined similarly to Native control ▬ A configuration file (.xsp-config) is defining the control properties ▬ A Java file is used to create the control object at runtime ▬ A custom control can be packaged like a native control ● Example: simple Ok-Cancel toolbar ▬ Copy the Java file, generated by Designer, to the plug-in ▬ The xsp-config file should also be added to the plug-ins ▬ Path to resources should be adapted ▬ Extension point to publish images, style sheets, other resources. ● Allows reuse of multiple XPage design elements from different sources, without using templates. The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion 15
  • 16.
    Extending the XPagesRuntime Example #3 Simple Actions ● Simple actions are objects, added to events, that can execute code on either the server or client side ▬ Each simple action can have it own set of properties ▬ Server Side ▬ Execute some Java code on the server ▬ Example: Modify Selected Documents Field, e.g. if you want to select multiple documents and change status field to "completed". ▬ Client Side ▬ Generates a piece of client side JavaScript when the page is rendered ▬ Example: Select Documents with Column Value e.g. Action to check the check box for each row where the column value is “new”. The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion 16
  • 17.
    Extending the XPagesRuntime Example #4 Json Data Source ● A DataSource provides data access to the page through a set of objects ▬ DataSource, complex type tag used in the XPage ▬ DataContainer, used to persist data between requests until saved ▬ DataModel, used by repeating controls to find individual items ● An example DataSource with underlying data like { {name: 'Fred', position: 'QE', phone: '5551234' }, {name: 'Joe', position: 'Dev', phone: '5551235' } } The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion 17
  • 18.
    Extending the XPagesRuntime Example #5 Providing a ContentType Renderer ● A content type renderer is used to format a text ▬ Available as a property to computed fields and view columns ▬ It gets the text to display from the runtime and can generate any markup ▬ Contributed using an extension point ● Examples ▬ Lotus Sametime® awareness rendering ▬ Lotus Connections VCard The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion 18
  • 19.
    Extending the XPagesRuntime Example #6 Implementing Custom Request Processing ● Hooking into the page request ▬ XPages controls can shortcut a request with a “pathinfo” and render any kind of result ▬ http://server/db.nsf/page.xsp/pathinfo?... ▬ The request is executed in the context of the page ▬ Any page/user/application data is available ● Example: REST services ▬ Formatting Domino data into a JSON stream ▬ Consumed by a Dojo dynamic grid ▬ RPC calls between the client and the server The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion 19
  • 20.
    Extending the XPagesRuntime XPages Library Content ● Java files ▬ A library definition file ▬ Java files implementing XPages controls, renderers, complex types ● Configuration files ▬ faces-config.xml Runtime JSF configuration file, defining for example the renderers ▬ .xsp-config XPages configuration file defining the controls and complex type. Used by Designer editors to fill the palette and the property panels. Used to generate the compiled XPages. ● Runtime resources ▬ CSS, JavaScript... The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion 20
  • 21.
    Extending the XPagesRuntime Building and Deploying a Library ● Building Java plug-ins from Domino Designer ▬ using the Eclipse™ PDE, included in Designer ● Installing into Designer and the developer's Notes Client ▬ Optional design time plugin, to get a better user experience in Designer ● Installing the library on the server ▬ Libraries do not replicate between servers. ● Publishing the bundle on a server for other Notes Client users ▬ Libraries can be pulled from a server to the Notes Client The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion 21
  • 22.
    Extending the XPagesRuntime Using a Library in an Application ● Pre-installed IBM libraries ▬ Are automatically available ● Explicit libraries ▬ A link should be added at the Application level ▬ The plug-ins can be downloaded and deployed to the client ● Global libraries ▬ When installed, available at runtime to every application ▬ Explicitly linked by applications that need them to function The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion 22
  • 23.
    Extending the XPagesRuntime Enhancing the Design Time Experience ● Providing render time markup ▬ XPages markup can be provided to replace the default square tags ● Registering property editors ▬ A property editor is used by the “All Properties” panel when the user edits a property ▬ Designer comes with a large set of predefined editors, but custom ones can be provided The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion 23
  • 24.
    What We Skipped.... ● A lot... we'll provide documentation and samples over time ▬ Custom validators/converters ▬ Extending language bindings ▬ RequestParameters extension to configure themes & other properties ▬ Active Content Filtering engines for processing markup ▬ ... The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion 24
  • 25.
    Q&A - Anticipated! ● Can I deploy custom XPages libraries on N/D 8.5, 8.5.1? ▬ This is not supported/documented by IBM. ● Can I use OSGi on Domino for purposes other than XPages? ▬ This is a future goal but it hasn't been qualified yet to support those use cases. ● Will you update to JSF 2.0? ▬ Not in plan for now. Might be if we have strong business cases. It is not justified as XPages already implements most of the JSF 2.0 new features. ● Can I contribute to the OSGi framework from a NSF? ▬ This is not supported in the next release of Notes/Domino, but we're thinking about it! The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for informational purposes only and may not be incorporated into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or functionality. The development, release, and timing of any features or functionality described for our products remains at our sole discretion 25
  • 26.
    Q&A – YourTurn! 26
  • 27.
    Related Sessions Session ID Description AD106 XPages Just Keep Getting Better AD107 Enhance Your Existing Applications with XPages AD108 XPages in the IBM Lotus Notes Client - A Deep Dive! AD109 XPages Performance and Scalability AD111 Harnessing the Power of Server-Side JavaScript and Other Advanced XPage Techniques BP207 Make Your XPage Apps "Pop!" with CSS and Themes SHOW112 How to Build an XPages Application from Start to Finish 27
  • 28.
    Legal Disclaimer © IBMCorporation 2009. All Rights Reserved. The information contained in this publication is provided for informational purposes only. While efforts were made to verify the completeness and accuracy of the information contained in this publication, it is provided AS IS without warranty of any kind, express or implied. In addition, this information is based on IBM’s current product plans and strategy, which are subject to change by IBM without notice. IBM shall not be responsible for any damages arising out of the use of, or otherwise related to, this publication or any other materials. Nothing contained in this publication is intended to, nor shall have the effect of, creating any warranties or representations from IBM or its suppliers or licensors, or altering the terms and conditions of the applicable license agreement governing the use of IBM software. References in this presentation to IBM products, programs, or services do not imply that they will be available in all countries in which IBM operates. Product release dates and/or capabilities referenced in this presentation may change at any time at IBM’s sole discretion based on market opportunities or other factors, and are not intended to be a commitment to future product or feature availability in any way. Nothing contained in these materials is intended to, nor shall have the effect of, stating or implying that any activities undertaken by you will result in any specific sales, revenue growth or other results. IBM, the IBM logo, Lotus, Lotus Notes, Notes, Domino, Sametime and Lotusphere are trademarks of International Business Machines Corporation in the United States, other countries, or both. Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. JavaScript is a trademark of Sun Microsystems, Inc. in the United States, other countries, or both. OSGi is a trademark of the OSGi Alliance in the United States, other countries, or both. Eclipse is a trademark of Eclipse Foundation, Inc. 28