[JBoss OSGi Development] - Re: Service integration with MC
by adrian@jboss.org
"alesj" wrote : "adrian(a)jboss.org" wrote :
| | e.g. The OSGi api is at the deployment level
| | by passing in the Bundle to getService(Bundle).
| |
| Wouldn't this be DeploymentControllerContext?
|
But that's just an implementation detail. ;-)
The actual answer is yes for normal bundles, because they always represent
top level deployments. OSGi bundles can't have subdeployments.
But its also not for the SystemBundle which doesn't have a DeploymentUnit, it should use
the SYSTEM level.
I can imagine other cases where you might not have a specific ControllerContext but
you do know what your ServiceTracker is (or something else does and can "hide" the
link through its own api).
Or as I described above, you may want to do tracking at subdeployment level.
The DeploymentControllerContext is no use there because it maps to the top level
deployment.
DeploymentControllerContext.getScope() -> APPLICATION scope
DeploymentUnit.getTopLevel().getScope() -> APPLICATION scope
(Sub)DeploymentUnit.getScope() -> DEPLOYMENT scope
So you can see that using the implement detail actually can give you the wrong answer.
Because you are writing to the wrong api. ;-)
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4267036#4267036
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4267036
16 years, 4 months
[JBoss OSGi Development] - Re: Service integration with MC
by alesj
"adrian(a)jboss.org" wrote : It should be done on the calls to (un)getTarget()
|
|
| | // Mixin interface for service tracking
| | public interface ServiceTracking
| | {
| | ...
| |
| | if (me instanceOf ServiceTracking)
| | {
| | ServiceTracker otherTracker = me.getServiceTracker();
| | if (otherTracker != null)
| | otherTracker.incrementUsing(this);
| | }
| | }
| | return result;
| | }
| |
|
| The instanceOf ServiceTracking is for backwards compatibilty in case
| some old ControllerContext doesn't know about ServiceTracking.
|
I don't get this "instance of"?
Wouldn't ControllerContext implement this ServiceTracking mixin?
OK, I guess since you called it mixin, it should be just AbstractControllerContext that impls it.
But this makes lookup code ugly ... checking every context in metadata if it's ServiceTracking interface.
Oh well, some copy pasting won't kill me ... :-)
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4267033#4267033
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4267033
16 years, 4 months