All Downloads are FREE. Search and download functionalities are using the official Maven repository.

au.net.causal.maven.plugins.boxdb.db.OracleFactory Maven / Gradle / Ivy

There is a newer version: 3.3
Show newest version
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);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy