WARNING - Function relief.handlers.CommonServiceProvider: called with 8 argument(s)

19 views
Skip to first unread message

Ramesh S

unread,
Aug 25, 2011, 9:33:39 PM8/25/11
to relief-f...@googlegroups.com
I am trying to read a simple JSON script from a local REST server, which gives out data like this.
{"Category":{"categoryId":"001","categoryName":"Java"}}


  var cache;
  /**
   * @type {relief.cache.Cache}
   * @private
   */
  this.cache_ = cache = new relief.cache.Cache();
  
  /**
   * An optional map of headers for our app. All of our app's RPC  requests
   * will be formatted JSON if a body is provided.
  */
  var headers = new goog.structs.Map({
   'Content-Type': 'application/json' 
  });
  
  var eventBus = new goog.events.EventTarget();
  
  var rpc;
  /**
   *
   * @type {relief.rpc.RPCService}
   * @private
   */
  this.rpc_ = rpc = new relief.rpc.RPCService(cache, headers);
   
   var auth;
   /**
    * Our app will not require authentication, so we will use the provided
    * PublicAuthManager class in Relief.
    *
    * @type {relief.auth.PublicAuthManager}
    * @private
    */
   this.auth_ = auth = new relief.auth.PublicAuthManager();
   
   // Get our required DOM elements ..
   var iframe = /** @type {!HTMLIFrameElement} */
        (goog.dom.getElement('history_frame')),
       input = /** @type {!HTMLInputElement} */
        (goog.dom.getElement('history_input')),
       content = /** @type {!Element} */
        (goog.dom.getElement('content-root'));


var sp = new relief.handlers.CommonServiceProvider( eventBus,gb.urls, cache, rpc, auth, iframe, input, content);

But I am getting the error even though there are 8 parameters in 
gb.ServiceProvider = function(eventBus, urlMap, cache, rpc, auth,
iframe, input, content) { goog.base(this, urlMap, cache, rpc, auth, iframe, input, content);

plovr.addWarnings([{"input":"/gb/gb.js","message":"/gb/gb.js:101: WARNING - Function relief.handlers.CommonServiceProvider: called with 8 argument(s). Function requires at least 7 argument(s) and no more than 7 argument(s).\n  var sp \u003d new relief.handlers.CommonServiceProvider( eventBus,gb.urls, cache, rpc, auth, iframe, input, content);\n                                                    ^\n","isError":false,"lineNumber":101},{"input":"/gb/gb.js","message":"/gb/gb.js:101: WARNING - actual parameter 2 of relief.handlers.CommonServiceProvider does not match formal parameter\nfound   : Object\nrequired: relief.cache.Cache\n  var sp \u003d new relief.handlers.CommonServiceProvider( eventBus,gb.urls, cache, rpc, auth, iframe, input, content);\n                                                               ^\n","isError":false,"lineNumber":101},{"input":"/gb/gb.js","message":"/gb/gb.js:101: WARNING - actual parameter 3 of relief.handlers.CommonServiceProvider does not match formal parameter\nfound   : relief.cache.Cache\nrequired: relief.rpc.RPCService\n  var sp \u003d new relief.handlers.CommonServiceProvider( eventBus,gb.urls, cache, rpc, auth, iframe, input, content);\n     .... and so on
Appreciate any help
thanks
Ramesh

Jay Young

unread,
Aug 25, 2011, 11:14:07 PM8/25/11
to relief-f...@googlegroups.com
Hey Ramesh,

It looks like you are trying to pass an event bus to the relief.handlers.CommonServiceProvider constructor, which is incorrect:
var sp = new relief.handlers.CommonServiceProvider( eventBus,gb.urls, cache, rpc, auth, iframe, input, content);
The relief.handlers.CommonServiceProvider constructor takes the following 7 arguments:
relief.handlers.CommonServiceProvider = function(urlMap, cache, rpc, auth, 
                                                 iframe, input, content);
You also seem to be mixing up examples again.  The guestbook example did not use an event bus.  The event bus concept is not a Relief component - it was only used in the sample blog application to demonstrate why and how you might want to extend the provided ServiceProvider classes.  If you look at your code and see an event bus + guestbook code, something is wrong.  I would recommend that, for your own app, create your own subclass of relief.handlers.CommonServiceProvider.  Don't try to re-use one of the example app classes.

Ramesh S

unread,
Aug 26, 2011, 10:19:45 AM8/26/11
to relief-f...@googlegroups.com
Good Morning Jay,

Appreciate your prompt reply.
I was actually trying to pass a record type class at first to my custom ServiceProvider class as the first parameter. I was getting similar error then. I think I am mixing up totally :) 
But I am almost there and I am getting the concepts now. 

Thanks for your patience. I am totally new to front end programming and this is the first time I am attempting and thanks to Relief Framework, I am getting there faster.

regards,
Ramesh

Jay Young

unread,
Aug 26, 2011, 10:22:48 AM8/26/11
to relief-f...@googlegroups.com
I'm happy to help.  I know a lot of these concepts take some getting used to.  And thanks for spreading the word!
Reply all
Reply to author
Forward
0 new messages