Uploaded image for project: 'ShrinkWrap'
  1. ShrinkWrap
  2. SHRINKWRAP-242

Get shrinkwrap to work from inside an OSGi framework

    Details

    • Type: Task
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Done
    • Affects Version/s: 1.0.0-alpha-11
    • Fix Version/s: 1.0.0-beta-1
    • Component/s: None
    • Labels:
      None

      Description

      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.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            bosschaert David Bosschaert added a comment - - edited

            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...

            Show
            bosschaert David Bosschaert added a comment - - edited 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...
            Hide
            alrubinger Andrew Rubinger added a comment -

            Yup, I actually plan on installing the Domain (which has the ArchiveFactory and the Configuration both) as a service. Don't quite know how to do that yet, but I figure that's just details.

            Show
            alrubinger Andrew Rubinger added a comment - Yup, I actually plan on installing the Domain (which has the ArchiveFactory and the Configuration both) as a service. Don't quite know how to do that yet, but I figure that's just details.
            Hide
            bosschaert David Bosschaert added a comment -

            Great - can't wait to see it

            Show
            bosschaert David Bosschaert added a comment - Great - can't wait to see it
            Hide
            alrubinger Andrew Rubinger added a comment -

            Can you point me to an example of a simple OSGi harness I can use for testing to be sure things are working as expected?

            Show
            alrubinger Andrew Rubinger added a comment - Can you point me to an example of a simple OSGi harness I can use for testing to be sure things are working as expected?
            Hide
            bosschaert David Bosschaert added a comment -

            How about this one from the jboss-as smoke test suite:
            https://github.com/jbossas/jboss-as/blob/master/testsuite/smoke/src/test/java/org/jboss/as/test/embedded/osgi/SimpleArchiveProviderTestCase.java

            To run it, just go to jboss-as/testsuite/smoke and run 'mvn test'

            Show
            bosschaert David Bosschaert added a comment - How about this one from the jboss-as smoke test suite: https://github.com/jbossas/jboss-as/blob/master/testsuite/smoke/src/test/java/org/jboss/as/test/embedded/osgi/SimpleArchiveProviderTestCase.java To run it, just go to jboss-as/testsuite/smoke and run 'mvn test'

              People

              • Assignee:
                bosschaert David Bosschaert
                Reporter:
                bosschaert David Bosschaert
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Development