// import static javax.measure.unit.SI.KILOGRAM;
// import javax.measure.quantity.Mass;
// import org.jscience.physics.model.RelativisticModel;
// import org.jscience.physics.amount.Amount;
//
import java.sql.*;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Map;

import java.net.UnknownHostException;
import java.net.URI;
import java.net.URISyntaxException;

import static spark.SparkBase.staticFileLocation;
import static spark.Spark.*;
import spark.template.freemarker.FreeMarkerEngine;
import spark.ModelAndView;
import static spark.Spark.get;

import com.mongodb.*;

import com.heroku.sdk.jdbc.DatabaseUrl;

import static spark.Spark.*;

import routes.*;
import com.todoapp.*;

public class Main {

  public static void main(String[] args) throws Exception {
        //port(Integer.valueOf(System.getenv("10396")));
        staticFileLocation("/public");
        new TodoResource(new TodoService(mongo()));
    }
  
    private static DB mongo() throws Exception {
        MongoClientURI uri = new MongoClientURI(System.getenv("MONGOHQ_URL"));
        
        //String host = "candidate.67.mongolayer.com";
        
//        if (host == null) {
//            MongoClient mongoClient = new MongoClient("localhost");
//            return mongoClient.getDB("todoapp");
//        }
        
        //int port = Integer.parseInt("10396");
        String dbname = "uri.getDatabase()";
        String username = "uri.getUsername()";
        String password = "uri.getPassword()";
        MongoClientOptions mongoClientOptions = MongoClientOptions.builder().build();
        MongoClient mongoClient = new MongoClient(uri);
        mongoClient.setWriteConcern(WriteConcern.SAFE);
        DB db = mongoClient.getDB(dbname);
        try {
            db.authenticate(username, password.toCharArray());
        } catch(RuntimeException ex) {
            System.err.println("Not able to authenticate with MongoDB" + ex.getMessage());
        }finally{
            return db;
        }
    }
}

@@ -1060,14 +1060,15 @@
 ONGO
-HQ_URL
+LAB_URI
 %22));
@@ -1080,234 +1080,64 @@
     
-%0A        //String host = %22candidate.67.mongolayer.com%22;%0A        %0A//        if (host == null) %7B%0A//            MongoClient mongoClient = new MongoClient(%22localhost%22);%0A//            return mongoClient.getDB(%22todoapp%22
+MongoClient mongoClient = new MongoClient(uri
 );%0A
-//
         
 %7D%0A  
@@ -1136,66 +1136,8 @@
     
-%7D%0A        %0A        //int port = Integer.parseInt(%2210396%22);
 %0A   
@@ -1153,25 +1153,24 @@
 ng dbname = 
-%22
 uri.getDatab
@@ -1174,17 +1174,16 @@
 tabase()
-%22
 ;%0A      
@@ -1188,235 +1188,8 @@
     
-String username = %22uri.getUsername()%22;%0A        String password = %22uri.getPassword()%22;%0A        MongoClientOptions mongoClientOptions = MongoClientOptions.builder().build();%0A        MongoClient mongoClient = new MongoClient(uri);
 %0A   
@@ -1331,37 +1331,41 @@
 te(u
-sername, password.toCharArray
+ri.getUsername(), uri.getPassword
 ());

change to mongolab