On 01/29/09 12:25, Bernd Eilers wrote:
Hi Stephan,
reading
http://www.openoffice.org/servlets/ReadMsg?list=dev&msgNo=19584
I wonder how filter/source/xsltfilter/XSLTransformer.java gets it right.
The intention was to switch to saxon9 for XML Transformations for OOo
3.2 as far as I know.
I see a call to
setContextClassLoader(this.getClass().getClassLoader()) in
XSLTransformer.java
And I see a ClassPath Entry for saxon9.jar in the MANIFEST.MF of
XMLFilter.jar.
is having those two things already enough?
Yes. Since XMLFilter.jar and saxon9.jar both end up in the
program/classes directory of the basis layer of an OOo installation, the
relative URL in
Class-Path: saxon9.jar
in the manifest of XMLFilter.jar works fine. (An OOo extension, on the
other hand, would have problems to specify a URL for the saxon9.jar in
the OOo installation---and should also of course not do so at all, as
saxon9.jar is not part of the stable interface between OOo and its
extensions---and would need to include its own copy of saxon9.jar next
to its main jar file instead. I did not follow this thread closely
enough to say whether or not this parenthetical remark is relevant here,
though.) However, the code in XSLTransformer.java not resetting the
context class loader again looks rather suspicious...
Your blog
http://blogs.sun.com/GullFOSS/entry/is_your_java_extension_ready
also mentions a UNO-Type-Path entry for the Manifest that must be set
if UNO Types are used which is the case for XMLTransformer.
No. As explained in the blog, UNO-Type-Path is needed when a jar
"contains class files that represent UNO types."
There is a UNO-Type-Path in XMLFilter.jar´s MANIFEST.MF but it is
empty. Is this an error?
No, this is correct.
Where can I find more information on what value should be put into the
UNO-Type-Path?
<http://www.openoffice.org/issues/show_bug.cgi?id=80405>, see the blog.
I have tried some experimental Saxon extensions and got some
problems/questions:
saxon9.jar loaded from XMLFilter.jar would create Objects using
class.forName() from the jar with the extensions. This jar I currently
put on the OOo classpath. I assume that if I would install this as a OOo
extension I do no longer need to put it onto the global OOo classpath,
is this correct? Do i need to set a contextClassLoader in the extension
or is it already enough that XMLTransformer.java did this and my
extension would inherit the context-classloader set by XMLTransformer.
When some method M (in saxon9.jar) calls
Class.forName("foo",true,Thread.currentThread().getContextClassLoader()),
then the code calling M must ensure that the current context class
loader is able to load M. See
<http://api.openoffice.org/servlets/ReadMsg?list=dev&msgNo=19811> for
what class loaders are involved in OOo, UNO, and extensions.
Also I currently seem to get into trouble when trying to use UNO
interfaces from within those extensions, could this be caused by a
missing UNO-Type-Path entry? If yes how must this look like?
You must not place the extension jar on the global class path.
-Stephan
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]