Send command line option for plugin

Post here questions and problems related to oXygen frameworks/document types.
flasomm
Posts: 1
Joined: Mon Feb 24, 2014 7:47 pm

Send command line option for plugin

Post by flasomm »

We've made a plugin to load data from web services.
Is it possible to open Oxygen and send an id to the plugin with command line ?

Ex:

Code: Select all

$ oxygen.sh myPlugin=<id>
Thanks
Radu
Posts: 9434
Joined: Fri Jul 09, 2004 5:18 pm

Re: Send command line option for plugin

Post by Radu »

Hi,

Oxygen is a Java application. A Java application can be started with a set of properties (which can then be read from the Java code using System.getProperty) and with a set of program arguments.

If you look inside the OXYGEN_INSTALL_DIR/oxygen.sh, the system properties are sent hard coded like:

Code: Select all

-Dcom.oxygenxml.MultipleInstances=true
while the program arguments are read from the command line. Unfortunately there is no way for a plugin to have access to the program arguments while it could have access to the system properties using constructs like System.getProperty("com.oxygenxml.MultipleInstances").

You will probably need to make your own version of the oxygen.sh which interprets the list of additional command line parameters as system properties for the java process.

Another possible workaround would be for your plugin to open a socket on some predetermined port and to send to it commands from the exterior via that opened port.

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

Re: Send command line option for plugin

Post by Radu »

Hi,

Oxygen 16.0 was just released.
Starting with Oxygen 16.0 you will be able to invoke a command line like:

Code: Select all

$ oxygen.sh -DoxymyPlugin=id
and the application will start with a system property named myPlugin set to id which a started plugin can read from the system properties map.

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