Revision: 10037
Author: [email protected]
Date: Wed Apr 20 11:46:29 2011
Log: Edited wiki page RequestFactoryMovingParts through web user
interface.
http://code.google.com/p/google-web-toolkit/source/detail?r=10037
Modified:
/wiki/RequestFactoryMovingParts.wiki
=======================================
--- /wiki/RequestFactoryMovingParts.wiki Wed Apr 20 08:32:39 2011
+++ /wiki/RequestFactoryMovingParts.wiki Wed Apr 20 11:46:29 2011
@@ -54,7 +54,7 @@
* The domain type is default-instantiable
* `I getId()` must return a stable value
* `V getVersion()` must change every time the meaningful state of the
domain object changes. No assumption is made about the semantic meaning of
the value, just that it is non-`equal()` to state version values.
- * `static Entity find(I id)` is used to retrieve a previously-referenced
entity, using a value returned by `getId()`. The `find()` method may
return `null` to indicate that the entity has been deleted or is otherwise
unavailable.
+ * `static Entity findEntity(I id)` is used to retrieve a
previously-referenced entity, using a value returned by `getId()`. The
`findEntity()` method may return `null` to indicate that the entity has
been deleted or is otherwise unavailable. A specific naming scheme is used
for this method: `find + Entity.class.getSimpleName()`.
Domain types that cannot satisfy some or all of the requirements of the
entity protocol may participate as entities by using a `Locator`.
@@ -92,6 +92,10 @@
A `Request` and its related type `InstanceRequest` represent a method
invocation to be performed on the server. The
[http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/web/bindery/requestfactory/shared/impl/AbstractRequest.java
AbstractRequest] base type is extended by the generator for each
`RequestContext` method declaration. The `Request` objects associate a
`RequestData` bag of metadata and parameter values with the user-provided
`Receiver` that was registered with `Request.to()` or implicitly by
`Request.fire(Receiver)`.
+The `InstanceRequest` interface allows instance methods on domain pojo
types to be called. The `InstanceRequest.using()` method sets the implicit
0-th argument of the invocation to the domain object represented by the
proxy.
+
+Instance methods on service objects can be called by providing a
`ServiceLocator` type which will provide the instance of an object on which
to invoke the desired business logic method. This allows
dependency-injection frameworks to be used to configure the service object.
+
== !RequestContext ==
A `RequestContext` maps domain code into the client's view. Each
`RequestContext` must be annotated with a `@Service` or `@ServiceName`
annotation. For a domain method with the following signature
@@ -102,7 +106,6 @@
{{{
Request<ReturnTypeProxy> methodName(SomeParamProxy p0, int p1, String p2);
}}}
-
The bulk of the `RequestContext` implementation can be found in
[http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/web/bindery/requestfactory/shared/impl/AbstractRequestContext.java
AbstractRequestContext].
@@ -116,16 +119,16 @@
A
[http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/web/bindery/requestfactory/server/RequestState.java
RequestState] is used by `SimpleRequestProcessor` to encapsulate all
temporary data necessary to process a single request. In general, a
`RequestState` maps domain objects to id objects and the id objects to
proxy instances. The proxy instances have ephemeral tag values that
associate them with their domain objects.
-== !ServiceLocator ==
-
-A `ServiceLocator` is used to provide instance objects for non-static
domain methods. Implementations of `ServiceLocators` are assumed to be
default-instantiable, however this may be changed by providing alternate
implementation of `ServiceLayer.createServiceLocator()`.
-
== !ServiceLayer ==
The `ServiceLayer` mediates all interactions between the
`SimpleRequestProcessor` and the domain. RequestFactory's default
behaviors may be overridden by providing one or more
`ServiceLayerDecorator` instance to `ServiceLayer.create()`. For instance,
the `ServiceLayer.setProperty()` method can be used to provide access
control for specific users.
Because the API expressed by `ServiceLayer` is intimately tied to the
services required by the `SimpleRequestProcessor`, the API is subject to
change over time. Efforts will be made to keep `ServiceLayerDecorator`
source-compatible, however this API should be treated as only semi-public.
Developers who are advanced enough to take advantage of decorating the
`ServiceLayer` will be able to adapt to changes as they come up.
+== !ServiceLocator ==
+
+A `ServiceLocator` is used to provide instance objects for non-static
domain methods that are not defined on a domain object (where an
`InstanceRequest` could be used instead). Implementations of
`ServiceLocators` are assumed to be default-instantiable, however this may
be changed by providing alternate implementation of
`ServiceLayer.createServiceLocator()`.
+
== !SimpleRequestProcessor ==
<img src="http://i.imgur.com/i7eN0.jpg" title="Boxes within boxes, wheels
within wheels." alt="Schematic drawing of SimpleRequestProcessor" />
@@ -140,6 +143,10 @@
RequestFactory provides a JRE-compatible implementation that can be used
for fast integration tests, server performance monitoring, or ad-hoc
utility clients. The implementation is accessed via the
[http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/web/bindery/requestfactory/vm/RequestFactorySource.java
RequestFactorySource] type.
+= JSON-RPC support =
+
+RequestFactory includes experimental support for interacting with JSON-RPC
services. This mode is activated by placing a `@JsonRpcService` annotation
on a `RequestContext`. Each `Request` method within a `RequestContext`
must be annotated with a `@JsonRpcWireName` annotation to specify the RPC
method name. Each parameter of the `Request` method declaration must be
annotated with a `@PropertyName` annotation. Exactly one parameter may
instead by annotated with the `@JsonRpcContent` annotation to use the
object as the request body for the RPC request. When in JSON-RPC mode, it
is legal to define additional setters within a `Request` subtype that can
be used to set optional properties. The additional setters must be
annotated with a `@PropertyName` annotation.
+
= Random notes without a home =
* The `gwt.rpc.dumpPayload` environment variable can be set to `true`
when attempting to debug RequestFactory behavior.
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors