tapestry-user@jakarta.apache.org
[Top] [All Lists]

Re: Visit, transient objects, and interaction with engine

Subject: Re: Visit, transient objects, and interaction with engine
From: Ryan Crumley
Date: Thu, 17 Mar 2005 18:53:44 -0600
The reason I placed the logic there was I was following the vlib
example application (which is in chapter 10 of tapestry in action). I
like the placement because it allows me to have one point where my
tapestry components/pages/visit/ect interact with my services.

If there are better ways to do it I would be happy to hear how other
people have done it and what the results were.

ryan


On Fri, 18 Mar 2005 00:36:59 +0100, Ron Piterman <mplayer@xxxxxxxxxx> wrote:
> - you delegate the loadMyObject to your engine, may I ask why to the
> engine. I guess some do it today with Spring, and with Taps 3.1 it will
> be hivemind, at the moment I use a static class methods as DAO,
> 
> Is there a design/other benefit from using engine for it?
> 
> Cheers,
> Ron
> 
> ××××× Ryan Crumley:
> > Following the example found in chapter ten in Tapestry in Action I
> > have created the following visit object:
> >
> > public class Visit implements Serializable {
> >      private transient Object mMyObject;
> >      private int mMyObjectId;
> >
> >      public Object getMyObject(IRequestCycle cycle) {
> >           if(mMyObject == null) {
> >                Engine engine = (Engine)cycle.getEngine();
> >                mMyObject = engine.loadMyObject(mMyObjectId);
> >           }
> >           return mMyObject;
> >      }
> > }
> >
> > I like this implementation because the serialized Visit object will be
> > very small and the engine contains all the real logic required to save
> > and load my persistable objects.
> >
> > I do not like that in order to obtain a reference to the engine object
> > I must pass in a IRequestCycle. This makes ognl expressions that
> > obtain a value from a property on mMyObject more complicated that
> > before:
> >
> > ognl:visit.getMyObject(requestCycle).propertyOnMyObject
> >
> > Are there any ideas on how to do this better?
> >
> > Thanks,
> > ryan
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@xxxxxxxxxxxxxxxxxx
> > For additional commands, e-mail: tapestry-user-help@xxxxxxxxxxxxxxxxxx
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@xxxxxxxxxxxxxxxxxx
> For additional commands, e-mail: tapestry-user-help@xxxxxxxxxxxxxxxxxx
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: tapestry-user-help@xxxxxxxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>