Java Reference
In-Depth Information
Repeat the previous step to create Java classes called , , and . Each of these has a specific purpose in the
The ImageObject class defines the attributes that you'll store for
each image you upload in the App Engine data store.
The ImageSource servlet renders your images back to the browser
after retrieving them from the data store.
The ImageTransform servlet does the processing of the POST
request and stores the files in the data store.
The PMF class is a PersistanceManager class similar to the one
discussed in Chapter 7.
Writing the ImageObject Class
Starting with the ImageObject class, copy the code from Listing 8-6 to .
This code defines three fields in the data store where you can pass through information
about your image requests.
The first, id , is the primary key of type Long.
The second, name , will store the name of the image file in a string. In
this case, this will be the file name.
The third, ImageObject , is of type
api.datastore.Blob . This field will contain a byte array of your
image's source file.
Listing 8-6.
package com.kyleroche.gaeservices;
import java.util.Date;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class ImageObject {
Search WWH ::

Custom Search