Google App Engine for Java (GAE/J)
What is Google App Engine? Google offers a cloud computing infrastructure calledgoogle App Engine(App Engine) for creating and running web applications. App Engine allows the dynamic allocation of system resources for an application based on the actual demand. supports Python and Java based applications. includes Java Virtual Machine (JVM) based languages, e.g.groovyorscala. We focus on App Engine for Java (GAE/J)
Why App Engine? Easy to get Started Automatic scalability The reliability, performance and security of Google's infrastructure Cost efficient hosting Risk free trial period
Deploying to Google App Engine Get started with App Engine Deploy the application to App Engine Personalize the application with the User Service Store data in the datastore
Sign up for an App Engine account Sign upfor an App Engine account. After your account is activated, sign in and create an application. Make a note of the application ID you choose because you will need this information when you configure the StockWatcherproject. After you've finished with this tutorial you will be able to reuse this application ID for other applications
Get started with App Engine Set up project (not the PRC version) In the File menu, select the Import... menu option. Select the import source General > Existing Projects into Workspace. Click the Next button. At "Select root directory", browse to and select the StockWatcherdirectory (from the unzipped file). Click the Finish button. Add the Google Web Toolkit and App Engine functionality to your newly created project (right-click on your project > Google > Web Toolkit / App Engine Settings...). This will add Google Pluginfunctionality to your project as well as copy required libraries to your projectweb-inf/lib directory automatically.
Debug If you add App Engine to your project and the project has a war/web-inf folder, you should get a problem marker telling you that it is missing. If you open up the Problems View in Eclipse (Window > Show View > Problems), select the problem "The appengine-web.xml file does not exist" and hit CTRL+1 (Quick Fix), the pluginwill create the file for you. You can look at http://code.google.com/eclipse/docs/project_vali dations.htmlfor more information.
Test locally We will run the application in GWT development mode to verify the project was set up successfully. However, instead of using the servletcontainer which comes with GWT, the application will run in the App Engine development server, the servlet container which comes with the App Engine SDK. What's the difference? The App Engine development server is configured to mimic the App Engine production environment.
Deploy the application to App Engine
Deploy the application to App Engine In the Package Explorer view, select the StockWatcher project. In the toolbar, click the Deploy App Engine Project button. (First time only) Click the "App Engine project settings..." link to specify your application ID. Click the OK button when you're finished. Enter your Google Accounts email and password. Click the Deploy button. You can watch the deployment progress in the Eclipse Console.
Test on App Engine Test your uploaded application by opening a web browser to http://application-id.appspot.com/ whereapplication-idis the App Engine application ID that you created earlier. The StockWatcherapplication is now running on App Engine under your application ID.
Personalize the application with the User Service Use the App Engine User API to add user login to the application. To implement login functionality we'll use the User Serivce. With this service in place, any user with a Google Account will be able to login using their account to access the StockWatcher application.
Define the Login RPC service LoginInfoobject which will contain the login info from the User service
Once they log in, the App Engine container will know where to redirect the user based on the requesturi
Update the StockWatcherUI we are requiring user login, we have to change the loading logic a bit