001package io.ebean.docker.container; 002 003import io.ebean.docker.commands.StartMode; 004import io.ebean.docker.commands.StopMode; 005 006import java.sql.Connection; 007import java.sql.SQLException; 008 009/** 010 * Configuration details associated with a container. 011 */ 012public interface ContainerConfig { 013 014 /** 015 * Return the type of container. postgres, mysql, elastic etc. 016 */ 017 String platform(); 018 019 /** 020 * Return the container name. 021 */ 022 String containerName(); 023 024 /** 025 * Return the image version. 026 */ 027 String version(); 028 029 /** 030 * Return a DB connection url or null if not a database container. 031 */ 032 String jdbcUrl(); 033 034 /** 035 * Return a DB connection url for the admin database user. 036 */ 037 String jdbcAdminUrl(); 038 039 /** 040 * Return a DB connection. 041 */ 042 Connection createConnection() throws SQLException; 043 044 /** 045 * Return a DB connection without schema (as it maybe is not created yet). 046 */ 047 Connection createConnectionNoSchema() throws SQLException; 048 049 /** 050 * Return a DB connection using the admin user. 051 */ 052 Connection createAdminConnection() throws SQLException; 053 054 /** 055 * Set the start mode. One of create, dropCreate, or container [only]. 056 */ 057 void setStartMode(StartMode startMode); 058 059 /** 060 * Set the stop mode used when stop() is called. 061 */ 062 void setStopMode(StopMode stopMode); 063 064 /** 065 * Set the shutdown hook mode to automatically stop/remove the container on JVM shutdown. 066 */ 067 void setShutdownMode(StopMode shutdownHookMode); 068 069 /** 070 * Return a good description for starting the container typically for logging. 071 */ 072 String startDescription(); 073 074 /** 075 * Return a good description for stopping the container typically for logging. 076 */ 077 String stopDescription(); 078}