SlideShare ist ein Scribd-Unternehmen logo
1 von 105
Downloaden Sie, um offline zu lesen
AD-1387
Outside The Box: Integrating with Non-
Domino Apps using XPages and Java
Julian Robichaux, panagenda
Kathy Brown, PSC Group
Who Are We?
• Kathy Brown
▪ Senior Consultant, PSC Group LLC
▪ IBM Champion
▪ @IamKathyBrown
▪ runningnotes.net
Who Are We?
• Julian Robichaux
▪ Senior Application Developer, panagenda
▪ IBM Champion
▪ @jrobichaux
▪ nsftools.com
Why Are We Here?
• Application integration
▪ Get data from other places
▪ Put data in other places

• Ideally this will be invisible to the end-user

• We will show you high-level detail (and code!) in this
presentation, even more is in the sample database available for
download
What Will We Be Using?
• IBM Domino® Server 9.0.1 FP4

• IBM Domino Designer (DDE) 9.0.1 FP4

• Java 1.6 (as included with Domino and DDE)

• XPages

• Other bits and bobs as mentioned throughout the presentation
Bridging the Gap: Converting
Data to Java Objects
Data Basics
• Before we start getting data, let’s talk about what the data
usually looks like
▪ XML
▪ JSON
▪ CSV

• But Java is made of objects…

• How do we convert from structured data to objects?
Easy And Old School: CSV
• Comma-separated values

• Simple data format, been used for years, still very common

• Boooorrrriiiinnnngg
▪ yawn

• Stick with us, this will make the other (COOLER) examples
easier to understand
Here’s What Our CSV Data Looks Like
"title","studio","year","adjustedRevenue","unadjustedRevenue"
"Gone With The Breeze","NGN",1939,1750000000,200000000
"Star Battles","Foz",1977,1500000000,450000000
"The Sound Of MP3s","Foz",1965,1250000000,160000000
"I.T.: The Computer Guys","Univixen",1982,1200000000,425000000
"Titantuan","Parallax",1997,1150000000,650000000
And Our Corresponding Java Object
public class MovieBean {
private String title;
private String studio;
private int year;
private int adjustedRevenue;
private int unadjustedRevenue;
public MovieBean() {}
public String getTitle() { return title; }
public void setTitle(String title) { this.title = title; }
public String getStudio() { return studio; }
public void setStudio(String studio) { this.studio = studio; }
public int getYear() { return year; }
public void setYear(int year) { this.year = year; }
public int getAdjustedRevenue() { return adjustedRevenue; }
public void setAdjustedRevenue(int adjustedRevenue) { this.adjustedRevenue = adjustedRevenue; }
public int getUnadjustedRevenue() { return unadjustedRevenue; }
public void setUnadjustedRevenue(int unadjustedRevenue) { this.unadjustedRevenue = unadjustedRevenue; }
}
Java Beans!
• Java Beans are just Java objects with:
▪ private fields
▪ getter and setter methods 

to access the fields
▪ a “no-arg” constructor

• Perfect for representing 

structured data elements
public class EasyBean {
private String name;
private int count;
public EasyBean() {}
public String getName() { return name; }
public void setName(String name) {
this.name = name;
}
public int getCount() { return count; }
public void setCount(int count) {
this.count = count;
}
}
The Bean And Its Data
public class MovieBean {
private String title;
private String studio;
private int year;
private int adjustedRevenue;
private int unadjustedRevenue;
public MovieBean() {}
public String getTitle() { return title; }
public void setTitle(String title) { this.title = title; }
public String getStudio() { return studio; }
public void setStudio(String studio) { this.studio = studio; }
public int getYear() { return year; }
public void setYear(int year) { this.year = year; }
public int getAdjustedRevenue() { return adjustedRevenue; }
public void setAdjustedRevenue(int adjustedRevenue) { this.adjustedRevenue = adjustedRevenue; }
public int getUnadjustedRevenue() { return unadjustedRevenue; }
public void setUnadjustedRevenue(int unadjustedRevenue) { this.unadjustedRevenue = unadjustedRevenue; }
}
"title","studio","year","adjustedRevenue","unadjustedRevenue"
"Gone With The Breeze","NGN",1939,1750000000,200000000
"Star Battles","Foz",1977,1500000000,450000000
"The Sound Of MP3s","Foz",1965,1250000000,160000000
"I.T.: The Computer Guys","Univixen",1982,1200000000,425000000
"Titantuan","Parallax",1997,1150000000,650000000
From Data To Bean
• Option 1: Parse the data manually, create objects manually

• Option 2: Use a library that parses the data for you into rows
and columns, put the row data into objects

• Option 3: Use a library that puts the data directly into objects
for you!
▪ referred to as “unmarshalling” or “deserialization”
▪ or “reading” or “parsing”, if that seems confusing
OpenCSV Library
• OpenCSV
▪ http://opencsv.sourceforge.net
▪ Open source, Apache licensed
▪ Tiny file size (14k or 42k, depending on version)

• We will use an older version 2.3, because that is compatible
with Java 6
▪ Latest version 3.6 is compiled for Java 7+
▪ java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version;
Add JAR File to Database
OpenCSV Parsing Code
public static List convertCSV(String csvText) {
try {
CSVReader reader = new CSVReader(new StringReader(csvText));
ColumnPositionMappingStrategy<MovieBean> strat =
new ColumnPositionMappingStrategy<MovieBean>();
strat.setType(MovieBean.class);
String[] columns = new String[] {
"title", "studio", "year", "adjustedRevenue", "unadjustedRevenue"};
strat.setColumnMapping(columns);
CsvToBean csv = new CsvToBean();
List list = csv.parse(strat, reader);
return list;
} catch (Exception e) {
// log this!
return null;
}
}
Awesome! What Did We Learn?
• Use Java Beans to hold data

• Use unmarshalling to avoid manual effort

• Let libraries do the work for you!
▪ to a degree… it’s always a trade-off
XML: Manual Parsing
• Java has plenty of XML support built-in
▪ DOM, SAX, and STaX for parsing
▪ XPath for selecting sets of nodes

• Using these, we can manually read an XML file (or string) and
put all the information piece-by-piece into objects

• Or…
JAXB
• Java Architecture for XML Binding (JAXB)

• Easily marshal and unmarshal between Java objects and XML

• Included with Java 6+
▪ Nothing extra to install for XPages

• Use Annotations in the Java Bean source code to indicate
which XML elements map to which fields
The XML
<moviedata>
<movie>
<title>Gone With The Breeze</title>
<studio>NGN</studio>
<year>1939</year>
<adjusted>1750000000</adjusted>
<unadjusted>200000000</unadjusted>
</movie>
<movie>
<title>Star Battles</title>
<studio>Foz</studio>
<year>1977</year>
<adjusted>1500000000</adjusted>
<unadjusted>450000000</unadjusted>
</movie>
<movie>
<title>The Sound Of MP3s</title>
<studio>Foz</studio>
<year>1965</year>
<adjusted>1250000000</adjusted>
<unadjusted>160000000</unadjusted>
</movie>
<movie>
<title>I.T.: The Computer Guys</title>
<studio>Univixen</studio>
<year>1982</year>
<adjusted>1200000000</adjusted>
<unadjusted>425000000</unadjusted>
</movie>
<movie>
<title>Titantuan</title>
<studio>Parallax</studio>
<year>1997</year>
<adjusted>1150000000</adjusted>
<unadjusted>650000000</unadjusted>
</movie>
</moviedata>
Java Bean to Hold Multiple Movies
package connect16.example.data;
import java.util.ArrayList;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name="moviedata")
public class MovieBeanList {
private ArrayList<MovieBean> movies =
new ArrayList<MovieBean>();
@XmlElement(name="movie")
public ArrayList<MovieBean> getMovies() {
return movies;
}
public void setMovies(ArrayList<MovieBean> movies) {
this.movies = movies;
}
}
<moviedata>
<movie>
<title>Gone With The Breeze</title>
<studio>NGN</studio>
<year>1939</year>
<adjusted>1750000000</adjusted>
<unadjusted>200000000</unadjusted>
</movie>
. . .
</moviedata>
MovieBean Annotations
@XmlElement(name="title")
public String getTitle() { return title; }
public void setTitle(String title) {
this.title = title; }
@XmlElement(name="studio")
public String getStudio() { return studio; }
public void setStudio(String studio) {
this.studio = studio; }
@XmlElement(name="year")
public int getYear() { return year; }
public void setYear(int year) { this.year = year; }
@XmlElement(name="adjusted")
public int getAdjustedRevenue() { return adjustedRevenue; }
public void setAdjustedRevenue(int adjustedRevenue) { this.adjustedRevenue = adjustedRevenue; }
@XmlElement(name="unadjusted")
public int getUnadjustedRevenue() { return unadjustedRevenue; }
public void setUnadjustedRevenue(int unadjustedRevenue) { this.unadjustedRevenue = unadjustedRevenue;
}
<moviedata>
<movie>
<title>Gone With The Breeze</title>
<studio>NGN</studio>
<year>1939</year>
<adjusted>1750000000</adjusted>
<unadjusted>200000000</unadjusted>
</movie>
. . .
</moviedata>
XML Parsing Code
public static MovieBeanList convertXML(String xml) {
try {
// see @XML annotations on Java beans
JAXBContext jc = JAXBContext.newInstance(MovieBeanList.class);
Unmarshaller unmarshaller = jc.createUnmarshaller();
MovieBeanList movies = (MovieBeanList)unmarshaller.unmarshal(
new StringReader(xml));
return movies;
} catch (Exception e) {
// log this!
return null;
}
}
And One More Time With JSON
• A JSON parsing library is included with the XPages libraries
▪ com.ibm.commons.util.io.json.JsonParser

• It reads JSON into Java Maps and Lists, not custom objects

• Some third-party libraries have unmashalling support (GSON,
FlexJSON) but cause security exceptions
▪ You can get around this, but it’s not always convenient

• So I wrote my own generic unmarshalling code
The JSON
[{"movie": {
"title": "Gone With The Breeze",
"studio": "NGN",
"year": 1939,
"adjusted": 1750000000,
"unadjusted": 200000000
}},
{"movie": {
"title": "Star Battles",
"studio": "Foz",
"year": 1977,
"adjusted": 1500000000,
"unadjusted": 450000000
}},
{"movie": {
"title": "The Sound Of MP3s",
"studio": "Foz",
"year": 1965,
"adjusted": 1250000000,
"unadjusted": 160000000
}},
{"movie": {
"title": "I.T.: The Computer Guys",
"studio": "Univixen",
"year": 1982,
"adjusted": 1200000000,
"unadjusted": 425000000
}},
{"movie": {
"title": "Titantuan",
"studio": "Parallax",
"year": 1997,
"adjusted": 1150000000,
"unadjusted": 650000000
}}
]
Small Change to MovieBean
@XmlElement(name="adjusted")
public int getAdjustedRevenue() { return adjustedRevenue; }
public void setAdjustedRevenue(int adjustedRevenue) { this.adjustedRevenue = adjustedRevenue; }
public void setAdjusted(int adjustedRevenue) { this.adjustedRevenue = adjustedRevenue; }
@XmlElement(name="unadjusted")
public int getUnadjustedRevenue() { return unadjustedRevenue; }
public void setUnadjustedRevenue(int unadjustedRevenue) { this.unadjustedRevenue = unadjustedRevenue; }
public void setUnadjusted(int unadjustedRevenue) { this.unadjustedRevenue = unadjustedRevenue; }
{"movie": {
"title": "Gone With The Breeze",
"studio": "NGN",
"year": 1939,
"adjusted": 1750000000,
"unadjusted": 200000000
}}
added setAdjusted() and
setUnadjusted() to map to
JSON field names
JSON Parsing Code
public static List convertJSON(String json) {
try {
Object stuff = JsonParser.fromJson(JsonJavaFactory.instance, json);
List list = buildObjectFromJSON(MovieBean.class, stuff);
return list;
} catch (Exception e) {
// log this!
return null;
}
}
Pros and Cons
• Pros
▪ Less code (on your part)
▪ Reduce or eliminate hardcoded mappings

• Cons
▪ Harder to debug if things go wrong
▪ Be very diligent about responding to Exceptions and checking the
data in the beans that are created
Caveats and Tips
• Some code that works for XPages will not work for Java Agents
▪ access to different external libraries
▪ default compiler level on agents is still Java 1.4

• Trap (and log) your errors!
▪ keep a copy of the “bad” JSON/XML when possible for analysis

• These Java Beans are not quite the same as XPages Managed
Beans — but you should learn to use those too!
Bridging the Gap (part deux):
Putting Java Objects on an XPage
So We’ve Got Objects… Now What?
• How do we display these things?

• The brute force way is by using XAgents or similar:
XAgent
<?xml version="1.0" encoding="UTF-8"?>
<xp:view
xmlns:xp="http://www.ibm.com/xsp/core"
rendered="false">
<xp:this.afterRenderResponse><![CDATA[#{javascript:
importPackage(connect16.example.data);
var data = "Result: " + Test.convertJSON();
var externalContext = facesContext.getExternalContext();
var writer = facesContext.getResponseWriter();
var response = externalContext.getResponse();
response.setHeader("Cache-Control", "no-cache");
writer.write("<pre>" + data + "</pre>");
writer.endDocument()
}]]></xp:this.afterRenderResponse></xp:view>
XPages Data Tables Are An Option
• You can use Java Arrays or Lists as input

• Automatically uses each item in the Array/List as a row in a
table

• Customize column values for each row based on item data

• You can even include a pager control
Data Table Example
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:dataTable rows="30" id="movieTable" var="movie" style="width:50%">
<xp:this.value><![CDATA[#{javascript:connect16.example.data.Test.convertJSON();
}]]></xp:this.value>
<xp:column id="titleColumn">
<xp:text escape="true" id="titleField" value="#{movie.title}">
</xp:text>
</xp:column>
<xp:column id="studioColumn">
<xp:text escape="true" id="studioField" value="#{movie.studio}">
</xp:text>
</xp:column>
<xp:column id="yearColumn">
<xp:text escape="true" id="yearField" value="#{movie.year}">
</xp:text>
</xp:column>
</xp:dataTable>
</xp:view>
returns an ArrayList of MovieBeans
MovieBean fields
(you can also use
class methods)
Data Table Example
Repeat Controls and more
• Using a bean allows you to use expression language
▪ Expression language allows you to populate:
• a repeat control
• input fields
• really anything in XPages where you can use expression language

▪ Pros and cons for using managed beans, check out:
• http://www.slideshare.net/RussellMaher/jmp402
Bootstrapped Repeat on Managed Bean Example
<xp:repeat id="repeat1" rows="30" var="mymovies"
value="#{MovieBeanList.movies}">
<tr><td>
<xp:text escape="true" id="inputText2" value="#{mymovies.title}">
</xp:text>
</td><td>
<xp:text escape="true" id="inputText1" value="#{mymovies.studio}">
</xp:text>
</td><td>
<xp:text escape="true" id="inputText3" value="#{mymovies.adjustedRevenue}">
</xp:text>
</td><td>
<xp:text escape="true" id="inputText4" value="#{mymovies.unadjustedRevenue}">
</xp:text>
</td><td>
<xp:text escape="true" id="inputText5" value="#{mymovies.year}">
</xp:text>
</td></tr>
</xp:repeat>
Bootstrapped Repeat on Managed Bean Example
Okay, Let’s Go Get Some Data!
Simple Stuff: Data From A URL
• When we access other servers, we often do it as though we are
accessing a URL
▪ port 80 and 443 are almost always open for traffic
▪ REST services (we’ll talk about that next!) usually are URL
requests
▪ a lot of convenient and well-understood security has been built on
top of HTTP

• So how hard is it to get data from a URL in Java?
Java URL Fetch: Ridiculously Simple Example
URL url = new URL("http://server/data.xml");
InputStream in = url.openStream();
something has to read the stream,
but that’s all there is (in a basic sense)
What’s An InputStream?
• An InputStream is a “stream” of bytes

• Often sent in chunks, so you don’t have to have the entire
contents of the stream in memory unless you want to

• Commonly accepted and understood by Java methods
XML As An InputStream
URL url = new URL("https://server/data.xml");
InputStream in = url.openStream();
JAXBContext jc = JAXBContext.newInstance(MovieBeanList.class);
Unmarshaller unmarshaller = jc.createUnmarshaller();
MovieBeanList movies = (MovieBeanList)unmarshaller.unmarshal(in);
Converting Bytes To Strings
• What if your Java method needs a String?
▪ or a Reader

• Use an InputStreamReader… BUT

• Mind your character sets!
▪ Java uses the default system character set by default
▪ According to spec, JSON is supposed to be sent as Unicode
(usually UTF-8): https://tools.ietf.org/html/rfc4627
JSON As A Reader
URL url = new URL("https://server/data.js");
InputStream in = url.openStream();
BufferedReader reader = new BufferedReader(
new InputStreamReader( in, "UTF-8" ));
Object stuff = JsonParser.fromJson(JsonJavaFactory.instance, reader);
CSV As A Reader
URL url = new URL("https://server/data.csv");
InputStream in = url.openStream();
BufferedReader reader = new BufferedReader(
new InputStreamReader( in, "UTF-8" ));
CSVReader csv = new CSVReader(reader);
If You Really Really Want A String
URL url = new URL("https://server/data.txt");
BufferedReader reader = new BufferedReader(
new InputStreamReader( url.openStream(), "UTF-8" ));
StringBuilder sb = new StringBuilder();
char[] buffer = new char[1024];
int size = 0;
while ( (size = reader.read(buffer)) > 0 ) {
sb.append(buffer, 0, size);
}
reader.close();
String stuff = sb.toString();
Is That All You Have To Do?
• Well…
▪ proxy servers
▪ authentication
▪ SSL certificates
▪ POST requests and headers

• Examples of all those things in the sample database

• When you use other libraries (like the SocialSDK, coming up!)
these things are often taken care of for you
Domino Security For Network (and File) Access
• You must have the following permissions in the Security section of
the Server doc to access the network:
▪ EITHER: run unrestricted
▪ OR: sign XPages 

AND run restricted



• This is the signature of the XPage AND all associated resources
▪ referenced controls, JS libraries, Java code, attached JAR files
▪ if any one of those things doesn’t have access, the XPage will fail
▪ HTTP Web Server: You are forbidden to perform this operation
REST Service Example
• REST = Representational State Transfer

• There are a lot of finer points to a proper REST service, but for
the purpose of our examples it will be:
▪ using a URL + HTTP to get information
▪ using a URL + HTTP to send information
Simple REST Service Example
public static MovieBeanList getMoviesFromREST()
throws IOException, JAXBException {
String restURL = "http://server/movieService.php?count=5&output=xml";
URL url = new URL(restURL);
InputStream in = url.openStream();
JAXBContext jc = JAXBContext.newInstance(MovieBeanList.class);
Unmarshaller unmarshaller = jc.createUnmarshaller();
return (MovieBeanList)unmarshaller.unmarshal( in );
}
Simple REST Service Example
public static void createDocs(Database db) {
try {
MovieBeanList movies = getMoviesFromREST();
for (MovieBean movie : movies.getMovies()) {
Document doc = db.createDocument();
doc.replaceItemValue("Form", "MovieData");
doc.replaceItemValue("Title", movie.getTitle());
doc.replaceItemValue("Studio", movie.getStudio());
doc.replaceItemValue("Year", movie.getYear());
doc.save();
doc.recycle();
}
} catch (Exception e) {
// log this!
}
}
IBM SocialSDK
IBM SocialSDK (aka Social Business Toolkit SDK)
• What is it?
▪ A toolkit, provided by IBM, to integrate with Connections,
Connections Cloud, Dropbox, Facebook, Twitter, and more
▪ Originally part of the XPages Extension Library, split off to its own
project in 2013

• Download from OpenNTF or Github
▪ https://openntf.org/p/Social+Business+Toolkit+SDK
▪ https://github.com/OpenNTF/SocialSDK/releases
IBM SocialSDK (aka Social Business Toolkit SDK)
• What’s included?
▪ Toolkit files
▪ OAuth* code
▪ Examples
▪ Sample XPages application
▪ Also has components for WebSphere and Tomcat
*OAuth
• A quick word about OAuth
▪ Many APIs require OAuth
▪ OAuth authentication is handled in the Social Business Toolkit
▪ BUT it’s still a really really good thing to understand
▪ http://www.slideshare.net/dominopoint/dd12-oauth-for-domino-
developers
IBM SocialSDK Install
• How to install
▪ IBM Getting Started - https://www-10.lotus.com/ldd/lcwiki.nsf/dx/
Installing_on_Domino_Server_SDK1.0
• using an UpdateSite database
• doesn’t load? See http://johnjardin.ukuvuma.co.za/2012/05/04/xpages-tip-
what-to-check-when-domino-doesnt-install-osgi-plugins-from-updatesite 

▪ Circular reference! http://xomino.com/2015/03/08/ibmsbt-in-xpages-
getting-set-up-with-a-social-business-toolkit-part-1/
• using file copy technique
• method may not be “best practice”, but it will get you up and running
IBM SocialSDK (Quick Install Version)
• Unzip the file from OpenNTF
• Install the plugin in Designer
• Set up an update site OR find the “Features” and “Plugins” folders in the
archive and place on your server
▪ datadominoworkspaceapplicationseclipse
• Re-start server
• Register your app for OAuth (if needed)
• Open the XPagesSBT.nsf to check that the plugin is working
▪ May need to update the endpoints
▪ http://xomino.com/2015/03/10/ibmsbt-in-xpages-getting-set-up-with-a-social-
business-toolkit-part-2/
IBM SocialSDK - What Can You Do?
• Activities
• Bookmarks
• Communities
• Files
• Forums
• Profiles
• and more
http://www.ibmpressbooks.com/store/xpages-extension-library-a-step-by-step-guide-to-the-9780132901819
old but still
useful
(chapter 13)
apps.na.collabserv.com
Use the API
• Javadocs:
▪ http://infolib.lotus.com/resources/social_business_toolkit/javadoc
▪ Source code: https://github.com/OpenNTF/SocialSDK 

• Examples:
▪ XPagesSBT.nsf
▪ https://greenhouse.lotus.com/sbt/sbtplayground.nsf/
JavaScriptSnippets.xsp
▪ https://greenhouse.lotus.com/sbt/sbtplayground.nsf/JavaSnippets.xsp
▪ search for “niklas heidloff sbt demo"
Adding Connections Functionality to Your DB
• Copy the following design elements from XPagesSBT.nsf to your database:
▪ _BasicLogin (XPage)
▪ sbtLoginPanel (Custom Control)
▪ sbtLoginPage (Custom Control)
• Open faces-config.xml in XPagesSBT.nsf
▪ copy the <managed-bean> info under "Greenhouse Connections" and add it to the
face-config.xml file in your database
▪ modify the "url" and "authenticationPage" references to match your Connections
server and local database
• In the Xsp Properties of your database (under Application Configuration), make
sure com.ibm.xsp.sbtsdk.library is checked on the “Page Generation” tab
▪ if that's not an option, you didn't install the SocialSDK plugins yet
IBM SocialSDK - My Files Java
public static EntityList<File> getConnectionsFiles() {
try {
FileService service = new FileService();
// API CHANGE! Used to return FileList
EntityList<File> myFiles = service.getMyFiles();
return myFiles;
} catch (Exception e) {
// log this!
return null;
}
}
use this in a dataTable
like we did before
IBM SocialSDK - My Files JavaScript
var fileService = new FileService();
fileService.getMyFiles().then(
function(files) {
if (files.length == 0) {
dom.setText("filesTable", "You do not own any files, you loser.");
} else {
for(var i=0; i<files.length; i++){
var file = files[i];
createItem(file);
}
}
}
IBM SocialSDK - My Files JavaScript
Connecting to Other Servers
• The StackOverflow example in XPagesSBT.nsf is a good place
to start if you want to connect to a custom server
• stackoverflow managed bean and GenericStackoverflow.xsp
• https://api.stackexchange.com/docs/questions
<xe:this.data>
<xe:restJsonData var='rest' endpoint="stackoverflow" serviceUrl="/2.0/questions"
paramCount="pagesize" paramFirst="page" paramFirstType="page1" splitPath="items">
<xe:this.urlParameters>
<xe:urlParameter name="site" value="stackoverflow"></xe:urlParameter>
<xe:urlParameter name="order" value="desc"></xe:urlParameter>
<xe:urlParameter name="sort" value="activity"></xe:urlParameter>
</xe:this.urlParameters>
</xe:restJsonData>
</xe:this.data>
Connecting to Other Servers
• You can also connect directly using a ClientService
▪ basic authentication is easy, OAuth takes more work
▪ uses Apache commons HttpClient under the covers
▪ methods for get, post, put, delete
RestClient client = new RestClient("http://your.rest.server");
client.setAuthenticator(new RestClient.BasicAuthenticator("username", "password"));
Response response = client.get("your/rest/endpoint", ClientService.FORMAT_TEXT);
return (String)response.getData();
Quickbase
Quickbase
• http://www.quickbase.com/api-guide/index.html 

• What You’ll Need:
▪ An understanding of Quickbase
▪ Quickbase account
▪ JavaScript and HTML for “simple” actions like embedding a table
▪ REST and Java for more complex API calls
Quickbase
• Embed a Quickbase table in XPages:
Somewhere in head of page:
<script lang="javascript" src="https://psc.quickbase.com/db/YOUR_DB_ID?
a=API_GenResultsTable&apptoken=YOUR_APP_TOKEN&jht=1">
</script>
Somewhere in body of page:
<script lang="javascript">
qdbWrite();
</script>
Quickbase
Quickbase
• More complex Quickbase API calls require post and response
from Quickbase and your application

• Most calls require authentication
▪ XPages application posts username and password to QB
▪ QB responds with an authentication token to be used throughout
session
public static String getResponse(String myURL, String nodePath) {
try {
URL url = new URL(myURL);
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
factory.setValidating(false);
DocumentBuilder builder = factory.newDocumentBuilder();
org.w3c.dom.Document dom = builder.parse( url.openStream() );
Node node = XPathAPI.selectSingleNode(dom, nodePath);
return node.getNodeValue();
} catch (Exception e) {
// log this!
return null;
}
}
Quickbase - Steps for an API call
https://target_domain/db/main?
a=API_Authenticate&username=PTBa
rnum&password=TopSecret&hours=24
<?xml version="1.0" ?>
<qdbapi><action>api_authenticate</action>
<errcode>0</errcode>
<errtext>No error</errtext>
<ticket>2_beeinrxmv_dpvx_b_crf8ttndjwyf9bui94
rhciirqcs</ticket>
<userid>112245.efy7</userid>
</qdbapi>
Relational Databases
XPages Extension Library
• The XPages Extension Library (ExtLib) began as an OpenNTF
project in 2011
▪ https://extlib.openntf.org 

• As of Domino 9.0, basic components of ExtLib are installed with
the server by default
▪ com.ibm.xsp.extlib.* in domino/osgi/shared/eclipse/plugins

• However, the good stuff is still on OpenNTF
Installing ExtLib
• Super high-level install instructions
▪ Download from https://extlib.openntf.org
▪ Unzip and extract updateSiteOpenNTF-designer.zip and
updateSiteOpenNTF.zip
▪ Create 2 different update site databases: one for Designer, one
for Domino server
▪ Install appropriate update sites to server (via notes.ini) and DDE
(File - Application - Install)
▪ Restart Domino and DDE
https://www-10.lotus.com/ldd/ddwiki.nsf/dx/XPages_Extension_Library_Deployment
Using ExtLib With DDE Local Preview
• NOTE: after you install, the extension library will work on your
Domino server but NOT when using Local Preview on your
workstation

• To also make Local Preview work, see these instructions:
▪ http://www.tlcc.com/admin/tlccsite.nsf/pages/extension-lib
Relational Database Support
• In 2014, the ExtLib component that allows you to connect
XPages directly to relational databases was “promoted”
▪ used to be in the *.extlibx package, now in *.extlib
▪ no longer “experimental”

• Nice video introduction by Brian Gleeson:
▪ https://www.openntf.org/main.nsf/blog.xsp?
permaLink=NHEF-9N7CKD
Setting Up Your Database
• Use the JDBC Driver Plugin Wizard (DDE Tools menu) to
bundle your JDBC driver as a plugin to install on Domino
▪ TIP: you might need to 

include a license file 

with your driver

▪ install via Update Site 

like you did with ExtLib 

and SocialSDK
Setting Up Your Database
• In XSP Properties of your database (Page Generation tab),
make sure com.ibm.xsp.extlib.relational.library is checked

• In Package Explorer, create a folder called "jdbc" under
WebContent/WEB-INF in your database

• Then create a new file in that folder called
MyDbConnection.jdbc
▪ or whatever name you want, with a .jdbc extension
Setting Up Your Database
Relational Database XPage
• Now you can create an XPage with a JDBCQuery data source:
▪ connectionName: MyDbConnection
▪ sqlTable: MOVIEINFO
▪ lots of other settings you can make too (query, etc.)
• hover over the setting in the Preferences tab for inline help

• We can display the data in the same kind of dataTable we used
earlier
Relational Database XPage
<xp:this.data>
<xe:jdbcQuery var="jdbcQuery1" connectionName="MyDbConnection" sqlTable="MOVIEINFO" />
</xp:this.data>
<xp:dataTable rows="30" id="movieTable" value="#{jdbcQuery1}" var="movie" style="width:50%">
<xp:column id="titleColumn">
<xp:text escape="true" id="titleField" value="#{movie.title}">
</xp:text>
</xp:column>
<xp:column id="studioColumn">
<xp:text escape="true" id="studioField" value="#{movie.studio}">
</xp:text>
</xp:column>
<xp:column id="yearColumn">
<xp:text escape="true" id="yearField" value="#{movie.releaseyear}">
</xp:text>
</xp:column>
</xp:dataTable>
Relational Database XPage
<xp:this.data>
<xe:jdbcQuery var="jdbcQuery1" connectionName="MyDbConnection" sqlTable="MOVIEINFO" />
</xp:this.data>
<xp:dataTable rows="30" id="movieTable" value="#{jdbcQuery1}" var="movie" style="width:50%">
<xp:column id="titleColumn">
<xp:text escape="true" id="titleField" value="#{movie.title}">
</xp:text>
</xp:column>
<xp:column id="studioColumn">
<xp:text escape="true" id="studioField" value="#{movie.studio}">
</xp:text>
</xp:column>
<xp:column id="yearColumn">
<xp:text escape="true" id="yearField" value="#{movie.releaseyear}">
</xp:text>
</xp:column>
</xp:dataTable>
Relational Database XPage
Paul Calhoun Has More!!!
• For a lot more detail (and sage advice), go to Paul Calhoun’s
session later this week Wednesday at 10:45!
BP-1617: Relational XPages!!
Using XPages as the Presentation
Layer for RDBMS Data
Push or Pull or Passive?
Pull integration
• Up to this point, we’ve shown how to pull data:
▪ Pulling CSV into our application
▪ Showing files from Connections in our application
▪ Displaying data from Quickbase in our application
Push integration
• IBM SBT:
▪ The JavaScript snippets include loads of examples like adding a new file, adding
an activity, etc.
▪ Upload a new file:
fileService.uploadFile("your-file")
• Quickbase:
▪ Similarly, the Quickbase REST API allows you to add new records, users, edit
records, etc.
▪ Add a new record:
https://target_domain/db/target_dbid?a=API_EditRecord&rid=154
&_fnm_second_year=1776&_fid_8=changed&update_id=992017018414
&ticket=auth_ticket&apptoken=app_token
Passive integration
• Rather than actively pushing data or pulling data, you can
passively serve up data for other applications (or your own as
we’ll see in a minute) to pull when they need it

• In XPages, we can passively (and easily) serve up data with a
custom REST service
Create a REST service
• Create a new XPage, called “REST”

• Change the viewState to “nostate”

• Add a REST service xe:restService

• Give it a pathInfo name, this will be part of the URL

• Click + next to service and add xe:viewItemFileService
▪ At a minimum, add a view name and defaultColumns = true
REST service output
REST.xsp is our XPage
showmovies is the pathInfo
Look familiar?
Creating Your Own Plugins
Java Deployment Options
• Java classes directly in DDE
▪ Code -> Java

• JAR files directly in DDE
▪ Code -> Jars

• jvm/lib/ext folder

• Update Site/plugins like Social SDK and ExtLib
Build Your Own Plugins
• Sometimes it makes sense to bundle your code (or someone
else’s) in a plugin for distribution
▪ avoid security exceptions
▪ better performance
▪ use in multiple databases

• Especially good for really large API libraries
▪ Google, Tableau, etc.
It’s A Little Complicated
• Hard to get your head around, especially if you’re not an Eclipse
developer

• Tips and instructions
▪ https://www.dalsgaard-data.eu/blog/wrap-an-existing-jar-file-into-
a-plug-in
▪ http://www.slideshare.net/paulswithers1/ibm-connected-2015-
mas103-xpages-performance-and-scalability
▪ https://www.youtube.com/embed/dchOyzjy9L4 (Niklas Heidloff
again!)
Why Integrate?
WAIT! You didn’t talk about ___________!?!
• We tried to give you the tools to connect to other services
▪ REST? Direct connect or Social SDK.
▪ Java API? Attach the JAR and go.
▪ JavaScript API? Connect and create/parse info.
▪ Relational Database? Use the Extension Library.

• The “technology of the month” you want to connect to will likely
fall into one of these categories

• You can do this!
Integration Use Cases
• Notes to Notes application
▪ Good: Widgets from Sales app to Production Issues app in Notes
View
▪ Better: Widgets from Sales to Production in ExtJS user-
configurable and -filterable grid on an XPage

• Notes to IBM Collaboration Software
▪ Good: Display IBM Connections business card in app
▪ Better: Display IBM Connections Cloud files, with likes,
comments, and ability to edit in the cloud
More Integration Use Cases
• Your Application to the Outside World
▪ Good: Display data from another source
▪ Better: Interact with data from another source

• Example use cases using the tools from this session:
▪ JIRA - “Report a bug” button in your applications (REST + Java)
▪ Quickbase - Update records in a Quickbase application (REST +
Java)
▪ o365 - Create a meeting from your Notes app to user’s Outlook
calendar (REST + Java… sense a theme here?)
Learning Resources
Learning Java
• The book “Head First Java” is still excellent

• TLCC has some Notes-specific Java course material

• The only way to learn it is to use it 

• Keep in mind that Notes/Domino is still (for now) on Java 6
▪ cool new Java 7 and Java 8 features aren’t yet available to us
Learning XPages
• The book “Mastering XPages” sold by IBM Press (2nd edition)

• XPages Portable Command Guide

• http://xpages.info
• http://www.notesin9.com 

• If you get stuck, ask questions on http://stackoverflow.com
▪ but please search for an answer first
Thank you
look here for the slides,
and a link to the sample db:
http://www.slideshare.net/kjbrown13
http://www.slideshare.net/JulianRobichaux
or ask us on Twitter:
@IamKathyBrown
@jrobichaux
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.
Acknowledgements and Disclaimers cont.
© Copyright IBM Corporation 2016. 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, Lotus, IBM Domino, IBM Notes, WebSphere, and 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
• Linux is a registered trademark of Linus Torvalds in the United States, other countries, or both.
• Microsoft, Windows, Windows NT, and the Windows logo are trademarks of Microsoft Corporation in the United States, other countries, or both.
• Java and all Java-based trademarks and logos are trademarks or registered trademarks of Oracle and/or its affiliates.
Other company, product, or service names may be trademarks or service marks of others.

Weitere ähnliche Inhalte

Was ist angesagt?

Collecting email from the target domain using the harvester
Collecting email from the target domain using the harvesterCollecting email from the target domain using the harvester
Collecting email from the target domain using the harvesterVishal Kumar
 
Lan chat system
Lan chat systemLan chat system
Lan chat systemWipro
 
Linux Security, from Concept to Tooling
Linux Security, from Concept to ToolingLinux Security, from Concept to Tooling
Linux Security, from Concept to ToolingMichael Boelen
 
PHPでWebSocketを実装してみてわかったこと
PHPでWebSocketを実装してみてわかったことPHPでWebSocketを実装してみてわかったこと
PHPでWebSocketを実装してみてわかったことksimoji
 
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytes
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytesWindows Kernel Exploitation : This Time Font hunt you down in 4 bytes
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytesPeter Hlavaty
 
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹InfraEngineer
 
Java Foundations: Maps, Lambda and Stream API
Java Foundations: Maps, Lambda and Stream APIJava Foundations: Maps, Lambda and Stream API
Java Foundations: Maps, Lambda and Stream APISvetlin Nakov
 
Implementation &amp; Comparison Of Rdma Over Ethernet
Implementation &amp; Comparison Of Rdma Over EthernetImplementation &amp; Comparison Of Rdma Over Ethernet
Implementation &amp; Comparison Of Rdma Over EthernetJames Wernicke
 
The View - Lotusscript coding best practices
The View - Lotusscript coding best practicesThe View - Lotusscript coding best practices
The View - Lotusscript coding best practicesBill Buchan
 
Exploring the Portable Executable format
Exploring the Portable Executable formatExploring the Portable Executable format
Exploring the Portable Executable formatAnge Albertini
 
How to use the new Domino Query Language
How to use the new Domino Query LanguageHow to use the new Domino Query Language
How to use the new Domino Query LanguageTim Davis
 
Google Hacking - Explorando falhas de dispotivos
Google Hacking - Explorando falhas de dispotivosGoogle Hacking - Explorando falhas de dispotivos
Google Hacking - Explorando falhas de dispotivosC H
 
Hearts Of Darkness - a Spring DevOps Apocalypse
Hearts Of Darkness - a Spring DevOps ApocalypseHearts Of Darkness - a Spring DevOps Apocalypse
Hearts Of Darkness - a Spring DevOps ApocalypseJoris Kuipers
 
OpenKilda: Stream Processing Meets Openflow
OpenKilda: Stream Processing Meets OpenflowOpenKilda: Stream Processing Meets Openflow
OpenKilda: Stream Processing Meets OpenflowAPNIC
 
Open vSwitch와 Mininet을 이용한 가상 네트워크 생성과 OpenDaylight를 사용한 네트워크 제어실험
Open vSwitch와 Mininet을 이용한 가상 네트워크 생성과 OpenDaylight를 사용한 네트워크 제어실험Open vSwitch와 Mininet을 이용한 가상 네트워크 생성과 OpenDaylight를 사용한 네트워크 제어실험
Open vSwitch와 Mininet을 이용한 가상 네트워크 생성과 OpenDaylight를 사용한 네트워크 제어실험Seung-Hoon Baek
 
Socket Programming In Python
Socket Programming In PythonSocket Programming In Python
Socket Programming In Pythondidip
 
Sticky Keys to the Kingdom
Sticky Keys to the KingdomSticky Keys to the Kingdom
Sticky Keys to the KingdomDennis Maldonado
 
A Case Study in Attacking KeePass
A Case Study in Attacking KeePassA Case Study in Attacking KeePass
A Case Study in Attacking KeePassWill Schroeder
 

Was ist angesagt? (20)

Collecting email from the target domain using the harvester
Collecting email from the target domain using the harvesterCollecting email from the target domain using the harvester
Collecting email from the target domain using the harvester
 
Python Programming Essentials - M8 - String Methods
Python Programming Essentials - M8 - String MethodsPython Programming Essentials - M8 - String Methods
Python Programming Essentials - M8 - String Methods
 
Lan chat system
Lan chat systemLan chat system
Lan chat system
 
Linux Security, from Concept to Tooling
Linux Security, from Concept to ToolingLinux Security, from Concept to Tooling
Linux Security, from Concept to Tooling
 
PHPでWebSocketを実装してみてわかったこと
PHPでWebSocketを実装してみてわかったことPHPでWebSocketを実装してみてわかったこと
PHPでWebSocketを実装してみてわかったこと
 
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytes
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytesWindows Kernel Exploitation : This Time Font hunt you down in 4 bytes
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytes
 
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹
 
Java Foundations: Maps, Lambda and Stream API
Java Foundations: Maps, Lambda and Stream APIJava Foundations: Maps, Lambda and Stream API
Java Foundations: Maps, Lambda and Stream API
 
Implementation &amp; Comparison Of Rdma Over Ethernet
Implementation &amp; Comparison Of Rdma Over EthernetImplementation &amp; Comparison Of Rdma Over Ethernet
Implementation &amp; Comparison Of Rdma Over Ethernet
 
The View - Lotusscript coding best practices
The View - Lotusscript coding best practicesThe View - Lotusscript coding best practices
The View - Lotusscript coding best practices
 
Exploring the Portable Executable format
Exploring the Portable Executable formatExploring the Portable Executable format
Exploring the Portable Executable format
 
Linux Hardening - nullhyd
Linux Hardening - nullhydLinux Hardening - nullhyd
Linux Hardening - nullhyd
 
How to use the new Domino Query Language
How to use the new Domino Query LanguageHow to use the new Domino Query Language
How to use the new Domino Query Language
 
Google Hacking - Explorando falhas de dispotivos
Google Hacking - Explorando falhas de dispotivosGoogle Hacking - Explorando falhas de dispotivos
Google Hacking - Explorando falhas de dispotivos
 
Hearts Of Darkness - a Spring DevOps Apocalypse
Hearts Of Darkness - a Spring DevOps ApocalypseHearts Of Darkness - a Spring DevOps Apocalypse
Hearts Of Darkness - a Spring DevOps Apocalypse
 
OpenKilda: Stream Processing Meets Openflow
OpenKilda: Stream Processing Meets OpenflowOpenKilda: Stream Processing Meets Openflow
OpenKilda: Stream Processing Meets Openflow
 
Open vSwitch와 Mininet을 이용한 가상 네트워크 생성과 OpenDaylight를 사용한 네트워크 제어실험
Open vSwitch와 Mininet을 이용한 가상 네트워크 생성과 OpenDaylight를 사용한 네트워크 제어실험Open vSwitch와 Mininet을 이용한 가상 네트워크 생성과 OpenDaylight를 사용한 네트워크 제어실험
Open vSwitch와 Mininet을 이용한 가상 네트워크 생성과 OpenDaylight를 사용한 네트워크 제어실험
 
Socket Programming In Python
Socket Programming In PythonSocket Programming In Python
Socket Programming In Python
 
Sticky Keys to the Kingdom
Sticky Keys to the KingdomSticky Keys to the Kingdom
Sticky Keys to the Kingdom
 
A Case Study in Attacking KeePass
A Case Study in Attacking KeePassA Case Study in Attacking KeePass
A Case Study in Attacking KeePass
 

Andere mochten auch

Becoming an IBM Connections Developer
Becoming an IBM Connections DeveloperBecoming an IBM Connections Developer
Becoming an IBM Connections DeveloperRob Novak
 
JMP402 Master Class: Managed beans and XPages: Your Time Is Now
JMP402 Master Class: Managed beans and XPages: Your Time Is NowJMP402 Master Class: Managed beans and XPages: Your Time Is Now
JMP402 Master Class: Managed beans and XPages: Your Time Is NowRussell Maher
 
IBM Connections administration – keep your systems running the right way
IBM Connections administration – keep your systems running the right wayIBM Connections administration – keep your systems running the right way
IBM Connections administration – keep your systems running the right wayLetsConnect
 
DEV-1269: Best and Worst Practices for Deploying IBM Connections – IBM Conne...
DEV-1269: Best and Worst Practices for Deploying IBM Connections  – IBM Conne...DEV-1269: Best and Worst Practices for Deploying IBM Connections  – IBM Conne...
DEV-1269: Best and Worst Practices for Deploying IBM Connections – IBM Conne...panagenda
 
Диспетчер тегов Google. Меньше затрат, больше контроля.
Диспетчер тегов Google. Меньше затрат, больше контроля.Диспетчер тегов Google. Меньше затрат, больше контроля.
Диспетчер тегов Google. Меньше затрат, больше контроля.CubeLine Agency
 
ข้อสอบสังคมพร้อมเฉลย
ข้อสอบสังคมพร้อมเฉลยข้อสอบสังคมพร้อมเฉลย
ข้อสอบสังคมพร้อมเฉลยTanapong Chaisri
 
ใบงานที่12
ใบงานที่12 ใบงานที่12
ใบงานที่12 Tanapong Chaisri
 
ข้อสอบฟิสิกพร้อมเฉลย
ข้อสอบฟิสิกพร้อมเฉลยข้อสอบฟิสิกพร้อมเฉลย
ข้อสอบฟิสิกพร้อมเฉลยTanapong Chaisri
 
ใบงานที่11
ใบงานที่11 ใบงานที่11
ใบงานที่11 Tanapong Chaisri
 
ข้อสอบภาษาไทยพร้อมเฉลย
ข้อสอบภาษาไทยพร้อมเฉลยข้อสอบภาษาไทยพร้อมเฉลย
ข้อสอบภาษาไทยพร้อมเฉลยTanapong Chaisri
 
Back home action plan for merdeka.com
Back home action plan for merdeka.comBack home action plan for merdeka.com
Back home action plan for merdeka.comRirin1984
 
Improving Your Domino Designer Experience
Improving Your Domino Designer ExperienceImproving Your Domino Designer Experience
Improving Your Domino Designer ExperienceJulian Robichaux
 
ข้อสอบชีวะพร้อมเฉลย
ข้อสอบชีวะพร้อมเฉลยข้อสอบชีวะพร้อมเฉลย
ข้อสอบชีวะพร้อมเฉลยTanapong Chaisri
 
Opposition to motion to continue trial
Opposition to motion to continue trialOpposition to motion to continue trial
Opposition to motion to continue trialTheMataHari
 
Trivia albert
Trivia albertTrivia albert
Trivia albertAlbert_C
 

Andere mochten auch (20)

Becoming an IBM Connections Developer
Becoming an IBM Connections DeveloperBecoming an IBM Connections Developer
Becoming an IBM Connections Developer
 
JMP402 Master Class: Managed beans and XPages: Your Time Is Now
JMP402 Master Class: Managed beans and XPages: Your Time Is NowJMP402 Master Class: Managed beans and XPages: Your Time Is Now
JMP402 Master Class: Managed beans and XPages: Your Time Is Now
 
IBM Connections administration – keep your systems running the right way
IBM Connections administration – keep your systems running the right wayIBM Connections administration – keep your systems running the right way
IBM Connections administration – keep your systems running the right way
 
DEV-1269: Best and Worst Practices for Deploying IBM Connections – IBM Conne...
DEV-1269: Best and Worst Practices for Deploying IBM Connections  – IBM Conne...DEV-1269: Best and Worst Practices for Deploying IBM Connections  – IBM Conne...
DEV-1269: Best and Worst Practices for Deploying IBM Connections – IBM Conne...
 
Trivia
TriviaTrivia
Trivia
 
Диспетчер тегов Google. Меньше затрат, больше контроля.
Диспетчер тегов Google. Меньше затрат, больше контроля.Диспетчер тегов Google. Меньше затрат, больше контроля.
Диспетчер тегов Google. Меньше затрат, больше контроля.
 
ข้อสอบสังคมพร้อมเฉลย
ข้อสอบสังคมพร้อมเฉลยข้อสอบสังคมพร้อมเฉลย
ข้อสอบสังคมพร้อมเฉลย
 
ใบงานที่12
ใบงานที่12 ใบงานที่12
ใบงานที่12
 
ข้อสอบฟิสิกพร้อมเฉลย
ข้อสอบฟิสิกพร้อมเฉลยข้อสอบฟิสิกพร้อมเฉลย
ข้อสอบฟิสิกพร้อมเฉลย
 
ใบงานที่11
ใบงานที่11 ใบงานที่11
ใบงานที่11
 
Estudioclima1
Estudioclima1Estudioclima1
Estudioclima1
 
ข้อสอบภาษาไทยพร้อมเฉลย
ข้อสอบภาษาไทยพร้อมเฉลยข้อสอบภาษาไทยพร้อมเฉลย
ข้อสอบภาษาไทยพร้อมเฉลย
 
Anordjony
AnordjonyAnordjony
Anordjony
 
Back home action plan for merdeka.com
Back home action plan for merdeka.comBack home action plan for merdeka.com
Back home action plan for merdeka.com
 
White Paper: Skilled Trades Career Training Solutions
White Paper: Skilled Trades Career Training SolutionsWhite Paper: Skilled Trades Career Training Solutions
White Paper: Skilled Trades Career Training Solutions
 
Improving Your Domino Designer Experience
Improving Your Domino Designer ExperienceImproving Your Domino Designer Experience
Improving Your Domino Designer Experience
 
ข้อสอบชีวะพร้อมเฉลย
ข้อสอบชีวะพร้อมเฉลยข้อสอบชีวะพร้อมเฉลย
ข้อสอบชีวะพร้อมเฉลย
 
Opposition to motion to continue trial
Opposition to motion to continue trialOpposition to motion to continue trial
Opposition to motion to continue trial
 
Trivia albert
Trivia albertTrivia albert
Trivia albert
 
Mobile seo
Mobile seoMobile seo
Mobile seo
 

Ähnlich wie Connect2016 AD1387 Integrate with XPages and Java

ITT 2015 - Simon Stewart - Building Android Apps at Speed and Scale
ITT 2015 - Simon Stewart - Building Android Apps at Speed and ScaleITT 2015 - Simon Stewart - Building Android Apps at Speed and Scale
ITT 2015 - Simon Stewart - Building Android Apps at Speed and ScaleIstanbul Tech Talks
 
Oscon Java Testing on the Fast Lane
Oscon Java Testing on the Fast LaneOscon Java Testing on the Fast Lane
Oscon Java Testing on the Fast LaneAndres Almiray
 
The Spring 4 Update - Josh Long
The Spring 4 Update - Josh LongThe Spring 4 Update - Josh Long
The Spring 4 Update - Josh Longjaxconf
 
the Spring 4 update
the Spring 4 updatethe Spring 4 update
the Spring 4 updateJoshua Long
 
MongoDB + Java - Everything you need to know
MongoDB + Java - Everything you need to know MongoDB + Java - Everything you need to know
MongoDB + Java - Everything you need to know Norberto Leite
 
Mongo+java (1)
Mongo+java (1)Mongo+java (1)
Mongo+java (1)MongoDB
 
JCD 2013 OCM Java Developer
JCD 2013 OCM Java DeveloperJCD 2013 OCM Java Developer
JCD 2013 OCM Java Developer益裕 張
 
OCM Java 開發人員認證與設計模式
OCM Java 開發人員認證與設計模式OCM Java 開發人員認證與設計模式
OCM Java 開發人員認證與設計模式CodeData
 
Boosting Your Testing Productivity with Groovy
Boosting Your Testing Productivity with GroovyBoosting Your Testing Productivity with Groovy
Boosting Your Testing Productivity with GroovyJames Williams
 
Javaone2008 Bof 5101 Groovytesting
Javaone2008 Bof 5101 GroovytestingJavaone2008 Bof 5101 Groovytesting
Javaone2008 Bof 5101 GroovytestingAndres Almiray
 
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)Jen Wong
 
Atlassian Groovy Plugins
Atlassian Groovy PluginsAtlassian Groovy Plugins
Atlassian Groovy PluginsPaul King
 
Getting the most out of Java [Nordic Coding-2010]
Getting the most out of Java [Nordic Coding-2010]Getting the most out of Java [Nordic Coding-2010]
Getting the most out of Java [Nordic Coding-2010]Sven Efftinge
 
Introducing to node.js
Introducing to node.jsIntroducing to node.js
Introducing to node.jsJeongHun Byeon
 
JSLT: JSON querying and transformation
JSLT: JSON querying and transformationJSLT: JSON querying and transformation
JSLT: JSON querying and transformationLars Marius Garshol
 
Refactoring In Tdd The Missing Part
Refactoring In Tdd The Missing PartRefactoring In Tdd The Missing Part
Refactoring In Tdd The Missing PartGabriele Lana
 

Ähnlich wie Connect2016 AD1387 Integrate with XPages and Java (20)

ITT 2015 - Simon Stewart - Building Android Apps at Speed and Scale
ITT 2015 - Simon Stewart - Building Android Apps at Speed and ScaleITT 2015 - Simon Stewart - Building Android Apps at Speed and Scale
ITT 2015 - Simon Stewart - Building Android Apps at Speed and Scale
 
Oscon Java Testing on the Fast Lane
Oscon Java Testing on the Fast LaneOscon Java Testing on the Fast Lane
Oscon Java Testing on the Fast Lane
 
Json generation
Json generationJson generation
Json generation
 
The Spring 4 Update - Josh Long
The Spring 4 Update - Josh LongThe Spring 4 Update - Josh Long
The Spring 4 Update - Josh Long
 
10 jdbc
10 jdbc10 jdbc
10 jdbc
 
10 jdbc
10 jdbc10 jdbc
10 jdbc
 
the Spring 4 update
the Spring 4 updatethe Spring 4 update
the Spring 4 update
 
Spring data requery
Spring data requerySpring data requery
Spring data requery
 
MongoDB + Java - Everything you need to know
MongoDB + Java - Everything you need to know MongoDB + Java - Everything you need to know
MongoDB + Java - Everything you need to know
 
Mongo+java (1)
Mongo+java (1)Mongo+java (1)
Mongo+java (1)
 
JCD 2013 OCM Java Developer
JCD 2013 OCM Java DeveloperJCD 2013 OCM Java Developer
JCD 2013 OCM Java Developer
 
OCM Java 開發人員認證與設計模式
OCM Java 開發人員認證與設計模式OCM Java 開發人員認證與設計模式
OCM Java 開發人員認證與設計模式
 
Boosting Your Testing Productivity with Groovy
Boosting Your Testing Productivity with GroovyBoosting Your Testing Productivity with Groovy
Boosting Your Testing Productivity with Groovy
 
Javaone2008 Bof 5101 Groovytesting
Javaone2008 Bof 5101 GroovytestingJavaone2008 Bof 5101 Groovytesting
Javaone2008 Bof 5101 Groovytesting
 
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
 
Atlassian Groovy Plugins
Atlassian Groovy PluginsAtlassian Groovy Plugins
Atlassian Groovy Plugins
 
Getting the most out of Java [Nordic Coding-2010]
Getting the most out of Java [Nordic Coding-2010]Getting the most out of Java [Nordic Coding-2010]
Getting the most out of Java [Nordic Coding-2010]
 
Introducing to node.js
Introducing to node.jsIntroducing to node.js
Introducing to node.js
 
JSLT: JSON querying and transformation
JSLT: JSON querying and transformationJSLT: JSON querying and transformation
JSLT: JSON querying and transformation
 
Refactoring In Tdd The Missing Part
Refactoring In Tdd The Missing PartRefactoring In Tdd The Missing Part
Refactoring In Tdd The Missing Part
 

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 

Kürzlich hochgeladen (20)

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 

Connect2016 AD1387 Integrate with XPages and Java

  • 1. AD-1387 Outside The Box: Integrating with Non- Domino Apps using XPages and Java Julian Robichaux, panagenda Kathy Brown, PSC Group
  • 2. Who Are We? • Kathy Brown ▪ Senior Consultant, PSC Group LLC ▪ IBM Champion ▪ @IamKathyBrown ▪ runningnotes.net
  • 3. Who Are We? • Julian Robichaux ▪ Senior Application Developer, panagenda ▪ IBM Champion ▪ @jrobichaux ▪ nsftools.com
  • 4. Why Are We Here? • Application integration ▪ Get data from other places ▪ Put data in other places
 • Ideally this will be invisible to the end-user
 • We will show you high-level detail (and code!) in this presentation, even more is in the sample database available for download
  • 5. What Will We Be Using? • IBM Domino® Server 9.0.1 FP4
 • IBM Domino Designer (DDE) 9.0.1 FP4
 • Java 1.6 (as included with Domino and DDE)
 • XPages
 • Other bits and bobs as mentioned throughout the presentation
  • 6. Bridging the Gap: Converting Data to Java Objects
  • 7. Data Basics • Before we start getting data, let’s talk about what the data usually looks like ▪ XML ▪ JSON ▪ CSV
 • But Java is made of objects…
 • How do we convert from structured data to objects?
  • 8. Easy And Old School: CSV • Comma-separated values
 • Simple data format, been used for years, still very common
 • Boooorrrriiiinnnngg ▪ yawn
 • Stick with us, this will make the other (COOLER) examples easier to understand
  • 9. Here’s What Our CSV Data Looks Like "title","studio","year","adjustedRevenue","unadjustedRevenue" "Gone With The Breeze","NGN",1939,1750000000,200000000 "Star Battles","Foz",1977,1500000000,450000000 "The Sound Of MP3s","Foz",1965,1250000000,160000000 "I.T.: The Computer Guys","Univixen",1982,1200000000,425000000 "Titantuan","Parallax",1997,1150000000,650000000
  • 10. And Our Corresponding Java Object public class MovieBean { private String title; private String studio; private int year; private int adjustedRevenue; private int unadjustedRevenue; public MovieBean() {} public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getStudio() { return studio; } public void setStudio(String studio) { this.studio = studio; } public int getYear() { return year; } public void setYear(int year) { this.year = year; } public int getAdjustedRevenue() { return adjustedRevenue; } public void setAdjustedRevenue(int adjustedRevenue) { this.adjustedRevenue = adjustedRevenue; } public int getUnadjustedRevenue() { return unadjustedRevenue; } public void setUnadjustedRevenue(int unadjustedRevenue) { this.unadjustedRevenue = unadjustedRevenue; } }
  • 11. Java Beans! • Java Beans are just Java objects with: ▪ private fields ▪ getter and setter methods 
 to access the fields ▪ a “no-arg” constructor
 • Perfect for representing 
 structured data elements public class EasyBean { private String name; private int count; public EasyBean() {} public String getName() { return name; } public void setName(String name) { this.name = name; } public int getCount() { return count; } public void setCount(int count) { this.count = count; } }
  • 12. The Bean And Its Data public class MovieBean { private String title; private String studio; private int year; private int adjustedRevenue; private int unadjustedRevenue; public MovieBean() {} public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getStudio() { return studio; } public void setStudio(String studio) { this.studio = studio; } public int getYear() { return year; } public void setYear(int year) { this.year = year; } public int getAdjustedRevenue() { return adjustedRevenue; } public void setAdjustedRevenue(int adjustedRevenue) { this.adjustedRevenue = adjustedRevenue; } public int getUnadjustedRevenue() { return unadjustedRevenue; } public void setUnadjustedRevenue(int unadjustedRevenue) { this.unadjustedRevenue = unadjustedRevenue; } } "title","studio","year","adjustedRevenue","unadjustedRevenue" "Gone With The Breeze","NGN",1939,1750000000,200000000 "Star Battles","Foz",1977,1500000000,450000000 "The Sound Of MP3s","Foz",1965,1250000000,160000000 "I.T.: The Computer Guys","Univixen",1982,1200000000,425000000 "Titantuan","Parallax",1997,1150000000,650000000
  • 13. From Data To Bean • Option 1: Parse the data manually, create objects manually
 • Option 2: Use a library that parses the data for you into rows and columns, put the row data into objects
 • Option 3: Use a library that puts the data directly into objects for you! ▪ referred to as “unmarshalling” or “deserialization” ▪ or “reading” or “parsing”, if that seems confusing
  • 14. OpenCSV Library • OpenCSV ▪ http://opencsv.sourceforge.net ▪ Open source, Apache licensed ▪ Tiny file size (14k or 42k, depending on version)
 • We will use an older version 2.3, because that is compatible with Java 6 ▪ Latest version 3.6 is compiled for Java 7+ ▪ java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version;
  • 15. Add JAR File to Database
  • 16. OpenCSV Parsing Code public static List convertCSV(String csvText) { try { CSVReader reader = new CSVReader(new StringReader(csvText)); ColumnPositionMappingStrategy<MovieBean> strat = new ColumnPositionMappingStrategy<MovieBean>(); strat.setType(MovieBean.class); String[] columns = new String[] { "title", "studio", "year", "adjustedRevenue", "unadjustedRevenue"}; strat.setColumnMapping(columns); CsvToBean csv = new CsvToBean(); List list = csv.parse(strat, reader); return list; } catch (Exception e) { // log this! return null; } }
  • 17. Awesome! What Did We Learn? • Use Java Beans to hold data
 • Use unmarshalling to avoid manual effort
 • Let libraries do the work for you! ▪ to a degree… it’s always a trade-off
  • 18. XML: Manual Parsing • Java has plenty of XML support built-in ▪ DOM, SAX, and STaX for parsing ▪ XPath for selecting sets of nodes
 • Using these, we can manually read an XML file (or string) and put all the information piece-by-piece into objects
 • Or…
  • 19. JAXB • Java Architecture for XML Binding (JAXB)
 • Easily marshal and unmarshal between Java objects and XML
 • Included with Java 6+ ▪ Nothing extra to install for XPages
 • Use Annotations in the Java Bean source code to indicate which XML elements map to which fields
  • 20. The XML <moviedata> <movie> <title>Gone With The Breeze</title> <studio>NGN</studio> <year>1939</year> <adjusted>1750000000</adjusted> <unadjusted>200000000</unadjusted> </movie> <movie> <title>Star Battles</title> <studio>Foz</studio> <year>1977</year> <adjusted>1500000000</adjusted> <unadjusted>450000000</unadjusted> </movie> <movie> <title>The Sound Of MP3s</title> <studio>Foz</studio> <year>1965</year> <adjusted>1250000000</adjusted> <unadjusted>160000000</unadjusted> </movie> <movie> <title>I.T.: The Computer Guys</title> <studio>Univixen</studio> <year>1982</year> <adjusted>1200000000</adjusted> <unadjusted>425000000</unadjusted> </movie> <movie> <title>Titantuan</title> <studio>Parallax</studio> <year>1997</year> <adjusted>1150000000</adjusted> <unadjusted>650000000</unadjusted> </movie> </moviedata>
  • 21. Java Bean to Hold Multiple Movies package connect16.example.data; import java.util.ArrayList; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name="moviedata") public class MovieBeanList { private ArrayList<MovieBean> movies = new ArrayList<MovieBean>(); @XmlElement(name="movie") public ArrayList<MovieBean> getMovies() { return movies; } public void setMovies(ArrayList<MovieBean> movies) { this.movies = movies; } } <moviedata> <movie> <title>Gone With The Breeze</title> <studio>NGN</studio> <year>1939</year> <adjusted>1750000000</adjusted> <unadjusted>200000000</unadjusted> </movie> . . . </moviedata>
  • 22. MovieBean Annotations @XmlElement(name="title") public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } @XmlElement(name="studio") public String getStudio() { return studio; } public void setStudio(String studio) { this.studio = studio; } @XmlElement(name="year") public int getYear() { return year; } public void setYear(int year) { this.year = year; } @XmlElement(name="adjusted") public int getAdjustedRevenue() { return adjustedRevenue; } public void setAdjustedRevenue(int adjustedRevenue) { this.adjustedRevenue = adjustedRevenue; } @XmlElement(name="unadjusted") public int getUnadjustedRevenue() { return unadjustedRevenue; } public void setUnadjustedRevenue(int unadjustedRevenue) { this.unadjustedRevenue = unadjustedRevenue; } <moviedata> <movie> <title>Gone With The Breeze</title> <studio>NGN</studio> <year>1939</year> <adjusted>1750000000</adjusted> <unadjusted>200000000</unadjusted> </movie> . . . </moviedata>
  • 23. XML Parsing Code public static MovieBeanList convertXML(String xml) { try { // see @XML annotations on Java beans JAXBContext jc = JAXBContext.newInstance(MovieBeanList.class); Unmarshaller unmarshaller = jc.createUnmarshaller(); MovieBeanList movies = (MovieBeanList)unmarshaller.unmarshal( new StringReader(xml)); return movies; } catch (Exception e) { // log this! return null; } }
  • 24. And One More Time With JSON • A JSON parsing library is included with the XPages libraries ▪ com.ibm.commons.util.io.json.JsonParser
 • It reads JSON into Java Maps and Lists, not custom objects
 • Some third-party libraries have unmashalling support (GSON, FlexJSON) but cause security exceptions ▪ You can get around this, but it’s not always convenient
 • So I wrote my own generic unmarshalling code
  • 25. The JSON [{"movie": { "title": "Gone With The Breeze", "studio": "NGN", "year": 1939, "adjusted": 1750000000, "unadjusted": 200000000 }}, {"movie": { "title": "Star Battles", "studio": "Foz", "year": 1977, "adjusted": 1500000000, "unadjusted": 450000000 }}, {"movie": { "title": "The Sound Of MP3s", "studio": "Foz", "year": 1965, "adjusted": 1250000000, "unadjusted": 160000000 }}, {"movie": { "title": "I.T.: The Computer Guys", "studio": "Univixen", "year": 1982, "adjusted": 1200000000, "unadjusted": 425000000 }}, {"movie": { "title": "Titantuan", "studio": "Parallax", "year": 1997, "adjusted": 1150000000, "unadjusted": 650000000 }} ]
  • 26. Small Change to MovieBean @XmlElement(name="adjusted") public int getAdjustedRevenue() { return adjustedRevenue; } public void setAdjustedRevenue(int adjustedRevenue) { this.adjustedRevenue = adjustedRevenue; } public void setAdjusted(int adjustedRevenue) { this.adjustedRevenue = adjustedRevenue; } @XmlElement(name="unadjusted") public int getUnadjustedRevenue() { return unadjustedRevenue; } public void setUnadjustedRevenue(int unadjustedRevenue) { this.unadjustedRevenue = unadjustedRevenue; } public void setUnadjusted(int unadjustedRevenue) { this.unadjustedRevenue = unadjustedRevenue; } {"movie": { "title": "Gone With The Breeze", "studio": "NGN", "year": 1939, "adjusted": 1750000000, "unadjusted": 200000000 }} added setAdjusted() and setUnadjusted() to map to JSON field names
  • 27. JSON Parsing Code public static List convertJSON(String json) { try { Object stuff = JsonParser.fromJson(JsonJavaFactory.instance, json); List list = buildObjectFromJSON(MovieBean.class, stuff); return list; } catch (Exception e) { // log this! return null; } }
  • 28. Pros and Cons • Pros ▪ Less code (on your part) ▪ Reduce or eliminate hardcoded mappings
 • Cons ▪ Harder to debug if things go wrong ▪ Be very diligent about responding to Exceptions and checking the data in the beans that are created
  • 29. Caveats and Tips • Some code that works for XPages will not work for Java Agents ▪ access to different external libraries ▪ default compiler level on agents is still Java 1.4
 • Trap (and log) your errors! ▪ keep a copy of the “bad” JSON/XML when possible for analysis
 • These Java Beans are not quite the same as XPages Managed Beans — but you should learn to use those too!
  • 30. Bridging the Gap (part deux): Putting Java Objects on an XPage
  • 31. So We’ve Got Objects… Now What? • How do we display these things?
 • The brute force way is by using XAgents or similar:
  • 32. XAgent <?xml version="1.0" encoding="UTF-8"?> <xp:view xmlns:xp="http://www.ibm.com/xsp/core" rendered="false"> <xp:this.afterRenderResponse><![CDATA[#{javascript: importPackage(connect16.example.data); var data = "Result: " + Test.convertJSON(); var externalContext = facesContext.getExternalContext(); var writer = facesContext.getResponseWriter(); var response = externalContext.getResponse(); response.setHeader("Cache-Control", "no-cache"); writer.write("<pre>" + data + "</pre>"); writer.endDocument() }]]></xp:this.afterRenderResponse></xp:view>
  • 33. XPages Data Tables Are An Option • You can use Java Arrays or Lists as input
 • Automatically uses each item in the Array/List as a row in a table
 • Customize column values for each row based on item data
 • You can even include a pager control
  • 34. Data Table Example <?xml version="1.0" encoding="UTF-8"?> <xp:view xmlns:xp="http://www.ibm.com/xsp/core"> <xp:dataTable rows="30" id="movieTable" var="movie" style="width:50%"> <xp:this.value><![CDATA[#{javascript:connect16.example.data.Test.convertJSON(); }]]></xp:this.value> <xp:column id="titleColumn"> <xp:text escape="true" id="titleField" value="#{movie.title}"> </xp:text> </xp:column> <xp:column id="studioColumn"> <xp:text escape="true" id="studioField" value="#{movie.studio}"> </xp:text> </xp:column> <xp:column id="yearColumn"> <xp:text escape="true" id="yearField" value="#{movie.year}"> </xp:text> </xp:column> </xp:dataTable> </xp:view> returns an ArrayList of MovieBeans MovieBean fields (you can also use class methods)
  • 36. Repeat Controls and more • Using a bean allows you to use expression language ▪ Expression language allows you to populate: • a repeat control • input fields • really anything in XPages where you can use expression language
 ▪ Pros and cons for using managed beans, check out: • http://www.slideshare.net/RussellMaher/jmp402
  • 37. Bootstrapped Repeat on Managed Bean Example <xp:repeat id="repeat1" rows="30" var="mymovies" value="#{MovieBeanList.movies}"> <tr><td> <xp:text escape="true" id="inputText2" value="#{mymovies.title}"> </xp:text> </td><td> <xp:text escape="true" id="inputText1" value="#{mymovies.studio}"> </xp:text> </td><td> <xp:text escape="true" id="inputText3" value="#{mymovies.adjustedRevenue}"> </xp:text> </td><td> <xp:text escape="true" id="inputText4" value="#{mymovies.unadjustedRevenue}"> </xp:text> </td><td> <xp:text escape="true" id="inputText5" value="#{mymovies.year}"> </xp:text> </td></tr> </xp:repeat>
  • 38. Bootstrapped Repeat on Managed Bean Example
  • 39. Okay, Let’s Go Get Some Data!
  • 40. Simple Stuff: Data From A URL • When we access other servers, we often do it as though we are accessing a URL ▪ port 80 and 443 are almost always open for traffic ▪ REST services (we’ll talk about that next!) usually are URL requests ▪ a lot of convenient and well-understood security has been built on top of HTTP
 • So how hard is it to get data from a URL in Java?
  • 41. Java URL Fetch: Ridiculously Simple Example URL url = new URL("http://server/data.xml"); InputStream in = url.openStream(); something has to read the stream, but that’s all there is (in a basic sense)
  • 42. What’s An InputStream? • An InputStream is a “stream” of bytes
 • Often sent in chunks, so you don’t have to have the entire contents of the stream in memory unless you want to
 • Commonly accepted and understood by Java methods
  • 43. XML As An InputStream URL url = new URL("https://server/data.xml"); InputStream in = url.openStream(); JAXBContext jc = JAXBContext.newInstance(MovieBeanList.class); Unmarshaller unmarshaller = jc.createUnmarshaller(); MovieBeanList movies = (MovieBeanList)unmarshaller.unmarshal(in);
  • 44. Converting Bytes To Strings • What if your Java method needs a String? ▪ or a Reader
 • Use an InputStreamReader… BUT
 • Mind your character sets! ▪ Java uses the default system character set by default ▪ According to spec, JSON is supposed to be sent as Unicode (usually UTF-8): https://tools.ietf.org/html/rfc4627
  • 45. JSON As A Reader URL url = new URL("https://server/data.js"); InputStream in = url.openStream(); BufferedReader reader = new BufferedReader( new InputStreamReader( in, "UTF-8" )); Object stuff = JsonParser.fromJson(JsonJavaFactory.instance, reader);
  • 46. CSV As A Reader URL url = new URL("https://server/data.csv"); InputStream in = url.openStream(); BufferedReader reader = new BufferedReader( new InputStreamReader( in, "UTF-8" )); CSVReader csv = new CSVReader(reader);
  • 47. If You Really Really Want A String URL url = new URL("https://server/data.txt"); BufferedReader reader = new BufferedReader( new InputStreamReader( url.openStream(), "UTF-8" )); StringBuilder sb = new StringBuilder(); char[] buffer = new char[1024]; int size = 0; while ( (size = reader.read(buffer)) > 0 ) { sb.append(buffer, 0, size); } reader.close(); String stuff = sb.toString();
  • 48. Is That All You Have To Do? • Well… ▪ proxy servers ▪ authentication ▪ SSL certificates ▪ POST requests and headers
 • Examples of all those things in the sample database
 • When you use other libraries (like the SocialSDK, coming up!) these things are often taken care of for you
  • 49. Domino Security For Network (and File) Access • You must have the following permissions in the Security section of the Server doc to access the network: ▪ EITHER: run unrestricted ▪ OR: sign XPages 
 AND run restricted
 
 • This is the signature of the XPage AND all associated resources ▪ referenced controls, JS libraries, Java code, attached JAR files ▪ if any one of those things doesn’t have access, the XPage will fail ▪ HTTP Web Server: You are forbidden to perform this operation
  • 50. REST Service Example • REST = Representational State Transfer
 • There are a lot of finer points to a proper REST service, but for the purpose of our examples it will be: ▪ using a URL + HTTP to get information ▪ using a URL + HTTP to send information
  • 51. Simple REST Service Example public static MovieBeanList getMoviesFromREST() throws IOException, JAXBException { String restURL = "http://server/movieService.php?count=5&output=xml"; URL url = new URL(restURL); InputStream in = url.openStream(); JAXBContext jc = JAXBContext.newInstance(MovieBeanList.class); Unmarshaller unmarshaller = jc.createUnmarshaller(); return (MovieBeanList)unmarshaller.unmarshal( in ); }
  • 52. Simple REST Service Example public static void createDocs(Database db) { try { MovieBeanList movies = getMoviesFromREST(); for (MovieBean movie : movies.getMovies()) { Document doc = db.createDocument(); doc.replaceItemValue("Form", "MovieData"); doc.replaceItemValue("Title", movie.getTitle()); doc.replaceItemValue("Studio", movie.getStudio()); doc.replaceItemValue("Year", movie.getYear()); doc.save(); doc.recycle(); } } catch (Exception e) { // log this! } }
  • 54. IBM SocialSDK (aka Social Business Toolkit SDK) • What is it? ▪ A toolkit, provided by IBM, to integrate with Connections, Connections Cloud, Dropbox, Facebook, Twitter, and more ▪ Originally part of the XPages Extension Library, split off to its own project in 2013
 • Download from OpenNTF or Github ▪ https://openntf.org/p/Social+Business+Toolkit+SDK ▪ https://github.com/OpenNTF/SocialSDK/releases
  • 55. IBM SocialSDK (aka Social Business Toolkit SDK) • What’s included? ▪ Toolkit files ▪ OAuth* code ▪ Examples ▪ Sample XPages application ▪ Also has components for WebSphere and Tomcat
  • 56. *OAuth • A quick word about OAuth ▪ Many APIs require OAuth ▪ OAuth authentication is handled in the Social Business Toolkit ▪ BUT it’s still a really really good thing to understand ▪ http://www.slideshare.net/dominopoint/dd12-oauth-for-domino- developers
  • 57. IBM SocialSDK Install • How to install ▪ IBM Getting Started - https://www-10.lotus.com/ldd/lcwiki.nsf/dx/ Installing_on_Domino_Server_SDK1.0 • using an UpdateSite database • doesn’t load? See http://johnjardin.ukuvuma.co.za/2012/05/04/xpages-tip- what-to-check-when-domino-doesnt-install-osgi-plugins-from-updatesite 
 ▪ Circular reference! http://xomino.com/2015/03/08/ibmsbt-in-xpages- getting-set-up-with-a-social-business-toolkit-part-1/ • using file copy technique • method may not be “best practice”, but it will get you up and running
  • 58. IBM SocialSDK (Quick Install Version) • Unzip the file from OpenNTF • Install the plugin in Designer • Set up an update site OR find the “Features” and “Plugins” folders in the archive and place on your server ▪ datadominoworkspaceapplicationseclipse • Re-start server • Register your app for OAuth (if needed) • Open the XPagesSBT.nsf to check that the plugin is working ▪ May need to update the endpoints ▪ http://xomino.com/2015/03/10/ibmsbt-in-xpages-getting-set-up-with-a-social- business-toolkit-part-2/
  • 59. IBM SocialSDK - What Can You Do? • Activities • Bookmarks • Communities • Files • Forums • Profiles • and more http://www.ibmpressbooks.com/store/xpages-extension-library-a-step-by-step-guide-to-the-9780132901819 old but still useful (chapter 13) apps.na.collabserv.com
  • 60. Use the API • Javadocs: ▪ http://infolib.lotus.com/resources/social_business_toolkit/javadoc ▪ Source code: https://github.com/OpenNTF/SocialSDK 
 • Examples: ▪ XPagesSBT.nsf ▪ https://greenhouse.lotus.com/sbt/sbtplayground.nsf/ JavaScriptSnippets.xsp ▪ https://greenhouse.lotus.com/sbt/sbtplayground.nsf/JavaSnippets.xsp ▪ search for “niklas heidloff sbt demo"
  • 61. Adding Connections Functionality to Your DB • Copy the following design elements from XPagesSBT.nsf to your database: ▪ _BasicLogin (XPage) ▪ sbtLoginPanel (Custom Control) ▪ sbtLoginPage (Custom Control) • Open faces-config.xml in XPagesSBT.nsf ▪ copy the <managed-bean> info under "Greenhouse Connections" and add it to the face-config.xml file in your database ▪ modify the "url" and "authenticationPage" references to match your Connections server and local database • In the Xsp Properties of your database (under Application Configuration), make sure com.ibm.xsp.sbtsdk.library is checked on the “Page Generation” tab ▪ if that's not an option, you didn't install the SocialSDK plugins yet
  • 62. IBM SocialSDK - My Files Java public static EntityList<File> getConnectionsFiles() { try { FileService service = new FileService(); // API CHANGE! Used to return FileList EntityList<File> myFiles = service.getMyFiles(); return myFiles; } catch (Exception e) { // log this! return null; } } use this in a dataTable like we did before
  • 63. IBM SocialSDK - My Files JavaScript var fileService = new FileService(); fileService.getMyFiles().then( function(files) { if (files.length == 0) { dom.setText("filesTable", "You do not own any files, you loser."); } else { for(var i=0; i<files.length; i++){ var file = files[i]; createItem(file); } } }
  • 64. IBM SocialSDK - My Files JavaScript
  • 65. Connecting to Other Servers • The StackOverflow example in XPagesSBT.nsf is a good place to start if you want to connect to a custom server • stackoverflow managed bean and GenericStackoverflow.xsp • https://api.stackexchange.com/docs/questions <xe:this.data> <xe:restJsonData var='rest' endpoint="stackoverflow" serviceUrl="/2.0/questions" paramCount="pagesize" paramFirst="page" paramFirstType="page1" splitPath="items"> <xe:this.urlParameters> <xe:urlParameter name="site" value="stackoverflow"></xe:urlParameter> <xe:urlParameter name="order" value="desc"></xe:urlParameter> <xe:urlParameter name="sort" value="activity"></xe:urlParameter> </xe:this.urlParameters> </xe:restJsonData> </xe:this.data>
  • 66. Connecting to Other Servers • You can also connect directly using a ClientService ▪ basic authentication is easy, OAuth takes more work ▪ uses Apache commons HttpClient under the covers ▪ methods for get, post, put, delete RestClient client = new RestClient("http://your.rest.server"); client.setAuthenticator(new RestClient.BasicAuthenticator("username", "password")); Response response = client.get("your/rest/endpoint", ClientService.FORMAT_TEXT); return (String)response.getData();
  • 68. Quickbase • http://www.quickbase.com/api-guide/index.html 
 • What You’ll Need: ▪ An understanding of Quickbase ▪ Quickbase account ▪ JavaScript and HTML for “simple” actions like embedding a table ▪ REST and Java for more complex API calls
  • 69. Quickbase • Embed a Quickbase table in XPages: Somewhere in head of page: <script lang="javascript" src="https://psc.quickbase.com/db/YOUR_DB_ID? a=API_GenResultsTable&apptoken=YOUR_APP_TOKEN&jht=1"> </script> Somewhere in body of page: <script lang="javascript"> qdbWrite(); </script>
  • 71. Quickbase • More complex Quickbase API calls require post and response from Quickbase and your application
 • Most calls require authentication ▪ XPages application posts username and password to QB ▪ QB responds with an authentication token to be used throughout session
  • 72. public static String getResponse(String myURL, String nodePath) { try { URL url = new URL(myURL); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(false); DocumentBuilder builder = factory.newDocumentBuilder(); org.w3c.dom.Document dom = builder.parse( url.openStream() ); Node node = XPathAPI.selectSingleNode(dom, nodePath); return node.getNodeValue(); } catch (Exception e) { // log this! return null; } } Quickbase - Steps for an API call https://target_domain/db/main? a=API_Authenticate&username=PTBa rnum&password=TopSecret&hours=24 <?xml version="1.0" ?> <qdbapi><action>api_authenticate</action> <errcode>0</errcode> <errtext>No error</errtext> <ticket>2_beeinrxmv_dpvx_b_crf8ttndjwyf9bui94 rhciirqcs</ticket> <userid>112245.efy7</userid> </qdbapi>
  • 74. XPages Extension Library • The XPages Extension Library (ExtLib) began as an OpenNTF project in 2011 ▪ https://extlib.openntf.org 
 • As of Domino 9.0, basic components of ExtLib are installed with the server by default ▪ com.ibm.xsp.extlib.* in domino/osgi/shared/eclipse/plugins
 • However, the good stuff is still on OpenNTF
  • 75. Installing ExtLib • Super high-level install instructions ▪ Download from https://extlib.openntf.org ▪ Unzip and extract updateSiteOpenNTF-designer.zip and updateSiteOpenNTF.zip ▪ Create 2 different update site databases: one for Designer, one for Domino server ▪ Install appropriate update sites to server (via notes.ini) and DDE (File - Application - Install) ▪ Restart Domino and DDE https://www-10.lotus.com/ldd/ddwiki.nsf/dx/XPages_Extension_Library_Deployment
  • 76. Using ExtLib With DDE Local Preview • NOTE: after you install, the extension library will work on your Domino server but NOT when using Local Preview on your workstation
 • To also make Local Preview work, see these instructions: ▪ http://www.tlcc.com/admin/tlccsite.nsf/pages/extension-lib
  • 77. Relational Database Support • In 2014, the ExtLib component that allows you to connect XPages directly to relational databases was “promoted” ▪ used to be in the *.extlibx package, now in *.extlib ▪ no longer “experimental”
 • Nice video introduction by Brian Gleeson: ▪ https://www.openntf.org/main.nsf/blog.xsp? permaLink=NHEF-9N7CKD
  • 78. Setting Up Your Database • Use the JDBC Driver Plugin Wizard (DDE Tools menu) to bundle your JDBC driver as a plugin to install on Domino ▪ TIP: you might need to 
 include a license file 
 with your driver
 ▪ install via Update Site 
 like you did with ExtLib 
 and SocialSDK
  • 79. Setting Up Your Database • In XSP Properties of your database (Page Generation tab), make sure com.ibm.xsp.extlib.relational.library is checked
 • In Package Explorer, create a folder called "jdbc" under WebContent/WEB-INF in your database
 • Then create a new file in that folder called MyDbConnection.jdbc ▪ or whatever name you want, with a .jdbc extension
  • 80. Setting Up Your Database
  • 81. Relational Database XPage • Now you can create an XPage with a JDBCQuery data source: ▪ connectionName: MyDbConnection ▪ sqlTable: MOVIEINFO ▪ lots of other settings you can make too (query, etc.) • hover over the setting in the Preferences tab for inline help
 • We can display the data in the same kind of dataTable we used earlier
  • 82. Relational Database XPage <xp:this.data> <xe:jdbcQuery var="jdbcQuery1" connectionName="MyDbConnection" sqlTable="MOVIEINFO" /> </xp:this.data> <xp:dataTable rows="30" id="movieTable" value="#{jdbcQuery1}" var="movie" style="width:50%"> <xp:column id="titleColumn"> <xp:text escape="true" id="titleField" value="#{movie.title}"> </xp:text> </xp:column> <xp:column id="studioColumn"> <xp:text escape="true" id="studioField" value="#{movie.studio}"> </xp:text> </xp:column> <xp:column id="yearColumn"> <xp:text escape="true" id="yearField" value="#{movie.releaseyear}"> </xp:text> </xp:column> </xp:dataTable>
  • 83. Relational Database XPage <xp:this.data> <xe:jdbcQuery var="jdbcQuery1" connectionName="MyDbConnection" sqlTable="MOVIEINFO" /> </xp:this.data> <xp:dataTable rows="30" id="movieTable" value="#{jdbcQuery1}" var="movie" style="width:50%"> <xp:column id="titleColumn"> <xp:text escape="true" id="titleField" value="#{movie.title}"> </xp:text> </xp:column> <xp:column id="studioColumn"> <xp:text escape="true" id="studioField" value="#{movie.studio}"> </xp:text> </xp:column> <xp:column id="yearColumn"> <xp:text escape="true" id="yearField" value="#{movie.releaseyear}"> </xp:text> </xp:column> </xp:dataTable>
  • 85. Paul Calhoun Has More!!! • For a lot more detail (and sage advice), go to Paul Calhoun’s session later this week Wednesday at 10:45! BP-1617: Relational XPages!! Using XPages as the Presentation Layer for RDBMS Data
  • 86. Push or Pull or Passive?
  • 87. Pull integration • Up to this point, we’ve shown how to pull data: ▪ Pulling CSV into our application ▪ Showing files from Connections in our application ▪ Displaying data from Quickbase in our application
  • 88. Push integration • IBM SBT: ▪ The JavaScript snippets include loads of examples like adding a new file, adding an activity, etc. ▪ Upload a new file: fileService.uploadFile("your-file") • Quickbase: ▪ Similarly, the Quickbase REST API allows you to add new records, users, edit records, etc. ▪ Add a new record: https://target_domain/db/target_dbid?a=API_EditRecord&rid=154 &_fnm_second_year=1776&_fid_8=changed&update_id=992017018414 &ticket=auth_ticket&apptoken=app_token
  • 89. Passive integration • Rather than actively pushing data or pulling data, you can passively serve up data for other applications (or your own as we’ll see in a minute) to pull when they need it
 • In XPages, we can passively (and easily) serve up data with a custom REST service
  • 90. Create a REST service • Create a new XPage, called “REST”
 • Change the viewState to “nostate”
 • Add a REST service xe:restService
 • Give it a pathInfo name, this will be part of the URL
 • Click + next to service and add xe:viewItemFileService ▪ At a minimum, add a view name and defaultColumns = true
  • 91. REST service output REST.xsp is our XPage showmovies is the pathInfo Look familiar?
  • 92. Creating Your Own Plugins
  • 93. Java Deployment Options • Java classes directly in DDE ▪ Code -> Java
 • JAR files directly in DDE ▪ Code -> Jars
 • jvm/lib/ext folder
 • Update Site/plugins like Social SDK and ExtLib
  • 94. Build Your Own Plugins • Sometimes it makes sense to bundle your code (or someone else’s) in a plugin for distribution ▪ avoid security exceptions ▪ better performance ▪ use in multiple databases
 • Especially good for really large API libraries ▪ Google, Tableau, etc.
  • 95. It’s A Little Complicated • Hard to get your head around, especially if you’re not an Eclipse developer
 • Tips and instructions ▪ https://www.dalsgaard-data.eu/blog/wrap-an-existing-jar-file-into- a-plug-in ▪ http://www.slideshare.net/paulswithers1/ibm-connected-2015- mas103-xpages-performance-and-scalability ▪ https://www.youtube.com/embed/dchOyzjy9L4 (Niklas Heidloff again!)
  • 97. WAIT! You didn’t talk about ___________!?! • We tried to give you the tools to connect to other services ▪ REST? Direct connect or Social SDK. ▪ Java API? Attach the JAR and go. ▪ JavaScript API? Connect and create/parse info. ▪ Relational Database? Use the Extension Library.
 • The “technology of the month” you want to connect to will likely fall into one of these categories
 • You can do this!
  • 98. Integration Use Cases • Notes to Notes application ▪ Good: Widgets from Sales app to Production Issues app in Notes View ▪ Better: Widgets from Sales to Production in ExtJS user- configurable and -filterable grid on an XPage
 • Notes to IBM Collaboration Software ▪ Good: Display IBM Connections business card in app ▪ Better: Display IBM Connections Cloud files, with likes, comments, and ability to edit in the cloud
  • 99. More Integration Use Cases • Your Application to the Outside World ▪ Good: Display data from another source ▪ Better: Interact with data from another source
 • Example use cases using the tools from this session: ▪ JIRA - “Report a bug” button in your applications (REST + Java) ▪ Quickbase - Update records in a Quickbase application (REST + Java) ▪ o365 - Create a meeting from your Notes app to user’s Outlook calendar (REST + Java… sense a theme here?)
  • 101. Learning Java • The book “Head First Java” is still excellent
 • TLCC has some Notes-specific Java course material
 • The only way to learn it is to use it 
 • Keep in mind that Notes/Domino is still (for now) on Java 6 ▪ cool new Java 7 and Java 8 features aren’t yet available to us
  • 102. Learning XPages • The book “Mastering XPages” sold by IBM Press (2nd edition)
 • XPages Portable Command Guide
 • http://xpages.info • http://www.notesin9.com 
 • If you get stuck, ask questions on http://stackoverflow.com ▪ but please search for an answer first
  • 103. Thank you look here for the slides, and a link to the sample db: http://www.slideshare.net/kjbrown13 http://www.slideshare.net/JulianRobichaux or ask us on Twitter: @IamKathyBrown @jrobichaux
  • 104. 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.
  • 105. Acknowledgements and Disclaimers cont. © Copyright IBM Corporation 2016. 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, Lotus, IBM Domino, IBM Notes, WebSphere, and 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 • Linux is a registered trademark of Linus Torvalds in the United States, other countries, or both. • Microsoft, Windows, Windows NT, and the Windows logo are trademarks of Microsoft Corporation in the United States, other countries, or both. • Java and all Java-based trademarks and logos are trademarks or registered trademarks of Oracle and/or its affiliates. Other company, product, or service names may be trademarks or service marks of others.