You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Yigal Rachman <yi...@uvic.ca> on 2007/05/25 20:05:30 UTC
mina-sm: other options?
Hi, Folks:
Yesterday my first MINA-based code went into production. As expected,
it is working wonderfully well - really cool! Thank you all for making
MINA such a joy to use.
As noted by others in this group, MINA is very well suited for use with
state machines because all the operations are non-blocking. I am
planning to exploit this for the instrument drivers that I am developing
with MINA, but am still researching the best tools for the job (no
offense to mina-sm). The most promising tool I have found is CHSM
(Concurrent Hierarchical State Machine). The home page is
http://chsm.sourceforge.net/index.html . Written originally for C++,
it now works for Java, too.
If you have an interest in state machines in general, then the original
thesis that spawned CHSM is a must-read:
http://homepage.mac.com/pauljlucas/resume/pjl-chsm-thesis.pdf (there is
a link to it from the home page, too). It describes in detail the
theory of hierarchical state machines (based on UML state charts - much
more powerful than the "usual" state machines), the programming
algorithms, and some great examples. It is the best work on the subject
that I have found thus far.
CHSM is a pre-compiler, which may make it more awkward to use than
direct java. However, I suspect that there may be a way to rework it to
use java directly, in the spirit of mina-sm.
Comments, anyone?
Yigal Rachman
Instrument Data Acquisition Developer
NEPTUNE Canada
www.neptunecanada.ca
Re: mina-sm: other options?
Posted by Trustin Lee <tr...@gmail.com>.
On 5/26/07, Niklas Therning <ni...@trillian.se> wrote:
<snip/>
> My main motivation for starting mina-sm was that I wanted to express my
> state machine in pure Java. It's by no means finished so any suggestions
> for improvements would be most welcome.
>
> If you want more info about mina-sm you could check out the tutorial I'm
> working on,
> http://cwiki.apache.org/confluence/display/MINA/Introduction+to+mina-sm.
> Please be aware that it's not finished yet.
It's an exciting tutorial for me. :) Can't wait the IoHandler example!
Cheers,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6
Re: mina-sm: other options?
Posted by Julien Vermillard <jv...@archean.fr>.
Le vendredi 01 juin 2007 à 10:51 +0200, Niklas Therning a écrit :
> Julien Vermillard wrote:
> > Le samedi 26 mai 2007 à 09:44 +0200, Niklas Therning a écrit :
> >
> >> My main motivation for starting mina-sm was that I wanted to express my
> >> state machine in pure Java. It's by no means finished so any suggestions
> >> for improvements would be most welcome.
> >>
> >> If you want more info about mina-sm you could check out the tutorial I'm
> >> working on,
> >> http://cwiki.apache.org/confluence/display/MINA/Introduction+to+mina-sm.
> >> Please be aware that it's not finished yet.
> >>
> >>
> >
> > Nice tutorial, you sohuld add a like in the documentation page.
> >
> > I got a little suggestion :
> > why not use Enum {} for defining the list of states in place of
> > Strings ?
> > in place of :
> >
> > @State public static final String EMPTY = "Empty";
> > @State public static final String LOADED = "Loaded";
> > @State public static final String PLAYING = "Playing";
> > @State public static final String PAUSED = "Paused";
> >
> > public enum State {EMPTY,LOADED,PLAYING,PAUSED};
> >
> If that was possible it would have been so great! Unfortunately, to my
> knowledge, the enum has to be known at the time mina-sm is compiled.
> :-( Can you think of a way to get around it?
>
Damn , now I need to checkout this code ;)
Re: mina-sm: other options?
Posted by Julien Vermillard <jv...@archean.fr>.
Le vendredi 01 juin 2007 à 11:19 +0200, Julien Vermillard a écrit :
> Le vendredi 01 juin 2007 à 10:51 +0200, Niklas Therning a écrit :
> > Julien Vermillard wrote:
> > > Le samedi 26 mai 2007 à 09:44 +0200, Niklas Therning a écrit :
> > >
> > >> My main motivation for starting mina-sm was that I wanted to express my
> > >> state machine in pure Java. It's by no means finished so any suggestions
> > >> for improvements would be most welcome.
> > >>
> > >> If you want more info about mina-sm you could check out the tutorial I'm
> > >> working on,
> > >> http://cwiki.apache.org/confluence/display/MINA/Introduction+to+mina-sm.
> > >> Please be aware that it's not finished yet.
> > >>
> > >>
> > >
> > > Nice tutorial, you sohuld add a like in the documentation page.
> > >
> > > I got a little suggestion :
> > > why not use Enum {} for defining the list of states in place of
> > > Strings ?
> > > in place of :
> > >
> > > @State public static final String EMPTY = "Empty";
> > > @State public static final String LOADED = "Loaded";
> > > @State public static final String PLAYING = "Playing";
> > > @State public static final String PAUSED = "Paused";
> > >
> > > public enum State {EMPTY,LOADED,PLAYING,PAUSED};
> > >
> > If that was possible it would have been so great! Unfortunately, to my
> > knowledge, the enum has to be known at the time mina-sm is compiled.
> > :-( Can you think of a way to get around it?
> >
>
> If you call
> Object.getClass.getClasses()
> you get all the public classes defined in this class
> You can loop testing the .isEnum(); method and find the Enum called
> "State".
>
> Could it be enought ?
>
Replying to myself, apparently you can't @anotate a vaule of an Enum, so
you won't be able to parametrize your different state like you did with
static Strings :(
Julien
Re: mina-sm: other options?
Posted by Julien Vermillard <jv...@archean.fr>.
Le vendredi 01 juin 2007 à 10:51 +0200, Niklas Therning a écrit :
> Julien Vermillard wrote:
> > Le samedi 26 mai 2007 à 09:44 +0200, Niklas Therning a écrit :
> >
> >> My main motivation for starting mina-sm was that I wanted to express my
> >> state machine in pure Java. It's by no means finished so any suggestions
> >> for improvements would be most welcome.
> >>
> >> If you want more info about mina-sm you could check out the tutorial I'm
> >> working on,
> >> http://cwiki.apache.org/confluence/display/MINA/Introduction+to+mina-sm.
> >> Please be aware that it's not finished yet.
> >>
> >>
> >
> > Nice tutorial, you sohuld add a like in the documentation page.
> >
> > I got a little suggestion :
> > why not use Enum {} for defining the list of states in place of
> > Strings ?
> > in place of :
> >
> > @State public static final String EMPTY = "Empty";
> > @State public static final String LOADED = "Loaded";
> > @State public static final String PLAYING = "Playing";
> > @State public static final String PAUSED = "Paused";
> >
> > public enum State {EMPTY,LOADED,PLAYING,PAUSED};
> >
> If that was possible it would have been so great! Unfortunately, to my
> knowledge, the enum has to be known at the time mina-sm is compiled.
> :-( Can you think of a way to get around it?
>
If you call
Object.getClass.getClasses()
you get all the public classes defined in this class
You can loop testing the .isEnum(); method and find the Enum called
"State".
Could it be enought ?
Re: mina-sm: other options?
Posted by Niklas Therning <ni...@trillian.se>.
Julien Vermillard wrote:
> Le samedi 26 mai 2007 à 09:44 +0200, Niklas Therning a écrit :
>
>> My main motivation for starting mina-sm was that I wanted to express my
>> state machine in pure Java. It's by no means finished so any suggestions
>> for improvements would be most welcome.
>>
>> If you want more info about mina-sm you could check out the tutorial I'm
>> working on,
>> http://cwiki.apache.org/confluence/display/MINA/Introduction+to+mina-sm.
>> Please be aware that it's not finished yet.
>>
>>
>
> Nice tutorial, you sohuld add a like in the documentation page.
>
> I got a little suggestion :
> why not use Enum {} for defining the list of states in place of
> Strings ?
> in place of :
>
> @State public static final String EMPTY = "Empty";
> @State public static final String LOADED = "Loaded";
> @State public static final String PLAYING = "Playing";
> @State public static final String PAUSED = "Paused";
>
> public enum State {EMPTY,LOADED,PLAYING,PAUSED};
>
If that was possible it would have been so great! Unfortunately, to my
knowledge, the enum has to be known at the time mina-sm is compiled.
:-( Can you think of a way to get around it?
--
Niklas Therning
www.spamdrain.net
Re: mina-sm: other options?
Posted by Julien Vermillard <jv...@archean.fr>.
Le samedi 26 mai 2007 à 09:44 +0200, Niklas Therning a écrit :
> My main motivation for starting mina-sm was that I wanted to express my
> state machine in pure Java. It's by no means finished so any suggestions
> for improvements would be most welcome.
>
> If you want more info about mina-sm you could check out the tutorial I'm
> working on,
> http://cwiki.apache.org/confluence/display/MINA/Introduction+to+mina-sm.
> Please be aware that it's not finished yet.
>
Nice tutorial, you sohuld add a like in the documentation page.
I got a little suggestion :
why not use Enum {} for defining the list of states in place of
Strings ?
in place of :
@State public static final String EMPTY = "Empty";
@State public static final String LOADED = "Loaded";
@State public static final String PLAYING = "Playing";
@State public static final String PAUSED = "Paused";
public enum State {EMPTY,LOADED,PLAYING,PAUSED};
Julien
Re: mina-sm: other options?
Posted by Niklas Therning <ni...@trillian.se>.
Yigal Rachman wrote:
> Hi, Folks:
>
> Yesterday my first MINA-based code went into production. As expected,
> it is working wonderfully well - really cool! Thank you all for
> making MINA such a joy to use.
>
> As noted by others in this group, MINA is very well suited for use
> with state machines because all the operations are non-blocking. I am
> planning to exploit this for the instrument drivers that I am
> developing with MINA, but am still researching the best tools for the
> job (no offense to mina-sm). The most promising tool I have found is
> CHSM (Concurrent Hierarchical State Machine). The home page is
> http://chsm.sourceforge.net/index.html . Written originally for C++,
> it now works for Java, too.
>
> If you have an interest in state machines in general, then the
> original thesis that spawned CHSM is a must-read:
> http://homepage.mac.com/pauljlucas/resume/pjl-chsm-thesis.pdf (there
> is a link to it from the home page, too). It describes in detail the
> theory of hierarchical state machines (based on UML state charts -
> much more powerful than the "usual" state machines), the programming
> algorithms, and some great examples. It is the best work on the
> subject that I have found thus far.
>
> CHSM is a pre-compiler, which may make it more awkward to use than
> direct java. However, I suspect that there may be a way to rework it
> to use java directly, in the spirit of mina-sm.
>
> Comments, anyone?
>
There's also the State Machine Compiler (http://smc.sourceforge.net/).
If you haven't you might want to check it out too. It also uses a
special language with embedded Java code which needs to be compiled into
Java by a special compiler.
My main motivation for starting mina-sm was that I wanted to express my
state machine in pure Java. It's by no means finished so any suggestions
for improvements would be most welcome.
If you want more info about mina-sm you could check out the tutorial I'm
working on,
http://cwiki.apache.org/confluence/display/MINA/Introduction+to+mina-sm.
Please be aware that it's not finished yet.
--
Niklas Therning
www.spamdrain.net