Google App Engine
Click here to load reader
-
Upload
anil-saldhana -
Category
Technology
-
view
1.334 -
download
3
description
Transcript of Google App Engine
Google App Engine
Anil Saldhana
Important Stuff To Remember
Use an IDE such as Eclipse and the Google App Engine Plugin.Take a look at the JRE White List to see the API that is supported. Run the application in local mode first before deploying in the app engine.
App Engine in local mode : http://localhost:8888/_ah/admin
2
Google App Engine Project
Install the Google Eclipse PluginClick on the "New Web Application Project" iconProject Name: cjug, Package: cjugUncheck "Use Google Web Toolkit"Retain the check on "Use Google App Engine"Thats it.
You get a full fledged web application that you can run on GAE.
HelloWorld Servlet.web.xml declaring the servletindex.htmlappengine-web.xmlWEB-INF/logging.properties
3
Configuration for GAE
Deployment Descriptor : web.xml AppEngine DD: appengine-web.xml Datastore Indexes : datastore-indexes.xml Task Queues : queues.xml Scheduled Jobs : cron.xml DOS Protection: dos.xml
4
Configuration : appengine-web.xml
The main configuration file for your web application.Define your application id (<application>)Define your application version (<version>)Define your system propertiesDefine your static and resource files (formats/includes/excludes) Mandate SSL (<ssl-enabled/>)Enable sessions (GAE uses datastore and memcache)
5
Configuration : datastore-indexes.xml
The GAE uses indexes on queries made by applications.You can predefine your queries and indexes.
<?xml version="1.0" encoding="utf-8"?><datastore-indexes autoGenerate="true"> <datastore-index kind="Employee" ancestor="false"> <property name="lastName" direction="asc" /> <property name="hireDate" direction="desc" /> </datastore-index>
<datastore-index kind="Project" ancestor="false"> <property name="dueDate" direction="asc" /> </datastore-index></datastore-indexes>
6
Configuration: Cron based schedulercron.xml in WEB-INF directory
<?xml version="1.0" encoding="UTF-8"?><cronentries> <cron> <url>/recache</url> <description>Repopulate the cache every 2 minutes</description> <schedule>every 2 minutes</schedule> </cron> <cron> <url>/weeklyreport</url> <description>Mail out a weekly report</description> <schedule>every monday 08:30</schedule> <timezone>America/New_York</timezone> </cron></cronentries>
7
Configuration: Task Queues You can use QueueFactory.getDefaultQueue() or Have a queue.xml in your WEB-INF directoryWithout uploading entire app, you can update config./appengine-java-sdk/bin/appcfg.sh update_queues myapp/war
<queue-entries> <queue> <name>default</name> <rate>1/s</rate> </queue> <queue> <name>mail-queue</name> <rate>2000/d</rate> <bucket-size>10</bucket-size> </queue> <queue> <name>background-processing</name> <rate>5/s</rate> </queue>
</queue-entries>
8
Configuration : DOS Protection dos.xml in WEB-INF directory
<?xml version="1.0" encoding="UTF-8"?><blacklistentries> <blacklist> <subnet>1.2.3.4</subnet> <description>a single IP address</description> </blacklist> <blacklist> <subnet>1.2.3.4/24</subnet> <description>an IPv4 subnet</description> </blacklist> <blacklist> <subnet>abcd::123:4567</subnet> <description>an IPv6 address</description> </blacklist> <blacklist> <subnet>abcd::123:4567/48</subnet> <description>an IPv6 subnet</description> </blacklist></blacklistentries>
9
Other ServicesGoogle Users Service
Integrate with Google user accounts.Memcache
Distributed in-memory cacheCan either use JCache (JSR107) API or Low Level API.
URL Fetch APIApplications interact with other hosts on the internet using http or https with this API.java.net.URLConnection is supported
No persistent HTTP ConnectionsNo explicit connection time outs.
Mail ServicesJava Mail or Low Level APISend and receive emails.
10
Other ServicesXMPP Services
Application can get XMPP messages from GTalk/JabberBlobStore API
Service large data objects (50MB limit)Billing required to be enabledExperimentalEg: Application users want to upload a file. An opaque blobstore key is returned.
Images Java APIAPI to deal with images - resize, crop etc
11
For More Information
Online DocumentationGoogle Discussion Group
http://code.google.com/appengine/community.html
12