In an OSGi environment, there are two kinds of dependencies between various bundles: type dependency and service dependency.
Type dependency: A bundle may depend on a
type exported by another bundle thus creating a type dependency. Type
dependencies are managed through Import-Package
and
Export-Package
directives in the OSGi manifest. This
kind of dependency is similar to a JAR file using types in other JAR files
from the classpath. However, as we’ve seen earlier, there are
significant differences.
Service dependency: A bundle may also publish services (preferably using Spring-DM), and other bundles may consume those services. If two bundles depend on the same service, both will be communicating effectively to the same object. More specifically, any state for that service will be shared between all the clients of that service. This kind of arrangement is similar to the commonly seen client-server interaction through mechanisms such as RMI or Web Services.