Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 334198 - [client] eventing and local services
Summary: [client] eventing and local services
Status: RESOLVED FIXED
Alias: None
Product: Orion
Classification: ECD
Component: Client (show other bugs)
Version: 0.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 0.2   Edit
Assignee: Simon Kaegi CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 334197
Blocks: 334570
  Show dependency tree
 
Reported: 2011-01-12 22:14 EST by Susan McCourt CLA
Modified: 2011-09-01 11:41 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Susan McCourt CLA 2011-01-12 22:14:55 EST
In 0.2-M4, we support the notion of "local services" in the service registry.  The idea is that these services are instantiated by the page and handed to the registry.  The registry can then call these services directly rather than going through the hub or some other sandbox.  This is good.

BUT...some of our application services have code that assumes they are local.  They are keeping track of listener instances, etc. and directly calling them.  This is bad.  The services themselves should not ever assume they are always local.  

I think the solution is that all eventing, even from local services, is handled by the registry.
Comment 1 Simon Kaegi CLA 2011-01-12 22:28:54 EST
Along with bug 334197 I'd like to use this bug to track cleaning up the service registry to a point where the differences between remote and local services is safely hidden away. Targetting end of next week.
Comment 2 Susan McCourt CLA 2011-01-26 17:38:01 EST
From my point of view this bug is now fixed.  There's more cleanup to do in bug 334197 and others, but the basic complaint here is resolved.  Simon, you can decide if you want to close this bug.
Comment 3 Susan McCourt CLA 2011-01-26 17:53:13 EST
For those who want to know about the types of changes, I'll document here.

The basic change for client code is from (OLD PATTERN):
	registry.callService("name", "method", null, [arg list]);

to something that looks more like a promise. (NEW PATTERN):
	registry.getService("name").then(function(service) {
		service.method(arg1, arg2);
	});

And for adding listeners, we now use listener event types.  
OLD PATTERN
	registry.callService("name", "addFooListener", null,  [function(stuff) { deal with stuff }]);
NEW PATTERN
	registry.getService("name").then(function(service) {
               service.addListener("stuffChanged", function(stuff) {deal with stuff});
        });

If you were using the service registry callbacks (this was not common) like this (OLD PATTERN):
        registry.callService("name", "method", function(result) {doSomething}, [arg list]);

the NEW PATTERN is:
        registry.getService("name").then(function(service) {
             return service.method(arg1, arg2);
        }).then(function(result) {doSomething});
Comment 4 Simon Kaegi CLA 2011-01-26 22:31:31 EST
Although the bug calls out local services, I want to finish my current round on re-integrating remote services back in before closing. Also, we need to update the wiki with the new service related apis.
Comment 5 John Arthorne CLA 2011-03-07 11:02:00 EST
Moving bugs targeting past milestones...
Comment 6 Simon Kaegi CLA 2011-03-07 11:10:46 EST
Resolving in the past...