Explore the Power of the Google App Engine with Eclipse
App developers can have their apps hosted by the Google App Engine (GAE) to run and test them. The engine uses the same infrastructure that is used by Google. In this well illustrated article, the author takes the reader through various features of the Go
Google App Engine (GAE) or App Engine is a public platform as a service (PaaS), one of the service models of cloud computing as defined by NIST (the US-based National Institute of Standards and Technology). GAE was developed by Google and was made available for public use in 2008. Its stable release is 1.8.2, as of July 2013. GAE is written in Python, Java, Go and PHP. It provides the facility to develop and host applications in resources managed by Google. Entry level usage has certain restrictions with free tier. App Engine provides free tier to get started. All applications can use up to 1 GB of storage, and sufficient CPU and bandwidth to support a resourceful application serving around five million page views a month.
Apart from Java, Python, Go and PHP, GAE also supports other JVM languages such as Clojure via a special version of Quercus, JRuby, Groovy and Scala, by extension. Go and PHP are not in full-fledged mode but are at the experimental phase. GAE makes it simple to build an application that is highly available and reliable, even under huge demand with vast amounts of data requests. It provides automatic scaling and load balancing, persistent storage, full support for common Web technologies, APIs for authenticating users and sending email using Google Accounts, full featured simulation of GAE on your local development environment, scheduled tasks, and task queues.
In GAE, applications run in a secure environment that provides limited access to the core resources. This sandbox isolates applications in its own highly available, reliable, secure environment that is independent of the compute resources. Only HTTP request execution is allowed Only pure-Python can be uploaded Does not support session affinity Access to virtual file systems only and read-only access
available to the filesystem on App Engine Does not support domains without www such as http:// clean-clouds.com Java applications may only use a subset of the classes from the JRE standard edition In-equality filters on two or more entity properties per query are not allowed in the datastore The minimum request processing time is 60 seconds.
SDK in GAE
App Engine provides a variety of services that help users to perform common management operations for an application such as URL Fetch, Mail, Memcache, Image Manipulation, etc. The GAE SDKs for Java, Python, PHP and Go each include a Web server application that emulates all of the GAE services such as APIs and libraries, secure sandbox environment, checks for attempts to access system resources on your local computer, tools to upload your application to GAE, etc. The Java SDK available as a Zip
file runs with Java 7. With the Eclipse IDE, Google plug-in for Eclipse can be used to create, test and upload GAE applications. The Python SDK available as a Zip file runs with Python 2.7. It is implemented in pure Python, and runs on Windows, Mac OS X and Linux. The PHP SDK available as a Zip file with PHP 5.4 runs on any platform including Windows, Mac OS X and Linux.
Setting up Eclipse and configuring a Google plug-in for Eclipse
Download the Eclipse IDE for Java EE Developers from http://www.eclipse.org/downloads/
Install the Google plug-in for Eclipse and follow instructions given at: http://code.google.com/eclipse/docs/install-eclipse3.6.html. Click Next to review the items to be installed. Then, click Next to review licences and select the radio button - I accept the terms of the Licence Agreement. And then click Finish. It will take some time to install the GAE environment in your local system. Click New to select Google and then click to select Web Application Project.
Deselect the Google Web Toolkit from the Google SDK section. Click Finish.
It is a normal Web application structure and the only difference is appengine-web.xml
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0"> <application></application> <version>1</version>
<!--
Allows App Engine to send multiple requests to one instance in parallel: --> <threadsafe>true</threadsafe> <! Configure java.util.logging > <system-properties>
<property name="java.util.logging.config.file" value="WEBINF/logging.properties"/>
</system-properties>
<!--
HTTP Sessions are disabled by default. To enable HTTP sessions specify:
<sessions-enabled>true</sessions-enabled>
It's possible to reduce request latency by configuring your application to asynchronously write HTTP session data to the datastore:
<async-session-persistence enabled="true" />
With this feature enabled, there is a very small chance your app will see stale session data. For details, see http:// code.google.com/appengine/docs/java/config/appconfig. html#Enabling_Sessions
Now just open http://localhost:8888 in the browser. Click on GAETest to run it in the local environment. Deploy Sample Hello, Open Source For You Web application on GAE.
To deploy it on GAE, authentication is required. Provide your username and password in a new window.
Accept the terms of service and privacy policies. If the application ID is not set, the deployment process will give an error: “GAETest does not have an application ID.” To create an application ID, open https://appengine.google.com log in and select Create New Application ID.
Click on Create Application. It will give the message: ‘Application Registered Successfully’ if all goes well. To proceed further, click on the project settings link in the same dialogue box.
Click OK and the application ID error will be solved. Now click on Deploy.
Once the deployment process is complete, the console output will be as shown below:
------------ Deploying frontend ------------ Preparing to deploy:
Created staging directory at: 'C:\Users\admin\ AppData\Local\Temp\appcfg1977774409461224969.tmp' Scanning for jsp files. Scanning files on local disk.
Initiating update. Cloning 2 static files.
Cloning 23 application files. Deploying: Uploading 3 files. Uploaded 1 files. Uploaded 2 files. Uploaded 3 files. Initializing precompilation... Sending batch containing 3 file(s) totaling 4KB. Deploying new version. Closing update: new version is ready to start serving.
Uploading index definitions.
Deployment completed successfully
Now, let’s verify the GAE dashboard and verify the status of the newly deployed application, as shown in Figure 11.
Let’s run the application as shown in Figure 12.
References
[1] http://en.wikipedia.org/wiki/Google_App_Engine [2] https://developers.google.com/appengine/docs The author is a Technical Lead at iGate Global Solutions Limited. He is in the Cloud Services Group and loves to write about new technologies. Blog: http://clean-clouds.com