Oxygen Hooks for SVN Client

Post here questions and problems related to oXygen frameworks/document types.
jlpoole
Posts: 23
Joined: Sun Jan 15, 2017 3:15 pm
Location: Salem, Oregon

Oxygen Hooks for SVN Client

Post by jlpoole » Tue Oct 30, 2018 11:40 pm

I'd like to be able to have some custom code within Oxygen validate and perform some tests on any XML that is about to be checked into Subversion. If the tests fail, check-in is denied or whatever.

I'm not finding any "hooks" within Oxygen for check-in, although I see a custom content management system ("CMS") plugin at https://www.oxygenxml.com/doc/versions/ ... lugin.html. What I'd like is to be able to use the SVN Client and hook my customizations at pre-check-in and post check-in (e.g. getting the version number of the just checked-in item).

Is it possible such hooks could be made available?

Radu
Posts: 6979
Joined: Fri Jul 09, 2004 5:18 pm

Re: Oxygen Hooks for SVN Client

Post by Radu » Wed Oct 31, 2018 9:30 am

Hi John,

Could you give me an example with a custom validation check you try to do?

We do not have any API which would notify you before and after our embedded SVN Client is used to commit a resource.
We do have API to allow you to add a custom validation processor:

ro.sync.exml.workspace.api.editor.WSEditor.addValidationProblemsFilter(ValidationProblemsFilter)

https://www.oxygenxml.com/InstData/Edit ... ditor.html

Such a processor would be called every time validation is done (either manual validation or automatic validation which is done every time you type). So you could use it to add your own validation checks.
Or you can define a custom validation scenario for your type of XML documents which adds a Schematron schema to check additional rules:

http://blog.oxygenxml.com/2017/02/shari ... rules.html

But such custom validation would be done all the time, not only before the end user decides to commit something.
So if you want a specific callback before a resource is committed via the Oxygen SVN client, callback which would allow you to also reject the commit, we would need to consider adding extra API for this.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

jlpoole
Posts: 23
Joined: Sun Jan 15, 2017 3:15 pm
Location: Salem, Oregon

Re: Oxygen Hooks for SVN Client

Post by jlpoole » Wed Oct 31, 2018 7:57 pm

Hi Radu,

Yes, here is a use case. We track elements using database created IDs ("PIDs") and to ensure each PID actually points to XML, the PIDs are inserted during the check-in outside of the author's control. Having a PID system called by the writer at any time allows for the writer to consume PIDs, then decide to delete the PIDDed content (or their session crashes or they leave their session running and the server is rebooted) before a commit thereby ending up in a break in our model. Over the decades, we have found we cannot rely on writers to observe validation rules before checking in, i.e. commits, so we have various rules employed after the writer believes they are willing to commit. An alternative approach is to place these checks within Subversion using Subversion's hook facility and that would be a departure from our practice (we're evaluating Oxygen, as you may have guessed) and add a level of complexity I'm hoping to avoid. We integrate the authoring experience heavily with database tables to accomplish a variety of tasks appropriate for our environment.

I was hoping there might be something along the line of:

Code: Select all


if (ourQA()== true){ 
ourFurtherModificationsToXML();
// proceed with Oxygen SVN Client checkin
var revisionNumber = fetch(SVNinfo);
ourPostCheck( revision # from Subversion);
} else {
// deny check-in stating why; log event
}
Kind regards,

John

Also, I'm trying to use the formatting features such as boldface, Code, and Codebox, but when I "Preview" the effects of such formatting do not appears. "Disable BBCode" checked or unchecked does not alter the behavior. Also, I was trying to find the syntax for Codebox= in my attempt to create pseudo-code in the manner of JavaScript.

Radu
Posts: 6979
Joined: Fri Jul 09, 2004 5:18 pm

Re: Oxygen Hooks for SVN Client

Post by Radu » Thu Nov 01, 2018 10:21 am

Hi John,

Please see some remarks below:
An alternative approach is to place these checks within Subversion using Subversion's hook facility and that would be a departure from our practice (we're evaluating Oxygen, as you may have guessed) and add a level of complexity I'm hoping to avoid.
Indeed adding some SVN Hooks on the server side would be one way to do it.
I was hoping there might be something along the line of:
Suppose we would add some client side API callback looking like this:

Code: Select all

boolean preCommitCallback(URL[] filesToCommit, SVNHelper svnHelper)
On the callback you could return "true" if you want the commit to continue or "false" if you want to abort it, you could also show some error message dialogs if you want. The "SVNHelper" interface could be implemented on our side to return a certain URL's SVN revision number. Would you need any other details from the SVN client in addition to the SVN revision number?
Also in your code sample you seem to want to sometimes modify the XML content. The end user might have already closed the XML documents in Oxygen so you may need to modify the files directly by using the URL to identify the local File, read the file using a stream, modify the XML content and save it back, this would be difficult to do because each XML has a certain encoding which needs to be detected before the XML is opened. Or you could use our API to re-open the XML documents, make changes to them using our "WSEditor" API and save them back.

As an alternative we already have an "editorAboutToBeSavedVeto" API which would allow you to reject the save operation:

https://www.oxygenxml.com/InstData/Edit ... tener.html

when people are editing and attempt to save the XML content. Using this API you would need to do the checks more often but the XML file would already be opened so you could operate the changes directly inside it. We also have API to allow you to listen for all changes made in the XML document. In the eventuality you would use the "editorAboutToBeSavedVeto" API would you still want to know the SVN revision number on the edited XML document?
Also, I'm trying to use the formatting features such as boldface, Code, and Codebox, but when I "Preview" the effects of such formatting do not appears. "Disable BBCode" checked or unchecked does not alter the behavior. Also, I was trying to find the syntax for Codebox= in my attempt to create pseudo-code in the manner of JavaScript.
Right, our forum posting system is not that great and it has a number of small bugs, I'll ask our web developer to try to look into this. I usually use

Code: Select all

[b][/b]
to mark bold content and

Code: Select all

 [code]
[/code] to mark code blocks. Indeed the "Codebox" with a language-specific setting does not work for me either.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

jlpoole
Posts: 23
Joined: Sun Jan 15, 2017 3:15 pm
Location: Salem, Oregon

Re: Oxygen Hooks for SVN Client

Post by jlpoole » Thu Nov 01, 2018 7:11 pm

Hi Radu,

I need to give some careful thought about the point you raise about the file beings saved in the repository tree outside of Oxygen's control before the SVN calls are made. I'll update further when I have a handle on it. Thank you for the offer. (I'll have to revisit my SVN code which I created for Arbortext for another product line in our company keeping in mind what you have described.)

John

Radu
Posts: 6979
Joined: Fri Jul 09, 2004 5:18 pm

Re: Oxygen Hooks for SVN Client

Post by Radu » Fri Nov 02, 2018 10:38 am

Hi John,

One more thing, what version of Oxygen is your team using? We have end users from your same company working only with Oxygen 17.1 and a certain CMS and they seem to be stuck to Oxygen 17.1, but they probably are from different team. Because if you are stuck to a certain Oxygen version, adding new API in a future Oxygen version will not help much.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply