summaryrefslogtreecommitdiff
path: root/lib/dojo/rpc
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2012-08-14 18:59:10 +0400
committerAndrew Dolgov <[email protected]>2012-08-14 18:59:18 +0400
commit1354d17270961fff662d40f90521223f8fd0d73b (patch)
treee9266be71587e47c800303446e968a6d3565e2cf /lib/dojo/rpc
parentd04f8c826f5283765f52cf6b98b42a1ed8f2d6bc (diff)
update dojo to 1.7.3
Diffstat (limited to 'lib/dojo/rpc')
-rw-r--r--lib/dojo/rpc/JsonService.js87
-rw-r--r--lib/dojo/rpc/JsonService.js.uncompressed.js85
-rw-r--r--lib/dojo/rpc/JsonpService.js69
-rw-r--r--lib/dojo/rpc/JsonpService.js.uncompressed.js67
-rw-r--r--lib/dojo/rpc/RpcService.js176
-rw-r--r--lib/dojo/rpc/RpcService.js.uncompressed.js175
6 files changed, 333 insertions, 326 deletions
diff --git a/lib/dojo/rpc/JsonService.js b/lib/dojo/rpc/JsonService.js
index 064fd0fee..5a755252f 100644
--- a/lib/dojo/rpc/JsonService.js
+++ b/lib/dojo/rpc/JsonService.js
@@ -4,88 +4,5 @@
see: http://dojotoolkit.org/license for details
*/
-
-if(!dojo._hasResource["dojo.rpc.JsonService"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojo.rpc.JsonService"] = true;
-dojo.provide("dojo.rpc.JsonService");
-dojo.require("dojo.rpc.RpcService");
-
-
-dojo.declare("dojo.rpc.JsonService", dojo.rpc.RpcService, {
- bustCache: false,
- contentType: "application/json-rpc",
- lastSubmissionId: 0,
-
- callRemote: function(method, params){
- // summary:
- // call an arbitrary remote method without requiring it to be
- // predefined with SMD
- // method: string
- // the name of the remote method you want to call.
- // params: array
- // array of parameters to pass to method
-
- var deferred = new dojo.Deferred();
- this.bind(method, params, deferred);
- return deferred;
- },
-
- bind: function(method, parameters, deferredRequestHandler, url){
- //summary:
- // JSON-RPC bind method. Takes remote method, parameters,
- // deferred, and a url, calls createRequest to make a JSON-RPC
- // envelope and passes that off with bind.
- // method: string
- // The name of the method we are calling
- // parameters: array
- // The parameters we are passing off to the method
- // deferredRequestHandler: deferred
- // The Deferred object for this particular request
-
- var def = dojo.rawXhrPost({
- url: url||this.serviceUrl,
- postData: this.createRequest(method, parameters),
- contentType: this.contentType,
- timeout: this.timeout,
- handleAs: "json-comment-optional"
- });
- def.addCallbacks(this.resultCallback(deferredRequestHandler), this.errorCallback(deferredRequestHandler));
- },
-
- createRequest: function(method, params){
- // summary:
- // create a JSON-RPC envelope for the request
- // method: string
- // The name of the method we are creating the requst for
- // params: array
- // The array of parameters for this request;
-
- var req = { "params": params, "method": method, "id": ++this.lastSubmissionId };
- var data = dojo.toJson(req);
- return data;
- },
-
- parseResults: function(/*anything*/obj){
- //summary:
- // parse the result envelope and pass the results back to
- // the callback function
- // obj: Object
- // Object containing envelope of data we recieve from the server
-
- if(dojo.isObject(obj)){
- if("result" in obj){
- return obj.result;
- }
- if("Result" in obj){
- return obj.Result;
- }
- if("ResultSet" in obj){
- return obj.ResultSet;
- }
- }
- return obj;
- }
- }
-);
-
-}
+//>>built
+define("dojo/rpc/JsonService",["../main","./RpcService"],function(_1){_1.declare("dojo.rpc.JsonService",_1.rpc.RpcService,{bustCache:false,contentType:"application/json-rpc",lastSubmissionId:0,callRemote:function(_2,_3){var _4=new _1.Deferred();this.bind(_2,_3,_4);return _4;},bind:function(_5,_6,_7,_8){var _9=_1.rawXhrPost({url:_8||this.serviceUrl,postData:this.createRequest(_5,_6),contentType:this.contentType,timeout:this.timeout,handleAs:"json-comment-optional"});_9.addCallbacks(this.resultCallback(_7),this.errorCallback(_7));},createRequest:function(_a,_b){var _c={"params":_b,"method":_a,"id":++this.lastSubmissionId};return _1.toJson(_c);},parseResults:function(_d){if(_1.isObject(_d)){if("result" in _d){return _d.result;}if("Result" in _d){return _d.Result;}if("ResultSet" in _d){return _d.ResultSet;}}return _d;}});return _1.rpc.JsonService;}); \ No newline at end of file
diff --git a/lib/dojo/rpc/JsonService.js.uncompressed.js b/lib/dojo/rpc/JsonService.js.uncompressed.js
new file mode 100644
index 000000000..ae7703d99
--- /dev/null
+++ b/lib/dojo/rpc/JsonService.js.uncompressed.js
@@ -0,0 +1,85 @@
+define("dojo/rpc/JsonService", ["../main", "./RpcService"], function(dojo) {
+ // module:
+ // dojo/rpc/JsonService
+ // summary:
+ // TODOC
+
+
+dojo.declare("dojo.rpc.JsonService", dojo.rpc.RpcService, {
+ bustCache: false,
+ contentType: "application/json-rpc",
+ lastSubmissionId: 0,
+
+ callRemote: function(method, params){
+ // summary:
+ // call an arbitrary remote method without requiring it to be
+ // predefined with SMD
+ // method: string
+ // the name of the remote method you want to call.
+ // params: array
+ // array of parameters to pass to method
+
+ var deferred = new dojo.Deferred();
+ this.bind(method, params, deferred);
+ return deferred;
+ },
+
+ bind: function(method, parameters, deferredRequestHandler, url){
+ //summary:
+ // JSON-RPC bind method. Takes remote method, parameters,
+ // deferred, and a url, calls createRequest to make a JSON-RPC
+ // envelope and passes that off with bind.
+ // method: string
+ // The name of the method we are calling
+ // parameters: array
+ // The parameters we are passing off to the method
+ // deferredRequestHandler: deferred
+ // The Deferred object for this particular request
+
+ var def = dojo.rawXhrPost({
+ url: url||this.serviceUrl,
+ postData: this.createRequest(method, parameters),
+ contentType: this.contentType,
+ timeout: this.timeout,
+ handleAs: "json-comment-optional"
+ });
+ def.addCallbacks(this.resultCallback(deferredRequestHandler), this.errorCallback(deferredRequestHandler));
+ },
+
+ createRequest: function(method, params){
+ // summary:
+ // create a JSON-RPC envelope for the request
+ // method: string
+ // The name of the method we are creating the requst for
+ // params: array
+ // The array of parameters for this request;
+
+ var req = { "params": params, "method": method, "id": ++this.lastSubmissionId };
+ return dojo.toJson(req);
+ },
+
+ parseResults: function(/*anything*/obj){
+ //summary:
+ // parse the result envelope and pass the results back to
+ // the callback function
+ // obj: Object
+ // Object containing envelope of data we recieve from the server
+
+ if(dojo.isObject(obj)){
+ if("result" in obj){
+ return obj.result;
+ }
+ if("Result" in obj){
+ return obj.Result;
+ }
+ if("ResultSet" in obj){
+ return obj.ResultSet;
+ }
+ }
+ return obj;
+ }
+ }
+);
+
+return dojo.rpc.JsonService;
+});
diff --git a/lib/dojo/rpc/JsonpService.js b/lib/dojo/rpc/JsonpService.js
index ecdadc7fc..7bb74e07c 100644
--- a/lib/dojo/rpc/JsonpService.js
+++ b/lib/dojo/rpc/JsonpService.js
@@ -4,70 +4,5 @@
see: http://dojotoolkit.org/license for details
*/
-
-if(!dojo._hasResource["dojo.rpc.JsonpService"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojo.rpc.JsonpService"] = true;
-dojo.provide("dojo.rpc.JsonpService");
-dojo.require("dojo.rpc.RpcService");
-dojo.require("dojo.io.script");
-
-
-dojo.declare("dojo.rpc.JsonpService", dojo.rpc.RpcService, {
- // summary:
- // Generic JSONP service. Minimally extends RpcService to allow
- // easy definition of nearly any JSONP style service. Example
- // SMD files exist in dojox.data
-
- constructor: function(args, requiredArgs){
- if(this.required) {
- if(requiredArgs){
- dojo.mixin(this.required, requiredArgs);
- }
-
- dojo.forEach(this.required, function(req){
- if(req=="" || req==undefined){
- throw new Error("Required Service Argument not found: "+req);
- }
- });
- }
- },
-
- strictArgChecks: false,
-
- bind: function(method, parameters, deferredRequestHandler, url){
- //summary:
- // JSONP bind method. Takes remote method, parameters,
- // deferred, and a url, calls createRequest to make a JSON-RPC
- // envelope and passes that off with bind.
- // method: string
- // The name of the method we are calling
- // parameters: array
- // The parameters we are passing off to the method
- // deferredRequestHandler: deferred
- // The Deferred object for this particular request
-
- var def = dojo.io.script.get({
- url: url||this.serviceUrl,
- callbackParamName: this.callbackParamName||"callback",
- content: this.createRequest(parameters),
- timeout: this.timeout,
- handleAs: "json",
- preventCache: true
- });
- def.addCallbacks(this.resultCallback(deferredRequestHandler), this.errorCallback(deferredRequestHandler));
- },
-
- createRequest: function(parameters){
- // summary:
- // create a JSONP req
- // params: array
- // The array of parameters for this request;
-
- var params = (dojo.isArrayLike(parameters) && parameters.length==1) ?
- parameters[0] : {};
- dojo.mixin(params,this.required);
- return params;
- }
-});
-
-}
+//>>built
+define("dojo/rpc/JsonpService",["../main","./RpcService","../io/script"],function(_1){_1.declare("dojo.rpc.JsonpService",_1.rpc.RpcService,{constructor:function(_2,_3){if(this.required){if(_3){_1.mixin(this.required,_3);}_1.forEach(this.required,function(_4){if(_4==""||_4==undefined){throw new Error("Required Service Argument not found: "+_4);}});}},strictArgChecks:false,bind:function(_5,_6,_7,_8){var _9=_1.io.script.get({url:_8||this.serviceUrl,callbackParamName:this.callbackParamName||"callback",content:this.createRequest(_6),timeout:this.timeout,handleAs:"json",preventCache:true});_9.addCallbacks(this.resultCallback(_7),this.errorCallback(_7));},createRequest:function(_a){var _b=(_1.isArrayLike(_a)&&_a.length==1)?_a[0]:{};_1.mixin(_b,this.required);return _b;}});return _1.rpc.JsonpService;}); \ No newline at end of file
diff --git a/lib/dojo/rpc/JsonpService.js.uncompressed.js b/lib/dojo/rpc/JsonpService.js.uncompressed.js
new file mode 100644
index 000000000..bc1d7108d
--- /dev/null
+++ b/lib/dojo/rpc/JsonpService.js.uncompressed.js
@@ -0,0 +1,67 @@
+define("dojo/rpc/JsonpService", ["../main", "./RpcService", "../io/script"], function(dojo) {
+ // module:
+ // dojo/rpc/JsonpService
+ // summary:
+ // TODOC
+
+
+dojo.declare("dojo.rpc.JsonpService", dojo.rpc.RpcService, {
+ // summary:
+ // Generic JSONP service. Minimally extends RpcService to allow
+ // easy definition of nearly any JSONP style service. Example
+ // SMD files exist in dojox.data
+
+ constructor: function(args, requiredArgs){
+ if(this.required) {
+ if(requiredArgs){
+ dojo.mixin(this.required, requiredArgs);
+ }
+
+ dojo.forEach(this.required, function(req){
+ if(req=="" || req==undefined){
+ throw new Error("Required Service Argument not found: "+req);
+ }
+ });
+ }
+ },
+
+ strictArgChecks: false,
+
+ bind: function(method, parameters, deferredRequestHandler, url){
+ //summary:
+ // JSONP bind method. Takes remote method, parameters,
+ // deferred, and a url, calls createRequest to make a JSON-RPC
+ // envelope and passes that off with bind.
+ // method: string
+ // The name of the method we are calling
+ // parameters: array
+ // The parameters we are passing off to the method
+ // deferredRequestHandler: deferred
+ // The Deferred object for this particular request
+
+ var def = dojo.io.script.get({
+ url: url||this.serviceUrl,
+ callbackParamName: this.callbackParamName||"callback",
+ content: this.createRequest(parameters),
+ timeout: this.timeout,
+ handleAs: "json",
+ preventCache: true
+ });
+ def.addCallbacks(this.resultCallback(deferredRequestHandler), this.errorCallback(deferredRequestHandler));
+ },
+
+ createRequest: function(parameters){
+ // summary:
+ // create a JSONP req
+ // params: array
+ // The array of parameters for this request;
+
+ var params = (dojo.isArrayLike(parameters) && parameters.length==1) ?
+ parameters[0] : {};
+ dojo.mixin(params,this.required);
+ return params;
+ }
+});
+
+return dojo.rpc.JsonpService;
+});
diff --git a/lib/dojo/rpc/RpcService.js b/lib/dojo/rpc/RpcService.js
index 5ef5dae7f..e504818be 100644
--- a/lib/dojo/rpc/RpcService.js
+++ b/lib/dojo/rpc/RpcService.js
@@ -4,177 +4,5 @@
see: http://dojotoolkit.org/license for details
*/
-
-if(!dojo._hasResource["dojo.rpc.RpcService"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojo.rpc.RpcService"] = true;
-dojo.provide("dojo.rpc.RpcService");
-
-
-dojo.declare("dojo.rpc.RpcService", null, {
- constructor: function(args){
- //summary:
- //Take a string as a url to retrieve an smd or an object that is an smd or partial smd to use
- //as a definition for the service
- //
- // args: object
- // Takes a number of properties as kwArgs for defining the service. It also
- // accepts a string. When passed a string, it is treated as a url from
- // which it should synchronously retrieve an smd file. Otherwise it is a kwArgs
- // object. It accepts serviceUrl, to manually define a url for the rpc service
- // allowing the rpc system to be used without an smd definition. strictArgChecks
- // forces the system to verify that the # of arguments provided in a call
- // matches those defined in the smd. smdString allows a developer to pass
- // a jsonString directly, which will be converted into an object or alternatively
- // smdObject is accepts an smdObject directly.
- //
- if(args){
- //if the arg is a string, we assume it is a url to retrieve an smd definition from
- if( (dojo.isString(args)) || (args instanceof dojo._Url)){
- if (args instanceof dojo._Url){
- var url = args + "";
- }else{
- url = args;
- }
- var def = dojo.xhrGet({
- url: url,
- handleAs: "json-comment-optional",
- sync: true
- });
-
- def.addCallback(this, "processSmd");
- def.addErrback(function() {
- throw new Error("Unable to load SMD from " + args);
- });
-
- }else if(args.smdStr){
- this.processSmd(dojo.eval("("+args.smdStr+")"));
- }else{
- // otherwise we assume it's an arguments object with the following
- // (optional) properties:
- // - serviceUrl
- // - strictArgChecks
- // - smdStr
- // - smdObj
-
- if(args.serviceUrl){
- this.serviceUrl = args.serviceUrl;
- }
-
- this.timeout = args.timeout || 3000;
-
- if("strictArgChecks" in args){
- this.strictArgChecks = args.strictArgChecks;
- }
-
- this.processSmd(args);
- }
- }
- },
-
- strictArgChecks: true,
- serviceUrl: "",
-
- parseResults: function(obj){
- // summary
- // parse the results coming back from an rpc request. this
- // base implementation, just returns the full object
- // subclasses should parse and only return the actual results
- // obj: Object
- // Object that is the return results from an rpc request
- return obj;
- },
-
- errorCallback: function(/* dojo.Deferred */ deferredRequestHandler){
- // summary:
- // create callback that calls the Deferres errback method
- // deferredRequestHandler: Deferred
- // The deferred object handling a request.
- return function(data){
- deferredRequestHandler.errback(data.message);
- };
- },
-
- resultCallback: function(/* dojo.Deferred */ deferredRequestHandler){
- // summary:
- // create callback that calls the Deferred's callback method
- // deferredRequestHandler: Deferred
- // The deferred object handling a request.
-
- var tf = dojo.hitch(this,
- function(obj){
- if(obj.error!=null){
- var err;
- if(typeof obj.error == 'object'){
- err = new Error(obj.error.message);
- err.code = obj.error.code;
- err.error = obj.error.error;
- }else{
- err = new Error(obj.error);
- }
- err.id = obj.id;
- err.errorObject = obj;
- deferredRequestHandler.errback(err);
- }else{
- deferredRequestHandler.callback(this.parseResults(obj));
- }
- }
- );
- return tf;
- },
-
- generateMethod: function(/*string*/ method, /*array*/ parameters, /*string*/ url){
- // summary:
- // generate the local bind methods for the remote object
- // method: string
- // The name of the method we are generating
- // parameters: array
- // the array of parameters for this call.
- // url: string
- // the service url for this call
-
- return dojo.hitch(this, function(){
- var deferredRequestHandler = new dojo.Deferred();
-
- // if params weren't specified, then we can assume it's varargs
- if( (this.strictArgChecks) &&
- (parameters != null) &&
- (arguments.length != parameters.length)
- ){
- // put error stuff here, no enough params
- throw new Error("Invalid number of parameters for remote method.");
- }else{
- this.bind(method, dojo._toArray(arguments), deferredRequestHandler, url);
- }
-
- return deferredRequestHandler;
- });
- },
-
- processSmd: function(object){
- // summary:
- // callback method for reciept of a smd object. Parse the smd
- // and generate functions based on the description
- // object:
- // smd object defining this service.
-
- if(object.methods){
- dojo.forEach(object.methods, function(m){
- if(m && m.name){
- this[m.name] = this.generateMethod( m.name,
- m.parameters,
- m.url||m.serviceUrl||m.serviceURL);
- if(!dojo.isFunction(this[m.name])){
- throw new Error("RpcService: Failed to create" + m.name + "()");
- /*console.log("RpcService: Failed to create", m.name, "()");*/
- }
- }
- }, this);
- }
-
- this.serviceUrl = object.serviceUrl||object.serviceURL;
- this.required = object.required;
- this.smd = object;
- }
-});
-
-}
+//>>built
+define("dojo/rpc/RpcService",["../main","../_base/url"],function(_1){_1.declare("dojo.rpc.RpcService",null,{constructor:function(_2){if(_2){if((_1.isString(_2))||(_2 instanceof _1._Url)){if(_2 instanceof _1._Url){var _3=_2+"";}else{_3=_2;}var _4=_1.xhrGet({url:_3,handleAs:"json-comment-optional",sync:true});_4.addCallback(this,"processSmd");_4.addErrback(function(){throw new Error("Unable to load SMD from "+_2);});}else{if(_2.smdStr){this.processSmd(_1.eval("("+_2.smdStr+")"));}else{if(_2.serviceUrl){this.serviceUrl=_2.serviceUrl;}this.timeout=_2.timeout||3000;if("strictArgChecks" in _2){this.strictArgChecks=_2.strictArgChecks;}this.processSmd(_2);}}}},strictArgChecks:true,serviceUrl:"",parseResults:function(_5){return _5;},errorCallback:function(_6){return function(_7){_6.errback(_7.message);};},resultCallback:function(_8){return _1.hitch(this,function(_9){if(_9.error!=null){var _a;if(typeof _9.error=="object"){_a=new Error(_9.error.message);_a.code=_9.error.code;_a.error=_9.error.error;}else{_a=new Error(_9.error);}_a.id=_9.id;_a.errorObject=_9;_8.errback(_a);}else{_8.callback(this.parseResults(_9));}});},generateMethod:function(_b,_c,_d){return _1.hitch(this,function(){var _e=new _1.Deferred();if((this.strictArgChecks)&&(_c!=null)&&(arguments.length!=_c.length)){throw new Error("Invalid number of parameters for remote method.");}else{this.bind(_b,_1._toArray(arguments),_e,_d);}return _e;});},processSmd:function(_f){if(_f.methods){_1.forEach(_f.methods,function(m){if(m&&m.name){this[m.name]=this.generateMethod(m.name,m.parameters,m.url||m.serviceUrl||m.serviceURL);if(!_1.isFunction(this[m.name])){throw new Error("RpcService: Failed to create"+m.name+"()");}}},this);}this.serviceUrl=_f.serviceUrl||_f.serviceURL;this.required=_f.required;this.smd=_f;}});return _1.rpc.RpcService;}); \ No newline at end of file
diff --git a/lib/dojo/rpc/RpcService.js.uncompressed.js b/lib/dojo/rpc/RpcService.js.uncompressed.js
new file mode 100644
index 000000000..3675dadf6
--- /dev/null
+++ b/lib/dojo/rpc/RpcService.js.uncompressed.js
@@ -0,0 +1,175 @@
+define("dojo/rpc/RpcService", ["../main", "../_base/url"], function(dojo) {
+ // module:
+ // dojo/rpc/RpcService
+ // summary:
+ // TODOC
+
+
+dojo.declare("dojo.rpc.RpcService", null, {
+ constructor: function(args){
+ //summary:
+ //Take a string as a url to retrieve an smd or an object that is an smd or partial smd to use
+ //as a definition for the service
+ //
+ // args: object
+ // Takes a number of properties as kwArgs for defining the service. It also
+ // accepts a string. When passed a string, it is treated as a url from
+ // which it should synchronously retrieve an smd file. Otherwise it is a kwArgs
+ // object. It accepts serviceUrl, to manually define a url for the rpc service
+ // allowing the rpc system to be used without an smd definition. strictArgChecks
+ // forces the system to verify that the # of arguments provided in a call
+ // matches those defined in the smd. smdString allows a developer to pass
+ // a jsonString directly, which will be converted into an object or alternatively
+ // smdObject is accepts an smdObject directly.
+ //
+ if(args){
+ //if the arg is a string, we assume it is a url to retrieve an smd definition from
+ if( (dojo.isString(args)) || (args instanceof dojo._Url)){
+ if (args instanceof dojo._Url){
+ var url = args + "";
+ }else{
+ url = args;
+ }
+ var def = dojo.xhrGet({
+ url: url,
+ handleAs: "json-comment-optional",
+ sync: true
+ });
+
+ def.addCallback(this, "processSmd");
+ def.addErrback(function() {
+ throw new Error("Unable to load SMD from " + args);
+ });
+
+ }else if(args.smdStr){
+ this.processSmd(dojo.eval("("+args.smdStr+")"));
+ }else{
+ // otherwise we assume it's an arguments object with the following
+ // (optional) properties:
+ // - serviceUrl
+ // - strictArgChecks
+ // - smdStr
+ // - smdObj
+
+ if(args.serviceUrl){
+ this.serviceUrl = args.serviceUrl;
+ }
+
+ this.timeout = args.timeout || 3000;
+
+ if("strictArgChecks" in args){
+ this.strictArgChecks = args.strictArgChecks;
+ }
+
+ this.processSmd(args);
+ }
+ }
+ },
+
+ strictArgChecks: true,
+ serviceUrl: "",
+
+ parseResults: function(obj){
+ // summary:
+ // parse the results coming back from an rpc request. this
+ // base implementation, just returns the full object
+ // subclasses should parse and only return the actual results
+ // obj: Object
+ // Object that is the return results from an rpc request
+ return obj;
+ },
+
+ errorCallback: function(/* dojo.Deferred */ deferredRequestHandler){
+ // summary:
+ // create callback that calls the Deferres errback method
+ // deferredRequestHandler: Deferred
+ // The deferred object handling a request.
+ return function(data){
+ deferredRequestHandler.errback(data.message);
+ };
+ },
+
+ resultCallback: function(/* dojo.Deferred */ deferredRequestHandler){
+ // summary:
+ // create callback that calls the Deferred's callback method
+ // deferredRequestHandler: Deferred
+ // The deferred object handling a request.
+
+ return dojo.hitch(this,
+ function(obj){
+ if(obj.error!=null){
+ var err;
+ if(typeof obj.error == 'object'){
+ err = new Error(obj.error.message);
+ err.code = obj.error.code;
+ err.error = obj.error.error;
+ }else{
+ err = new Error(obj.error);
+ }
+ err.id = obj.id;
+ err.errorObject = obj;
+ deferredRequestHandler.errback(err);
+ }else{
+ deferredRequestHandler.callback(this.parseResults(obj));
+ }
+ }
+ );
+ },
+
+ generateMethod: function(/*string*/ method, /*array*/ parameters, /*string*/ url){
+ // summary:
+ // generate the local bind methods for the remote object
+ // method: string
+ // The name of the method we are generating
+ // parameters: array
+ // the array of parameters for this call.
+ // url: string
+ // the service url for this call
+
+ return dojo.hitch(this, function(){
+ var deferredRequestHandler = new dojo.Deferred();
+
+ // if params weren't specified, then we can assume it's varargs
+ if( (this.strictArgChecks) &&
+ (parameters != null) &&
+ (arguments.length != parameters.length)
+ ){
+ // put error stuff here, no enough params
+ throw new Error("Invalid number of parameters for remote method.");
+ }else{
+ this.bind(method, dojo._toArray(arguments), deferredRequestHandler, url);
+ }
+
+ return deferredRequestHandler;
+ });
+ },
+
+ processSmd: function(object){
+ // summary:
+ // callback method for reciept of a smd object. Parse the smd
+ // and generate functions based on the description
+ // object:
+ // smd object defining this service.
+
+ if(object.methods){
+ dojo.forEach(object.methods, function(m){
+ if(m && m.name){
+ this[m.name] = this.generateMethod( m.name,
+ m.parameters,
+ m.url||m.serviceUrl||m.serviceURL);
+ if(!dojo.isFunction(this[m.name])){
+ throw new Error("RpcService: Failed to create" + m.name + "()");
+ /*console.log("RpcService: Failed to create", m.name, "()");*/
+ }
+ }
+ }, this);
+ }
+
+ this.serviceUrl = object.serviceUrl||object.serviceURL;
+ this.required = object.required;
+ this.smd = object;
+ }
+});
+
+return dojo.rpc.RpcService;
+});