|
I'm fairly new to grails, but I have done some rails work in the past. Is there an equivalent in grails to rails' acts as state machine plugin? (old link - there are newer versions out there)
If there isn't one, does anyone have a suggestion how to implement the functionality of defining states, state transitions and adding callbacks for entering/exiting/guarding states for a model? |
|
I haven't seen a plugin like this before. But if I was going to implement one, I would probably start out with the Apache SCXML project. http://commons.apache.org/scxml
Hope this helps, Mark On Thu, Jul 30, 2009 at 9:13 AM, eranlo <[hidden email]> wrote:
-- Mark Fortner blog: http://feeds.feedburner.com/jroller/ideafactory |
|
In reply to this post by eranlo
Please keep me posted with your progress on this, it's something i'd also
like to see. Dom -----Original Message----- From: eranlo [mailto:[hidden email]] Sent: 30 July 2009 17:14 To: [hidden email] Subject: [grails-user] "Acts As State Machine" equivalent in grails I'm fairly new to grails, but I have done some rails work in the past. Is there an equivalent in grails to rails' http://agilewebdevelopment.com/plugins/acts_as_state_machine acts as state machine plugin? (old link - there are newer versions out there) If there isn't one, does anyone have a suggestion how to implement the functionality of defining states, state transitions and adding callbacks for entering/exiting/guarding states for a model? -- View this message in context: http://www.nabble.com/%22Acts-As-State-Machine%22-equivalent-in-grails-tp247 41662p24741662.html Sent from the grails - user mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
How similar is this to Grails' use of Spring web flow?
It looks to me like a stateful, scoped service with some internal DSL to define states and transitions. Is that accurate? (for the sake of those not familiar with the RoR plugin) Thanks. -Tom On Fri, Jul 31, 2009 at 6:33 AM, Dominic Clifton<[hidden email]> wrote: > Please keep me posted with your progress on this, it's something i'd also > like to see. > > Dom > > -----Original Message----- > From: eranlo [mailto:[hidden email]] > Sent: 30 July 2009 17:14 > To: [hidden email] > Subject: [grails-user] "Acts As State Machine" equivalent in grails > > > I'm fairly new to grails, but I have done some rails work in the past. Is > there an equivalent in grails to rails' > http://agilewebdevelopment.com/plugins/acts_as_state_machine acts as state > machine plugin? (old link - there are newer versions out there) > > If there isn't one, does anyone have a suggestion how to implement the > functionality of defining states, state transitions and adding callbacks for > entering/exiting/guarding states for a model? > > -- > View this message in context: > http://www.nabble.com/%22Acts-As-State-Machine%22-equivalent-in-grails-tp247 > 41662p24741662.html > Sent from the grails - user mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
When I read the OP, I originally assumed that it would be something similar to WebFlow, but as I understand it now it injects behavior into a domain object and that the states and transitions refere to the domain object and not the Web conversation. I think.
-----Original Message----- From: Tom Nichols [mailto:[hidden email]] Sent: Friday, July 31, 2009 9:11 AM To: [hidden email] Subject: Re: [grails-user] "Acts As State Machine" equivalent in grails How similar is this to Grails' use of Spring web flow? It looks to me like a stateful, scoped service with some internal DSL to define states and transitions. Is that accurate? (for the sake of those not familiar with the RoR plugin) Thanks. -Tom On Fri, Jul 31, 2009 at 6:33 AM, Dominic Clifton<[hidden email]> wrote: > Please keep me posted with your progress on this, it's something i'd > also like to see. > > Dom > > -----Original Message----- > From: eranlo [mailto:[hidden email]] > Sent: 30 July 2009 17:14 > To: [hidden email] > Subject: [grails-user] "Acts As State Machine" equivalent in grails > > > I'm fairly new to grails, but I have done some rails work in the past. > Is there an equivalent in grails to rails' > http://agilewebdevelopment.com/plugins/acts_as_state_machine acts as > state machine plugin? (old link - there are newer versions out there) > > If there isn't one, does anyone have a suggestion how to implement the > functionality of defining states, state transitions and adding > callbacks for entering/exiting/guarding states for a model? > > -- > View this message in context: > http://www.nabble.com/%22Acts-As-State-Machine%22-equivalent-in-grails > -tp247 > 41662p24741662.html > Sent from the grails - user mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email PLEASE READ: This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this message in error, please delete it and all copies from your system, destroy any hard copies and notify the sender. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. Nomura Holding America Inc., Nomura Securities International, Inc, and their respective subsidiaries each reserve the right to monitor all e-mail communications through its networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state the views of such entity. Unless otherwise stated, any pricing information in this message is indicative only, is subject to change and does not constitute an offer to deal at any price quoted. Any reference to the terms of executed transactions should be treated as preliminary only and subject to our formal written confirmation. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Acts As State Machine is a generic way of switching states of an object, regardless of whether the object is a work flow as part of a command line tool or a work flow in a Web app. Spring Web flow is limited to managing states in Web app.
It would be nice if Groovy had a AASM equivalent.
|
|
What about http://grails.org/plugin/list#workflow%2Btags ?
On Fri, Jul 31, 2009 at 5:32 PM, Tom_G <[hidden email]> wrote:
-- Alvaro Sanchez-Mariscal Software Architect & Instructor blogs.salenda.es/alvaro_sanchez | twitter.com/alvaro_sanchez [hidden email] |
|
jBPM is a hell of a lot better Workflow than many commercial offerings. But I think Ruby's AASM is simple and elegant and all most people need when modeling state change.
|
|
I needed something like this today but was reluctant to jump on to
something like jBPM. It's not quite the same as AASM, but here's what I came up with: public abstract class StateMachine implements Callable { abstract Closure getStart() Closure currentStateClosure def call() { this.currentStateClosure = this.start while ( currentStateClosure != null ) { this.currentStateClosure = currentStateClosure.call() } } } And then an implementation: public class SlideShow extends StateMachine { def startTime // set for some time in the future. def lights = "off" def slides = ['one', 'two', 'three'] def start = WAIT_FOR_START def WAIT_FOR_START = { def now = new Date() if ( now >= startTime ) return LIGHTS // else sleep Thread.sleep( start.time - now.time ) WAIT_FOR_START } def LIGHTS = { lights = "off" SHOW } def SHOW = { if ( ! slides.size() ) return END //else show the next slide showSlide slides.first() slides = slides.tail() SHOW // transition to self for next slide } def END = { lights = "on" null // we are done! } } Now, this can be greatly expanded upon, but that's what I came up with after thinking about it for about an hour. Obviously this differs greatly from AASM in a number of ways -- but IMO it's a good start and makes the state machine pretty easy to understand. One thing that comes to mind is you could pass transient information between states by currying the closure that gets returned, i.e. def SHOW = { slides -> // show first slide... return SHOW.curry( slides.tail() ) } Any thoughts? Another idea would be to make the StateMachine class a mixin. -Tom On Sat, Aug 1, 2009 at 8:55 AM, Tom_G<[hidden email]> wrote: > > jBPM is a hell of a lot better Workflow than many commercial offerings. But > I think Ruby's AASM is simple and elegant and all most people need when > modeling state change. > > > > Alvaro Sanchez-Mariscal wrote: >> >> What about http://grails.org/plugin/list#workflow%2Btags ? >> >> On Fri, Jul 31, 2009 at 5:32 PM, Tom_G <[hidden email]> wrote: >> >>> >>> Acts As State Machine is a generic way of switching states of an object, >>> regardless of whether the object is a work flow as part of a command line >>> tool or a work flow in a Web app. Spring Web flow is limited to managing >>> states in Web app. >>> >>> It would be nice if Groovy had a AASM equivalent. >>> >>> >>> Frohnhofer, James wrote: >>> > >>> > When I read the OP, I originally assumed that it would be something >>> > similar to WebFlow, but as I understand it now it injects behavior into >>> a >>> > domain object and that the states and transitions refere to the domain >>> > object and not the Web conversation. I think. >>> > >>> > -----Original Message----- >>> > From: Tom Nichols [mailto:[hidden email]] >>> > Sent: Friday, July 31, 2009 9:11 AM >>> > To: [hidden email] >>> > Subject: Re: [grails-user] "Acts As State Machine" equivalent in grails >>> > >>> > How similar is this to Grails' use of Spring web flow? >>> > >>> > It looks to me like a stateful, scoped service with some internal DSL >>> to >>> > define states and transitions. Is that accurate? (for the sake of >>> those >>> > not familiar with the RoR plugin) >>> > >>> > Thanks. >>> > -Tom >>> > >>> > >>> > On Fri, Jul 31, 2009 at 6:33 AM, Dominic >>> Clifton<[hidden email]> >>> > wrote: >>> >> Please keep me posted with your progress on this, it's something i'd >>> >> also like to see. >>> >> >>> >> Dom >>> >> >>> >> -----Original Message----- >>> >> From: eranlo [mailto:[hidden email]] >>> >> Sent: 30 July 2009 17:14 >>> >> To: [hidden email] >>> >> Subject: [grails-user] "Acts As State Machine" equivalent in grails >>> >> >>> >> >>> >> I'm fairly new to grails, but I have done some rails work in the past. >>> >> Is there an equivalent in grails to rails' >>> >> http://agilewebdevelopment.com/plugins/acts_as_state_machine acts as >>> >> state machine plugin? (old link - there are newer versions out there) >>> >> >>> >> If there isn't one, does anyone have a suggestion how to implement the >>> >> functionality of defining states, state transitions and adding >>> >> callbacks for entering/exiting/guarding states for a model? >>> >> >>> >> -- >>> >> View this message in context: >>> >> http://www.nabble.com/%22Acts-As-State-Machine%22-equivalent-in-grails >>> >> -tp247 >>> >> 41662p24741662.html >>> >> Sent from the grails - user mailing list archive at Nabble.com. >>> >> >>> >> >>> >> --------------------------------------------------------------------- >>> >> To unsubscribe from this list, please visit: >>> >> >>> >> http://xircles.codehaus.org/manage_email >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> --------------------------------------------------------------------- >>> >> To unsubscribe from this list, please visit: >>> >> >>> >> http://xircles.codehaus.org/manage_email >>> >> >>> >> >>> >> >>> > >>> > --------------------------------------------------------------------- >>> > To unsubscribe from this list, please visit: >>> > >>> > http://xircles.codehaus.org/manage_email >>> > >>> > >>> > >>> > >>> > PLEASE READ: This message is for the named person's use only. It may >>> > contain confidential, proprietary or legally privileged information. No >>> > confidentiality or privilege is waived or lost by any mistransmission. >>> If >>> > you receive this message in error, please delete it and all copies from >>> > your system, destroy any hard copies and notify the sender. You must >>> not, >>> > directly or indirectly, use, disclose, distribute, print, or copy any >>> part >>> > of this message if you are not the intended recipient. Nomura Holding >>> > America Inc., Nomura Securities International, Inc, and their >>> respective >>> > subsidiaries each reserve the right to monitor all e-mail >>> communications >>> > through its networks. Any views expressed in this message are those of >>> the >>> > individual sender, except where the message states otherwise and the >>> > sender is authorized to state the views of such entity. Unless >>> otherwise >>> > stated, any pricing information in this message is indicative only, is >>> > subject to change and does not constitute an offer to deal at any price >>> > quoted. Any reference to the terms of executed transactions should be >>> > treated as preliminary only and subject to our formal written >>> > confirmation. >>> > >>> > --------------------------------------------------------------------- >>> > To unsubscribe from this list, please visit: >>> > >>> > http://xircles.codehaus.org/manage_email >>> > >>> > >>> > >>> > >>> >>> -- >>> View this message in context: >>> http://www.nabble.com/%22Acts-As-State-Machine%22-equivalent-in-grails-tp24741662p24757852.html >>> Sent from the grails - user mailing list archive at Nabble.com. >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe from this list, please visit: >>> >>> http://xircles.codehaus.org/manage_email >>> >>> >>> >> >> >> -- >> Alvaro Sanchez-Mariscal >> Software Architect & Instructor >> blogs.salenda.es/alvaro_sanchez | twitter.com/alvaro_sanchez >> [hidden email] >> >> > > -- > View this message in context: http://www.nabble.com/%22Acts-As-State-Machine%22-equivalent-in-grails-tp24741662p24768852.html > Sent from the grails - user mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
| Powered by Nabble | Edit this page |
