au.net.causal.maven.plugins.boxdb.db.OracleFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of boxdb-maven-plugin Show documentation
Show all versions of boxdb-maven-plugin Show documentation
Maven plugin to start databases using Docker and VMs
package au.net.causal.maven.plugins.boxdb.db;
import java.io.IOException;
@BoxDbBundled
public class OracleFactory extends DockerDatabaseFactory
{
private static final String ORACLE_11_IMAGE_NAME = "wnameless/oracle-xe-11g:16.04";
public OracleFactory()
{
super("oracle");
}
@Override
protected void initializeDefaults(BoxConfiguration boxConfiguration)
{
if (boxConfiguration.getAdminUser() == null)
boxConfiguration.setAdminUser("system");
if (boxConfiguration.getAdminPassword() == null)
boxConfiguration.setAdminPassword("oracle");
if (boxConfiguration.getDatabaseName() == null && boxConfiguration.getDatabaseUser() != null)
boxConfiguration.setDatabaseName(boxConfiguration.getDatabaseUser());
if (boxConfiguration.getDatabaseName() == null)
boxConfiguration.setDatabaseName("app");
if (boxConfiguration.getDatabaseVersion() == null)
boxConfiguration.setDatabaseVersion("11g");
if (boxConfiguration.getDatabasePort() <= 0)
boxConfiguration.setDatabasePort(49161);
if (boxConfiguration.getDatabaseUser() == null)
boxConfiguration.setDatabaseUser(boxConfiguration.getDatabaseName());
if (boxConfiguration.getDatabasePassword() == null)
boxConfiguration.setDatabasePassword(boxConfiguration.getDatabaseUser());
super.initializeDefaults(boxConfiguration);
}
protected String dockerImageName(BoxConfiguration boxConfiguration)
throws BoxDatabaseException
{
return ORACLE_11_IMAGE_NAME;
}
@Override
protected OracleDatabase createDockerDatabase(BoxConfiguration boxConfiguration, ProjectConfiguration projectConfiguration, BoxContext context)
throws BoxDatabaseException
{
try
{
return new OracleDatabase(boxConfiguration, projectConfiguration, context, dockerImageName(boxConfiguration));
}
catch (IOException e)
{
throw new BoxDatabaseException("I/O error creating database: " + e, e);
}
}
}