cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pier Fumagalli <>
Subject Re: Java components in blocks
Date Wed, 13 Apr 2005 15:08:47 GMT
On 13 Apr 2005, at 12:40, Reinhard Poetz wrote:
> Pier Fumagalli wrote:
>> Ok, here is where I don't agree...
>> By adding to blocks the capability of "bringing components" with 
>> them, we enter a quite big minefield, imposed by the restrictions of 
>> the Java VM. The complexity escalates at this point as now blocks 
>> must be aware of their class-loading mechanism, and the component 
>> manager must be aware of blocks and interfaces.
>> For example, classes and libraries included in an interface block 
>> must be loaded by the parent ClassLoader of the blocks using 
>> (implementing, extending, requiring) them to avoid 
>> ClassCastException(s).
>> So, alongside blocks and their deployment graph (block A extends B, 
>> implements C, ... blabla ...) we need to start keep tracking also the 
>> classes included in those blocks, and create a completely different 
>> tree based on the class loading structure that those represent.
>> And then you get into the minefield of versioning... If it's easy to 
>> determine that two versions of the same block can co-exist (by using 
>> two separate class loaders children of the same parent) without 
>> creating too many problems, what happens in the case of two 
>> interfaces with different versions? The class loading tree should (at 
>> this point) become very fine-grained and start building multiple 
>> class-loaders for multiple versions of the same interface, and then 
>> build as children of those class loaders for the individual blocks 
>> "using" them, ...
> Hmmm, are we really the first project tackling this? How did Eclipse 
> solved this?

I'm not saying that we are the first, nor that it can't be solved. I'm 
just saying that the concerns are separate: a block provides 
generators, transformers, serializers, ... to other blocks, but those 
are de-coupled from the real java components (if any) doing the job.

For example, a "mailprovider" implementation used for the block 
"sendmail" will have to provide a generator that accepts URI like 
"imap://user:password@server/folder/id", and generates a MimeDocument 
XML stream.

It doesn't matter to the block what components will be used to generate 
the XML, I can use a single component to do this job, or I can use a 
virtual component calling god knows what generator and a number of 
different transformers to achieve the same output, it doesn't matter to 
the block using the interface implementation.

And it shouldn't matter to the block deployment frameworks whether 
those components are written in Java or JavaScript or whatever... And 
neither it should matter what kind of Java ClassLoading components do 
require to be available to blocks, right?


View raw message