Re: Removing imports in bundles generated by Maven bundle plugin

2009-11-23 Thread Alan D. Cabrera


On Nov 23, 2009, at 10:23 AM, Stuart McCulloch wrote:


2009/11/24 Alan D. Cabrera 

When converting 3rd party jars it's my understanding that it's a  
good idea
that if it's a "leaf" jar, i.e. has no deps, then it should not  
import what

it exports.

It's not clear to me how I should configure the bundle plugin to do  
this.




the Bnd tool handles the manifest generation, see:

  http://aqute.biz/Code/Bnd#export-package

specifically the ";-noimport:=true" package attribute:

  Export-Package= org.foo.bar.*;-noimport:=true

alternatively you can use negated entries in Import-Package:

  Import-Package: !org.foo.bar, *


That's the ticket, ";-noimport:=true" !  Thanks!


Regards,
Alan



Re: Removing imports in bundles generated by Maven bundle plugin

2009-11-23 Thread Holger Hoffstätte
Alan D. Cabrera wrote:
> When converting 3rd party jars it's my understanding that it's a good  
> idea that if it's a "leaf" jar, i.e. has no deps, then it should not  
> import what it exports.

IMHO Peter explained it well:
http://www.osgi.org/blog/2007/04/importance-of-exporting-nd-importing.html

-h



Re: Removing imports in bundles generated by Maven bundle plugin

2009-11-23 Thread Stuart McCulloch
2009/11/24 Toni Menzel 

> Why exactly do you want to do this ?
> It is common (and good) practice to import what you export to the framework
> more options for wiring. You don't lose anything. Its also known as
> "package
> substitution".
>

FYI, every rule or "best-practice" has exceptions ;) in this case if you
have a library (ie. non-API) that you don't expect to ever have multiple
implementations, or you have tightly coupled packages then it might
make sense to avoid importing:


http://felix.apache.org/site/apache-felix-osgi-faq.html#ApacheFelixOSGiFAQ-Shouldabundleimportitsownexportedpackages%3F

to put it another way, occasionally you just want to disallow substitution.

If you really want to do this, you try add a Import-Package:
> !myexportpackage,*
> But you usually do not want to do this.
>
> On Mon, Nov 23, 2009 at 7:14 PM, Alan D. Cabrera  >wrote:
>
> > When converting 3rd party jars it's my understanding that it's a good
> idea
> > that if it's a "leaf" jar, i.e. has no deps, then it should not import
> what
> > it exports.
> >
> > It's not clear to me how I should configure the bundle plugin to do this.
> >
> >
> > Regards,
> > Alan
> >
> >
>
>
> --
> Toni Menzel
> Independent Software Developer
> Professional Profile: http://okidokiteam.com
> t...@okidokiteam.com
> http://www.ops4j.org - New Energy for OSS Communities - Open
> Participation Software.
>



-- 
Cheers, Stuart


Re: Removing imports in bundles generated by Maven bundle plugin

2009-11-23 Thread Toni Menzel
On Mon, Nov 23, 2009 at 7:23 PM, Stuart McCulloch  wrote:

> 2009/11/24 Alan D. Cabrera 
>
> > When converting 3rd party jars it's my understanding that it's a good
> idea
> > that if it's a "leaf" jar, i.e. has no deps, then it should not import
> what
> > it exports.
> >
> > It's not clear to me how I should configure the bundle plugin to do this.
> >
>
> the Bnd tool handles the manifest generation, see:
>
>   http://aqute.biz/Code/Bnd#export-package
>
> specifically the ";-noimport:=true" package attribute:
>
>   Export-Package= org.foo.bar.*;-noimport:=true
>

or so. thanks stuart.


>
> alternatively you can use negated entries in Import-Package:
>
>   Import-Package: !org.foo.bar, *
>
> HTH
>


>
> Regards,
> > Alan
> >
>
> --
> Cheers, Stuart
>



-- 
Toni Menzel
Independent Software Developer
Professional Profile: http://okidokiteam.com
t...@okidokiteam.com
http://www.ops4j.org - New Energy for OSS Communities - Open
Participation Software.


Re: Removing imports in bundles generated by Maven bundle plugin

2009-11-23 Thread Stuart McCulloch
2009/11/24 Alan D. Cabrera 

> When converting 3rd party jars it's my understanding that it's a good idea
> that if it's a "leaf" jar, i.e. has no deps, then it should not import what
> it exports.
>
> It's not clear to me how I should configure the bundle plugin to do this.
>

the Bnd tool handles the manifest generation, see:

   http://aqute.biz/Code/Bnd#export-package

specifically the ";-noimport:=true" package attribute:

   Export-Package= org.foo.bar.*;-noimport:=true

alternatively you can use negated entries in Import-Package:

   Import-Package: !org.foo.bar, *

HTH

Regards,
> Alan
>

-- 
Cheers, Stuart


Re: Removing imports in bundles generated by Maven bundle plugin

2009-11-23 Thread Toni Menzel
Why exactly do you want to do this ?
It is common (and good) practice to import what you export to the framework
more options for wiring. You don't lose anything. Its also known as "package
substitution".

If you really want to do this, you try add a Import-Package:
!myexportpackage,*
But you usually do not want to do this.

On Mon, Nov 23, 2009 at 7:14 PM, Alan D. Cabrera wrote:

> When converting 3rd party jars it's my understanding that it's a good idea
> that if it's a "leaf" jar, i.e. has no deps, then it should not import what
> it exports.
>
> It's not clear to me how I should configure the bundle plugin to do this.
>
>
> Regards,
> Alan
>
>


-- 
Toni Menzel
Independent Software Developer
Professional Profile: http://okidokiteam.com
t...@okidokiteam.com
http://www.ops4j.org - New Energy for OSS Communities - Open
Participation Software.


Removing imports in bundles generated by Maven bundle plugin

2009-11-23 Thread Alan D. Cabrera
When converting 3rd party jars it's my understanding that it's a good  
idea that if it's a "leaf" jar, i.e. has no deps, then it should not  
import what it exports.


It's not clear to me how I should configure the bundle plugin to do  
this.



Regards,
Alan