[jboss-dev-forums] [JBoss OSGi Development] - Re: Service integration with MC

adrian@jboss.org do-not-reply at jboss.com
Mon Nov 23 08:23:09 EST 2009


"alesj" wrote : "adrian at 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



More information about the jboss-dev-forums mailing list