Hi,
I just tried to figure out, how to obtain the current version of fop.
There is a nice method called
org.apache.fop.apps.Version.getVersion(), which returns null, when you
call it. Not very nice. So I looked a bit more into the source, and I
found the following method to read the configuration:
Class.forName("org.apache.fop.apps.Options").newInstance();
using this before calling the getVersion() above solved the problem,
and I get the String "FOP 0.20.5". But in addition the following lines
are dumped to the console:
[WARNING] Screen logger not set - Using ConsoleLogger.
[INFO] Using org.apache.crimson.parser.XMLReaderImpl as SAX2 Parser
Is this the right method for doing this? Or does it perhaps override a
previously loaded configuration? Right now I am checking for a null of
the getVersion()-call, and make the newInstance() of the Options only
in this case.
The additional lines do not matter that much, because the actual
program is a GUI-Application, and the console is not available, when
running with "javaw".
I am writing a System-dumpinfo-class in case of bugreports, and the
FOP-Version could be quite useful. The code now looks like this
(reflection rules, since it should work when fop is not available too):
try {
Class c = Class.forName("org.apache.fop.apps.Version");
String version = (String)c.getMethod("getVersion", NOCLASSES).invoke(null,
NOOBJECTS);
if (version == null) {
Class.forName("org.apache.fop.apps.Options").newInstance();
version = (String)c.getMethod("getVersion", NOCLASSES).invoke(null,
NOOBJECTS);
}
logger.log("FOP-Version: " + version);
} catch (Exception e) {}
--
Best regards,
Michael mailto:[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]