Harold Huang
Harold Huang

Reputation: 13

How does OSGi bundle get started without Bundle-Activator

How can an OSGi bundle become active without Bundle-Activator in the MANIFEST-MF file? For example, Google guava can run as a bundle and become active in Karaf container but the MANIFEST-MF file doesn't include Bundle-Activator property.

Manifest-Version: 1.0
Bnd-LastModified: 1408992499326
Build-Jdk: 1.7.0-google-v6
Built-By: cgdecker
Bundle-Description: Guava is a suite of core and expanded libraries that
  include    utility classes, google's collections, io classes, and much
     much more.    Guava has only one code dependency - javax.annotation
 ,    per the JSR-305 spec.
Bundle-DocURL: https://guava-libraries.googlecode.com/
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
Bundle-ManifestVersion: 2
Bundle-Name: Guava: Google Core Libraries for Java
Bundle-SymbolicName: com.google.guava
Bundle-Version: 18.0.0
Created-By: Apache Maven Bundle Plugin
Export-Package: com.google.common.net;uses:="javax.annotation,com.google
 .common.base,com.google.common.hash,com.google.common.io,com.google.com
 mon.primitives,com.google.common.collect,com.google.common.escape";vers
 ion="18.0.0",com.google.common.html;uses:="com.google.common.escape,jav
 ax.annotation";version="18.0.0",com.google.common.collect;uses:="com.go
 ogle.common.base,javax.annotation,com.google.common.primitives,com.goog
 le.common.math";version="18.0.0",com.google.common.primitives;uses:="co
 m.google.common.base,javax.annotation,sun.misc";version="18.0.0",com.go
 ogle.common.base;uses:="javax.annotation";version="18.0.0",com.google.c
 ommon.escape;uses:="com.google.common.base,javax.annotation";version="1
 8.0.0",com.google.common.cache;uses:="com.google.common.collect,com.goo
 gle.common.util.concurrent,javax.annotation,com.google.common.base,com.
 google.common.primitives,sun.misc";version="18.0.0",com.google.common.e
 ventbus;uses:="com.google.common.collect,com.google.common.cache,javax.
 annotation,com.google.common.base,com.google.common.util.concurrent,com
 .google.common.reflect";version="18.0.0",com.google.common.util.concurr
 ent;uses:="com.google.common.base,javax.annotation,com.google.common.co
 llect,com.google.common.primitives,com.google.common.math";version="18.
 0.0",com.google.common.hash;uses:="com.google.common.primitives,com.goo
 gle.common.base,javax.annotation,com.google.common.math";version="18.0.
 0",com.google.common.io;uses:="javax.annotation,com.google.common.base,
 com.google.common.math,com.google.common.hash,com.google.common.collect
 ,com.google.common.primitives";version="18.0.0",com.google.common.xml;u
 ses:="com.google.common.escape,javax.annotation";version="18.0.0",com.g
 oogle.common.reflect;uses:="javax.annotation,com.google.common.base,com
 .google.common.collect,com.google.common.primitives";version="18.0.0",c
 om.google.common.math;uses:="com.google.common.base,com.google.common.p
 rimitives,javax.annotation";version="18.0.0",com.google.common.annotati
 ons;version="18.0.0"
Import-Package: javax.annotation;resolution:=optional,sun.misc;resolutio
 n:=optional
Tool: Bnd-1.50.0

Upvotes: 1

Views: 806

Answers (1)

Achim Nierbeck
Achim Nierbeck

Reputation: 5285

For one, there are also other means of starting a logic in a bundle, for example it could be Blueprint, or Declarative Services. But I doubt guava does have that, so what you see here is a typical case. An OSGi bundle usually follows the following steps:

a) installed
b) resolved
c) starting
d) active
e) stopping
f) uninstalled

This is for all bundles, only fragments will stay in the resolved state as a fragment bundle itself can't be started/activated.

If your bundle (or guava in this case) doesn't have an explicit Activator class which will be called in the active stage, the bundle still can be active.

Upvotes: 2

Related Questions