[wsas-java-dev] Re: [commons-dev] Improvements to adminui javascript/AJAX library

saminda abeyruwan saminda at wso2.com
Thu Mar 8 23:37:50 PST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Sir,

I believe you are referring prior to WSRequest.js. The simplest solution
would be to start with native/WSRequest.js.

We propose that main.js contains functions related to a namespace
"WSO2.common", (ex: WSO2.common.send(args...)) will solve the namespace
issue.


As an example, WSO2.common.send(args...) is the wrapper function that
uses WSRequest functionality to communicate with server. This is our
original plan and we were waiting for a release of WSRequest to achieve
this.


There could be another send() in the namespace of "WSO2.wsas". Thus, we
could simply create an object of WSO2.wsas and call send() function.
(i.e WSO2.wsas.send(args..)).

In addition to this we could give another util function in main.js,

WSO2.namespace(obj); that will create the object with proper namespace.

Ex:

WSO2.namespace('org.wso2.foo'); will create an Object =>
WSO2.org.wso2.foo. Thus, user can simply implement his functions,
without any namespace collisions.

In this mode, WSRequest itself dosen't have to aware of its namespace.

Thank you

Saminda




Sanjiva Weerawarana wrote:
> I'm -1 on this.
> 
> I'd like to switch to using the WSClient API that we're advocating as a
> good API for Javascript Web services. We didn't use it in WSAS because
> the WSAS stuff predates WSClient. However if we're doing a change like
> this I'd like to move straight to WSClient.
> 
> We should make sure the WSClient uses a proper namespace to avoid the
> problems that we're noticing now with WSAS!
> 
> Sanjiva.
> 
> saminda abeyruwan wrote:
> 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.
> 
> 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.
> 
> If all permits, I would like to volunteer to do the refactoring, and
> help to update other projects.
> 
> Thank you
> 
> Saminda
> 
> 
> 
> 
> 
>>
_______________________________________________
Commons-dev mailing list
Commons-dev at wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/commons-dev
>>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF8Q7NYmklbLuW6wYRAjWBAJ9juBTVPhByJXYbNvh8GM4JHYswFQCeNuhA
wXg0sqMbd4IgOg52VBFczDE=
=QB0g
-----END PGP SIGNATURE-----




More information about the Wsas-java-dev mailing list