Google App Engine

1,699 views

Published on

Describes the Google App Engine for Java.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,699
On SlideShare
0
From Embeds
0
Number of Embeds
31
Actions
Shares
0
Downloads
10
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Google App Engine

  1. 1. Google App Engine Anil Saldhana
  2. 2. 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
  3. 3. Google App Engine Project Install the Google Eclipse Plugin Click on the "New Web Application Project" icon Project Name: cjug, Package: cjug Uncheck "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 servlet index.html appengine-web.xml WEB-INF/logging.properties 3
  4. 4. 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
  5. 5. 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 properties Define your static and resource files (formats/includes/excludes) Mandate SSL (<ssl-enabled/>) Enable sessions (GAE uses datastore and memcache) 5
  6. 6. 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
  7. 7. Configuration: Cron based scheduler cron.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
  8. 8. Configuration: Task Queues You can use QueueFactory.getDefaultQueue() or Have a queue.xml in your WEB-INF directory Without 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
  9. 9. 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
  10. 10. Other Services Google Users Service Integrate with Google user accounts. Memcache Distributed in-memory cache Can either use JCache (JSR107) API or Low Level API. URL Fetch API Applications interact with other hosts on the internet using http or https with this API. java.net.URLConnection is supported No persistent HTTP Connections No explicit connection time outs. Mail Services Java Mail or Low Level API Send and receive emails. 10
  11. 11. Other Services XMPP Services Application can get XMPP messages from GTalk/Jabber BlobStore API Service large data objects (50MB limit) Billing required to be enabled Experimental Eg: Application users want to upload a file. An opaque blobstore key is returned. Images Java API API to deal with images - resize, crop etc 11
  12. 12. For More Information Online Documentation Google Discussion Group http://code.google.com/appengine/community.html 12

×