public class JpyBasicDao<T, K> extends BasicDAO<T, K> implements IJpyBasicDao {
private static final Log log = LogFactory.getLog(JpyBasicDao.class);
protected JpyBasicDao(Mongo mongo, Morphia morphia, String dbName, String username, String password, boolean isAuthenticated) {
super(new DatastoreImpl(morphia, mongo, dbName));
if (isAuthenticated) {
if (!this.ds.getDB().isAuthenticated() && !this.ds.getDB().authenticate(username, password.toCharArray())) {
throw new RuntimeException("MongoDB authentication failed: " + dbName);
}
}