[jboss-dev-forums] [Design of OSGi Integration] - Re: ServiceReferences outside of OSGi Deployers

johnbailey do-not-reply at jboss.com
Tue Mar 4 01:38:27 EST 2008


I will take a crack at coming up with a ServiceRegistration/ServiceReference determination model.

On a similar note, what is the best way to get the KernelController, KernelConfigurator, and the KernelEventEmitter?  The BundleContextImpl uses them for the ServiceRegistration.  I am doing it as follows, but I want to see if there is a more correct way of doing it:


  |    protected KernelController controller;
  | 
  |    protected KernelEventEmitter emitterDelegate;
  | 
  |     protected KernelConfigurator configurator;
  | 
  |    ....
  | 
  |     public BundleContextImpl(DeploymentUnit deploymentUnit)
  |    {
  |       this.deploymentUnit = deploymentUnit;
  |       controller = getKernelController(deploymentUnit); 
  |       emitterDelegate = controller.getKernel().getEventManager();
  |       configurator = controller.getKernel().getConfigurator(); 
  |    }
  | 
  |    ....
  | 
  |    private KernelController getKernelController(DeploymentUnit deploymentUnit)
  |    {
  |       return (KernelController) deploymentUnit
  |             .getAttachment(ControllerContext.class.getName(), ControllerContext.class)
  |             .getController();
  |    }
  | 

I am sure there is a better way, as there always is :)

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4133788#4133788

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4133788



More information about the jboss-dev-forums mailing list