[OpenAjaxIDE] Unique Identifier for a given widget?

Jon Ferraiolo jferrai at us.ibm.com
Thu Aug 14 17:02:43 PDT 2008


Regarding Kin's original query, I think it would be a good idea to require
each widget specify a unique URI for that widget that stays constant across
different versions of that widget. For example, as Scott suggests,
com.yahoo.yui.calendar.

I  really don't like using the 'id' attribute for this purpose, however,
because IMO that's a general XML thing that specifications shouldn't
attempt to leverage for their own needs. But I see that the W3C Widgets
spec is doing just that, so we should probably go along. With the W3C
Widgets spec, 'id' is optional. It would be OK with me to make it required.

Regarding the possibility of twowidgets from different authors might
conflict (i.e., they both say <widget name="calendar"), I'm not sure
whether we need to address that in the spec beyond what we have already. I
have been assuming that tools would prevent such collisions somehow under
the hood. I have a similar mindset with Scott in that the widget author
should namespace his widget, but I have been assuming that:

- *JavaScript* namespacing would be addressed mainly via
jsClass="mytoolkit.calendar" (where mytoolkit is a registered prefix in the
OpenAjax Registry). If jsClass is not specified, then the default widget
class would be something like OpenAjax.widgets.WidgetWrapper (which is what
the spec says now). In our reference implementation, the default widget
class acts pretty much like a virtual class in that all potential collision
points are assigned instance-specific values, which precludes the
possibility of class conflicts.

- Tools would prevent widget name collisions (e.g., two widgets that have
<widget name="calendar">) by some higher-level organizational logic. There
are many ways to accomplish this and each tool can do what they think is
best. But here is an illustration of one possible approach. For an Ajax
library (e.g., dojo), the tool groups all widgets from that library into a
"dojo" area, with the assumption that the widget names within that library
are unique. In effect, under the hood within a tool, a dojo calendar widget
would be identified by the pair: {"dojo","calendar"}. A YUI calendar widget
would be identified by the pair: {"yui", "calendar"}. For widgets that are
not part of a library, then each widget would have its own auto-generated
library name. For example, Joe's calendar widget might be identified by the
pair: {"auto0001","calendar"}.

(The following text is mainly for FYI purposes. It talks about things that
might be related to this conversation, so here goes. ) On the Gadgets TF
side of the world, we have been assuming for months that each widget
instance would have its own JavaScript object with a unique name. Within
<content>, you can use the variable __WID__ to refer to the widget object.
In our mini-mashup reference implementation, aftter macro substitution, any
occurrences of __WID__ will have values such as "gid_02589543" (where the
latter part is a randomly generated value). jMaki does something similar. I
have neglected until earlier today to include anything in the spec about
__WID__ despite our earlier discussions.

Jon





                                                                           
             "Scott Richards"                                              
             <scrichar at adobe.c                                             
             om>                                                        To 
             Sent by:                  "Kin Blas" <jblas at adobe.com>,       
             ide-bounces at opena         <ide at openajax.org>                  
             jax.org                                                    cc 
                                                                           
                                                                   Subject 
             08/14/2008 02:12          Re: [OpenAjaxIDE] Unique Identifier 
             PM                        for a given widget?                 
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




I suggest that it should be the responsibility of the widget author to
ensure uniqueness by namespacing their widgets.  Reverse namespacing is
a good way to ensure uniqueness.  Having an ID allows the name to be
localized without causing any problems.

Here is an example:
<widget
  id="com.yahoo.yui.calendar"
  name"Calendar"
  version="2.5.2"
>

________________________________________
From: ide-bounces at openajax.org [mailto:ide-bounces at openajax.org] On
Behalf Of Kin Blas
Sent: Thursday, August 14, 2008 2:02 PM
To: ide at openajax.org
Subject: [OpenAjaxIDE] Unique Identifier for a given widget?

So someone on our team asked me if there was anything within the widget
metadata spec that could serve as a unique identifier for a widget.

The basic workflow/scenario we have here, is that the widget metadata
file (WMF) could be imported into an IDE which gathers all the assets,
etc that are specified within the WMF, and stores them in some IDE
specific repository such that when the user wants to insert a particular
widget into their document, the IDE can retrieve and insert the relevant
markup/code/asset reference and copy any asset files to where they need
to be so that the document can access them.

The problem we have is that we want to insure that as the user imports
different WMFs that they don't stomp over something that already exists.
I have seen this little blurb from the WMF spec:


"The name attribute specifies the widget name. 20080520 Tentatively
approved: Yes, have 'name'. Name attribute does not have to be globally
unique. Eg, We expect possibility of multiple widgets with name of
'tooltip'. There is implicit namespacing for widgets within a library
because the library has an implicit namespace. OK for tools to
manufacture a namespace from author if needed. Need to say that a name
must match construction for JavaScript identifiers. Remove the
restriction on the name, the name is OPTIONAL and drop the suggestion
regarding using the title attribute if the name attribute is not
specified."


But the fact that @name does not have to be unique and that both @name
and <author> are optional, it really makes it hard on the IDE to figure
out whether or not a given WMF is a totally different widget, or an
updated version of the a widget it has already seen.

Is this something we have to live with? Or is there something that can
be proposed here that can make life for the IDE a bit easier? Perhaps
requiring each WMF that describes a widget have its own ID? Where ID is
generated/registered from some page off of the OAA site? I realize that
such a solution would require infrastructure that the OAA is not willing
to take on, but I'm all ears for any other proposals or ideas.

--== Kin ==--

_______________________________________________
IDE mailing list
IDE at openajax.org
http://openajax.org/mailman/listinfo/ide
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://openajax.org/pipermail/ide/attachments/20080814/b0a30106/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
Url : http://openajax.org/pipermail/ide/attachments/20080814/b0a30106/attachment.gif 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic19244.gif
Type: image/gif
Size: 1255 bytes
Desc: not available
Url : http://openajax.org/pipermail/ide/attachments/20080814/b0a30106/attachment-0001.gif 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ecblank.gif
Type: image/gif
Size: 45 bytes
Desc: not available
Url : http://openajax.org/pipermail/ide/attachments/20080814/b0a30106/attachment-0002.gif 


More information about the IDE mailing list