| Dain, OSGi is a Dependency Lookup father than Dependency Injection form of Inversion of control (running with the the common mistake that component assembly is what defines IoC, ignoring configuration etc). I think the industry long term future is in Dependency Injection, particularly CDI. That is for static languages like Java. Experience gleaned from the worlds of Ruby and Python is that component assembly issues are less of a problem there. I just don't like OSGi and think even the original Avalon (Stefano's baby from 1998 and onwards) has a better dependency lookup API. Anyway, In the NanoContainer project we've always been pushing to have hierarchies of components and containers that have class and implementation visibilities sorted out. PicoContainer does not provide any reflection-esque way of instantiating components. NanoContainer (as well as many other things) wraps PicoContainer and does do that. In the same timeline as this tread we wrote a tiny boot class that allows for components in a tree to not even see the classes for NanoContainer & Groovy (our preferred but not mandated composition language)... Primordial--| |--Boot | | |--Pico--|--Nano, Groovy, | ASM, CLI | | |--Common--| API |--Comp A | |--Comp B Comp A and B (in separate classloaders) can see Common-API, which can see the classloader that contains PicoContainer who's parent is the classes in rt.jar On a separate branch, is the Boot classloader (once main() is executed the thing plays no further part in the running of the 'machine'). It creates NanoContainer and all the associated libs it is going to use to create trees of comps, in one classloader giving it PicoContainer (etc) as its parent classloader. Anyway, it works well and allows us to implement separations. It also allows us to have say Component-B depend on Component-A provided the type A implemented was in the Common-API classloader or higher. Making this more complex is the need to depend on things not there at boot time. We've experimented with the notion of hot deployment (in MicroContainer as it happens), but we'll talk about the mechanics here (not sell another product). A hypothetical Kernel could be running is the same space as the Nano/Groovy thing, and hot deploy (via some user action or archive dropped into a dir) a component. The component could introduce a new thing for others to avail of. For example, the component could be DefaultSpellChecker and implement SpellChecker that it ships with. If the mechanism for delivering the component allows for a diff jar each for interface and implementaion, and the former was in some way marked, the Kernel could take it and allow it to join the classloader at Common-API level while mounting its implementation in a new classloader alongside Comp-A and Comp-B. This is a once off deal though. The interface itself, once mounted cannot be replaced in that classloader. So we gained late deploy and hot deploy via that. We also have re-hot-deploy sorted via the same mechanism, but not if the API changed. What clearly is not done via that mechanism is redeployment of a second or superseding version of the same interface. This is possible of course. Just it is pushed elsewhere I think. Bob McWhirter's and Jason van Zyl's ClassWorlds will do it. (directed/constrained graphs with selection package inheritance). Peter Donald has something inside Loom that does it too called ClassMan. With those and cunning use of some context during classloading, you should be able to lace things correctly. Stick with DI lads - it has a rosy future... Incidentally we aim with NanoContainer to deliver whole applications that leverage cherry picked components from projects (Geronimo, Spring, Jetty, Hibernate etc). Composed like so :- builder = NanoContainerBuilder() parent = builder.container(parent:parent,class:ImplementationHidingNanoPicoContainer) { classpathelement(path:"lib/api.jar") hidden() { classpathelement(path:"lib/a.jar") component(key:"A", class:"AImpl") } hidden() { classpathelement(path:"lib/b.jar") component(class:"BImpl") } } - Paul On Jun 16, 2005, at 2:00 PM, Dain Sundstrom wrote:
|
- Re: ClassLoader Architecture Paul Hammant
- Re: [picocontainer-dev] Re: ClassLoader Architecture Rickard Öberg
- Re: [picocontainer-dev] Re: ClassLoader Architectu... Jeremy Boynes
- Re: [picocontainer-dev] Re: ClassLoader Archit... Rickard Öberg
- Re: [picocontainer-dev] Re: ClassLoader Ar... Dain Sundstrom
- Re: ClassLoader Architecture Dain Sundstrom
