All Downloads are FREE. Search and download functionalities are using the official Maven repository.

panda.dao.gae.GaeDaoClient Maven / Gradle / Ivy

Go to download

Panda Core is the core module of Panda Framework, it contains commonly used utility classes similar to apache-commons.

There is a newer version: 1.8.0
Show newest version
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);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy