Started

Anakreon <[email protected]> Fri, 21 May 2004 20:30:55 +0300
Newsgroups gmane.comp.java.luxor-xul.devel
Message-ID <[email protected]>
Hello all. I have started working on luxor again.
In the cvs now is a new branch which I called test.
The reason for creating the branch, is that I'm thinking of some modifications
in the design. Having those modifications in an other branch, then the main one,
will avoid braking something.

There is a problem with the luxor.template.XulTemplateResourceLoader which has
this code:
           XulManager xul = XulManager.getXulManager();
           in = xul.getResourceAsStream( templateName );
The problem is that the  XulManager.getXulManager() returns the first instance
of XulManager created, but if there are other instances as well, which require a
resource to be loaded, then the loading will probably fail.

Here is an example code which fails with a NullPointerException:
       XulManager xul = XulManager.getXulManager( Integer.toString( _lastId++ ) );
       SimpleChromeLoader loader = new SimpleChromeLoader( chromeDir );
       xul.setResourceLoader( loader );
       xul.load();
taken from luxor.runner.AppRunner.
The NullPointerException is caused because the first instance of XulManager has
no ResourceLoader associated with. So when XulTemplateResourceLoader requests
from the first instance of XulManager an InputStream the exception is caused.

Perhaps the AppRunner shouldn't create a new instance of XulManager.
But in that case the constructor of XulManager should be declared private to
prohibit the miss use. I think though that is good to have many XulManager
instances.


Design Problems:
The code base is big, so I might have misunderstood the design. Be skeptical
about my comments.

The XulContext seems to be used as a shortcut, as a way to avoid typing all the
interfaces which declares to extend.
In the *Peer and *Def classes, createNComponent require a XulContext, but it
seems that they only need a ComponentResolver (hope I have the name right).

In other classes, a request for a service goes from class to class.
Here is an example:
1:XulManager.load
2:XulLoader.load
3:TemplateManager.getTemplate
4:XulTemplateResourceLoader.getResourceStream
5:XulManager.getResourceAsStream
6:ChromeResourceLoader.getResourceAsStream

At least, this way is very confusing. The chain of actions goes to 5 different
classes, and a call to XulManager after having called methods from 3 other
classe ends up to XulManager again.

I guess there could be simplifications over this model.



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click