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

adrian@jboss.org do-not-reply at jboss.com
Tue Mar 4 00:53:58 EST 2008


The KernelController should already be able to give you most of the
ServiceReference information.

The two difficulties you'll find with the ServiceReferences are

1) What interfaces (if any) should they be exposed as.
For StandardMBeans this is easier since there is spec defined mechanism to
determine the management interface or there is the @JMX annotation.

However sometimes the MBean is not really what you want. 
e.g. The JCA ConnectionManager is not the DataSource ;-)

For POJOs, a simple analysis gives you two options:
a) Don't expose an it unless there is specific configuration telling you
what the OSGi service interface is.
e.g.

  | @org.jboss.osgi.Service(interfaces={X,Y})
  | public class MyClass implements X,Y,Z {}
  | 
b) Expose them using any of the interfaces (there already is a class->target map)
inside the controller for the type based injection.

However, I'm sure you can think of other mechanisms/policy?

2) What deployment does it belong to?
This information is sort of there but it is not in the format you want it
and not public.

The DeploymentContext has a getControllerContextNames().

But this is Deployment->Names, you want Name->Deployment.

In fact, except for the bootstrap, all MBeans/POJOs go through
the relevant component deployers, so you can intercept this information
and make some registry of your own.

But it would be better if we could do this natively rather than
duplicating information.

e.g. pseudo code (similar to what is already done to build the info
in the deployment context)

  | public class MyRegistry extends AbstractDeployer
  | {
  |    public MyRegistry()
  |    {
  |        setComponentsOnly(true);
  |    }
  | 
  |    public void deploy(DeploymentUnit unit)
  |    {
  |       // A component unit name is the name in the MC
  |       // The bundle is the top level deployment
  |       map.put(unit.getName(), unit.getTopLevel());
  |    }
  | 
  |    public void undeploy(DeploymentUnit unit)
  |    {
  |       map.remove(unit.getName());
  |    }
  | }
  | 

OTHER WORK

Don't forget you've also got to emit ServiceEvents for these as well
otherwise users won't know when they appear/disappear.

Finally, longer term we want also to expose things like EJBs as services
through their home or business interface.

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

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



More information about the jboss-dev-forums mailing list