A guide to create a simple Java application and upload it to the Google Cloud Platform with Google App Engine. This presentation covers usage of persistence API with both Google Cloud SQL and Google Cloud Datastore.
2. About me
Linked[in]: ua.linkedin.com/in/invaa/
e-mail: alex@zamkovyi.name
3. Google App Engine
PaaS
264k websites (258k is active)
URL: http://trends.builtwith.com/hosting/Google-App-
Engine
Coca-cola, Ubisoft, Rovio, BestBuy, Sony Music, ...
URL: https://cloud.google.com/customers/
4. Demo
Tic Tac Toe using Google Endpoints
Features:
API
Web frontend
Android client
Deployed:
https://cloudendpointstic.appspot.com
Sources:
https://github.com/GoogleCloudPlatform
5. Plan
Get to know the Google App Engine (GAE) while making
a simple jQuery Calendar (aka “Google Calendar killer”)
and put the app in the Google Cloud.
6.
7. Calendar app
Events with persistence in the Google Cloud
Start
End
Title
Description
Color
Attenders
Add events
Move events
8. Requirements and Prerequisites
JDK 1.7 (recommended)
Apache Maven 3.1+
MySQL 5+ (for local dev server)
Google account
Application ID
IDE
More:
https://cloud.google.com/appengine/docs/java/gettingstarte
d/setup
9. TODO
V1: Project creation and structure
V2: Spring MVC
V3: View with jQuery Calendar
V4: Persistence with Cloud SQL
V5: Persistence with Cloud Datastore
V6: Attenders and colors
V7: update events on drop
More: https://github.com/invaa/CloudCalendar
13. v1. Project structure
You'll add your own application
Java classes to src/main/java/...
You'll configure your application
using the
file src/main/webapp/WEB-INF/
appengine.web.xml
You'll configure your application
deployment using the
file src/main/webapp/WEB-INF/
web.xml
15. The Java Development Server
jetty-6.1.x (built-in)
The development web server simulates the App Engine
Java runtime environment and all of its services,
including the datastore
More:
https://cloud.google.com/appengine/docs/java/tools/
devserver
51. v7. Update on drop
eventDrop: function (event, delta, revertFunc) {
//update in db
$.getJSON("${pageContext.request.contextPath}/updateEventOnDrop",
{
id: event.id,
start: event.start.format()
},
function (data) {
})
.done(function () {
})
.fail(function () {
})
.complete(function () {
});
}
52. An App Engine application cannot
write to the filesystem. Applications must use the App
Engine datastore for storing persistent data. Reading
from the filesystem is allowed, and all application files
uploaded with the application are available.
respond slowly. A web request to an application must
be handled within a few seconds. Processes that take a
very long time to respond are terminated to avoid
overloading the web server.
make other kinds of system calls.
53. JRE White list
https://cloud.google.com/appengine/docs/java/jrewhi
telist
54. web.xml Features Not Supported
App Engine supports the <load-on-startup> element for servlet
declarations. However, the load actually occurs during the first
request handled by the web server instance, not prior to it.
Some deployment descriptor elements can take a human
readable display name, description and icon for use in IDEs. App
Engine doesn't use these, and ignores them.
App Engine doesn't support JNDI environment variables (<env-entry>).
App Engine doesn't support EJB resources (<resource-ref>).
Notification of the destruction of servlets, servlet context, or
filters is not supported.
The <distributable> element is ignored.
Servlet scheduling with <run-at> is not supported.