SlideShare a Scribd company logo
1 of 31
Download to read offline
1
Coffee from a Friend:
Using Third Party Java Libraries
2014/03/18– Matthew Fyleman
2
 Matthew Fyleman
 21 YearsasaNotes/Domino Developer
 MostlyWorking on:
 Xpagesconversions
 Product development
Who AmI?
3
 Based on MyExperiences
 Beginner Level!
 Using JavaGenerally in XPages
 Will focuson .jar files, but will look at other
waysof incorporating Java
 What to usewhen
What isthisTalk About?
4
 Why Java?
 Advantagesover SSJS
 Java Options
 Prepackaged Options
 .jarspackaged into Extension Libraries
 OpenNTF.org
 ApachePOI Example
 Raw Libraries
 Deploying
 Incorporation
 Security
 Creating .jars
 Questions
What amI talking about?
5
It hasa better structure than ssjs
 Stronglytyped
 Object Oriented fromtheground up
It‘sa very useful skill
 Widelyused outsideNotes/Domino
 Encouragesbetter programming practise
Why Java?– 1. Thebasics
6
<<Demonstration>>
Why Java?– 2. ItsFaster than SSJS
But not asmuch asyou might think!
7
Seealso Stephan Wissel‘sblog post:
http://www.wissel.net/blog/d6plinks/SHWL-8SLCVR
Why Java?– 3. ItsEasier to Debug
8
Why Java?– 4. ThereareLotsof 3rd Party Libraries
 AdobeAcrobat (PDF) Manipulation
 Word and Excel Creation and Modification
 XMLparsing
 ... Many more
 If you need it, thereisprobably a Java
library out there
 Tested and stable(relatively!)
9
 Raw Java
 You’realreadydoing this!
 JavaClassFiles
 Better for development
 .jarsprovideobfuscation
 .jarsareeasilyportable– writeonceuseanywhere
 Managed Beans
 Much easier to createthan you might think
 Automatically work within ascope
 .jar Files
Java Options
10
 Almost certainly donethisalready:
 var vecThis= new java.util.Vector();
 Can Import Packages
 importPackage(java.util);
 var vecThis= new Vector();
 Can beadisadvantage, particularly for beginners!
Java Options– Raw Java
11
 Easyto create
 In thecodesection under Java
 Createnew java class
Java Options– ClassFiles
12
 Need to generate constructor?
 Under thesourcemenu
 GenerateConstructor using ...
 Gettersand Setters?
 Samemenu
 Correct indentation?
 Samemenu
Java Options– Getting Help FromEclipse
13
Rulesfor Managed Beans
 If you haveaconstructor, it must beparameterless
 Fieldsin your classareonlypublically accessiblethrough gettersand
setters
 To support persistenceit should implement theSerializableinterface
 It needsan entryin thefaces-config.xml file
 SeePer Laustenspage‘Creating Your First managed bean for
Xpages’
http://per.lausten.dk/blog/2012/02/creating-your-first-
managed-bean-for-xpages.html
Java Options– Managed Beans
14
 You are probably not the first!
 Check OpenNTF.org
 Pre-Packaged into an Extension Library
 Easyto Use
 Documentation (?)
 Onceext lib installed, no securitysettingsto
think about
Pre-Packaged Options
15
 Demonstration
Pre-Packaged Options
16
 Not AlwaysAvailable
 Extension Librariesneed to be
deployed to the server!
 What can you do if thisisnot an option?
Pre-Packaged Options- Issues
17
 Thiswasthesituation I found myself in on arecent project
 Customer needed .docx filemanipulation
 Customer would not permit third party deployment to the
server
 Deployed thePOI Libswithin myApplication
 No Deployment to theServer (technically speaking!)
 Simple
 Still had accessto theFunctionality
UsetheLibrary‘RAW‘
18
 ThreeOptions:
1. Deployto theserver filesystem
 Non-starter
2. Deployunder WEB-INF
 Better but onlyuseif you are8.5.2 or lower
3. Deployto jar areaunder ‘code‘
 Best option
Deployment Options
19
 Java Librariesfor manipulatingMicrosoft Word and
Excel files
 Open Source
 Main library ispoi-3.9-20121203.jar
 But you will need othersparticularly if you wish to
work on docx and xlsx
 dom4j-1.6.1.jar
 stax-api-1.0.1.jar
 xmlbeans-2.3.0.jar
ApachePOI Project
20
 To create an Excel spreadsheet using POI, have your
code perform the following steps:
 Createaworkbook object:
var xl=new org.apache.poi.hssf.usermodel.HSSFWorkbook();
 Add asheet to theworkbook:
var sheet = xl.createSheet("Sheet 1");
ApachePOI Creating aSpreadsheet
21
 Add arow to thesheet
 They start at 0
row = sheet.createRow(rowCount++);
 Writedatainto cellsinto each row
cell = row.createCell((java.lang.Integer)(cellCount++));
cell.setCellValue(document.getItemValueString(“AField”));
 Watch out!
ApachePOI Creating aSpreadsheet
22
 Demonstration
Deployment
23
 Sooner or later you will hit this
 Need to edit the‘java.policy’ file
 Proper wayisto databasespecificentry
 For Production Systems
 Doesn’t work on Domino 9 ?
 For Dev EnvironmentsYou Can Cheat!
grant { permission java.security.AllPermission; };
 Seeblog post ‘JavaSecurity in Xpages’ fromStephan Wissel:
 http://www.wissel.net/blog/d6plinks/SHWL-8JYAT5
 don‘t missNathan Freeman‘scomment!
Deployment - SecurityIssues
24
 Similar to working with Excel:
 Get thedocument
 Get document’sparagraphs
 Get thetext runsin theparagraphs
 Search and replacein text runs
 Get thetables
 Iteratethrough therows
 Iteratethrough thecells
 Do paragraph search and replacein each cell
ApachePOI Search and Replacein Word
25
 Java Librariesfor manipulating AdobeAcrobat
(pdf) documents
 Open Source– but ApacheLicense!
 Main library isitextpdf-5.5.0.jar
 UnlikePOI, thisisall you need for basicPDFs
iTextPdf
26
 Itsopen sourceso itsfree, right?
 Maybe, but check thelicense
 E.g. ApacheLicense
 Freeto useif your softwareisalso distributed under an
ApacheLicense
 Otherwisetheremaybeafeefor commercial use
 iText – OEM license, 125 desktops, approx. $3,000
Deployment - LicenseIssues
27
 Doing a lot of @Formula conversion to SSJS
 Encountering a lot of List Ops
 SSJShasno built in permutation operations
 Wanted alibrary of List Op utilities
What About MyOwn .jars
28
In Domino:
 Createtheclassfiles
 Test and debug
 Go to packageexplorer view
 Fileexport
 Createthe.jar
 Deployinto your database
- Simple!
MyOwn jar
29
 We4IT– www.we4it.com
 OpenNTF– www.openntf.org
 Ulrich Krause– www.eknori.de
 Wissel.net – Stephan Wissel‘sblog
 XpagesPortableCommand Guide–
Martin Donnelly et. al., IBM Press
Resourcesand Information
30
Questions?
31
matthew.fyleman@we4it.com

More Related Content

Similar to bccon-2014 dev02 xpages-coffe-from-a-friend-using-third-party-java-libraries

Icsug conf 14_dev02_xpages-coffe-from-a-friend-using-third-party-java-libraries
Icsug conf 14_dev02_xpages-coffe-from-a-friend-using-third-party-java-librariesIcsug conf 14_dev02_xpages-coffe-from-a-friend-using-third-party-java-libraries
Icsug conf 14_dev02_xpages-coffe-from-a-friend-using-third-party-java-librariesICS User Group
 
Integrating Maven with Eclipse
Integrating Maven with EclipseIntegrating Maven with Eclipse
Integrating Maven with EclipseNikhil Bharati
 
Google Hacking Lab ClassNameDate This is an introducti.docx
Google Hacking Lab ClassNameDate This is an introducti.docxGoogle Hacking Lab ClassNameDate This is an introducti.docx
Google Hacking Lab ClassNameDate This is an introducti.docxwhittemorelucilla
 
Neo4j Stored Procedure Training Part 1
Neo4j Stored Procedure Training Part 1Neo4j Stored Procedure Training Part 1
Neo4j Stored Procedure Training Part 1Max De Marzi
 
Big data key-value and column stores redis - cassandra
Big data  key-value and column stores redis - cassandraBig data  key-value and column stores redis - cassandra
Big data key-value and column stores redis - cassandraJWORKS powered by Ordina
 
Maven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable ResultsMaven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable ResultsSteve Keener
 
Exploit Frameworks
Exploit FrameworksExploit Frameworks
Exploit Frameworksphanleson
 
Sai devops - the art of being specializing generalist
Sai   devops - the art of being specializing generalistSai   devops - the art of being specializing generalist
Sai devops - the art of being specializing generalistOdd-e
 
Get ready for FRC 2015: Intro to Java 5 through 8 updates and Eclipse
Get ready for FRC 2015: Intro to Java 5 through 8 updates and EclipseGet ready for FRC 2015: Intro to Java 5 through 8 updates and Eclipse
Get ready for FRC 2015: Intro to Java 5 through 8 updates and EclipseJeanne Boyarsky
 
Migraine Drupal - syncing your staging and live sites
Migraine Drupal - syncing your staging and live sitesMigraine Drupal - syncing your staging and live sites
Migraine Drupal - syncing your staging and live sitesdrupalindia
 
Performance Analysis of Idle Programs
Performance Analysis of Idle ProgramsPerformance Analysis of Idle Programs
Performance Analysis of Idle Programsgreenwop
 
Automated Web Testing With Selenium
Automated Web Testing With SeleniumAutomated Web Testing With Selenium
Automated Web Testing With SeleniumJodie Miners
 
7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins Users7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins UsersAndrew Bayer
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applicationshchen1
 
Jared Whitlock Open Source In The Enterprise Plone @ Novell
Jared Whitlock   Open Source In The Enterprise    Plone @ NovellJared Whitlock   Open Source In The Enterprise    Plone @ Novell
Jared Whitlock Open Source In The Enterprise Plone @ NovellVincenzo Barone
 
Puppet for Sys Admins
Puppet for Sys AdminsPuppet for Sys Admins
Puppet for Sys AdminsPuppet
 

Similar to bccon-2014 dev02 xpages-coffe-from-a-friend-using-third-party-java-libraries (20)

Icsug conf 14_dev02_xpages-coffe-from-a-friend-using-third-party-java-libraries
Icsug conf 14_dev02_xpages-coffe-from-a-friend-using-third-party-java-librariesIcsug conf 14_dev02_xpages-coffe-from-a-friend-using-third-party-java-libraries
Icsug conf 14_dev02_xpages-coffe-from-a-friend-using-third-party-java-libraries
 
Integrating Maven with Eclipse
Integrating Maven with EclipseIntegrating Maven with Eclipse
Integrating Maven with Eclipse
 
Google Hacking Lab ClassNameDate This is an introducti.docx
Google Hacking Lab ClassNameDate This is an introducti.docxGoogle Hacking Lab ClassNameDate This is an introducti.docx
Google Hacking Lab ClassNameDate This is an introducti.docx
 
How java works
How java worksHow java works
How java works
 
How java works
How java worksHow java works
How java works
 
Neo4j Stored Procedure Training Part 1
Neo4j Stored Procedure Training Part 1Neo4j Stored Procedure Training Part 1
Neo4j Stored Procedure Training Part 1
 
Big data key-value and column stores redis - cassandra
Big data  key-value and column stores redis - cassandraBig data  key-value and column stores redis - cassandra
Big data key-value and column stores redis - cassandra
 
Maven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable ResultsMaven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable Results
 
Exploit Frameworks
Exploit FrameworksExploit Frameworks
Exploit Frameworks
 
Sai devops - the art of being specializing generalist
Sai   devops - the art of being specializing generalistSai   devops - the art of being specializing generalist
Sai devops - the art of being specializing generalist
 
Get ready for FRC 2015: Intro to Java 5 through 8 updates and Eclipse
Get ready for FRC 2015: Intro to Java 5 through 8 updates and EclipseGet ready for FRC 2015: Intro to Java 5 through 8 updates and Eclipse
Get ready for FRC 2015: Intro to Java 5 through 8 updates and Eclipse
 
Java tutorial
Java tutorialJava tutorial
Java tutorial
 
Migraine Drupal - syncing your staging and live sites
Migraine Drupal - syncing your staging and live sitesMigraine Drupal - syncing your staging and live sites
Migraine Drupal - syncing your staging and live sites
 
01 spring-intro
01 spring-intro01 spring-intro
01 spring-intro
 
Performance Analysis of Idle Programs
Performance Analysis of Idle ProgramsPerformance Analysis of Idle Programs
Performance Analysis of Idle Programs
 
Automated Web Testing With Selenium
Automated Web Testing With SeleniumAutomated Web Testing With Selenium
Automated Web Testing With Selenium
 
7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins Users7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins Users
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
 
Jared Whitlock Open Source In The Enterprise Plone @ Novell
Jared Whitlock   Open Source In The Enterprise    Plone @ NovellJared Whitlock   Open Source In The Enterprise    Plone @ Novell
Jared Whitlock Open Source In The Enterprise Plone @ Novell
 
Puppet for Sys Admins
Puppet for Sys AdminsPuppet for Sys Admins
Puppet for Sys Admins
 

More from ICS User Group

bccon-2014 str05 ibm-smart_cloud-for-social-business
bccon-2014 str05 ibm-smart_cloud-for-social-businessbccon-2014 str05 ibm-smart_cloud-for-social-business
bccon-2014 str05 ibm-smart_cloud-for-social-businessICS User Group
 
bccon-2014 str06 ibm-notes-browser-plug-in_9.0.1
bccon-2014 str06 ibm-notes-browser-plug-in_9.0.1bccon-2014 str06 ibm-notes-browser-plug-in_9.0.1
bccon-2014 str06 ibm-notes-browser-plug-in_9.0.1ICS User Group
 
bccon-2014 dev03 xpages-road_to_damascas-lotus-script-and-@formula-to-ssjs
bccon-2014 dev03 xpages-road_to_damascas-lotus-script-and-@formula-to-ssjsbccon-2014 dev03 xpages-road_to_damascas-lotus-script-and-@formula-to-ssjs
bccon-2014 dev03 xpages-road_to_damascas-lotus-script-and-@formula-to-ssjsICS User Group
 
bccon-2014 adm04 ibm-domino-64bit-all-you-need-to-know
bccon-2014 adm04 ibm-domino-64bit-all-you-need-to-knowbccon-2014 adm04 ibm-domino-64bit-all-you-need-to-know
bccon-2014 adm04 ibm-domino-64bit-all-you-need-to-knowICS User Group
 
bccon-2014 dev04 domino_apps_reaching_up&out
bccon-2014 dev04 domino_apps_reaching_up&outbccon-2014 dev04 domino_apps_reaching_up&out
bccon-2014 dev04 domino_apps_reaching_up&outICS User Group
 
bccon-2014 com02 level-up_building_next_generation_business_applications
bccon-2014 com02 level-up_building_next_generation_business_applicationsbccon-2014 com02 level-up_building_next_generation_business_applications
bccon-2014 com02 level-up_building_next_generation_business_applicationsICS User Group
 
bccon-2014 cas01 ibm-notes-upgrades-in-der-kaffeepause
bccon-2014 cas01 ibm-notes-upgrades-in-der-kaffeepausebccon-2014 cas01 ibm-notes-upgrades-in-der-kaffeepause
bccon-2014 cas01 ibm-notes-upgrades-in-der-kaffeepauseICS User Group
 
bccon-2014 adm06 hony,_i_shrunk_the_data
bccon-2014 adm06 hony,_i_shrunk_the_databccon-2014 adm06 hony,_i_shrunk_the_data
bccon-2014 adm06 hony,_i_shrunk_the_dataICS User Group
 
bccon-2014 adm05 ibm traveler-2013-and-beyond
bccon-2014 adm05 ibm traveler-2013-and-beyondbccon-2014 adm05 ibm traveler-2013-and-beyond
bccon-2014 adm05 ibm traveler-2013-and-beyondICS User Group
 
bccon-2014 adm01 tipps-und-skripts-aus-dem-leben-eines-ibm-connections-admins
bccon-2014 adm01 tipps-und-skripts-aus-dem-leben-eines-ibm-connections-adminsbccon-2014 adm01 tipps-und-skripts-aus-dem-leben-eines-ibm-connections-admins
bccon-2014 adm01 tipps-und-skripts-aus-dem-leben-eines-ibm-connections-adminsICS User Group
 

More from ICS User Group (11)

bccon-2014 str05 ibm-smart_cloud-for-social-business
bccon-2014 str05 ibm-smart_cloud-for-social-businessbccon-2014 str05 ibm-smart_cloud-for-social-business
bccon-2014 str05 ibm-smart_cloud-for-social-business
 
bccon-2014 str06 ibm-notes-browser-plug-in_9.0.1
bccon-2014 str06 ibm-notes-browser-plug-in_9.0.1bccon-2014 str06 ibm-notes-browser-plug-in_9.0.1
bccon-2014 str06 ibm-notes-browser-plug-in_9.0.1
 
bccon-2014 dev03 xpages-road_to_damascas-lotus-script-and-@formula-to-ssjs
bccon-2014 dev03 xpages-road_to_damascas-lotus-script-and-@formula-to-ssjsbccon-2014 dev03 xpages-road_to_damascas-lotus-script-and-@formula-to-ssjs
bccon-2014 dev03 xpages-road_to_damascas-lotus-script-and-@formula-to-ssjs
 
bccon-2014 adm04 ibm-domino-64bit-all-you-need-to-know
bccon-2014 adm04 ibm-domino-64bit-all-you-need-to-knowbccon-2014 adm04 ibm-domino-64bit-all-you-need-to-know
bccon-2014 adm04 ibm-domino-64bit-all-you-need-to-know
 
bccon-2014 dev04 domino_apps_reaching_up&out
bccon-2014 dev04 domino_apps_reaching_up&outbccon-2014 dev04 domino_apps_reaching_up&out
bccon-2014 dev04 domino_apps_reaching_up&out
 
bccon-2014 com02 level-up_building_next_generation_business_applications
bccon-2014 com02 level-up_building_next_generation_business_applicationsbccon-2014 com02 level-up_building_next_generation_business_applications
bccon-2014 com02 level-up_building_next_generation_business_applications
 
bccon-2014 cas01 ibm-notes-upgrades-in-der-kaffeepause
bccon-2014 cas01 ibm-notes-upgrades-in-der-kaffeepausebccon-2014 cas01 ibm-notes-upgrades-in-der-kaffeepause
bccon-2014 cas01 ibm-notes-upgrades-in-der-kaffeepause
 
bccon-2014 adm06 hony,_i_shrunk_the_data
bccon-2014 adm06 hony,_i_shrunk_the_databccon-2014 adm06 hony,_i_shrunk_the_data
bccon-2014 adm06 hony,_i_shrunk_the_data
 
bccon-2014 adm05 ibm traveler-2013-and-beyond
bccon-2014 adm05 ibm traveler-2013-and-beyondbccon-2014 adm05 ibm traveler-2013-and-beyond
bccon-2014 adm05 ibm traveler-2013-and-beyond
 
bccon-2014 adm01 tipps-und-skripts-aus-dem-leben-eines-ibm-connections-admins
bccon-2014 adm01 tipps-und-skripts-aus-dem-leben-eines-ibm-connections-adminsbccon-2014 adm01 tipps-und-skripts-aus-dem-leben-eines-ibm-connections-admins
bccon-2014 adm01 tipps-und-skripts-aus-dem-leben-eines-ibm-connections-admins
 
bccon-2014-welcome
bccon-2014-welcomebccon-2014-welcome
bccon-2014-welcome
 

Recently uploaded

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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
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
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 

Recently uploaded (20)

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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
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
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

bccon-2014 dev02 xpages-coffe-from-a-friend-using-third-party-java-libraries

  • 1. 1 Coffee from a Friend: Using Third Party Java Libraries 2014/03/18– Matthew Fyleman
  • 2. 2  Matthew Fyleman  21 YearsasaNotes/Domino Developer  MostlyWorking on:  Xpagesconversions  Product development Who AmI?
  • 3. 3  Based on MyExperiences  Beginner Level!  Using JavaGenerally in XPages  Will focuson .jar files, but will look at other waysof incorporating Java  What to usewhen What isthisTalk About?
  • 4. 4  Why Java?  Advantagesover SSJS  Java Options  Prepackaged Options  .jarspackaged into Extension Libraries  OpenNTF.org  ApachePOI Example  Raw Libraries  Deploying  Incorporation  Security  Creating .jars  Questions What amI talking about?
  • 5. 5 It hasa better structure than ssjs  Stronglytyped  Object Oriented fromtheground up It‘sa very useful skill  Widelyused outsideNotes/Domino  Encouragesbetter programming practise Why Java?– 1. Thebasics
  • 6. 6 <<Demonstration>> Why Java?– 2. ItsFaster than SSJS But not asmuch asyou might think!
  • 7. 7 Seealso Stephan Wissel‘sblog post: http://www.wissel.net/blog/d6plinks/SHWL-8SLCVR Why Java?– 3. ItsEasier to Debug
  • 8. 8 Why Java?– 4. ThereareLotsof 3rd Party Libraries  AdobeAcrobat (PDF) Manipulation  Word and Excel Creation and Modification  XMLparsing  ... Many more  If you need it, thereisprobably a Java library out there  Tested and stable(relatively!)
  • 9. 9  Raw Java  You’realreadydoing this!  JavaClassFiles  Better for development  .jarsprovideobfuscation  .jarsareeasilyportable– writeonceuseanywhere  Managed Beans  Much easier to createthan you might think  Automatically work within ascope  .jar Files Java Options
  • 10. 10  Almost certainly donethisalready:  var vecThis= new java.util.Vector();  Can Import Packages  importPackage(java.util);  var vecThis= new Vector();  Can beadisadvantage, particularly for beginners! Java Options– Raw Java
  • 11. 11  Easyto create  In thecodesection under Java  Createnew java class Java Options– ClassFiles
  • 12. 12  Need to generate constructor?  Under thesourcemenu  GenerateConstructor using ...  Gettersand Setters?  Samemenu  Correct indentation?  Samemenu Java Options– Getting Help FromEclipse
  • 13. 13 Rulesfor Managed Beans  If you haveaconstructor, it must beparameterless  Fieldsin your classareonlypublically accessiblethrough gettersand setters  To support persistenceit should implement theSerializableinterface  It needsan entryin thefaces-config.xml file  SeePer Laustenspage‘Creating Your First managed bean for Xpages’ http://per.lausten.dk/blog/2012/02/creating-your-first- managed-bean-for-xpages.html Java Options– Managed Beans
  • 14. 14  You are probably not the first!  Check OpenNTF.org  Pre-Packaged into an Extension Library  Easyto Use  Documentation (?)  Onceext lib installed, no securitysettingsto think about Pre-Packaged Options
  • 16. 16  Not AlwaysAvailable  Extension Librariesneed to be deployed to the server!  What can you do if thisisnot an option? Pre-Packaged Options- Issues
  • 17. 17  Thiswasthesituation I found myself in on arecent project  Customer needed .docx filemanipulation  Customer would not permit third party deployment to the server  Deployed thePOI Libswithin myApplication  No Deployment to theServer (technically speaking!)  Simple  Still had accessto theFunctionality UsetheLibrary‘RAW‘
  • 18. 18  ThreeOptions: 1. Deployto theserver filesystem  Non-starter 2. Deployunder WEB-INF  Better but onlyuseif you are8.5.2 or lower 3. Deployto jar areaunder ‘code‘  Best option Deployment Options
  • 19. 19  Java Librariesfor manipulatingMicrosoft Word and Excel files  Open Source  Main library ispoi-3.9-20121203.jar  But you will need othersparticularly if you wish to work on docx and xlsx  dom4j-1.6.1.jar  stax-api-1.0.1.jar  xmlbeans-2.3.0.jar ApachePOI Project
  • 20. 20  To create an Excel spreadsheet using POI, have your code perform the following steps:  Createaworkbook object: var xl=new org.apache.poi.hssf.usermodel.HSSFWorkbook();  Add asheet to theworkbook: var sheet = xl.createSheet("Sheet 1"); ApachePOI Creating aSpreadsheet
  • 21. 21  Add arow to thesheet  They start at 0 row = sheet.createRow(rowCount++);  Writedatainto cellsinto each row cell = row.createCell((java.lang.Integer)(cellCount++)); cell.setCellValue(document.getItemValueString(“AField”));  Watch out! ApachePOI Creating aSpreadsheet
  • 23. 23  Sooner or later you will hit this  Need to edit the‘java.policy’ file  Proper wayisto databasespecificentry  For Production Systems  Doesn’t work on Domino 9 ?  For Dev EnvironmentsYou Can Cheat! grant { permission java.security.AllPermission; };  Seeblog post ‘JavaSecurity in Xpages’ fromStephan Wissel:  http://www.wissel.net/blog/d6plinks/SHWL-8JYAT5  don‘t missNathan Freeman‘scomment! Deployment - SecurityIssues
  • 24. 24  Similar to working with Excel:  Get thedocument  Get document’sparagraphs  Get thetext runsin theparagraphs  Search and replacein text runs  Get thetables  Iteratethrough therows  Iteratethrough thecells  Do paragraph search and replacein each cell ApachePOI Search and Replacein Word
  • 25. 25  Java Librariesfor manipulating AdobeAcrobat (pdf) documents  Open Source– but ApacheLicense!  Main library isitextpdf-5.5.0.jar  UnlikePOI, thisisall you need for basicPDFs iTextPdf
  • 26. 26  Itsopen sourceso itsfree, right?  Maybe, but check thelicense  E.g. ApacheLicense  Freeto useif your softwareisalso distributed under an ApacheLicense  Otherwisetheremaybeafeefor commercial use  iText – OEM license, 125 desktops, approx. $3,000 Deployment - LicenseIssues
  • 27. 27  Doing a lot of @Formula conversion to SSJS  Encountering a lot of List Ops  SSJShasno built in permutation operations  Wanted alibrary of List Op utilities What About MyOwn .jars
  • 28. 28 In Domino:  Createtheclassfiles  Test and debug  Go to packageexplorer view  Fileexport  Createthe.jar  Deployinto your database - Simple! MyOwn jar
  • 29. 29  We4IT– www.we4it.com  OpenNTF– www.openntf.org  Ulrich Krause– www.eknori.de  Wissel.net – Stephan Wissel‘sblog  XpagesPortableCommand Guide– Martin Donnelly et. al., IBM Press Resourcesand Information