Re: Best practice to implement Command Pattern RPC on server?

2009-07-08 Thread David Peterson
On Jul 8, 8:03 am, pohl wrote: > > Essentially, I couldn't get the GWT compiler to work with a service > > with the following definition: > > > public interface DispatchService extends RemoteService { > >     , R extends Result> R execute( A action ) > > throws Exception; > > > } > > I tried to d

Re: Best practice to implement Command Pattern RPC on server?

2009-07-07 Thread Peter
When you run your web app in hosted mode, specify a log level of SPAM. The gwt compiler will then be more helpful - it will generate detailed messages about what is wrong with your class. In particular it will tell you if you're missing a default constructor or if you forgot to implement IsSeria

Re: Best practice to implement Command Pattern RPC on server?

2009-07-07 Thread pohl
> Essentially, I couldn't get the GWT compiler to work with a service > with the following definition: > > public interface DispatchService extends RemoteService { >     , R extends Result> R execute( A action ) > throws Exception; > > } I tried to do the same thing, inspired by Ray Ryan's talk

Re: Best practice to implement Command Pattern RPC on server?

2009-07-06 Thread David Peterson
Hi Nathan, On Jul 7, 7:24 am, Nathan Wells wrote: > I think this is mostly directed at David, but if anyone has answers, > I'd welcome them. > > In your command pattern implementation or somewhere on this thread > (can't remember where I saw it) you mention that GWT doesn't properly > implement

Re: Best practice to implement Command Pattern RPC on server?

2009-07-06 Thread Nathan Wells
I think this is mostly directed at David, but if anyone has answers, I'd welcome them. In your command pattern implementation or somewhere on this thread (can't remember where I saw it) you mention that GWT doesn't properly implement parameterized method calls on the RPC service. Is that true, or

Re: Best practice to implement Command Pattern RPC on server?

2009-07-06 Thread jdwy
Thought I'd point to my command pattern examples: http://github.com/jdwyah/tocollege.net/tree/f97ed4ff3f31c1c463eb426c34a55de439c601b3/src/main/java/com/apress/progwt/client/domain/commands I found the command pattern to be just the ticket to deal with XSRF attacks. In the directory above you can

Re: Best practice to implement Command Pattern RPC on server?

2009-07-06 Thread David Peterson
Yeah, that took me a while to figure out too - I do mention that on the 'Getting Started' example for gwt-dispatch. Better error messages would definitely be helpful... David On Jul 6, 8:17 pm, martinhansen wrote: > Gr! > > I found out why! Gr! > > The Action and Response classe

Re: Best practice to implement Command Pattern RPC on server?

2009-07-06 Thread martinhansen
Hello Herme, now it finally works. I've used your great and simple example and created a simple GWT application from it to check a user name and a password. For anyone interested, I've uploaded the sample application. It's essentially the same, just using GWT. http://rapidshare.de/files/47769639

Re: Best practice to implement Command Pattern RPC on server?

2009-07-06 Thread martinhansen
Gr! I found out why! Gr! The Action and Response classes must have an empty default constructor to be serializable. I've had this error before. Unfortunately, the GWT compiler error message is anything but helpful in this case. G. On 6 Jul., 11:57, martinhansen wrote: > He

Re: Best practice to implement Command Pattern RPC on server?

2009-07-06 Thread martinhansen
Hello Herme, your example is very interesting. I downloaded it and changed it to work with GWT. But I was not successful. When I run my application, the compiler complains about my client service interface: [ERROR] Type 'com.isp.gwtpattern.client.rpc.Response' was not serializable and has no c

Re: Best practice to implement Command Pattern RPC on server?

2009-07-06 Thread hgarciag
Martin, For really simple example you can see here: http://itsp.typepad.com/voip/2009/07/gwt-implementing-rpc-command-pattern-on-server.html At the end, you will need to add some more code, but you can see how the pattern works (it helped me!) Herme On Jul 5, 10:16 am, martinhansen wrote:

Re: Best practice to implement Command Pattern RPC on server?

2009-07-05 Thread David Peterson
On Jul 5, 6:16 pm, martinhansen wrote: > Hello David, > > I've read your source code and your example. It is very interesting. > But although it's short and simple, I still don't understand it. > Especially "GIN" and "GUICE" confuses me a lot. Can I use your example > without these technologies

Re: Best practice to implement Command Pattern RPC on server?

2009-07-05 Thread Herme Garcia
Martin, For really simple example, look at http://itsp.typepad.com/voip/2009/07/gwt-implementing-rpc-command-pattern-on-server.html This is really simple, far from complete, but you can see how the pattern works Herme On Jul 5, 10:16 am, martinhansen wrote: > Hello David, > > I've read your

Re: Best practice to implement Command Pattern RPC on server?

2009-07-05 Thread martinhansen
Hello David, I've read your source code and your example. It is very interesting. But although it's short and simple, I still don't understand it. Especially "GIN" and "GUICE" confuses me a lot. Can I use your example without these technologies? Does anyone know a really simple example? The exam

Re: Best practice to implement Command Pattern RPC on server?

2009-07-04 Thread David Peterson
Hi Nathan, On Jul 5, 2:15 am, Nathan Wells wrote: > I updated my project to only use the two interfaces as suggested by > David. Instead of using actionhandlers and registering them, I created > an annotation for the IRemoteProcedureCall implementations that > contains the canonical class name o

Re: Best practice to implement Command Pattern RPC on server?

2009-07-04 Thread David Peterson
Yeah, there is some added complexity, however I found myself basically implementing it in a much more ad-hoc fashion anyway, it's just that some operations required a 'token' object with multiple parameters, or returning another token with multiple return values, and some didn't. This way, it's mo

Re: Best practice to implement Command Pattern RPC on server?

2009-07-04 Thread Nathan Wells
For general information and benefits of the Command Pattern, see this article: http://en.wikipedia.org/wiki/Command_pattern GWT has some additional quirks that would make an abstracted command pattern nice, but I can see how you could say the added complexity might detract from those benefits.

Re: Best practice to implement Command Pattern RPC on server?

2009-07-04 Thread martinhansen
Can someone explain how this is useful? I don't know what a command pattern is. Why should I use command patterns and not the traditional way? What is the difference? At first look, this seems to be a lot more complicated, so I'm a little confused. --~--~-~--~~~---~--~-

Re: Best practice to implement Command Pattern RPC on server?

2009-07-04 Thread David Peterson
Hi all, I extracted the command-related code from my current project and have posted it here: http://code.google.com/p/gwt-dispatch/ The original code was working fine, but I haven't had a chance to test it since it was extracted from the project. It does compile, although you will currently n

Re: Best practice to implement Command Pattern RPC on server?

2009-07-04 Thread Nathan Wells
I updated my project to only use the two interfaces as suggested by David. Instead of using actionhandlers and registering them, I created an annotation for the IRemoteProcedureCall implementations that contains the canonical class name of the IProcedure that is to be run on the server. I'm very

Re: Best practice to implement Command Pattern RPC on server?

2009-07-04 Thread Herme Garcia
Hi, I have been playing a while, and I like Dave Peterson's, even with that class proliferation, I wrote a simple (and incomplete) example code: http://itsp.typepad.com/voip/2009/07/gwt-implementing-rpc-command-pattern-on-server.html Thanks On 4 jul, 15:49, David Peterson wrote: > Jason: I'll

Re: Best practice to implement Command Pattern RPC on server?

2009-07-04 Thread David Peterson
Jason: I'll admit I was unable to figure out exactly what Shindig's approach is, exactly, unfortunately. However there is definitely more than one way to skin this cat. My current implementation an Action, a Result and a Handler for each operation. This does result in some class proliferation, but

Re: Best practice to implement Command Pattern RPC on server?

2009-07-04 Thread Jason A. Beranek
All, Ok, just relooked and apparently the approach I described above was part of the 0.8 Shindig release, not the current 0.9. The pattern is still similar, but the implementation is a bit more confusing if you look at the Shindig code directly. Other than the references above to the Shindig sour

Re: Best practice to implement Command Pattern RPC on server?

2009-07-04 Thread Jason A. Beranek
David, The Apache Shindig project (reference implementation of OpenSocial) provides another approach for registering ActionHandlers. The Shindig OpenSocial API code uses a HandlerDispatcher to dispatch Action handling (as opposed to using the Servlet to do this directly). For application specific

Re: Best practice to implement Command Pattern RPC on server?

2009-07-04 Thread traneHead
Thanks both to David and ClusterCougar for your efforts! I've also been struggeling with this for a while now and got something similar to the command model Ray Ryan described it in the talk. Your version of it David, with the undo-functionality, sounds very interessting though. I'd be very inte

Re: Best practice to implement Command Pattern RPC on server?

2009-07-04 Thread Herme Garcia
David, Thank you for your help, How is "type" related to getActionType method on ActionbHandler interface?, do you have different services? Herme On 4 jul, 03:51, David Peterson wrote: > Just a couple of other comments on this general topic. > > 1. Yes, it's one-class-per RPC method. This is

Re: Best practice to implement Command Pattern RPC on server?

2009-07-03 Thread David Peterson
Just a couple of other comments on this general topic. 1. Yes, it's one-class-per RPC method. This is actually a good thing, since it lets you do item 2, which is: 2. You can add 'undo' to your actions. This is particularly handy if you build your Action classes using item 3: 3. You can have one

Re: Best practice to implement Command Pattern RPC on server?

2009-07-03 Thread David Peterson
There are a couple of ways to go about it, and I'm not 100% happy with my current solution as a 'best practice'. It's a bit convoluted, really. Current I'm using Guice on the server-side, so I bind them to 'ActionHandler.class', and then a post-config step pulls all ActionHandler bindings and regi

Re: Best practice to implement Command Pattern RPC on server?

2009-07-03 Thread ClusterCougar
Thanks David. That looks like a much better solution. The only reason I did all those generics was because I was still trying to wrap my head around the problem. Based on this, I've come up with some ideas I'm going to try to implement. How do you register your ActionHandlers? On Jul 3, 8:55 am,

Re: Best practice to implement Command Pattern RPC on server?

2009-07-03 Thread David Peterson
Hey ClusterCougar, I think your implementation is over-complicated. On the client side, just stick to two basic interfaces (and concrete implementations there- of) - Action and Result (I'm using 'Result' rather than 'Response' because that is often used in HTTP-related APIs), or in your API, IPro

Re: Best practice to implement Command Pattern RPC on server?

2009-06-30 Thread ClusterCougar
I thought I posted this last night, but I don't see it. Apologies if this is a dupe. I've tried to implement the command pattern using generics, but have some hangups. You can see my code at http://code.google.com/p/gwt-command-pattern/ Hangups: 1) Too many parameters. It's just not pretty 2)

Re: Best practice to implement Command Pattern RPC on server?

2009-06-25 Thread Eric
On Jun 25, 5:12 pm, Herme Garcia wrote: > Hi, > > After listening carefully Google IO's session from Ray Ryan about > "Best Practices For Architecting Your GWT App" : > > http://code.google.com/intl/es-ES/events/io/sessions/GoogleWebToolkit... > > He suggests a command pattern implementation fo