Preface |
|
1 | (6) |
|
|
7 | (16) |
|
|
8 | (1) |
|
Introduction to Google App Engine |
|
|
8 | (8) |
|
|
9 | (1) |
|
App Engine's scalable services |
|
|
9 | (1) |
|
Java App Engine runtime and the application development environment |
|
|
10 | (1) |
|
GAE/J and the Eclipse IDE |
|
|
10 | (1) |
|
App Engine application hosting |
|
|
11 | (1) |
|
App Engine "surprises" for new developers |
|
|
11 | (1) |
|
|
12 | (1) |
|
|
13 | (1) |
|
|
14 | (1) |
|
|
14 | (1) |
|
|
14 | (1) |
|
The GWT/GAE Eclipse plugin |
|
|
15 | (1) |
|
|
15 | (1) |
|
Recommended GWT background |
|
|
16 | (1) |
|
Example application: Connectr |
|
|
16 | (3) |
|
|
19 | (1) |
|
|
19 | (2) |
|
|
20 | (1) |
|
Documentation, blogs, and discussion groups |
|
|
20 | (1) |
|
|
21 | (2) |
|
Chapter 2 Using Eclipse and the Google Plugin |
|
|
23 | (28) |
|
Installing the plugin and supporting software |
|
|
24 | (5) |
|
|
24 | (1) |
|
Installing Java on Mac OS X |
|
|
25 | (1) |
|
Installing Java on other platforms |
|
|
26 | (1) |
|
|
26 | (1) |
|
Installing the Google plugin |
|
|
26 | (2) |
|
Updating the Google plugin |
|
|
28 | (1) |
|
Developing your application in Eclipse |
|
|
29 | (5) |
|
Creating a new web application project in Eclipse |
|
|
29 | (1) |
|
First look: The anatomy of a web application project |
|
|
30 | (3) |
|
The Google plugin wizards and helpers |
|
|
33 | (1) |
|
Running and debugging your application |
|
|
34 | (7) |
|
Running your application in Development Mode |
|
|
35 | (1) |
|
Developing the application in debug mode |
|
|
35 | (1) |
|
Development Mode and the GWT browser plugin |
|
|
36 | (2) |
|
Defining a run or debug configuration |
|
|
38 | (1) |
|
|
38 | (2) |
|
Compiling your GWT code for production mode |
|
|
40 | (1) |
|
Deploying your application |
|
|
41 | (5) |
|
Registering and setting an application ID for your application |
|
|
41 | (2) |
|
How to set the application ID and version for a project |
|
|
43 | (1) |
|
Uploading and deploying your application |
|
|
44 | (1) |
|
Your App Engine Admin Console |
|
|
45 | (1) |
|
Importing an existing application |
|
|
46 | (3) |
|
Adding the Google SDKs to your project's build path |
|
|
47 | (1) |
|
Adding third-party JAR files |
|
|
47 | (1) |
|
Managing multiple Google SDKs |
|
|
48 | (1) |
|
Running Google's demo apps in Eclipse |
|
|
48 | (1) |
|
|
49 | (2) |
|
Chapter 3 Building the Connectr User Interface with GWT |
|
|
51 | (38) |
|
Installing the (first version of) the Connectr project in Eclipse |
|
|
52 | (4) |
|
|
56 | (1) |
|
Why AJAX apps are the way forward |
|
|
56 | (2) |
|
AJAX apps minimize traffic and workload both on the client and the server |
|
|
57 | (1) |
|
Challenges associated with AJAX programming and how GWT solves them |
|
|
58 | (4) |
|
JavaScript browser's implementation is not consistent |
|
|
59 | (1) |
|
Mastering JavaScript---an uphill battle |
|
|
60 | (1) |
|
How GWT comes to the rescue to make developers more efficient |
|
|
61 | (1) |
|
Google Web Toolkit overview---modern tools for modern developers |
|
|
62 | (2) |
|
GWT user interface building blocks |
|
|
63 | (1) |
|
Building the Connectr application---the user interface |
|
|
64 | (15) |
|
User interface design elements of Connectr |
|
|
65 | (1) |
|
Coding the Connectr user interface |
|
|
66 | (1) |
|
Introducing UiBinder to increase productivity |
|
|
66 | (1) |
|
Declarative UiBinder versus procedural Java---let's compare |
|
|
67 | (3) |
|
Implementing the application layout with UiBinder |
|
|
70 | (3) |
|
Tying the view to the Java code |
|
|
73 | (1) |
|
Adding custom widgets to UiBinder |
|
|
74 | (1) |
|
Adding CSS styles to the application |
|
|
75 | (2) |
|
Implementing CSS styles in a global CSS file |
|
|
77 | (1) |
|
Adding a logo to the application |
|
|
77 | (1) |
|
Catching mouse and keyboard events |
|
|
78 | (1) |
|
Grouping CSS files and images for faster speed with ClientBundle |
|
|
79 | (3) |
|
|
80 | (1) |
|
Using image resources in Connectr |
|
|
81 | (1) |
|
Automatically checking CSS styles at compile time with CssResource |
|
|
82 | (1) |
|
Getting data from the server using GWT RPC |
|
|
82 | (5) |
|
Creating the login service |
|
|
83 | (1) |
|
Implementing the server-side login service |
|
|
84 | (1) |
|
Creating the asynchronous interface |
|
|
85 | (1) |
|
Invoking the login service |
|
|
85 | (1) |
|
|
86 | (1) |
|
|
87 | (2) |
|
Chapter 4 Persisting Data: The App Engine Datastore |
|
|
89 | (52) |
|
|
89 | (2) |
|
The Connectr server-side object model |
|
|
90 | (1) |
|
|
91 | (5) |
|
Datastore entities and their properties |
|
|
91 | (2) |
|
|
93 | (1) |
|
Datastore queries and indexes |
|
|
94 | (1) |
|
Queries are supported by indexes |
|
|
94 | (1) |
|
App Engine queries are fast |
|
|
95 | (1) |
|
The Datastore versus a relational database |
|
|
95 | (1) |
|
|
96 | (1) |
|
|
97 | (1) |
|
Creating Connectr's data models |
|
|
97 | (37) |
|
The PersistenceManager and the PersistenceManagerFactory |
|
|
98 | (1) |
|
Making data classes persistable |
|
|
99 | (1) |
|
Class and field annotations |
|
|
99 | (2) |
|
|
101 | (1) |
|
|
102 | (1) |
|
Collections and multi-valued properties |
|
|
103 | (2) |
|
Datastore keys and JDO key fields |
|
|
105 | (4) |
|
Defining keys and core value type fields for Friend and UserAccount |
|
|
109 | (2) |
|
Referencing complex objects |
|
|
111 | (1) |
|
Serializable objects and serialized fields |
|
|
112 | (3) |
|
|
115 | (2) |
|
|
117 | (2) |
|
Saving, updating, and deleting data objects |
|
|
119 | (1) |
|
|
119 | (1) |
|
Fetching a persisted object by its key |
|
|
120 | (1) |
|
Deleting a persisted object |
|
|
121 | (1) |
|
An object has an associated PersistenceManager |
|
|
121 | (1) |
|
|
122 | (1) |
|
Connectr example: creating and modifying UserAccount and Friend data objects |
|
|
123 | (1) |
|
Creating new Friend objects |
|
|
124 | (2) |
|
|
126 | (1) |
|
Fetching a list of Friend objects using the key list |
|
|
126 | (1) |
|
|
127 | (2) |
|
Detached Data Access Objects and Data Transfer Objects |
|
|
129 | (1) |
|
DTOs in the Connectr application |
|
|
130 | (4) |
|
|
134 | (5) |
|
The local development console |
|
|
134 | (2) |
|
|
136 | (1) |
|
Browsing the App Engine Datastore |
|
|
136 | (2) |
|
Viewing application data statistics |
|
|
138 | (1) |
|
|
139 | (1) |
|
|
140 | (1) |
|
Chapter 5 JDO Object Relationships and Queries |
|
|
141 | (36) |
|
Modeling relationships between objects |
|
|
141 | (10) |
|
Owned relationships and entity groups |
|
|
143 | (1) |
|
Uni-directional owned relationships |
|
|
144 | (1) |
|
Supporting uni-directional owned relationships in Connectr |
|
|
144 | (3) |
|
|
147 | (1) |
|
Bi-directional owned relationships |
|
|
148 | (1) |
|
Bi-directional one-to-one relationship |
|
|
148 | (1) |
|
Bi-directional one-to-many relationship |
|
|
149 | (1) |
|
One-to-many Collection ordering |
|
|
150 | (1) |
|
|
150 | (1) |
|
Finding objects---queries and indexes |
|
|
151 | (14) |
|
Constructing JDOQL queries |
|
|
151 | (1) |
|
|
152 | (2) |
|
|
154 | (3) |
|
Query filters on fields with multiple values |
|
|
157 | (1) |
|
Query sort orders and ranges |
|
|
158 | (1) |
|
Executing a query and getting the results |
|
|
159 | (1) |
|
|
159 | (3) |
|
Unset and unindexed entity fields |
|
|
162 | (1) |
|
|
163 | (1) |
|
Batch fetches using a list of keys |
|
|
164 | (1) |
|
|
164 | (1) |
|
Extents: fetching all objects of a particular kind |
|
|
165 | (1) |
|
The App Engine Datastore index |
|
|
165 | (10) |
|
Automatically-generated indexes |
|
|
166 | (2) |
|
|
168 | (1) |
|
Revisiting constraints on queries |
|
|
169 | (1) |
|
|
170 | (1) |
|
Using the Admin Console Datastore index viewer and index vacuuming |
|
|
170 | (3) |
|
Side-stepping query constraints |
|
|
173 | (1) |
|
Pre-persist callbacks---normalizing Friend name information |
|
|
174 | (1) |
|
|
175 | (2) |
|
Chapter 6 Implementing MVP, an Event Bus, and Other GWT Patterns |
|
|
177 | (40) |
|
Introducing MVP - The need for design patterns in software |
|
|
178 | (1) |
|
|
179 | (1) |
|
|
179 | (1) |
|
|
179 | (1) |
|
|
180 | (1) |
|
Connectr MVP application architecture overview |
|
|
180 | (1) |
|
Package and file organization |
|
|
181 | (1) |
|
|
181 | (10) |
|
Starting up the application |
|
|
182 | (1) |
|
|
183 | (1) |
|
Populating the Friend list view |
|
|
184 | (1) |
|
Responding to user interface events |
|
|
185 | (2) |
|
Listening to the event bus |
|
|
187 | (1) |
|
Integrating UiBinder views into MVP |
|
|
188 | (3) |
|
|
191 | (2) |
|
Creating a custom event class |
|
|
192 | (1) |
|
Adding an application controller |
|
|
193 | (1) |
|
Adding support for browser history |
|
|
193 | (1) |
|
Introducing the browser history stack and navigation tokens |
|
|
194 | (1) |
|
Implementing browser history management |
|
|
194 | (2) |
|
Bootstrapping the browser history at application startup |
|
|
196 | (1) |
|
Centralizing RPC calls for better handling and usability and reliability |
|
|
196 | (7) |
|
Introducing an encompassing RPC class |
|
|
197 | (1) |
|
Displaying a loading indicator when the app is busy |
|
|
198 | (2) |
|
Catching server exceptions |
|
|
200 | (2) |
|
Retrying a call after failure |
|
|
202 | (1) |
|
|
202 | (1) |
|
MVP Development with Activities and Places |
|
|
203 | (13) |
|
Building a basic application |
|
|
204 | (1) |
|
Traditional MVP versus MVP with Activities and Places |
|
|
205 | (1) |
|
Moving parts of ProfileMVP |
|
|
205 | (1) |
|
|
205 | (2) |
|
Places and the Place History Mapper |
|
|
207 | (1) |
|
|
208 | (3) |
|
|
211 | (2) |
|
Adding deferred binding for iPhone and Android views |
|
|
213 | (1) |
|
|
214 | (1) |
|
Putting the pieces together: the onModuleLoad method |
|
|
215 | (1) |
|
|
216 | (1) |
|
Chapter 7 Background Processing and Feed Management |
|
|
217 | (62) |
|
|
218 | (1) |
|
Using Servlets in App Engine |
|
|
218 | (9) |
|
Making your Servlets accessible---the deployment descriptor |
|
|
219 | (1) |
|
|
220 | (1) |
|
Servlet requests and responses |
|
|
221 | (1) |
|
|
222 | (1) |
|
App Engine Servlet limitations |
|
|
223 | (1) |
|
Restricting access to a Servlet |
|
|
223 | (2) |
|
|
225 | (1) |
|
The JRE whitelist and system restrictions |
|
|
226 | (1) |
|
Accessing static application files |
|
|
226 | (1) |
|
Using migrations to evolve the Datastore entities |
|
|
227 | (13) |
|
Removing a field from a JDO data class definition |
|
|
228 | (1) |
|
Adding a field to a JDO data class definition |
|
|
229 | (1) |
|
Facilitating "schema" transitions via migrations |
|
|
230 | (1) |
|
Approach---defining a migration |
|
|
231 | (1) |
|
|
231 | (1) |
|
Implementing a Migration: The FriendMigration class |
|
|
232 | (3) |
|
Running the Migration: A Migration Servlet and the Task Queue |
|
|
235 | (3) |
|
Invoking the Servlet as a web request |
|
|
238 | (1) |
|
Servlet admin authentication |
|
|
239 | (1) |
|
Pulling in Feeds: The URL Fetch service |
|
|
240 | (9) |
|
|
240 | (1) |
|
|
241 | (1) |
|
Java support for URL Fetch |
|
|
242 | (1) |
|
Using java.net.URL Connection |
|
|
242 | (1) |
|
|
243 | (1) |
|
Using HTTP(S) URL Connection objects |
|
|
243 | (3) |
|
The "low-level" Java URL Fetch API |
|
|
246 | (1) |
|
The ROME and ROME Fetcher RSS/Atom libraries |
|
|
246 | (1) |
|
Downloading the ROME and ROME Fetcher jars and their dependencies |
|
|
247 | (1) |
|
Installing the library JAR files |
|
|
248 | (1) |
|
Using RSS/Atom feeds in the Connectr app |
|
|
249 | (16) |
|
|
249 | (1) |
|
|
250 | (5) |
|
Adding and removing friend feeds |
|
|
255 | (4) |
|
Fetching and updating feeds |
|
|
259 | (2) |
|
Subclassing the ROME Fetcher HttpURLFeedFetcher class |
|
|
261 | (3) |
|
Processing changes to Friend URLs |
|
|
264 | (1) |
|
Enabling background feed updating and processing |
|
|
265 | (13) |
|
Add some test feeds to your app |
|
|
266 | (1) |
|
Updating the most recently requested FeedInfo objects |
|
|
267 | (2) |
|
The FeedUpdateServlet mapping |
|
|
269 | (1) |
|
Using an admin-only Servlet URL for the feed update job |
|
|
270 | (1) |
|
Updating all feeds for the Friends of a UserAccount |
|
|
271 | (4) |
|
Updating the feeds for a specific Friend |
|
|
275 | (2) |
|
A simple Servlet to display feed contents |
|
|
277 | (1) |
|
|
278 | (1) |
|
Chapter 8 Authentication using Twitter, Facebook OAuth, and Google Accounts |
|
|
279 | (30) |
|
Connectr login implementation |
|
|
280 | (4) |
|
Step-by-step implementation of the login sequence |
|
|
281 | (3) |
|
OAuth: a new way to login and authorize |
|
|
284 | (1) |
|
Integrating with Facebook |
|
|
284 | (1) |
|
Registering Connectr with Facebook |
|
|
284 | (8) |
|
Authenticating with Facebook OAuth |
|
|
286 | (5) |
|
Integrating Connectr inside Facebook |
|
|
291 | (1) |
|
Authenticating against Google |
|
|
292 | (3) |
|
Authenticating against Twitter with OAuth |
|
|
295 | (4) |
|
Registering Connectr with Twitter |
|
|
295 | (2) |
|
Introducing the Twitter login Servlet |
|
|
297 | (1) |
|
Analyzing the Twitter callback Servlet |
|
|
298 | (1) |
|
|
299 | (5) |
|
Logging out when authenticating against Google or Twitter |
|
|
300 | (2) |
|
|
302 | (2) |
|
Uniquely identifying Connectr users |
|
|
304 | (1) |
|
Automatically registering users when they login |
|
|
305 | (2) |
|
|
307 | (2) |
|
Chapter 9 Robustness and Scalability: Transactions, Memcache, and Datastore Design |
|
|
309 | (40) |
|
Data modeling and scalability |
|
|
309 | (10) |
|
Reducing latency---read consistency and Datastore access deadlines |
|
|
310 | (1) |
|
Splitting big data models into multiple entities to make access more efficient |
|
|
311 | (1) |
|
|
312 | (1) |
|
Splitting a model by creating an "index" and a "data" entity |
|
|
313 | (4) |
|
Use of property lists to support "join" behavior |
|
|
317 | (1) |
|
Supporting the semantics of more complex joins |
|
|
318 | (1) |
|
|
319 | (16) |
|
Transaction commits and rollbacks |
|
|
321 | (1) |
|
Example---a JDO transaction |
|
|
321 | (1) |
|
App Engine transactions use optimistic concurrency |
|
|
322 | (1) |
|
|
322 | (1) |
|
Transactions and entity groups |
|
|
323 | (1) |
|
Creating entities in the same entity group |
|
|
324 | (2) |
|
Getting the entity parent key from the child key |
|
|
326 | (1) |
|
Entity group design considerations |
|
|
326 | (1) |
|
What you can do inside a transaction |
|
|
327 | (1) |
|
When to use a transaction |
|
|
328 | (1) |
|
Adding transactional control to the Connectr application |
|
|
328 | (1) |
|
|
329 | (6) |
|
|
335 | (13) |
|
Using the App Engine Memcache Java API in Connectr |
|
|
336 | (3) |
|
|
339 | (1) |
|
|
340 | (1) |
|
Atomic increment/decrement of Memcache values |
|
|
340 | (1) |
|
Using Memcache with JDO data objects |
|
|
340 | (2) |
|
|
342 | (1) |
|
Defining a cacheable interface |
|
|
343 | (1) |
|
The Connectr application's lifecycle listeners |
|
|
344 | (4) |
|
|
348 | (1) |
|
Chapter 10 Pushing Fresh Content to Clients with the Channel API |
|
|
349 | (14) |
|
|
349 | (1) |
|
|
350 | (1) |
|
Setting up the application to handle pushed messages |
|
|
351 | (4) |
|
Server side channel creation |
|
|
351 | (1) |
|
Under the hood of ChannelServer |
|
|
352 | (1) |
|
Preparing the GWT client for pushed messages |
|
|
353 | (1) |
|
Adding a handler to process pushed messages |
|
|
354 | (1) |
|
Pushing messages to clients |
|
|
355 | (1) |
|
Creating custom classes of pushed messages |
|
|
356 | (3) |
|
Telling the server a client is inactive |
|
|
359 | (1) |
|
Adding a refresh button to allow on-demand news updates |
|
|
360 | (1) |
|
|
361 | (2) |
|
Chapter 11 Managing and Backing Up your App Engine Application |
|
|
363 | (34) |
|
Configuration and deployment |
|
|
363 | (15) |
|
|
364 | (1) |
|
The deployment descriptor---web.xml |
|
|
364 | (4) |
|
Configuring DoS protection blacklists---dos.xml |
|
|
368 | (2) |
|
App configuration---appengine-web.xml |
|
|
370 | (5) |
|
App engine application versions |
|
|
375 | (2) |
|
|
377 | (1) |
|
|
378 | (5) |
|
Browsing an app version's logs |
|
|
378 | (2) |
|
App server startup latency |
|
|
380 | (1) |
|
|
380 | (2) |
|
Monitoring your quota levels and resource usage |
|
|
382 | (1) |
|
Application behavior when a quota is depleted |
|
|
383 | (1) |
|
Adding developers for an application |
|
|
383 | (1) |
|
Command-line administration |
|
|
383 | (6) |
|
|
383 | (1) |
|
|
384 | (1) |
|
|
384 | (1) |
|
Downloading application logs |
|
|
385 | (1) |
|
Bulk download and upload of an app's Datastore |
|
|
386 | (1) |
|
|
387 | (1) |
|
Uploading or restoring data |
|
|
388 | (1) |
|
|
389 | (2) |
|
Enabling and configuring Appstats |
|
|
389 | (1) |
|
Browsing the Appstats statistics page |
|
|
390 | (1) |
|
Using your own domain for an app |
|
|
391 | (4) |
|
|
395 | (2) |
|
Chapter 12 Asynchronous Processing with Cron, Task Queue, and XMPP |
|
|
397 | (48) |
|
|
397 | (4) |
|
|
398 | (1) |
|
What goes on behind the scenes |
|
|
399 | (2) |
|
|
401 | (1) |
|
|
401 | (5) |
|
The StreamItem persistent class |
|
|
401 | (4) |
|
|
405 | (1) |
|
|
406 | (1) |
|
Server-Side asynchronous processing |
|
|
406 | (17) |
|
|
407 | (1) |
|
|
408 | (1) |
|
Task Queue quotas and limits |
|
|
409 | (1) |
|
Monitoring tasks in the App Engine Admin Console |
|
|
410 | (1) |
|
Using application-defined Task Queues |
|
|
410 | (1) |
|
Defining a task: TaskOptions |
|
|
411 | (1) |
|
Some Task Queue design considerations |
|
|
412 | (2) |
|
|
414 | (2) |
|
Asynchronous server-side tasks in Connectr |
|
|
416 | (1) |
|
|
416 | (6) |
|
Context-Specific feed update tasks |
|
|
422 | (1) |
|
Supporting synchronous content delivery: Datastore queries and caching |
|
|
423 | (8) |
|
Making StreamItem queries fast |
|
|
424 | (1) |
|
Finding StreamItems for all Friends of a user: doing write-time work to make queries fast |
|
|
424 | (2) |
|
Filtering the StreamItems on a subset of the user's Friends: Using key paths and contains() |
|
|
426 | (4) |
|
|
430 | (1) |
|
XMPP: Information push to the app |
|
|
431 | (12) |
|
The App Engine XMPP service and API |
|
|
432 | (1) |
|
|
432 | (1) |
|
|
433 | (2) |
|
Receiving an XMPP message |
|
|
435 | (2) |
|
XMPP-related quotas and limits |
|
|
437 | (1) |
|
Setting up Connectr as an XMPP client |
|
|
437 | (1) |
|
Subscribing a Connectr app to the XMPP Breaking News Gateway App |
|
|
438 | (3) |
|
Processing the incoming XMPP notifications |
|
|
441 | (2) |
|
|
443 | (2) |
|
Chapter 13 Conclusion and Final Thoughts |
|
|
445 | (4) |
|
What lies ahead for App Engine and GWT? |
|
|
448 | (1) |
Index |
|
449 | |