Return-Path: Delivered-To: apmail-commons-user-archive@www.apache.org Received: (qmail 2990 invoked from network); 12 Jul 2010 19:19:51 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 12 Jul 2010 19:19:51 -0000 Received: (qmail 77248 invoked by uid 500); 12 Jul 2010 19:19:50 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 77087 invoked by uid 500); 12 Jul 2010 19:19:49 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 77079 invoked by uid 99); 12 Jul 2010 19:19:49 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Jul 2010 19:19:49 +0000 X-ASF-Spam-Status: No, hits=2.3 required=10.0 tests=ASF_LIST_SERVER_DEV_B,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [206.190.38.33] (HELO web50105.mail.re2.yahoo.com) (206.190.38.33) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 12 Jul 2010 19:19:40 +0000 Received: (qmail 66526 invoked by uid 60001); 12 Jul 2010 19:18:19 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1278962299; bh=PnEtvV7R6vJPeGFckiHaE1iaWMzD2M52dCcnssZpeDg=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=lmw/kF6V9QhE+KWhSy5YlCcnF9cVwMuVIJchQBu1abg96K5enn7x9KN9QwHU9BG/EhmKkSduWcBz6aVqhkTeqZi54eeK0ixMwHvTu1pFzuf8MpaH0DVzwwPpDVIF925jIuEQfrjC7Y52ap8nqqvnZ8DHOEKJH7h4Dq/iKFZnQeI= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=wl/ooSZNhg/7+hLzFTnhJzu/oWiOrLr8ubRk21tMUfFXSAyfuJBAGbVzFOJXzrOFzo1aPBLeHaXwT3wHlhILzlMJzQ2YUZ+vPK+IXQ8SwyVAOoPTSIC8qUTjkWCzkPu/RiP+27DxiZC8ZnwCBiV9Nb1Pmdho5csmuzrpWZNta5o=; Message-ID: <45535.65751.qm@web50105.mail.re2.yahoo.com> X-YMail-OSG: 4B_lgbQVM1nwDJVkDqZ7hN6Izs._mBKo6mGR6kyceHmuwip 7Q1RY93EaXpQETEvHtEzHZwZWZJ9GqQzWv96Xfw_1PDKHte8p6L2M0v033J2 ahz799CFqzzZ8RXOPJyuh8CHk3fhcCsuv6J9WjsZYF5eiuIl6J2J5gub.w2G HLIife4uHrRsi09r_X82D7jTV1t4RIJD8qWSdBrgZZzsxnEb8INKhpBzySwp _9Iqh5W66U23zau0pIuud7CznUOvpI3_718aOuYD0cgXxybhm5trkTdq.YW3 ERDTS8gW1JO2SS1aaRWBMtvgIa2NHAVrasOGdyiyBgZt1NOY_XJwpZVrJ3OJ .jlLUdJGy9kDWcwnuucEwebK26A-- Received: from [69.47.188.60] by web50105.mail.re2.yahoo.com via HTTP; Mon, 12 Jul 2010 12:18:18 PDT X-Mailer: YahooMailRC/420.4 YahooMailWebService/0.8.104.276605 References: <388606.81248.qm@web50106.mail.re2.yahoo.com> Date: Mon, 12 Jul 2010 12:18:18 -0700 (PDT) From: qin ding Subject: Re: [scxml] passing data to the state To: Commons Users List In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Thank you, Rahaul, for your quick=A0response.=A0 =0A=0AIf I do the followin= g:=0A=0APlayer p =3D ... // POJO from game client=0A=A0 getEngine().getRoot= Context().set("player", p);=0A=0Athen in the states, I should do this to ge= t it out, right?=0APlayer p =3D (Player) getEngine().getRootContext().get("= player");=0A=0ASomehow, when I do this, I get null out of the RootContext()= .=A0 Any idea?=0A=0AI will study the link you sent to me.=0A=0A=0A=0A----- = Original Message ----=0AFrom: Rahul Akolkar =0ATo:= Commons Users List =0ASent: Mon, July 12, 2010 1:= 02:04 PM=0ASubject: Re: [scxml] passing data to the state=0A=0AOn Mon, Jul = 12, 2010 at 12:49 PM, qin ding wrote:=0A> I am learnin= g commons scxml.=A0 I am experimenting writing a poker game using=0A> activ= emq and scxml.=0A>=0A>=0A> So, I have my config xml defined as follows:=0A>= =0A> =0A> =A0=A0=A0=A0=A0=A0 version=3D"1.0"=0A> =A0=A0=A0=A0=A0=A0 initia= lstate=3D"waitingRound">=0A> =A0=A0=A0 =0A> =A0=A0=A0=A0=A0=A0= =A0 =0A> =A0=A0=A0=A0=A0=A0=A0=A0=A0 =0A> =A0=A0=A0=A0=A0=A0=A0=A0=A0 =0A> =A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0 =0A> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =0A> =A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0 =0A> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =0A> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =0A> =A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0 =0A> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =0A> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =0A> =A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0 =0A> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0 =0A> =A0=A0=A0=A0=A0=A0=A0=A0=A0 =0A> =A0=A0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A> =A0=A0=A0=A0=A0=A0=A0 =0A> =A0=A0=A0=A0= =A0=A0=A0 =0A= > =A0=A0=A0 =0A> =A0=A0=A0 =0A> =A0=A0= =A0=A0=A0=A0=A0 = =0A> =A0=A0=A0 =0A> =0A>=0A> My questions:=0A> How can I pa= ss my pojo "Player" to the firstBettingRound, secondBettingRound =0A>and=0A= > etc?=A0This player object is coming from game client with betting informa= tion.=0A>=0A=0A=0AData (including POJOs) can be passed into an execu= tor either via an=0Aexternal event's payload or via procedural injection to= the executor's=0Aroot context.=0A=0ASo, as an example of the latter, the f= ollowing will create a variable=0A"player" in the executor's root context a= nd bind the POJO to it:=0A=0A=A0 Player p =3D ... // POJO from game client= =0A=A0 getEngine().getRootContext().set("player", p);=0A=0ASubsequently, th= e variable "player" may be used in expressions in the=0Astate machine.=0A= =0AIn the above state machine, the variable "inputPlayer" doesn't seem to= =0Abe accessed anywhere, so unless the player information is needed for=0At= he state machine logic, it can perhaps stay out of the state=0Amachine's ro= ot context altogether (given the pattern of use you=0Amention below).=0A=0A= =0A> After the activemq delivers it to the server end,=A0 how can I know wh= ich method=0A> to call?=A0 I think scxml handles the the state of game, so = I have to say=0A>=0A>=0A> Set states =3D getEngine().getCurrentStatus().get= States();=0A> =A0=A0=A0=A0=A0=A0=A0 return ((org.apache.commons.scxml.model= .State) states.iterator().=0A> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0 next()).getId();=0A>=0A> if the current state is firstBettingRound,=A0 = I do=0A> game.firstBettingRound(player);=A0 Is it correct=0A>=0A=0A= =0AIf you wanted to map states to activities that way. There are a few=0Apa= tterns that are commonly used, see:=0A=0A=A0 http://commons.apache.org/scxm= l/guide/using-commons-scxml.html=0A=0A-Rahul=0A=0A=0A> I seem unable to fin= d the example to show me how to pass pojo to the state=0A> correcponded met= hod.=A0 If I am completely wrong with my approach, Please =0Aadvise.=0A> Th= ank you very much.=0A>=0A> QD=0A>=0A=0A------------------------------------= ---------------------------------=0ATo unsubscribe, e-mail: user-unsubscrib= e@commons.apache.org=0AFor additional commands, e-mail: user-help@commons.a= pache.org=0A=0A=0A --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org