Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Allow Saxon licensed editions (EE and PE) #4854

Conversation

alanpaxton
Copy link
Collaborator

@alanpaxton alanpaxton commented Apr 6, 2023

Description:

  • Add support for loading a Saxon configuration file from a location defined in eXist-db's conf.xml.
  • Refactor current code in eXist-db which uses Saxon, to use Saxon configuration and Saxon processor provided by the broker pool (single configuration and processor per broker pool)
  • Introduces a SaxonConfigurationHolder class used by the broker pool to search for and fetch the Saxon configuration referenced by conf.xml and load it into Saxon. The holder holds the saxon configuration lazily, loads it on first request, and retains the same configuration to respond to subsequent requests with.
  • Provide instructions for replacing the SaxonHE bundled in eXist with a licensed Saxon (EE or PE). The changes to configuration loading allow the user to configure their use of a licensed version of Saxon so that xquery functions such as fn:transform() (which uses Saxon as its transformer) can make use of EE and/or PE features.

Reference:

Closes #4813

Type of tests:

  • Basic unit tests to verify the loading of Saxon configuration via the broker pool.
  • The manual procedure to use EE has been validated by installing a clean eXist from an installer Jar built from the feature branch, walking through the instructions and executing a fn:transform() script in eXide. Logging by the configuration holder of the result of querying capabilities of the resulting Saxon processor verified that the running version of Saxon provided all licensed features.

Copy link
Member

@line-o line-o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice Feature! Please have a look at the Codacy output and the exported names.
I also do wonder how this change affects the runtime of fn:transform.
I hope the constructor of this function does only run once and then reuses the static context and configuration within on each call. Is that the case?

@line-o
Copy link
Member

line-o commented Apr 6, 2023

@alanpaxton The commit messages do not conform to our commit message format. They must start with either [enhancement], [bugfix], [refactor] or [ignore].

@line-o line-o added enhancement new features, suggestions, etc. needs documentation Signals issues or PRs that will require an update to the documentation repo labels Apr 6, 2023
@duncdrum duncdrum added this to the eXist-7.0.0 milestone Apr 6, 2023
Copy link
Member

@line-o line-o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for going the extra-mile @alanpaxton !

@line-o
Copy link
Member

line-o commented Apr 6, 2023

@alanpaxton Can you rename your commits to match the commit message format?

@line-o line-o self-requested a review April 6, 2023 15:57
@alanpaxton alanpaxton changed the title Feature/eb 4813 allow Saxon licensed editions (EE and PE) [feature] Allow Saxon licensed editions (EE and PE) Apr 6, 2023
@alanpaxton alanpaxton force-pushed the feature/eb-4813-allow-saxon-licensed-editions branch from 2824238 to 71955d4 Compare April 6, 2023 16:40
@line-o
Copy link
Member

line-o commented Apr 7, 2023

Having learned that it was possible to use Saxon PE and EE up until 6.0.1 I see this as a fix of a regression. I believe this warrants a backport to develop-6.x.x

@adamretter adamretter self-requested a review April 7, 2023 14:08
@adamretter
Copy link
Member

adamretter commented Apr 9, 2023

@line-o EB won't be backporting this at this time, but anyone else is free to do so

@line-o
Copy link
Member

line-o commented Apr 11, 2023

@alanpaxton I believe, @adamretter would like the work in progress commit bc8d9ce to be cleaned from the history before it gets merged.

Copy link
Member

@adamretter adamretter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some minor issues, and one question about the design of the config holder class.

exist-distribution/Saxon-EE.md Outdated Show resolved Hide resolved
exist-distribution/src/main/config/saxon-config.xml Outdated Show resolved Hide resolved
exist-distribution/src/main/config/saxon-config.xml Outdated Show resolved Hide resolved
exist-distribution/src/main/config/conf.xml Show resolved Hide resolved
exist-core/src/main/java/org/exist/storage/BrokerPool.java Outdated Show resolved Hide resolved
@kosek
Copy link

kosek commented Apr 13, 2023

Because of a bug in Saxon 9.9 that has been fixed only for version 10+ it is not possible to integrate Saxon-PE, only Saxon-EE.

See corresponding Saxon bug: https://saxonica.plan.io/issues/4849

I'm not sure whether this bug will be ever fixed in 9.9. Are there any plans/estimates to use Saxon 10/11 in exist-db?

Set up to configure Saxon with a license for PE/EE if we find such a license, assume at that point that PE/EE has been manually installed.

WIP - not fully tested, UT or manually, and we need manual testing after installing EE to confirm that we can get the features we want.

[fix] Remove licence file stuff, comment code

There is no point in us pushing a licence file into Saxon from a different place, because as soon as we ask Saxon to load a configuration it looks for a licence file.

We will just ask to dump a licence file where Saxon expects it by default.

Comment the methods in the configuration holder.
The saxon-config.xml file we supply does nothing, it just acts as a placeholder for a fully-realised saxon-config.xml when a licensed Saxon edition is installed.
Instructions in markdown for how to achieve this.
Saxon config tests that we find the saxon config file; the part about looking for a license file is not implemented.
De-genericize static names
Don’t capitalize static method
Remove unused imports
Unpick method for complexity metric
Re-order some qualifiers
Make markdown conform to checker rules
We don’t need a map of broker pool to saxon config, I’m not sure why we made it like that in the first place. Broker pool just needs a (lazy) reference to its own saxon configuration (wrapper).
@alanpaxton alanpaxton force-pushed the feature/eb-4813-allow-saxon-licensed-editions branch from 71955d4 to 9772b00 Compare April 24, 2023 14:56
@alanpaxton
Copy link
Collaborator Author

Because of a bug in Saxon 9.9 that has been fixed only for version 10+ it is not possible to integrate Saxon-PE, only Saxon-EE.

See corresponding Saxon bug: https://saxonica.plan.io/issues/4849

I'm not sure whether this bug will be ever fixed in 9.9. Are there any plans/estimates to use Saxon 10/11 in exist-db?

I had a look at upgrading to 11 when I started this, but saxon has changed the regex code which we fork as a separate repo and include in exist, so there's some quantity more work involved to update and resolve that conflict.

@adamretter adamretter self-requested a review April 28, 2023 13:45
Copy link
Member

@adamretter adamretter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the review comments - LGTM :-)

@sonarcloud
Copy link

sonarcloud bot commented Apr 28, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 10 Code Smells

66.4% 66.4% Coverage
0.0% 0.0% Duplication

@adamretter
Copy link
Member

@line-o Can this be merged now then?

@adamretter adamretter merged commit ba68294 into eXist-db:develop May 10, 2023
7 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement new features, suggestions, etc. needs documentation Signals issues or PRs that will require an update to the documentation repo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature] Allow usage of Saxon PE/EE
5 participants