Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-10885

Make Groovy Extensions work in an OSGi environment

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • groovy-runtime
    • None

    Description

      The current setup for loading in ExtensionModule's does not support groovy extensions correctly in OSGi (tested in Apache Felix).

      The reason is that the MetaClassRegistryImpl creates an ExtensionModuleScanner, which scan's the classloader for every jar file with an ExtensionModule properties file. In an OSGi environment, the classloader does not have access to every jar file (bundle) by default.

      I have created an example of an OSGi compatible implementation, using a BundleListener to listen for the addition of a Bundle to the OSGi environment, and then use this to get a ClassLoader for this Bundle to load the ExtensionModule properties file of that Bundle: Activator

      Open questions:

      • What to do when a Bundle gets reloaded / removed, in an OSGi environment this can be done at runtime but I don't see any methods available in the MetaClassRegistry / CachedClass to remove MetaMethods
      • Where is this code best hosted? Is it ok to make a new subproject named groovy-osgi that contains the code to make this work, or does Groovy not see this relevant in the groovy git project?

      Attachments

        Activity

          People

            Unassigned Unassigned
            royteeuwen Roy Teeuwen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: