Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [e4-dev] Having multiple IContextFunction


Hi Tom,
This is the expected behavior. Having multiple services can be a valid scenario. For example, imagine that we ship e4 SDK with a "generic" implementation of a, say, weather service. A developer downloads the SDK and says, "hey, this weather service... hmm... does not provide long-term forecasts within expected tolerances". With multiple services allowed, in theory, the developer then can make his own weather service and register it with OSGi with a higher ranking.

(Unfortunately iterating services to find the "best" answer won't work as at the dependency injector level we don't know what "best" means; "null" can be a valid answer too.)

This is simplicity vs. extensibility in action :-). I am not claiming that we have found the best balance, so if the reasons above don't sound convincing please open a bug/enhancement request and we'll follow up there.

Sincerely,
Oleg Besedin



From: Tom Schindl <tom.schindl@xxxxxxxxxxxxxxx>
To: E4 Project developer mailing list <e4-dev@xxxxxxxxxxx>
Date: 05/20/2010 09:31 AM
Subject: [e4-dev] Having multiple IContextFunction
Sent by: e4-dev-bounces@xxxxxxxxxxx





Hi,

Today i came across a problem that I had 2 DS-Services defining the same
"service.context.key" because both functions are able to contruct the
same Service-Interface in different contexts.

When I launched my inner 4.0 Workbench my model-editor didn't came up
because it said that there was a missing DI-Argument.

The reason was that DI consulted only one of the contributed functions
which was not able to construct a service in the given context and so
refused to create my Component-POJO.

Is this behaviour expected and if it is it would it probably make sense
to log a warning if 2 IContextFunctions define the same service.context.key.

Ideally I think if there are n functions who provide the same
service.context.key they are called until one of them returns a none
null value (though I'm not sure this is possible).

I hope the above is not too confusing else please tell me and I'll try
to rephrase it.

Tom

--
B e s t S o l u t i o n . a t                        EDV Systemhaus GmbH
------------------------------------------------------------------------
tom schindl                                        geschaeftsfuehrer/CEO
------------------------------------------------------------------------
eduard-bodem-gasse 5/1    A-6020 innsbruck      phone    ++43 512 935834
_______________________________________________
e4-dev mailing list
e4-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/e4-dev



Back to the top