cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grzegorz Kossakowski <>
Subject Re: How to get Avalon Component from Bean?
Date Sun, 25 Feb 2007 10:15:57 GMT
Dev at weitling napisaƂ(a):
> Hi Grzegorz,
> if I don't have to reinvent the wheel I stop chiseling quadratic stones :-)
> Yes, there is lazy loading of dependent SQL tables, handled in the form
> as nested repeaters. Any class loading my SQL data should use a
> preconfigured (Avalon) component for the DB connection - but how to get
> access from a simple bean? Is there an interface I could implement to
> get the appropriate ServiceManager? (within flowscript it's easy because
> the cocoon object is available)
> I would like to XMLify as much as possible but there is some special
> update logic necessary. And I don't catch it all how to use
> SQLTransformer in a binding for load and save.
I think the only way to obtain ServiceManager is implementing 
Serviceable interface but it will only work if your POJO is component 
and is managed as component, but it's not the case for binding. So I 
think it's possible to do this way.
>> I think binding code tries to find out which values were changed and
> bind only if something was changed. That should explain why get is called.
> Cocoon is too often like a black box. We too often rely on assumptions.
Maybe I was not firm enough, I'm sure it works this way, see doSave():
> What about discussing the value of documentation at the next
> GetTogether...? The whol eproject and its spreading would win with a
> precise and stringent docu.
Granted, it should not be that you have to look deep into Cocoon's code 
to understand some simple common behaviors. I agree that it should be 
documented, others agree too but the lack of motivation/time is really 
our problem here.
Say only about me, I'm still planning to write quite big tutorial about 
Flowscript+Cforms+Templates trio, but first I would like to finish some 
changes of Cocoon's core that I work on. You can demand it in a month 
and a half :-)
> To be more precise:
> Example 1)
> My form just has one textfield "mytext", my java bean reads and writes
> this value from/to a file. When I want to get this file via cocoon: or
> context: protocol I need the Cocoon object.
Why don't you read from cocoon: or context: all necessary values before 
binding anything? Do you want to achieve lazy loading for xml files 
generated by Cocoon pipelines? If so, it would be tricky.
> Example 2)
> I have three tables representing a nested structure (Answers belong to
> QuestionLocales belong to Questions, so each question has several
> locales which has several answers). On updating I have to lookup if the
> values have been changed in the meantine in the database. And I can call
> a SQL statement only when I have gathered all necessary fields. So e.g.
> a call getMyText() on my bean can't give a result as long as there has
> not been a call to getMyId() and getMyUser(). And there should be as
> less SQL calls as possible.
> Any ideas greatly appreciated :-)
I think you just should some object/relational persistence library like 
Hibernate or OJB.
That's why I've said you are trying to reinvent the wheel. These 
libraries do exactly what you ask for in elegant way.
My questions is, why haven't you chosen this kind of library from the 
beginning and trying to implement theirs functionality instead?

Grzegorz Kossakowski

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message