public class DockerizedDataSource
extends org.springframework.jdbc.datasource.DelegatingDataSource
| Modifier and Type | Field and Description |
|---|---|
static String |
CONTAINER_NAME_PREFIX |
protected com.spotify.docker.client.messages.ContainerInfo |
containerInfo |
protected com.spotify.docker.client.DockerClient |
docker |
protected DockerizedDatabase |
type |
| Constructor and Description |
|---|
DockerizedDataSource(DockerizedDatabase type) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkStaleContainers() |
protected void |
createContainer() |
void |
destroyContainer() |
String |
getDatabaseUrl() |
void |
startDatabseInContainer() |
protected void |
waitForDatabaseStart(String url,
String username,
String password) |
public static final String CONTAINER_NAME_PREFIX
protected final DockerizedDatabase type
protected final com.spotify.docker.client.DockerClient docker
protected com.spotify.docker.client.messages.ContainerInfo containerInfo
public DockerizedDataSource(DockerizedDatabase type) throws Exception
Exception@PostConstruct public void startDatabseInContainer() throws Exception
Exception@PreDestroy public void destroyContainer() throws Exception
Exceptionprotected void checkStaleContainers()
throws com.spotify.docker.client.exceptions.DockerException,
InterruptedException
com.spotify.docker.client.exceptions.DockerExceptionInterruptedExceptionprotected void createContainer()
throws com.spotify.docker.client.exceptions.DockerException,
InterruptedException,
IOException
com.spotify.docker.client.exceptions.DockerExceptionInterruptedExceptionIOExceptionprotected void waitForDatabaseStart(String url, String username, String password) throws InterruptedException, SQLException
InterruptedExceptionSQLExceptionpublic String getDatabaseUrl()
Copyright © 2016 TouK. All rights reserved.