package edu.mit.csail.db.ml.main;

import edu.mit.csail.db.ml.conf.ModelDbConfig;
import edu.mit.csail.db.ml.server.ModelDbServer;
import modeldb.ModelDBService;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TProtocolFactory;
import org.apache.thrift.server.TThreadPoolServer;
import org.apache.thrift.transport.TFramedTransport;
import org.apache.thrift.transport.TServerSocket;
import org.apache.thrift.transport.TServerTransport;
import org.apache.thrift.transport.TTransportFactory;

public class Main {
  public static void main(String[] args) throws Exception {
    ModelDbConfig config = ModelDbConfig.parse(args);
    try {
      TServerTransport transport = new TServerSocket(config.thriftPort);
      TProtocolFactory protocolFactory = new TBinaryProtocol.Factory();
      TTransportFactory transportFactory = new TFramedTransport.Factory();
      TThreadPoolServer.Args serverArgs = new TThreadPoolServer.Args(transport)
        .processor(new ModelDBService.Processor<ModelDbServer>(new ModelDbServer(
          config.dbUser,
          config.dbPassword,
          config.jbdcUrl,
          config.dbType
        )))
        .protocolFactory(protocolFactory)
        .transportFactory(transportFactory)
        .minWorkerThreads(1)
        .maxWorkerThreads(100);
      TThreadPoolServer server = new TThreadPoolServer(serverArgs);

      System.out.printf("Starting the simple server on port %d...\n", config.thriftPort);
      server.serve();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
@@ -524,87 +524,404 @@
 y;%0A%0A
-public class Main %7B%0A  public static void main(String%5B%5D args) throws Exception %7B
+/**%0A * Main entry point of of the ModelDB Server.%0A *%0A * When you execute this file, you can include the following command line arguments:%0A * (optional) --conf %5Bpath_to_conf_file%5D%0A */%0Apublic class Main %7B%0A  public static void main(String%5B%5D args) throws Exception %7B%0A    // Read the configuration. This uses the default configuration if no configuration is given in the%0A    // command line arguments.
 %0A   
@@ -970,16 +970,54 @@
 e(args);
+%0A%0A    // Attempt to launch the server.
 %0A    try
@@ -1087,24 +1087,62 @@
 thriftPort);
+%0A%0A      // We use the binary protocol.
 %0A      TProt
@@ -1268,32 +1268,135 @@
 sport.Factory();
+%0A%0A      // Create a multi-threaded server. Process requests with an instance of%0A      // ModelDbServer.
 %0A      TThreadPo
@@ -1870,24 +1870,52 @@
 rverArgs);%0A%0A
+      // Launch the server.%0A
       System

Comment Main file for server