<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Times New Roman; font-size: 12pt; color: #000000'>Hi guys,<br><br>I've spent some time working on UI Plugins proof-of-concept (PoC) implementation, and thought I'd share my results with you. I've attached a patch that reflects the current progress. <br><br>The actual PoC implementation takes some inspiration from oVirt UI Plugins wiki page, and simplifies/streamlines/improves its main concepts. The goal is to have simple-to-use, yet flexible and robust plugin infrastructure. Major changes to the original design are outlined below.<br><br><strong>Each UI plugin runs within the context of an iframe, and therefore requires a </strong><span style="font-style: italic; font-weight: bold;">plugin source page</span><span style="font-weight: bold;"> that executes the actual plugin code.</span><br><ul><li>iframe is essentially the sandbox for each plugin. We can disable plugins by detaching their iframe elements from the main document during WebAdmin runtime. This also allows us to implement features such as <em>plugin safe mode</em> (no plugins loaded on WebAdmin startup).</li><li>Plugin source pages and WebAdmin host page share the same origin (protocol, domain, port), with plugin source pages being served through EngineManager application server (JBoss AS). This is to avoid cross-domain window/iframe communication issues, when the actual plugin code running in an iframe tries to register itself into WebAdmin main document's <span style="font-style: italic;">pluginApi</span> object.</li><li>There's a servlet designed to render plugin source page for all plugins (<span style="font-style: italic;">PluginSourcePageServlet</span>). For the given plugin, it detects its dependencies (3rd party JavaScript libraries) and configuration object (JSON data), reads the actual plugin code, and assembles everything into the resulting HTML page (to be evaluated by the plugin iframe).</li><li>iframe isolates plugin dependencies (3rd party JavaScript libraries) from other plugins and the main WebAdmin document. In practice, this means that plugin A can use jQuery 1.7 and plugin B can use jQuery 1.6 without the fear of any clashes.</li><li>Last but not least, writing plugins in Google Web Toolkit (GWT) should be as easy as providing your own plugin source page. Just deploy your GWT plugin application on JBoss AS (next to <span style="font-style: italic;">engine.ear</span>), and point to GWT plugin application host page.<br></li></ul><p>The current PoC declares a simple plugin that gets loaded using hard-coded values in <span style="font-style: italic;">PluginSourcePageServlet</span>. Actual plugin code registers the plugin into global <span style="font-style: italic;">pluginApi.plugins</span> object, with one sample event handler function (<span style="font-style: italic;">ActionButtonClick</span>). Just after that, the plugin reports in as ready by calling <span style="font-style: italic;">pluginApi.ready</span> function. This essentially puts the plugin into use within WebAdmin.<br></p><p><br></p>To simulate extension point (application event to be consumed by plugins), when the user clicks "New server" button on "Virtual Machines" main tab, <span style="font-style: italic;">ActionButtonClickEvent</span> gets fired through WebAdmin event bus. <span style="font-style: italic;">PluginEventHandler</span> receives this event and invokes <span style="font-style: italic;">ActionButtonClick</span> event handler function on all plugins.<br><p><br></p><p>(Note: for passing context objects from WebAdmin to plugin event handler functions, I'm planning to experiment with gwt-exporter project [1]. This would greatly simplify the way how WebAdmin exposes context-specific plugin API to event handler functions.)</p><p><br></p><p>As for the next step, I suggest to have some meeting (conference) to discuss the PoC in detail, and outline tasks for the near future. Also, please let me know what you think of the PoC so far.<br></p><br>Cheers,<br>Vojtech<br><br>[1] http://code.google.com/p/gwt-exporter/<p><br></p><p></p></div></body></html>