Bundle lifecycle controlled by maexo?

2 views
Skip to first unread message

schu...@googlemail.com

unread,
Jun 16, 2009, 11:01:50 AM6/16/09
to maexo-discuss
Hello again,

is it possible to retrieve the actual bundle status (resolved,
active, ....)? Until now I only can get the names and versions. I cant
find this in jmx either. Even jconsole wont tell me that status.

thx,
juergen

dirk.mahler

unread,
Jun 16, 2009, 2:33:21 PM6/16/09
to maexo-discuss
Hi Juergen,

the bundle maexo-mbeans.osgi.core contains an MBean implementation
representing OSGi bundles and can be obtained by using object names
following the pattern
"com.buschmais.maexo:type=Bundle,name=<symbolicName>,version=<bundleVersion>" (e.g.
"com.buschmais.maexo:type=Bundle,name=slf4j.api,version=1.5.6").

The MBean implementation provides among others two attributes (both
read only) which represent the current state of a bundle:

- state: an integer representing the state as it is provided by the
OSGi framework
- stateAsName: a human readable string representation (e.g. ACTIVE,
RESOLVED)

Thus calling mbeanServerConnection.getAttribute(objectName, "state");
or mbeanServerConnection.getAttribute(objectName, "stateAsName");
should provide the requested information.

The MAEXO distribution comes with an API documentation of the provided
MBeans, it is located in the directory "doc/api/maexo-
mbeans.osgi.core". Here you will find the interface
BundleMBean and the class BundleMBeanConstants which are supposed to
be used by JMX clients, e.g.:

BundleMBean mbean = (BundleMBean)
MBeanServerInvocationHandler.newProxyInstance(
mbeanServerConnection, objectName, BundleMBean.class, false);
Integer state = mbean.getState();
String stateAsName = mbean.getStateAsName();

Regards

Dirk

Frank Schwarz

unread,
Jun 16, 2009, 2:34:02 PM6/16/09
to maexo-discuss
I'm not quite sure if I got what you mean.

Every bundle is exported as a
com.buschmais.maexo.mbeans.osgi.core.BundleMBean, for example
"com.buschmais.maexo:type=Bundle,name=org.eclipse.core.runtime,version=3.4.0.v20080512".
A BundleMBean has the attributes "state" and "stateAsName"

If you query the mbeanserver(-connection) for mbeans as
"com.buschmais.maexo:type=Bundle,name=*,version=*" you will get all
known bundles (as their mbean representation).

-- Frank


On 16 Jun., 17:01, "schum...@googlemail.com" <schum...@googlemail.com>
wrote:

schu...@googlemail.com

unread,
Jun 17, 2009, 5:07:59 AM6/17/09
to maexo-discuss
Hello,

excellent support in this group! The attribute stateasname is what I
missed and I didnt know how to handle BundleMBean.

Thx a lot,
juergen
Reply all
Reply to author
Forward
0 new messages