// Path: src/java/main/br/ufpe/cin/groundhog/GitHubEntity.java
// public abstract class GitHubEntity {
// 	
// 	/**
// 	 * Returns the Entity's API URL
// 	 * @return a String 
// 	 */
// 	public abstract String getURL();
// }


import java.net.UnknownHostException;
import org.mongodb.morphia.Datastore;
import org.mongodb.morphia.Morphia;
import br.ufpe.cin.groundhog.GitHubEntity;
import com.mongodb.MongoClient;
package br.ufpe.cin.groundhog.database;





/**
 * This class represents the database interface for Groundhog data persistence via MongoDB
 * Read more at https://github.com/spgroup/groundhog#database-support
 * 
 * @author Rodrigo Alves
 * 
 */
public class GroundhogDB {
	private final String dbName;
	private final MongoClient mongo;
    private final Datastore datastore;
    
	public GroundhogDB(String host, String dbName) throws UnknownHostException {
		this.dbName = dbName;
		this.mongo = new MongoClient(host);
		this.datastore = new Morphia().createDatastore(this.mongo, dbName);
	}
	
	public GroundhogDB(MongoClient mongo, String dbName) throws UnknownHostException {
		this.dbName = dbName;
		this.mongo = null;
		this.datastore = new Morphia().createDatastore(mongo, dbName);
	}
	
// Path: src/java/main/br/ufpe/cin/groundhog/GitHubEntity.java
// public abstract class GitHubEntity {
// 	
// 	/**
// 	 * Returns the Entity's API URL
// 	 * @return a String 
// 	 */
// 	public abstract String getURL();
// }


// Path: src/java/main/br/ufpe/cin/groundhog/database/GroundhogDB.java
import java.net.UnknownHostException;
import org.mongodb.morphia.Datastore;
import org.mongodb.morphia.Morphia;
import br.ufpe.cin.groundhog.GitHubEntity;
import com.mongodb.MongoClient;

package br.ufpe.cin.groundhog.database;





/**
 * This class represents the database interface for Groundhog data persistence via MongoDB
 * Read more at https://github.com/spgroup/groundhog#database-support
 * 
 * @author Rodrigo Alves
 * 
 */
public class GroundhogDB {
	private final String dbName;
	private final MongoClient mongo;
    private final Datastore datastore;
    
	public GroundhogDB(String host, String dbName) throws UnknownHostException {
		this.dbName = dbName;
		this.mongo = new MongoClient(host);
		this.datastore = new Morphia().createDatastore(this.mongo, dbName);
	}
	
	public GroundhogDB(MongoClient mongo, String dbName) throws UnknownHostException {
		this.dbName = dbName;
		this.mongo = null;
		this.datastore = new Morphia().createDatastore(mongo, dbName);
	}
	
	public static void query(GitHubEntity entity, String params) {