[shrinkwrap-issues] [JBoss JIRA] Issue Comment Edited: (SHRINKWRAP-242) Get shrinkwrap to work from inside an OSGi framework

David Bosschaert (JIRA) jira-events at lists.jboss.org
Wed Mar 30 04:15:38 EDT 2011


    [ https://issues.jboss.org/browse/SHRINKWRAP-242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592607#comment-12592607 ] 

David Bosschaert edited comment on SHRINKWRAP-242 at 3/30/11 4:13 AM:
----------------------------------------------------------------------

Just thinking a little more about the OSGi and JBoss-modules use-cases...

While all of the above seems fine - there is a missing part IMHO. If you're in OSGi or in JBoss modules, it's still kinda hard to find out what the classloader is that you need to pass in. In the simple case its the classloader that loads the sw-impl-base module but how you find that classloader is non-trivial (I think). Therefore I would recommend that in addition to what you did, you register the ArchiveFactory as a service, either in MSC, in OSGi, or in both. This means that someone who wants to use SW from such an environment doesn't need to do any crazy stuff to find the appropriate classloader. The ArchiveFactory instance is just there. It also means that the user doesn't need to declare a hard dependency on the impl-base module.

You can do this in a way that doesn't hamper anyone else...
* For OSGi you simply add a bundle activator that registers the instance
* For JBoss-modules/msc you add a service activator that registers the instance
Ideally you would do both :)

The nice thing is that if you're running outside of any of these the activators are ignored...
If you need any help with this I would be happy to assist...

      was (Author: bosschaert):
    Just thinking a little more about the OSGi and JBoss-modules use-cases...

While all of the above seems fine - there is a missing part IMHO. If you're in OSGi or in JBoss modules, it's still kinda hard to find out what the classloader is that you need to pass in. In the simple case its the classloader that loads the sw-impl-base module but how you find that classloader is non-trivial (I think). Therefore I would recommend that in addition to what you did, you register the ArchiveFactory as a service, either in MSC, in OSGi, or in both. This means that someone who wants to use SW from such an environment doesn't need to do any crazy stuff to find the appropriate classloader. The ArchiveFactory instance is just there. It also means that the user doesn't need to declare a hard dependency on the impl-base module.

You can do this in a way that doesn't hamper anyone else...
* For OSGi you simply add a bundle activator that registers the instance
* For JBoss-modules/msc you add a service activator
Ideally you would do both :)

The nice thing is that if you're running outside of any of these the activators are ignored...
If you need any help with this I would be happy to assist...
  
> Get shrinkwrap to work from inside an OSGi framework
> ----------------------------------------------------
>
>                 Key: SHRINKWRAP-242
>                 URL: https://issues.jboss.org/browse/SHRINKWRAP-242
>             Project: ShrinkWrap
>          Issue Type: Task
>    Affects Versions: 1.0.0-alpha-11
>            Reporter: David Bosschaert
>            Assignee: David Bosschaert
>            Priority: Critical
>             Fix For: 1.0.0-beta-1
>
>
> Currently there are issues around the use of Shrinkwrap in an OSGi framework. The libraries don't contain the necessary Manifest headers and just adding them causes classloading problems as the TCCL is used during the boot process.
> Shrinkwrap should be usable from within OSGi.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the shrinkwrap-issues mailing list