GAE
Introduction
Applications can be developed in Python and Java.
Java Development
You develop and upload Java applications for Google App Engine using the App Engine Java software development kit (SDK). The SDK includes software for a web server that you can run on your own computer to test your Java applications (see #Development_Environment). Google App Engine provides several useful services based on Google infrastructure, accessible by applications using libraries included with the SDK.
App Engine Java applications use the Java Servlet standard for interacting with the web server environment. An application's files, including compiled classes, JARs, static files and configuration files, are arranged in a directory structure using the WAR standard layout for Java web applications.
GAE uses Java 6.
Development Environment
Installation
- PlugIn
- Path extended to %JAVA_HOME%, to enable call to javac.exe
- port change from 8080 to 8090 in C:\Uwes\eclipse\v351\eclipse\plugins\com.google.appengine.eclipse.sdkbundle.1.3.0_1.3.0.v200912141120\appengine-java-sdk-1.3.0\config\user\ant-macros.xml
- in eclipse Run -> Run Configuration -> Web Application -> <Project> -> Port from 8888 to 8090
Eclipse Plugin
see plugins/com.google.appengine.eclipse.sdkbundle_VERSION/
Java Development Server
The App Engine Java SDK includes a development web server for testing your application on your computer. The server simulates all of the App Engine services, including a local version of the datastore, Google Accounts, and the ability to fetch URLs and send email from your computer using the App Engine APIs. The Google Plugin for Eclipse can run the server in the Eclipse debugger or you can run it from the command line.
Test
Demos
C:\Uwes\eclipse\v351\eclipse\plugins\com.google.appengine.eclipse.sdkbundle.1.3.0_1.3.0.v200912141120>appengine-java-sdk-1.3.0\bin\dev_appserver.cmd --port=8090 appengine-java-sdk-1.3.0\demos\guestbook\war
Development Process
New Project
The wizard creates a directory structure for the project, including a src/ directory for Java source files, and a war/ directory for compiled classes and other files for the application, libraries, configuration files, static files such as images and CSS, and other data files. The wizard also creates a servlet source file and two configuration files. The complete directory structure looks like this:
Guestbook/
src/
guestbook/
server/
GuestbookServlet.java
META-INF/
jdoconfig.xml
log4j.properties
logging.properties
war/
WEB-INF/
lib/
...App Engine JARs...
appengine-web.xml
web.xml
index.html
Run/Debug Project
With Eclipse, you can leave the server running in the debugger while you make changes to source code, JSPs, static files and appengine-web.xml. When you save changes to source code, Eclipse compiles the class automatically, then attempts to insert it into the running web server dynamically. In most cases, you can simply reload the page in your browser to test the new version of the code. Changes to JSPs, static files and appengine-web.xml are recognized by the development server automatically, and also take effect without restarting the server. If you change web.xml or other configuration files, you must stop and start the server for the changes to take effect.
Run
- Project Context Menu -> Run As -> Web Application or
- Project Context Menu -> Run As -> Run Configuration -> Web Application -> <Projectname>
- Browser http://localhost:<port>/<Appname>
Debug
- Project Context Menu -> Debug As -> Web Application or
- Project Context Menu -> Debug As -> Debug Configuration -> Web Application -> <Projectname>
- Browser http://localhost:<port>/<Appname>
Deploy changes
- according documentation local engine should be updated after save but doesn't work, so go to Debug Perspective, select engine context menu and use 'terminate and relaunch'
Stop Server
- switch to Debug perspective
- select application in the debug panel
- press terminate button in button bar
Specific Configuration Files
appengine-web.xml
appengine-web.xml is specific to App Engine, and is not part of the servlet standard.
<?xml version="1.0" encoding="utf-8"?> <appengine-web-app xmlns="http://appengine.google.com/ns/1.0"> <application></application> <version>1</version> </appengine-web-app>
jdoconfig.xml
Application Engine Services
Datastore
App Engine includes support for two different API standards for the datastore: Java Data Objects (JDO) and Java Persistence API (JPA). These interfaces are provided by DataNucleus Access Platform, an open source implementation of several Java persistence standards, with an adapter for the App Engine datastore.