Databases Reference
In-Depth Information
Tersely Exploring the Java App Engine SDK
To get started, read the introductory tutorial, available online at http://code.google.com/
appengine/docs/java/gettingstarted/ . Programs written in Java to run on the app engine are
web applications that leverage the standard Java specifi cation like Java Servlets. The app engine
run time hosts a Java application server. The container itself is a customized implementation of the
Webtide Jetty application server.
The fundamentals of the app engine remain the same whether they are accessed from Python or Java
so repeating what has already been described would be futile. Therefore, this section jumps right in
to show a few bits about accessing the data store using the Java standards like JDO and JPA.
The DataNucleus ( www.datanucleus.org/ ) open-source app engine plug-in bridges the gap
between the Java standard persistence frameworks (in particular JDO and JPA) and the Google
Bigtable-based data store.
To set up and confi gure JDO read the online documentation at http://code.google.com/
appengine/docs/java/datastore/jdo/ . For JPA confi guration look at http://code.google
.com/appengine/docs/java/datastore/jpa/ .
The Task class from the Python example can be created as a JDO-aware plain old Java object
(POJO) like so:
package taskmanager;
Available for
download on
Wrox.com
import com.google.appengine.api.datastore.Key;
import java.util.Date;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
@PersistenceCapable
public class Task {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
@Persistent
private String name;
@Persistent
private String description;
@Persistent
private Date startDate;
@Persistent
private String status;
public Greeting(String name, String description, Date startDate,
String status) {
this.name = name;
this.description = description;