[gwt-contrib] Re: Generalized RPC for server-enhanced objects
I'm not completely familiar with serialization code, but it looks pretty good to me. My main concern is that the use of a public setter might have unintended side effects that affect the value of other fields. http://gwt-code-reviews.appspot.com/51823/diff/1/14 File user/src/com/google/gwt/user/RemoteService.gwt.xml (right): http://gwt-code-reviews.appspot.com/51823/diff/1/14#newcode55 Line 55: define-configuration-property name=rpc.enhancedClasses is-multi-valued=true/ Would it make more sense to use an Annotation to specify enhanced classes? I think it would be easier for users. http://gwt-code-reviews.appspot.com/51823/diff/1/13 File user/src/com/google/gwt/user/server/rpc/SerializationPolicy.java (right): http://gwt-code-reviews.appspot.com/51823/diff/1/13#newcode33 Line 33: * that are expected to be enchanced on the server to have additional fields, enhanced, not enchanced http://gwt-code-reviews.appspot.com/51823/diff/1/13#newcode39 Line 39: public abstract SetString getClientFieldNames(Class? clazz); If this only returns something for classes that are enhanced, this might be a bad name. How about getClientFieldNamesForEnhancedClass()? http://gwt-code-reviews.appspot.com/51823/diff/1/12 File user/src/com/google/gwt/user/server/rpc/SerializationPolicyLoader.java (right): http://gwt-code-reviews.appspot.com/51823/diff/1/12#newcode45 Line 45: private static final String CLIENT_FIELDS_KEYWORD = @ClientFields; This field is a duplicate of ProxyCreator.CLIENT_FIELDS_KEYWORD, which is public. You can just use that one. http://gwt-code-reviews.appspot.com/51823/diff/1/5 File user/src/com/google/gwt/user/server/rpc/impl/ServerSerializationStreamReader.java (right): http://gwt-code-reviews.appspot.com/51823/diff/1/5#newcode652 Line 652: setter.invoke(instance, value); Will this work even if the setter has a side effect? For example, consider a class with two instance fields: field0 and field1, and the following setters: setField0(boolean value) { field0 = value; } setField1(boolean value) { field1 = value; field0 = false; } When you use the setter to set field1, it will change field0, possibly making it inconsistent with the object you are trying to serialize. http://gwt-code-reviews.appspot.com/51823 --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: Generalized RPC for server-enhanced objects
LGTM http://gwt-code-reviews.appspot.com/51823 --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: Generalized RPC for server-enhanced objects
This sounds very promising! Will there be (is there already?) a wiki page explaining how this works? Regards, -- Arthur Kalmenson On Wed, Jul 29, 2009 at 3:04 PM, r...@google.com wrote: Reviewers: robertvawter_google.com, scottb, Description: This patch removes the previous special-case handling of JDO objects in favor of a more general approach. First we determine which classes may be enhanced, based on annotations in the classes themselves or a new rpc.enhancedClasses configuration property. For those classes that are (possibly) enhanced and which may be transmitted in both directions between client and server, we place a list of client-visible methods into the .gwt.rpc file containing the RPC-able classes. At runtime, we use this list to identify any server-only fields and apply server-side serialization to them. When deserializing an enhanced object on the server, we user setter methods where possible rather than direct field writes. Please review this at http://gwt-code-reviews.appspot.com/51823 Affected files: user/src/com/google/gwt/user/RemoteService.gwt.xml user/src/com/google/gwt/user/rebind/rpc/ClientDataSerializer.java user/src/com/google/gwt/user/rebind/rpc/FieldSerializerCreator.java user/src/com/google/gwt/user/rebind/rpc/JdoDetachedStateClientDataSerializer.java user/src/com/google/gwt/user/rebind/rpc/ProxyCreator.java user/src/com/google/gwt/user/rebind/rpc/SerializableTypeOracle.java user/src/com/google/gwt/user/rebind/rpc/SerializableTypeOracleBuilder.java user/src/com/google/gwt/user/rebind/rpc/SerializableTypeOracleImpl.java user/src/com/google/gwt/user/rebind/rpc/Shared.java user/src/com/google/gwt/user/server/rpc/RemoteServiceServlet.java user/src/com/google/gwt/user/server/rpc/SerializationPolicy.java user/src/com/google/gwt/user/server/rpc/SerializationPolicyLoader.java user/src/com/google/gwt/user/server/rpc/impl/JdoDetachedStateServerDataSerializer.java user/src/com/google/gwt/user/server/rpc/impl/LegacySerializationPolicy.java user/src/com/google/gwt/user/server/rpc/impl/SerializabilityUtil.java user/src/com/google/gwt/user/server/rpc/impl/ServerDataSerializer.java user/src/com/google/gwt/user/server/rpc/impl/ServerSerializationStreamReader.java user/src/com/google/gwt/user/server/rpc/impl/ServerSerializationStreamWriter.java user/src/com/google/gwt/user/server/rpc/impl/StandardSerializationPolicy.java user/super/com/google/gwt/user/translatable/com/google/gwt/core/client/impl/WeakMapping.java user/test/com/google/gwt/user/server/rpc/RPCTest.java user/test/com/google/gwt/user/server/rpc/impl/StandardSerializationPolicyTest.java --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---