David,

Let me thank you for your answers.
I'm studying your implementation.
It has the bonus of having guice and gin that was in my plans to use.
I didn't fire you with questions because I'm studying at night in my
home and got little time spent on it.

Regards,

Geraldo


On 7 jul, 16:38, Fred Sauer <[email protected]> wrote:
> Geraldo,
> This dispatching method is independent of the signature of the
> implementation. Your caching service class execute method can look like
> this:
>
>   public <T extends Response> void execute(Action<T> action, final
> AsyncCallback<T> cb) {
>     realService.execute(action, new AsyncCallback<T>() {
>
>       public void onFailure(Throwable caught) {
>         cb.onFailure(caught);
>       }
>
>       public void onSuccess(T result) {
>         // This is where we would cache the result
>         cb.onSuccess(result);
>         // This is where we would fire an event on the bus
>       }
>
>     });
>   }
>
> The actual caching and bus event generation code can be sensitive to the
> subtype of Action being passed in.
>
> HTH
> Fred
>
>
>
> On Sun, Jul 5, 2009 at 8:39 AM, Geraldo Lopes <[email protected]> wrote:
>
> > I've been trying to understand Ray's presentation  and want to share
> > some doubts hoping for clarification:
>
> >http://dl.google.com/io/2009/pres/Th_0200_GoogleWebToolkitArchitectur...
>
> > Considering Page 21
>
> > interface Action<T extends Response> { }
>
> > interface Response { }
>
> > interface ContactsService extends RemoteService {
> >  <T extends Response> T execute(Action<T> action);
> > }
>
> > interface ContactsServiceAsync {
> >  <T extends Response> void execute(Action<T> action,
> >    AsyncCallback<T> callback);
> > }
>
> > Considering the Tossing the Event Page (46)
>
> > public void execute(final UpdateContact update,
> >  final AsyncCallback<GetContactsResponse> cb) {
> >    realService.execute(update,
> >     new AsyncCallback<UpdateContactResponse>() {
> > ..
> > ..
>
> > Observe that the execute method has specialized parameters. If it's
> > implementing the ContactsServiceAsync interface it probably has a
>
> >  void execute(Action<T> action,  AsyncCallback<T> callback) {
> >  if (action instanceof UpdateContact)
> >    execute(UpdateContact(action), (GetContactsResponse)callback);
> >  else
> >  if (action instanceof AnotherCommand)
> >  ..
> >  ..
> > }
>
> > I've understood the purpose of the code (It's a kind of a manual proxy
> > to intercept the calls to the realService and make whatever is
> > necessary ,caching, eventbus interaction). That's not the point. My
> > doubt is : What is the signature of the class ?
>
> > If you see the code of page 58 which is a Mock of the
> > ContactsServiceAsync
>
> > class MockContactsService implements ContactsServiceAsync {
> >  Action<?> lastAction;
> >  AsyncCallback<?> lastCallback;
>
> >  public <T extends Response> void execute(Action<T> action,
> >   AsyncCallback<T> callback) {
> >   lastAction = action;
> >   lastCallback = callback;
> >  }
> > }
>
> > You get the impression of there has to be some mechanism to dispatch
> > to the real execute methods because one can't write
>
> > class CachedBatchingService implements ContactsServiceAsync
>
> >  public  CachedBatchingService(ContactsServiceAsync realService) {
> >  }
>
> > public void execute(final UpdateContact update,
> >  final AsyncCallback<GetContactsResponse> cb) {
> >    realService.execute(update,
> >     new AsyncCallback<UpdateContactResponse>() {
> > ..
>
> > The compiler demands a method with :
>
> >  <T extends Response> void execute(Action<T> action,
> >    AsyncCallback<T> callback);
>
> > Please be tolerant with my english and my java.
>
> > Thanks in advance
>
> > Geraldo
>
> --
> Fred Sauer
> [email protected]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to