Page 1 of 1

define FOP configuration file in framework

Posted: Mon Mar 30, 2015 3:48 pm
by Ron Van den Branden
Hi,

I've been developing an XSL-FO transformation scenario in an Oxygen project, for which I have defined a dedicated configuration file in the project-specific "FO Processor Settings" http://www.oxygenxml.com/doc/ug-editor/ ... ssors.html.

Eventually, this project will have to be transformed to an Oxygen framework, and I'm looking for a way to specify a FOP configuration file at the framework level. As far as I can see, it's not possible to just copy the project's

Code: Select all


  <entry>
<String>fop.configuration.file.path</String>
<String>/path/to/my/fop.conf.xml</String>
</entry>
setting to a framework file.

I've looked elsewhere in the forum (see http://www.oxygenxml.com/forum/topic10867.html), where it was suggested that it isn't possible to add global options to Document Type definitions in a framework, and that instead:
A workaround would be to create and pack as an extra add-on a plugin for Oxygen which could use for example the Java API ro.sync.exml.workspace.api.PluginWorkspace.setGlobalObjectProperty(String, Object) to set a system property the first time it is started.
Unfortunately, my Java skills are insufficient to manage this; if anyone could help me out, that would be fantastic. This is what I've tried: since the framework is based on the TEI add-on framework, I've tried to set this global option in the TEIP5ExtensionsBundle Java class, by editing it as follows (inspired on what I found at http://www.oxygenxml.com/forum/topic10846.html):

Code: Select all


@API(type=APIType.INTERNAL, src=SourceType.PUBLIC)
public class TEIP5ExtensionsBundle extends TEIExtensionsBundleBase {

PluginWorkspaceProvider.getPluginWorkspace().setGlobalObjectProperty("fop.configuration.file.path", "/path/to/my/fop.conf.xml");

/* the rest goes here */
}
But this is not working:

Code: Select all


    [javac] /path/to/TEIP5ExtensionsBundle.java:75:
error: <identifier> expected
[javac] PluginWorkspaceProvider.getPluginWorkspace().setGlobalObjectProperty("fop.configuration.file.path", fopConf);
[javac] ^
Where and how should the setGlobalObjectProperty be set?

Best,

Ron

Re: define FOP configuration file in framework

Posted: Mon Mar 30, 2015 4:27 pm
by Radu
Hi Ron,

You cannot just call methods anywhere in a java class.
At least you could surround the call to the global plugin workspace in a static section like:

Code: Select all

 
static{
PluginWorkspaceProvider.getPluginWorkspace().setGlobalObjectProperty("fop.configuration.file.path", "/path/to/my/fop.conf.xml");
}
Usually developers use our Oxygen SDK to compile Java changes:

http://www.oxygenxml.com/oxygen_sdk.htm ... horing_SDK

Maybe as you are not very familiar with Java you could create instead an ANT script and have a transformation scenario which runs it instead. An ANT build script can take control over how the <fop> task is defined and run:

https://xmlgraphics.apache.org/fop/0.95/anttask.html

Regards,
Radu