The JDA spceification is not very hard to grasp, due to the fact that it is small and does just a few things in an elegant fashion. Those thigns are by the way;
2) A standard way of setting properties which are read (again, in the most simple manner) by the components when they are intialized.
3) A standard way of passing messages between components, describing input and output terminals for the compoennts and allowing simple "wiring" of one compoennt to another in the html definition (1) above.
Because of this elegance, I was truly stumbled when I tried to implement the is_proxy feature in JDA. If an element which defines an infotron has the attribute is_proxy="true", it means that it wraps an achor element (a which is a reference to the remote service which is being proxied (By an ajax call, most probably).
So, the whole shebang looks like this (example from the MAYA JDA foundry);
properties="'encoding' : 'uri-form',
Monday, January 29, 2007
When things are just too easy
OK, so we have an infotron called "delicious", which in reality is an Ajax proxu (it's called JsonCallback). The proeprties given to it gives us hints that it can handle several types of encodings, and is flexible as to how to append arguments to the service it is calling.
So far so good, but I had a great headache when implementing my BaStar(d) implementation of JDA, because I tried to generate an infotrion in one pass, from scratch with information from both the is_proxy infotron and the enclosed anchor tag.
In reality, things were much more simple.
An infotron gets a reference to the DOM node wher it is defined. If declared in the Blueprint (the .js file implementaion of the infotron), the _onInit() function gets called whenthe infotron gets created (and the _onStartUp() gets called just before first message is passed).
That means that the most simple way to create a proxy is to not do anything at all. In teh microkernal code, that is. The JsonCallback.js of course searches for the first anchor tag childNode under its own node when initialized, and collects service url and other info from it. Case closed.
So, today lesson is to never, ever twist things around. Even if you manage getting both legs in one trouser-leg, it doesn't mean you've done the right thing :)