Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Runtime surgery


Published on

Slides to eclipse summit europe 2010 talk runtime surgery (

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Runtime surgery

  1. 1. Runtime Surgery New ways to integrate softwarecomponents with eclipse equinox Tobias Jenkner (edmPRO)
  2. 2. Surgery - who are the patients ●Eclipse Runtime – equinox ●Osgi: Reuse existing software components ➔Patients: existing osgi bundles we want to reuse
  3. 3. Reuse bundles: Customize Plugin to be reused Java and OSGI access restrictions InitializationCustomize No public interface Plugin to be reused Java and OSGI access restrictions Security
  4. 4. Reuse bundles: Separation of concerns Client Common Server Log API RCP ... Menu-Entry Global UI Software-Updates Log impl RCP ... Change Window View 1 Title Log config RCP ... RCP View 1 View 2
  5. 5. Summary:Reuse bundles✗ Separation of concerns✗ Interfaces available➔ Write a component once run everywhere● Separation of concerns only in the context ofthe original development (A single OSGI Bundle contains GUI,configuration, business logic, …)● Customization not possible (API not available)● Write once break everywhere else
  6. 6. Integration – existing bundles
  7. 7. Integration options●Enhancement request to the vendor / project●Branch existing sourcecode●Modify code at runtime with eclipse equinoxframework extensions
  8. 8. Eclipse equinoxApplication of the patches at loadtime. Eclipse PluginEquinox transforms xslt● plugin.xmlEquinox weaving aspectj● bytecode
  9. 9. Equinox transforms xsltChange existing eclipse RCP extensions:●Remove, relocate, restrict visibility of toolbar andmenu entries<xsl:stylesheet version="1.0" xmlns:xsl=""> <!-- suppress the menuContribution for the command org.eclipse.equinox.p2.ui.sdk.install --> <xsl:template match="extension[@point=org.eclipse.ui.menus]/ MenuContribution/ command[@commandId= org.eclipse.equinox.p2.ui.sdk.install]"> </xsl:template> ...
  10. 10. Equinox weaving aspectjUse aspectj around advice to suppress methodcalls●Set window titlepointcut setTitle() :call(void org.eclipse.swt.widgets.Shell.setText(String));void around() : setTitle() { // without proceed() - suppress the method call}
  11. 11. Equinox weaving aspectj ●Access internals from existing bundles in order to customize existing functionality ● AJDT, ScalaDT JDT CompilationUnit around(PackageFragment parent, String name, WorkingCopyOwner owner) : compilationUnitCreations(parent, name, owner) { String newName = trimName(name); String extension = findExtension(newName); ICompilationUnitProvider provider = CompilationUnitProviderRegistry.getInstance().getProvider(extension); if (provider != null) { try { return provider.create(parent, newName, owner); } catch (Throwable t) { JDTWeavingPlugin.logException(t); } } return proceed(parent, name, owner); }
  12. 12. Use case summaryWeaving:●Customize and extend existing functionality(without API)●Suppress method callsTransforms:●Cleanup Menus / UIBoth:●Enforce integration specific codingguidelines. Forbid usage of available APIs (e.g.set window title).
  13. 13. Drawbacks●Equinox waeving: Coping with internals /breaking up information hidingDoing the job of the vendor / project●
  14. 14. ConclusionModify complete bundles at runtime:●Declarative XML●Java bytecode
  15. 15. What do you think?● Useful ?● Risk ?● Production ?● Responsibility ?● ...