A few classes from the "internal" namespaces are used directly:
Link
FeedLink
DateTime
Money
PostalAddress
PhoneNumber
Organization
Im
ExtendedProperty
Email
Deleted
Text
Where
Category

So if i were to convert those classes to interfaces, i would have to
define specialized versions, which i'd rather not. An option is to
leave all classes alone and just add a bunch of interfaces, one per
class. So for example the following classes:
com.google.gwt.gdata.client.Feed
com.google.gwt.gdata.client.atom.Feed

Would implement the following interfaces respectively:
com.google.gwt.gdata.client.impl.IFeed
com.google.gwt.gdata.client.impl.atom.IFeed

Where the second interface extends the first, etc.

Since this can be added at any time, initially i'm going to keep the
API flat without any inheritance or interfaces, so i'll have each
class implement all of its methods, including those "inherited" from
parent classes. Personally i think that to do this right, the GWT
GData library should be built entirely with GWT rather than be
overlayed on top of the JS API, which is a huge project. To take it
one step at a time here's my plan:

1. Build GWT-GData on top of JS API without class inheritance.
2. Add "inheritance" via interfaces.
3. Add the service namespaces that are missing from the JS API (e.g.
Documents, YouTube, etc).
4. Remove the JS API and provide GWT implementation (as needed).

Bobby

On Jun 12, 1:46 pm, Bobby <bobbysoa...@gmail.com> wrote:
> Ok, so time to look at class structure. In the JS API we have for
> example:
>
> com.google.gwt.gdata.client.calendar.CalendarFeed
>   com.google.gwt.gdata.client.Feed
>      com.google.gwt.gdata.client.atom.Feed
>
> We won't be able to implement this structure with overlay types
> because all methods are final, so for example CalendarFeed can't
> override methods of its parent feed classes - it does need to override
> methods to specialize the parameter and return types.
>
> Most of the classes in the following namespaces are only used
> internally.
> com.google.gwt.gdata.client
> com.google.gwt.gdata.client.atom
>
> The approach seems to be to not have any class in those namespaces
> used directly. For example, the Calendar namespace does not use
> com.google.gwt.gdata.client.Who, instead it specializes that class as
> com.google.gwt.gdata.client.calendar.CalendarWho and uses that.
>
> So i have the following options:
> 1. leave the parent classes around, but remove any methods implemented
> by child classes (this leaves polymorphism in place, but it's not of
> much use, since these classes will be pretty much empty).
> 2. convert the parent classes to interfaces (this gives us useful
> polymorphism)
> 3. remove these parent classes from the GWT API.
>
> Option 1 is not very useful.
> Option 2 works the best but perhaps adds too many interfaces.
> Option 3 removes all of these internal classes, which gets rid of
> polymorphism. With this approach, the GWT library would just have the
> "leaves" of the GData API's class tree, which would result in a very
> thin interface.
>
> I'm leaning towards Option 2 at this time.
>
> Bobby
>
> On Jun 6, 10:45 pm, Bobby <bobbysoa...@gmail.com> wrote:
>
> > The GoogleAccounts module is working well and is pretty close to what
> > it needs to 
> > be:http://code.google.com/p/gwt-gdata/source/browse/trunk/gdata/src/com/...
>
> > I was able to create jUnit test cases that impersonate user
> > authentication - the GData JS API AuthSub implementation performs
> > authentication by redirecting to a Google Accounts page, performing
> > auth and then redirecting back to the referring URL, passing along a
> > session token which gets stored in a cookie. To make the
> > authentication work i am setting the cookie directly which has the
> > same effect but allows the jUnit tests to work 
> > smoothly:http://code.google.com/p/gwt-gdata/source/browse/trunk/gdata/test/com...
>
> > Now i can write unit tests for the services which read/write data with
> > a test account.
>
> > I'm debating whether i should split the GWT-Gdata module into multiple
> > sub modules. For example, instead of having one large GWT module at
> > com.google.gwt.gdata, have com.google.gwt.gdata be a base module
> > inherited by specialized modules such as:
>
> > com.google.gwt.gdata.calendar
> > com.google.gwt.gdata.blogger
> > com.google.gwt.gdata.contacts
> > com.google.gwt.gdata.finance
> > ...etc
>
> > The reason is that, from my experience, you end up using GData to
> > interact with either Calendar or Documents for example, rather than
> > all of the GData systems, so it seems more natural to have a module
> > per GData system.
>
> > Bobby
>
> > On May 30, 10:21 pm, Bobby <bobbysoa...@gmail.com> wrote:
>
> > > I eliminated the Date errors by making use of a 
> > > DateHelper:http://code.google.com/p/gwt-gdata/source/browse/trunk/gdata/src/com/...
>
> > > Here's how i'm using 
> > > it:http://code.google.com/p/gwt-gdata/source/browse/trunk/gdata/src/com/...
>
> > > I convert Dates to milliseconds since 1970 before passing them between
> > > Java and JS.
>
> > > Bobby
>
> > > On May 30, 5:04 pm, Eric Ayers <zun...@google.com> wrote:
>
> > > > I don't think GWT does anything useful when you pass a Java Date
> > > > object into JSNI.  You may want to pass the # of milliseconds since
> > > > 1970 instead.
>
> > > > On Sat, May 30, 2009 at 2:03 AM, Bobby <bobbysoa...@gmail.com> wrote:
>
> > > > > I'm seeing some weird behavior whenever java.util.Date is used. The
> > > > > following DateTime class in GData wraps around a date:
> > > > >http://code.google.com/p/gwt-gdata/source/browse/trunk/gdata/src/com/...
>
> > > > > The newInstance method receives a java.util.Date.:
>
> > > > >  public static native DateTime newInstance(Date date, boolean
> > > > > dateOnly) /*-{
> > > > >     return new $wnd.google.gdata.DateTime(
> > > > >       date,
> > > > >       dateOnly
> > > > >     );
> > > > >   }-*/;
>
> > > > > Whenever i call this method it fails. If i replace it with the
> > > > > following, then it works:
>
> > > > >  public static native DateTime newInstance(Date date, boolean
> > > > > dateOnly) /*-{
> > > > >     return new $wnd.google.gdata.DateTime(
> > > > >       new Date(), //pass static JS date instead
> > > > >       dateOnly
> > > > >     );
> > > > >   }-*/;
>
> > > > > So the date object passed in from Java causes a failure whereas a
> > > > > regular JS date doesn't. I looked at the Date parameter passed in from
> > > > > Java and it looked like a regular JS date - when printed, a regular
> > > > > date string is displayed.
> > > > > In web mode jUnit hangs on newInstance(new Date(), true/false) because
> > > > > a JS exception occurs. In hosted mode the following exception is
> > > > > thrown:
>
> > > > > [WARN] Malformed JSNI reference 'getFullYear'; expect subsequent
> > > > > failures
> > > > > java.lang.NoSuchFieldError: getFullYear
> > > > >        at com.google.gwt.dev.shell.CompilingClassLoader
> > > > > $DispatchClassInfoOracle.getDispId(CompilingClassLoader.java:119)
> > > > >        at com.google.gwt.dev.shell.CompilingClassLoader.getDispId
> > > > > (CompilingClassLoader.java:531)
> > > > >        at com.google.gwt.dev.shell.ie.IDispatchProxy.getIDsOfNames
> > > > > (IDispatchProxy.java:124)
> > > > >        at com.google.gwt.dev.shell.ie.IDispatchImpl.GetIDsOfNames
> > > > > (IDispatchImpl.java:273)
> > > > >        at com.google.gwt.dev.shell.ie.IDispatchImpl.method5
> > > > > (IDispatchImpl.java:189)
> > > > >        at org.eclipse.swt.internal.ole.win32.COMObject.callback5
> > > > > (COMObject.java:108)
> > > > >        at org.eclipse.swt.internal.ole.win32.COM.VtblCall(Native 
> > > > > Method)
> > > > >        at 
> > > > > org.eclipse.swt.internal.ole.win32.IDispatch.Invoke(IDispatch.java:
> > > > > 64)
> > > > >        at 
> > > > > org.eclipse.swt.ole.win32.OleAutomation.invoke(OleAutomation.java:
> > > > > 493)
> > > > >        at 
> > > > > org.eclipse.swt.ole.win32.OleAutomation.invoke(OleAutomation.java:
> > > > > 417)
> > > > >        at com.google.gwt.dev.shell.ie.ModuleSpaceIE6.doInvokeOnWindow
> > > > > (ModuleSpaceIE6.java:67)
> > > > >        at com.google.gwt.dev.shell.ie.ModuleSpaceIE6.doInvoke
> > > > > (ModuleSpaceIE6.java:152)
> > > > >        at 
> > > > > com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
> > > > > 447)
> > > > >        at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid
> > > > > (ModuleSpace.java:248)
> > > > >        at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid
> > > > > (JavaScriptHost.java:107)
> > > > >        at 
> > > > > com.google.gwt.gdata.client.app.Edited$.setValue$(Edited.java)
> > > > >        at com.google.gwt.gdata.client.app.EditedTest.testProperties
> > > > > (EditedTest.java:42)
> > > > >        at 
> > > > > com.google.gwt.gdata.client.app.__EditedTest_unitTestImpl.doRunTest
> > > > > (transient source for
> > > > > com.google.gwt.gdata.client.app.__EditedTest_unitTestImpl:7)
> > > > >        at junit.framework.TestCase.runTest(TestCase.java:62)
> > > > >        at 
> > > > > com.google.gwt.junit.client.GWTTestCase.runBare(GWTTestCase.java:
> > > > > 178)
> > > > >        at com.google.gwt.junit.client.GWTTestCase.__doRunTest
> > > > > (GWTTestCase.java:116)
> > > > >        at 
> > > > > com.google.gwt.junit.client.impl.GWTRunner.runTest(GWTRunner.java:
> > > > > 188)
> > > > >        at com.google.gwt.junit.client.impl.GWTRunner.doRunTest
> > > > > (GWTRunner.java:163)
> > > > >        at 
> > > > > com.google.gwt.junit.client.impl.GWTRunner.access$3(GWTRunner.java:
> > > > > 157)
> > > > >        at com.google.gwt.junit.client.impl.GWTRunner
> > > > > $JUnitHostListener.onSuccess(GWTRunner.java:61)
> > > > >        at com.google.gwt.junit.client.impl.GWTRunner
> > > > > $JUnitHostListener.onSuccess(GWTRunner.java:1)
> > > > >        at
> > > > > com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceiv­­­ed
> > > > > (RequestCallbackAdapter.java:215)
> > > > >        at 
> > > > > com.google.gwt.http.client.Request.fireOnResponseReceivedImpl
> > > > > (Request.java:254)
> > > > >        at 
> > > > > com.google.gwt.http.client.Request.fireOnResponseReceivedAndCatch
> > > > > (Request.java:226)
> > > > >        at com.google.gwt.http.client.Request.fireOnResponseReceived
> > > > > (Request.java:217)
> > > > >        at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)
> > > > >        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown 
> > > > > Source)
> > > > >        at java.lang.reflect.Method.invoke(Unknown Source)
> > > > >        at 
> > > > > com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:
> > > > > 103)
> > > > >        at com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod
> > > > > (IDispatchImpl.java:126)
> > > > >        at com.google.gwt.dev.shell.ie.IDispatchProxy.invoke
> > > > > (IDispatchProxy.java:155)
> > > > >        at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke
> > > > > (IDispatchImpl.java:294)
> > > > >        at com.google.gwt.dev.shell.ie.IDispatchImpl.method6
> > > > > (IDispatchImpl.java:194)
> > > > >        at org.eclipse.swt.internal.ole.win32.COMObject.callback6
> > > > > (COMObject.java:117)
> > > > >        at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native 
> > > > > Method)
> > > > >        at 
> > > > > org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925)
> > > > >        at 
> > > > > org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966)
> > > > >        at
>
> ...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to