<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7892137512351952975</id><updated>2012-01-03T22:22:21.928+01:00</updated><category term='Aptana'/><category term='OSGi'/><category term='Mustache'/><category term='ZK'/><title type='text'>My zomgkthxlol blog</title><subtitle type='html'>Web Apps and so forth..</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://bundle-exception.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7892137512351952975/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://bundle-exception.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Cal</name><uri>http://www.blogger.com/profile/12312296747731726559</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/-9cOYwkjKMdU/TwNxVrodA4I/AAAAAAAAAGQ/6fIimzRDZwY/s220/moim2.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7892137512351952975.post-582772309566877302</id><published>2010-12-31T15:23:00.003+01:00</published><updated>2010-12-31T15:30:40.189+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Mustache'/><category scheme='http://www.blogger.com/atom/ns#' term='Aptana'/><title type='text'>Mustache ruble for Aptana Studio 3</title><content type='html'>If you use Mustache for templating and Aptana Studio 3, here is a ruble i made for adding time-saving snippets :&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="https://github.com/Placoplatr/mustache.ruble"&gt;https://github.com/Placoplatr/mustache.ruble&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7892137512351952975-582772309566877302?l=bundle-exception.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bundle-exception.blogspot.com/feeds/582772309566877302/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bundle-exception.blogspot.com/2010/12/mustache-ruble-for-aptana-studio-3.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7892137512351952975/posts/default/582772309566877302'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7892137512351952975/posts/default/582772309566877302'/><link rel='alternate' type='text/html' href='http://bundle-exception.blogspot.com/2010/12/mustache-ruble-for-aptana-studio-3.html' title='Mustache ruble for Aptana Studio 3'/><author><name>Cal</name><uri>http://www.blogger.com/profile/12312296747731726559</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/-9cOYwkjKMdU/TwNxVrodA4I/AAAAAAAAAGQ/6fIimzRDZwY/s220/moim2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7892137512351952975.post-4025100818846373335</id><published>2009-08-13T10:55:00.002+02:00</published><updated>2009-08-13T11:15:39.993+02:00</updated><title type='text'>ZK on OSGi - Unique ZK bundle</title><content type='html'>A user from the zk forum, galdasc, pointed out a way to create a unique ZK bundle working flawlessly with the osgi classloader. Here's the recipe :&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Copy all zk jars needed in a bundle&lt;/li&gt;&lt;li&gt;Add them in the &lt;span style="font-style: italic;"&gt;Bundle-Classpath&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Copy &lt;span id="z_np_m6" class="commentBody"&gt;all the &lt;span style="font-style: italic;"&gt;Export-Package&lt;/span&gt; and&lt;span style="font-style: italic;"&gt; Import-Package&lt;/span&gt; statements from each bundelized zk jar given by the bnd tool (previous post) or by the eclipse method.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;Unfortunately there is no way of doing this automatically. I'm going to provide such a bundle soon.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7892137512351952975-4025100818846373335?l=bundle-exception.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bundle-exception.blogspot.com/feeds/4025100818846373335/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bundle-exception.blogspot.com/2009/08/zk-on-osgi-unique-zk-bundle.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7892137512351952975/posts/default/4025100818846373335'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7892137512351952975/posts/default/4025100818846373335'/><link rel='alternate' type='text/html' href='http://bundle-exception.blogspot.com/2009/08/zk-on-osgi-unique-zk-bundle.html' title='ZK on OSGi - Unique ZK bundle'/><author><name>Cal</name><uri>http://www.blogger.com/profile/12312296747731726559</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/-9cOYwkjKMdU/TwNxVrodA4I/AAAAAAAAAGQ/6fIimzRDZwY/s220/moim2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7892137512351952975.post-3279869083178919660</id><published>2009-07-07T11:21:00.069+02:00</published><updated>2009-07-20T10:56:48.914+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OSGi'/><category scheme='http://www.blogger.com/atom/ns#' term='ZK'/><title type='text'>ZK on OSGi - Dynamic &amp; Asynchronous Richlets</title><content type='html'>After some days struggling I finally managed to integrate &lt;a href="http://www.zkoss.org/"&gt;ZK&lt;/a&gt;, which allow you to easily build rich webapps, with the &lt;a href="http://www.osgi.org/"&gt;OSGi&lt;/a&gt; framework. This combination allow to dynamically register .zul files or Richlets and most interestingly, to update UI components asynchonously from OSGi bundles or events.&lt;br /&gt;We will see in this post how to bundelize zk libs, how to configure and start zk engines, how to register zul files or richlets and finally how to update a richlet through a java method accessible in OSGi.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Bundelization of ZK jars&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The first step is to make all zk jars suitable for OSGi environment by editing their manifest file. Thanks to the bnd tool, this tasks is pretty straightforward. I've written an ant script to do the job. Just put in a directory each zk jar you want to bundelize, the bnd jar, an optional bnd file (for setting manifest properties like Bundle-Version), the following ant script and launch "ant" in a console.&lt;br /&gt;&lt;pre class="brush: xml"&gt;&lt;br /&gt;&amp;lt;project name="ZK OSGi Multi Bundles" default="all" basedir="."&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;property name="bundle.version" value="3.6.2"/&amp;gt;&lt;br /&gt;  &amp;lt;property name="bundle.base" value="org.zkoss.zk.osgi"/&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;target name="bnd"&amp;gt;&lt;br /&gt;    &amp;lt;taskdef resource="aQute/bnd/ant/taskdef.properties"&lt;br /&gt;                classpath="bnd/bnd-0.0.337.jar"/&amp;gt;&lt;br /&gt;    &amp;lt;bndwrap&lt;br /&gt;      jars="bsh.jar,commons-collections.jar,commons-fileupload.jar,commons-io.jar,&lt;br /&gt;           commons-logging.jar,jasperreports.jar,zcommon.jar,zcommons-el.jar,zk.jar,&lt;br /&gt;           zhtml.jar,zkex.jar,zkmax.jar, zkplus.jar,zml.jar,zul.jar,zweb.jar"&lt;br /&gt;      classpath=""&lt;br /&gt;      output="."/&amp;gt;&lt;br /&gt;      &amp;lt;!--output="./output/${bundle.base}.*-${bundle.version}.jar"--&amp;gt;&lt;br /&gt;  &amp;lt;/target&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;target name="deploy"&amp;gt;&lt;br /&gt;    &amp;lt;move todir="output"&amp;gt;&lt;br /&gt;      &amp;lt;fileset dir="."&amp;gt;&lt;br /&gt;        &amp;lt;include name="*.bar"/&amp;gt;&lt;br /&gt;      &amp;lt;/fileset&amp;gt;&lt;br /&gt;      &amp;lt;mapper type="glob" from="*.bar" to="${bundle.base}.*-${bundle.version}.jar"/&amp;gt;&lt;br /&gt;    &amp;lt;/move&amp;gt;&lt;br /&gt;  &amp;lt;/target&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;target name="all" depends="bnd, deploy"/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/project&amp;gt;&lt;br /&gt;&lt;/pre&gt;A maven pom would certainly be more handy as it will download the jars and manage bundle name / version easily but the first solution satisfied me so i didn't bother make a second one.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Configure and launch ZK engine&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The Zk &lt;a href="http://docs.zkoss.org/wiki/Basic_concepts#Architecture_Overview"&gt;architecture&lt;/a&gt; is constituted by two servlets, named zkLoader and auEngine in the docs. Integrate Zk on OSGi  is as simple as register servlets with an osgi http service. However these servlets require specific URI mapping which can't be set with a basic implementation of the http service.  Hopefully the &lt;a href="http://wiki.ops4j.org/display/paxweb/Pax+Web"&gt;Pax Web&lt;/a&gt;  implementation extends the http service with such functionalities.&lt;br /&gt;&lt;br /&gt;Here follow the code to configure and register Zk engine servlets with Pax Web.&lt;br /&gt;&lt;pre class="brush: java"&gt;&lt;br /&gt;//Get Pax Web http service&lt;br /&gt;ServiceReference ref = context.getServiceReference("org.ops4j.pax.web.service.WebContainer");&lt;br /&gt;if(ref == null) return;&lt;br /&gt;http = (WebContainer)context.getService(ref);&lt;br /&gt;if(http == null) return;&lt;br /&gt;&lt;br /&gt;//Configure zkLoader servlet&lt;br /&gt;DHtmlLayoutServlet zkLoader = new DHtmlLayoutServlet();  //Class of the zkLoader servlet&lt;br /&gt;Hashtable&amp;lt;String, String&amp;gt; loader_initparam = new Hashtable&amp;lt;String, String&amp;gt;();  //set init parameters&lt;br /&gt;loader_initparam.put("servlet-name", "zkLoader");&lt;br /&gt;loader_initparam.put("update-uri", "/zkau");     //URI mapped to auEngine&lt;br /&gt;String loader_mapping[] = {"*.zul", "*.zhtml"};  //mapping of UI files&lt;br /&gt;&lt;br /&gt;//Configure auEngine servlet&lt;br /&gt;DHtmlUpdateServlet auEngine = new DHtmlUpdateServlet();&lt;br /&gt;Hashtable&amp;lt;String, String&amp;gt; engine_initparam = new Hashtable&amp;lt;String, String&amp;gt;();&lt;br /&gt;engine_initparam.put("servlet-name", "auEngine");&lt;br /&gt;String engine_mapping[] = {"/zkau/*"};  //same URI as the parameter "update-uri" of zkLoader&lt;br /&gt;&lt;br /&gt;//Get the http context (zk servlets should be registered with the same http context)&lt;br /&gt;HttpContext ctx = http.createDefaultHttpContext();&lt;br /&gt;&lt;br /&gt;//Register zk session listener&lt;br /&gt;http.registerEventListener(new HttpSessionListener(), ctx);&lt;br /&gt;&lt;br /&gt;//Register zk servlets&lt;br /&gt;http.registerServlet(zkLoader, loader_mapping, loader_initparam, ctx);&lt;br /&gt;http.registerServlet(auEngine, engine_mapping, engine_initparam, ctx);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Note: Launching ZK servlets from those newly ZK bundles run flawlessly but cause http requests to abort :&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://img230.imageshack.us/img230/7159/httperrorwithzkbundles.png"&gt;&lt;img style="cursor: pointer; width: 732px; height: 211px;" src="http://img230.imageshack.us/img230/7159/httperrorwithzkbundles.png" alt="" border="0" /&gt;&lt;/a&gt; &lt;/div&gt;&lt;br /&gt;This is due to a natural incompatibility between the ZK config file loader (which load metainfo files inside zk jars) and the OSGi ClassLoaders.&lt;br /&gt;&lt;br /&gt;I've tried to wrap a unique ZK bundle and merge metainfo config files but this attempt was unsuccessful. The only workaround I found is to include zk jars in the bundle which register servlets. Anyway ZK api bundles are still useful for other bundles implementing Richlets.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Hello World zul&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A .zul or .zhtml file can be registered using the registerRessource() method from the http service.&lt;br /&gt;Create a directory "rsc" in your project and add a hello.zul file :&lt;br /&gt;&lt;pre class="brush: xml"&gt;&lt;br /&gt;&amp;lt;window title="OMG a ZK Window !" border="normal" width="210px"&amp;gt;&lt;br /&gt;    Hello from OSGi .zul ressource !&lt;br /&gt;&amp;lt;/window&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;Then register it :&lt;br /&gt;&lt;pre class="brush: java"&gt;&lt;br /&gt;http.registerResources("/", "/rsc", ctx);&lt;br /&gt;&lt;/pre&gt;Don't forget to include this resource and zk jars (unfortunately) in the manifest. With bnd it can looks like :&lt;br /&gt;&lt;pre class="brush: java"&gt;Include-Resource: lib/bsh.jar=./lib/zk/bsh.jar, \&lt;br /&gt;    ...&lt;br /&gt;    lib/zweb.jar=./lib/zk/zweb.jar, \&lt;br /&gt;    rsc/hello.zul = ./rsc/hello.zul&lt;br /&gt;&lt;br /&gt;Bundle-ClassPath: .,\&lt;br /&gt;    lib/bsh.jar, \&lt;br /&gt;    ...&lt;br /&gt;    lib/zweb.jar&lt;br /&gt;&lt;/pre&gt;It works !&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://img38.imageshack.us/img38/6003/zkzulhellowindow.png"&gt;&lt;img style="cursor: pointer; width: 591px; height: 212px;" src="http://img38.imageshack.us/img38/6003/zkzulhellowindow.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;This method to register zul files over OSGi don't seems to be more dynamic than with a classical web container. Even if it is possible to re-register the resource folder, a better solution to achieve dynamism would be to use Richlets.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Hello World richlet&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Add a new class extending GenericRichlet in your project :&lt;br /&gt;&lt;pre class="brush: java"&gt;public class HelloRichlet extends GenericRichlet {&lt;br /&gt;&lt;br /&gt;@Override&lt;br /&gt;public void service(Page page) {&lt;br /&gt;    page.setTitle("Richlet from OSGi");&lt;br /&gt;&lt;br /&gt;    Window window = new Window("OMG a ZK Window !", "normal", false);&lt;br /&gt; &lt;br /&gt;    label = new Label("Hello from OSGi !!");&lt;br /&gt;    label.setParent(window);&lt;br /&gt;&lt;br /&gt;    window.setWidth("230px");&lt;br /&gt;    window.setPage(page);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;Then you can register it using the zk api :&lt;br /&gt;&lt;pre class="brush: java"&gt;//Get the configuration&lt;br /&gt;Configuration config = WebManager.getWebManager(zkLoader.getServletContext()).getWebApp().getConfiguration();&lt;br /&gt;&lt;br /&gt;//Register Richlet&lt;br /&gt;config.addRichlet("hello", HelloRichlet.class.getName(), null);&lt;br /&gt;config.addRichletMapping("hello", "/hello");&lt;/pre&gt;In order to tell Zk to parse this configuration when the user requests the richlet, add "/*" in the URI mapping of zkLoader :&lt;br /&gt;&lt;pre class="brush: java"&gt;String loader_mapping[] = {"*.zul", "*.zhtml", "/*"};  //mapping of UI files&lt;/pre&gt;Now you can access the richlet in &lt;span style="font-style: italic;"&gt;http://localhost:8080/hello&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://img12.imageshack.us/img12/1646/zkrichlethellowindow.png"&gt;&lt;img style="cursor: pointer; width: 568px; height: 197px;" src="http://img12.imageshack.us/img12/1646/zkrichlethellowindow.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Asynchronous UI modification from OSGi&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now that we're able to register Richlets on OSGi, we are going to modify them at runtime without using ZK event listeners. Of course it is still possible to use them, but the idea is to update components asynchronously from java methods. There are few things to do :&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Activate the server push functionality (Comet)&lt;/li&gt;&lt;li&gt;Create a waiting thread which will update the component&lt;/li&gt;&lt;li&gt;Start this thread when the richlet is requested&lt;/li&gt;&lt;li&gt;Add the update method in the richlet which will notify the thread&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;To enable Comet in Ajax compliant browsers add the following line when configuring Zk.&lt;br /&gt;&lt;pre class="brush: java"&gt;//Enable server push with the zk Comet implementation&lt;br /&gt;Devices.setServerPushClass("ajax", CometServerPush.class);&lt;/pre&gt;Here is an example of the thread class, updating a label :&lt;br /&gt;&lt;pre class="brush: java"&gt;/**&lt;br /&gt;* Thread waiting for an update. It has to be launched in a zk richlet.&lt;br /&gt;*/&lt;br /&gt;public class LabelAsynchronousUpdate extends Thread {&lt;br /&gt;&lt;br /&gt;private Label label;&lt;br /&gt;private Desktop desktop;&lt;br /&gt;private ArrayBlockingQueue&amp;lt;String&amp;gt; text;  //used to notify the thread and give the argument&lt;br /&gt;&lt;br /&gt;public LabelAsynchronousUpdate(Label label) {&lt;br /&gt;    this.label = label;&lt;br /&gt;    this.desktop = label.getDesktop();&lt;br /&gt;    this.text = new ArrayBlockingQueue&amp;lt;String&amp;gt;(1);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* Call to update the label.&lt;br /&gt;* The thread will be notified through the BloquingQueue.&lt;br /&gt;*/&lt;br /&gt;public void updateLabel(String text) {&lt;br /&gt;    try {&lt;br /&gt;         this.text.put(text); //Add the text object in the blocking queue&lt;br /&gt;    } catch (InterruptedException e) {&lt;br /&gt;         Thread.currentThread().interrupt();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void run() {&lt;br /&gt;    while (true) {&lt;br /&gt;        if (!desktop.isServerPushEnabled())&lt;br /&gt;            desktop.enableServerPush(true);&lt;br /&gt;&lt;br /&gt;        try { &lt;br /&gt;            //Wait for text message to appear in the queue&lt;br /&gt;            String message = text.take(); //take and remove from queue&lt;br /&gt;&lt;br /&gt;            Executions.activate(desktop); //active the desktop for server-push&lt;br /&gt;            try {&lt;br /&gt;                label.setValue(message);  //update&lt;br /&gt;            } finally {&lt;br /&gt;                Executions.deactivate(desktop);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        catch (InterruptedException ex) {&lt;br /&gt;            Thread.currentThread().interrupt();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;}&lt;/pre&gt;Finally update the hello richlet :&lt;br /&gt;&lt;pre class="brush: java"&gt;public class HelloRichlet extends GenericRichlet {&lt;br /&gt;&lt;br /&gt;private Label label;&lt;br /&gt;private LabelAsynchronousUpdate labelupdate;&lt;br /&gt;&lt;br /&gt;@Override&lt;br /&gt;public void service(Page page) {&lt;br /&gt;    page.setTitle("Richlet from OSGi");&lt;br /&gt;&lt;br /&gt;    //Enable Comet&lt;br /&gt;    page.getDesktop().enableServerPush(true);&lt;br /&gt;&lt;br /&gt;    Window window = new Window("OMG a ZK Window !", "normal", false);&lt;br /&gt;&lt;br /&gt;    label = new Label("Hello from OSGi !!");&lt;br /&gt;    label.setParent(window);&lt;br /&gt;&lt;br /&gt;    window.setWidth("230px");&lt;br /&gt;    window.setPage(page);&lt;br /&gt;&lt;br /&gt;    //Create and launch an updating thread. It needs to be launched from the richlet&lt;br /&gt;    //in order to let zk hold the connection&lt;br /&gt;    this.labelupdate = new LabelAsynchronousUpdate(label);&lt;br /&gt;    this.labelupdate.start();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* Change the label asynchronously.&lt;br /&gt;*/&lt;br /&gt;public void changeLabel(String message) {&lt;br /&gt;    if (labelupdate != null)&lt;br /&gt;        this.labelupdate.updateLabel(message);&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;In order to test you have to get the instance of the richlet from the Configuration object, and call the changeLabel() method.&lt;br /&gt;&lt;pre class="brush: java"&gt;Thread.sleep(10000);  //test 10 sec after bundle start&lt;br /&gt;&lt;br /&gt;HelloRichlet hr = (HelloRichlet) config.getRichlet("hello");&lt;br /&gt;if (hr != null)&lt;br /&gt;hr.changeLabel("OMFG ! This label is updatable asynchronously from OSGi !");&lt;/pre&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://img142.imageshack.us/img142/6281/zkasyncrichlethellowind.png"&gt;&lt;img style="cursor: pointer; width: 571px; height: 219px;" src="http://img142.imageshack.us/img142/6281/zkasyncrichlethellowind.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Conclusion&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Using ZK on OSGi allow to use the benefits of a service oriented architecture. It is easier to handle dynamism and easier to achieve modularity. For example we can imagine bundles exporting richlets as services and another bundle registering them dynamically.&lt;br /&gt;With the asynchronous modification it becomes easier to automatically represent a service through the web. If for instance we have some "light" or "temperature sensor" services, corresponding to real objects in a house, it would then be possible to handle asynchronous notification of state change and build a solid web interface.&lt;br /&gt;&lt;br /&gt;Download full source code &lt;a href="https://ligforge.imag.fr/docman/view.php/76/333/ZK+Dynamic+Osgi+HelloWorld.rar"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7892137512351952975-3279869083178919660?l=bundle-exception.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bundle-exception.blogspot.com/feeds/3279869083178919660/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bundle-exception.blogspot.com/2009/07/zk-on-osgi-dynamic-asynchronous.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7892137512351952975/posts/default/3279869083178919660'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7892137512351952975/posts/default/3279869083178919660'/><link rel='alternate' type='text/html' href='http://bundle-exception.blogspot.com/2009/07/zk-on-osgi-dynamic-asynchronous.html' title='ZK on OSGi - Dynamic &amp; Asynchronous Richlets'/><author><name>Cal</name><uri>http://www.blogger.com/profile/12312296747731726559</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/-9cOYwkjKMdU/TwNxVrodA4I/AAAAAAAAAGQ/6fIimzRDZwY/s220/moim2.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7892137512351952975.post-7524107795754011631</id><published>2009-07-04T13:33:00.008+02:00</published><updated>2009-07-07T19:17:40.308+02:00</updated><title type='text'>Hi</title><content type='html'>hi.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: java"&gt;&lt;br /&gt;public class TestHi extends Hi {&lt;br /&gt;&lt;br /&gt;   /**&lt;br /&gt;    * lalalala, hi&lt;br /&gt;    * @author me&lt;br /&gt;    */ &lt;br /&gt;   private Object hi;&lt;br /&gt; &lt;br /&gt;   //TODO&lt;br /&gt;   @Override&lt;br /&gt;   public void method(Arg arg) {&lt;br /&gt;       hi.setHi("hello");&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7892137512351952975-7524107795754011631?l=bundle-exception.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bundle-exception.blogspot.com/feeds/7524107795754011631/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bundle-exception.blogspot.com/2009/07/hi.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7892137512351952975/posts/default/7524107795754011631'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7892137512351952975/posts/default/7524107795754011631'/><link rel='alternate' type='text/html' href='http://bundle-exception.blogspot.com/2009/07/hi.html' title='Hi'/><author><name>Cal</name><uri>http://www.blogger.com/profile/12312296747731726559</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/-9cOYwkjKMdU/TwNxVrodA4I/AAAAAAAAAGQ/6fIimzRDZwY/s220/moim2.jpg'/></author><thr:total>0</thr:total></entry></feed>
