Chu-Carroll, Mark C.

Code in the Cloud: Programming google app engine - Mumbai Shroff Publishers & Distributors Pvt. Ltd. 2018 - 306

Join the next wave of Web 2.0 software development in the cloud! Cloud applications are the next big shift in application development: instead of building single-user applications to run on a personal computer, new applications are being built as multi-user services that run in data centers around the world.

Code in the Cloud: Programming Google AppEngine will teach you what you need to make the shift to cloud development using Google’s AppEngine—a powerful, easy-to-use framework for developing cloud-based services.

The cloud is a platform for creating services, a new kind of application that can reach more users and provide those users with more capabilities than a desktop application ever could. Building applications as cloud services makes them scalable: cloud applications can easily and smoothly adapt from running on a single computer for a single user to running on thousands of computers for millions of users.

Code in the Cloud will teach you what a cloud service is, and how it differs from traditional applications. It shows you how to build a cloud service by taking advantage of the services that AppEngine makes available to you, and by using iterative development of a simple application to guide you through the different aspects of AppEngine development, using either Python or Java.

Through the process of working on a simple application, you’ll learn about how to build an application as a service; how to manage persistent data using AppEngine; how to build dynamic, interactive user interfaces that run in a user’s web-browser; how to manage security in a web application; and how to interact with other services running in the AppEngine cloud.

Contents
I Getting Started with Google App Engine 1

1 Introduction 3
1.1 What’s Cloud Computing? . . . . . . . . . . . . . . . 3
1.2 Cloud Computing Programming Systems . . . . . . 9
1.3 Acknowledgments . . . . . . . . . . . . . . . . . . . . 12

2 Getting Started 13
2.1 Setting Up a Google App Engine Account . . . . . . 13
2.2 Setting Up Your Development Environment . . . . . 15
2.3 Starting to Program in Python with App Engine . . 18
2.4 Monitoring Your Application . . . . . . . . . . . . . . 25

II Programming Google App Engine with Python 29

3 A First Real Cloud Application 31
3.1 The Basic Chat Application . . . . . . . . . . . . . . 31
3.2 The Basics of HTTP . . . . . . . . . . . . . . . . . . . 35
3.3 Mapping Chat into HTTP . . . . . . . . . . . . . . . . 39

4 Managing Data in the Cloud 47
4.1 Why Didn’t Chat Work? . . . . . . . . . . . . . . . . . 47
4.2 Making Chat Persistent . . . . . . . . . . . . . . . . . 50

5 Google App Engine Services for Login Authentication 59
5.1 Introducing the Users Service . . . . . . . . . . . . . 59
5.2 The Users Service . . . . . . . . . . . . . . . . . . . . 60
5.3 Integrating the Users Service into Chat . . . . . . . 61

6 Organizing Code: Separating UI and Logic 65
6.1 Getting Started with Templates . . . . . . . . . . . . 65
6.2 Building Related Views with Templates . . . . . . . 70
6.3 Multiple Chat Rooms . . . . . . . . . . . . . . . . . . 76

7 Making the UI Pretty: Templates and CSS 83
7.1 Introducing CSS . . . . . . . . . . . . . . . . . . . . . 84
7.2 Styling Text Using CSS . . . . . . . . . . . . . . . . . 85
7.3 Page Layouts Using CSS . . . . . . . . . . . . . . . . 90
7.4 Building Our Interface Using Flowed Layout . . . . 98
7.5 Including CSS Files in App Engine Applications . . 101

8 Getting Interactive 103
8.1 Interactive Web Services: The Basics . . . . . . . . . 103
8.2 The Model-View-Controller Design Pattern . . . . . 106
8.3 Talking to the Server without Disruption . . . . . . 109
8.4 References and Resources . . . . . . . . . . . . . . . 117

III Programming Google App Engine with Java 119

9 Google App Engine and Java 121
9.1 Introducing GWT . . . . . . . . . . . . . . . . . . . . 123
9.2 Getting Started with Java and GWT . . . . . . . . . 125
9.3 RPC in GWT . . . . . . . . . . . . . . . . . . . . . . . 133
9.4 Testing and Deploying with GWT . . . . . . . . . . . 138

10 Managing Server-Side Data 139
10.1 Data Persistence in Java . . . . . . . . . . . . . . . . 139
10.2 Storing Persistent Objects in GWT . . . . . . . . . . 143
10.3 Retrieving Persistent Objects in GWT . . . . . . . . . 147
10.4 Gluing the Client and the Server Together . . . . . . 149
10.5 References and Resources . . . . . . . . . . . . . . . 151

11 Building User Interfaces in Java 153
11.1 Why Use GWT? . . . . . . . . . . . . . . . . . . . . . 153
11.2 Building GWT UIs with Widgets . . . . . . . . . . . . 154
11.3 Making the UI Active: Handling Events . . . . . . . 161
11.4 Making the UI Active: Updating the Display . . . . . 166
11.5 Wrapping Up with GWT . . . . . . . . . . . . . . . . 168
11.6 References and Resources . . . . . . . . . . . . . . . 169

12 Building the Server Side of a Java Application 171
12.1 Filling in Gaps: Supporting Chat Rooms . . . . . . . 171
12.2 Proper Interactive Design: Being Incremental . . . . 176
12.3 Updating the Client . . . . . . . . . . . . . . . . . . . 184
12.4 Chat Administration . . . . . . . . . . . . . . . . . . 185
12.5 Running and Deploying the Chat Application . . . . 187
12.6 Wrapping Up the Server Side . . . . . . . . . . . . . 189

IV Advanced Google App Engine 191

13 Advanced Datastore: Property Types 193
13.1 Building a Filesystem Service . . . . . . . . . . . . . 193
13.2 Modeling the Filesystem: A First Cut . . . . . . . . . 197
13.3 Property Types Reference . . . . . . . . . . . . . . . . 214
13.4 Wrapping Up Property Types . . . . . . . . . . . . . 217

14 Advanced Datastore: Queries and Indices 219
14.1 Indices and Queries in Datastore . . . . . . . . . . . 220
14.2 More Flexible Models . . . . . . . . . . . . . . . . . . 226
14.3 Transactions, Keys, and Entity Groups . . . . . . . 227
14.4 Policy and Consistency Models . . . . . . . . . . . . 229
14.5 Incremental Retrieval . . . . . . . . . . . . . . . . . . 233

15 Google App Engine Services 235
15.1 The Memcache Service . . . . . . . . . . . . . . . . . 236
15.2 Accessing Other Stuff: The URL Fetch Service . . . 241
15.3 Communicating with People: Mail and Chat Services 242
15.4 Sending and Receiving Email . . . . . . . . . . . . . 246
15.5 Wrapping Up Services . . . . . . . . . . . . . . . . . 249

16 Server Computing in the Cloud 251
16.1 Scheduling Jobs with App Engine Cron . . . . . . . 252
16.2 Running Jobs Dynamically Using the Task Queue . 256
16.3 Wrapping Up Server Computing . . . . . . . . . . . . 262

17 Security in App Engine Services 263
17.1 What Is Security? . . . . . . . . . . . . . . . . . . . . 263
17.2 Basic Security . . . . . . . . . . . . . . . . . . . . . . 264
17.3 Advanced Security . . . . . . . . . . . . . . . . . . . 272

18 Administering Your App Engine Deployment 281
18.1 Monitoring . . . . . . . . . . . . . . . . . . . . . . . . 281
18.2 Peeking at the Datastore . . . . . . . . . . . . . . . . 285
18.3 Logs and Debugging . . . . . . . . . . . . . . . . . . 286
18.4 Managing Your Application . . . . . . . . . . . . . . 288
18.5 Paying for What You Use . . . . . . . . . . . . . . . . 289

19 Wrapping Up 291
19.1 Cloud Concepts . . . . . . . . . . . . . . . . . . . . . 291
19.2 Google App Engine Concepts . . . . . . . . . . . . . 292
19.3 Where to Go from Here . . . . . . . . . . . . . . . . . 294
19.4 References and Resources . . . . . . . . . . . . . . . 296

Index 297

978-93-5023-427-7

Allied Informatics, Jaipur


CSE
Cloud computing

005.276 / CHU