Revision: 10530
Author: bobv%[email protected]
Date: Tue Aug 16 12:44:31 2011
Log: Edited wiki page RequestFactoryInterfaceValidation through web
user interface.
http://code.google.com/p/google-web-toolkit/source/detail?r=10530
Modified:
/wiki/RequestFactoryInterfaceValidation.wiki
=======================================
--- /wiki/RequestFactoryInterfaceValidation.wiki Tue Aug 2 17:49:09 2011
+++ /wiki/RequestFactoryInterfaceValidation.wiki Tue Aug 16 12:44:31 2011
@@ -8,18 +8,44 @@
The RequestFactory annotation processor will validate the RequestFactory
interface declarations and ensure that the mapping of proxy properties and
context methods to their domain types is valid. The manner in which the
errors are reported depends on the method by which the annotation processor
is invoked.
-In addition to validating the interfaces, the annotation processor also
generates addition Java types which embed pre-computed metadata that is
required by the RequestFactory server components. Users of
`RequestFactorySource` must also run the annotation processor in order to
provide the client code with obfuscated type token mappings. In the
client-only case, the server domain types are not required.
-
-It is necessary for both the shared RequestFactory interfaces and their
server domain counterparts to be available on the classpath. In order to
accomodate different build processes, the va
+In addition to validating the interfaces, the annotation processor also
generates addition Java types which embed pre-computed metadata that is
required by the RequestFactory server components. Users of
`RequestFactorySource` must also run the annotation processor in order to
provide the client code with obfuscated type token mappings. In the
client-only case, the server domain types are not required.
= Annotation Processor =
+It is necessary for both the shared RequestFactory interfaces and their
server domain counterparts to be available on the sourcepath or classpath
during the compilation process. If this is not convenient, see the
`ValidationTool` section for information on post-processing pre-compiled
shared interfaces and domain types as part of a deployment process.
+
== javac builds==
-Users using javac 1.6 or later to compile their server projects need only
to include the `requestfactory-client.jar` on the build classpath. The
compiler will automatically load the annotation processor from the JAR file.
+Users using javac 1.6 or later to compile their server projects need only
to include the `requestfactory-apt.jar` on the build classpath. The
compiler will automatically load the annotation processor from the JAR file.
== IDE configuration ==
-* TODO * add screenshots for how to configure Eclipse.
+=== Eclipse ===
+Open the project properties dialog and navigate to `Java Compiler ->
Annotation Processing`. Ensure that annotation processing is enabled.
+
+<img src="http://i.imgur.com/7upSN.png" />
+
+Add the `requestfactory-apt.jar` to the factory path.
+
+<img src="http://i.imgur.com/lMw0T.png" />
+
+The project will need to be rebuilt, but once this is done, any
RequestFactory validation errors or warnings will be displayed in the
editor upon saving:
+
+<img src="http://i.imgur.com/QQGHU.png" />
= !ValidationTool =
+
+Not all build processes are amenable to compiling the shared proxy
interfaces and the domain types at the same time. Cases where the
`ProxyForName` and `ServiceName` annotation are used are typical of this
build configuration. In these cases, it is possible to post-process
pre-compiled shared and domain types using the RequestFactory
`ValidationTool`.
+
+To run the `ValidationTool` it is necessary to have the shared interfaces
and domain types available on the classpath. The binary names of the
RequestFactory interfaces are provided to the tool as well as an output
location, which may be a directory or a jar file. The tool will produce
one or more class files that contain precomputed metadata that will be used
by the RequestFactory server code.
+{{{
+#!/bin/sh
+java \
+ -cp
requestfactory-apt.jar:requestfactory-server.jar:your-shared-classes.jar:your-server-classes.jar
\
+ com.google.web.bindery.requestfactory.apt.ValidationTool \
+ /path/to/output.jar \
+ com.example.shared.MyRequestFactory \
+ com.example.shared.AnotherRequestFactory
+}}}
+
+An optional client-only mode will produce the metadata required by
JVM-based RequestFactory clients using only the shared interfaces. This
mode is activated by adding a `-client` flag before the output location.
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors