<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Let's start by explaining something about OSGi. When designing towards modularity there are two parts of OSGi that are important:</div><div>1) the classloading mechanism.&nbsp;</div><div>Bundles (modules) declare their requirements on other packages (imports) in a manifest file. Bundles can also export packages by declaring them in the manifest so that they become available to other bundles. When the OSGi container is started the resolver will check if all declared imports are available (exported by another bundle), if not, the bundle will not start. The resolver supports versions and ranges of version, and it's possible to have several versions of the same package installed. This mechanism makes sure that you will never get classnotfoundexceptions because the resolver checks if all requirements are fulfilled, and makes sure that implementation classes can simply be hidden by not exporting them; perfect for making sure others only use your public APIs. Also note that you never write the import headers yourself (this would be a lot of work), they should be calculated by tools (bnd) instead. Exports are defined yourself however.</div><div>This mechanism is similar to what JBoss Modules is doing; although it's doing a little more (which makes the resolver a little slower). Because startup speed is on the most important aspects of AS7 the resolver overhead during startup was not acceptable. I didn't see the numbers so I can judge on this, but I have seen many other very large applications that work fine (and start up A LOT quicker then Forge...)</div><div><br></div><div>Also note that just having separate classloaders doesn't give you real modularity yet, for that we need services...</div><div><br></div><div>2) dynamic services</div><div>A service is simply a class registered as a service; compare this to a class registered/picked up to the CDI bean manager. A service can be injected in other services, and in practice the model works very similar with other dependency injection solutions. Implementation code that should be available to others (using an API) should be published as a service; the client uses the service by it's API and simply injects the service. What makes services different from other dependency injection solutions is that they can be dynamically registered and de-registered; they can come and go during runtime. Of course this just happens randomly, there are good reasons to do this. For example, a bundle is re-installed (new version), or uninstalled. The services of this bundle will also become unavailable. Or you might pick up new configuration somewhere that should start new services for example.&nbsp;</div><div>What happens to clients of a service that is de-registered though? In most cases you would want to de-register the client (a service itself as well) as well. In other cases you might just switch to another service that publishes the same API, or just continue work without the service. This sounds way more complex than it is; you solve these things by simply configuring this in your dependency injection framework, and everything will be handled automatically.&nbsp;</div><div><br></div><div>So theoretically speaking, a Forge implementation in OSGi would require the following:</div><div>-Define all Forge APIs in one or more API bundles</div><div>-Implement the core as OSGi services.</div><div>-A plugin is also an OSGi service, and implements a plugin interface. They are registered "whiteboard style".</div><div>-A plugin injects core features by injecting OSGi services (remember, this is just DI similar as we do now)</div><div>-Plugins can be dynamically installed/de-installed/reloaded by simply reloading the bundle and registering the service</div><div><br></div><div>So yes, the architecture of Forge fits OSGi perfectly.</div><div><br></div><div>In my opinion OSGi is not too complex. The spec is large, but that is because it's a spec that is being used over 10 years now! It supports many corner cases, and if you would have to understand each corner case you could definitely say it's complex. You don't have to however, in most cases you really only deal with the basics and they are easy. Compare it to the CDI spec. The CDI spec has many tricky corner cases as well, but most users don't even know about those corner cases, and this is fine. If you would implement your own OSGi container you would have to deal with the complexity, but by just using OSGi you don't.</div><div><br></div><div>So should we start using OSGi? Well this is a difficult question... In my opinion we should have started that way, but it might be a little late for that. OSGi shouldn't be hacked on top of Forge, that's just going to bring more problems. Forge itself should be build in OSGi, but this will of course change things. The programming model would be very similar, but the exact APIs etc. would be considerably different. I'm not sure this is feasible at this point. &nbsp;</div><div><br></div><div>If you want to see the basics of programming in OSGi (with dynamic services etc.) take a look at this talk: <a href="http://parleys.com/#st=5&amp;id=3361&amp;sl=0">http://parleys.com/#st=5&amp;id=3361&amp;sl=0</a>. Skip to the part where I start coding :-)</div><div><br></div><div>Paul</div><div>&nbsp;</div><div><br></div><br><div><div>On Sep 25, 2012, at 2:23 , Dan Allen &lt;<a href="mailto:dan.j.allen@gmail.com">dan.j.allen@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">...which is pretty consistent with my point as well. It's too over-engineered (as are the arguments as to why it isn't) for low-level containers. But the need (to live in this world) is nothing a layer of abstraction can't satiate :)<br>

<br>-Dan<br><br>On Mon, Sep 24, 2012 at 6:13 PM, JFlower <span dir="ltr">&lt;<a href="mailto:fiorenzino@gmail.com" target="_blank">fiorenzino@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

i remember this post:<div><br></div><div><span style="line-height:20px;font-family:'Lucida Sans',Arial,Helvetica,sans-serif">I've rarely in my life met a more overengineered, overcomplex spec than OSGi. Compatibility with OSGi should be an anti-requirement in any sane world. <br>


Unfortunately we live in this world :-(</span></div><div><font face="Lucida Sans, Arial, Helvetica, sans-serif"><span style="line-height:20px"><br></span></font></div><div>Gavin King</div><div><br></div><div>[<a href="http://in.relation.to/22155.lace" target="_blank">http://in.relation.to/22155.lace</a>]</div>


<div><br></div><div>Fiorenzo</div><div><br></div><div>PS i never used osgi in my jee apps, and i hate my eclipse&nbsp;when i need to&nbsp;restart it after a&nbsp;plugin&nbsp;installation...</div><div><br><div class="gmail_quote">2012/9/25  <span dir="ltr">&lt;<a href="mailto:ggastald@redhat.com" target="_blank">ggastald@redhat.com</a>&gt;</span><br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
  

    
  
  <div bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    I've been done some thinking and researching for Forge 2.0 based on
    the last forge meeting we had and the current code in the 2.0
    branch, and it seems that the architecture we're looking for is very
    close to OSGi architecture itself (regarding to plugability and
    modularity). <br>
    <br>
    I'm also afraid that we'll face the same problems that OSGi tries to
    solve. As my current experience with OSGi is next to minimal (and
    probably to better understand why and have some arguments if someone
    asks me about it), I would like some opinions about the
    advantages/disadvantages of why not having the Forge container as an
    OSGi compliant solution. <br>
    <br>
    Also, don't get me wrong: I am not trying to convince anyone of
    using OSGi into the forge core, just want to understand better why
    this architecture is not a viable solution so far. I know Lincoln is
    against using it, but I just want some arguments in case someone
    asks me in conferences and stuff :)<br>
    <br>
    Of course, we need to keep using CDI and annotations as well. So if
    it's possible to have that and at the same time the modularity (and
    plugability) offered by OSGi, it would be awesome.<br>
    <br>
    Looking forward for your answers !<br>
    <br>
    Best Regards,<span><font color="#888888"><br>
    <br>
    -- <br>
    <div><b>George Gastaldi</b> | <i>Senior
        Software Engineer</i> <br>
      JBoss Forge Team<br>
      Red Hat<br>
    </div>
  </font></span></div>

<br></div></div>_______________________________________________<br>
forge-dev mailing list<br>
<a href="mailto:forge-dev@lists.jboss.org" target="_blank">forge-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/forge-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/forge-dev</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
forge-dev mailing list<br>
<a href="mailto:forge-dev@lists.jboss.org">forge-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/forge-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/forge-dev</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div>Dan Allen</div>Principal Software Engineer, Red Hat | Author of Seam in Action<br>Registered Linux User #231597<br><br><div><a href="http://google.com/profiles/dan.j.allen" target="_blank">http://google.com/profiles/dan.j.allen</a><br>

<a href="http://mojavelinux.com/" target="_blank">http://mojavelinux.com</a><br><a href="http://mojavelinux.com/seaminaction" target="_blank">http://mojavelinux.com/seaminaction</a><br></div><br>
_______________________________________________<br>forge-dev mailing list<br><a href="mailto:forge-dev@lists.jboss.org">forge-dev@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/forge-dev<br></blockquote></div><br></body></html>