You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
713 B
32 lines
713 B
package de.fd.fh.server.game;
|
|
|
|
import com.mongodb.MongoClient;
|
|
import dev.morphia.Datastore;
|
|
import dev.morphia.Key;
|
|
import dev.morphia.Morphia;
|
|
|
|
public class GameRepository
|
|
{
|
|
private final Datastore datastore;
|
|
|
|
public GameRepository()
|
|
{
|
|
System.out.println("AccessRepo");
|
|
final Morphia morphia = new Morphia();
|
|
|
|
morphia.mapPackage("de.fd.fh.server.game");
|
|
|
|
this.datastore = morphia.createDatastore(new MongoClient(), "smartwarfare");
|
|
datastore.ensureIndexes();
|
|
}
|
|
|
|
GameRepository(final Datastore datastore)
|
|
{
|
|
this.datastore = datastore;
|
|
}
|
|
|
|
public Key<Game> save(final Game access)
|
|
{
|
|
return datastore.save(access);
|
|
}
|
|
}
|