SlideShare ist ein Scribd-Unternehmen logo
1 von 152
SHOW303: Proper
Connections Development
for Proper Domino
Developers
Matt White, London Developer Co-op
Mark Myers, London Developer Co-op

© 2014 IBM Corporation
About Us
 Matt White
– A Member of the London Developer Co-op
(londc.com) A group of UK based developers
– Domino web developer since 1996
– XPages developer since 2008
– Also…
• Owner at http://xpages101.net
• Lead Developer for Elguji Software
- IdeaJam
- IQJam

2
About Us
 Mark Myers
– A Member of the London Developer Co-op
(londc.com) A group of UK based developers
– Developer from a support background
– 12+ years on Domino, 15+ years in IT
– Speaker at 4x Lotuspheres, 4x UKLUGs, 1x
ILUG, 1x BLUG

3
Software we’re using
 IBM Domino® 9.0.1
 IBM Domino® Designer 9.0.1
 IBM Websphere® Application Server 8.0
 IBM DB2® 10.1
 MyEclipse® 2014 Blue Edition

4
Aim of this session
 Surface an XPages application inside Connections
 We’re assuming that you are Domino developers and that you know nothing about
developing applications for Connections
 We’re going to show you three different ways to do this
 This is from real world experience

5
What is Connections?
 Not a single application server
 Think a series of WAS applications, a database server and various add-ons.
 It is not as simple as Domino development
 But, it is not difficult to do. You just need to know the moving parts.
 That’s what we’re going to show you today.

6
Our Development Environment
 IBM Domino 9.0.1 running:
– HTTP – obviously as we are running XPages apps
– LDAP – our Domino server handles all authentication for IBM Connections
– Mail etc – all the usual add on tasks in Domino
 IBM Domino Designer 9.0.1
 Websphere Application Server
– Free download for developers of WAS 8.0 from: http://ibm.co/1dNp4Uw
• We use 8.0 vs 8.5 as Connections 4.0 & 4.5 only runs on 8.0
– You’ll also need to get the IBM Installation Manager v1.6.2
 MyEclipse Blue Edition
– http://www.myeclipseide.com/blue/
 Connections 4.5
7
Our Connections Development Environment
- Connections
 Connections development is far simpler than connections installation and administration
 Minimum of a Windows server with 8Gig of Ram and 30+ gig for a Empty installation
 Installations files 14+ gig
 https://bitly.com/18Ub03F (1115 slides not including the Domino installation for LDAP)
 You CAN get it all working on one box, but it will be slow (fine for development but not really
suitable for users)
 You can not use a WAS server set up for development as your connections box, all the
security needs to be turned on.
 You will need a full day to do this!!
 Connections settles in to about 10Gig of memory if left alone, so even on an 8Gig box you
will need to reboot every so often.
8
Our Connections Development Environment
 Installing Connections 4.5 Crib sheet
– Install Domino and Enable LDAP (or use an existing one)
– Install db2 10.1 + Fixes
– Install WAS 8.0.0.5 + Fixes
– Create Connections DBs (with wizard)
– Install TDI
– Avoid Cognos ( you will rarely need it for development and it is optional )
– Link Domino LDAP with Connections ProfileDB with TDI (using wizard)
– Install Connections*
– Make a mental note to ask your admin to do it next time

9

*Discover at this point that you have
misconfigured some minor detail wrong (such
as the deployment profile) and spend hours
figuring out why and where
The Domino Application
 Simple Approvals application
 Three forms
 Workflow around document status changes send update emails

10
Demo

11
What we’re going to show
 Three different ways of surfacing the application in Connections:
 1) Simple iWidget
 2) Static HTML / JavaScript which integrates with an API
 3) WAS Application which integrates with an API
 Then as a bonus we’ll add some extra functionality
– Using the Social Business Toolkit we’ll post from the Domino application into other
Connections tools

12
Creating the iWidget
 Very little to do, we already have a responsive web design
 Bootstrap 3.0 will handle the scaling of the web page
 We just need to configure the iWidget and deploy it

13
Creating the iWidget
 We need to present it to Connections as a Open Social widget
 The easiest way of doing this is with a simple domino page which we will call “approvals.xml”

14
Installing into Connections
 You will need Connections admin rights.
 When you log on to connections, click on the
“Administration” Link, on the left side bar under
“my Page”

15
Installing it into Connections
 You can Add/Enable/Disable Widgets
from here
 Click “Add another widget”

16
Installing it into Connections
 First choose “Open Social Gadget”
 Then “Trusted”
– Select “SSO” if you are logging
on with your domino credentials
and your admin has set SSO
up, this will enable your domino
security to work seamlessly in a
the widget

17
Installing it into Connections

 Fill in other details (only Title and
Address are Mandatory)
 Then Save and Enable the widget

18
Installing it into Connections
 Finally

19
Create an API

20
Creating API – Server Settings
 We need to enable the PUT and DELETE methods in
our website document on the Domino server
 Discuss this with your friendly admin
– If not allowed, then process PUT and DELETE
using POST and an additional HTTP Header to
describe the actual method being used
• Ideally avoid this approach as it is non standard
for the rest of the world
We need to create an API
 The second and third demos require an API so let’s quickly create one
 The API will be a REST JSON service which allows us to read and write data programatically
 It’s a simple process, but there a couple of gotchas

22
Creating API – Server Settings
 We want to allow cross domain Ajax requests as
well
 From the website document, create a new website
rule
 Set the following fields:
– Type of Rule: HTTP Response Headers
– Incoming URL pattern: */api.xsp*
– Expires Header: Add Header if application did
not
– Custom Headers
• Access-Control-Allow-Origin: *
• Access-Control-Allow-Headers: Origin, XRequested-With, Content-Type, Accept
 Restrict which domains can do this with the
Access-Control-Allow-Origin setting
 Restart HTTP on your server
Creating API – Java Class
 Now we can create the code in Domino Designer
 First we’ll create a new Java Class called ApprovalsService
Creating API – Java Class
 Now add java code, first the imports:
Creating API – Java Class
 Add the renderService method
Creating API – Java Class
 We’re going to support four methods using three functions:
– GET – renderServiceJSONGet
– POST – renderServiceJSONUpdate
– PUT – renderServiceJSONUpdate
– DELETE – renderServiceJSONDelete
 URL Format is:
– …/mydb.nsf/api.xsp/[UNID]
Creating API – GET Method
 The GET method returns JSON of views or a single document
Creating API – GET Method
Creating API – GET Method
Creating API – GET Method
Creating API – POST / PUT Method
 JSON is sent to our service and based upon the method used to send it, we decide whether
to update an existing document or create a new document
– POST will try to update an existing document
– PUT will insert a new document
 We use HTTP response codes to indicate success or any errors
– So 200 == Success
– 404 == document not found
– Etc.
– http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
 We’ll see how to call the service later on
Creating API – POST / PUT Method
Creating API – POST / PUT Method
Creating API – DELETE Method
 A simple DELETE request is sent to our service and we can decide what to do with the
document.
– We don’t have to delete the document, we can simply move it out of live views
 Again we use response codes to indicate success or failure
Creating API – DELETE Method
Creating API – API XPage
 Now we create a new XPage called “api”
Creating API – API XPage
 Make sure the XPage rendered property is set to false
 Then in the afterRenderResponse event call the renderService method in our Java class
Testing the API
 We use a Chrome plugin called “Dev HTTP Client”
– Free
– Download from Chrome Web Store
 We need to control the URL, the METHOD, the HTTP HEADERS
 We’re going to test
– Getting allrequests
– Getting myrequests
– Reading a document
– Updating a document
– Creating a document
– Deleting a document

39
Testing the API - allrequests

40
Testing the API - myrequests

41
Testing the API – Read Document

42
Testing the API – Update Document

43
Testing the API – Creating a new document

44
Testing the API – Deleting a document

45
Testing the API - Errors
 In this case we are trying to read a document which doesn’t exist so we get an Error 404

46
Create Static HTML App

47
Static HTML App
 Now that we have an API, any number of external applications can access our original
XPages application
 This is not limited to Connections of course
– Think Mobile!
 We’re going to create a static HTML and JavaScript application which makes use of the API
and AJAX to perform some basic functions
 The benefit of this is that we can build in error handling
– If the Domino server is down then we can display a useful error page for example
 We might want to pull data from several different places
 The iWidget may be too basic

48
Development Process
 This is very simple
– We’re going to use a text editor!
 We’ll also use some frameworks to make things nice and simple
– jQuery 2.0.3
• Will handle our Ajax requests etc
– Bootstrap 3
• Will be used for our UI
– Font Awesome
• Useful for general icons, in this case a spinner
 Merge all the files into a folder in the following structure
– Root
• CSS
• Font
• JS
49
Static HTML Application
 We’ll create a single HTML page called index.html

50
Static HTML Application
 Then we’ll create a single JavaScript document, site.js
 The URL will obviously need to be changed to match your environment

51
Static HTML Application

52
Static HTML Application
 Once you have a working static HTML application, we’re going to want to deploy it to
Websphere Application Server (WAS)
 We recommend using MyEclipse Blue for this rather than Rational Application Developer
– It’s cheaper
– It’s smaller and faster
– It’s much simpler
 We need to create two different projects, one which will contain the code (war file) and one
which will handle hold and deploy the war file to WAS (ear file)

53
What are WAR and EAR files
 A .War file (Web application ARchive) is a file used to distribute a collection of JavaServer
Pages, Java Servlets, Java classes, XML files, tag libraries, static Web pages (HTML and
related files) and other resources that together constitute a Web application.
 An .Ear (Enterprise ARchive) is Basically a normal War file wrapped in a configuration
wrapper.
 The Configuration wrapper of the Ear file contains features that while are very useful and
powerful for Websphere applications (adding JDBC connections on install etc etc) are
dangerous on connections server remember you are on a shared server and you can not
make any assumptions as to what is happening
– After working with multiple Connections administrators, the general opinion is to
document the features you require and ask your administrators to manually add them
rather than use the Ear file

54
Create EAR Project
 In MyEclipse, select File -> New -> Enterprise Application Project

 Populate the dialog:
– Enter Project Name
– Make sure Target Runtime is set to
Websphere 8.0
 Click Next

55
Create EAR Project
 In the next page of the wizard make sure to check “Generate application.xml deployment
descriptor”
 Then click Finish
 We end up with an empty project which we can
ignore for the moment

56
Create Web Project
 Still in MyEclipse, create a new Web Project:
 In the dialog enter the Project Name
 Make sure that you choose to “Add project
to an EAR” and select the EAR project
we just created
 Click Next

57
Create Web Project
 Take the defaults on the next page of the dialog
 Then click Next
 In the final dialog window make sure that the
“Generate web.xml deployment descriptor” is
checked
 Click Finish

58
You have seen most of this before
irectory
ource D
S

Root of Web
site

59
Import HTML into Web Project
 In the WebRoot folder of the Web Project we just created, now import the HTML, JavaScript
and CSS files we created into the project:
 Right click on the WebRoot folder and choose “Import”

60
Create approvals.xml file
 In the same way that we created an XML for the deployment of the Domino widget, we need
to create a similar XML file for this project
 Create a new XML file in the WebRoot folder called approvals.xml

61
Create approvals.xml file
 Insert the following XML and save the file
 Obviously adjust the href property to match your environment

62
Export EAR
 Now that we have our (very simple) web project we want to get it deployed to our test WAS
installation to make sure it works
 So we need to export an EAR file
 Right click on the EAR project and choose Export
 Choose “EAR File” from the list
 Click Next

63
Export EAR
 In the dialog choose the destination for the EAR file
 Make sure to choose “Optimize for a specific server runtime” and choose Websphere 8.0”
from the list
 Click Finish

64
Test Install WAS Application
 We want to make sure that the WAS
application works OK
 So open your browser
 Now we want to open the WAS Admin
Console
 Choose “New Application” from the
Applications menu

65
Install WAS Application
 We now go through a 5 stage wizard to install the application
 First we upload the EAR file we just created
 Then click Next

66
Install WAS Application
 Because this is the simplest possible deployment we can just take the defaults for the next
wizard pages
 Choose Fast Path
 Click Next

67
Install WAS Application
 Take the default options and click Next

68
Install WAS Application
 Take the default options and click next

 And again for Step 3

69
Install WAS Application
 Take the defaults for steps 4 and 5 as well
 Finally click Finish

70
Install WAS Application
 The next screen contains the install details with the final option to save the changes to the
server
 Click “Save”
 Now go to the Enterprise Applications list and
choose to start the application we just installed:

71
Test the WAS Application
 Finally we can actually test the WAS application
 The URL for the application will be the same server name as your WAS Admin console but
port 9080 (if you’ve setup with the defaults)
 The application is called Connect14 and we want to open index.html
 So in my case http://mattwhite2c8a:9080/Connect14/index.html

72
Deploy the WAS Application to Connections
 Now we can deploy the app to
Connections
 This is basically the same as the
deployment to Websphere that you
have just done for testing but with a few
subtle but important differences
 A Connections instance already has
multiple applications and is nearly
always spread over multiple
servers/clusters to spread the load, you
must be careful your application does
not disturb this balance.

73
Deploy the WAS Application to Connections
 To find out which applications are running on
which servers
– Select “Websphere application servers”
from the “Servers” left hand menu
– Select the server you want to check from
the list presented

74
Deploy the WAS Application to Connections
 Select “Installed applications”

75
Deploy the WAS Application to Connections
 You can now see all the applications running on the server and their startup order

76
Deploy the WAS Application to Connections
 Once you have picked a suitable server (I prefer “InfraCluster” on my development
boxes as lots of small applications which are similar to most of the ones I develop)
– Install the application as you have done previously (using “Fast Path”)
– Select the server you want to deploy to, click the checkbox for your application
and click “Apply”

77
Deploy the WAS Application to Connections
 You will see that the server name has now been updated
 Continue on with the rest of the “fast track” as you have done previously

78
Deploy the WAS Application to Connections
 A gotcha when deploying to
multi-server environments is
to remember which ports the
chosen server uses.
 Return to the Application
server config for your chosen
server, and click on “Ports”

79
Deploy the WAS Application to Connections
 If you are using the SSL port,
remember you will most likely be
using a self certificate on your
development box (these are
generated for you during the
profile creation section of the
connections installation)
The normal HTTP port (80)
The normal HTTPS port (443)

80
Deploy the WAS Application to Connections
 The environment just shown is a default “medium” environment that is configured when
Connections is installed
– This is commonly considered the best environment for development as it simulates
a production environment but still works on a smaller local machine.
– You may be tempted to select the “small” installation option but it makes for a very
slow restart time for any application/server.
 The missing element in what we are showing you verses a production Websphere
/Connections installation is the IBM High Availability HTTP server on the front end, this
is why we are putting port on the front of everything.
– It is invaluable for productions installations but unnecessary for development as it
adds an extra layer to deployments (you have to sync web modules between it and
Websphere when you deploy a new application) as well as taking up extra
resources.

81
Deploy the WAS Application to Connections
 On a production server the application location decision will be taken by your
administrator, but you can provide help and advice
– It is more important to provide suspected load per user than you are used to for
Domino, include as much info as you can include processor and disk
requirements
 On your development environment, you can cripple performance if you overload the
wrong server node which can lead to:
– Wasted time as you try to determine performance bottle necks
– Incorrect load requirements.
– Looking in the wrong logs for debugging (believe me it happens)
 If you are running a large application you may not want to share a cluster/server at all
and may need a dedicated server/cluster.
 If this happens on live you app may be incorrectly blamed for a system wide
slowdown
82
Deploy the WAS Application to Connections
 Here it is side by side with the Domino one

83
Native WAS Application
which integrates with an
API

84
Native WAS Application which integrates with an API
 When you want to go beyond basic Connections integration or when you want to write a full
application on the connections platform you WILL end up writing a Websphere Application
Server Native App
– Native access to relation databases
– Strongly embedded Widgets i.e. homepage
– Strategic
 We have built in features in Domino as it is an app development platform,
– WAS is an Enterprise App server, not a development platform
– Connections is Social Enterprise Software, not a development platform
 Native Websphere apps have a great deal of power and although security can be tightly
controlled it is not as simple to implement as Domino
85
Native WAS Application which integrates with an API
 For this example we are going to use a native application to pull from the Approvals Domino
database, and post it to the Connections stream
– We will do this on a schedule just as we would do with Agent Manager.

86
Integrating WAS into your IDE
 With Native applications you will first want to build and test them locally on Websphere
– Far faster turn around
– Live console
– Your breakages don’t impact other people.
– Logs are much larger on a connections box
 This can be done for Connections development unless:
– You are after the Connections backend databases and your administrator has restricted
access to them
• Administrators can often be persuaded to grant this access on dev boxes
– You are embedding widgets directly into customized Connections pages
• the security overrides needed are often more bother than they are worth

87
Integrating WAS into your IDE
 To add the Websphere server to your
environment, in your IDE show the
“Servers” View

88
Integrating WAS into your IDE
 Right Click and Select “Configure Server
Connector”

89
Integrating WAS into your IDE
 Navigate to Websphere 8.0
 Select the Websphere Home directory
– This will be the “AppServer” directory in
where ever you installed Websphere
too e.g.
“D:IBMWebsphereAppServer”*

*This is the Websphere data
directory so should not be installed
on a system drive. Also avoid spaces
in directories (WAS installer defaults
to “C:Program files”)
90
Integrating WAS into your IDE
 Select “Load Profiles” to show the
profiles on the server, think of
profiles the same way as Domino
partitions.
 Profiles each have their own HTTP
port and admin port
– the HTTP port will not default to
port 80

91
Integrating WAS into your IDE
 You now have an entry in the server list
for each profile,
– You can Start/Stop and deploy your
applications to this profile directly
within the IDE

92
Integrating WAS into your IDE
 You can also see the live console (SystemOut.log)
– this is stored in the IBMWebsphereAppServerprofiles<ProfileName>logsserver1
directory

93
Native WAS Application which integrates with an API
 Our native app will consist of the following actions
 Getting Environment variables (for service connections)
 Fetching our REST data (from Domino)
 Posting it to the Connections Activity Stream
 Schedule these updates (like Agent Manager)

94
Native WAS Application which integrates with an API
 WARNING: Teacher Moment
 The will ALLWAYS be a better Way in Java, either a new tool or something you
don’t know about.
 Our examples use the most exposed fashion way we can thing of, so you can see
what's going on
 In real life you will use the best tools to make your job simpler.
 Up till now IBM will have provided you with most of the tools you need
 With J2EE unless you pick a full featured framework eg. SPRING
(http://spring.io/) , Vaadin (https://vaadin.com/home) you will have to pick your
own ‘best of breed’ tools.

95
Native WAS Application - Starting
 First Build a new Ear and Web Project as per the previous Example

Note: We will be applying Jar libraries
manually, in this example, in real life you would
want to be using maven
(http://maven.apache.org/)

96
Native WAS Application - Getting environment variables

 In Domino we take getCurrentDatabase() for granted.
 Most other systems require a database connection which its self requires parameters
 We want to be able to set these parameters with NO HARDCODING
 Thankfully Websphere allows application specific variables

97
Native WAS Application - Getting environment variables
 These are stored in the application “Deployment descriptor” or
web.xml
 This is a XML configuration file that is used to store artifacts
that are used in a Java application.
 It controls many functions for your applications including
 Servlets and URL Paths
 The Welcome File List
 Error Handlers
 Recourses

98
Native WAS Application - Getting environment variables
 First add the variables to the Web.xml including default values
<env-entry>
<env-entry-name>RESTusername</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>restadmin</env-entry-value>
</env-entry>

<env-entry>
<env-entry-name>RESTpassword</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>password123</env-entry-value>
</env-entry>
99
Native WAS Application - Getting environment variables
 On a deployed application
you can see and edit the
Environment variables from
the properties of deployed
applications

100
Native WAS Application - Getting environment variables
 This can enable your admin to keep production passwords away from developers
or simply not hardcode things

101
Native WAS Application - Getting environment variables
 There are multiple ways to access the variables, we are just doing to use the simplest,
which is to pick them up off the “initialContext”
initCtx = new InitialContext();
String rESTurl = (String) initCtx.lookup("java:comp/env/RESTurl");

 Ensure that you use the full name so “Java:/comp/env” + the name you gave them

 A more advanced way is with the @Resource annotation
 See http://en.wikipedia.org/wiki/Java_annotation &
http://docs.oracle.com/javase/tutorial/java/annotations/basics.html for annotations
background
102
Native WAS Application - Getting environment variables

 Here we are just picking them all
up

103
Native WAS Application - Fetching Domino Data
 Now that we don’t have to hardcode variables we can go get the Data from the Domino
API we have written previously.
 Go to https://code.google.com/p/google-gson/ ,download the “google-gson-2.2.4release.zip”, and extract it

104
Native WAS Application - Fetching Domino Data

 Select the “Lib” directory in
“WEB-INF”, right click and
select “Import”  “File System”

105
Native WAS Application - Fetching Domino Data

 Find and select the gson Jar file

106
Native WAS Application - Fetching Dominio Data

 We are going to fetch the JSON Data from Domino and parse it into a Java class so that
it is easy to work with
 As we can’t be bothered to manually convert the JSON data to a POJO* we will use
http://www.jsonschema2pojo.org/

107
Native WAS Application - Fetching Dominio Data
Select “JSON” and
use some of the data
from the testing with
the DEV HTTP
Client

Selecting the Lowest
common
Denominator here

108
Native WAS Application - Fetching Domino Data

 Gives us this Class which we can use

109
Native WAS Application - Fetching Domino Data

 As we are going to use this class for
converting from JSON add
“@XmlRootElement” just above the
class name

110
Native WAS Application - Fetching Domino Data

Here is the class
being used.

111
Native WAS Application - Posting to Connections
 Now that we have a List of Request Objects, lets send some of their details to the
Connections Activity Stream.
 Go to http://abdera.apache.org/ ,download the zip, and extract it
 Get the Main Jar

112
Native WAS Application - Posting to Connections
 Lots and lots of supporting Jar files.
 You don’t need them all depending
which of the Abdera functions you use.
 This is also a perfect example of what
can lead to “jar hell”.
 Note: Once you happy with ATOM in
general and are only doing Integration
with connections, switch to the Social
Business Toolkit
(https://www.ibmdw.net/social)

113
Native WAS Application - Posting to Connections

 Select the “lib” directory in
“WEB-INF”, right click and
select “Import”  “File System”

114
Native WAS Application - Posting to Connections

 Find and select the Abdera Jar and
import it
 Repeat the process for the supporting
Jar files in the lib folder

115
Native WAS Application - Posting to Connections
 Jar files added to this project are automatically
on the build path i.e.
 Go to the Project Properties
 Select “Java Build Path”, go to the
“libraries”
 You can see the files are already on the
build path

116
Native WAS Application - Posting to Connections
 First let’s write a function that can take one of the Request objects we have converted
our Domino JSON data to and send it to Connections

117
Native WAS Application - Posting to Connections

118
Native WAS Application - Posting to Connections

119
Native WAS Application - Posting to Connections
 Now let’s write some code to hold it all together

120
Native WAS Application - Posting to Connections
 That’s all well and good but how are these functions called in the first place?
 What we really need is something like Domino Agent Manager but for a
Websphere app

121
Native WAS Application - Scheduled Updates
 Go to http://quartz-scheduler.org/ ,download the Jars, and extract them

122
Native WAS Application - Scheduled Updates

 Select the “Lib” directory in
“WEB-INF”, right click and
select “Import”  “File System”

123
Native WAS Application - Scheduled Updates

 Find and select the Quartz Jar files

124
Native WAS Application - Scheduled Updates
 Quartz uses an Event Listener
 http://docs.oracle.com/cd/E15051_01/wls/docs103/webapp/app_events.html#wp178122
 We have to add that listener to the Web.xml file

125
Native WAS Application - Scheduled Updates
<context-param>

 Quartz Listener and
Basic Parameters for
Web.xml
 Which gives things like
the location of the
Quartz properties file

<param-name>quartz:config-file</param-name>
<param-value>/quartz.properties</param-value>
</context-param>
<context-param>
<param-name>quartz:shutdown-on-unload</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>quartz:wait-on-shutdown</param-name>
<param-value>false</param-value>
</context-param>
<context-param>

126

<param-name>quartz:start-scheduler-on-load</param-name>
Native WAS Application - Scheduled Updates

 Next we will create the quartz.properties
file in the “WebRoot”  “WEB-INF” 
“classes”

127
Native WAS Application - Scheduled Updates
 And populate it with some defaults

128
Native WAS Application - Scheduled Updates
 Now we want a servlet
for the quartz scheduler
“agent manager” to run
in.
 Open up the web.xml file
and add the
configuration for a
servlet

129
Native WAS Application - Scheduled Updates
<servlet>

 Add the following to the WEB.XML

<servlet-name>QuartzInitializer</servlet-name>

<servlet-class>
 The “<load-on-startup>2</load-onstartup>” means that this servlet starts
com.connect2014.ScheduledAgentStarter
when the application starts and triggers
</servlet-class>
the class “init”

 You can see the class name that we
need to create next in the “<servletclass>” parameter.

<init-param>
<param-name>shutdown-on-unload</param-name>
<param-value>true</param-value>
</init-param>

130

<load-on-startup>2</load-on-startup>
Native WAS Application - Scheduled Updates

 That’s the equivalent to “Agent Manager” set up, now lets do a “Scheduled
Agent”, a chunk of code that will start when the web app starts.
 First let’s build our base agent by creating a new Class and getting the default
quartzScheduler

131
Native WAS Application - Scheduled Updates

132
Native WAS Application - Scheduled Updates

133
Native WAS Application - Scheduled Updates
 As you can see the class we created on the last slide extends “HttpServlet” and
contains “init”

 That means that when the servlet we added to the web.xml starts (when the
application starts), it will run the “init” and we can start scheduling

134
Native WAS Application - Scheduled Updates
Inside the init function of your
schedule we now define:
1)A new job (linked to our Class)

1

2)A schedule
3)Link the Job and schedule
together
4)Trigger the scheduler i.e. “load
Agent manager”

135

2
3
4
Native WAS Application - Scheduled Updates
– While we are here this is a Crontrigger
•

http://quartz-scheduler.org/documentation/quartz-2.2.x/tutorials/tutorial-lesson-06

– Very very powerful, but sometimes overly complex

•

If you need a simpler version, check out “Simple Triggers”
•

136

http://quartz-scheduler.org/documentation/quartz-2.2.x/tutorials/tutorial-lesson-05
Native WAS Application - Scheduled Updates

Also we need to send all the
environmental parameters we
built before, into the new “Job” we
have just created

137
Native WAS Application - Scheduled Updates
To enable our existing class to be used as a Job, is has to have “implements Job”

And it must possess the “execute” method

138
Native WAS Application - Scheduled Updates
Finally we can now add the code we wrote before to this function as well as pickup all the
variables

139
Native WAS Application – Build and Deploy Application
 Build the Ear file and deploy the application as per previous native application example

140
Native WAS Application
 Once the Application
Starts, it pumps
entries to the Actor
user’s* activity stream
from the domino rest
service

*(the one who's credentials
are supplied)
141
Recommendations and
Further Reading

142
Recommendations and Further Reading
 As already mentioned neither Connections nor its host, Websphere, are application
development platforms in the way Domino is.
– You will need to bring your own toolbox of libraries and toolkits to perform many of the
functions that you have taken for granted with Domino

143
Further reading
 When you need: Agent Manager
 We Recommend: Quartz (http://quartz-scheduler.org/)

 Alternative: java.util.Timer
– Simpler but not as powerful
– Example: http://www.mkyong.com/java/jdk-timer-scheduler-example/

144
Further reading
 When you need: To connect to a Relational Databases (such as the Native Connections
Dbs)
 We Recommend: Hibernate using JPA
 When we moved from Domino to Connections we went from the easy going world of NOSQL
and constantly being in a database context to Relational databases and defining our own
contexts (most likely DB2)
 There are lots of fighting over if you should use a ORM (Object-relational mapping)
framework such as JPA or direct SQL, but frankly, its quick, reliable and does not give you
grief
 See Slide deck on SHOW104

145
Further reading
 When you need: Make your data accessible as Json
 We Recommend: gson https://code.google.com/p/google-gson

 Alternatives: Jboss Resteasy (http://www.jboss.org/resteasy) & Jersey
(https://jersey.java.net)

146
Further reading – ATOM (Connections feeds)
 When you need: Talk to Connections (ATOM)
 We Recommend: Abdera (http://abdera.apache.org/)

147
Further reading - Email
 When you need: Send an Email
 We Recommend: https://javamail.java.net/nonav/docs/api/
 Get the SMTP server details off your admin as they will
already be setup for connections (it was in the notifications
part of the Connections setup)

148
Further reading - Email
Properties props = new Properties();
props.put("mail.smtp.host", "my-mail-server");
Session session = Session.getInstance(props, null);

try {
MimeMessage msg = new MimeMessage(session);
msg.setFrom(“sender@ldc.com");
msg.setRecipients(Message.RecipientType.TO, "you@example.com");
msg.setSubject("JavaMail hello world example");
msg.setSentDate(new Date());
149

msg.setText("Hello, world!n");
Further reading – Homework
 If you think you have a handle on all of this, your next stops
to be a “Proper” Java Developer are
– Maven build management (http://maven.apache.org/)
– Source Control - Git/Github (http://git-scm.com/ &
https://github.com/)
– Continuous integration - Jenkins (http://jenkins-ci.org/)
– A Web framework (Spring http://spring.io/ , Grails,
Vaadin https://vaadin.com/ , GWT, Wicket, Play, Struts
and JSF)
– Spring Annotations to make use of modern Java and
reduce the amount of code you have to write

150
 Access Connect Online to complete your session surveys using any:
– Web or mobile browser
– Connect Online kiosk onsite

151
Acknowledgements and Disclaimers
Availability. 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.
The workshops, sessions and materials have been prepared by IBM or the session speakers and reflect their own views. They are provided for informational purposes only, and are neither
intended to, nor shall have the effect of being, legal or other guidance or advice to any participant. While efforts were made to verify the completeness and accuracy of the information
contained in this presentation, it is provided AS-IS without warranty of any kind, express or implied. IBM shall not be responsible for any damages arising out of the use of, or otherwise
related to, this presentation or any other materials. Nothing contained in this presentation 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.
All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved. Actual environmental costs and
performance characteristics may vary by customer. 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.

© Copyright IBM Corporation 2014. All rights reserved.
 U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
 IBM, the IBM logo, ibm.com, Websphere and IBM Domino, IBM Connections, IBM Websphere Application Server, DB2 are trademarks or registered trademarks of International Business
Machines Corporation in the United States, other countries, or both. If these and other IBM trademarked terms are marked on their first occurrence in this information with a trademark
symbol (® or ™), these symbols indicate U.S. registered or common law trademarks owned by IBM at the time this information was published. Such trademarks may also be registered
or common law trademarks in other countries. A current list of IBM trademarks is available on the Web at “Copyright and trademark information” at www.ibm.com/legal/copytrade.shtml
 MyEclipse Blue and Other company, product, or service names may be trademarks or service marks of others.

152

Weitere ähnliche Inhalte

Was ist angesagt?

Basic Java Database Connectivity(JDBC)
Basic Java Database Connectivity(JDBC)Basic Java Database Connectivity(JDBC)
Basic Java Database Connectivity(JDBC)suraj pandey
 
J2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - ComponentsJ2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - ComponentsKaml Sah
 
IBM ConnectED 2015 - MAS103 XPages Performance and Scalability
IBM ConnectED 2015 - MAS103 XPages Performance and ScalabilityIBM ConnectED 2015 - MAS103 XPages Performance and Scalability
IBM ConnectED 2015 - MAS103 XPages Performance and ScalabilityPaul Withers
 
Xml Publisher And Reporting To Excel
Xml Publisher And Reporting To ExcelXml Publisher And Reporting To Excel
Xml Publisher And Reporting To ExcelDuncan Davies
 
Ibm web sphere_job_interview_preparation_guide
Ibm web sphere_job_interview_preparation_guideIbm web sphere_job_interview_preparation_guide
Ibm web sphere_job_interview_preparation_guideKhemnath Chauhan
 
Java Web Programming [1/9] : Introduction to Web Application
Java Web Programming [1/9] : Introduction to Web ApplicationJava Web Programming [1/9] : Introduction to Web Application
Java Web Programming [1/9] : Introduction to Web ApplicationIMC Institute
 
ASP, ASP.NET, JSP, COM/DCOM
ASP, ASP.NET, JSP, COM/DCOMASP, ASP.NET, JSP, COM/DCOM
ASP, ASP.NET, JSP, COM/DCOMAashish Jain
 
2009 - Microsoft IIS Vs. Apache - Who Serves More - A Study
2009 - Microsoft IIS Vs. Apache - Who Serves More - A Study2009 - Microsoft IIS Vs. Apache - Who Serves More - A Study
2009 - Microsoft IIS Vs. Apache - Who Serves More - A StudyVijay Prasad Gupta
 
By: Luis A. Colón Anthony Trivino
By: Luis A. Colón Anthony TrivinoBy: Luis A. Colón Anthony Trivino
By: Luis A. Colón Anthony Trivinowebhostingguy
 
Introduction to soapui and webservices
Introduction to soapui  and webservicesIntroduction to soapui  and webservices
Introduction to soapui and webservicesAnil Yadav
 
Performance Of Web Applications On Client Machines
Performance Of Web Applications On Client MachinesPerformance Of Web Applications On Client Machines
Performance Of Web Applications On Client MachinesCurelet Marius
 
Interview preparation net_asp_csharp
Interview preparation net_asp_csharpInterview preparation net_asp_csharp
Interview preparation net_asp_csharpMallikarjuna G D
 
108 advancedjava
108 advancedjava108 advancedjava
108 advancedjavaAnil Kumar
 

Was ist angesagt? (20)

Basic Java Database Connectivity(JDBC)
Basic Java Database Connectivity(JDBC)Basic Java Database Connectivity(JDBC)
Basic Java Database Connectivity(JDBC)
 
Oracle OSB Tutorial 3
Oracle OSB Tutorial 3Oracle OSB Tutorial 3
Oracle OSB Tutorial 3
 
J2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - ComponentsJ2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - Components
 
IBM ConnectED 2015 - MAS103 XPages Performance and Scalability
IBM ConnectED 2015 - MAS103 XPages Performance and ScalabilityIBM ConnectED 2015 - MAS103 XPages Performance and Scalability
IBM ConnectED 2015 - MAS103 XPages Performance and Scalability
 
Xml Publisher And Reporting To Excel
Xml Publisher And Reporting To ExcelXml Publisher And Reporting To Excel
Xml Publisher And Reporting To Excel
 
Ibm web sphere_job_interview_preparation_guide
Ibm web sphere_job_interview_preparation_guideIbm web sphere_job_interview_preparation_guide
Ibm web sphere_job_interview_preparation_guide
 
Java part 3
Java part  3Java part  3
Java part 3
 
Jdbc
JdbcJdbc
Jdbc
 
Java Web Programming [1/9] : Introduction to Web Application
Java Web Programming [1/9] : Introduction to Web ApplicationJava Web Programming [1/9] : Introduction to Web Application
Java Web Programming [1/9] : Introduction to Web Application
 
Asp.net
Asp.netAsp.net
Asp.net
 
ASP, ASP.NET, JSP, COM/DCOM
ASP, ASP.NET, JSP, COM/DCOMASP, ASP.NET, JSP, COM/DCOM
ASP, ASP.NET, JSP, COM/DCOM
 
2009 - Microsoft IIS Vs. Apache - Who Serves More - A Study
2009 - Microsoft IIS Vs. Apache - Who Serves More - A Study2009 - Microsoft IIS Vs. Apache - Who Serves More - A Study
2009 - Microsoft IIS Vs. Apache - Who Serves More - A Study
 
By: Luis A. Colón Anthony Trivino
By: Luis A. Colón Anthony TrivinoBy: Luis A. Colón Anthony Trivino
By: Luis A. Colón Anthony Trivino
 
Introduction to soapui and webservices
Introduction to soapui  and webservicesIntroduction to soapui  and webservices
Introduction to soapui and webservices
 
Performance Of Web Applications On Client Machines
Performance Of Web Applications On Client MachinesPerformance Of Web Applications On Client Machines
Performance Of Web Applications On Client Machines
 
Interview preparation net_asp_csharp
Interview preparation net_asp_csharpInterview preparation net_asp_csharp
Interview preparation net_asp_csharp
 
Appengine Nljug
Appengine NljugAppengine Nljug
Appengine Nljug
 
Jdbc
JdbcJdbc
Jdbc
 
108 advancedjava
108 advancedjava108 advancedjava
108 advancedjava
 
Data load utility
Data load utilityData load utility
Data load utility
 

Andere mochten auch

IBM Connections 4.5 Reviewer's Guide
IBM Connections 4.5 Reviewer's GuideIBM Connections 4.5 Reviewer's Guide
IBM Connections 4.5 Reviewer's GuideLuis Benitez
 
XCC 12.0 - Documentation
XCC 12.0 - DocumentationXCC 12.0 - Documentation
XCC 12.0 - DocumentationTIMETOACT GROUP
 
API & Custom Widgets coming in XCC next - Web Content and Custom App Extensio...
API & Custom Widgets coming in XCC next - Web Content and Custom App Extensio...API & Custom Widgets coming in XCC next - Web Content and Custom App Extensio...
API & Custom Widgets coming in XCC next - Web Content and Custom App Extensio...TIMETOACT GROUP
 
XCC Cloud for IBM Connections Cloud
XCC Cloud for IBM Connections Cloud XCC Cloud for IBM Connections Cloud
XCC Cloud for IBM Connections Cloud TIMETOACT GROUP
 
What's New in XCC 12 - Release
What's New in XCC 12 - ReleaseWhat's New in XCC 12 - Release
What's New in XCC 12 - ReleaseTIMETOACT GROUP
 
IBM Digital Workplace Hub - Official Booklet
IBM Digital Workplace Hub - Official BookletIBM Digital Workplace Hub - Official Booklet
IBM Digital Workplace Hub - Official BookletTIMETOACT GROUP
 
IBM Digital Workplace Hub with IBM Connections & TIMETOACT's XCC - Web Conten...
IBM Digital Workplace Hub with IBM Connections & TIMETOACT's XCC - Web Conten...IBM Digital Workplace Hub with IBM Connections & TIMETOACT's XCC - Web Conten...
IBM Digital Workplace Hub with IBM Connections & TIMETOACT's XCC - Web Conten...TIMETOACT GROUP
 
24 Ways to Enhance IBM Connections with XCC – Web Content & Custom Apps Exte...
24 Ways to Enhance IBM Connections with XCC – Web Content  & Custom Apps Exte...24 Ways to Enhance IBM Connections with XCC – Web Content  & Custom Apps Exte...
24 Ways to Enhance IBM Connections with XCC – Web Content & Custom Apps Exte...TIMETOACT GROUP
 
XCC & IBM Connections 6
XCC & IBM Connections 6 XCC & IBM Connections 6
XCC & IBM Connections 6 TIMETOACT GROUP
 

Andere mochten auch (9)

IBM Connections 4.5 Reviewer's Guide
IBM Connections 4.5 Reviewer's GuideIBM Connections 4.5 Reviewer's Guide
IBM Connections 4.5 Reviewer's Guide
 
XCC 12.0 - Documentation
XCC 12.0 - DocumentationXCC 12.0 - Documentation
XCC 12.0 - Documentation
 
API & Custom Widgets coming in XCC next - Web Content and Custom App Extensio...
API & Custom Widgets coming in XCC next - Web Content and Custom App Extensio...API & Custom Widgets coming in XCC next - Web Content and Custom App Extensio...
API & Custom Widgets coming in XCC next - Web Content and Custom App Extensio...
 
XCC Cloud for IBM Connections Cloud
XCC Cloud for IBM Connections Cloud XCC Cloud for IBM Connections Cloud
XCC Cloud for IBM Connections Cloud
 
What's New in XCC 12 - Release
What's New in XCC 12 - ReleaseWhat's New in XCC 12 - Release
What's New in XCC 12 - Release
 
IBM Digital Workplace Hub - Official Booklet
IBM Digital Workplace Hub - Official BookletIBM Digital Workplace Hub - Official Booklet
IBM Digital Workplace Hub - Official Booklet
 
IBM Digital Workplace Hub with IBM Connections & TIMETOACT's XCC - Web Conten...
IBM Digital Workplace Hub with IBM Connections & TIMETOACT's XCC - Web Conten...IBM Digital Workplace Hub with IBM Connections & TIMETOACT's XCC - Web Conten...
IBM Digital Workplace Hub with IBM Connections & TIMETOACT's XCC - Web Conten...
 
24 Ways to Enhance IBM Connections with XCC – Web Content & Custom Apps Exte...
24 Ways to Enhance IBM Connections with XCC – Web Content  & Custom Apps Exte...24 Ways to Enhance IBM Connections with XCC – Web Content  & Custom Apps Exte...
24 Ways to Enhance IBM Connections with XCC – Web Content & Custom Apps Exte...
 
XCC & IBM Connections 6
XCC & IBM Connections 6 XCC & IBM Connections 6
XCC & IBM Connections 6
 

Ähnlich wie Proper Connections Development for Proper Domino Developers

Free Mongo on OpenShift
Free Mongo on OpenShiftFree Mongo on OpenShift
Free Mongo on OpenShiftSteven Pousty
 
Intro to SpringBatch NoSQL 2021
Intro to SpringBatch NoSQL 2021Intro to SpringBatch NoSQL 2021
Intro to SpringBatch NoSQL 2021Slobodan Lohja
 
Uklug2009 Hairy Bikers Cookbook
Uklug2009   Hairy Bikers CookbookUklug2009   Hairy Bikers Cookbook
Uklug2009 Hairy Bikers CookbookBill Buchan
 
Django simplified : by weever mbakaya
Django simplified : by weever mbakayaDjango simplified : by weever mbakaya
Django simplified : by weever mbakayaMbakaya Kwatukha
 
OpenShift with Eclipse Tooling - EclipseCon 2012
OpenShift with Eclipse Tooling - EclipseCon 2012OpenShift with Eclipse Tooling - EclipseCon 2012
OpenShift with Eclipse Tooling - EclipseCon 2012Steven Pousty
 
Office Add-ins community call-March 2019
Office Add-ins community call-March 2019Office Add-ins community call-March 2019
Office Add-ins community call-March 2019Microsoft 365 Developer
 
OWA And SharePoint Integration
OWA And SharePoint IntegrationOWA And SharePoint Integration
OWA And SharePoint Integrationjems7
 
AIR - Framework ( Cairngorm and Parsley )
AIR - Framework ( Cairngorm and Parsley )AIR - Framework ( Cairngorm and Parsley )
AIR - Framework ( Cairngorm and Parsley )senthil0809
 
WP REST API - Building a simple Web Application
WP REST API - Building a simple Web ApplicationWP REST API - Building a simple Web Application
WP REST API - Building a simple Web ApplicationEdmund Chan
 
Tutorial: extending the zend server ui and web api
Tutorial: extending the zend server ui and web apiTutorial: extending the zend server ui and web api
Tutorial: extending the zend server ui and web apiYonni Mendes
 
learn mvc project in 7 day
learn mvc project in 7 daylearn mvc project in 7 day
learn mvc project in 7 dayQuach Long
 
What is Node.js? (ICON UK)
What is Node.js? (ICON UK)What is Node.js? (ICON UK)
What is Node.js? (ICON UK)Tim Davis
 
SharePoint 2013 App Provisioning Models
SharePoint 2013 App Provisioning ModelsSharePoint 2013 App Provisioning Models
SharePoint 2013 App Provisioning ModelsShailen Sukul
 
Office Add ins community call-February 2019
Office Add ins community call-February 2019Office Add ins community call-February 2019
Office Add ins community call-February 2019Microsoft 365 Developer
 
M365 global developer bootcamp 2019 Intro to SPFx Version
M365 global developer bootcamp 2019 Intro to SPFx VersionM365 global developer bootcamp 2019 Intro to SPFx Version
M365 global developer bootcamp 2019 Intro to SPFx VersionThomas Daly
 
1 app 2 developers 3 servers
1 app 2 developers 3 servers1 app 2 developers 3 servers
1 app 2 developers 3 serversMark Myers
 
ONLINE PORTAL WITH COMPILER USING C#
ONLINE  PORTAL WITH COMPILER USING C#ONLINE  PORTAL WITH COMPILER USING C#
ONLINE PORTAL WITH COMPILER USING C#Pritam Guchhait
 

Ähnlich wie Proper Connections Development for Proper Domino Developers (20)

Free Mongo on OpenShift
Free Mongo on OpenShiftFree Mongo on OpenShift
Free Mongo on OpenShift
 
Intro to SpringBatch NoSQL 2021
Intro to SpringBatch NoSQL 2021Intro to SpringBatch NoSQL 2021
Intro to SpringBatch NoSQL 2021
 
Uklug2009 Hairy Bikers Cookbook
Uklug2009   Hairy Bikers CookbookUklug2009   Hairy Bikers Cookbook
Uklug2009 Hairy Bikers Cookbook
 
Django simplified : by weever mbakaya
Django simplified : by weever mbakayaDjango simplified : by weever mbakaya
Django simplified : by weever mbakaya
 
OpenShift with Eclipse Tooling - EclipseCon 2012
OpenShift with Eclipse Tooling - EclipseCon 2012OpenShift with Eclipse Tooling - EclipseCon 2012
OpenShift with Eclipse Tooling - EclipseCon 2012
 
Office Add-ins community call-March 2019
Office Add-ins community call-March 2019Office Add-ins community call-March 2019
Office Add-ins community call-March 2019
 
OWA And SharePoint Integration
OWA And SharePoint IntegrationOWA And SharePoint Integration
OWA And SharePoint Integration
 
AIR - Framework ( Cairngorm and Parsley )
AIR - Framework ( Cairngorm and Parsley )AIR - Framework ( Cairngorm and Parsley )
AIR - Framework ( Cairngorm and Parsley )
 
WP REST API - Building a simple Web Application
WP REST API - Building a simple Web ApplicationWP REST API - Building a simple Web Application
WP REST API - Building a simple Web Application
 
Tutorial: extending the zend server ui and web api
Tutorial: extending the zend server ui and web apiTutorial: extending the zend server ui and web api
Tutorial: extending the zend server ui and web api
 
learn mvc project in 7 day
learn mvc project in 7 daylearn mvc project in 7 day
learn mvc project in 7 day
 
What is Node.js? (ICON UK)
What is Node.js? (ICON UK)What is Node.js? (ICON UK)
What is Node.js? (ICON UK)
 
SharePoint 2013 App Provisioning Models
SharePoint 2013 App Provisioning ModelsSharePoint 2013 App Provisioning Models
SharePoint 2013 App Provisioning Models
 
Cake Php Consultant
Cake Php ConsultantCake Php Consultant
Cake Php Consultant
 
Testing soap UI
Testing soap UITesting soap UI
Testing soap UI
 
Office Add ins community call-February 2019
Office Add ins community call-February 2019Office Add ins community call-February 2019
Office Add ins community call-February 2019
 
Mailing Website
Mailing WebsiteMailing Website
Mailing Website
 
M365 global developer bootcamp 2019 Intro to SPFx Version
M365 global developer bootcamp 2019 Intro to SPFx VersionM365 global developer bootcamp 2019 Intro to SPFx Version
M365 global developer bootcamp 2019 Intro to SPFx Version
 
1 app 2 developers 3 servers
1 app 2 developers 3 servers1 app 2 developers 3 servers
1 app 2 developers 3 servers
 
ONLINE PORTAL WITH COMPILER USING C#
ONLINE  PORTAL WITH COMPILER USING C#ONLINE  PORTAL WITH COMPILER USING C#
ONLINE PORTAL WITH COMPILER USING C#
 

Mehr von Mark Myers

Engage 2017 - Choose your own adventure
Engage 2017 - Choose your own adventureEngage 2017 - Choose your own adventure
Engage 2017 - Choose your own adventureMark Myers
 
LDC Via building a new app
LDC Via  building a new appLDC Via  building a new app
LDC Via building a new appMark Myers
 
Saleforce For Domino Dogs
Saleforce For Domino DogsSaleforce For Domino Dogs
Saleforce For Domino DogsMark Myers
 
Vertical vs Horizontal Scaling
Vertical vs Horizontal Scaling Vertical vs Horizontal Scaling
Vertical vs Horizontal Scaling Mark Myers
 
The Dev-Admin Chimera: Customising Connections (with Gab Davis)
The Dev-Admin Chimera: Customising Connections (with Gab Davis)The Dev-Admin Chimera: Customising Connections (with Gab Davis)
The Dev-Admin Chimera: Customising Connections (with Gab Davis)Mark Myers
 
Ar*@!+$es to this. getting IBM connections to do what you want
Ar*@!+$es to this. getting IBM connections to do what you want Ar*@!+$es to this. getting IBM connections to do what you want
Ar*@!+$es to this. getting IBM connections to do what you want Mark Myers
 
Blug2013 frameworks
Blug2013 frameworksBlug2013 frameworks
Blug2013 frameworksMark Myers
 
Show104 buried treasure
Show104 buried treasureShow104 buried treasure
Show104 buried treasureMark Myers
 
BP203 limitless languages
BP203 limitless languagesBP203 limitless languages
BP203 limitless languagesMark Myers
 

Mehr von Mark Myers (9)

Engage 2017 - Choose your own adventure
Engage 2017 - Choose your own adventureEngage 2017 - Choose your own adventure
Engage 2017 - Choose your own adventure
 
LDC Via building a new app
LDC Via  building a new appLDC Via  building a new app
LDC Via building a new app
 
Saleforce For Domino Dogs
Saleforce For Domino DogsSaleforce For Domino Dogs
Saleforce For Domino Dogs
 
Vertical vs Horizontal Scaling
Vertical vs Horizontal Scaling Vertical vs Horizontal Scaling
Vertical vs Horizontal Scaling
 
The Dev-Admin Chimera: Customising Connections (with Gab Davis)
The Dev-Admin Chimera: Customising Connections (with Gab Davis)The Dev-Admin Chimera: Customising Connections (with Gab Davis)
The Dev-Admin Chimera: Customising Connections (with Gab Davis)
 
Ar*@!+$es to this. getting IBM connections to do what you want
Ar*@!+$es to this. getting IBM connections to do what you want Ar*@!+$es to this. getting IBM connections to do what you want
Ar*@!+$es to this. getting IBM connections to do what you want
 
Blug2013 frameworks
Blug2013 frameworksBlug2013 frameworks
Blug2013 frameworks
 
Show104 buried treasure
Show104 buried treasureShow104 buried treasure
Show104 buried treasure
 
BP203 limitless languages
BP203 limitless languagesBP203 limitless languages
BP203 limitless languages
 

Kürzlich hochgeladen

TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 

Kürzlich hochgeladen (20)

TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 

Proper Connections Development for Proper Domino Developers

  • 1. SHOW303: Proper Connections Development for Proper Domino Developers Matt White, London Developer Co-op Mark Myers, London Developer Co-op © 2014 IBM Corporation
  • 2. About Us  Matt White – A Member of the London Developer Co-op (londc.com) A group of UK based developers – Domino web developer since 1996 – XPages developer since 2008 – Also… • Owner at http://xpages101.net • Lead Developer for Elguji Software - IdeaJam - IQJam 2
  • 3. About Us  Mark Myers – A Member of the London Developer Co-op (londc.com) A group of UK based developers – Developer from a support background – 12+ years on Domino, 15+ years in IT – Speaker at 4x Lotuspheres, 4x UKLUGs, 1x ILUG, 1x BLUG 3
  • 4. Software we’re using  IBM Domino® 9.0.1  IBM Domino® Designer 9.0.1  IBM Websphere® Application Server 8.0  IBM DB2® 10.1  MyEclipse® 2014 Blue Edition 4
  • 5. Aim of this session  Surface an XPages application inside Connections  We’re assuming that you are Domino developers and that you know nothing about developing applications for Connections  We’re going to show you three different ways to do this  This is from real world experience 5
  • 6. What is Connections?  Not a single application server  Think a series of WAS applications, a database server and various add-ons.  It is not as simple as Domino development  But, it is not difficult to do. You just need to know the moving parts.  That’s what we’re going to show you today. 6
  • 7. Our Development Environment  IBM Domino 9.0.1 running: – HTTP – obviously as we are running XPages apps – LDAP – our Domino server handles all authentication for IBM Connections – Mail etc – all the usual add on tasks in Domino  IBM Domino Designer 9.0.1  Websphere Application Server – Free download for developers of WAS 8.0 from: http://ibm.co/1dNp4Uw • We use 8.0 vs 8.5 as Connections 4.0 & 4.5 only runs on 8.0 – You’ll also need to get the IBM Installation Manager v1.6.2  MyEclipse Blue Edition – http://www.myeclipseide.com/blue/  Connections 4.5 7
  • 8. Our Connections Development Environment - Connections  Connections development is far simpler than connections installation and administration  Minimum of a Windows server with 8Gig of Ram and 30+ gig for a Empty installation  Installations files 14+ gig  https://bitly.com/18Ub03F (1115 slides not including the Domino installation for LDAP)  You CAN get it all working on one box, but it will be slow (fine for development but not really suitable for users)  You can not use a WAS server set up for development as your connections box, all the security needs to be turned on.  You will need a full day to do this!!  Connections settles in to about 10Gig of memory if left alone, so even on an 8Gig box you will need to reboot every so often. 8
  • 9. Our Connections Development Environment  Installing Connections 4.5 Crib sheet – Install Domino and Enable LDAP (or use an existing one) – Install db2 10.1 + Fixes – Install WAS 8.0.0.5 + Fixes – Create Connections DBs (with wizard) – Install TDI – Avoid Cognos ( you will rarely need it for development and it is optional ) – Link Domino LDAP with Connections ProfileDB with TDI (using wizard) – Install Connections* – Make a mental note to ask your admin to do it next time 9 *Discover at this point that you have misconfigured some minor detail wrong (such as the deployment profile) and spend hours figuring out why and where
  • 10. The Domino Application  Simple Approvals application  Three forms  Workflow around document status changes send update emails 10
  • 12. What we’re going to show  Three different ways of surfacing the application in Connections:  1) Simple iWidget  2) Static HTML / JavaScript which integrates with an API  3) WAS Application which integrates with an API  Then as a bonus we’ll add some extra functionality – Using the Social Business Toolkit we’ll post from the Domino application into other Connections tools 12
  • 13. Creating the iWidget  Very little to do, we already have a responsive web design  Bootstrap 3.0 will handle the scaling of the web page  We just need to configure the iWidget and deploy it 13
  • 14. Creating the iWidget  We need to present it to Connections as a Open Social widget  The easiest way of doing this is with a simple domino page which we will call “approvals.xml” 14
  • 15. Installing into Connections  You will need Connections admin rights.  When you log on to connections, click on the “Administration” Link, on the left side bar under “my Page” 15
  • 16. Installing it into Connections  You can Add/Enable/Disable Widgets from here  Click “Add another widget” 16
  • 17. Installing it into Connections  First choose “Open Social Gadget”  Then “Trusted” – Select “SSO” if you are logging on with your domino credentials and your admin has set SSO up, this will enable your domino security to work seamlessly in a the widget 17
  • 18. Installing it into Connections  Fill in other details (only Title and Address are Mandatory)  Then Save and Enable the widget 18
  • 19. Installing it into Connections  Finally 19
  • 21. Creating API – Server Settings  We need to enable the PUT and DELETE methods in our website document on the Domino server  Discuss this with your friendly admin – If not allowed, then process PUT and DELETE using POST and an additional HTTP Header to describe the actual method being used • Ideally avoid this approach as it is non standard for the rest of the world
  • 22. We need to create an API  The second and third demos require an API so let’s quickly create one  The API will be a REST JSON service which allows us to read and write data programatically  It’s a simple process, but there a couple of gotchas 22
  • 23. Creating API – Server Settings  We want to allow cross domain Ajax requests as well  From the website document, create a new website rule  Set the following fields: – Type of Rule: HTTP Response Headers – Incoming URL pattern: */api.xsp* – Expires Header: Add Header if application did not – Custom Headers • Access-Control-Allow-Origin: * • Access-Control-Allow-Headers: Origin, XRequested-With, Content-Type, Accept  Restrict which domains can do this with the Access-Control-Allow-Origin setting  Restart HTTP on your server
  • 24. Creating API – Java Class  Now we can create the code in Domino Designer  First we’ll create a new Java Class called ApprovalsService
  • 25. Creating API – Java Class  Now add java code, first the imports:
  • 26. Creating API – Java Class  Add the renderService method
  • 27. Creating API – Java Class  We’re going to support four methods using three functions: – GET – renderServiceJSONGet – POST – renderServiceJSONUpdate – PUT – renderServiceJSONUpdate – DELETE – renderServiceJSONDelete  URL Format is: – …/mydb.nsf/api.xsp/[UNID]
  • 28. Creating API – GET Method  The GET method returns JSON of views or a single document
  • 29. Creating API – GET Method
  • 30. Creating API – GET Method
  • 31. Creating API – GET Method
  • 32. Creating API – POST / PUT Method  JSON is sent to our service and based upon the method used to send it, we decide whether to update an existing document or create a new document – POST will try to update an existing document – PUT will insert a new document  We use HTTP response codes to indicate success or any errors – So 200 == Success – 404 == document not found – Etc. – http://en.wikipedia.org/wiki/List_of_HTTP_status_codes  We’ll see how to call the service later on
  • 33. Creating API – POST / PUT Method
  • 34. Creating API – POST / PUT Method
  • 35. Creating API – DELETE Method  A simple DELETE request is sent to our service and we can decide what to do with the document. – We don’t have to delete the document, we can simply move it out of live views  Again we use response codes to indicate success or failure
  • 36. Creating API – DELETE Method
  • 37. Creating API – API XPage  Now we create a new XPage called “api”
  • 38. Creating API – API XPage  Make sure the XPage rendered property is set to false  Then in the afterRenderResponse event call the renderService method in our Java class
  • 39. Testing the API  We use a Chrome plugin called “Dev HTTP Client” – Free – Download from Chrome Web Store  We need to control the URL, the METHOD, the HTTP HEADERS  We’re going to test – Getting allrequests – Getting myrequests – Reading a document – Updating a document – Creating a document – Deleting a document 39
  • 40. Testing the API - allrequests 40
  • 41. Testing the API - myrequests 41
  • 42. Testing the API – Read Document 42
  • 43. Testing the API – Update Document 43
  • 44. Testing the API – Creating a new document 44
  • 45. Testing the API – Deleting a document 45
  • 46. Testing the API - Errors  In this case we are trying to read a document which doesn’t exist so we get an Error 404 46
  • 48. Static HTML App  Now that we have an API, any number of external applications can access our original XPages application  This is not limited to Connections of course – Think Mobile!  We’re going to create a static HTML and JavaScript application which makes use of the API and AJAX to perform some basic functions  The benefit of this is that we can build in error handling – If the Domino server is down then we can display a useful error page for example  We might want to pull data from several different places  The iWidget may be too basic 48
  • 49. Development Process  This is very simple – We’re going to use a text editor!  We’ll also use some frameworks to make things nice and simple – jQuery 2.0.3 • Will handle our Ajax requests etc – Bootstrap 3 • Will be used for our UI – Font Awesome • Useful for general icons, in this case a spinner  Merge all the files into a folder in the following structure – Root • CSS • Font • JS 49
  • 50. Static HTML Application  We’ll create a single HTML page called index.html 50
  • 51. Static HTML Application  Then we’ll create a single JavaScript document, site.js  The URL will obviously need to be changed to match your environment 51
  • 53. Static HTML Application  Once you have a working static HTML application, we’re going to want to deploy it to Websphere Application Server (WAS)  We recommend using MyEclipse Blue for this rather than Rational Application Developer – It’s cheaper – It’s smaller and faster – It’s much simpler  We need to create two different projects, one which will contain the code (war file) and one which will handle hold and deploy the war file to WAS (ear file) 53
  • 54. What are WAR and EAR files  A .War file (Web application ARchive) is a file used to distribute a collection of JavaServer Pages, Java Servlets, Java classes, XML files, tag libraries, static Web pages (HTML and related files) and other resources that together constitute a Web application.  An .Ear (Enterprise ARchive) is Basically a normal War file wrapped in a configuration wrapper.  The Configuration wrapper of the Ear file contains features that while are very useful and powerful for Websphere applications (adding JDBC connections on install etc etc) are dangerous on connections server remember you are on a shared server and you can not make any assumptions as to what is happening – After working with multiple Connections administrators, the general opinion is to document the features you require and ask your administrators to manually add them rather than use the Ear file 54
  • 55. Create EAR Project  In MyEclipse, select File -> New -> Enterprise Application Project  Populate the dialog: – Enter Project Name – Make sure Target Runtime is set to Websphere 8.0  Click Next 55
  • 56. Create EAR Project  In the next page of the wizard make sure to check “Generate application.xml deployment descriptor”  Then click Finish  We end up with an empty project which we can ignore for the moment 56
  • 57. Create Web Project  Still in MyEclipse, create a new Web Project:  In the dialog enter the Project Name  Make sure that you choose to “Add project to an EAR” and select the EAR project we just created  Click Next 57
  • 58. Create Web Project  Take the defaults on the next page of the dialog  Then click Next  In the final dialog window make sure that the “Generate web.xml deployment descriptor” is checked  Click Finish 58
  • 59. You have seen most of this before irectory ource D S Root of Web site 59
  • 60. Import HTML into Web Project  In the WebRoot folder of the Web Project we just created, now import the HTML, JavaScript and CSS files we created into the project:  Right click on the WebRoot folder and choose “Import” 60
  • 61. Create approvals.xml file  In the same way that we created an XML for the deployment of the Domino widget, we need to create a similar XML file for this project  Create a new XML file in the WebRoot folder called approvals.xml 61
  • 62. Create approvals.xml file  Insert the following XML and save the file  Obviously adjust the href property to match your environment 62
  • 63. Export EAR  Now that we have our (very simple) web project we want to get it deployed to our test WAS installation to make sure it works  So we need to export an EAR file  Right click on the EAR project and choose Export  Choose “EAR File” from the list  Click Next 63
  • 64. Export EAR  In the dialog choose the destination for the EAR file  Make sure to choose “Optimize for a specific server runtime” and choose Websphere 8.0” from the list  Click Finish 64
  • 65. Test Install WAS Application  We want to make sure that the WAS application works OK  So open your browser  Now we want to open the WAS Admin Console  Choose “New Application” from the Applications menu 65
  • 66. Install WAS Application  We now go through a 5 stage wizard to install the application  First we upload the EAR file we just created  Then click Next 66
  • 67. Install WAS Application  Because this is the simplest possible deployment we can just take the defaults for the next wizard pages  Choose Fast Path  Click Next 67
  • 68. Install WAS Application  Take the default options and click Next 68
  • 69. Install WAS Application  Take the default options and click next  And again for Step 3 69
  • 70. Install WAS Application  Take the defaults for steps 4 and 5 as well  Finally click Finish 70
  • 71. Install WAS Application  The next screen contains the install details with the final option to save the changes to the server  Click “Save”  Now go to the Enterprise Applications list and choose to start the application we just installed: 71
  • 72. Test the WAS Application  Finally we can actually test the WAS application  The URL for the application will be the same server name as your WAS Admin console but port 9080 (if you’ve setup with the defaults)  The application is called Connect14 and we want to open index.html  So in my case http://mattwhite2c8a:9080/Connect14/index.html 72
  • 73. Deploy the WAS Application to Connections  Now we can deploy the app to Connections  This is basically the same as the deployment to Websphere that you have just done for testing but with a few subtle but important differences  A Connections instance already has multiple applications and is nearly always spread over multiple servers/clusters to spread the load, you must be careful your application does not disturb this balance. 73
  • 74. Deploy the WAS Application to Connections  To find out which applications are running on which servers – Select “Websphere application servers” from the “Servers” left hand menu – Select the server you want to check from the list presented 74
  • 75. Deploy the WAS Application to Connections  Select “Installed applications” 75
  • 76. Deploy the WAS Application to Connections  You can now see all the applications running on the server and their startup order 76
  • 77. Deploy the WAS Application to Connections  Once you have picked a suitable server (I prefer “InfraCluster” on my development boxes as lots of small applications which are similar to most of the ones I develop) – Install the application as you have done previously (using “Fast Path”) – Select the server you want to deploy to, click the checkbox for your application and click “Apply” 77
  • 78. Deploy the WAS Application to Connections  You will see that the server name has now been updated  Continue on with the rest of the “fast track” as you have done previously 78
  • 79. Deploy the WAS Application to Connections  A gotcha when deploying to multi-server environments is to remember which ports the chosen server uses.  Return to the Application server config for your chosen server, and click on “Ports” 79
  • 80. Deploy the WAS Application to Connections  If you are using the SSL port, remember you will most likely be using a self certificate on your development box (these are generated for you during the profile creation section of the connections installation) The normal HTTP port (80) The normal HTTPS port (443) 80
  • 81. Deploy the WAS Application to Connections  The environment just shown is a default “medium” environment that is configured when Connections is installed – This is commonly considered the best environment for development as it simulates a production environment but still works on a smaller local machine. – You may be tempted to select the “small” installation option but it makes for a very slow restart time for any application/server.  The missing element in what we are showing you verses a production Websphere /Connections installation is the IBM High Availability HTTP server on the front end, this is why we are putting port on the front of everything. – It is invaluable for productions installations but unnecessary for development as it adds an extra layer to deployments (you have to sync web modules between it and Websphere when you deploy a new application) as well as taking up extra resources. 81
  • 82. Deploy the WAS Application to Connections  On a production server the application location decision will be taken by your administrator, but you can provide help and advice – It is more important to provide suspected load per user than you are used to for Domino, include as much info as you can include processor and disk requirements  On your development environment, you can cripple performance if you overload the wrong server node which can lead to: – Wasted time as you try to determine performance bottle necks – Incorrect load requirements. – Looking in the wrong logs for debugging (believe me it happens)  If you are running a large application you may not want to share a cluster/server at all and may need a dedicated server/cluster.  If this happens on live you app may be incorrectly blamed for a system wide slowdown 82
  • 83. Deploy the WAS Application to Connections  Here it is side by side with the Domino one 83
  • 84. Native WAS Application which integrates with an API 84
  • 85. Native WAS Application which integrates with an API  When you want to go beyond basic Connections integration or when you want to write a full application on the connections platform you WILL end up writing a Websphere Application Server Native App – Native access to relation databases – Strongly embedded Widgets i.e. homepage – Strategic  We have built in features in Domino as it is an app development platform, – WAS is an Enterprise App server, not a development platform – Connections is Social Enterprise Software, not a development platform  Native Websphere apps have a great deal of power and although security can be tightly controlled it is not as simple to implement as Domino 85
  • 86. Native WAS Application which integrates with an API  For this example we are going to use a native application to pull from the Approvals Domino database, and post it to the Connections stream – We will do this on a schedule just as we would do with Agent Manager. 86
  • 87. Integrating WAS into your IDE  With Native applications you will first want to build and test them locally on Websphere – Far faster turn around – Live console – Your breakages don’t impact other people. – Logs are much larger on a connections box  This can be done for Connections development unless: – You are after the Connections backend databases and your administrator has restricted access to them • Administrators can often be persuaded to grant this access on dev boxes – You are embedding widgets directly into customized Connections pages • the security overrides needed are often more bother than they are worth 87
  • 88. Integrating WAS into your IDE  To add the Websphere server to your environment, in your IDE show the “Servers” View 88
  • 89. Integrating WAS into your IDE  Right Click and Select “Configure Server Connector” 89
  • 90. Integrating WAS into your IDE  Navigate to Websphere 8.0  Select the Websphere Home directory – This will be the “AppServer” directory in where ever you installed Websphere too e.g. “D:IBMWebsphereAppServer”* *This is the Websphere data directory so should not be installed on a system drive. Also avoid spaces in directories (WAS installer defaults to “C:Program files”) 90
  • 91. Integrating WAS into your IDE  Select “Load Profiles” to show the profiles on the server, think of profiles the same way as Domino partitions.  Profiles each have their own HTTP port and admin port – the HTTP port will not default to port 80 91
  • 92. Integrating WAS into your IDE  You now have an entry in the server list for each profile, – You can Start/Stop and deploy your applications to this profile directly within the IDE 92
  • 93. Integrating WAS into your IDE  You can also see the live console (SystemOut.log) – this is stored in the IBMWebsphereAppServerprofiles<ProfileName>logsserver1 directory 93
  • 94. Native WAS Application which integrates with an API  Our native app will consist of the following actions  Getting Environment variables (for service connections)  Fetching our REST data (from Domino)  Posting it to the Connections Activity Stream  Schedule these updates (like Agent Manager) 94
  • 95. Native WAS Application which integrates with an API  WARNING: Teacher Moment  The will ALLWAYS be a better Way in Java, either a new tool or something you don’t know about.  Our examples use the most exposed fashion way we can thing of, so you can see what's going on  In real life you will use the best tools to make your job simpler.  Up till now IBM will have provided you with most of the tools you need  With J2EE unless you pick a full featured framework eg. SPRING (http://spring.io/) , Vaadin (https://vaadin.com/home) you will have to pick your own ‘best of breed’ tools. 95
  • 96. Native WAS Application - Starting  First Build a new Ear and Web Project as per the previous Example Note: We will be applying Jar libraries manually, in this example, in real life you would want to be using maven (http://maven.apache.org/) 96
  • 97. Native WAS Application - Getting environment variables  In Domino we take getCurrentDatabase() for granted.  Most other systems require a database connection which its self requires parameters  We want to be able to set these parameters with NO HARDCODING  Thankfully Websphere allows application specific variables 97
  • 98. Native WAS Application - Getting environment variables  These are stored in the application “Deployment descriptor” or web.xml  This is a XML configuration file that is used to store artifacts that are used in a Java application.  It controls many functions for your applications including  Servlets and URL Paths  The Welcome File List  Error Handlers  Recourses 98
  • 99. Native WAS Application - Getting environment variables  First add the variables to the Web.xml including default values <env-entry> <env-entry-name>RESTusername</env-entry-name> <env-entry-type>java.lang.String</env-entry-type> <env-entry-value>restadmin</env-entry-value> </env-entry> <env-entry> <env-entry-name>RESTpassword</env-entry-name> <env-entry-type>java.lang.String</env-entry-type> <env-entry-value>password123</env-entry-value> </env-entry> 99
  • 100. Native WAS Application - Getting environment variables  On a deployed application you can see and edit the Environment variables from the properties of deployed applications 100
  • 101. Native WAS Application - Getting environment variables  This can enable your admin to keep production passwords away from developers or simply not hardcode things 101
  • 102. Native WAS Application - Getting environment variables  There are multiple ways to access the variables, we are just doing to use the simplest, which is to pick them up off the “initialContext” initCtx = new InitialContext(); String rESTurl = (String) initCtx.lookup("java:comp/env/RESTurl");  Ensure that you use the full name so “Java:/comp/env” + the name you gave them  A more advanced way is with the @Resource annotation  See http://en.wikipedia.org/wiki/Java_annotation & http://docs.oracle.com/javase/tutorial/java/annotations/basics.html for annotations background 102
  • 103. Native WAS Application - Getting environment variables  Here we are just picking them all up 103
  • 104. Native WAS Application - Fetching Domino Data  Now that we don’t have to hardcode variables we can go get the Data from the Domino API we have written previously.  Go to https://code.google.com/p/google-gson/ ,download the “google-gson-2.2.4release.zip”, and extract it 104
  • 105. Native WAS Application - Fetching Domino Data  Select the “Lib” directory in “WEB-INF”, right click and select “Import”  “File System” 105
  • 106. Native WAS Application - Fetching Domino Data  Find and select the gson Jar file 106
  • 107. Native WAS Application - Fetching Dominio Data  We are going to fetch the JSON Data from Domino and parse it into a Java class so that it is easy to work with  As we can’t be bothered to manually convert the JSON data to a POJO* we will use http://www.jsonschema2pojo.org/ 107
  • 108. Native WAS Application - Fetching Dominio Data Select “JSON” and use some of the data from the testing with the DEV HTTP Client Selecting the Lowest common Denominator here 108
  • 109. Native WAS Application - Fetching Domino Data  Gives us this Class which we can use 109
  • 110. Native WAS Application - Fetching Domino Data  As we are going to use this class for converting from JSON add “@XmlRootElement” just above the class name 110
  • 111. Native WAS Application - Fetching Domino Data Here is the class being used. 111
  • 112. Native WAS Application - Posting to Connections  Now that we have a List of Request Objects, lets send some of their details to the Connections Activity Stream.  Go to http://abdera.apache.org/ ,download the zip, and extract it  Get the Main Jar 112
  • 113. Native WAS Application - Posting to Connections  Lots and lots of supporting Jar files.  You don’t need them all depending which of the Abdera functions you use.  This is also a perfect example of what can lead to “jar hell”.  Note: Once you happy with ATOM in general and are only doing Integration with connections, switch to the Social Business Toolkit (https://www.ibmdw.net/social) 113
  • 114. Native WAS Application - Posting to Connections  Select the “lib” directory in “WEB-INF”, right click and select “Import”  “File System” 114
  • 115. Native WAS Application - Posting to Connections  Find and select the Abdera Jar and import it  Repeat the process for the supporting Jar files in the lib folder 115
  • 116. Native WAS Application - Posting to Connections  Jar files added to this project are automatically on the build path i.e.  Go to the Project Properties  Select “Java Build Path”, go to the “libraries”  You can see the files are already on the build path 116
  • 117. Native WAS Application - Posting to Connections  First let’s write a function that can take one of the Request objects we have converted our Domino JSON data to and send it to Connections 117
  • 118. Native WAS Application - Posting to Connections 118
  • 119. Native WAS Application - Posting to Connections 119
  • 120. Native WAS Application - Posting to Connections  Now let’s write some code to hold it all together 120
  • 121. Native WAS Application - Posting to Connections  That’s all well and good but how are these functions called in the first place?  What we really need is something like Domino Agent Manager but for a Websphere app 121
  • 122. Native WAS Application - Scheduled Updates  Go to http://quartz-scheduler.org/ ,download the Jars, and extract them 122
  • 123. Native WAS Application - Scheduled Updates  Select the “Lib” directory in “WEB-INF”, right click and select “Import”  “File System” 123
  • 124. Native WAS Application - Scheduled Updates  Find and select the Quartz Jar files 124
  • 125. Native WAS Application - Scheduled Updates  Quartz uses an Event Listener  http://docs.oracle.com/cd/E15051_01/wls/docs103/webapp/app_events.html#wp178122  We have to add that listener to the Web.xml file 125
  • 126. Native WAS Application - Scheduled Updates <context-param>  Quartz Listener and Basic Parameters for Web.xml  Which gives things like the location of the Quartz properties file <param-name>quartz:config-file</param-name> <param-value>/quartz.properties</param-value> </context-param> <context-param> <param-name>quartz:shutdown-on-unload</param-name> <param-value>true</param-value> </context-param> <context-param> <param-name>quartz:wait-on-shutdown</param-name> <param-value>false</param-value> </context-param> <context-param> 126 <param-name>quartz:start-scheduler-on-load</param-name>
  • 127. Native WAS Application - Scheduled Updates  Next we will create the quartz.properties file in the “WebRoot”  “WEB-INF”  “classes” 127
  • 128. Native WAS Application - Scheduled Updates  And populate it with some defaults 128
  • 129. Native WAS Application - Scheduled Updates  Now we want a servlet for the quartz scheduler “agent manager” to run in.  Open up the web.xml file and add the configuration for a servlet 129
  • 130. Native WAS Application - Scheduled Updates <servlet>  Add the following to the WEB.XML <servlet-name>QuartzInitializer</servlet-name> <servlet-class>  The “<load-on-startup>2</load-onstartup>” means that this servlet starts com.connect2014.ScheduledAgentStarter when the application starts and triggers </servlet-class> the class “init”  You can see the class name that we need to create next in the “<servletclass>” parameter. <init-param> <param-name>shutdown-on-unload</param-name> <param-value>true</param-value> </init-param> 130 <load-on-startup>2</load-on-startup>
  • 131. Native WAS Application - Scheduled Updates  That’s the equivalent to “Agent Manager” set up, now lets do a “Scheduled Agent”, a chunk of code that will start when the web app starts.  First let’s build our base agent by creating a new Class and getting the default quartzScheduler 131
  • 132. Native WAS Application - Scheduled Updates 132
  • 133. Native WAS Application - Scheduled Updates 133
  • 134. Native WAS Application - Scheduled Updates  As you can see the class we created on the last slide extends “HttpServlet” and contains “init”  That means that when the servlet we added to the web.xml starts (when the application starts), it will run the “init” and we can start scheduling 134
  • 135. Native WAS Application - Scheduled Updates Inside the init function of your schedule we now define: 1)A new job (linked to our Class) 1 2)A schedule 3)Link the Job and schedule together 4)Trigger the scheduler i.e. “load Agent manager” 135 2 3 4
  • 136. Native WAS Application - Scheduled Updates – While we are here this is a Crontrigger • http://quartz-scheduler.org/documentation/quartz-2.2.x/tutorials/tutorial-lesson-06 – Very very powerful, but sometimes overly complex • If you need a simpler version, check out “Simple Triggers” • 136 http://quartz-scheduler.org/documentation/quartz-2.2.x/tutorials/tutorial-lesson-05
  • 137. Native WAS Application - Scheduled Updates Also we need to send all the environmental parameters we built before, into the new “Job” we have just created 137
  • 138. Native WAS Application - Scheduled Updates To enable our existing class to be used as a Job, is has to have “implements Job” And it must possess the “execute” method 138
  • 139. Native WAS Application - Scheduled Updates Finally we can now add the code we wrote before to this function as well as pickup all the variables 139
  • 140. Native WAS Application – Build and Deploy Application  Build the Ear file and deploy the application as per previous native application example 140
  • 141. Native WAS Application  Once the Application Starts, it pumps entries to the Actor user’s* activity stream from the domino rest service *(the one who's credentials are supplied) 141
  • 143. Recommendations and Further Reading  As already mentioned neither Connections nor its host, Websphere, are application development platforms in the way Domino is. – You will need to bring your own toolbox of libraries and toolkits to perform many of the functions that you have taken for granted with Domino 143
  • 144. Further reading  When you need: Agent Manager  We Recommend: Quartz (http://quartz-scheduler.org/)  Alternative: java.util.Timer – Simpler but not as powerful – Example: http://www.mkyong.com/java/jdk-timer-scheduler-example/ 144
  • 145. Further reading  When you need: To connect to a Relational Databases (such as the Native Connections Dbs)  We Recommend: Hibernate using JPA  When we moved from Domino to Connections we went from the easy going world of NOSQL and constantly being in a database context to Relational databases and defining our own contexts (most likely DB2)  There are lots of fighting over if you should use a ORM (Object-relational mapping) framework such as JPA or direct SQL, but frankly, its quick, reliable and does not give you grief  See Slide deck on SHOW104 145
  • 146. Further reading  When you need: Make your data accessible as Json  We Recommend: gson https://code.google.com/p/google-gson  Alternatives: Jboss Resteasy (http://www.jboss.org/resteasy) & Jersey (https://jersey.java.net) 146
  • 147. Further reading – ATOM (Connections feeds)  When you need: Talk to Connections (ATOM)  We Recommend: Abdera (http://abdera.apache.org/) 147
  • 148. Further reading - Email  When you need: Send an Email  We Recommend: https://javamail.java.net/nonav/docs/api/  Get the SMTP server details off your admin as they will already be setup for connections (it was in the notifications part of the Connections setup) 148
  • 149. Further reading - Email Properties props = new Properties(); props.put("mail.smtp.host", "my-mail-server"); Session session = Session.getInstance(props, null); try { MimeMessage msg = new MimeMessage(session); msg.setFrom(“sender@ldc.com"); msg.setRecipients(Message.RecipientType.TO, "you@example.com"); msg.setSubject("JavaMail hello world example"); msg.setSentDate(new Date()); 149 msg.setText("Hello, world!n");
  • 150. Further reading – Homework  If you think you have a handle on all of this, your next stops to be a “Proper” Java Developer are – Maven build management (http://maven.apache.org/) – Source Control - Git/Github (http://git-scm.com/ & https://github.com/) – Continuous integration - Jenkins (http://jenkins-ci.org/) – A Web framework (Spring http://spring.io/ , Grails, Vaadin https://vaadin.com/ , GWT, Wicket, Play, Struts and JSF) – Spring Annotations to make use of modern Java and reduce the amount of code you have to write 150
  • 151.  Access Connect Online to complete your session surveys using any: – Web or mobile browser – Connect Online kiosk onsite 151
  • 152. Acknowledgements and Disclaimers Availability. 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. The workshops, sessions and materials have been prepared by IBM or the session speakers and reflect their own views. They are provided for informational purposes only, and are neither intended to, nor shall have the effect of being, legal or other guidance or advice to any participant. While efforts were made to verify the completeness and accuracy of the information contained in this presentation, it is provided AS-IS without warranty of any kind, express or implied. IBM shall not be responsible for any damages arising out of the use of, or otherwise related to, this presentation or any other materials. Nothing contained in this presentation 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. All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved. Actual environmental costs and performance characteristics may vary by customer. 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. © Copyright IBM Corporation 2014. All rights reserved.  U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.  IBM, the IBM logo, ibm.com, Websphere and IBM Domino, IBM Connections, IBM Websphere Application Server, DB2 are trademarks or registered trademarks of International Business Machines Corporation in the United States, other countries, or both. If these and other IBM trademarked terms are marked on their first occurrence in this information with a trademark symbol (® or ™), these symbols indicate U.S. registered or common law trademarks owned by IBM at the time this information was published. Such trademarks may also be registered or common law trademarks in other countries. A current list of IBM trademarks is available on the Web at “Copyright and trademark information” at www.ibm.com/legal/copytrade.shtml  MyEclipse Blue and Other company, product, or service names may be trademarks or service marks of others. 152