ebook img

Google App Engine Java and GWT Application Development PDF

480 Pages·2010·7.9 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Google App Engine Java and GWT Application Development

Google App Engine Java and GWT Application Development Build powerful, scalable, and interactive web applications in the cloud Daniel Guermeur Amy Unruh Google App Engine Java and GWT Application Development Copyright © 2010 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: November 2010 Production Reference: 1161110 Published by Packt Publishing Ltd. 32 Lincoln Road Olton Birmingham, B27 6PA, UK. ISBN 978-1-849690-44-7 www.packtpub.com Cover Image by Sujay Gawand ([email protected]) Credits Authors Editorial Team Leader Daniel Guermeur Aditya Belpathak Amy Unruh Project Team Leader Lata Basantani Reviewers Dom Derrien Yağız Erkan Project Coordinator Vincila Colaco Samuel Goebert Ravi Sharma Indexers Monica Ajmera Mehta Acquisition Editor Rekha Nair David Barnes Proofreader Development Editor Kevin McGowan Hyacintha D'Souza Graphics Technical Editors Geetanjali Sawant Paramanand N.Bhat Namita Sahni Production Coordinator Arvindkumar Gupta Copy Editor Laxmi Subramanian Cover Work Arvindkumar Gupta About the Authors Daniel Guermeur is the founder and CEO of Metadot Corporation. He holds a Diplome d'Ingenieur of Informatique from University of Technology of Compiegne (France) as well as a Master in Photonics from Ecole Nationale Superieure de Physique of Strasbourg (France). Before starting Metadot in 2000, he worked for oil services companies including giant Schlumberger Ltd where he was in charge of improving the worldwide IT infrastructure. He has been developing large scale database-backed web applications since the very beginning of the democratization of the Internet in 1995, including an open source software content management system Metadot Portal Server, Mojo Helpdesk, a web- based customer support application and Montastic, a popular website monitor service. Thank you to my daughter Alexandra Guermeur and Cheryl Ridall for their love and continuous support while writing this book. This meant a lot to me. Cheryl, I miss you. Amy Unruh currently does technology training and course development, with a focus on web technologies. Previously, she has been a Research Fellow at the University of Melbourne, where she taught web technologies and researched robust distributed agent systems. She has worked at several startups, building web applications using a variety of languages; served as adjunct faculty at the University of Texas; and was a member of the Distributed Agents Program at MCC. She received her Ph.D. in CS/AI from Stanford University, in the area of AI planning, and has a BS degree in CS from UCSB. She has numerous publications, and has co-edited a book on Safety and Security in Multiagent Systems. Thanks to Moon, and to Wesley and Eleanor Unruh, without whose love and support this book would not have been possible. And thanks also to Daniel, for getting us started! About the Reviewers Dom Derrien joined AnotherSocialEconomy.com (ASE) as co-founder after having worked for more than 15 years in the software development area. Dom's responsibilities in ASE cover the architecture definition of its communication engine and respective connectors enabling its multi-channel interfaces like e-mail, Twitter, Facebook, Android, Adobe AIR, and others. Dom is also in charge of defining the ASE public API (REST-based). He produces the vast majority of code and corresponding tests for the implementation ported on Google App Engine. Dom also coordinates the work of other contributors working on specific connectors as well as reviewing web materials and contributing to pre-sales consulting, the internal community site and business decision-making. Prior to ASE, Dom worked for Compuware Corporation as Technical Consultant in the Web application and Mobile application domains, to bootstrap new projects in the Vantage product line. Before joining Compuware, as a Software Architect, he worked on the development of a Web 2.0 client for Rational Portfolio Manager enterprise project management server, at IBM Canada. Dom also worked at Oracle Canada, as a Senior Developer, in the Oracle Collaboration Suite team, to build its first Web 2.0 client, just at the time the corresponding technology was emerging. Aside from his protected work for ASE, Dom shares some projects on github.com to give back materials to the open source community (like a library for Amazon FPS on GAE, utilities for internationalized Web applications, and others) and publishes his own blog at domderrien.blogspot.com. Dom is also active in the Diku Dilenga organization which aims to bring microfinance services to the poorest in the Democratic Republic of the Congo. His dream is to connect ASE to Diku Dilenga, to use modern communication technologies at the service of microentrepreneurs. Also important in his life is his family – his wife and two sons. They all enjoy their peaceful life in Montreal, Quebec, Canada, and their practice of karate, Chito-Ryu style. Yağız Erkan is the Chief Technical Architect with DeCare Systems Ireland, an Ireland-based software development company building highly-scalable, large enterprise systems and retail sites. Before taking on an architectural role, he worked as a software engineer for various companies in France. Yağız studied in Galatasaray High School in Istanbul, Turkey, then he obtained his MSc in Computer Science in Université Claude Bernard in Lyon, France. After working several years as a software engineer in Lyon, he moved to Ireland and joined DeCare Systems Ireland as a Technical Architect in 2000. He currently leads a team of hands-on architects who ensure the most up-to-date and suitable practices, technologies and tools are utilized, leading to the delivery of high quality applications and solutions. Even though Yağız's background is mainly Java and Web technologies, he has worked on Microsoft .NET and mobile (iPhone and Android) projects. He has already been mentioned in various books as a reviewer and he keeps an on-line presence through blogging and social networking. Samuel Goebert is a computer science master student at the University of Applied Sciences Darmstadt, Germany. Goebert has over 7 years of experience in web related development and associated technologies. In his role as technology consultant for bigcurl (http://www.bigcurl.de) Goebert is responsible for the overall design and execution of various products from conception to launch including web applications, mobile applications, intranet tools and custom API's. He wrote his award winning bachelor thesis about scalable data delivery in local area networks at Apple Inc. in California, which also awarded him with a students scholarship from 2006 until 2009. Goebert holds a Diploma from the School of Audio Engineering and received a bachelors degree from the University of Applied Sciences Darmstadt, Germany in Computer Science. He is currently working on receiving his master degree in Computer Science in the field of restoring communications for the population of post disaster areas with autonomously deploying cell phone towers. Ravi Sharma has a B.Tech (Computer Science) from Y.M.C.A Institute of Engineering, Faridabad and has worked in banking and higher studies. He has 8 years of experience in java especially low latency applications.He runs his own company, NextInfotech (www.nextinfotech.com) and also works as a consultant. Table of Contents Preface 1 Chapter 1: Introduction 7 Overview of the chapter 8 Introduction to Google App Engine 8 The Datastore 9 App Engine's scalable services 9 Java App Engine runtime and the application development environment 10 GAE/J and the Eclipse IDE 10 App Engine application hosting 11 App Engine "surprises" for new developers 11 Introduction to GWT 12 GWT UI support 13 Other GWT features 14 GWT's RPC API 14 GWT with GAE 14 The GWT/GAE Eclipse plugin 15 GWT support for Java 15 Recommended GWT background 16 Example application: Connectr 16 A look ahead 19 Online resources 19 GAE and GWT galleries 20 Documentation, blogs, and discussion groups 20 Summary 21 Chapter 2: Using Eclipse and the Google Plugin 23 Installing the plugin and supporting software 24 Installing the Java SDK 24 Installing Java on Mac OS X 25 Installing Java on other platforms 26 Table of Contents Installing Eclipse 26 Installing the Google plugin 26 Updating the Google plugin 28 Developing your application in Eclipse 29 Creating a new web application project in Eclipse 29 First look: The anatomy of a web application project 30 The Google plugin wizards and helpers 33 Running and debugging your application 34 Running your application in Development Mode 35 Developing the application in debug mode 35 Development Mode and the GWT browser plugin 36 Defining a run or debug configuration 38 Debugging 38 Compiling your GWT code for production mode 40 Deploying your application 41 Registering and setting an application ID for your application 41 How to set the application ID and version for a project 43 Uploading and deploying your application 44 Your App Engine Admin Console 45 Importing an existing application 46 Adding the Google SDKs to your project's build path 47 Adding third-party JAR files 47 Managing multiple Google SDKs 48 Running Google's demo apps in Eclipse 48 Summary 49 Chapter 3: Building the Connectr User Interface with GWT 51 Installing the (first version of) the Connectr project in Eclipse 52 AJAX and its benefits 56 Why AJAX apps are the way forward 56 AJAX apps minimize traffic and workload both on the client and the server 57 Challenges associated with AJAX programming and how GWT solves them 58 JavaScript browser's implementation is not consistent 59 Mastering JavaScript—an uphill battle 60 How GWT comes to the rescue to make developers more efficient 61 Google Web Toolkit overview—modern tools for modern developers 62 GWT user interface building blocks 63 Building the Connectr application—the user interface 64 User interface design elements of Connectr 65 Coding the Connectr user interface 66 Introducing UiBinder to increase productivity 66 Declarative UiBinder versus procedural Java—let's compare 67 [ ii ] Table of Contents Implementing the application layout with UiBinder 70 Tying the view to the Java code 73 Adding custom widgets to UiBinder 74 Adding CSS styles to the application 75 Implementing CSS styles in a global CSS file 77 Adding a logo to the application 77 Catching mouse and keyboard events 78 Grouping CSS files and images for faster speed with ClientBundle 79 Creating a ClientBundle 80 Using image resources in Connectr 81 Automatically checking CSS styles at compile time with CssResource 82 Getting data from the server using GWT RPC 82 Creating the login service 83 Implementing the server-side login service 84 Creating the asynchronous interface 85 Invoking the login service 85 Catching exceptions 86 Summary 87 Chapter 4: Persisting Data: The App Engine Datastore 89 Introduction 89 The Connectr server-side object model 90 The Datastore 91 Datastore entities and their properties 91 Entity keys 93 Datastore queries and indexes 94 Queries are supported by indexes 94 App Engine queries are fast 95 The Datastore versus a relational database 95 JDO 96 Setting up JDO 97 Creating Connectr's data models 97 The PersistenceManager and the PersistenceManagerFactory 98 Making data classes persistable 99 Class and field annotations 99 Persistable field types 101 Core value types 102 Collections and multi-valued properties 103 Datastore keys and JDO key fields 105 Defining keys and core value type fields for Friend and UserAccount 109 Referencing complex objects 111 Serializable objects and serialized fields 112 Embedded classes 115 [ iii ]

Description:
This is a practical guide with a step-by-step approach that builds an application in stages. Each stage of the application is used along with screenshots to introduce or develop your understanding of how to write powerful GAE applications. If you are a developer with prior programming experience of
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.