Page 1 of 1

Custom CMS integration

Posted: Wed Sep 27, 2017 8:33 am
by rahul1995
Hi everyone,

I need a functionality to checkin/checkout files on my server from Oxygen XML Author desktop tool.
So I was trying to develop plugin for that.
But I can't see any checkin/checkout button.
Do I need to create them by myself? And please guide me to achieve the functionality.

Thanks
Rahul

Re: Custom CMS integration

Posted: Wed Sep 27, 2017 9:07 am
by sorin_carbunaru
Hello Rahul,

Yes, you need to create the buttons yourself and place them in a toolbar.

We actually have a sample plugin in our SDK that I think would be helpful to you. You should follow the instructions from https://www.oxygenxml.com/oxygen_sdk/download.html to download our SDK samples, then look for the plugin called oxygen-sample-plugin-workspace-access, and especially take some time to analyze the CustomWorkspaceAccessPluginExtension class. There you will find examples about how to create buttons, menu actions and so on. Please note that our sample is meant to work with local files.

Good luck with your work!
Sorin Carbunaru
oXygen XML

Re: Custom CMS integration

Posted: Thu Sep 28, 2017 7:48 am
by rahul1995
Hi Sorin,

Thanks for your quick reply.
I run command

Code: Select all

mvn package
but it gives me a jar file, without any lib folder and all (Which is the folder structure of oXygen plugins).
When I tried extracting that jar file, then I found that lib folder and another jar inside that. And when I am placing this extracted version in plugins folder, it is working.

Could you please tell me why is maven packaging it again? It is irritating to extract everytime I am trying to run my modified plugin.

Thanks
Rahul

Re: Custom CMS integration

Posted: Thu Sep 28, 2017 9:11 am
by sorin_carbunaru
Hello Rahul,

I agree that unpacking the JAR every time is annoying, but creating a package (by default a JAR archive) is what "mvn package" is supposed to do.

But... "If you want to debug your Java code and do not want to run "mvn install" and to install the plugin in Oxygen all the time, in the "OXYGEN_INSTALL_DIR\plugins" folder you can create a folder with any name (for example "sample") in which you place a file called "plugin.redirect" containing the full file path reference to your project (for example in my case "C:\Users\radu_coravu\Documents\sample-plugin-workspace-access"). After this, when Oxygen will start it will automatically load the plugin from your project location. So you will just need to modify the Java code, the IDE will automatically compile it, then restart Oxygen and test your changes." (https://github.com/oxygenxml/sample-plu ... ace-access)

Hope this helps ;)!

Sorin C.

Re: Custom CMS integration

Posted: Thu Sep 28, 2017 10:27 am
by rahul1995
Hi Sorin,
I read the same somewhere else but it is not working, not even showing any error. Are there any other things to keep in mind(like, extract jar everytime after modification or some modification in plugin.xml)?
I have created plugin.redirect file and added text "C:\Work\sample 1\oxy-plugin". Is space in the filepath creating problem?

And also, I want to show a file chooser to choose files from remote URL of certain extensions only. So I tried using

Code: Select all

pluginWorkspace.chooseURL(title, allowedExtensions[], descr)
But it is showing a simple textfield to put URL in. When I click "Choose file from remote location" button and put my server url and authInfo, and Connect, It is showing files of all extensions. Is there some way to do what I need? My server url simply works on HTTP protocol so I don't think I have to implement Custom Protocol/URLStreamHandlerExtension?

Thanks
Rahul

Re: Custom CMS integration

Posted: Thu Sep 28, 2017 4:11 pm
by sorin_carbunaru
Hello Rahul,

It's odd that it doesn't work and also doesn't show any error... By the way, you don't have to unpack the JAR anymore in "[oXygen_dir]/plugins". Actually, you should better delete your plugin folder (oxygen-sample-plugin-workspace-access-[version]) from there. What you have to do is to create an "[oXygen_dir]/plugins/[any_name]/plugin.redirect" file and add the full file path reference to your project, just as you showed me. Try not to use spaces in the filepath, just to be on the safe side.

Unfortunately, the extension filter for the "chooseURL()" method only works with local files. I logged a bug on our side to make it work also with the remote URL chooser. What you could do, although I admit it would take more time than you would probably want, is to create your own "Choose URL" action and show your own dialog that has a filter for resource extensions.

Regarding your last question, no, you don't have to implement any handlers. You can actually work with WebDAV directly from oXygen, without any plugins (https://www.oxygenxml.com/doc/versions/ ... ction.html). But we don't have "Check In"/"Check out" buttons...

Sorin C.

Re: Custom CMS integration

Posted: Fri Sep 29, 2017 12:11 pm
by rahul1995
Hi Sorin,

Thanks for helping me a lot. In my plugin.xml, <library> was referring to some other folder. I fixed that and it's working now.

But when I tried to run that debug configuration for Eclipse, I got the following error and I can't debug :

Code: Select all

14:29:49,966 1 ERROR [ main ] ro.sync.ui.application.b.m - Bundle descriptor file not found: C:\Users\rahul1995i\.m2\repository\com\oxygenxml\oxygen\bundle.descriptor
java.io.FileNotFoundException: C:\Users\rahul1995\.m2\repository\com\oxygenxml\oxygen\bundle.descriptor (The system cannot find the file specified)
Apart from that, In checkout process, I am showing a Choose URL dialog, and based on the URL chosen, I need to send an HTTP POST call to my server, Do you know how can I get HTTP connection while user is choosing the file and through that connection, how can I send post request?

Thanks
Rahul

Re: Custom CMS integration

Posted: Fri Sep 29, 2017 2:26 pm
by sorin_carbunaru
Hello,

For debugging I think you would be interested in reading this topic from our user's manual: https://www.oxygenxml.com/doc/versions/ ... lugin.html.

For posting to the URL that the user has chosen you have to get the chosen URL from "pluginWorkspace.chooseURL()" and then connect to that URL and send the POST request. Google should give you some good help about how to do this. Try for example https://www.mkyong.com/java/how-to-send ... t-in-java/, the "1. Java HttpURLConnection example" section.

Sorin C.

Re: Custom CMS integration

Posted: Fri Sep 29, 2017 2:45 pm
by rahul1995
Hi Sorin,

I tried that. But it's like I have URLConnection of URL "http://localhost:4502/path1" opened and I need URLConnection of "http://localhost:4502/different/path", it is asking me to enter credentials again.

Thanks
Rahul

Re: Custom CMS integration

Posted: Fri Sep 29, 2017 3:26 pm
by sorin_carbunaru
Hi,

Don't you have a check box for saving the credentials?

Sorin C.

Re: Custom CMS integration

Posted: Fri Sep 29, 2017 3:31 pm
by rahul1995
Oh sorry. I directly put the full url instead of using "Browse" option.

Thanks for helping.
Rahul

Re: Custom CMS integration

Posted: Sat Sep 30, 2017 8:56 pm
by rahul1995
Hi,

As there would be mappings of temprary file path to remote url path for the checked out files. After the application is closed with some files checked out, I need to save mapping in some file. When I try to create mapping file at oxygen_install_dir, it is giving me access denied error.
Where should I store it?

And I am simply serializing map object to the file, is there some better way to store the mapping?

Thanks
Rahul

Re: Custom CMS integration

Posted: Mon Oct 02, 2017 9:48 am
by sorin_carbunaru
Hello Rahul,

You can save the files in the operating system's temporary folder, that can found in Java using System.getProperty("java.io.tmpdir").

You can probably go with ObjectOutputStream for serialization, as I suppose you already did.

Sorin C.

Re: Custom CMS integration

Posted: Tue Oct 03, 2017 12:39 pm
by rahul1995
Hi,

As "Browse remote file" opens up a webdav view which asks for server URL and authentication and calls webdav API to show files inside it, I wanna show a similar window to show my CMS repository and connect to it, I have APIs to return the subfolders and files inside a folder. Is there a way to create "Custom browse" which can show the webdav-like window but uses my APIs to show folders and get URL of the file user selects?

Thanks
Rahul

Re: Custom CMS integration

Posted: Tue Oct 03, 2017 2:43 pm
by sorin_carbunaru
Hello Rahul,

No, we don't provide such an API. You need to implement your own tree of resources and the interaction.

One colleague of mine told me that there is a project similar to what you try to do publicly available on GitHub. See https://github.com/axxepta/project-argon. You can analyze how they created their tree in src/main/java/de/axxepta/oxygen/tree/. Maybe you can come out with some ideas from there...

Sorin C.