Search in sources :

Example 1 with SimpleConnector

use of com.developmentontheedge.dbms.SimpleConnector in project be5 by DevelopmentOnTheEdge.

the class Be5Mojo method init.

// /////////////////////////////////////////////////////////////////
public void init() throws MojoFailureException {
    long startTime = System.nanoTime();
    initLogging();
    if (be5Project == null) {
        if (projectPath == null)
            throw new MojoFailureException("Please specify projectPath attribute");
        getLog().info("Reading be5 project from '" + projectPath + "'...");
        be5Project = loadProject(projectPath.toPath());
        if (debug) {
            be5Project.setDebugStream(System.err);
        }
        try {
            ModuleLoader2.mergeModules(be5Project, logger);
        } catch (ProjectLoadException e) {
            e.printStackTrace();
            throw new MojoFailureException(e.getMessage());
        }
    }
    if (connectionProfileName != null) {
        be5Project.setConnectionProfileName(connectionProfileName);
    }
    BeConnectionProfile profile = be5Project.getConnectionProfile();
    if (profile != null) {
        this.be5Project.setDatabaseSystem(Rdbms.getRdbms(profile.getConnectionUrl()));
        this.connector = new SimpleConnector(Rdbms.getRdbms(profile.getConnectionUrl()).getType(), profile.getConnectionUrl(), profile.getUsername(), connectionPassword != null ? connectionPassword : profile.getPassword());
        getLog().info("Using connection " + DatabaseUtils.formatUrl(profile.getConnectionUrl(), profile.getUsername(), "xxxxx"));
    } else {
        throw new MojoFailureException("Please specify connection profile: create " + be5Project.getProjectFileStructure().getSelectedProfileFile() + " file with profile name or use -DBE5_PROFILE=...");
    }
    getLog().info(ModuleLoader2.logLoadedProject(be5Project, startTime));
}
Also used : ProjectLoadException(com.developmentontheedge.be5.metadata.exception.ProjectLoadException) BeConnectionProfile(com.developmentontheedge.be5.metadata.model.BeConnectionProfile) SimpleConnector(com.developmentontheedge.dbms.SimpleConnector) MojoFailureException(org.apache.maven.plugin.MojoFailureException)

Aggregations

ProjectLoadException (com.developmentontheedge.be5.metadata.exception.ProjectLoadException)1 BeConnectionProfile (com.developmentontheedge.be5.metadata.model.BeConnectionProfile)1 SimpleConnector (com.developmentontheedge.dbms.SimpleConnector)1 MojoFailureException (org.apache.maven.plugin.MojoFailureException)1