Custom Protocol Plugin error with DITA-OT Transformations

Post here questions and problems related to oXygen frameworks/document types.
ankitr
Posts: 12
Joined: Thu Dec 14, 2017 11:52 am

Custom Protocol Plugin error with DITA-OT Transformations

Post by ankitr »

Hi,

I have a Custom Protocol handler plugin. The plugin requires access to several Oxygen SDK classes like UtilAccess, StandalonePluginWorkspace to function. This is primarily required for reading server credentials from options storage.

When I run a transformation on a map opened over my custom protocol, my protocol handler class is called in action to download linked documents. However, it ends up throwing NPE as an instance of StandalonePluginWorkspace is not available. I investigated and it seems that my class is loaded into a new DITA-OT process.

My question is, if my Custom Protocol handler class is called from a new process, how can I obtain the options storage and establish a connection to a server.

Thanks,
Ankit
alex_jitianu
Posts: 1008
Joined: Wed Nov 16, 2005 11:11 am

Re: Custom Protocol Plugin error with DITA-OT Transformations

Post by alex_jitianu »

Hi Ankit,

Indeed, a DITA-OT transformation is run in a different process in which a StandalonePluginWorkspace instance is not available. I will add an issue to investigate how we can make one available (at least one with partial functionality, like the UtilAccess methods). We will let you know as soon as the issue gets fixed. Meanwhile, I see no other possibility than to create your own implementations for encrypting and storing the user credentials.

Best regards,
Alex
ankitr
Posts: 12
Joined: Thu Dec 14, 2017 11:52 am

Re: Custom Protocol Plugin error with DITA-OT Transformations

Post by ankitr »

Hi Alex,

Thanks for your reply.
Could you help me understand how does the new process know to instantiate the CustomURLHandler class for specific URLs? Plain DITA-OT code wouldn't know to do this, so is it run under some shell process that leverages available Oxygen plugins?

Regards,
Ankit
Radu
Posts: 9048
Joined: Fri Jul 09, 2004 5:18 pm

Re: Custom Protocol Plugin error with DITA-OT Transformations

Post by Radu »

Hi Ankit,

When the DITA OT is run from Oxygen, it starts as a separate process. But we set a parameter to it which will instantiate a custom XML parser configuration implementation available in our code. When that XML parser configuration class is first instantiated, it will also load all plugins (like the main Oxygen application usually does) in order for the custom protocols to work. But because this is not an entire Oxygen application, various APIs called (like the one you discovered) might not work.
One workaround for you might be to have your own options storage folder using the "user.home" system property to know where the user home resides, create a folder there and read/write settings to it using a certain custom file format that you decide. Thus the custom protocol would not call any API from that singleton.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Radu
Posts: 9048
Joined: Fri Jul 09, 2004 5:18 pm

Re: Custom Protocol Plugin error with DITA-OT Transformations

Post by Radu »

Hi,

One more thing, can you also post the entire stack trace of the NullPointerException?

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