Pages

The Book: GAE and GWT App Development

Google App Engine Java and GWT Application Development

This book is designed to give developers all the information they need to develop their own GAE+GWT applications, with a particular focus on some of the technologies useful for building scalable social-media-oriented applications. It is an easy-to-follow guide that shows you how to get the most out of combining the powerful features of GAE and GWT. It provides you with solutions to many of the problems that arise in developing, maintaining, and scaling web applications.

Over the course of the book, you are guided by the development of a sample application using the Google Web Toolkit (GWT) and App Engine. To make things easier for you, all application building blocks are explained in detail, walking you through the development process step by step.

Chapter 1, Introduction, introduces the approaches and technology covered in the book, and discusses what lies ahead.

Chapter 2, Using Eclipse and the Google Plugin, describes the basics of setting up a project using the Eclipse IDE and Google's GWT/GAE plugin. Topics include defining, compiling and running an Eclipse GWT/GAE project, and using the GWT developer browser plugin with the interactive debugger. The chapter also covers how to set up an App Engine account and create applications, and how to deploy an app to App Engine and access its Admin Console.

Chapter 3, Building The Connectr User Interface with GWT, focuses on GWT, and building the fi rst iteration of the Connectr application's frontend. The chapter looks at how to specify widgets, with a focus on declarative specification using GWT's UIBinder and using the GWT RPC API for server-side communication.

Chapter 4, Persisting Data: The App Engine Datastore, covers Datastore basics. In the process, the first iteration of Connectr's server-side functionality is built. The chapter looks at how the Datastore works, and the implications of its design for your data models and code development. It covers how to use Java Data Objects (JDO) as an interface to the Datastore and how to persist and retrieve Datastore entities.

Chapter 5, JDO Object Relationships and Queries, builds on the topics of Chapter 4. It describes how to build and manage JDO objects that have relationships to each other, such as one-to-many and one-to-one parent-child relationships. It also covers how to query the Datastore, and the important role that Datastore indexes play in this process.

Chapter 6, Implementing MVP, an Event Bus and Other GWT Patterns, builds on the client-side code of Chapter 3, and shows how to make the frontend code modular and extensible. It accomplishes this via use of the MVP (Model-View-Presenter) and Event Bus design patterns, history/bookmark management, and an RPC abstraction, which supports call retries and progress indicators.

Chapter 7, Background Processing and Feed Management, centers on defining and running decoupled backend asynchronous tasks. In the process, the chapter introduces several App Engine services, including URLFetch and Task Queues, shows the use of Query Cursors to distribute Datastore-related processing across multiple Tasks, and introduces the use of Java Servlets and the incorporation of third-party libraries in a deployed application.

Chapter 8, Authentication using Twitter and Facebook OAuth and Google Accounts, adds authentication, login, and account functionality to Connectr, allowing it to support multiple users. The chapter demonstrates the use of both the Google Accounts API and the OAuth protocol for creating user accounts.

Chapter 9, Robustness and Scalability: Transactions, Memcache, and Datastore Design, delves into more advanced Datastore-related topics. The chapter investigates Datastore- related means of increasing the robustness, speed, and scalability of an App Engine app, including several ways to design data classes for scalability and to support efficient join-like queries. The chapter also introduces App Engine transactions and Transactional Tasks and the use of Memcache, App Engine's volatile-memory key-value store.

Chapter 10, Pushing fresh content to clients with the Channel API, covers the implementation of a message push system using the App Engine Channel API, used by Connectr to keep application data streams current. The chapter describes how to open back-end channels connected to client-side socket listeners, and presents a strategy for preventing the server from pushing messages to unattended web clients.

Chapter 11, Managing and Backing Up Your App Engine Application, focuses on useful App Engine deployment strategies, and admin and tuning tools. It includes ways to quickly upload configuration fi les without redeploying your entire application and describes how to do bulk uploads and downloads of application data. The chapter also discusses tools to analyze and tune your application's behavior, and the App Engine billing model.

Chapter 12, Asynchronous Processing with Cron, Task Queue, and XMPP, finishes building the server-side part of the Connectr app. The chapter introduces the use of App Engine Cron jobs, configuration of customized Task Queues, and App Engine's XMPP service and API, which supports push notifications. The chapter shows the benefits of proactive and asynchronous updating—the behind-the scenes work that keeps Connectr's data stream fresh—and looks at how App Engine apps can both send and receive XMPP messages.

Chapter 13, Conclusion, summarizes some of the approaches and technology covered in the book, and discusses what might lie ahead.

Detailed Table of Contents

Chapter 1: Introduction

Overview of the chapter

Introduction to Google App Engine

The Datastore

Introduction to GWT

Example application: Connectr

Chapter 2: Using Eclipse and the Google Plugin

Installing the plugin and supporting software

Installing the Java SDK

Installing Java on Mac OS X

Installing Java on other platforms

Installing Eclipse

Installing the Google plugin

Updating the Google plugin

Developing your application in Eclipse

Creating a new web application project in Eclipse

First look: The anatomy of a web application project

The Google plugin wizards and helpers

Running and debugging your application

Running your application in Development Mode

Developing the application in debug mode

Development Mode and the GWT browser plugin

Defining a run or debug configuration

Debugging

Compiling your GWT code for production mode

Deploying your application

Registering and setting an application ID for your application

How to set the application ID and version for a project

Uploading and deploying your application

Your App Engine Admin Console

Importing an existing application

Adding the Google SDKs to your project's build path

Adding third-party JAR files

Managing multiple Google SDKs

Running Google's demo apps in Eclipse

Summary

Chapter 3: Building the Connectr User Interface with GWT

Installing the (first version of) the Connectr project in Eclipse

AJAX and its benefits

Why AJAX apps are the way forward

AJAX apps minimize traffic and workload both on the client and the server