// Path: modules/common/app/edu/berkeley/ground/common/exception/GroundException.java
// public class GroundException extends Exception {
// 
//   private static final long serialVersionUID = 1L;
// 
//   private final String message;
//   private final ExceptionType exceptionType;
// 
//   public enum ExceptionType {
//     DB("Database Exception:", "%s"),
//     ITEM_NOT_FOUND("GroundItemNotFoundException", "No %s \'%s\' found."),
//     VERSION_NOT_FOUND("GroundVersionNotFoundException", "No %s \'%s\' found."),
//     ITEM_ALREADY_EXISTS("GroundItemAlreadyExistsException", "%s %s already exists."),
//     OTHER("GroundException", "%s");
// 
//     String name;
//     String description;
// 
//     ExceptionType(String name, String description) {
//       this.name = name;
//       this.description = description;
//     }
// 
//     public String format(String... values) {
//       return String.format(this.description, values);
//     }
//   }
// 
//   public GroundException(ExceptionType exceptionType, String... values) {
//     this.exceptionType = exceptionType;
//     this.message = this.exceptionType.format(values);
//   }
// 
//   public GroundException(Exception exception) {
//     this.exceptionType = ExceptionType.OTHER;
//     this.message = this.exceptionType.format(exception.getMessage());
//   }
// 
//   @Override
//   public String getMessage() {
//     return this.message;
//   }
// 
//   public ExceptionType getExceptionType() {
//     return this.exceptionType;
//   }
// }


import edu.berkeley.ground.common.exception.GroundException;
import java.time.Clock;
import java.time.Instant;
import java.util.concurrent.CompletableFuture;
import javax.inject.Inject;
import javax.inject.Singleton;
import play.Logger;
import play.api.Configuration;
import play.db.Database;
import play.inject.ApplicationLifecycle;
package edu.berkeley.ground.postgres.start;


@Singleton
public class ApplicationStart {

  private final Instant start;

  @Inject
  public ApplicationStart(Clock clock, ApplicationLifecycle appLifecycle, final Configuration configuration, final Database dbSource)
    throws GroundException {

    this.start = clock.instant();
    Logger.info("Ground Postgres: Starting application at " + this.start);

// Path: modules/common/app/edu/berkeley/ground/common/exception/GroundException.java
// public class GroundException extends Exception {
// 
//   private static final long serialVersionUID = 1L;
// 
//   private final String message;
//   private final ExceptionType exceptionType;
// 
//   public enum ExceptionType {
//     DB("Database Exception:", "%s"),
//     ITEM_NOT_FOUND("GroundItemNotFoundException", "No %s \'%s\' found."),
//     VERSION_NOT_FOUND("GroundVersionNotFoundException", "No %s \'%s\' found."),
//     ITEM_ALREADY_EXISTS("GroundItemAlreadyExistsException", "%s %s already exists."),
//     OTHER("GroundException", "%s");
// 
//     String name;
//     String description;
// 
//     ExceptionType(String name, String description) {
//       this.name = name;
//       this.description = description;
//     }
// 
//     public String format(String... values) {
//       return String.format(this.description, values);
//     }
//   }
// 
//   public GroundException(ExceptionType exceptionType, String... values) {
//     this.exceptionType = exceptionType;
//     this.message = this.exceptionType.format(values);
//   }
// 
//   public GroundException(Exception exception) {
//     this.exceptionType = ExceptionType.OTHER;
//     this.message = this.exceptionType.format(exception.getMessage());
//   }
// 
//   @Override
//   public String getMessage() {
//     return this.message;
//   }
// 
//   public ExceptionType getExceptionType() {
//     return this.exceptionType;
//   }
// }


// Path: modules/postgres/app/edu/berkeley/ground/postgres/start/ApplicationStart.java
import edu.berkeley.ground.common.exception.GroundException;
import java.time.Clock;
import java.time.Instant;
import java.util.concurrent.CompletableFuture;
import javax.inject.Inject;
import javax.inject.Singleton;
import play.Logger;
import play.api.Configuration;
import play.db.Database;
import play.inject.ApplicationLifecycle;

package edu.berkeley.ground.postgres.start;


@Singleton
public class ApplicationStart {

  private final Instant start;

  @Inject
  public ApplicationStart(Clock clock, ApplicationLifecycle appLifecycle, final Configuration configuration, final Database dbSource)
    throws GroundException {

    this.start = clock.instant();
    Logger.info("Ground Postgres: Starting application at " + this.start);

    Logger.info("Queries will Cache for {} seconds.", configuration.underlying().getString("ground.cache.expire.secs"));