SlideShare uma empresa Scribd logo
1 de 31
Baixar para ler 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

Mais conteúdo relacionado

Semelhante a 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
 

Semelhante a 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
 

Mais de 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
 

Mais de 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
 

Último

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 

Último (20)

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 

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