Revision: 10057
Author: b...@google.com
Date: Fri Apr 22 08:12:24 2011
Log: Edited wiki page RequestFactoryMovingParts through web user
interface.
http://code.google.com/p/google-web-toolkit/source/detail?r=10057
Modified:
/wiki/RequestFactoryMovingParts.wiki
=======================================
--- /wiki/RequestFactoryMovingParts.wiki Fri Apr 22 07:44:46 2011
+++ /wiki/RequestFactoryMovingParts.wiki Fri Apr 22 08:12:24 2011
@@ -132,10 +132,28 @@
== !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.
+The
[http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/web/bindery/requestfactory/server/ServiceLayer.java
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.
+The default implementation of `ServiceLayer` is comprised of several
`ServiceLayerDecorator` types that group implementation implementation
details by overall function.
+
+Methods in the `ServiceLayer` API have a mostly-uniform naming scheme:
+ * `createFoo()` controls the instantiation of domain objects, `Locator`,
`ServiceLocator`, and service objects. Users of the dependency-injection
pattern will typically override the create methods to use their framework
of choice.
+ * `resolveFoo()` controls the mappings between client types and domain
types.
+ * `getFoo()` retrieves various declared and synthetic properties and
methods of domain objects.
+
+The `die()` and `report()` methods in `ServiceLayerDecorator` are both
used to report fatal errors and abort request processing. The difference
between the two is that `report()` will send diagnostic information to the
client whereas `die()` fails in a client-opaque way. Typically, `report()`
is used to send exceptions thrown by user-provided service methods, while
`die()` is used for all other failures.
+
+The default stack:
+ *
[http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/web/bindery/requestfactory/server/ServiceLayerCache.java
ServiceLayerCache] is used to reduce the number of type-introspection calls.
+ * User-provided `ServiceLayerDecorators` are inserted here.
+ *
[http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/web/bindery/requestfactory/server/LocatorServiceLayer.java
LocatorServiceLayer] implements support for `Locator` and `ServiceLocator`
types.
+ *
[http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/web/bindery/requestfactory/server/ReflectiveServiceLayer.java
ReflectiveServiceLayer] implements the majority of the domain-object
manipulation code.
+ *
[http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/web/bindery/requestfactory/server/ResolverServiceLayer.java
ResolverServiceLayer] provides the client to domain type and method
mappings.
+
+Implementors of `ServiceLayerDecorator` types should always use
`getTop().serviceMethod()` when calling methods defined in the
`ServiceLayer` API in order to allow those methods to be further
overridden. Implementations of `ServiceLayerDecorator` should be
stateless, as the default `RequestFactoryServlet` does not create a new
`ServiceLayer` for each request. If a stateful `ServiceLayerDecorator` is
written, the developer is responsible for ensuring the appropriate
lifecycle is used by the caller to `SimpleRequestProcessor`.
+
== !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()`.
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors