Page 1 of 1

CMS Integration Plugin: Retrieve CMS document content. and sore it in a local file.

Posted: Tue Sep 22, 2015 1:26 pm
by sebastienlavandier
Hello,

First, CMS Integration plugin documentation is really great made ! :D

I implemented a custom ProtocolChooserExtension to select a remote CMS document.
I also implemented a custom ProtocolURLHandlerExtension to retrieve the remote content of the select CMS document (Example: http://localhost:8080/function/00001/content.dita
The CMS document content is open in a new editor tab.

But I want to set this content in a local file, and open this local file, and I don't know how/when I can do that...

Thanks in advance for your help
Sébastien.L

Re: CMS Integration Plugin: Retrieve CMS document content. and sore it in a local file.

Posted: Tue Sep 22, 2015 3:49 pm
by alex_jitianu
Hello Sébastien,

I'll be sure to pass your kind words to our documentation department!

From a Workspace Access plugin you can contribute two actions, a Check out and a Check in action. The Check out action can present a remote resource browsing dialog. After the user selects the resource you can copy it to a local file and open the local file. Inside our SDK there is a sample plugin named oxygen-sample-plugin-workspace-access that does just that. The Check In action knows how to map the local file back to the remote one.

Is your use case different? At which time should the local copy be stored back on the server?

Best regards,
Alex

Re: CMS Integration Plugin: Retrieve CMS document content. and sore it in a local file.

Posted: Tue Sep 22, 2015 5:42 pm
by sebastienlavandier
Hello Alew,

In the same way, when a dita document is open.
I choose to add a conref in this document, to a CMS document's.
Then, when I click on this conref="cproto://1_14_5_546953_0_5.dita#topicId", my custom protocole is used, to retrieve content.
But the second document is open in a new editor tab with the web service url like this: "http://localhost:8080/cf-psa/function/1 ... ntent.dita".

In this CMS plugin integration I don't work directly with document's URL, but with web services, that send me the content of the document ID.
I don't work with relative reference, I hope it's not a problem...

I hope too that was clear enough

Thanks in advance for your help.
Sébastien.L

Re: CMS Integration Plugin: Retrieve CMS document content. and sore it in a local file.

Posted: Wed Sep 23, 2015 9:30 am
by alex_jitianu
Hello Sébastien,
Then, when I click on this conref="cproto://1_14_5_546953_0_5.dita#topicId", my custom protocole is used, to retrieve content.But the second document is open in a new editor tab with the web service url like this: "http://localhost:8080/cf-psa/function/1 ... ntent.dita".
Yes, a new editor will be opened. What the custom protocol does behind scenes is transparent for the user. The user will see this file as being cproto://1_14_5_546953_0_5.dita. Is this a problem? Would you like to create a local copy of cproto://1_14_5_546953_0_5.dita and open that instead?

One thing I still don't understand is why do you want to work with local files. The local copies could be needed if you want to implement a CheckIn/CheckOut mechanism. The user checks out a number of resources from the server, makes changes, and it feels it has finished with them he commits them back on the server.
I don't work with relative reference, I hope it's not a problem...
It depends. Are these absolute references using the "cproto" protocol too? Then it shouldn't be a problem even when creating local copies. I'm just thinking on how Oxygen will be able to resolve these references.

Best regards,
Alex

Re: CMS Integration Plugin: Retrieve CMS document content. and sore it in a local file.

Posted: Wed Sep 23, 2015 11:26 am
by sebastienlavandier
Hello Alex,
Yes, a new editor will be opened. What the custom protocol does behind scenes is transparent for the user. The user will see this file as being cproto://1_14_5_546953_0_5.dita. Is this a problem? Would you like to create a local copy of cproto://1_14_5_546953_0_5.dita and open that instead?
Yes, when I try to open this URL : cproto://1_14_5_546953_0_5.dita, custom protocol resolve this url and open a new tab editor where the editor tab name's is the resolved URL (http://localhost:8080/cf-psa/function/1 ... ntent.dita).
User see only from editor tab name the end of this URL (content.dita).
I think too that is not necessary to save it in a local file, but then I want to change the editor tab's url from "http://localhost:8080/cf-psa/function/1 ... ntent.dita" to "cproto://1_14_5_546953_0_5.dita"

How/When I can do that ?
In this case, when user want to refresh this page, the custom resolver will be be called again.

Thanks in advance for your help.
Sébastien.L

Re: CMS Integration Plugin: Retrieve CMS document content. and sore it in a local file.

Posted: Wed Sep 23, 2015 2:28 pm
by alex_jitianu
Hello Sébastien,
I think too that is not necessary to save it in a local file, but then I want to change the editor tab's url from "http://localhost:8080/cf-psa/function/1 ... ntent.dita" to "cproto://1_14_5_546953_0_5.dita"
In your implementation of URLStreamHandler, on openConnection(), you are returning an URLConnection. This URLConnection is probably built over the "http" protocol and that's why is being seen as the editior location. I think you can fix this by overriding the URLConnection.getURL() and return the "cproto" URL.



Best regards,
Alex