{
String uri = p.getProperty(URI_PROPERTY);
if (uri == null)
{
throw new ConfigurationException("Please define a MongoDB URI for property: " + URI_PROPERTY);
}
MongoClientURI mongoUri = new MongoClientURI(uri);
dbName = mongoUri.getDatabase();
try
{
client = new MongoClient(mongoUri);
}
catch (UnknownHostException e)
{
throw new ConfigurationException(e);
}
}