panda.dao.gae.GaeDaoClient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of panda-core Show documentation
Show all versions of panda-core Show documentation
Panda Core is the core module of Panda Framework, it contains commonly used utility classes similar to apache-commons.
package panda.dao.gae;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.google.appengine.api.datastore.DatastoreServiceFactory;
import panda.dao.DB;
import panda.dao.Dao;
import panda.dao.DaoClient;
import panda.dao.DatabaseMeta;
public class GaeDaoClient extends DaoClient {
private static final DatabaseMeta meta = new DatabaseMeta(DB.GAE, "Google App Engine", "1.0");
private static GaeDaoClient instance = new GaeDaoClient();
public static GaeDaoClient i() {
return instance;
}
private Map, GaeConverter> gcs;
private GaeDaoClient() {
this.name = "GAE";
gcs = new ConcurrentHashMap, GaeConverter>();
}
@Override
public DatabaseMeta getDatabaseMeta() {
return meta;
}
@Override
public Dao getDao() {
return new GaeDao(this, DatastoreServiceFactory.getDatastoreService());
}
public void registerConverter(Class> cls, GaeConverter gc) {
gcs.put(cls, gc);
}
public GaeConverter findConverter(Class> cls) {
return gcs.get(cls);
}
}