geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <>
Subject Gbeans as osgi services, warning of serialization incompatibility
Date Tue, 15 Jun 2010 23:54:05 GMT
After some talks with people who may want to use some geronimo components with non-geronimo
osgi components, I thought it might be a good idea to make it easy to expose gbeans as osgi
services or service factories (GERONIMO-5380).

I've implemented support for this in rev 955091.  This breaks serialization compatibility
of GBeanInfo and GBeanData.  Since pre-3.0 plugins won't work on 3.0 anyway, I don't think
this is a serious issue.  However if there are arguments I can restore serialization compatibility.

In particular this means you will have to rebuild all of geronimo to get any plugins to load.

Here's how this works:

1. There's a new annotation @OsgiService you can add to a gbean (defined with @GBean annotation).
 Optionally, you can include a String array of the interfaces to register the service under.

2. Your gbean can implement ServiceInterfaces and supply the String array of interfaces to
be registered under after it has been created.

3. A deployer can set the interfaces and service properties on a GBeanData.  For instance,
to expose it in osgi jndi context, it can include a entry.

4. Your gbean can implement osgi's ServiceFactory.

When the gbean instance is created, if it's an osgi service (see annotation in (1)), the service
interfaces are determined as follows:

a. if gbean data specifies them, that is used.
b. if the gbean implements ServiceInterfaces, that is used.
c. if the gbean info specifies them, that is used.
d. Otherwise, the class and all implemented interfaces are used.

The service properties are determined as follows:
a. if gbean data specifies them, that is used.
b. Otherwise, a org.apache.geronimo.abstractName=<abstract name> entry is added.

The gbean is registered as an osgi service, and unregistered when it stops.

I've redone the connector/datasource osgi service code to use this more generic capability.

david jencks

View raw message