I have gone down a rather long chain of reasoning that ends with me being
stuck.  Would you folks please take a look and let me know where, if
anywhere, I have made a mistake.

My overall goal is to be able to manipulate RDF Datasources from an applet.
This is for an add on product, not part of core Mozilla.
BlackConnect will not be available for an indeterminate period of time.
LiveConnect is both too clunky and to slow.

So....  I am trying to use JNI to access XPCOM directly.
The problem is, that RDF only runs in the UI thread, while my applet runs in
a different thread, so I need to access the RDF through a nsISupports Proxy.

In order to accomplish my task, I need to access both an nsIRDFService and
an nsIRDFDataSource.  Both need to run as the UI thread, so both need to be
inside proxy(s).

I can not use separate proxies for the Service and the DataSource.  When I
try to proxy the DataSource, the Proxy Manager crashes, because it uses
GetAddRef, which recognizes that the Proxy Manager is running in my thread,
while the DataSource can only be used in the UI thread, and throws a
threadsafe exception.
If I try to proxy the proxy manager, so that it too is running in the UI
thread, it just laughs at me an crashes.

So, I have to put both the Service and the DataSource under the same Proxy.
Which I can only do by building my own XPCOM component that manipulates both
of them; and then proxying my component.

At this point, things get a little murky, because I can not find any
documentation about either:
a) How someone outside Mozilla can build an XPCOM component that will run in
Mozilla.
b) How to build an XPCOM component such that it is proxyable.

As near as I can make out, the proxy code relies on the .xpt file which is
generated by the idl compiler.  It uses this file to determine the proxy's
interfaces.  There is a file named xpti.dat that is used to determine which
xpt files are loaded.  This complete list of all XPCOM interfaces is
generated by Mozilla, and I really shouldn't be changing it, especially not
if I want to be compatible with multiple Mozilla versions.

So, I can't create a proxyable XPCOM component unless it is part of core
Mozilla.
Therefore, I can't access RDF from a non-UI thread.
Therefore, I can't build my java to RDF API.

If my chain of reasoning has gone astray at any point, please let me know.
Thanks,
    -- Dan



Reply via email to