atom feed12 messages in net.java.dev.appfuse.devRe: [appfuse-dev] GWT & Appfuse
FromSent OnAttachments
Matt RaibleFeb 24, 2009 7:42 am 
RoyPorterFeb 24, 2009 1:14 pm 
Michael HorwitzFeb 24, 2009 1:49 pm 
Matt RaibleMar 4, 2009 9:37 pm 
David WhitehurstMar 5, 2009 4:57 am 
David WhitehurstMar 5, 2009 5:11 am 
David WhitehurstMar 5, 2009 10:55 am 
Matt RaibleMar 5, 2009 10:59 am 
David WhitehurstMar 5, 2009 11:07 am 
Matt RaibleMar 5, 2009 11:44 am 
David WhitehurstMar 5, 2009 12:01 pm 
Musachy BarrosoMar 5, 2009 12:16 pm 
Subject:Re: [appfuse-dev] GWT & Appfuse
From:David Whitehurst (dlwh@gmail.com)
Date:Mar 5, 2009 4:57:45 am
List:net.java.dev.appfuse.dev

I whipped up a GWT thing last night and loved it! I have two questions:

1) Does it seem uncomfortable to have all those private newly created instances? Just feels wrong. I'm going for my Refactoring book. 2) Restful services in one app and client (GWT) in another? (and ... I see the answer below).

Guys, this is good stuff I think because e.g. I have form drawings that I'll continue to discuss and I think I'm going to hold off on showing any UI with my client for a while. I truly think that UI causes problems in design and analysis (even though I'm prototyping what might be the product). And, by discussing the user mechanics, the Restful stuff will be solid and tested at 100%.

Matt, thanks for the other mail. I'm hooked now too I think. I did the entire first form last night and thought to myself, "all I need is CSS now". The Restful stuff will be well understood and rigid.

Mike, if you rough out AppFuse restful and GWT archetypes, I'll help if you can give me blind instructions as to what I can do. I am actually going to be structuring two projects that will be similar first but without all the AppFuse complexity (security, struts-menu, templates, etc). If my stuff helps I'll share. Security is going to my biggest thing because I'm preparing to change the accounting world. But, I think AppFuse and the Spring security model will be perfect.. I'll pass out "Trust me" buttons when I'm done.

David

On Thu, Mar 5, 2009 at 12:37 AM, Matt Raible <ma@raibledesigns.com> wrote:

On Tue, Feb 24, 2009 at 2:14 PM, RoyPorter <as@porter.me.uk> wrote:

mraible wrote:

Here's how I believe GWT should be integrated:

1. Create an appfuse-ws archetype that serves up RESTful services (http://issues.appfuse.org/browse/APF-897). 2. Create an appfuse-gwt archetype that consumes those services. This archetype would contain a proxy servlet that allows #1 to be on a separate host/port.

In addition to #1, I hope to convert the Struts 2 and Spring MVC archetypes to use those framework's REST support.

For #2, we could use SmartGWT or GXT. SmartGWT might be better since Sanjiv is a committer on this project. ;-)

I was going to bring up this on the mailing list anyway, Matt, you've come up with one way of integrating GWT into a back-end - i.e. using RESTful services.

This is actually the way I initially investigated when going down the GWT route, I put it to one side in the end for a number of reasons: a. I didn't feel that there a stable Restful solution that was suitable for us (RESTlet has a GWT plug-in now, so that's possibly no longer the case). b. I have some concerns about not making the client too thick - we didn't have the time to learn how to architecture a proper RESTful system at the same time as using GWT for the first time, I had concerns that we may end up with all the business logic in the client, rather than on the server.

I'm not a RESTful expert though, so will bow to more experience people in this respect. I still haven't totally discarded using it myself, but there's question marks in my mind at the moment.

Alternatives .... there's 2 that spring to mind ...

1. If we're talking hibernate as the persistence mechanism, then Gilead (formerly Hibernate4GWT) is an option.

2. Map the valueobjects to DTO's using Dozer, or equivalent. We can therefore be picky and cut down what get's transferred across the wire to the client.

The latter DTO option is what we've used currently. I was not happy at the project start that Hibernate4GWT was polished enough, and I had some concerns about the amount of traffic that would go to the client if we just sent our current models over. Also there was the high likelihood that some of managers would also be exposed to non java consumers as web services, so our use of some of the Java Collection classes in the model objects could have caused issues. (Our DTO's flatten out any collection objects to arrays.)

In the process of implementing this, I took the GenericManager and created a generic Mapping version of it, so that the mapping between model objects and dto's was handled in the base class (with the option of overriding, if necessary).

So, our back-end consists of Manager's and DAO's as normal (for appfuse), our GWT client talks to the managers directly using the Spring MVC DispatcherServlet.

Moving onto your point 2, I agree with having whatever back-end on a different port, so that you can still use Hosted mode for development of the client.

GWT 1.6 is going to bring some very good improvements in - Jetty as the hosted mode server for one, and better design of where compiled artifacts go, amongst many others ...

As for SmartGWT, that's a no-brainer, in my opinion, our current project relies upon GWT-EXT, but I've had plans for some time to remove this in favour of SmartGWT.

As for my maven/appfuse archetype proposal, what I was thinking about doing was one or both of Gilead/DTO mapping, and create a GWT/SpringMVC/{Hibernate} archetype. I'd appreciate people's thoughts on this. Is it worth doing? or should we be following Matt's route? Or are a tutorial or two (of the non RESTful routes) explaining the integration of GWT with Appfuse enough?

The architecture I've been using is to use GWT's RequestBuilder to talk to RESTful services that return JSON. We hand-craft our GWT model objects from the domain objects on the server-side. Sure, it's not efficient, but it only takes a few minutes to code up the model object. We're using GXT, which has a slew of data-related classes we extend.

http://extjs.com/deploy/gxtdocs/com/extjs/gxt/ui/client/data/package-summary.html

Then we wrote our own JsonMarshaler that can easily initialize our model objects with JSON. Since I'm familiar with this setup, I'd probably implement something similar initially (unless others contribute of course).

Cheers,