Hi Herve, Blueprint or Spring DM mechanism which allows to proxified spring bean and refer them in OSGI service is a completely independant from the OSGI versioning and class loading resolution.
What you can do in bundle B is to use the <Require-Bundle> instructution pointing to BundleSymbolic-Name of wrapped bundles D1 and D2. In this case, you do not need to import those packages. Regards, Charles Moulliard Sr. Principal Solution Architect - FuseSource Apache Committer Blog : http://cmoulliard.blogspot.com Twitter : http://twitter.com/cmoulliard Linkedin : http://www.linkedin.com/in/charlesmoulliard Skype: cmoulliard On Fri, Apr 1, 2011 at 3:29 PM, Hervé BARRAULT <[email protected]> wrote: > Hi, > i'm asking a question about the dependency management and the publication of > OSGI services. > > Here a explanation of the situation : > > I have a bundle D1 exporting its packages (a wrapped JDBC driver). > > I have a bundle D2 exporting its packages (another wrapped JDBC driver). > > > I have a bundle DS : a datasource with the following spring file (here an > extract) : > > <bean id="datasource" class="org.apache.commons.dbcp.BasicDataSource" > destroy-method="close"> > <property name="driverClassName" value="${DB_DRIVER}"/> > <property name="url" value="${DB_URL}"/> > <property name="username" value="${DB_USER}"/> > <property name="password" value="${DB_PWD}"/> > <property name="poolPreparedStatements" value="true"/> > </bean> > <osgi:service id="my-ds" ref="datasource" interface="javax.sql.DataSource" > /> > > DS is importing packages from D1 AND D2 > <Import-Package>oracle.jdbc.driver;resolution:=optional, > com.microsoft.sqlserver;resolution:=optional, > org.apache.commons.dbcp, > javax.sql > </Import-Package> > > With these bundles all its ok. > > > And finally,I have my annoying Bundle B importing the datasource and using > it : > <osgi:reference id="my-ds" interface="javax.sql.DataSource" /> > > In bundle B, i import javax.sql.DataSource. > But i should also import packages exported by D1 and D2 otherwise i have an > exception when it's trying to create the driver (the class files are in D1 > or D2). > > I thought that the service will be exported with the needed dependencies. > > Is there a way to not declare import of D1 and D2 (in Bundle B) ? [I know > there is DynamicImport-Package but i would rather using it]. > Why an imported service is not coming with its own dependencies (is there a > way to do it)? > > Regards > Hervé >
