Package io.ebean.docker.commands
Class BaseConfig
- java.lang.Object
-
- io.ebean.docker.commands.BaseConfig
-
- All Implemented Interfaces:
ContainerConfig
- Direct Known Subclasses:
DbConfig,ElasticConfig,RedisConfig
public abstract class BaseConfig extends Object implements ContainerConfig
Configuration for an DBMS like Postgres, MySql, Oracle, SQLServer
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearStopMode()Clear the stopMode when detect already running.StringcontainerName()Return the container name.ConnectioncreateAdminConnection()Return a DB connection using the admin user.ConnectioncreateConnection()Return a Connection to the database (make sure you close it).ConnectioncreateConnectionNoSchema()Return a DB connection without schema (as it maybe is not created yet).intgetAdminInternalPort()intgetAdminPort()StringgetCharacterSet()StringgetCollation()StringgetDocker()StringgetImage()intgetInternalPort()intgetMaxReadyAttempts()intgetPort()StartModegetStartMode()StopModegetStopMode()booleanisDefaultCollation()booleanisExplicitCollation()booleanisStopModeNone()StringjdbcAdminUrl()Return a DB connection url for the admin database user.StringjdbcUrl()Return a DB connection url or null if not a database container.Stringplatform()Return the type of container.BaseConfigsetAdminInternalPort(int adminInternalPort)Set the internal admin (to the container) port.BaseConfigsetAdminPort(int adminPort)Set the exposed admin port.BaseConfigsetCharacterSet(String characterSet)Set the character set to use.BaseConfigsetCollation(String collation)Set the collation to use.BaseConfigsetContainerName(String containerName)Set the container name.BaseConfigsetDocker(String docker)Set the docker command to use (defaults to 'docker').BaseConfigsetImage(String image)Set the docker image to use.BaseConfigsetInternalPort(int internalPort)Set the internal (to the container) port.BaseConfigsetMaxReadyAttempts(int maxReadyAttempts)Set the max attempts to wait for DB ready.BaseConfigsetPort(int port)Set the exposed port.BaseConfigsetProperties(Properties properties)Load configuration from properties.voidsetShutdownMode(StopMode shutdownMode)Set the shutdown hook mode to automatically stop/remove the container on JVM shutdown.voidsetStartMode(StartMode startMode)Set the start mode.voidsetStopMode(StopMode stopMode)Set the stop mode used when stop() is called.StopModeshutdownMode()StringstartDescription()Return a description of the configuration.StringstopDescription()Return a good description for stopping the container typically for logging.Stringversion()Return the image version.
-
-
-
Method Detail
-
startDescription
public String startDescription()
Return a description of the configuration.- Specified by:
startDescriptionin interfaceContainerConfig
-
stopDescription
public String stopDescription()
Description copied from interface:ContainerConfigReturn a good description for stopping the container typically for logging.- Specified by:
stopDescriptionin interfaceContainerConfig
-
platform
public String platform()
Description copied from interface:ContainerConfigReturn the type of container. postgres, mysql, elastic etc.- Specified by:
platformin interfaceContainerConfig
-
containerName
public String containerName()
Description copied from interface:ContainerConfigReturn the container name.- Specified by:
containerNamein interfaceContainerConfig
-
version
public String version()
Description copied from interface:ContainerConfigReturn the image version.- Specified by:
versionin interfaceContainerConfig
-
setStartMode
public void setStartMode(StartMode startMode)
Description copied from interface:ContainerConfigSet the start mode. One of create, dropCreate, or container [only].- Specified by:
setStartModein interfaceContainerConfig
-
setStopMode
public void setStopMode(StopMode stopMode)
Description copied from interface:ContainerConfigSet the stop mode used when stop() is called.- Specified by:
setStopModein interfaceContainerConfig
-
setShutdownMode
public void setShutdownMode(StopMode shutdownMode)
Description copied from interface:ContainerConfigSet the shutdown hook mode to automatically stop/remove the container on JVM shutdown.- Specified by:
setShutdownModein interfaceContainerConfig
-
createConnection
public Connection createConnection() throws SQLException
Return a Connection to the database (make sure you close it).- Specified by:
createConnectionin interfaceContainerConfig- Throws:
SQLException
-
createConnectionNoSchema
public Connection createConnectionNoSchema() throws SQLException
Description copied from interface:ContainerConfigReturn a DB connection without schema (as it maybe is not created yet).- Specified by:
createConnectionNoSchemain interfaceContainerConfig- Throws:
SQLException
-
createAdminConnection
public Connection createAdminConnection() throws SQLException
Description copied from interface:ContainerConfigReturn a DB connection using the admin user.- Specified by:
createAdminConnectionin interfaceContainerConfig- Throws:
SQLException
-
jdbcUrl
public String jdbcUrl()
Description copied from interface:ContainerConfigReturn a DB connection url or null if not a database container.- Specified by:
jdbcUrlin interfaceContainerConfig
-
jdbcAdminUrl
public String jdbcAdminUrl()
Description copied from interface:ContainerConfigReturn a DB connection url for the admin database user.- Specified by:
jdbcAdminUrlin interfaceContainerConfig
-
setProperties
public BaseConfig setProperties(Properties properties)
Load configuration from properties.
-
setContainerName
public BaseConfig setContainerName(String containerName)
Set the container name.
-
setPort
public BaseConfig setPort(int port)
Set the exposed port.
-
setInternalPort
public BaseConfig setInternalPort(int internalPort)
Set the internal (to the container) port.
-
setAdminPort
public BaseConfig setAdminPort(int adminPort)
Set the exposed admin port.
-
setAdminInternalPort
public BaseConfig setAdminInternalPort(int adminInternalPort)
Set the internal admin (to the container) port.
-
setImage
public BaseConfig setImage(String image)
Set the docker image to use.
-
setCharacterSet
public BaseConfig setCharacterSet(String characterSet)
Set the character set to use.
-
setCollation
public BaseConfig setCollation(String collation)
Set the collation to use.
-
setMaxReadyAttempts
public BaseConfig setMaxReadyAttempts(int maxReadyAttempts)
Set the max attempts to wait for DB ready.
-
setDocker
public BaseConfig setDocker(String docker)
Set the docker command to use (defaults to 'docker').
-
getPort
public int getPort()
-
getInternalPort
public int getInternalPort()
-
getAdminPort
public int getAdminPort()
-
getAdminInternalPort
public int getAdminInternalPort()
-
getStartMode
public StartMode getStartMode()
-
getStopMode
public StopMode getStopMode()
-
getMaxReadyAttempts
public int getMaxReadyAttempts()
-
shutdownMode
public StopMode shutdownMode()
-
getCharacterSet
public String getCharacterSet()
-
getCollation
public String getCollation()
-
isExplicitCollation
public boolean isExplicitCollation()
-
isDefaultCollation
public boolean isDefaultCollation()
-
isStopModeNone
public boolean isStopModeNone()
-
clearStopMode
public void clearStopMode()
Clear the stopMode when detect already running.
-
-