[wsas-java-dev] Re: [commons-dev] Improvements to adminui
javascript/AJAX library
Ruwan Linton
ruwan at wso2.com
Thu Mar 8 19:39:02 PST 2007
saminda abeyruwan wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi All,
>
> With the current discussion going on the development of Mashup server
> and looking at the tools available in Yahoo (YUI), Google (GWT) etc, and
> more usage of WSO2Commons adminui's Javascript/AJAX library, we have
> come across with the following problems and improvements to
> Javascript/AJAX library.
>
> WSO2 Commons Adminui project contains the Javascript/AJAX
> library.[https://wso2.org/repos/wso2/trunk/commons]
>
> Adminui's base javascript functionalities are written in the "main.js".
> All the functions available in this javascript has been written as pure
> functions. Thus, one could use the function say, foo(args..) without any
> association with objects. Since this is a base library, an implementor
> might have his js that would have the same method say foo(args2..), with
> different arguments. Thus, at runtime, if user uses foo(), theres no
> guarantee, which foo() is gonna select by runtime.
>
> Thus, we propose the following architecture for our adminui
> Javascrtip/AJAX library.
>
> As we expect this library to be used widely, We should be writing this
> functions relative to a custom object. So, we propose the object name
> should be WSO2. Apart from that as these functions are "common",
> everything should be associated with "WSO2.common".
>
> So, the implementation is as follows,
>
> =======================================================================
>
> WSO2.common = {
>
> var xmlHttpRequest, //global variables
>
> send: function(operationName, bodyXML, xslFileName, callURL, objDiv,
> loginMethod, callBack) {// impl}, // send function
>
> onError: function() {// impl}, // onError function
>
> _split: function(obj) {// impl}, // split function
>
> ... // Other functions
>
>
> }
>
> ========================================================================
>
> Thus, user has do the following to execute a function, ex: executing of
> send() function,
>
>
> WSO2.common.send('foo',someXML,xslFile,url,divObj,false,sendCallback);
>
> As such the above will not cause any unnecessary complications.
>
+1 for this. I also was thinking of this complication issue when I was
doing a POC, for example we have a show() method in the esb root.js
which conflicts with a YUI show() method. In this kind of complication
the normal behavior of javascript is that it neither execute none of the
methods nor throw errors to the console, it just stuck, and stop execution.
So I think not even for the adminui, but also for wsas and esb specific
javascript also should be qualified with the WSO2 name. For example our
root.js show method should be qualified as WSO2.esb.show() and so on.
> We will follow the Java coding standard. As there is no way to represent
> a "private" function, we should use "_", thus, _foo() is a private
> function. Most of the Javascript libraries follow this standard.
>
> In addition to this, above object should be implemented in
> js/common/common.js rather at main.js.
>
> With above proposal, we could simply switch between either to use Raw
> AJAX or WSReques.js to communicate with server.
>
> Please be kind enough to send your consensus on this.
>
+1. No concerns. This is good and we need this.
> If all permits, I would like to volunteer to do the refactoring, and
> help to update other projects.
>
> Thank you
>
> Saminda
>
>
>
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.2 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFF8B/5YmklbLuW6wYRAlEVAJ9N3U3vbT46ow2+b4QWlPjnPSgkLgCeOMAh
> lhDO1ogXGsPVxDDPIL2gxdU=
> =eHaY
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Commons-dev mailing list
> Commons-dev at wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/commons-dev
>
>
More information about the Wsas-java-dev
mailing list