[ https://issues.apache.org/jira/browse/SLING-1007?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12721113#action_12721113 ]
Carsten Ziegeler commented on SLING-1007: ----------------------------------------- I'll start with the original issue and when we've finished that we can have a look at the other use case. > Implement helper classloader > ---------------------------- > > Key: SLING-1007 > URL: https://issues.apache.org/jira/browse/SLING-1007 > Project: Sling > Issue Type: New Feature > Components: Commons OSGi > Affects Versions: Commons OSGi 2.0.4 > Reporter: Felix Meschberger > Assignee: Carsten Ziegeler > > Currently we require the ScriptEngine[Factory] implementation bundles to > create bundle header > DynamicImport-Package: * > to be able to access anything from the scripts since scripts are executed in > the class loader of the script engine bundle. > The downside of running the scripts in the class loader of the script engine > bundle and using this global dynamic import are: > * scripts see internal classes of the script engine bundle > * scripts engine bundles must provide for classes for the scripts > * whenever a wire has been created for a script and the providing bundle is > updated or uninstalled, the script engine bundle is also cycled. > A better approach might be to provide a ClassLoader implementation which > behind the scenes manages access to packages exported by the bundles > installed in the system. I would imagine such an implementation along the > following lines: > * Uses PackageAdmin to find a bundle providing the required class > * Copes with bundles being updated or uninstalled > Maybe coping with bundles being updated or uninstalled requires a two level > approach: a fronend class loader which answers the class and resource > accesses by relaying to a backend class loader. The back end classloader does > the hardwork of loading classes and resources by querying bundles. Whenever a > bundle is updated or uninstalled the backend classloader gets replaced. A > similar approach has been chosen for the Repository ClassLoader in the > jcr/classloader bundle. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.