MongoOptions mo = null;
MongoDBSchemaMetadata metadata = MongoDBPropertyReader.msmd;
ClientProperties cp = metadata != null ? metadata.getClientProperties() : null;
if (cp != null)
{
DataStore dataStore = metadata != null ? metadata.getDataStore() : null;
List<Server> servers = dataStore != null && dataStore.getConnection() != null ? dataStore.getConnection()
.getServers() : null;
if (servers != null && !servers.isEmpty())
{
for (Server server : servers)
{
addrs.add(new ServerAddress(server.getHost().trim(), Integer.parseInt(server.getPort().trim())));
}
mongo = new Mongo(addrs);
}
else
{
logger.info("Connecting to mongodb at " + contactNode + " on port " + defaultPort);
mongo = new Mongo(contactNode, Integer.parseInt(defaultPort));
}
mo = mongo.getMongoOptions();
Properties p = dataStore != null && dataStore.getConnection() != null ? dataStore.getConnection()
.getProperties() : null;
PopulateMongoOptions.populateMongoOptions(mo, p);
}
else