Trustin,
Below are the OSGi related entries generated for the mina-core and added
to jar's manifest.mf . Note the Export-Package and the Import-Package
entries. These two metadata entries along with the Bundle-SymbolicName,
and the Bundle-Version are used by the OSGi runtime to create a
classloader matrix that wires the Mina-Core bundle to its dependencies
and as a dependency for other bundles.
The mina-core bundle manifest below specifies to the OSGi runtime to
export of all the packages in mina-core to the outside world, import the
slf4j package and also import all the exported packages as well. The
latter may seem unwanted but in an OSGi runtime one may have multiple
mina-core bundles installed. To quote -Richard Hall, Apache Felix.
" Yes, that is intended because it allows those packages to be
substitutable with other providers. If your bundle only exported them,
then it would always get them from itself, even in cases where there was
another provider already in use. This would then limit interoperability,
because your bundle would not be able to interact with bundles using the
other provider's packages. You can explicitly tell the plugin to not
import an exported package if you do not want this behavior. "
Also notice the 'uses' attribute for the exported packages. The 'uses'
metadata gives additional hints for wiring the classloader matrix
between bundles. Perhaps you may find this metadata useful to you in
your refactoring the cyclic dependencies out of mina?
The OSGi classloader matrix offers a continuation of the same idea of
Java encapsulation taken to a package level -> private, default, public,
and now Export-Package. With OSGi we can encapsulate as much as
possible inside the module, exposing only as exportable the packages
with classes needed by our mina-core user bundles.
So the first thing you can help me with is to identify all the packages
that we should specify as private to the plugin. Meaning what packages
do we not want to offer to the outside world. These private packages
would contain internal classes that are only used within the mina-core.
In other words, internal classes are those that would never be inherited
or appear in a method signature by a class in a bundle other than the
mina-core.
============================================================================================
Bundle-Description MINA (Multipurpose Infrastructure for
Network Applications) is a network application framework which helps
users develop high performance and highly scalable network
applications easily.
Bundle-DocURL http://mina.apace.org/
Bundle-License http://www.apache.org/licenses/LICENSE-2.0
Bundle-ManifestVersion 2
Bundle-Name Apache MINA Core API
Bundle-SymbolicName mina-core
Bundle-Vendor Apache MINA Project
Bundle-Version 2.0.0.M1-SNAPSHOT
Created-By Bnd-0.0.107
Export-Package
org.apache.mina.transport.vmpipe;uses:="org.apache.mina.common.support,org.apache.mina.common,org.apache.mina.util,org.apache.mina.transport.vmpipe.support",
org.apache.mina.filter.executor;uses:="org.apache.mina.common,org.slf4j",
org.apache.mina.common;uses:="org.apache.mina.transport.vmpipe,org.apache.mina.common.support,org.apache.mina.util,org.apache.mina.transport.socket.nio",
org.apache.mina.transport.socket.nio.support;uses:="org.apache.mina.common.support,org.apache.mina.common,org.apache.mina.util,org.apache.mina.transport.socket.nio",
org.apache.mina.transport.socket.nio;uses:="org.apache.mina.common.support,org.apache.mina.common,org.apache.mina.util,org.apache.mina.transport.socket.nio.support",
org.apache.mina.handler.chain;uses:=org.apache.mina.common,
org.apache.mina.handler.multiton;uses:="org.apache.mina.common,org.apache.mina.util",
org.apache.mina.transport.vmpipe.support;uses:="org.apache.mina.transport.vmpipe,org.apache.mina.common.support,org.apache.mina.common,org.apache.mina.util",
org.apache.mina.handler.demux;uses:="org.apache.mina.common,org.apache.mina.util",
org.apache.mina.common.support;uses:="org.apache.mina.common,org.apache.mina.util,org.slf4j",
org.apache.mina.handler.support;uses:=org.apache.mina.common,
org.apache.mina.filter.codec.textline;uses:="org.apache.mina.common,org.apache.mina.util,org.apache.mina.filter.codec",
org.apache.mina.management;uses:=org.apache.mina.common,
org.apache.mina.filter.codec.support;uses:="org.apache.mina.common.support,org.apache.mina.common,org.apache.mina.filter.codec",
org.apache.mina.util;uses:="org.apache.mina.common,org.apache.mina.transport.socket.nio,org.slf4j",
org.apache.mina.filter;uses:="org.apache.mina.filter.executor,org.apache.mina.common,org.apache.mina.util,org.slf4j",
org.apache.mina.filter.codec.serialization;uses:="org.apache.mina.common,org.apache.mina.filter.codec",
org.apache.mina.filter.codec.demux;uses:="org.apache.mina.common,org.apache.mina.util,org.apache.mina.filter.codec",
org.apache.mina.filter.codec;uses:="org.apache.mina.common.support,org.apache.mina.common,org.apache.mina.filter.codec.support,org.apache.mina.util",
org.apache.mina.handler;uses:="org.apache.mina.handler.support,org.apache.mina.common,org.apache.mina.util"
Import-Package
org.apache.mina.common,
org.apache.mina.common.support,
org.apache.mina.filter,
org.apache.mina.filter.codec,
org.apache.mina.filter.codec.demux,
org.apache.mina.filter.codec.serialization,
org.apache.mina.filter.codec.support,
org.apache.mina.filter.codec.textline,
org.apache.mina.filter.executor,
org.apache.mina.handler,
org.apache.mina.handler.chain,
org.apache.mina.handler.demux,
org.apache.mina.handler.multiton,
org.apache.mina.handler.support,
org.apache.mina.management,
org.apache.mina.transport.socket.nio,
org.apache.mina.transport.socket.nio.support,
org.apache.mina.transport.vmpipe,
org.apache.mina.transport.vmpipe.support,
org.apache.mina.util,
org.slf4j
Include-Resource src/main/resources/
Manifest-Version 1
=======================================================================================
cheers,
John