Upayavira wrote:
I think you are getting something wrong here.
If you have two objects bizObj1 and bizObj2, and you pass these to a
pipeline that does
JXT(bizObj1)->tx->tx-\
>-aggregate->tx->serlialize
JXT(bizObj2)->tx->tx-/
You would do:
sendPage("your-pipeline", {"bizObj1": bizObj1, "bizObj2": bizObj2});
It feel like it breaks SoC a little as controller has to know how your view is
rendered. Also if you change your rendering to 3 aggregate parts you have to
make appropriate changes in controller.
Then, your objects would implement:
bizObj.getValidity()
And the jxtemplate would ask the business object for its validity as
Sylvain has described.
Thus, if bizObj1 says it can be cached, and bizObj2 says it can't, then
at least one of your two aggregated pipelines doesn't need to be
generated, which will speed up processing.
Remember, the jxtemplate pulls the validity from the business object.
The flow doesn't need to even know that caching might be happening (and
in fact _shouldn't_ know it is happening). If you have to write
flowscript to deal with this, then something is probably wrong.
If your business object takes an age to instantiate, and you can decide
whether or not to instantiate it based upon request parameters, then
wrap it in a lighter component that does (in pseudocode):
lightObject.getValidity() {
return request.parameters["a"]+ request.parameters["b"];
}
lightObject.getHeavyBusinessObject() {
if (this.heavyBusinessObject == null) {
this.heavyBusinessObject = HeavyBusinessObjectBuilder.newObject();
}
return this.heavyBusinessObject;
}
Then, in your jxt, you use Sylvains
jx:cacheKey="lightObject.getValidity()" construct, and then later in
your jxt, you access your heavy object with
#{/lightObject/HeavyObject/property1}. This latter expression will only
be invoked if the page is not cached.
Does that make sense?
Now it does. I never thought of a wrapper. It's real pleasure to discuss with
you all.
It seems to me that Sylvains suggested extension of jxt has a great deal
of power in it.
OK. Then I'll continue my work and try to provide the appropriate patch as I
have already started to make needed changes.
--
Leszek Gawron [EMAIL PROTECTED]