Java Reference
In-Depth Information
*/
public String getWebsite() {
return website;
}
/**
* @param website the website to set
*/
public void setWebsite(String website) {
this.website = website;
}
}
Like any datastore, you need to create a connection to fetch data. To obtain a
connection to Bigtable you need to obtain an instance of the EntityManagerFactory .
The implementation is pretty straightforward, but like your JDO example, you want
to wrap this into a singleton due to the high connection overhead. Use the code in
Listing 4-21 to create the EMF class.
Listing 4-21. The EMF singleton
package com.appirio;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
public class EMF {
private static final EntityManagerFactory emf =
Persistence.createEntityManagerFactory("transactions-optional");
public static EntityManagerFactory get() {
return emf;
}
private EMF() {
}
}
The last bit of code you need to write for your application will implement the
Gateway class that GraniteDS uses as the remoting endpoint. The Gateway object
in Listing 4-22 contains the public methods that the Flex front end calls via the
RemoteObject tag in main.mxml. Notice that you are not doing any special type of
casting for the Flex front end as GraniteDS takes care of that for you.
 
Search WWH ::




Custom Search