3. Who Am I ? : Mark Myers
ï§ Member of the London Developer Co-op http://www.londc.com
â A group of freelance developers that band together to build more
complex projects.
â IBM Connections, Domino, Mobile and Web development
â Hire me!
ï§ Developer from a support background
ï§ 13+ years on Domino, 16+ years in IT
ï§ Speaker at 5x Lotuspheres/Connects, 5 x UKLUGs, 1 x ILUG,
2 x BLUG/Engage
ï§
5. What is this Session about?
ï§ Its about being able to write a core app and deploy it on any server with a Java core
â It does not even need to be a Java app, this works just as well for pure client side websites using
popular client side JavaScript frameworks eg, AngluarJS, backbone.
â This also means you can use your preferred IDE, ie sublime text for AngularJS
ï§ As IBM develops new apps and brings out new platforms, you want to be able to develop
for them without putting all your eggs in one basket (this is good for IBM as it lowers the
investment cost for partners to developer for their platforms)
ï§ We used to take each new standard and framework and try and glue it to Domino, now we
can speed up that process and glue it to any part of the IBM stack. <cough> BlueMix
<cough> or even expand our apps to other providers
6. What Software are we using?
ï§ IDE: Eclipseâą Luna for EE https://www.eclipse.org/downloads/packages/eclipse-ide-java-
ee-developers/lunasr1a
â Vaadin Plugin https://vaadin.com/eclipse
â ApacheÂź TomcatÂź V8 http://tomcat.apache.org/download-80.cgi
ï§ IBMÂź DominoÂź 9.0.1
ï§ IBMÂź WebSphereÂź 8.5.5 (Not the Liberty Profile, the full server as used by Connections)
8. Basic Vaadin Application
ï§ Why Use Vaadin for this demo?
â It is one of the best frameworks in terms of features ( both client side and server side logic)
â Easy for Domino People to pick up, as of all the current frameworks it seems to work the nearest
of Domino and Xpages.
â Uses a single servlet and deploys as a standard WAR application (Web application ARchive)
â Complex in terms of infrastructure (not a hello world platform)
â Its not a client end framework e.g AngularJS
9. Basic Vaadin Application
ï§ Once you have added the Vaadin Plugin
ï§ Select âFileâ ï âNewâ and select âVaadin
7 Projectâ
10. Basic Vaadin Application
ï§ Give the Project a name and leave the Target runtime as
â<None>â and accept defaults on the rest of the options
ï§ Accept the default build Directory
12. Basic Vaadin Application
ï§ If this is your first time building a Vaadin App it will
download a load of backend framework stuff, donât worry
just let it run. (we will come back to why that is important
later)
ï§ You now have a clean
new WAR app, lets
deploy it.
14. Apache: Setup
ï§ Globally considered the baseline for Java Application Servers
ï§ The Most popular Java Application Server on the Internet
â https://plumbr.eu/blog/most-popular-application-servers-in-2014
ï§ Very easy going and light weight
15. Apache: Setup
ï§ Download Tomcat from
http://tomcat.apache.org/download-
80.cgi
ï§ Upzip the Download and place it
somewhere sensible.
16. Apache: Setup
ï§ Go Back To Eclipse, Select the âServersâ
tab
ï§ Click to the Link to Create a New Server
Config
17. Apache: Setup
ï§ Select Apache / Tomcat v8.0 from the list
ï§ Browse to the directory you unzipped
Tomcat to and select it.
18. Apache: Setup
ï§ To deploy an app in eclipse, right click
on the application root
ï§ Select âRun Asâ ï âRun on Serverâ
19. Apache: Setup
ï§ The â3ServerDemoâ will be listed in
the Available column, add it to the
âConfiguredâ column.
23. WebSphere: Setup
ï§ The core of the IBM stack
ï§ The Liberty profile is a very light weight version of the full WebSphere server.
â Perfect for local development.
â From the point of view of the type of applications we are discussing here WebSphere and the
liberty profile are interchangeable.
â We are not using it here just to prove a point as Connections development is one of our primary
use cases and Connections uses the full WebSphere server.
24. WebSphere: Setup
ï§ We are assuming you have installed
WebSphere 8.5.5 locally
â A typical install accepting all defaults
ï§ After that we will want to install the IBM
WebSphere plugin for Eclipse
ï§ This is in the âEclipse Marketplaceâ rather
than under the âInstall New Softwareâ
25. Websphere: Setup
ï§ Search for IBM and select âinstallâ on
âIBM WebSphere Application Server
V8.5x Developer Toolsâ
26. WebSphere: Setup
ï§ You only need the âWebSphere
Application Server V8.5 Toolsâ but the
other tools are useful.
ï§ Select âConfirmâ.
27. Websphere: Setup
ï§ Once the tools have installed and Eclipse
restarted.
ï§ On the âServersâ tab right click, and
select âNewâ ï Server
28. WebSphere: Setup
ï§ Select âWebSphere Application Server V8.5â
ï§ Accept All defaults
ï§ Select âFinishâ
29. WebSphere: Setup
ï§ Browse to the servers AppServer directory (it
will auto fill the JRE Setting)
â Note: This JRE has to be a version equal or
higher than the Compile version of the
application
30. WebSphere: Setup
ï§ You will find that when you try to
run the WAR app on WebSphere in
the same way as you did for
Tomcat that no applications will be
Listed
ï§ You need to create a EAR wrapper
32. WebSphere: Setup
ï§ Give the EAR project a suitable name,
and select the âTarget runtimeâ
ï§ Click âNextâ
33. WebSphere: Setup
ï§ Now select the actual app that will be
inserted into the EAR application
ï§ If you want to keep all the Application
settings within the core application then
do not select âGenerate application.xml
deployment descriptorâ
34. WebSphere: Setup
ï§ Now you will find, that when you try to
run the application on WebSphere you
have a available Application.
35. WebSphere: Setup
ï§ The Application in now running on
WebSphere
ï§ Be still my beating heart part 2
37. Connections: Setup
ï§ The connections box can take any of the apps you build (Its just a WebSphere box after
all)
â Donât forget that connections is a heavy duty application adding additional apps to the same box
has to be done carefully, make sure you work out the maximum load your app is going to add and
keep Admins informed.
â You should use the Connections APIâs for most things but you DO gain access to the
Connections DB2 databases (by their well known JDBC names), and they grant you a great deal
of power and speed
âą Do not do this without telling your admin.
M
38. Connections: Setup
ï§ If you are adding a new app to connections with a new context i.e. the âdirectoryâ the site
runs in (in this case â3ServerDemoâ)
ï§ You will find the URL will not work when you first try and open the website.
ï§ You will have to use wsadmin to re-sync the application servers
LCConfigService.checkInConfig("d:",AdminControl.getCell())
LCConfigService.updateConfig("versionStamp","")
39. Connections: Setup
ï§ Integration at the users end is done with widgets, either the âOpen Socialâ widget
standard or iwidgets
â See the slides for MAS202 to tell the difference.
ï§ An Example of a BASIC âOpen Socialâ wrapper, that you can use to point to your own
content within your own app
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title=âServerDemoâ author_email=support@3ServerDemo.com height=â500â width=â100%">
<Require feature="dynamic-height" />
</ModulePrefs>
<Content href="/3ServerDemo" type="url" view="canvas" /></Module>
40. Connections: Setup
ï§ And a BASIC iwidget wrapper, that you can use to point to your own content within
your own app
<?xml version="1.0" encoding="UTF-8" ?>
<iw:iwidget name=â3ServerDemo" xmlns:iw="http://www.ibm.com/xmlns/prod/iWidget" iScope="htmlWidget" supportedModes="view" mode="view">
<iw:content mode="view">
<![CDATA[
<iframe src="/3ServerDemo/" scrolling="auto" width="100%" height="3000px" frameborder="0" scrolling="no"></iframe>
]]>
</iw:content>
</iw:iwidget>
41. Connections: Setup
ï§ Put the iwidget xml file in the WEB-INF directory
ï§ You can use this to add a widget to Connections with the URL
http://servername/3ServerDemo/iwidgetlink.xml
43. Domino: Setup
ï§ Take advance of the latest frameworks while still being able to leverage all your existing
domino data and features with easy NSF data and security access.
ï§ This has been done multiple times before 2 excellent reference presentations are:
â https://speakerdeck.com/sbasegmez/bp207-meet-the-java-application-server-you-already-own-
ibm-domin
â http://www.slideshare.net/fiorep/domino-osgi-development
44. Domino: Getting Existing Web Applications Running on Domino via OSGI
ï§ Method 1 â Copy existing App components over then glue the app back into a new Plug in
Project
â Pros:
âą Easy to work out what's going out (mixing project dependency's + OSGI is horrible)
âą If you have resource conflicts caused by dependency injection tools, you might have to do an
export as WAR to get the jars matching entries in MANIFEST.MF
â Cons
âą Not very elegant
ï§ Method 2 - Migrate your Existing Application to a plug-in project
â Pros:
âą Impressive and fast when it works.
â Cons:
âą Horribly confusing to get right if you donât know what your OSGI config should look like
45. Domino: Setup
ï§ Lets do Method 1
ï§ In Eclipse click âNewâ ï âPlug-in Projectâ
46. Domino: Setup
ï§ In Eclipse click âNewâ
ï âPlug-in Projectâ
ï§ Select âEquinoxâ as
your framework
ï§ Generate an Activator
47. Domino: Setup - Update
ï§ Next copy your âsrcâ and âWebContentâ from your
original project to
ï§ This is only because we are using a Java backend
framework (worst Case scenario)
â If we were using only front end frameworks, you
would only have to copy the âWebContentâ
Directory
48. Domino: Setup - Update
ï§ Now Import the Notes.jar
â File ï Import
â Select the file system and get
the Notes.jar file from the ext
directory
49. Domino: Setup - Update
ï§ Your MANIFEST.MF will tend to take a lot of
work until you get used to it,
ï§ Once you are happy with it, It is
recommended you just manually edit it
rather than using the GUI
The Jar files you copied over from your original project
50. Domino: Setup - Update
ï§ Next to ensure you have all
required system libs, check the
facets view for both projects to
ensure they are the same
â Right click on the project root ï
Properties and select Project
Facets
51. Domino: Setup - Update
ï§ That will give you a valid project that can be used in conjunction with
â 1- A eclipse feature site
â 2- Then an eclipse update site
â 3- Then the Domino update site
ï§ Be Still my beating heart part 3
Iâm not going to go though it as
its been done in a presentation
every year for the last 3 years at
this conference. Zzzzzz
53. Multi Authentication
ï§ With the increased emphasis on security due to recent breaches, your application often
has to deal with multiple forms of security.
ï§ Despite common standards if you are going to support different servers you have to cater
to different authentication mediums.
ï§ Once you have made the initial effort to handle different forms of authentication as dictated
by the server platforms, then adding multiple ones becomes progressively easier.
54. Multi Authentication
ï§ Enterprise applications now often
compare poorly against
consumer websites which take
multiple forms of authentication.
55. Multi Authentication: Example
if (isDomino) {
Session userSession = DominoResource.INSTANCE.getUserSession(username.getValue(), password.getValue());
if (null == userSession || !userSession.isValid()) {
//Report system Error
} else {
AppSession appSession = SessionUtils.populateFromDominoSession(userSession)
}
} else {
LDAPLogon lDAPLogon = new LDAPLogon();
LdapContext userCTX = lDAPLogon.getUserCtx(username.getValue(), password.getValue());
if (null == userCTX) {
//Report system Error
} else {
LDAPUtils ldap = new LDAPUtils(username.getValue(), LDAPResource.INSTANCE.getCtx());
AppSession appSession = SessionUtils.populateFromLDAP(ldap)
}
56. Multi Authentication
ï§ Pros
â Allows greater integration into a clients system.
â If a client is migrating from one system to another your systems will not be a bottleneck in the
process.
â Can allow you to log on to multiple systems simultaneously.
ï§ Cons
â Can slow down the login process
â A systems wide unique identifier is sometimes hard to achieve
âą You would not believe how many times email address is not suitable.
58. Data Abstraction
ï§ Just about all data storage is actually an abstraction layer (such as http://hibernate.org/ )
ï§ If you are considering support for multiple platforms, then providing your own functional
abstraction layer can be very useful.
â You design how you want the data to be handled in your app and deal with the actual nuts and
bold of storage latter, which makes your storage more agnostic.
ï§ When doing a data abstraction, it is best to sit down and work out exactly how and what
you are wanting to store and read
ï§ If you have created an API then its easy to use the same functions as a data abstraction
and vs versa, so you may have done all the hard work.
59. Data Abstraction
Create Order
Internal Order
Object
ï§ Reference No
ï§ Status
ï§ Address
ï§ Items
ï§ Etc..
DB2 Order
Table
MongoDb
Collection
NSF
Database
Create DB2
Order
Create
MongoDb
Order
Create NSF
Order
60. Data Abstraction: Example
public OrderStatus createOrder(Order currentOrder, String requestingUser) {
try {
if (isDomino) {
return dominoStore.createOrder( currentOrder, requestingUser) ;
} else(isWebSphere) {
return db2Store.createOrder( currentOrder, requestingUser);
} else {
return mongoStore.createOrder( currentOrder, requestingUser);
}
} catch (Exception e) {
e.printStackTrace();
return OrderStatus.ORDER_CREATE_FAIL;
}
}
There is no mention of
database connections or
tables or SQL or sessions
or anything specific to a
single storage medium
61. Data Abstraction
ï§ Pros
â Grants flexibility to changing backend storage
â Makes you think about storage rather than just stuffing data into a database
â Once you have done it once, its easy to reuse.
â Allows soft rollouts of new platforms.
â Easier to work on large teams as it separates workflow and storage.
ï§ Cons
â Adding an extra field etc takes much longer.
â It can get complex and cause performance issues if done badly
âą Think about the difference between real workflow and storage workflow eg search
â Different platforms can have features that another does not have (eg. Blob storage)
63. Summary
ï§ Given the speed that both frameworks and platforms change, you need to provide the most
flexibility you can without sacrificing functionality, all the while ensuring you can pivot if
needed.
â This can be seen in the mobile market where companies tying them selves to a single platform
limit their long term growth, the same rule applies to any application market.
ï§ Gluing frameworks onto frameworks is both slow and clunky, taking a few steps back and
building your apps on as clean a system as possible means change is easier, and you can
get for more return on investment.