Hi,
I'm using pier in a project who needs execute certain operations after a command is executed (journal/persistence stuff) and I added a method PRCommand, who is executed after doExecute... so... what is the problem? well, I have to mark an object as "persistent", in PRAddCommand, and then I do: self child bePersistent... but, as #child answer a ew instance of #type, the operation is lost... I changed #child to use an instVar and just instantiate once.... everything seems to be working now, but I want to know if there is a possible problem with this change... what do you think? the change works? Thanks, Esteban _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
Hi Esteban,
just to clarify what your question is about: You want to do certain operations after a PRCommand was executed, right? So I wonder why you don't do them in the command's doExecute method... Now, in order to do stuff after executing the command, you added a method like doPostExecute to PRCommand, and you hooked that into the execution logic defined in PRCommand, right? Your problem is that you execute a PRAddCommand and you want to tell the new child somehow to bePersistent. And you don't know how to do that except for going into PRAddCommand and changing methods there. The more general question is: how do I access the new child that is created by a PRAddCommand, after it is created. Am I understanding the problem correctly? Maybe you can use a subclass of PRAddCommand that overrides #doValidate, or #validateChild:in: ? BTW: as far as I understand Piers design, persistency is supposed to be managed by the Pier kernel: PRCommand>>execute says self kernel persistency execute: self. Cheers Matthias On Mon, Aug 25, 2008 at 10:41 PM, Esteban Lorenzano <[hidden email]> wrote: > Hi, > I'm using pier in a project who needs execute certain operations after > a command is executed (journal/persistence stuff) and I added a method > PRCommand, who is executed after doExecute... so... what is the > problem? well, I have to mark an object as "persistent", in > PRAddCommand, and then I do: self child bePersistent... but, as #child > answer a ew instance of #type, the operation is lost... > I changed #child to use an instVar and just instantiate once.... > everything seems to be working now, but I want to know if there is a > possible problem with this change... > what do you think? the change works? > > Thanks, > Esteban > > > > _______________________________________________ > SmallWiki, Magritte, Pier and Related Tools ... > https://www.iam.unibe.ch/mailman/listinfo/smallwiki > _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
> BTW: as far as I understand Piers design, persistency is supposed to
> be managed by the Pier kernel: PRCommand>>execute says self kernel > persistency execute: self. Yeah, if you need to know about executed commands then create your own persistency strategy and override #apply:. This can also be a simple delegator, that passes all requests to the default strategy and handles certain cases differently. Cheers, Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
On 2008-08-26 07:55:36 -0300, Lukas Renggli <[hidden email]> said:
>> BTW: as far as I understand Piers design, persistency is supposed to >> be managed by the Pier kernel: PRCommand>>execute says self kernel >> persistency execute: self. > > Yeah, if you need to know about executed commands then create your own > persistency strategy and override #apply:. This can also be a simple > delegator, that passes all requests to the default strategy and > handles certain cases differently. Yes, that's exactly what I did... the problem is with PRAddCommand, because it creates the new child every time #child is called, then I am not working in the instance I saved but in a new one, that's why I want to change #child implementation, to keep the first instance it creates. > > Cheers, > Lukas _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
Free forum by Nabble | Edit this page |