On Saturday, Sep 20, 2003, at 10:03 Europe/Rome, Bertrand Delacretaz wrote:


Le Vendredi, 19 sep 2003, à 23:14 Europe/Zurich, Stefano Mazzocchi a écrit :


On Friday, Sep 19, 2003, at 19:31 Europe/Rome, Reinhard Poetz wrote:



From: Bertrand Delacretaz


Le Jeudi, 18 sep 2003, à 21:09 Europe/Zurich, Reinhard Poetz a écrit :

...I understand that I can't load a class from another block. My
question:
Is it possible to load classes from "Cocoon core" (whatever we will
consider as core) from within my block via "new" or are
there arguments
against it?...

I think loading classes directly via new (as opposed to factories + interfaces) should be discouraged as much as possible, as it creates unnecessary coupling.

Depending on the classloading mechanisms that are implemented,
selective filtering of what is allowed could be implemented easily I
think [1].

Do you have examples where direct instantation via "new" is required?

e.g. line 341 in the HTMLGenerator


   throw new ProcessingException("Exception in
HTMLGenerator.generate()",e);

(org.apache.cocoon.ProcessingException)

How can I do this in the generator in the future?

Of course!

Obviously - but still, do you want to let blocks access all public core classes openly?

Why not?


Event if it's no needed right away, I think being able to filter this classloading from blocks to core should be planned for in the design (but maybe it is already?).

The design doesn't need to specify this since it's a classloading implementation issue.


--
Stefano.



Reply via email to