Closed
Bug 338259
Opened 20 years ago
Closed 20 years ago
w3c dom bridge
Categories
(Core Graveyard :: Java to XPCOM Bridge, defect)
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: michal.ceresna, Assigned: jhpedemonte)
Details
Attachments
(2 files)
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.8.0.2) Gecko/20060308 Firefox/1.5.0.2
Build Identifier:
the initial version of the javaxpcom (nsIDOM) to w3c dom connector
Reproducible: Always
| Reporter | ||
Comment 1•20 years ago
|
||
Comment 2•20 years ago
|
||
To compile it, you have to additionally create 2 symlinks:
domconnector/connectorinput/JavaXPCOM/javaxpcom.zip -> MozillaInterfaces-src.jar
domconnector/jars/javaxpcom.jar -> MozillaInterfaces.jar
Comment 3•20 years ago
|
||
Currently the connector depends on Ant and Python. Which do we have to remove?
Comment 4•20 years ago
|
||
You have to copy this to domconnector/connectoroutput/ in order to be able to build the connecor with ant
| Assignee | ||
Comment 5•20 years ago
|
||
Michal, Peter, could you please provide (in this bug) a description of what this code is meant to do, how it is built, how it is organized, etc. This will help with the review. Thanks.
| Reporter | ||
Comment 6•20 years ago
|
||
#how to build:
#unpack
tar xjvf ~/Destop/domconnector.tar.bz2 #in attachment
mkdir domconnector/connectoroutput/
cp ~/Desktop/build.xml domconnector/connectoroutput/ #in attachment
#add the javaxpcom jars
cp ~/xulrunner/sdk/lib/MozillaInterfaces-src.jar domconnector/connectorinput/JavaXPCOM/javaxpcom.zip
cp ~/xulrunner/sdk/lib/MozillaInterfaces.jar domconnector/jars/javaxpcom.jar
#config
#
#edit domconnector/configuration/W3CConnector.conf and
#set path to jdk (now points to /home/peter/... :-)
#
#into file supportclasses/UnsupportedMethods.txt
#add line:
#getSchemaTypeInfo
#build, ensure 'python' and 'ant' are in your path
export PATH=$PATH:/opt/apache-ant/bin
( cd domconnector/ ; ./generate_connector.sh )
#the result is in
domconnector/connectoroutput/dist/lib/w3ccore.jar
| Reporter | ||
Comment 7•20 years ago
|
||
#The code implementes org.w3c.dom interfaces by translating the calls
#to and from nsIDOM* classes.
#this code snippet gives you a DOM document of the currently loaded page:
nsIWebBrowser brow = getWebBrowser();
nsIWebNavigation nav =
(nsIWebNavigation)
brow.queryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID);
nsIDOMDocument doc = (nsIDOMDocument) nav.getDocument();
Document mozDoc = (Document) org.mozilla.dom.NodeFactory.getNodeInstance(doc);
#and from now on, you can use all the existing java/dom libraries :)
#such as XPath2 engine, saxon, xalan, etc working on mozilla documents.
#e.g. dumping DOM of the html document to stdout:
writeDOM(mozDoc)
public static void writeDOM(Node n)
throws IOException
{
try {
StreamResult sr = new StreamResult(System.out);
//create transformer
TransformerFactory trf = TransformerFactory.newInstance();
Transformer tr = trf.newTransformer();
tr.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
tr.setOutputProperty(OutputKeys.INDENT, "yes");
//serialize the DOM tree
tr.transform(new DOMSource(n), sr);
}
catch (TransformerException e) {
//wrap to IOException
IOException ioe = new IOException();
ioe.initCause(e);
throw ioe;
}
}
| Reporter | ||
Comment 8•20 years ago
|
||
the directory stucture is not clear to me neither, but maybe Peter has some insights :)
For us the current question are the build dependencies, if we want to
integrate it into the standard mozilla build system:
The code generation is written in python, which depends on a library
(module) called cheetah. Atm, this module is directly included.
The generated java code is compiled using ant.
If these dependencies are ok, then I can easily reorganize the directories
into a more understandable structure and write Makefile.in
| Assignee | ||
Comment 9•20 years ago
|
||
Benjamin, Mike, Brendan: What do you guys think of this project? Michal Ceresna provides an explanation in comment #7, but in general, this provides a w3c DOM API layer on top of the (Javafied) Mozilla DOM APIs. As Michal explains, this allows the use of existing Java DOM libraries on Mozilla documents. Also, this would be good to have for ATF: the goal is to eventually support other browsers, and an easy way to accomplish that is to code ATF to use w3c DOM APIs, and have browser specific w3c DOM wrappers for each browser. This could also be useful for Ed Burns' Webclient project.
Comment 10•20 years ago
|
||
At first glance I don't think this is something we need/want to ship with XULRunner by default. It could be a very useful abstraction tool, and it perhaps should live in our tree and be built by us (and shipped with the SDK, for example)... but Java apps that wanted to use it would have to ship it (or depend on an Eclipse package that shipped it).
It would be good to identify early on whether it has nonfrozen dependencies, and what it would take to make it use only frozen dependencies.
I suspect the code should live in extensions/java/dom.
We definitely do not want an ant dependency in our normal build system. I don't think we want a python dependency either, but I'm not nearly so sure about that (python would be good to have in general, and could end up replacing a lot of our crufty perl build-fu).
Status: UNCONFIRMED → NEW
Ever confirmed: true
| Assignee | ||
Comment 11•20 years ago
|
||
I agree that this isn't something that we should ship, except for maybe in the SDK. Really, I was just thinking that it would be good to build this and make it available for download (probably as both an Eclipse plugin and as a separate jar).
> It would be good to identify early on whether it has nonfrozen dependencies,
> and what it would take to make it use only frozen dependencies.
True. I hadn't thought of that yet. I just wanted to start a discussion first on whether to put this into the tree.
> I suspect the code should live in extensions/java/dom.
That's what I had in mind.
> We definitely do not want an ant dependency in our normal build system.
I was thinking that any ant commands could just be replaced by direct javac calls in Makefiles (as I'm already doing elsewhere). But just for arguments sake, why not use ant? We already require a JDK for building XULRunner. And I could use ant to clean up how some of the Java files are currently built.
> I don't think we want a python dependency either...
Well, I only took a look at the code briefly, but it seems to be heavily based on python. Rewriting this as a non-python solution might take a while. Michal or Peter can provide a better analysis.
Comment 12•20 years ago
|
||
Hey guys,
Sorry, sorry, i have been very busy recently. Normally i am very responsive but had a lot of things to do the last days. However Michal did an outstanding job answering your questions so in fact i was not really needed anyway ;-)
Until there is a decision wrt dependencies and other vague things and the connector can (hopefully) find it's final home, i put up a svn to my page which can be accesed either via http:
http://svn.rubyrailways.com/W3CConnector/
or svn:
svn co http://svn.rubyrailways.com/W3CConnector/
(anyone can download, only i can commit, so if you have some suggestions, contact me, or alternatively i can give you commit accounts if someone is interested)
Inside this initial revision (v0.9 preview release) there is a kickstart readme
which can maybe answer some questions:
http://svn.rubyrailways.com/W3CConnector/readmefirst.txt
Since it is really just a kickstart howto, it does not really deal with technicalities, so please ask your questions that have not been answered yet.
wrt Python: Javier is right, the whole stuff is written in Python - Ant is used just for compilation (so Python generates all the .java files, and after this they are compiled and bundled into a .jar by Ant).
To remove the Python dependency would mean to throw the whole thing out and write it from scratch (in Java or whatever else (e.g. Ruby ;-) (just kidding). really don't see any way to reuse anything from the present state if you decide to not use Python.
My estimate to rewrite the whole stuff from scratch is about 1 to 3 months depending on different factors like
- the language you choose to write in - e.g. I am much more productive in Python/Ruby than in Java, mainly if it comes to things like string operations, regexps, templating languages etc. (i.e. exactly the things you need to use when writing such a connector) - and i believe a language like Python/Ruby is much more better suited for this job than Java
- various other design decisions
However, to write it is one thing, and to test it, debug it, find gotchas here and there, make it stable, usable etc. is another. I think we (Michal, Peter, in broader sense the company where we are employed ATM) already went through this (mostly) - we are heavily using the connector for months in our flagship commercial product and although there are some speed issues, the stability is OK.
You have to decide whether a Python dependency is worth all this or not. Please note that i am not using Python for deployment/building/pre-generation, but Python is the whole stuff itself. It is not a problem to drop Ant and replace it with a bash/make/Python script, but to drop Python means drop the whole project.
Anyway, Python is already quite essential part of any decent linux distro nowadays - I think to include it would not really hurt anybody. Of course the decision is up to you, this is just my $0.02.
If you decide to keep the snake, i am volunteering to remove Ant and replace its functionality with a Python script.
btw What's the problem with my direcory structure?!?! ;-)
If you have any questions, you can write here (i will try to check back regularly) or write me directly to peter@[the server where the svn is located]
| Reporter | ||
Comment 13•20 years ago
|
||
hello, is there someone responsible willing to decide the open points?
Comment 14•20 years ago
|
||
It doesn't look like this project is a suitable candidate for ever shipping with XULRunner. I don't mind hosting it in our CVS, although a sourceforge project or something equivalent might be just as appropriate.
| Reporter | ||
Comment 15•20 years ago
|
||
The project found its new home at http://mozdom4java.mozdev.org/
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Comment 16•20 years ago
|
||
No code was checked into SeaMonkey / Firefox as far as I can tell - so this should not be marked as FIXED. If things are going to be done in another project, then this should actually be marked WONTFIX, since it's not going to be native to our browser.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
| Assignee | ||
Comment 17•20 years ago
|
||
Based on comment #14 (and other comments), this code won't be put into Mozilla CVS any time soon. It is now available on mozdev.org, so ->WONTFIX.
Status: REOPENED → RESOLVED
Closed: 20 years ago → 20 years ago
Resolution: --- → WONTFIX
Updated•12 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•