cYAn YellOW mAgenTA BlAcK PAnTOne 123 c BOOKs fOR PROfessIOnAls BY PROfessIOnAls® The eXPeRT’s VOIce® In clOud cOmPuTIng Companion eBook Available Beginning Java Google App ™ Beginning Engine FPO J Dear Reader, a Cloud computing is becoming a model of choice for many developers like Beginning yourself. This book gives you the keys to Google App Engine, which is a major v Cloud platform for JavaTM. We’ll show you all the core components of the SDK, a Kyle Roche the platform, and the services that Google provides – the essentials for building Java Google a web application on App Engine. ™ You'll learn how to put App Engine to work quickly, starting with the Google ™ Plugin for Eclipse and moving on to the development server, the datastore, Java G Data Objects (JDO), and Persistence as a Service. Then we'll show you how to use Spring as a Service for transaction, data access, and more. You'll see how you can o create Ajax applications with Google Web Toolkit, and how to build Web apps that even integrate with Salesforce.com and Google Wave. And once your app is up o App Engine and running, you'll learn how to monitor, manage, and maintain it. Beginning Java™ Google App Engine gives you a complete guided tour of g Google App Engine. Once you’ve read this book, you’ll be able to implement l your next big project with this exciting new platform, with the knowledge and e skills you’ve gained from this book as your foundation. Jeff Douglas Kyle Roche and Jeff Douglas A p p THE APRESS ROADMAP Learn about the core components of the Google PlaBtefogrimnn iwnigth J Gavlaas™sF iEsEh ™6 3 GoBoegglien nAipnpg EJnagvianTeM Pro Scala E App Engine SDK, platform, and services for web Companion eBook n developers using JavaTM technology Beginning Groovy The Definitive Guide to Grails, Pro Hadoop and Grails Second Edition g The Definitive Guide to Lift: Beginning Scala A Scala-based i See last page for details Web Framework n on $10 eBook version e SOURCE CODE ONLINE www.apress.com D Kyle Roche and Jeff Douglas oR u ISBN 978-1-4302-2553-9 o g US $44.99 54499 lach se Shelve in: Web Development / Programming Languages / Java User level: 9 781430 225539 Beginner to Intermediate this print for content only—size & color not accurate 7.5 x 9.25 spine = x.xxx" xxx page count Download at WoweBook.Com ™ Beginning Java Google App Engine ■ ■ ■ Kyle Roche Jeff Douglas Download at WoweBook.Com Beginning Java™ Google App Engine Copyright © 2009 by Kyle Roche and Jeff Douglas All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN-13 (pbk): 978-1-4302-2553-9 ISBN-13 (electronic): 978-1-4302-2554-6 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. President and Publisher: Paul Manning Lead Editor: Steve Anglin Developmental Editor: Tom Welsh Technical Reviewer: Kunal Mittal Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell, Jonathan Gennick, Jonathan Hassell, Michelle Lowman, Matthew Moodie, Duncan Parkes, Jeffrey Pepper, Frank Pohlmann, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Coordinating Editor: Kelly Moritz Copy Editor: Jill Steinberg Composition: ContentWorks, Inc. Indexer: BIM Indexing & Proofreading Services Artist: April Milne Cover Designer: Anna Ishchenko Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail [email protected], or visit http://www.springeronline.com. For information on translations, please e-mail [email protected], or visit http://www.apress.com. Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at http://www.apress.com/info/bulksales. The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. The source code for this book is available to readers at http://www.apress.com. You will need to answer questions pertaining to this book in order to successfully download the code. Download at WoweBook.Com There’s an Irish saying . . . no man can prosper without his woman’s leave. —KR To Cathy, who has touched not only my heart, but the hearts of so many that will never remember her. I love you. —JD Download at WoweBook.Com Download at WoweBook.Com Contents at a Glance Foreword.................................................................................................................xiii About the Authors.....................................................................................................xv About the Technical Reviewer................................................................................xvii Acknowledgments...................................................................................................xix Introduction.............................................................................................................xxi Chapter 1: Beginning Google App Engine for Java....................................................1 Chapter 2: Introduction to App Engine.......................................................................7 Chapter 3: Getting Started with Google App Engine for Java...................................25 Chapter 4: Servlet Container and Frameworks........................................................43 Chapter 5: Developing Your Application...................................................................89 Chapter 6: Authenticating Users.............................................................................123 Chapter 7: Using the App Engine Datastore............................................................135 Chapter 8: App Engine Services.............................................................................169 Chapter 9: Administration and Integration.............................................................197 Index.......................................................................................................................221 v Download at WoweBook.Com vi Download at WoweBook.Com Contents Foreword.................................................................................................................xiii About the Authors.....................................................................................................xv About the Technical Reviewer................................................................................xvii Acknowledgments...................................................................................................xix Introduction.............................................................................................................xxi Chapter 1: Beginning Google App Engine for Java....................................................1 Cloud Computing and App Engine.................................................................................................................1 Find More Time to Innovate......................................................................................................................4 What You’ll Learn in This Book.................................................................................................................5 Summary.......................................................................................................................................................6 Chapter 2: Introduction to App Engine.......................................................................7 App Engine Architecture................................................................................................................................7 Being a Good Neighbor With Quotas..............................................................................................................9 Billable and Fixed Quotas.......................................................................................................................10 Detailed Resource Quotas......................................................................................................................12 Components of an App Engine Application..................................................................................................22 Summary.....................................................................................................................................................23 Chapter 3: Getting Started with Google App Engine for Java...................................25 Where Do We Start?....................................................................................................................................25 Create Your First App Engine Project...........................................................................................................30 Local Development Server...........................................................................................................................37 Summary.....................................................................................................................................................42 vii Download at WoweBook.Com ■ CONTENTS Chapter 4: Servlet Container and Frameworks........................................................43 Choosing a Framework................................................................................................................................43 Servlets and JavaServer Pages...................................................................................................................46 Views......................................................................................................................................................46 Model......................................................................................................................................................59 Controller................................................................................................................................................64 Deployment Descriptor...........................................................................................................................69 PersistenceManager...............................................................................................................................69 Spring MVC..................................................................................................................................................70 Server Configuration...............................................................................................................................71 Views......................................................................................................................................................72 Adobe Flex...................................................................................................................................................74 Server Configuration...............................................................................................................................76 Client-Side Code.....................................................................................................................................79 Server-Side Code....................................................................................................................................83 Summary.....................................................................................................................................................88 Chapter 5: Developing Your Application...................................................................89 Functional Specifications............................................................................................................................89 Timecard UI Mock-up.............................................................................................................................90 Technical Specifications..............................................................................................................................91 Authentication........................................................................................................................................91 Presentation...........................................................................................................................................91 Persistence.............................................................................................................................................92 Using Google Web Toolkit............................................................................................................................92 Creating Your Project..............................................................................................................................93 Running the Initial Starter Application....................................................................................................96 Developing Your Application........................................................................................................................97 Required Imports..................................................................................................................................101 Coding Your UI......................................................................................................................................102 viii Download at WoweBook.Com
Description: