-
-
Notifications
You must be signed in to change notification settings - Fork 550
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
XWIKI-22481: Add the ability to use a LibreOffice binary from another server #3610
base: master
Are you sure you want to change the base?
Conversation
… server. * Fix checkstyle issue.
*/ | ||
default String getWorkDir() | ||
{ | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not ideal, but I did not want to break the stable interface. The failover is implemented by the component that call getWorkDir()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to use Optional<String>
as the return value, see https://dev.xwiki.org/xwiki/bin/view/Community/CodeStyle/JavaCodeStyle/#HOptional
@@ -350,6 +350,10 @@ rendering.transformations = $xwikiRenderingTransformations | |||
#-# 1 - Externally managed (local) server instance. | |||
# openoffice.serverType = 0 | |||
|
|||
#-# [Since 16.10RC1] | |||
#-# Hostname used for connecting to the openoffice server instance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing the explanation about what is the default value if not specified.
@@ -371,6 +375,11 @@ rendering.transformations = $xwikiRenderingTransformations | |||
#-# If no path is provided, a default value will be calculated based on the operating environment. | |||
# openoffice.profilePath = /home/user/.openoffice.org/3 | |||
|
|||
#-# [Since 16.10RC1] | |||
#-# Path to a folder where XWiki could exchange temporary files with the openoffice server. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/could/will ?
@@ -137,6 +138,7 @@ public void initialize() throws OfficeServerException | |||
ExternalOfficeManager.Builder externalProcessOfficeManager = ExternalOfficeManager.builder(); | |||
externalProcessOfficeManager.portNumbers(this.config.getServerPorts()); | |||
externalProcessOfficeManager.connectOnStart(true); | |||
externalProcessOfficeManager.hostName(config.getServerHost()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure that 127.0.0.1
is the default? (vs localhost
for example).
Another option is to set the a host only if not empty in the XWiki config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirm that 127.0.0.1
is the default -> https://github.com/jodconverter/jodconverter/blob/master/jodconverter-local/src/main/java/org/jodconverter/local/office/ExternalOfficeManager.java#L60
* @return the hostname of the office server instance | ||
* @since 16.10.0RC1 | ||
*/ | ||
default String getServerHost() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing @Unstable
annotation.
* environment temporary directory) | ||
* @see 16.10.0RC1 | ||
*/ | ||
default String getWorkDir() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also missing unstable annotation. And I think now we have an annotation when it's nullable, I need to double check that.
Now I would have considered that both null or empty would mean to fallback on default temp env.
/** | ||
* @see OfficeServerConfiguration#getServerHost() | ||
*/ | ||
private static final String DEFAULT_SERVER_HOST = "127.0.0.1"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to not expose the constant in OfficeServerConfiguration and reuse it here?
File workDir = this.environment.getTemporaryDirectory(); | ||
this.converter = new DefaultOfficeConverter(this.jodConverter, workDir); | ||
if (StringUtils.isNotBlank(this.config.getWorkDir())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok so it confirms it can be empty or null so the javadoc needs to be improved.
@@ -350,6 +350,10 @@ rendering.transformations = $xwikiRenderingTransformations | |||
#-# 1 - Externally managed (local) server instance. | |||
# openoffice.serverType = 0 | |||
|
|||
#-# [Since 16.10RC1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's 16.10.0RC1.
Btw you don't need that in other branches?
@@ -350,6 +350,10 @@ rendering.transformations = $xwikiRenderingTransformations | |||
#-# 1 - Externally managed (local) server instance. | |||
# openoffice.serverType = 0 | |||
|
|||
#-# [Since 16.10RC1] | |||
#-# Hostname used for connecting to the openoffice server instance. | |||
# openoffice.host = localhost |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default 127.0.0.1 should be used here no?
#-# [Since 16.10RC1] | ||
#-# Path to a folder where XWiki could exchange temporary files with the openoffice server. | ||
#-# If no path is provided, the temporary folder set for XWiki will be used. | ||
# openoffice.workDir = /tmp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default should be empty no?
Thank you for all your comments! It was definitively needed! |
… server. * Use Optional<String> instead of plain String in OfficeServerConfiguration#getWorkDir(). * Improve the comments in xwiki.properties.
I have pushed my changes, thanks! |
@gdelhumeau I don't think I've seen any update to the Admin UI at http://localhost:8080/xwiki/bin/admin/XWiki/XWikiPreferences?editor=globaladmin§ion=XWiki.OfficeImporterAdmin Isn't that required? For example to display the server host used. Thanks |
Also we already have this config:
I'm not sure how it interacts with your change. On one hand, a value of 1 is what you're doing since it's externally managed, but OTOH it's not a local server instance. Does it mean that right now we can use your new config property AND keep Thx |
These changes only apply when Actually we have a constant |
… server. * Handle the SERVER_TYPE_EXTERNAL_REMOTE use-case. * Update OfficeImporterAdmin.
@vmassol @surli Did you have the chance to take a look? Do you want a proper proposal on the forum? Maybe you were expecting a proper "remote" behavior where we wouldn't have to share any drive but I don't have the time to implement this and I think what I'm proposing is already an improvement (at least it fixes the problem I have with my Docker/Kubernetes use-case). |
Jira URL
https://jira.xwiki.org/browse/XWIKI-22481
Changes
Description
I have introduced 2 new properties in xwiki.properties:
openoffice.host
to set the hostname of the openoffice server (in case it not reachable at "localhost")openoffice.workDir
to set the folder where the files are exchanged, temporary, between XWiki and the openoffice server (same: useful in a kubernetes environment where we need to mount a common volume between the 2 containers).Clarifications
I have not made commit on xwiki-platform for a while, so I prefer asking for a quick confirmation before merging. Thank you!
I have not built on the current master branch, but it built successfully against the 16.4.4 tag.